@eslint-sukka/eslint-plugin-sukka-full 8.14.1 → 8.14.2
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 +21 -21
- package/package.json +4 -3
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
let e,t,r,n;"use strict";var o=Map,a=RegExp,i=Set,s=WeakMap,l=WeakSet;var u,p,c=require("eslint-plugin-sukka"),d=require("node:vm"),m=require("url"),f=require("path"),g=require("fs"),y=require("vm"),h=require("worker_threads"),x=require("node:assert/strict"),b=require("node:util/types"),E=require("node:path"),v=require("node:util"),C=require("eslint/use-at-your-own-risk"),D="u">typeof document?document.currentScript:null;function S(e,t){if("string"==typeof t){let e=t;t=t=>t.type===e}for(;e;){if(t(e))return e;e=e.parent}}function T(e){return e?.type==="Identifier"||e?.type==="PrivateIdentifier"}function A(e){return e?.type==="MemberExpression"}function w(e){return e?.type==="AwaitExpression"}function k(e,t){return!!T(e)&&("function"==typeof t?t(e.name):Array.isArray(t)?t.includes(e.name):e.name===t)}function I(e,t){return e?.type==="Literal"&&(Array.isArray(t)?t.includes(e.value):"string"==typeof e.value&&t instanceof RegExp?t.test(e.value):e.value===t)}function j(e){return!!e&&["ArrowFunctionExpression","FunctionDeclaration","FunctionExpression"].includes(e.type)}function F(e,t){return e?.type==="Identifier"&&t?.type===e.type&&e.name===t.name}function B({create:e,defaultOptions:t,meta:r,name:n}){return r.docs&&!r.docs.url&&(r.docs.url=new URL(n,"https://dimensiondev.github.io/eslint-plugin/src/rules/").href),{create(r){var n,o;let a,s=(n=t,o=r.options,a=structuredClone(n),null==o||a.forEach((e,t)=>{if(void 0!==o[t]){let r=o[t];"object"!=typeof r||Array.isArray(r)||"object"!=typeof e||Array.isArray(e)?a[t]=r:a[t]=function e(t={},r={}){return Object.fromEntries([...new i([...Object.keys(t),...Object.keys(r)])].map(n=>{let o=n in t,a=n in r,i=t[n],s=r[n];return[n,o&&a?"object"!=typeof i||Array.isArray(i)||"object"!=typeof s||Array.isArray(s)?s:e(i,s):o?i:s]}))}(e,r)}}),a);return e(r,s)},defaultOptions:t,meta:r,name:n}}function R(e){if(!e?.program)throw Error("see https://typescript-eslint.io/docs/linting/type-linting")}var P=B({name:"array/no-unneeded-flat-map",meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow `Array#flatMap((x) => x)` when simpler alternatives exist",recommended:"stylistic"},schema:[],messages:{invalid:"Disallow simple `Array#flatMap()` in array"}},defaultOptions:[],create:e=>({CallExpression(t){var r;if("MemberExpression"!==t.callee.type||!k(t.callee.property,"flatMap")||!(j(r=t.arguments[0])&&1===r.params.length&&"Identifier"===r.params[0].type&&r.body&&(F(r.params[0],r.body)||"BlockStatement"===r.body.type&&1===r.body.body.length&&"ReturnStatement"===r.body.body[0].type&&F(r.params[0],r.body.body[0].argument))))return;let{property:n}=t.callee;e.report({node:t,messageId:"invalid",*fix(e){yield e.replaceText(n,"flat"),yield*t.arguments.map(t=>e.remove(t))}})}})});let L=new i(["href","pathname","search","hash","origin"]);var N=B({name:"browser/prefer-location-assign",meta:{type:"suggestion",fixable:"code",docs:{description:"Prefer `location.assign(...)` over `location.*`",recommended:"stylistic"},schema:[],messages:{instead:"Use `location.assign(...)` instead of `location.{{name}}`"}},defaultOptions:[],create:e=>({AssignmentExpression(t){let r=function(e,t){if(k(e,t))return e;for(;A(e);){if(k(e.property,t))return e;e=e.object}}(t.left,"location");if(!r)return;let n=$(r.parent);e.report({node:t,messageId:"instead",data:{name:n},fix:function(e,t,r){let n=$(t.parent);if(L.has(n??"href"))return n=>n.replaceText(r,`${e.getText(t)}.assign(${e.getText(r.right)})`)}(e.sourceCode,r,t)})}})});function $(e){if(A(e)&&T(e.property))return e.property.name}var M=B({name:"jsx/no-template-literal",meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow use template-literal in JSX",recommended:"stylistic"},schema:[],messages:{invalid:"Disallow use template-literal in JSX"}},defaultOptions:[],create:e=>({JSXExpressionContainer(t){if("TemplateLiteral"!==t.expression.type||t.parent?.type==="JSXAttribute")return;let{expression:r}=t;e.report({node:t,messageId:"invalid",fix(n){let o=[...r.expressions,...r.quasis];o.sort((e,t)=>e.range[0]-t.range[0]);let a=o.map(t=>"TemplateElement"===t.type?t.value.cooked:"{"+e.sourceCode.getText(t)+"}");return n.replaceText(t,a.join(""))}})}})}),O=B({name:"jsx/no-unneeded-nested",meta:{type:"suggestion",fixable:"code",docs:{description:"Reduce unneeded JSXFragment nested",recommended:"stylistic"},schema:[],messages:{invalid:"Reduce unneeded JSXFragment nested"}},defaultOptions:[],create(e){let t=e.sourceCode;return{JSXFragment(r){if(1!==r.children.length)return;let n=r.children[0];e.report({node:r,messageId:"invalid",*fix(e){"JSXExpressionContainer"===n.type?"JSXEmptyExpression"!==n.expression.type&&(yield e.replaceText(r,t.getText(n.expression))):yield e.replaceText(r,t.getText(n))}})}}}});let U=/^toLocale(?<name>Upper|Lower)Case$/g;var q=B({name:"string/no-locale-case",meta:{type:"problem",fixable:"code",docs:{description:"Disallow use `String#toLocale{Upper,Lower}Case()`",recommended:"recommended"},schema:[],messages:{instead:"Use `.to{{name}}Case(...)` instead of `.toLocale{{name}}Case()`"}},defaultOptions:[],create:e=>({CallExpression(t){if(t.arguments.length>0||!A(t.callee)||!T(t.callee.property))return;let{property:r}=t.callee,n=U.exec(r.name);n&&e.report({node:t,data:{name:n.groups?.name},messageId:"instead",fix:e=>e.replaceText(r,r.name.replaceAll("Locale",""))})}})}),V=B({name:"string/no-simple-template-literal",meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow simple template-literal",recommended:"stylistic"},schema:[],messages:{invalid:"Disallow simple template-literal"}},defaultOptions:[],create:e=>({TemplateLiteral(t){var r,n,o,a;let i=(r=e.sourceCode,(o=n=t,o.parent?.type!=="TaggedTemplateExpression"&&1===o.quasis.length&&!function({loc:e}){return!!e&&e.start.line!==e.end.line}(o.quasis[0])&&0===o.expressions.length)?e=>{let t=JSON.stringify(n.quasis[0].value.cooked),o=S(n,e=>"Property"===e.type&&e.key===n);return o?e.replaceText(o,`${t}: ${r.getText(o.value)}`):e.replaceText(n,t)}:2===(a=n).quasis.length&&a.quasis.every(({value:e})=>""===e.cooked)&&1===a.expressions.length?e=>e.replaceText(n,r.getText(n.expressions[0])):void 0);i&&e.report({node:t,messageId:"invalid",fix:i})}})});let W=/\P{ASCII}/u;function _(e,t){return{Program(r){for(let n of r.tokens??[]){let r=function(e){switch(e.type){case"String":case"Template":return e.value.slice(1,-1);case"Identifier":if(e.value.startsWith("#"))return e.value.slice(1);return e.value;case"PrivateIdentifier":case"JSXText":case"JSXIdentifier":return e.value;case"RegularExpression":return e.regex.pattern}return!1}(n);!1!==r&&e.test(r)&&t(n,"code")}for(let n of r.comments??[])e.test(n.value)&&t(n,"comment")}}}function z(e,t){switch(e.type){case"String":case"Template":return r=>{let n=e.value.slice(0,1),o=e.value.slice(-1),a=K(e.value.slice(1,-1),t);return r.replaceText(e,`${n}${a}${o}`)};case"JSXText":return r=>{let n=e.value.replace(t,e=>`&#x${G(e.codePointAt(0))};`);return r.replaceText(e,n)};case"RegularExpression":return r=>{let n=new i(e.regex.flags);n.add("u");let o=new a(K(e.regex.pattern,t),[...n].join(""));return r.replaceText(e,o.toString())}}}function K(e,t){return e.replace(t,e=>{let t=e.codePointAt(0);return t>65535?`\\u{${G(t)}}`:`\\u${G(t)}`})}function G(e){return e.toString(16).padStart(4,"0").toUpperCase()}B({name:"unicode/specific-set",meta:{type:"problem",fixable:"code",docs:{description:"Limit the range of literal characters"},schema:[{type:"object",properties:{pattern:{type:"string"},flags:{type:"string"},only:{type:"string",enum:["code","comment"]}},additionalProperties:!1}],messages:{illegal:"Illegal character detected"}},defaultOptions:[{pattern:W.source,flags:"u",only:void 0}],create(e,[{pattern:t,flags:r,only:n}]){let o=t?new a(t,r):W;return _(o,(t,r)=>{if(n&&n!==r)return;let a=z(t,RegExp(o.source,"gu"));e.report({node:t,messageId:"illegal",fix:a})})}});let J=/[\u061C\u202A-\u202E\u2066-\u2069]/;var X=B({name:"unicode/no-bidi",meta:{type:"problem",fixable:"code",docs:{description:"Detect and stop Trojan Source attacks",recommended:"recommended"},schema:[],messages:{detected:"Detected potential trojan source attack with unicode bidi introduced in this {{kind}}: {{text}}."}},defaultOptions:[],create:e=>_(J,(t,r)=>{let n=RegExp(J.source,"gu"),o={kind:r,text:K(t.value,n)},a=z(t,n);e.report({node:t,data:o,messageId:"detected",fix:a})})});let Y=(n=[/\u00AD\u034F\u061C\u17B4\u17B5\uFEFF\uFFFC/,/\u180B-\u180E/,/\u200B-\u200F/,/\u202A-\u202E/,/\u2060-\u206F/,/\uFE00-\uFE0F/,/\uFFF0-\uFFF8/,/\u{1D173}-\u{1D17A}/u,/\u{E0000}-\u{E007F}/u,/\u{E0100}-\u{E01EF}/u].map(e=>"string"==typeof e?e:e.source).join(""),RegExp(`[${n}]`,"u"));var H=B({name:"unicode/no-invisible",meta:{type:"problem",fixable:"code",docs:{description:"Disallow invisible characters",recommended:"recommended"},schema:[],messages:{illegal:"Illegal character detected"}},defaultOptions:[],create:e=>_(Y,t=>{let r=z(t,RegExp(Y.source,"gu"));e.report({node:t,messageId:"illegal",fix:r})})}),Q=B({name:"no-redundant-variable",meta:{type:"problem",fixable:"code",docs:{description:"Disallow redundant variable",recommended:"stylistic"},schema:[],messages:{invalid:"Disallow Redundant Variable"}},defaultOptions:[],create:e=>({BlockStatement({body:t}){var r,n,o,a,i;let s=t.find(Z);if(!s)return;let l=t[t.indexOf(s)-1];r=l,n=s,r&&"VariableDeclaration"===r.type&&1===r.declarations.length&&r.declarations.some(({init:e,id:t})=>null!==e&&F(n.argument,t))&&e.report({node:s,messageId:"invalid",fix:(o=e.sourceCode,a=l,i=s,e=>{var t;let{init:r,id:n}=a.declarations[0];if(!(r&&n&&i.argument))return null;let s=!w(t=r)||S(t,"TryStatement")?t:t.argument,l=(e=>{if(!n.typeAnnotation)return e;let t=o.getText(n.typeAnnotation.typeAnnotation);return`(${e}) as ${w(r)?`Promise<${t}>`:t}`})(o.getText(s));return[e.remove(a),e.replaceText(i.argument,l)]})})}})});function Z(e){return"ReturnStatement"===e.type&&T(e.argument)}var ee=B({name:"no-single-return",meta:{type:"suggestion",docs:{description:"Disallow single-return",recommended:"stylistic"},schema:[],messages:{invalid:"Disallow Single Return"}},defaultOptions:[],create:e=>({BlockStatement({parent:t,body:r}){if(!j(t))return;let n=function(e,t){let r=t.find(et);if(!r)return;let n=t.find(e=>{var t,n;return t=e,n=r,"VariableDeclaration"===t.type&&"const"!==t.kind&&t.declarations.some(({id:e})=>F(n.argument,e))});if(n)return e.sourceCode.getDeclaredVariables(n).find(({references:e})=>e.every(e=>e.isWriteOnly()||e.identifier.parent===r))}(e,r);for(let{identifier:t}of n?.references??[])t.parent&&e.report({node:t.parent,messageId:"invalid"})}})});function et(e){return"ReturnStatement"===e.type&&T(e.argument)}var er=B({name:"prefer-early-return",meta:{type:"problem",fixable:"code",docs:{description:"Prefer early returns over full-body conditional wrapping in function declarations",recommended:"stylistic"},schema:[{type:"object",properties:{maximumStatements:{type:"integer",minimum:0}},additionalProperties:!1}],messages:{prefer:"Prefer an early return to a conditionally-wrapped function body"}},defaultOptions:[{maximumStatements:0}],create:(e,[{maximumStatements:t}])=>({BlockStatement:function({body:r,parent:n}){var o,a;if(!j(n)||!(1===r.length&&function(e,t){if("IfStatement"!==e.type||null!==e.alternate)return!1;let{consequent:r}=e;return"ExpressionStatement"===r.type&&0===t||"BlockStatement"===r.type&&r.body.length>t}(r[0],t)))return;let i=(o=e,a=r[0],function*(e){var t;let r;if("IfStatement"!==a.type)return;let{test:n,consequent:i}=a;yield e.insertTextBefore(n,"!("),yield e.insertTextAfter(n,")"),yield e.replaceText(i,"return;");let s=(t=o.sourceCode.getText(i),r=t,"BlockStatement"===i.type?r.slice(1,-1):r);yield e.insertTextAfter(a,s)});e.report({node:r[0],messageId:"prefer",fix:i})}})}),en=B({name:"prefer-fetch",meta:{type:"problem",docs:{description:"Enforce fetch",recommended:"stylistic"},schema:[],messages:{callee:"Should use 'fetch' instead"}},defaultOptions:[],create:e=>({ImportDeclaration(t){let r=t.source.value;("axios"===r||"request"===r)&&e.report({node:t,messageId:"callee"})},NewExpression(t){var r;((function({callee:e}){return k(e,"XMLHttpRequest")})(t)||k((r=t).callee,"ActiveXObject")&&I(r.arguments[0],/xmlhttp/i))&&e.report({node:t,messageId:"callee"})},CallExpression(t){((function({callee:e}){let t="$http";return k(e,t)||A(e)&&k(e.object,t)})(t)||function({callee:e,parent:t}){let r=["$","jQuery"];return k(e,r)&&A(t)&&k(t.property,"load")||A(e)&&k(e.object,r)&&k(e.property,["ajax","get","post","getJSON","getScript"])}(t)||eo(t,"axios")||eo(t,"request"))&&e.report({node:t,messageId:"callee"})}})});function eo(e,t){return k(e.callee,"require")&&I(e.arguments[0],t)}let ea=new i(["setTimeout","setInterval","requestAnimationFrame","requestIdleCallback"]);var ei=B({name:"prefer-timer-id",meta:{type:"problem",docs:{description:"Enforce best practice with timer function",recommended:"recommended"},schema:[],messages:{assign:"Timer id should assign to an identifier or member for cleaning up, `const timer = {{name}}(...);`",fix:"Assign timer id to a variable"},hasSuggestions:!0},defaultOptions:[],create:e=>({CallExpression(t){"Identifier"!==t.callee.type||!ea.has(t.callee.name)||function(e){if(!k(e.callee,"setTimeout"))return!1;let t=e.arguments[1];return!t||I(t,0)}(t)||t.parent?.type==="AssignmentExpression"&&t.parent.right===t||t.parent?.type==="VariableDeclarator"&&t.parent.init===t||e.report({node:t,messageId:"assign",data:{name:t.callee.name},suggest:[{messageId:"fix",fix:e=>e.insertTextBefore(t,"const timer = ")}]})}})}),es=B({name:"string/no-unneeded-to-string",meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow `String#toString()` when simpler alternatives exist",recommended:"stylistic",requiresTypeChecking:!0},schema:[],messages:{invalid:"Disallow use `.toString()` in string"}},defaultOptions:[],create(e){R(e.sourceCode.parserServices);let{program:t,esTreeNodeToTSNodeMap:r}=e.sourceCode.parserServices,n=t.getTypeChecker();return{CallExpression(t){if("MemberExpression"!==t.callee.type)return;let{object:o,property:a}=t.callee;(k(a,"toString")||I(a,"toString"))&&function(e,t){let r=e.getTypeAtLocation(t);if(r.isStringLiteral()||"string"===e.typeToString(r))return!0;let n=r.getSymbol();return n&&"String"===e.symbolToString(n)}(n,r.get(o))&&e.report({node:a,messageId:"invalid",fix:r=>r.replaceText(t,e.sourceCode.getText(o))})}}}}),el=B({name:"type/no-force-cast-via-top-type",meta:{type:"problem",docs:{description:"Disallowing cast a type `T` to unrelated or incompatible type `Q` via `T as any as Q`",recommended:"recommended"},schema:[],messages:{invalid:"Don't cast this expression to another type by `as {{type}} as T`"}},defaultOptions:[],create:e=>({TSAsExpression(t){var r,n;if("TSAnyKeyword"!==(r=t.typeAnnotation).type&&"TSUnknownKeyword"!==r.type||!((n=t.parent)&&"TSAsExpression"===n.type&&"TSTypeReference"===n.typeAnnotation.type))return;let o="TSAnyKeyword"===t.typeAnnotation.type?"any":"unknown";e.report({node:t,messageId:"invalid",data:{type:o}})}})});let eu=new i(["BigInt","Boolean","Number","String","Symbol"]);var ep=B({name:"type/no-wrapper-type-reference",meta:{type:"problem",fixable:"code",docs:{description:"Disallow wrapper type for type reference",recommended:"recommended"},schema:[],messages:{instead:"Use {{name}} instead"}},defaultOptions:[],create:e=>({TSTypeReference(t){if("Identifier"!==t.typeName.type||!eu.has(t.typeName.name))return;let r=t.typeName.name.toLowerCase();e.report({node:t,messageId:"instead",data:{name:r},fix:e=>e.replaceText(t.typeName,r)})}})}),ec=B({name:"no-default-error",meta:{type:"problem",docs:{description:"Restrict the usage of default (unextended) error",recommended:"strict",requiresTypeChecking:!0},schema:[],messages:{invalid:"Default error object should not be used in this project"}},defaultOptions:[],create(e){R(e.sourceCode.parserServices);let{esTreeNodeToTSNodeMap:t,program:r}=e.sourceCode.parserServices,n=r.getTypeChecker();function o(r){"ErrorConstructor"===function(e,t){let r=e.getTypeAtLocation(t).getSymbol();if(!r?.valueDeclaration)return;let n=e.getTypeOfSymbolAtLocation(r,r.valueDeclaration);return e.typeToString(n)}(n,t.get(r))&&e.report({node:r,messageId:"invalid"})}return{ThrowStatement(e){e.argument&&o(e.argument)},NewExpression:o,CallExpression:o}}});let ed={ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],AwaitExpression:["argument"],BinaryExpression:["left","right"],BlockStatement:["body"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ChainExpression:["expression"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExperimentalRestProperty:["argument"],ExperimentalSpreadProperty:["argument"],ExportAllDeclaration:["exported","source"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportSpecifier:["exported","local"],ExpressionStatement:["expression"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],ForStatement:["init","test","update","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportExpression:["source"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],JSXAttribute:["name","value"],JSXClosingElement:["name"],JSXClosingFragment:[],JSXElement:["openingElement","children","closingElement"],JSXEmptyExpression:[],JSXExpressionContainer:["expression"],JSXFragment:["openingFragment","children","closingFragment"],JSXIdentifier:[],JSXMemberExpression:["object","property"],JSXNamespacedName:["namespace","name"],JSXOpeningElement:["name","attributes"],JSXOpeningFragment:[],JSXSpreadAttribute:["argument"],JSXSpreadChild:["expression"],JSXText:[],LabeledStatement:["label","body"],Literal:[],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],PrivateIdentifier:[],Program:["body"],Property:["key","value"],PropertyDefinition:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],StaticBlock:["body"],Super:[],SwitchCase:["test","consequent"],SwitchStatement:["discriminant","cases"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]};for(let e of Object.keys(ed))Object.freeze(ed[e]);Object.freeze(ed);let em=new i(["parent","leadingComments","trailingComments"]);function ef(e){return!em.has(e)&&"_"!==e[0]}function eg(e,t){let r="",n=e;for("string"==typeof t?r=t:(r=t.name,n=function(e,t){let r=t.range[0],n=e,o=!1;do for(let e of(o=!1,n.childScopes)){let t=e.block.range;if(t[0]<=r&&r<t[1]){n=e,o=!0;break}}while(o);return n}(n,t));null!=n;){let e=n.set.get(r);if(null!=e)return e;n=n.upper}return null}function ey(e,t){return"Punctuator"===e.type&&e.value===t}function eh(e){return ey(e,"=>")}function ex(e){return ey(e,",")}function eb(e){return ey(e,";")}function eE(e){return ey(e,":")}function ev(e){return ey(e,"(")}function eC(e){return ey(e,")")}function eD(e){return ey(e,"{")}function eS(e){return["Block","Line","Shebang"].includes(e.type)}let eT=e=>!eb(e);function eA(e,t){let r=e.parent,n=null,o=null;if("ArrowFunctionExpression"===e.type){let r=t.getTokenBefore(e.body,eh);n=r.loc.start,o=r.loc.end}else{var a,i;n=r&&("Property"===r.type||"MethodDefinition"===r.type||"PropertyDefinition"===r.type)?r.loc.start:e.loc.start,o=(a=e,i=t,a.id?i.getTokenAfter(a.id,ev):i.getFirstToken(a,ev)).loc.start}return{start:{...n},end:{...o}}}let ew="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},ek=Object.freeze(new i(["Array","ArrayBuffer","BigInt","BigInt64Array","BigUint64Array","Boolean","DataView","Date","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","Float32Array","Float64Array","Function","Infinity","Int16Array","Int32Array","Int8Array","isFinite","isNaN","isPrototypeOf","JSON","Map","Math","NaN","Number","Object","parseFloat","parseInt","Promise","Proxy","Reflect","RegExp","Set","String","Symbol","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray","undefined","unescape","WeakMap","WeakSet"])),eI=new i([Array.isArray,Array.of,Array.prototype.at,Array.prototype.concat,Array.prototype.entries,Array.prototype.every,Array.prototype.filter,Array.prototype.find,Array.prototype.findIndex,Array.prototype.flat,Array.prototype.includes,Array.prototype.indexOf,Array.prototype.join,Array.prototype.keys,Array.prototype.lastIndexOf,Array.prototype.slice,Array.prototype.some,Array.prototype.toString,Array.prototype.values,"function"==typeof BigInt?BigInt:void 0,Boolean,Date,Date.parse,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,escape,isFinite,isNaN,isPrototypeOf,Map,Map.prototype.entries,Map.prototype.get,Map.prototype.has,Map.prototype.keys,Map.prototype.values,...Object.getOwnPropertyNames(Math).filter(e=>"random"!==e).map(e=>Math[e]).filter(e=>"function"==typeof e),Number,Number.isFinite,Number.isNaN,Number.parseFloat,Number.parseInt,Number.prototype.toExponential,Number.prototype.toFixed,Number.prototype.toPrecision,Number.prototype.toString,Object,Object.entries,Object.is,Object.isExtensible,Object.isFrozen,Object.isSealed,Object.keys,Object.values,parseFloat,parseInt,RegExp,Set,Set.prototype.entries,Set.prototype.has,Set.prototype.keys,Set.prototype.values,String,String.fromCharCode,String.fromCodePoint,String.raw,String.prototype.at,String.prototype.charAt,String.prototype.charCodeAt,String.prototype.codePointAt,String.prototype.concat,String.prototype.endsWith,String.prototype.includes,String.prototype.indexOf,String.prototype.lastIndexOf,String.prototype.normalize,String.prototype.padEnd,String.prototype.padStart,String.prototype.slice,String.prototype.startsWith,String.prototype.substr,String.prototype.substring,String.prototype.toLowerCase,String.prototype.toString,String.prototype.toUpperCase,String.prototype.trim,String.prototype.trimEnd,String.prototype.trimLeft,String.prototype.trimRight,String.prototype.trimStart,Symbol.for,Symbol.keyFor,unescape].filter(e=>"function"==typeof e)),ej=new i([Object.freeze,Object.preventExtensions,Object.seal]),eF=[[Map,new i(["size"])],[RegExp,new i(["dotAll","flags","global","hasIndices","ignoreCase","multiline","source","sticky","unicode"])],[Set,new i(["size"])]];function eB(e,t){let r=[];for(let n=0;n<e.length;++n){let o=e[n];if(null==o)r.length=n+1;else if("SpreadElement"===o.type){let e=eP(o.argument,t);if(null==e)return null;r.push(...e.value)}else{let e=eP(o,t);if(null==e)return null;r.push(e.value)}}return r}let eR=Object.freeze({ArrayExpression(e,t){let r=eB(e.elements,t);return null!=r?{value:r}:null},AssignmentExpression:(e,t)=>"="===e.operator?eP(e.right,t):null,BinaryExpression(e,t){if("in"===e.operator||"instanceof"===e.operator)return null;let r=eP(e.left,t),n=eP(e.right,t);if(null!=r&&null!=n)switch(e.operator){case"==":return{value:r.value==n.value};case"!=":return{value:r.value!=n.value};case"===":return{value:r.value===n.value};case"!==":return{value:r.value!==n.value};case"<":return{value:r.value<n.value};case"<=":return{value:r.value<=n.value};case">":return{value:r.value>n.value};case">=":return{value:r.value>=n.value};case"<<":return{value:r.value<<n.value};case">>":return{value:r.value>>n.value};case">>>":return{value:r.value>>>n.value};case"+":return{value:r.value+n.value};case"-":return{value:r.value-n.value};case"*":return{value:r.value*n.value};case"/":return{value:r.value/n.value};case"%":return{value:r.value%n.value};case"**":return{value:r.value**n.value};case"|":return{value:r.value|n.value};case"^":return{value:r.value^n.value};case"&":return{value:r.value&n.value}}return null},CallExpression(e,t){let r=e.callee,n=eB(e.arguments,t);if(null!=n)if("MemberExpression"===r.type){if("PrivateIdentifier"===r.property.type)return null;let o=eP(r.object,t);if(null!=o){if(null==o.value&&(o.optional||e.optional))return{value:void 0,optional:!0};let a=eL(r,t);if(null!=a){let e=o.value,t=a.value;if(eI.has(e[t]))return{value:e[t](...n)};if(ej.has(e[t]))return{value:n[0]}}}}else{let o=eP(r,t);if(null!=o){if(null==o.value&&e.optional)return{value:void 0,optional:!0};let t=o.value;if(eI.has(t))return{value:t(...n)};if(ej.has(t))return{value:n[0]}}}return null},ConditionalExpression(e,t){let r=eP(e.test,t);return null!=r?r.value?eP(e.consequent,t):eP(e.alternate,t):null},ExpressionStatement:(e,t)=>eP(e.expression,t),Identifier(e,t){if(null!=t){let r=eg(t,e);if(null!=r){if(null!=r&&0===r.defs.length&&ek.has(r.name)&&r.name in ew)return{value:ew[r.name]};if(function(e){let t,r,n;if(1!==e.defs.length)return!1;let o=e.defs[0];return!!(o.parent&&"Variable"===o.type&&("const"===o.parent.kind||(r=(t=e.references).filter(e=>e.init).length,n=t.filter(e=>e.isReadOnly()).length,1===r&&n+r===t.length)))}(r)){let e=r.defs[0];if("Identifier"===e.node.id.type){let n=eP(e.node.init,t);return n&&"object"==typeof n.value&&null!==n.value&&function(e,t){for(let r of e.references){let e=r.identifier;for(;e&&e.parent&&"MemberExpression"===e.parent.type;)e=e.parent;if(e&&e.parent&&("AssignmentExpression"===e.parent.type&&e.parent.left===e||"UpdateExpression"===e.parent.type&&e.parent.argument===e||"CallExpression"===e.parent.type&&e.parent.callee===e&&"MemberExpression"===e.type&&function(e){if(null==e||null==e.value)return!1;let t=e.value;return"copyWithin"===t||"fill"===t||"pop"===t||"push"===t||"reverse"===t||"shift"===t||"sort"===t||"splice"===t||"unshift"===t}(eL(e,t))))return!0}return!1}(r,t)?null:n}}}}return null},Literal:e=>(null!=e.regex||null!=e.bigint)&&null==e.value?null:{value:e.value},LogicalExpression(e,t){let r=eP(e.left,t);if(null!=r){if("||"===e.operator&&!0==!!r.value||"&&"===e.operator&&!1==!!r.value||"??"===e.operator&&null!=r.value)return r;let n=eP(e.right,t);if(null!=n)return n}return null},MemberExpression(e,t){if("PrivateIdentifier"===e.property.type)return null;let r=eP(e.object,t);if(null!=r){if(null==r.value&&(r.optional||e.optional))return{value:void 0,optional:!0};let n=eL(e,t);if(null!=n){let e;if(null==(e=function(e,t){let r=e;for(;("object"==typeof r||"function"==typeof r)&&null!==r;){let e=Object.getOwnPropertyDescriptor(r,t);if(e)return e;r=Object.getPrototypeOf(r)}return null}(r.value,n.value))||null==e.get)return{value:r.value[n.value]};for(let[e,t]of eF)if(r.value instanceof e&&t.has(n.value))return{value:r.value[n.value]}}}return null},ChainExpression(e,t){let r=eP(e.expression,t);return null!=r?{value:r.value}:null},NewExpression(e,t){let r=eP(e.callee,t),n=eB(e.arguments,t);if(null!=r&&null!=n){let e=r.value;if(eI.has(e))return{value:new e(...n)}}return null},ObjectExpression(e,t){let r={};for(let n of e.properties)if("Property"===n.type){if("init"!==n.kind)return null;let e=eL(n,t),o=eP(n.value,t);if(null==e||null==o)return null;r[e.value]=o.value}else{if("SpreadElement"!==n.type&&"ExperimentalSpreadProperty"!==n.type)return null;let e=eP(n.argument,t);if(null==e)return null;Object.assign(r,e.value)}return{value:r}},SequenceExpression:(e,t)=>eP(e.expressions[e.expressions.length-1],t),TaggedTemplateExpression(e,t){let r=eP(e.tag,t),n=eB(e.quasi.expressions,t);if(null!=r&&null!=n){let t=r.value,o=e.quasi.quasis.map(e=>e.value.cooked);if(o.raw=e.quasi.quasis.map(e=>e.value.raw),t===String.raw)return{value:t(o,...n)}}return null},TemplateLiteral(e,t){let r=eB(e.expressions,t);if(null!=r){let t=e.quasis[0].value.cooked;for(let n=0;n<r.length;++n)t+=r[n],t+=e.quasis[n+1].value.cooked;return{value:t}}return null},UnaryExpression(e,t){if("delete"===e.operator)return null;if("void"===e.operator)return{value:void 0};let r=eP(e.argument,t);if(null!=r)switch(e.operator){case"-":return{value:-r.value};case"+":return{value:+r.value};case"!":return{value:!r.value};case"~":return{value:~r.value};case"typeof":return{value:typeof r.value}}return null},TSAsExpression:(e,t)=>eP(e.expression,t),TSSatisfiesExpression:(e,t)=>eP(e.expression,t),TSTypeAssertion:(e,t)=>eP(e.expression,t),TSNonNullExpression:(e,t)=>eP(e.expression,t),TSInstantiationExpression:(e,t)=>eP(e.expression,t)});function eP(e,t){return null!=e&&Object.hasOwnProperty.call(eR,e.type)?eR[e.type](e,t):null}function eL(e,t){let r="Property"===e.type?e.key:e.property;return e.computed?eP(r,t):"Identifier"===r.type?{value:r.name}:"Literal"===r.type?r.bigint?{value:r.bigint}:{value:String(r.value)}:null}function eN(e,t=null){try{return eP(e,t)}catch(e){return null}}function e$(e,t=null){if(e&&"Literal"===e.type&&null===e.value){if(e.regex)return`/${e.regex.pattern}/${e.regex.flags}`;if(e.bigint)return e.bigint}let r=eN(e,t);if(r)try{return String(r.value)}catch{}return null}function eM(e,t){switch(e.type){case"MemberExpression":if(e.computed)return e$(e.property,t);if("PrivateIdentifier"===e.property.type)break;return e.property.name;case"Property":case"MethodDefinition":case"PropertyDefinition":if(e.computed)return e$(e.key,t);if("Literal"===e.key.type)return String(e.key.value);if("PrivateIdentifier"===e.key.type)break;return e.key.name}return null}function eO(e,t){let r=e.parent;if(!r)return"";let n=[],o="Property"===r.type&&r.value===e,a="MethodDefinition"===r.type&&r.value===e,i="PropertyDefinition"===r.type&&r.value===e;if((a||i)&&(r.static&&n.push("static"),"PrivateIdentifier"===r.key.type&&n.push("private")),e.async&&n.push("async"),e.generator&&n.push("generator"),o||a){if("constructor"===r.kind)return"constructor";"get"===r.kind?n.push("getter"):"set"===r.kind?n.push("setter"):n.push("method")}else i?n.push("method"):("ArrowFunctionExpression"===e.type&&n.push("arrow"),n.push("function"));if(o||a||i)if("PrivateIdentifier"===r.key.type)n.push(`#${r.key.name}`);else{let e=eM(r);if(e)n.push(`'${e}'`);else if(t){let e=t.getText(r.key);e.includes("\n")||n.push(`[${e}]`)}}else e.id?n.push(`'${e.id.name}'`):"VariableDeclarator"===r.type&&r.id&&"Identifier"===r.id.type?n.push(`'${r.id.name}'`):("AssignmentExpression"===r.type||"AssignmentPattern"===r.type)&&r.left&&"Identifier"===r.left.type?n.push(`'${r.left.name}'`):"ExportDefaultDeclaration"===r.type&&r.declaration===e&&n.push("'default'");return n.join(" ")}let eU=Object.freeze(new i(["==","!=","<","<=",">",">=","<<",">>",">>>","+","-","*","/","%","|","^","&","in"])),eq=Object.freeze(new i(["-","+","!","~"]));function eV(e){return null!==e&&"object"==typeof e&&"string"==typeof e.type}let eW=Object.freeze(Object.assign(Object.create(null),{$visit(e,t,r){let{type:n}=e;return"function"==typeof this[n]?this[n](e,t,r):this.$visitChildren(e,t,r)},$visitChildren(e,t,r){let{type:n}=e;for(let o of r[n]||Object.keys(e).filter(ef)){let n=e[o];if(Array.isArray(n)){for(let e of n)if(eV(e)&&this.$visit(e,t,r))return!0}else if(eV(n)&&this.$visit(n,t,r))return!0}return!1},ArrowFunctionExpression:()=>!1,AssignmentExpression:()=>!0,AwaitExpression:()=>!0,BinaryExpression(e,t,r){return!!(t.considerImplicitTypeConversion&&eU.has(e.operator))&&("Literal"!==e.left.type||"Literal"!==e.right.type)||this.$visitChildren(e,t,r)},CallExpression:()=>!0,FunctionExpression:()=>!1,ImportExpression:()=>!0,MemberExpression(e,t,r){return!!t.considerGetters||!!t.considerImplicitTypeConversion&&!!e.computed&&"Literal"!==e.property.type||this.$visitChildren(e,t,r)},MethodDefinition(e,t,r){return!!t.considerImplicitTypeConversion&&!!e.computed&&"Literal"!==e.key.type||this.$visitChildren(e,t,r)},NewExpression:()=>!0,Property(e,t,r){return!!t.considerImplicitTypeConversion&&!!e.computed&&"Literal"!==e.key.type||this.$visitChildren(e,t,r)},PropertyDefinition(e,t,r){return!!t.considerImplicitTypeConversion&&!!e.computed&&"Literal"!==e.key.type||this.$visitChildren(e,t,r)},UnaryExpression(e,t,r){return!!("delete"===e.operator||t.considerImplicitTypeConversion&&eq.has(e.operator)&&"Literal"!==e.argument.type)||this.$visitChildren(e,t,r)},UpdateExpression:()=>!0,YieldExpression:()=>!0}));function e_(e,t,r={}){let{considerGetters:n=!1,considerImplicitTypeConversion:o=!1}=r;return eW.$visit(e,{considerGetters:n,considerImplicitTypeConversion:o},t.visitorKeys||ed)}function ez(e,t,r){let n,o,a,i,s;if("number"==typeof e){if(n=0|e,o=t,a=r,!(n>=1))throw TypeError("'times' should be a positive integer.")}else n=1,o=e,a=t;if(null==o||null==o.parent||"CatchClause"===o.parent.type&&o.parent.param===o)return!1;i=s=o;do i=a.getTokenBefore(i),s=a.getTokenAfter(s);while(null!=i&&null!=s&&ev(i)&&eC(s)&&i!==function(e,t){let r=e.parent;if(!r)return null;switch(r.type){case"CallExpression":case"NewExpression":if(1===r.arguments.length&&r.arguments[0]===e)return t.getTokenAfter(r.typeArguments||r.typeParameters||r.callee,ev);return null;case"DoWhileStatement":if(r.test===e)return t.getTokenAfter(r.body,ev);return null;case"IfStatement":case"WhileStatement":if(r.test===e)return t.getFirstToken(r,1);return null;case"ImportExpression":if(r.source===e)return t.getFirstToken(r,1);return null;case"SwitchStatement":if(r.discriminant===e)return t.getFirstToken(r,1);return null;case"WithStatement":if(r.object===e)return t.getFirstToken(r,1);return null;default:return null}}(o,a)&&--n>0);return 0===n}let eK=/^(?:Import|Export(?:All|Default|Named))Declaration$/u,eG=Function.call.bind(Object.hasOwnProperty),eJ=Symbol("read"),eX=Symbol("call"),eY=Symbol("construct"),eH=Symbol("esm"),eQ={require:{[eX]:!0}};function eZ(e){return null==e||0!==e.defs.length||e.references.some(e=>e.isWrite())}class e0{constructor(e,t={}){let{mode:r="strict",globalObjectNames:n=["global","globalThis","self","window"]}=t;this.variableStack=[],this.globalScope=e,this.mode=r,this.globalObjectNames=n.slice(0)}*iterateGlobalReferences(e){for(let t of Object.keys(e)){let r=e[t],n=[t],o=this.globalScope.set.get(t);eZ(o)||(yield*this._iterateVariableReferences(o,n,r,!0))}for(let t of this.globalObjectNames){let r=[],n=this.globalScope.set.get(t);eZ(n)||(yield*this._iterateVariableReferences(n,r,e,!1))}}*iterateCjsReferences(e){for(let{node:t}of this.iterateGlobalReferences(eQ)){let r=e$(t.arguments[0]);if(null==r||!eG(e,r))continue;let n=e[r],o=[r];n[eJ]&&(yield{node:t,path:o,type:eJ,info:n[eJ]}),yield*this._iteratePropertyReferences(t,o,n)}}*iterateEsmReferences(e){for(let t of this.globalScope.block.body){if(!eK.test(t.type)||null==t.source)continue;let r=t.source.value;if(!eG(e,r))continue;let n=e[r],o=[r];if(n[eJ]&&(yield{node:t,path:o,type:eJ,info:n[eJ]}),"ExportAllDeclaration"===t.type)for(let e of Object.keys(n)){let r=n[e];r[eJ]&&(yield{node:t,path:o.concat(e),type:eJ,info:r[eJ]})}else for(let e of t.specifiers){let t=eG(n,eH),r=this._iterateImportReferences(e,o,t?n:"legacy"===this.mode?{default:n,...n}:{default:n});if(t)yield*r;else for(let e of r)e.path=e.path.filter(e1),(e.path.length>=2||e.type!==eJ)&&(yield e)}}}*iteratePropertyReferences(e,t){yield*this._iteratePropertyReferences(e,[],t)}*_iterateVariableReferences(e,t,r,n){if(!this.variableStack.includes(e)){this.variableStack.push(e);try{for(let o of e.references){if(!o.isRead())continue;let e=o.identifier;n&&r[eJ]&&(yield{node:e,path:t,type:eJ,info:r[eJ]}),yield*this._iteratePropertyReferences(e,t,r)}}finally{this.variableStack.pop()}}}*_iteratePropertyReferences(e,t,r){let n=e;for(;function(e){let t=e.parent;if(t)switch(t.type){case"ConditionalExpression":return t.consequent===e||t.alternate===e;case"LogicalExpression":case"ChainExpression":case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":case"TSNonNullExpression":case"TSInstantiationExpression":return!0;case"SequenceExpression":return t.expressions[t.expressions.length-1]===e}return!1}(n);)n=n.parent;let o=n.parent;if(o){if("MemberExpression"===o.type){if(o.object===n){let e=eM(o);if(null==e||!eG(r,e))return;t=t.concat(e);let n=r[e];n[eJ]&&(yield{node:o,path:t,type:eJ,info:n[eJ]}),yield*this._iteratePropertyReferences(o,t,n)}return}if("CallExpression"===o.type){o.callee===n&&r[eX]&&(yield{node:o,path:t,type:eX,info:r[eX]});return}if("NewExpression"===o.type){o.callee===n&&r[eY]&&(yield{node:o,path:t,type:eY,info:r[eY]});return}if("AssignmentExpression"===o.type){o.right===n&&(yield*this._iterateLhsReferences(o.left,t,r),yield*this._iteratePropertyReferences(o,t,r));return}if("AssignmentPattern"===o.type){o.right===n&&(yield*this._iterateLhsReferences(o.left,t,r));return}"VariableDeclarator"===o.type&&o.init===n&&(yield*this._iterateLhsReferences(o.id,t,r))}}*_iterateLhsReferences(e,t,r){if("Identifier"===e.type){let n=eg(this.globalScope,e);null!=n&&(yield*this._iterateVariableReferences(n,t,r,!1));return}if("ObjectPattern"===e.type){for(let n of e.properties){let e=eM(n);if(null==e||!eG(r,e))continue;let o=t.concat(e),a=r[e];a[eJ]&&(yield{node:n,path:o,type:eJ,info:a[eJ]}),yield*this._iterateLhsReferences(n.value,o,a)}return}"AssignmentPattern"===e.type&&(yield*this._iterateLhsReferences(e.left,t,r))}*_iterateImportReferences(e,t,r){let n=e.type;if("ImportSpecifier"===n||"ImportDefaultSpecifier"===n){let o="ImportDefaultSpecifier"===n?"default":"Identifier"===e.imported.type?e.imported.name:e.imported.value;if(!eG(r,o))return;t=t.concat(o);let a=r[o];a[eJ]&&(yield{node:e,path:t,type:eJ,info:a[eJ]}),yield*this._iterateVariableReferences(eg(this.globalScope,e.local),t,a,!1);return}if("ImportNamespaceSpecifier"===n)return void(yield*this._iterateVariableReferences(eg(this.globalScope,e.local),t,r,!1));if("ExportSpecifier"===n){let n="Identifier"===e.local.type?e.local.name:e.local.value;if(!eG(r,n))return;t=t.concat(n);let o=r[n];o[eJ]&&(yield{node:e,path:t,type:eJ,info:o[eJ]})}}}function e1(e,t){return 1!==t||"default"!==e}e0.READ=eJ,e0.CALL=eX,e0.CONSTRUCT=eY,e0.ESM=eH;let e2=Symbol("SYNTAX_OPENING_PARENTHESIS_INITIAL_VALUE");function*e3(e,t){if(!e||!e.parent||"CatchClause"===e.parent.type&&e.parent.param===e)return;let r=e2,n=[e,e];for(;n=function([e,t],r){let n=r.sourceCode.getTokenBefore(e);if(!n||!ev(n))return;let o=r.sourceCode.getTokenAfter(t);if(o&&eC(o))return[n,o]}(n,t);){let[o]=n;if(r===e2&&(r=function(e,t){let{parent:r}=e;switch(r.type){case"CallExpression":case"NewExpression":if(1===r.arguments.length&&r.arguments[0]===e)return t.sourceCode.getTokenAfter(r.typeArguments??r.callee,ev);return;case"DoWhileStatement":if(r.test===e)return t.sourceCode.getTokenAfter(r.body,ev);return;case"IfStatement":case"WhileStatement":if(r.test===e)return t.sourceCode.getFirstToken(r,1);return;case"ImportExpression":if(r.source===e)return t.sourceCode.getFirstToken(r,1);return;case"SwitchStatement":if(r.discriminant===e)return t.sourceCode.getFirstToken(r,1);return;case"WithStatement":if(r.object===e)return t.sourceCode.getFirstToken(r,1)}}(e,t)),o===r)break;yield n}}let e8=new s;function e6(e,t){if(!e||!e8.has(e)){let r=[];for(let[n,o]of e3(e,t))r.unshift(n),r.push(o);e8.set(e,r)}return e8.get(e)}function e9(e,t){let r=e6(e,t),[n]=t.sourceCode.getRange(r[0]??e),[,o]=t.sourceCode.getRange(r.at(-1)??e);return[n,o]}function e5(e,t){let[r,n]=e9(e,t);return t.sourceCode.text.slice(r,n)}function e4(e,t){if(e8.has(e))return e8.get(e).length>0;let r=e3(e,t).next().done;return r&&e8.set(e,[]),!r}function e7(e,t){return e?.type==="Literal"&&e.value===t}let te=e=>e?.type==="Literal"&&"string"==typeof e.value,tt=(e,t)=>e?.type==="Literal"&&"boolean"==typeof e.value&&(void 0===t||e.value===t),tr=e=>te(e)?e.value:e?.type==="TemplateLiteral"&&0===e.expressions.length?e.quasis[0].value.cooked:void 0,tn=e=>"Literal"===e.type&&"number"==typeof e.value,to=e=>"Literal"===e.type&&!!e.regex,ta=e=>e?.type==="Literal"&&"null"===e.raw,ti=e=>"Literal"===e.type&&!!e.bigint;function ts(e,t,r){return t?"Identifier"===e.type&&e.name===t:!Array.isArray(r)||0===r.length||"Identifier"===e.type&&r.includes(e.name)}let tl={},tu=["CallExpression"],tp=["NewExpression"],tc=["CallExpression","NewExpression"];function td(e,t,r){if(!r.includes(e?.type))return!1;"string"==typeof t?t={names:[t]}:Array.isArray(t)&&(t={names:t});let{name:n,names:o,argumentsLength:a,minimumArguments:i=0,maximumArguments:s=1/0,allowSpreadElement:l=!1,optional:u}=t??tl;if(!0===u&&e.optional!==u||!1===u&&e.optional||"number"==typeof a&&e.arguments.length!==a||0!==i&&e.arguments.length<i||Number.isFinite(s)&&e.arguments.length>s)return!1;if(!l){let t=Number.isFinite(s)?s:a;if("number"==typeof t&&e.arguments.some((e,r)=>"SpreadElement"===e.type&&r<t))return!1}return ts(e.callee,n,o)}let tm=(e,t)=>{if("boolean"==typeof t?.optional)throw TypeError("Cannot check node.optional in `isNewExpression`.");return td(e,t,tp)},tf=e=>"ExpressionStatement"===e.type&&"string"==typeof e.directive;function tg(e,t){let{type:r}=e;return"BlockStatement"===r?e.body.every(e=>tg(e,t)):"EmptyStatement"===r||!!t?.(e)}let ty=e=>"ArrayExpression"===e.type&&0===e.elements.length,th=e=>"ObjectExpression"===e.type&&0===e.properties.length;function tx(e){return"ExpressionStatement"===e.type||"ChainExpression"===e.type&&"ExpressionStatement"===e.parent.type}let tb=["FunctionDeclaration","FunctionExpression","ArrowFunctionExpression"];function tE(e){return tb.includes(e.type)}let tv=["DoWhileStatement","ForInStatement","ForOfStatement","ForStatement","WhileStatement"];function tC(e){return tv.includes(e.type)}let tD={};function tS(e,t){if(e?.type!=="MemberExpression")return!1;"string"==typeof t?t={properties:[t]}:Array.isArray(t)&&(t={properties:t});let{property:r,properties:n,object:o,objects:a,optional:i,computed:s}=t??tD;if(!0===i&&e.optional!==i||!1===i&&e.optional)return!1;if(r||Array.isArray(n)&&n.length>0){if(!ts(e.property,r,n))return!1;s??=!1}return(!0!==s||e.computed===s)&&(!1!==s||!e.computed)&&ts(e.object,o,a)}let tT={};function tA(e,t){return e?.type==="CallExpression"&&"MemberExpression"===e.callee.type&&("string"==typeof t?t={methods:[t]}:Array.isArray(t)&&(t={methods:t}),td(e,{argumentsLength:(t??=tT).argumentsLength,minimumArguments:t.minimumArguments,maximumArguments:t.maximumArguments,allowSpreadElement:t.allowSpreadElement,optional:t.optionalCall},tu)&&tS(e.callee,{object:t.object,objects:t.objects,computed:t.computed,property:t.method,properties:t.methods,optional:t.optionalMember}))}function tw(e){return e?.type==="UnaryExpression"&&"-"===e.operator&&tn(e.argument)&&1===e.argument.value}function tk(e,t=[]){if("Identifier"!==e.type)return!1;let r=Array.isArray(t)?t:[t];return(!(r.length>0)||!!r.includes(e.name))&&!function(e){let{parent:t}=e;switch(t.type){case"MemberExpression":return!t.computed&&t.property===e;case"FunctionDeclaration":case"FunctionExpression":return t.params.includes(e)||t.id===e;case"ArrowFunctionExpression":return t.params.includes(e);case"ClassDeclaration":case"ClassExpression":case"VariableDeclarator":case"TSDeclareFunction":case"TSEnumMember":case"TSTypeAliasDeclaration":return t.id===e;case"PropertyDefinition":case"MethodDefinition":return!t.computed&&t.key===e;case"Property":return!t.computed&&t.key===e&&("ObjectExpression"===t.parent.type||"ObjectPattern"===t.parent.type)&&t.parent.properties.includes(t)||t.value===e&&"ObjectPattern"===t.parent.type&&t.parent.properties.includes(t);case"ArrayPattern":return t.elements.includes(e);case"LabeledStatement":case"ContinueStatement":case"BreakStatement":return t.label===e;case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":return t.local===e;case"ExportAllDeclaration":return t.exported===e;case"ImportSpecifier":return t.local===e||t.imported===e;case"ExportSpecifier":return t.local===e||t.exported===e;case"TSIndexSignature":return t.parameters.includes(e);case"TSTypeParameter":return t.name===e;case"TSMappedType":case"TSPropertySignature":return t.key===e}return!1}(e)}let tI=e=>td(e,{name:"require",argumentsLength:1,optional:!1},tu)&&te(e.arguments[0]);function tj(e,t){let r=t.trim().split(".");for(let t=r.length-1;t>=0;t--){let n=r[t];if(!n)return!1;if(0===t)return"Identifier"===e.type&&e.name===n||"this"===n&&"ThisExpression"===e.type||"super"===n&&"Super"===e.type;if(1===t&&"MetaProperty"===e.type&&"Identifier"===e.property.type&&e.property.name===n){e=e.meta;continue}if("MemberExpression"===e.type&&!e.optional&&!e.computed&&"Identifier"===e.property.type&&e.property.name===n){e=e.object;continue}return!1}}function tF(e,t){return t.some(t=>tj(e,t))}function tB(e,t){return"TemplateLiteral"===e.type&&"TaggedTemplateExpression"===e.parent.type&&e.parent.quasi===e&&(!t||tF(e.parent.tag,t))}function tR(e){return e?.type==="Identifier"&&"undefined"===e.name}let tP=(e,t)=>(function(e,t){let{object:r,property:n,properties:o}={property:"",properties:[],...t};if(!tS(e,{property:n,properties:o,optional:!1}))return;let a=e.object;return tS(a,{object:r,property:"prototype",optional:!1})||"Array"===r&&ty(a)||"Object"===r&&th(a)})(e,{...t,object:"Array"}),tL=e=>e?.type==="LogicalExpression"&&("&&"===e.operator||"||"===e.operator),tN=e=>e?.type==="UnaryExpression"&&"!"===e.operator,t$=e=>tN(e.parent)&&e.parent.argument===e,tM=(e,t)=>tO(e.parent,t)&&e.parent.arguments[0]===e,tO=(e,t)=>e?.type==="CallExpression"&&!e.optional&&"Identifier"===e.callee.type&&"Boolean"===e.callee.name&&1===e.arguments.length&&"SpreadElement"!==e.arguments[0].type&&((e,t)=>{let{sourceCode:r}=t;if(r.isGlobalReference(e))return!0;let n=eg(r.getScope(e),e);return!n||0===n.defs.length})(e.callee,t);function tU(e,t){return!!(tN(e)||t$(e)||tO(e,t)||tM(e,t))||!!tL(e.parent)&&tU(e.parent,t)}function tq(e){let t;return t=e.parent,!!(t?.type==="VExpressionContainer"&&"VAttribute"===t.parent.type&&t.parent.directive&&t.parent.value===t&&"VDirectiveKey"===t.parent.key.type&&"VIdentifier"===t.parent.key.name.type&&["if","else-if","show"].includes(t.parent.key.name.rawName)||["IfStatement","ConditionalExpression","WhileStatement","DoWhileStatement","ForStatement"].includes(e.parent.type)&&e.parent.test===e)||!!tL(e.parent)&&tq(e.parent)}function tV(e,{test:t,expected:r,ruleId:n}){if(t?.(e)||(r=(r=Array.isArray(r)?r:[r]).map(e=>"string"==typeof e?{value:e}:e),!t&&r.some(t=>Object.entries(t).every(([t,r])=>e[t]===r))))return;let o=`'${JSON.stringify({value:e.value,type:e.type})}'`;r=r.map(e=>`'${JSON.stringify(e)}'`).join(" or ");let a=`\`${n}\`: Unexpected token ${o}`,i=`https://github.com/sindresorhus/eslint-plugin-unicorn/issues/new?title=${encodeURIComponent(a)}`;throw Error(`Expected token ${r}, got ${o}.
|
|
2
|
-
Please open an issue at ${i}.`)}function
|
|
1
|
+
let e,t,r,n;"use strict";var o=Map,a=RegExp,i=Set,s=WeakMap,l=WeakSet;var u,p,c=require("eslint-plugin-sukka"),d=require("@eslint-sukka/shared"),m=require("node:vm"),f=require("url"),g=require("path"),y=require("fs"),h=require("vm"),x=require("worker_threads"),b=require("node:assert/strict"),E=require("node:util/types"),v=require("node:path"),C=require("node:util"),D=require("eslint/use-at-your-own-risk"),S="u">typeof document?document.currentScript:null;function T(e,t){if("string"==typeof t){let e=t;t=t=>t.type===e}for(;e;){if(t(e))return e;e=e.parent}}function A(e){return e?.type==="Identifier"||e?.type==="PrivateIdentifier"}function w(e){return e?.type==="MemberExpression"}function k(e){return e?.type==="AwaitExpression"}function I(e,t){return!!A(e)&&("function"==typeof t?t(e.name):Array.isArray(t)?t.includes(e.name):e.name===t)}function j(e,t){return e?.type==="Literal"&&(Array.isArray(t)?t.includes(e.value):"string"==typeof e.value&&t instanceof RegExp?t.test(e.value):e.value===t)}function F(e){return!!e&&["ArrowFunctionExpression","FunctionDeclaration","FunctionExpression"].includes(e.type)}function B(e,t){return e?.type==="Identifier"&&t?.type===e.type&&e.name===t.name}function R({create:e,defaultOptions:t,meta:r,name:n}){return r.docs&&!r.docs.url&&(r.docs.url=new URL(n,"https://dimensiondev.github.io/eslint-plugin/src/rules/").href),{create(r){var n,o;let a,s=(n=t,o=r.options,a=structuredClone(n),null==o||a.forEach((e,t)=>{if(void 0!==o[t]){let r=o[t];"object"!=typeof r||Array.isArray(r)||"object"!=typeof e||Array.isArray(e)?a[t]=r:a[t]=function e(t={},r={}){return Object.fromEntries([...new i([...Object.keys(t),...Object.keys(r)])].map(n=>{let o=n in t,a=n in r,i=t[n],s=r[n];return[n,o&&a?"object"!=typeof i||Array.isArray(i)||"object"!=typeof s||Array.isArray(s)?s:e(i,s):o?i:s]}))}(e,r)}}),a);return e(r,s)},defaultOptions:t,meta:r,name:n}}function P(e){if(!e?.program)throw Error("see https://typescript-eslint.io/docs/linting/type-linting")}var L=R({name:"array/no-unneeded-flat-map",meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow `Array#flatMap((x) => x)` when simpler alternatives exist",recommended:"stylistic"},schema:[],messages:{invalid:"Disallow simple `Array#flatMap()` in array"}},defaultOptions:[],create:e=>({CallExpression(t){var r;if("MemberExpression"!==t.callee.type||!I(t.callee.property,"flatMap")||!(F(r=t.arguments[0])&&1===r.params.length&&"Identifier"===r.params[0].type&&r.body&&(B(r.params[0],r.body)||"BlockStatement"===r.body.type&&1===r.body.body.length&&"ReturnStatement"===r.body.body[0].type&&B(r.params[0],r.body.body[0].argument))))return;let{property:n}=t.callee;e.report({node:t,messageId:"invalid",*fix(e){yield e.replaceText(n,"flat"),yield*t.arguments.map(t=>e.remove(t))}})}})});let N=new i(["href","pathname","search","hash","origin"]);var $=R({name:"browser/prefer-location-assign",meta:{type:"suggestion",fixable:"code",docs:{description:"Prefer `location.assign(...)` over `location.*`",recommended:"stylistic"},schema:[],messages:{instead:"Use `location.assign(...)` instead of `location.{{name}}`"}},defaultOptions:[],create:e=>({AssignmentExpression(t){let r=function(e,t){if(I(e,t))return e;for(;w(e);){if(I(e.property,t))return e;e=e.object}}(t.left,"location");if(!r)return;let n=M(r.parent);e.report({node:t,messageId:"instead",data:{name:n},fix:function(e,t,r){let n=M(t.parent);if(N.has(n??"href"))return n=>n.replaceText(r,`${e.getText(t)}.assign(${e.getText(r.right)})`)}(e.sourceCode,r,t)})}})});function M(e){if(w(e)&&A(e.property))return e.property.name}var O=R({name:"jsx/no-template-literal",meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow use template-literal in JSX",recommended:"stylistic"},schema:[],messages:{invalid:"Disallow use template-literal in JSX"}},defaultOptions:[],create:e=>({JSXExpressionContainer(t){if("TemplateLiteral"!==t.expression.type||t.parent?.type==="JSXAttribute")return;let{expression:r}=t;e.report({node:t,messageId:"invalid",fix(n){let o=[...r.expressions,...r.quasis];o.sort((e,t)=>e.range[0]-t.range[0]);let a=o.map(t=>"TemplateElement"===t.type?t.value.cooked:"{"+e.sourceCode.getText(t)+"}");return n.replaceText(t,a.join(""))}})}})}),U=R({name:"jsx/no-unneeded-nested",meta:{type:"suggestion",fixable:"code",docs:{description:"Reduce unneeded JSXFragment nested",recommended:"stylistic"},schema:[],messages:{invalid:"Reduce unneeded JSXFragment nested"}},defaultOptions:[],create(e){let t=e.sourceCode;return{JSXFragment(r){if(1!==r.children.length)return;let n=r.children[0];e.report({node:r,messageId:"invalid",*fix(e){"JSXExpressionContainer"===n.type?"JSXEmptyExpression"!==n.expression.type&&(yield e.replaceText(r,t.getText(n.expression))):yield e.replaceText(r,t.getText(n))}})}}}});let q=/^toLocale(?<name>Upper|Lower)Case$/g;var V=R({name:"string/no-locale-case",meta:{type:"problem",fixable:"code",docs:{description:"Disallow use `String#toLocale{Upper,Lower}Case()`",recommended:"recommended"},schema:[],messages:{instead:"Use `.to{{name}}Case(...)` instead of `.toLocale{{name}}Case()`"}},defaultOptions:[],create:e=>({CallExpression(t){if(t.arguments.length>0||!w(t.callee)||!A(t.callee.property))return;let{property:r}=t.callee,n=q.exec(r.name);n&&e.report({node:t,data:{name:n.groups?.name},messageId:"instead",fix:e=>e.replaceText(r,r.name.replaceAll("Locale",""))})}})}),W=R({name:"string/no-simple-template-literal",meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow simple template-literal",recommended:"stylistic"},schema:[],messages:{invalid:"Disallow simple template-literal"}},defaultOptions:[],create:e=>({TemplateLiteral(t){var r,n,o,a;let i=(r=e.sourceCode,(o=n=t,o.parent?.type!=="TaggedTemplateExpression"&&1===o.quasis.length&&!function({loc:e}){return!!e&&e.start.line!==e.end.line}(o.quasis[0])&&0===o.expressions.length)?e=>{let t=JSON.stringify(n.quasis[0].value.cooked),o=T(n,e=>"Property"===e.type&&e.key===n);return o?e.replaceText(o,`${t}: ${r.getText(o.value)}`):e.replaceText(n,t)}:2===(a=n).quasis.length&&a.quasis.every(({value:e})=>""===e.cooked)&&1===a.expressions.length?e=>e.replaceText(n,r.getText(n.expressions[0])):void 0);i&&e.report({node:t,messageId:"invalid",fix:i})}})});let _=/\P{ASCII}/u;function z(e,t){return{Program(r){for(let n of r.tokens??[]){let r=function(e){switch(e.type){case"String":case"Template":return e.value.slice(1,-1);case"Identifier":if(e.value.startsWith("#"))return e.value.slice(1);return e.value;case"PrivateIdentifier":case"JSXText":case"JSXIdentifier":return e.value;case"RegularExpression":return e.regex.pattern}return!1}(n);!1!==r&&e.test(r)&&t(n,"code")}for(let n of r.comments??[])e.test(n.value)&&t(n,"comment")}}}function K(e,t){switch(e.type){case"String":case"Template":return r=>{let n=e.value.slice(0,1),o=e.value.slice(-1),a=G(e.value.slice(1,-1),t);return r.replaceText(e,`${n}${a}${o}`)};case"JSXText":return r=>{let n=e.value.replace(t,e=>`&#x${J(e.codePointAt(0))};`);return r.replaceText(e,n)};case"RegularExpression":return r=>{let n=new i(e.regex.flags);n.add("u");let o=new a(G(e.regex.pattern,t),[...n].join(""));return r.replaceText(e,o.toString())}}}function G(e,t){return e.replace(t,e=>{let t=e.codePointAt(0);return t>65535?`\\u{${J(t)}}`:`\\u${J(t)}`})}function J(e){return e.toString(16).padStart(4,"0").toUpperCase()}R({name:"unicode/specific-set",meta:{type:"problem",fixable:"code",docs:{description:"Limit the range of literal characters"},schema:[{type:"object",properties:{pattern:{type:"string"},flags:{type:"string"},only:{type:"string",enum:["code","comment"]}},additionalProperties:!1}],messages:{illegal:"Illegal character detected"}},defaultOptions:[{pattern:_.source,flags:"u",only:void 0}],create(e,[{pattern:t,flags:r,only:n}]){let o=t?new a(t,r):_;return z(o,(t,r)=>{if(n&&n!==r)return;let a=K(t,RegExp(o.source,"gu"));e.report({node:t,messageId:"illegal",fix:a})})}});let X=/[\u061C\u202A-\u202E\u2066-\u2069]/;var Y=R({name:"unicode/no-bidi",meta:{type:"problem",fixable:"code",docs:{description:"Detect and stop Trojan Source attacks",recommended:"recommended"},schema:[],messages:{detected:"Detected potential trojan source attack with unicode bidi introduced in this {{kind}}: {{text}}."}},defaultOptions:[],create:e=>z(X,(t,r)=>{let n=RegExp(X.source,"gu"),o={kind:r,text:G(t.value,n)},a=K(t,n);e.report({node:t,data:o,messageId:"detected",fix:a})})});let H=(n=[/\u00AD\u034F\u061C\u17B4\u17B5\uFEFF\uFFFC/,/\u180B-\u180E/,/\u200B-\u200F/,/\u202A-\u202E/,/\u2060-\u206F/,/\uFE00-\uFE0F/,/\uFFF0-\uFFF8/,/\u{1D173}-\u{1D17A}/u,/\u{E0000}-\u{E007F}/u,/\u{E0100}-\u{E01EF}/u].map(e=>"string"==typeof e?e:e.source).join(""),RegExp(`[${n}]`,"u"));var Q=R({name:"unicode/no-invisible",meta:{type:"problem",fixable:"code",docs:{description:"Disallow invisible characters",recommended:"recommended"},schema:[],messages:{illegal:"Illegal character detected"}},defaultOptions:[],create:e=>z(H,t=>{let r=K(t,RegExp(H.source,"gu"));e.report({node:t,messageId:"illegal",fix:r})})}),Z=R({name:"no-redundant-variable",meta:{type:"problem",fixable:"code",docs:{description:"Disallow redundant variable",recommended:"stylistic"},schema:[],messages:{invalid:"Disallow Redundant Variable"}},defaultOptions:[],create:e=>({BlockStatement({body:t}){var r,n,o,a,i;let s=t.find(ee);if(!s)return;let l=t[t.indexOf(s)-1];r=l,n=s,r&&"VariableDeclaration"===r.type&&1===r.declarations.length&&r.declarations.some(({init:e,id:t})=>null!==e&&B(n.argument,t))&&e.report({node:s,messageId:"invalid",fix:(o=e.sourceCode,a=l,i=s,e=>{var t;let{init:r,id:n}=a.declarations[0];if(!(r&&n&&i.argument))return null;let s=!k(t=r)||T(t,"TryStatement")?t:t.argument,l=(e=>{if(!n.typeAnnotation)return e;let t=o.getText(n.typeAnnotation.typeAnnotation);return`(${e}) as ${k(r)?`Promise<${t}>`:t}`})(o.getText(s));return[e.remove(a),e.replaceText(i.argument,l)]})})}})});function ee(e){return"ReturnStatement"===e.type&&A(e.argument)}var et=R({name:"no-single-return",meta:{type:"suggestion",docs:{description:"Disallow single-return",recommended:"stylistic"},schema:[],messages:{invalid:"Disallow Single Return"}},defaultOptions:[],create:e=>({BlockStatement({parent:t,body:r}){if(!F(t))return;let n=function(e,t){let r=t.find(er);if(!r)return;let n=t.find(e=>{var t,n;return t=e,n=r,"VariableDeclaration"===t.type&&"const"!==t.kind&&t.declarations.some(({id:e})=>B(n.argument,e))});if(n)return e.sourceCode.getDeclaredVariables(n).find(({references:e})=>e.every(e=>e.isWriteOnly()||e.identifier.parent===r))}(e,r);for(let{identifier:t}of n?.references??[])t.parent&&e.report({node:t.parent,messageId:"invalid"})}})});function er(e){return"ReturnStatement"===e.type&&A(e.argument)}var en=R({name:"prefer-early-return",meta:{type:"problem",fixable:"code",docs:{description:"Prefer early returns over full-body conditional wrapping in function declarations",recommended:"stylistic"},schema:[{type:"object",properties:{maximumStatements:{type:"integer",minimum:0}},additionalProperties:!1}],messages:{prefer:"Prefer an early return to a conditionally-wrapped function body"}},defaultOptions:[{maximumStatements:0}],create:(e,[{maximumStatements:t}])=>({BlockStatement:function({body:r,parent:n}){var o,a;if(!F(n)||!(1===r.length&&function(e,t){if("IfStatement"!==e.type||null!==e.alternate)return!1;let{consequent:r}=e;return"ExpressionStatement"===r.type&&0===t||"BlockStatement"===r.type&&r.body.length>t}(r[0],t)))return;let i=(o=e,a=r[0],function*(e){var t;let r;if("IfStatement"!==a.type)return;let{test:n,consequent:i}=a;yield e.insertTextBefore(n,"!("),yield e.insertTextAfter(n,")"),yield e.replaceText(i,"return;");let s=(t=o.sourceCode.getText(i),r=t,"BlockStatement"===i.type?r.slice(1,-1):r);yield e.insertTextAfter(a,s)});e.report({node:r[0],messageId:"prefer",fix:i})}})}),eo=R({name:"prefer-fetch",meta:{type:"problem",docs:{description:"Enforce fetch",recommended:"stylistic"},schema:[],messages:{callee:"Should use 'fetch' instead"}},defaultOptions:[],create:e=>({ImportDeclaration(t){let r=t.source.value;("axios"===r||"request"===r)&&e.report({node:t,messageId:"callee"})},NewExpression(t){var r;((function({callee:e}){return I(e,"XMLHttpRequest")})(t)||I((r=t).callee,"ActiveXObject")&&j(r.arguments[0],/xmlhttp/i))&&e.report({node:t,messageId:"callee"})},CallExpression(t){((function({callee:e}){let t="$http";return I(e,t)||w(e)&&I(e.object,t)})(t)||function({callee:e,parent:t}){let r=["$","jQuery"];return I(e,r)&&w(t)&&I(t.property,"load")||w(e)&&I(e.object,r)&&I(e.property,["ajax","get","post","getJSON","getScript"])}(t)||ea(t,"axios")||ea(t,"request"))&&e.report({node:t,messageId:"callee"})}})});function ea(e,t){return I(e.callee,"require")&&j(e.arguments[0],t)}let ei=new i(["setTimeout","setInterval","requestAnimationFrame","requestIdleCallback"]);var es=R({name:"prefer-timer-id",meta:{type:"problem",docs:{description:"Enforce best practice with timer function",recommended:"recommended"},schema:[],messages:{assign:"Timer id should assign to an identifier or member for cleaning up, `const timer = {{name}}(...);`",fix:"Assign timer id to a variable"},hasSuggestions:!0},defaultOptions:[],create:e=>({CallExpression(t){"Identifier"!==t.callee.type||!ei.has(t.callee.name)||function(e){if(!I(e.callee,"setTimeout"))return!1;let t=e.arguments[1];return!t||j(t,0)}(t)||t.parent?.type==="AssignmentExpression"&&t.parent.right===t||t.parent?.type==="VariableDeclarator"&&t.parent.init===t||e.report({node:t,messageId:"assign",data:{name:t.callee.name},suggest:[{messageId:"fix",fix:e=>e.insertTextBefore(t,"const timer = ")}]})}})}),el=R({name:"string/no-unneeded-to-string",meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow `String#toString()` when simpler alternatives exist",recommended:"stylistic",requiresTypeChecking:!0},schema:[],messages:{invalid:"Disallow use `.toString()` in string"}},defaultOptions:[],create(e){P(e.sourceCode.parserServices);let{program:t,esTreeNodeToTSNodeMap:r}=e.sourceCode.parserServices,n=t.getTypeChecker();return{CallExpression(t){if("MemberExpression"!==t.callee.type)return;let{object:o,property:a}=t.callee;(I(a,"toString")||j(a,"toString"))&&function(e,t){let r=e.getTypeAtLocation(t);if(r.isStringLiteral()||"string"===e.typeToString(r))return!0;let n=r.getSymbol();return n&&"String"===e.symbolToString(n)}(n,r.get(o))&&e.report({node:a,messageId:"invalid",fix:r=>r.replaceText(t,e.sourceCode.getText(o))})}}}}),eu=R({name:"type/no-force-cast-via-top-type",meta:{type:"problem",docs:{description:"Disallowing cast a type `T` to unrelated or incompatible type `Q` via `T as any as Q`",recommended:"recommended"},schema:[],messages:{invalid:"Don't cast this expression to another type by `as {{type}} as T`"}},defaultOptions:[],create:e=>({TSAsExpression(t){var r,n;if("TSAnyKeyword"!==(r=t.typeAnnotation).type&&"TSUnknownKeyword"!==r.type||!((n=t.parent)&&"TSAsExpression"===n.type&&"TSTypeReference"===n.typeAnnotation.type))return;let o="TSAnyKeyword"===t.typeAnnotation.type?"any":"unknown";e.report({node:t,messageId:"invalid",data:{type:o}})}})});let ep=new i(["BigInt","Boolean","Number","String","Symbol"]);var ec=R({name:"type/no-wrapper-type-reference",meta:{type:"problem",fixable:"code",docs:{description:"Disallow wrapper type for type reference",recommended:"recommended"},schema:[],messages:{instead:"Use {{name}} instead"}},defaultOptions:[],create:e=>({TSTypeReference(t){if("Identifier"!==t.typeName.type||!ep.has(t.typeName.name))return;let r=t.typeName.name.toLowerCase();e.report({node:t,messageId:"instead",data:{name:r},fix:e=>e.replaceText(t.typeName,r)})}})}),ed=R({name:"no-default-error",meta:{type:"problem",docs:{description:"Restrict the usage of default (unextended) error",recommended:"strict",requiresTypeChecking:!0},schema:[],messages:{invalid:"Default error object should not be used in this project"}},defaultOptions:[],create(e){P(e.sourceCode.parserServices);let{esTreeNodeToTSNodeMap:t,program:r}=e.sourceCode.parserServices,n=r.getTypeChecker();function o(r){"ErrorConstructor"===function(e,t){let r=e.getTypeAtLocation(t).getSymbol();if(!r?.valueDeclaration)return;let n=e.getTypeOfSymbolAtLocation(r,r.valueDeclaration);return e.typeToString(n)}(n,t.get(r))&&e.report({node:r,messageId:"invalid"})}return{ThrowStatement(e){e.argument&&o(e.argument)},NewExpression:o,CallExpression:o}}});let em={ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],AwaitExpression:["argument"],BinaryExpression:["left","right"],BlockStatement:["body"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ChainExpression:["expression"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExperimentalRestProperty:["argument"],ExperimentalSpreadProperty:["argument"],ExportAllDeclaration:["exported","source"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportSpecifier:["exported","local"],ExpressionStatement:["expression"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],ForStatement:["init","test","update","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportExpression:["source"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],JSXAttribute:["name","value"],JSXClosingElement:["name"],JSXClosingFragment:[],JSXElement:["openingElement","children","closingElement"],JSXEmptyExpression:[],JSXExpressionContainer:["expression"],JSXFragment:["openingFragment","children","closingFragment"],JSXIdentifier:[],JSXMemberExpression:["object","property"],JSXNamespacedName:["namespace","name"],JSXOpeningElement:["name","attributes"],JSXOpeningFragment:[],JSXSpreadAttribute:["argument"],JSXSpreadChild:["expression"],JSXText:[],LabeledStatement:["label","body"],Literal:[],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],PrivateIdentifier:[],Program:["body"],Property:["key","value"],PropertyDefinition:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],StaticBlock:["body"],Super:[],SwitchCase:["test","consequent"],SwitchStatement:["discriminant","cases"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]};for(let e of Object.keys(em))Object.freeze(em[e]);Object.freeze(em);let ef=new i(["parent","leadingComments","trailingComments"]);function eg(e){return!ef.has(e)&&"_"!==e[0]}function ey(e,t){let r="",n=e;for("string"==typeof t?r=t:(r=t.name,n=function(e,t){let r=t.range[0],n=e,o=!1;do for(let e of(o=!1,n.childScopes)){let t=e.block.range;if(t[0]<=r&&r<t[1]){n=e,o=!0;break}}while(o);return n}(n,t));null!=n;){let e=n.set.get(r);if(null!=e)return e;n=n.upper}return null}function eh(e,t){return"Punctuator"===e.type&&e.value===t}function ex(e){return eh(e,"=>")}function eb(e){return eh(e,",")}function eE(e){return eh(e,";")}function ev(e){return eh(e,":")}function eC(e){return eh(e,"(")}function eD(e){return eh(e,")")}function eS(e){return eh(e,"{")}function eT(e){return["Block","Line","Shebang"].includes(e.type)}let eA=e=>!eE(e);function ew(e,t){let r=e.parent,n=null,o=null;if("ArrowFunctionExpression"===e.type){let r=t.getTokenBefore(e.body,ex);n=r.loc.start,o=r.loc.end}else{var a,i;n=r&&("Property"===r.type||"MethodDefinition"===r.type||"PropertyDefinition"===r.type)?r.loc.start:e.loc.start,o=(a=e,i=t,a.id?i.getTokenAfter(a.id,eC):i.getFirstToken(a,eC)).loc.start}return{start:{...n},end:{...o}}}let ek="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},eI=Object.freeze(new i(["Array","ArrayBuffer","BigInt","BigInt64Array","BigUint64Array","Boolean","DataView","Date","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","Float32Array","Float64Array","Function","Infinity","Int16Array","Int32Array","Int8Array","isFinite","isNaN","isPrototypeOf","JSON","Map","Math","NaN","Number","Object","parseFloat","parseInt","Promise","Proxy","Reflect","RegExp","Set","String","Symbol","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray","undefined","unescape","WeakMap","WeakSet"])),ej=new i([Array.isArray,Array.of,Array.prototype.at,Array.prototype.concat,Array.prototype.entries,Array.prototype.every,Array.prototype.filter,Array.prototype.find,Array.prototype.findIndex,Array.prototype.flat,Array.prototype.includes,Array.prototype.indexOf,Array.prototype.join,Array.prototype.keys,Array.prototype.lastIndexOf,Array.prototype.slice,Array.prototype.some,Array.prototype.toString,Array.prototype.values,"function"==typeof BigInt?BigInt:void 0,Boolean,Date,Date.parse,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,escape,isFinite,isNaN,isPrototypeOf,Map,Map.prototype.entries,Map.prototype.get,Map.prototype.has,Map.prototype.keys,Map.prototype.values,...Object.getOwnPropertyNames(Math).filter(e=>"random"!==e).map(e=>Math[e]).filter(e=>"function"==typeof e),Number,Number.isFinite,Number.isNaN,Number.parseFloat,Number.parseInt,Number.prototype.toExponential,Number.prototype.toFixed,Number.prototype.toPrecision,Number.prototype.toString,Object,Object.entries,Object.is,Object.isExtensible,Object.isFrozen,Object.isSealed,Object.keys,Object.values,parseFloat,parseInt,RegExp,Set,Set.prototype.entries,Set.prototype.has,Set.prototype.keys,Set.prototype.values,String,String.fromCharCode,String.fromCodePoint,String.raw,String.prototype.at,String.prototype.charAt,String.prototype.charCodeAt,String.prototype.codePointAt,String.prototype.concat,String.prototype.endsWith,String.prototype.includes,String.prototype.indexOf,String.prototype.lastIndexOf,String.prototype.normalize,String.prototype.padEnd,String.prototype.padStart,String.prototype.slice,String.prototype.startsWith,String.prototype.substr,String.prototype.substring,String.prototype.toLowerCase,String.prototype.toString,String.prototype.toUpperCase,String.prototype.trim,String.prototype.trimEnd,String.prototype.trimLeft,String.prototype.trimRight,String.prototype.trimStart,Symbol.for,Symbol.keyFor,unescape].filter(e=>"function"==typeof e)),eF=new i([Object.freeze,Object.preventExtensions,Object.seal]),eB=[[Map,new i(["size"])],[RegExp,new i(["dotAll","flags","global","hasIndices","ignoreCase","multiline","source","sticky","unicode"])],[Set,new i(["size"])]];function eR(e,t){let r=[];for(let n=0;n<e.length;++n){let o=e[n];if(null==o)r.length=n+1;else if("SpreadElement"===o.type){let e=eL(o.argument,t);if(null==e)return null;r.push(...e.value)}else{let e=eL(o,t);if(null==e)return null;r.push(e.value)}}return r}let eP=Object.freeze({ArrayExpression(e,t){let r=eR(e.elements,t);return null!=r?{value:r}:null},AssignmentExpression:(e,t)=>"="===e.operator?eL(e.right,t):null,BinaryExpression(e,t){if("in"===e.operator||"instanceof"===e.operator)return null;let r=eL(e.left,t),n=eL(e.right,t);if(null!=r&&null!=n)switch(e.operator){case"==":return{value:r.value==n.value};case"!=":return{value:r.value!=n.value};case"===":return{value:r.value===n.value};case"!==":return{value:r.value!==n.value};case"<":return{value:r.value<n.value};case"<=":return{value:r.value<=n.value};case">":return{value:r.value>n.value};case">=":return{value:r.value>=n.value};case"<<":return{value:r.value<<n.value};case">>":return{value:r.value>>n.value};case">>>":return{value:r.value>>>n.value};case"+":return{value:r.value+n.value};case"-":return{value:r.value-n.value};case"*":return{value:r.value*n.value};case"/":return{value:r.value/n.value};case"%":return{value:r.value%n.value};case"**":return{value:r.value**n.value};case"|":return{value:r.value|n.value};case"^":return{value:r.value^n.value};case"&":return{value:r.value&n.value}}return null},CallExpression(e,t){let r=e.callee,n=eR(e.arguments,t);if(null!=n)if("MemberExpression"===r.type){if("PrivateIdentifier"===r.property.type)return null;let o=eL(r.object,t);if(null!=o){if(null==o.value&&(o.optional||e.optional))return{value:void 0,optional:!0};let a=eN(r,t);if(null!=a){let e=o.value,t=a.value;if(ej.has(e[t]))return{value:e[t](...n)};if(eF.has(e[t]))return{value:n[0]}}}}else{let o=eL(r,t);if(null!=o){if(null==o.value&&e.optional)return{value:void 0,optional:!0};let t=o.value;if(ej.has(t))return{value:t(...n)};if(eF.has(t))return{value:n[0]}}}return null},ConditionalExpression(e,t){let r=eL(e.test,t);return null!=r?r.value?eL(e.consequent,t):eL(e.alternate,t):null},ExpressionStatement:(e,t)=>eL(e.expression,t),Identifier(e,t){if(null!=t){let r=ey(t,e);if(null!=r){if(null!=r&&0===r.defs.length&&eI.has(r.name)&&r.name in ek)return{value:ek[r.name]};if(function(e){let t,r,n;if(1!==e.defs.length)return!1;let o=e.defs[0];return!!(o.parent&&"Variable"===o.type&&("const"===o.parent.kind||(r=(t=e.references).filter(e=>e.init).length,n=t.filter(e=>e.isReadOnly()).length,1===r&&n+r===t.length)))}(r)){let e=r.defs[0];if("Identifier"===e.node.id.type){let n=eL(e.node.init,t);return n&&"object"==typeof n.value&&null!==n.value&&function(e,t){for(let r of e.references){let e=r.identifier;for(;e&&e.parent&&"MemberExpression"===e.parent.type;)e=e.parent;if(e&&e.parent&&("AssignmentExpression"===e.parent.type&&e.parent.left===e||"UpdateExpression"===e.parent.type&&e.parent.argument===e||"CallExpression"===e.parent.type&&e.parent.callee===e&&"MemberExpression"===e.type&&function(e){if(null==e||null==e.value)return!1;let t=e.value;return"copyWithin"===t||"fill"===t||"pop"===t||"push"===t||"reverse"===t||"shift"===t||"sort"===t||"splice"===t||"unshift"===t}(eN(e,t))))return!0}return!1}(r,t)?null:n}}}}return null},Literal:e=>(null!=e.regex||null!=e.bigint)&&null==e.value?null:{value:e.value},LogicalExpression(e,t){let r=eL(e.left,t);if(null!=r){if("||"===e.operator&&!0==!!r.value||"&&"===e.operator&&!1==!!r.value||"??"===e.operator&&null!=r.value)return r;let n=eL(e.right,t);if(null!=n)return n}return null},MemberExpression(e,t){if("PrivateIdentifier"===e.property.type)return null;let r=eL(e.object,t);if(null!=r){if(null==r.value&&(r.optional||e.optional))return{value:void 0,optional:!0};let n=eN(e,t);if(null!=n){let e;if(null==(e=function(e,t){let r=e;for(;("object"==typeof r||"function"==typeof r)&&null!==r;){let e=Object.getOwnPropertyDescriptor(r,t);if(e)return e;r=Object.getPrototypeOf(r)}return null}(r.value,n.value))||null==e.get)return{value:r.value[n.value]};for(let[e,t]of eB)if(r.value instanceof e&&t.has(n.value))return{value:r.value[n.value]}}}return null},ChainExpression(e,t){let r=eL(e.expression,t);return null!=r?{value:r.value}:null},NewExpression(e,t){let r=eL(e.callee,t),n=eR(e.arguments,t);if(null!=r&&null!=n){let e=r.value;if(ej.has(e))return{value:new e(...n)}}return null},ObjectExpression(e,t){let r={};for(let n of e.properties)if("Property"===n.type){if("init"!==n.kind)return null;let e=eN(n,t),o=eL(n.value,t);if(null==e||null==o)return null;r[e.value]=o.value}else{if("SpreadElement"!==n.type&&"ExperimentalSpreadProperty"!==n.type)return null;let e=eL(n.argument,t);if(null==e)return null;Object.assign(r,e.value)}return{value:r}},SequenceExpression:(e,t)=>eL(e.expressions[e.expressions.length-1],t),TaggedTemplateExpression(e,t){let r=eL(e.tag,t),n=eR(e.quasi.expressions,t);if(null!=r&&null!=n){let t=r.value,o=e.quasi.quasis.map(e=>e.value.cooked);if(o.raw=e.quasi.quasis.map(e=>e.value.raw),t===String.raw)return{value:t(o,...n)}}return null},TemplateLiteral(e,t){let r=eR(e.expressions,t);if(null!=r){let t=e.quasis[0].value.cooked;for(let n=0;n<r.length;++n)t+=r[n],t+=e.quasis[n+1].value.cooked;return{value:t}}return null},UnaryExpression(e,t){if("delete"===e.operator)return null;if("void"===e.operator)return{value:void 0};let r=eL(e.argument,t);if(null!=r)switch(e.operator){case"-":return{value:-r.value};case"+":return{value:+r.value};case"!":return{value:!r.value};case"~":return{value:~r.value};case"typeof":return{value:typeof r.value}}return null},TSAsExpression:(e,t)=>eL(e.expression,t),TSSatisfiesExpression:(e,t)=>eL(e.expression,t),TSTypeAssertion:(e,t)=>eL(e.expression,t),TSNonNullExpression:(e,t)=>eL(e.expression,t),TSInstantiationExpression:(e,t)=>eL(e.expression,t)});function eL(e,t){return null!=e&&Object.hasOwnProperty.call(eP,e.type)?eP[e.type](e,t):null}function eN(e,t){let r="Property"===e.type?e.key:e.property;return e.computed?eL(r,t):"Identifier"===r.type?{value:r.name}:"Literal"===r.type?r.bigint?{value:r.bigint}:{value:String(r.value)}:null}function e$(e,t=null){try{return eL(e,t)}catch(e){return null}}function eM(e,t=null){if(e&&"Literal"===e.type&&null===e.value){if(e.regex)return`/${e.regex.pattern}/${e.regex.flags}`;if(e.bigint)return e.bigint}let r=e$(e,t);if(r)try{return String(r.value)}catch{}return null}function eO(e,t){switch(e.type){case"MemberExpression":if(e.computed)return eM(e.property,t);if("PrivateIdentifier"===e.property.type)break;return e.property.name;case"Property":case"MethodDefinition":case"PropertyDefinition":if(e.computed)return eM(e.key,t);if("Literal"===e.key.type)return String(e.key.value);if("PrivateIdentifier"===e.key.type)break;return e.key.name}return null}function eU(e,t){let r=e.parent;if(!r)return"";let n=[],o="Property"===r.type&&r.value===e,a="MethodDefinition"===r.type&&r.value===e,i="PropertyDefinition"===r.type&&r.value===e;if((a||i)&&(r.static&&n.push("static"),"PrivateIdentifier"===r.key.type&&n.push("private")),e.async&&n.push("async"),e.generator&&n.push("generator"),o||a){if("constructor"===r.kind)return"constructor";"get"===r.kind?n.push("getter"):"set"===r.kind?n.push("setter"):n.push("method")}else i?n.push("method"):("ArrowFunctionExpression"===e.type&&n.push("arrow"),n.push("function"));if(o||a||i)if("PrivateIdentifier"===r.key.type)n.push(`#${r.key.name}`);else{let e=eO(r);if(e)n.push(`'${e}'`);else if(t){let e=t.getText(r.key);e.includes("\n")||n.push(`[${e}]`)}}else e.id?n.push(`'${e.id.name}'`):"VariableDeclarator"===r.type&&r.id&&"Identifier"===r.id.type?n.push(`'${r.id.name}'`):("AssignmentExpression"===r.type||"AssignmentPattern"===r.type)&&r.left&&"Identifier"===r.left.type?n.push(`'${r.left.name}'`):"ExportDefaultDeclaration"===r.type&&r.declaration===e&&n.push("'default'");return n.join(" ")}let eq=Object.freeze(new i(["==","!=","<","<=",">",">=","<<",">>",">>>","+","-","*","/","%","|","^","&","in"])),eV=Object.freeze(new i(["-","+","!","~"]));function eW(e){return null!==e&&"object"==typeof e&&"string"==typeof e.type}let e_=Object.freeze(Object.assign(Object.create(null),{$visit(e,t,r){let{type:n}=e;return"function"==typeof this[n]?this[n](e,t,r):this.$visitChildren(e,t,r)},$visitChildren(e,t,r){let{type:n}=e;for(let o of r[n]||Object.keys(e).filter(eg)){let n=e[o];if(Array.isArray(n)){for(let e of n)if(eW(e)&&this.$visit(e,t,r))return!0}else if(eW(n)&&this.$visit(n,t,r))return!0}return!1},ArrowFunctionExpression:()=>!1,AssignmentExpression:()=>!0,AwaitExpression:()=>!0,BinaryExpression(e,t,r){return!!(t.considerImplicitTypeConversion&&eq.has(e.operator))&&("Literal"!==e.left.type||"Literal"!==e.right.type)||this.$visitChildren(e,t,r)},CallExpression:()=>!0,FunctionExpression:()=>!1,ImportExpression:()=>!0,MemberExpression(e,t,r){return!!t.considerGetters||!!t.considerImplicitTypeConversion&&!!e.computed&&"Literal"!==e.property.type||this.$visitChildren(e,t,r)},MethodDefinition(e,t,r){return!!t.considerImplicitTypeConversion&&!!e.computed&&"Literal"!==e.key.type||this.$visitChildren(e,t,r)},NewExpression:()=>!0,Property(e,t,r){return!!t.considerImplicitTypeConversion&&!!e.computed&&"Literal"!==e.key.type||this.$visitChildren(e,t,r)},PropertyDefinition(e,t,r){return!!t.considerImplicitTypeConversion&&!!e.computed&&"Literal"!==e.key.type||this.$visitChildren(e,t,r)},UnaryExpression(e,t,r){return!!("delete"===e.operator||t.considerImplicitTypeConversion&&eV.has(e.operator)&&"Literal"!==e.argument.type)||this.$visitChildren(e,t,r)},UpdateExpression:()=>!0,YieldExpression:()=>!0}));function ez(e,t,r={}){let{considerGetters:n=!1,considerImplicitTypeConversion:o=!1}=r;return e_.$visit(e,{considerGetters:n,considerImplicitTypeConversion:o},t.visitorKeys||em)}function eK(e,t,r){let n,o,a,i,s;if("number"==typeof e){if(n=0|e,o=t,a=r,!(n>=1))throw TypeError("'times' should be a positive integer.")}else n=1,o=e,a=t;if(null==o||null==o.parent||"CatchClause"===o.parent.type&&o.parent.param===o)return!1;i=s=o;do i=a.getTokenBefore(i),s=a.getTokenAfter(s);while(null!=i&&null!=s&&eC(i)&&eD(s)&&i!==function(e,t){let r=e.parent;if(!r)return null;switch(r.type){case"CallExpression":case"NewExpression":if(1===r.arguments.length&&r.arguments[0]===e)return t.getTokenAfter(r.typeArguments||r.typeParameters||r.callee,eC);return null;case"DoWhileStatement":if(r.test===e)return t.getTokenAfter(r.body,eC);return null;case"IfStatement":case"WhileStatement":if(r.test===e)return t.getFirstToken(r,1);return null;case"ImportExpression":if(r.source===e)return t.getFirstToken(r,1);return null;case"SwitchStatement":if(r.discriminant===e)return t.getFirstToken(r,1);return null;case"WithStatement":if(r.object===e)return t.getFirstToken(r,1);return null;default:return null}}(o,a)&&--n>0);return 0===n}let eG=/^(?:Import|Export(?:All|Default|Named))Declaration$/u,eJ=Function.call.bind(Object.hasOwnProperty),eX=Symbol("read"),eY=Symbol("call"),eH=Symbol("construct"),eQ=Symbol("esm"),eZ={require:{[eY]:!0}};function e0(e){return null==e||0!==e.defs.length||e.references.some(e=>e.isWrite())}class e1{constructor(e,t={}){let{mode:r="strict",globalObjectNames:n=["global","globalThis","self","window"]}=t;this.variableStack=[],this.globalScope=e,this.mode=r,this.globalObjectNames=n.slice(0)}*iterateGlobalReferences(e){for(let t of Object.keys(e)){let r=e[t],n=[t],o=this.globalScope.set.get(t);e0(o)||(yield*this._iterateVariableReferences(o,n,r,!0))}for(let t of this.globalObjectNames){let r=[],n=this.globalScope.set.get(t);e0(n)||(yield*this._iterateVariableReferences(n,r,e,!1))}}*iterateCjsReferences(e){for(let{node:t}of this.iterateGlobalReferences(eZ)){let r=eM(t.arguments[0]);if(null==r||!eJ(e,r))continue;let n=e[r],o=[r];n[eX]&&(yield{node:t,path:o,type:eX,info:n[eX]}),yield*this._iteratePropertyReferences(t,o,n)}}*iterateEsmReferences(e){for(let t of this.globalScope.block.body){if(!eG.test(t.type)||null==t.source)continue;let r=t.source.value;if(!eJ(e,r))continue;let n=e[r],o=[r];if(n[eX]&&(yield{node:t,path:o,type:eX,info:n[eX]}),"ExportAllDeclaration"===t.type)for(let e of Object.keys(n)){let r=n[e];r[eX]&&(yield{node:t,path:o.concat(e),type:eX,info:r[eX]})}else for(let e of t.specifiers){let t=eJ(n,eQ),r=this._iterateImportReferences(e,o,t?n:"legacy"===this.mode?{default:n,...n}:{default:n});if(t)yield*r;else for(let e of r)e.path=e.path.filter(e2),(e.path.length>=2||e.type!==eX)&&(yield e)}}}*iteratePropertyReferences(e,t){yield*this._iteratePropertyReferences(e,[],t)}*_iterateVariableReferences(e,t,r,n){if(!this.variableStack.includes(e)){this.variableStack.push(e);try{for(let o of e.references){if(!o.isRead())continue;let e=o.identifier;n&&r[eX]&&(yield{node:e,path:t,type:eX,info:r[eX]}),yield*this._iteratePropertyReferences(e,t,r)}}finally{this.variableStack.pop()}}}*_iteratePropertyReferences(e,t,r){let n=e;for(;function(e){let t=e.parent;if(t)switch(t.type){case"ConditionalExpression":return t.consequent===e||t.alternate===e;case"LogicalExpression":case"ChainExpression":case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":case"TSNonNullExpression":case"TSInstantiationExpression":return!0;case"SequenceExpression":return t.expressions[t.expressions.length-1]===e}return!1}(n);)n=n.parent;let o=n.parent;if(o){if("MemberExpression"===o.type){if(o.object===n){let e=eO(o);if(null==e||!eJ(r,e))return;t=t.concat(e);let n=r[e];n[eX]&&(yield{node:o,path:t,type:eX,info:n[eX]}),yield*this._iteratePropertyReferences(o,t,n)}return}if("CallExpression"===o.type){o.callee===n&&r[eY]&&(yield{node:o,path:t,type:eY,info:r[eY]});return}if("NewExpression"===o.type){o.callee===n&&r[eH]&&(yield{node:o,path:t,type:eH,info:r[eH]});return}if("AssignmentExpression"===o.type){o.right===n&&(yield*this._iterateLhsReferences(o.left,t,r),yield*this._iteratePropertyReferences(o,t,r));return}if("AssignmentPattern"===o.type){o.right===n&&(yield*this._iterateLhsReferences(o.left,t,r));return}"VariableDeclarator"===o.type&&o.init===n&&(yield*this._iterateLhsReferences(o.id,t,r))}}*_iterateLhsReferences(e,t,r){if("Identifier"===e.type){let n=ey(this.globalScope,e);null!=n&&(yield*this._iterateVariableReferences(n,t,r,!1));return}if("ObjectPattern"===e.type){for(let n of e.properties){let e=eO(n);if(null==e||!eJ(r,e))continue;let o=t.concat(e),a=r[e];a[eX]&&(yield{node:n,path:o,type:eX,info:a[eX]}),yield*this._iterateLhsReferences(n.value,o,a)}return}"AssignmentPattern"===e.type&&(yield*this._iterateLhsReferences(e.left,t,r))}*_iterateImportReferences(e,t,r){let n=e.type;if("ImportSpecifier"===n||"ImportDefaultSpecifier"===n){let o="ImportDefaultSpecifier"===n?"default":"Identifier"===e.imported.type?e.imported.name:e.imported.value;if(!eJ(r,o))return;t=t.concat(o);let a=r[o];a[eX]&&(yield{node:e,path:t,type:eX,info:a[eX]}),yield*this._iterateVariableReferences(ey(this.globalScope,e.local),t,a,!1);return}if("ImportNamespaceSpecifier"===n)return void(yield*this._iterateVariableReferences(ey(this.globalScope,e.local),t,r,!1));if("ExportSpecifier"===n){let n="Identifier"===e.local.type?e.local.name:e.local.value;if(!eJ(r,n))return;t=t.concat(n);let o=r[n];o[eX]&&(yield{node:e,path:t,type:eX,info:o[eX]})}}}function e2(e,t){return 1!==t||"default"!==e}e1.READ=eX,e1.CALL=eY,e1.CONSTRUCT=eH,e1.ESM=eQ;let e3=Symbol("SYNTAX_OPENING_PARENTHESIS_INITIAL_VALUE");function*e8(e,t){if(!e||!e.parent||"CatchClause"===e.parent.type&&e.parent.param===e)return;let r=e3,n=[e,e];for(;n=function([e,t],r){let n=r.sourceCode.getTokenBefore(e);if(!n||!eC(n))return;let o=r.sourceCode.getTokenAfter(t);if(o&&eD(o))return[n,o]}(n,t);){let[o]=n;if(r===e3&&(r=function(e,t){let{parent:r}=e;switch(r.type){case"CallExpression":case"NewExpression":if(1===r.arguments.length&&r.arguments[0]===e)return t.sourceCode.getTokenAfter(r.typeArguments??r.callee,eC);return;case"DoWhileStatement":if(r.test===e)return t.sourceCode.getTokenAfter(r.body,eC);return;case"IfStatement":case"WhileStatement":if(r.test===e)return t.sourceCode.getFirstToken(r,1);return;case"ImportExpression":if(r.source===e)return t.sourceCode.getFirstToken(r,1);return;case"SwitchStatement":if(r.discriminant===e)return t.sourceCode.getFirstToken(r,1);return;case"WithStatement":if(r.object===e)return t.sourceCode.getFirstToken(r,1)}}(e,t)),o===r)break;yield n}}let e6=new s;function e9(e,t){if(!e||!e6.has(e)){let r=[];for(let[n,o]of e8(e,t))r.unshift(n),r.push(o);e6.set(e,r)}return e6.get(e)}function e5(e,t){let r=e9(e,t),[n]=t.sourceCode.getRange(r[0]??e),[,o]=t.sourceCode.getRange(r.at(-1)??e);return[n,o]}function e4(e,t){let[r,n]=e5(e,t);return t.sourceCode.text.slice(r,n)}function e7(e,t){if(e6.has(e))return e6.get(e).length>0;let r=e8(e,t).next().done;return r&&e6.set(e,[]),!r}function te(e,t){return e?.type==="Literal"&&e.value===t}let tt=e=>e?.type==="Literal"&&"string"==typeof e.value,tr=(e,t)=>e?.type==="Literal"&&"boolean"==typeof e.value&&(void 0===t||e.value===t),tn=e=>tt(e)?e.value:e?.type==="TemplateLiteral"&&0===e.expressions.length?e.quasis[0].value.cooked:void 0,to=e=>"Literal"===e.type&&"number"==typeof e.value,ta=e=>"Literal"===e.type&&!!e.regex,ti=e=>e?.type==="Literal"&&"null"===e.raw,ts=e=>"Literal"===e.type&&!!e.bigint;function tl(e,t,r){return t?"Identifier"===e.type&&e.name===t:!Array.isArray(r)||0===r.length||"Identifier"===e.type&&r.includes(e.name)}let tu={},tp=["CallExpression"],tc=["NewExpression"],td=["CallExpression","NewExpression"];function tm(e,t,r){if(!r.includes(e?.type))return!1;"string"==typeof t?t={names:[t]}:Array.isArray(t)&&(t={names:t});let{name:n,names:o,argumentsLength:a,minimumArguments:i=0,maximumArguments:s=1/0,allowSpreadElement:l=!1,optional:u}=t??tu;if(!0===u&&e.optional!==u||!1===u&&e.optional||"number"==typeof a&&e.arguments.length!==a||0!==i&&e.arguments.length<i||Number.isFinite(s)&&e.arguments.length>s)return!1;if(!l){let t=Number.isFinite(s)?s:a;if("number"==typeof t&&e.arguments.some((e,r)=>"SpreadElement"===e.type&&r<t))return!1}return tl(e.callee,n,o)}let tf=(e,t)=>{if("boolean"==typeof t?.optional)throw TypeError("Cannot check node.optional in `isNewExpression`.");return tm(e,t,tc)},tg=e=>"ExpressionStatement"===e.type&&"string"==typeof e.directive;function ty(e,t){let{type:r}=e;return"BlockStatement"===r?e.body.every(e=>ty(e,t)):"EmptyStatement"===r||!!t?.(e)}let th=e=>"ArrayExpression"===e.type&&0===e.elements.length,tx=e=>"ObjectExpression"===e.type&&0===e.properties.length;function tb(e){return"ExpressionStatement"===e.type||"ChainExpression"===e.type&&"ExpressionStatement"===e.parent.type}let tE=["FunctionDeclaration","FunctionExpression","ArrowFunctionExpression"];function tv(e){return tE.includes(e.type)}let tC=["DoWhileStatement","ForInStatement","ForOfStatement","ForStatement","WhileStatement"];function tD(e){return tC.includes(e.type)}let tS={};function tT(e,t){if(e?.type!=="MemberExpression")return!1;"string"==typeof t?t={properties:[t]}:Array.isArray(t)&&(t={properties:t});let{property:r,properties:n,object:o,objects:a,optional:i,computed:s}=t??tS;if(!0===i&&e.optional!==i||!1===i&&e.optional)return!1;if(r||Array.isArray(n)&&n.length>0){if(!tl(e.property,r,n))return!1;s??=!1}return(!0!==s||e.computed===s)&&(!1!==s||!e.computed)&&tl(e.object,o,a)}let tA={};function tw(e,t){return e?.type==="CallExpression"&&"MemberExpression"===e.callee.type&&("string"==typeof t?t={methods:[t]}:Array.isArray(t)&&(t={methods:t}),tm(e,{argumentsLength:(t??=tA).argumentsLength,minimumArguments:t.minimumArguments,maximumArguments:t.maximumArguments,allowSpreadElement:t.allowSpreadElement,optional:t.optionalCall},tp)&&tT(e.callee,{object:t.object,objects:t.objects,computed:t.computed,property:t.method,properties:t.methods,optional:t.optionalMember}))}function tk(e){return e?.type==="UnaryExpression"&&"-"===e.operator&&to(e.argument)&&1===e.argument.value}function tI(e,t=[]){if("Identifier"!==e.type)return!1;let r=Array.isArray(t)?t:[t];return(!(r.length>0)||!!r.includes(e.name))&&!function(e){let{parent:t}=e;switch(t.type){case"MemberExpression":return!t.computed&&t.property===e;case"FunctionDeclaration":case"FunctionExpression":return t.params.includes(e)||t.id===e;case"ArrowFunctionExpression":return t.params.includes(e);case"ClassDeclaration":case"ClassExpression":case"VariableDeclarator":case"TSDeclareFunction":case"TSEnumMember":case"TSTypeAliasDeclaration":return t.id===e;case"PropertyDefinition":case"MethodDefinition":return!t.computed&&t.key===e;case"Property":return!t.computed&&t.key===e&&("ObjectExpression"===t.parent.type||"ObjectPattern"===t.parent.type)&&t.parent.properties.includes(t)||t.value===e&&"ObjectPattern"===t.parent.type&&t.parent.properties.includes(t);case"ArrayPattern":return t.elements.includes(e);case"LabeledStatement":case"ContinueStatement":case"BreakStatement":return t.label===e;case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":return t.local===e;case"ExportAllDeclaration":return t.exported===e;case"ImportSpecifier":return t.local===e||t.imported===e;case"ExportSpecifier":return t.local===e||t.exported===e;case"TSIndexSignature":return t.parameters.includes(e);case"TSTypeParameter":return t.name===e;case"TSMappedType":case"TSPropertySignature":return t.key===e}return!1}(e)}let tj=e=>tm(e,{name:"require",argumentsLength:1,optional:!1},tp)&&tt(e.arguments[0]);function tF(e,t){let r=t.trim().split(".");for(let t=r.length-1;t>=0;t--){let n=r[t];if(!n)return!1;if(0===t)return"Identifier"===e.type&&e.name===n||"this"===n&&"ThisExpression"===e.type||"super"===n&&"Super"===e.type;if(1===t&&"MetaProperty"===e.type&&"Identifier"===e.property.type&&e.property.name===n){e=e.meta;continue}if("MemberExpression"===e.type&&!e.optional&&!e.computed&&"Identifier"===e.property.type&&e.property.name===n){e=e.object;continue}return!1}}function tB(e,t){return t.some(t=>tF(e,t))}function tR(e,t){return"TemplateLiteral"===e.type&&"TaggedTemplateExpression"===e.parent.type&&e.parent.quasi===e&&(!t||tB(e.parent.tag,t))}function tP(e){return e?.type==="Identifier"&&"undefined"===e.name}let tL=(e,t)=>(function(e,t){let{object:r,property:n,properties:o}={property:"",properties:[],...t};if(!tT(e,{property:n,properties:o,optional:!1}))return;let a=e.object;return tT(a,{object:r,property:"prototype",optional:!1})||"Array"===r&&th(a)||"Object"===r&&tx(a)})(e,{...t,object:"Array"}),tN=e=>e?.type==="LogicalExpression"&&("&&"===e.operator||"||"===e.operator),t$=e=>e?.type==="UnaryExpression"&&"!"===e.operator,tM=e=>t$(e.parent)&&e.parent.argument===e,tO=(e,t)=>tU(e.parent,t)&&e.parent.arguments[0]===e,tU=(e,t)=>e?.type==="CallExpression"&&!e.optional&&"Identifier"===e.callee.type&&"Boolean"===e.callee.name&&1===e.arguments.length&&"SpreadElement"!==e.arguments[0].type&&((e,t)=>{let{sourceCode:r}=t;if(r.isGlobalReference(e))return!0;let n=ey(r.getScope(e),e);return!n||0===n.defs.length})(e.callee,t);function tq(e,t){return!!(t$(e)||tM(e)||tU(e,t)||tO(e,t))||!!tN(e.parent)&&tq(e.parent,t)}function tV(e){let t;return t=e.parent,!!(t?.type==="VExpressionContainer"&&"VAttribute"===t.parent.type&&t.parent.directive&&t.parent.value===t&&"VDirectiveKey"===t.parent.key.type&&"VIdentifier"===t.parent.key.name.type&&["if","else-if","show"].includes(t.parent.key.name.rawName)||["IfStatement","ConditionalExpression","WhileStatement","DoWhileStatement","ForStatement"].includes(e.parent.type)&&e.parent.test===e)||!!tN(e.parent)&&tV(e.parent)}function tW(e,{test:t,expected:r,ruleId:n}){if(t?.(e)||(r=(r=Array.isArray(r)?r:[r]).map(e=>"string"==typeof e?{value:e}:e),!t&&r.some(t=>Object.entries(t).every(([t,r])=>e[t]===r))))return;let o=`'${JSON.stringify({value:e.value,type:e.type})}'`;r=r.map(e=>`'${JSON.stringify(e)}'`).join(" or ");let a=`\`${n}\`: Unexpected token ${o}`,i=`https://github.com/sindresorhus/eslint-plugin-unicorn/issues/new?title=${encodeURIComponent(a)}`;throw Error(`Expected token ${r}, got ${o}.
|
|
2
|
+
Please open an issue at ${i}.`)}function t_(e,t){if("AwaitExpression"===e.type||"YieldExpression"===e.type||"ForOfStatement"===e.type&&e.await)return!0;if(tv(e))return!1;for(let r of t[e.type]??[]){let n=e[r];for(let e of Array.isArray(n)?n:[n])if(e?.type&&t_(e,t))return!0}return!1}let tz={"\n":String.raw`\n`,"\r":String.raw`\r`," ":String.raw`\t`,"\b":String.raw`\b`,"\f":String.raw`\f`,"\v":String.raw`\v`,"\0":String.raw`\u{0}`};function tK(e,t="'"){if("string"!=typeof e)throw TypeError("Unexpected string.");return function(e,t="'"){if("string"!=typeof e)throw TypeError("Expected a string.");if("'"!==t&&'"'!==t)throw TypeError("Expected `quote` to be either `'` or `\"`.");let r=[...e].map(e=>{if("\\"===e)return String.raw`\\`;if(e===t)return`\\${t}`;let r=e.codePointAt(0);return r<=31||127===r||8232===r||8233===r||r>=55296&&r<=57343?tz[e]??String.raw`\u{${r.toString(16)}}`:e}).join("");return`${t}${r}${t}`}(e,t)}let tG=["await","break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","implements","interface","let","package","private","protected","public","static","arguments","eval"],tJ=["globalThis","Infinity","NaN","undefined"];function tX({includeGlobalProperties:e=!1}={}){return new i([...tG,...e?tJ:[]])}let tY=/[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*/u,tH=`(?!(?:${[...tX({includeGlobalProperties:!0})].join("|")})(?![$_\\p{ID_Continue}]))`,tQ=new o,tZ=new m.Script("returnValue = functionToRun()"),t0=Symbol.for("worker"),t1=Symbol.for("events");class t2{constructor(){Object.defineProperty(this,t1,{value:new o})}dispatchEvent(e){if(e.target=e.currentTarget=this,this["on"+e.type])try{this["on"+e.type](e)}catch(e){console.error(e)}let t=this[t1].get(e.type);null!=t&&t.forEach(t=>{try{t.call(this,e)}catch(e){console.error(e)}})}addEventListener(e,t){let r=this[t1].get(e);r||this[t1].set(e,r=[]),r.push(t)}removeEventListener(e,t){let r=this[t1].get(e);if(r){let e=r.indexOf(t);-1!==e&&r.splice(e,1)}}}function t3(e,t){this.type=e,this.timeStamp=Date.now(),this.target=this.currentTarget=this.data=null}var t8="function"==typeof Worker?Worker:x.isMainThread?t9():function(){if("function"==typeof global.WorkerGlobalScope)return;let{mod:e,name:t,type:r}=x.workerData;if(!e)return t9();let n=global.self=global,o=[];function a(){let e=o;o=null,e.forEach(e=>{n.dispatchEvent(e)})}x.parentPort.on("message",e=>{let t=new t3("message");t.data=e,null==o?n.dispatchEvent(t):o.push(t)}),x.parentPort.on("error",e=>{e.type="Error",n.dispatchEvent(e)});class i extends t2{postMessage(e,t){x.parentPort.postMessage(e,t)}close(){process.exit()}importScripts(){for(let t=0;t<arguments.length;t++){let r,n=arguments[t];r=/^data:/.test(n)?t4(n).data:y.readFileSync(new f.URL(g.posix.normalize(n),f.pathToFileURL(e)),"utf-8"),h.runInThisContext(r,{filename:n})}}}let s=Object.getPrototypeOf(global);delete s.constructor,Object.defineProperties(i.prototype,s),s=Object.setPrototypeOf(global,new i),["postMessage","addEventListener","removeEventListener","dispatchEvent"].forEach(e=>{s[e]=s[e].bind(global)}),global.name=t,global.WorkerGlobalScope=i;let l=/^data:/.test(e);if("module"===r)import(l?e:f.pathToFileURL(e)).catch(r=>{if(l&&"Not supported"===r.message)return console.warn("Worker(): Importing data: URLs requires Node 12.10+. Falling back to classic worker."),t5(e,t);console.error(r)}).then(a);else{try{/^data:/.test(e)?t5(e,t):global.importScripts(e)}catch(e){console.error(e)}Promise.resolve().then(a)}}();let t6=f.pathToFileURL(process.cwd()+"/");function t9(){class e extends t2{constructor(e,t){let r;super();let{name:n,type:o}=t||{};e+="",r=/^data:/.test(e)?e:f.fileURLToPath(new f.URL(e,t6));let a=new x.Worker(f.fileURLToPath("u"<typeof document?require("url").pathToFileURL(__filename).href:S&&"SCRIPT"===S.tagName.toUpperCase()&&S.src||new URL("index.cjs",document.baseURI).href),{workerData:{mod:r,name:n,type:o}});Object.defineProperty(this,t0,{value:a}),a.on("message",e=>{let t=new t3("message");t.data=e,this.dispatchEvent(t)}),a.on("error",e=>{e.type="error",this.dispatchEvent(e)}),a.on("exit",()=>{this.dispatchEvent(new t3("close"))})}postMessage(e,t){this[t0].postMessage(e,t)}terminate(){this[t0].terminate()}}return e.prototype.onmessage=e.prototype.onerror=e.prototype.onclose=null,e}function t5(e,t){let{data:r}=t4(e);return h.runInThisContext(r,{filename:"worker.<"+(t||"data:")+">"})}function t4(e){let[t,r,n,o]=e.match(/^data: *([^;,]*)(?: *; *([^,]*))? *,(.*)$/)||[];if(!t)throw Error("Invalid Data URL.");if(o=decodeURIComponent(o),n)if("base64"===n.toLowerCase())o=Buffer.from(o,"base64").toString();else throw Error('Unknown Data URL encoding "'+n+'"');return{type:r,data:o}}class t7 extends Error{constructor(e){super(e),this.name="TimeoutError"}}class re extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}let rt=e=>void 0===globalThis.DOMException?new re(e):new DOMException(e),rr=e=>{let t=void 0===e.reason?rt("This operation was aborted."):e.reason;return t instanceof Error?t:rt(t)};function rn(e,t,r){"function"==typeof r&&(r={filter:r});let n=function(e,t,r){let n,o=new Promise((o,a)=>{if(!((r={rejectionEvents:["error"],multiArgs:!1,resolveImmediately:!1,...r}).count>=0&&(r.count===1/0||Number.isInteger(r.count))))throw TypeError("The `count` option should be at least 0 or more");r.signal?.throwIfAborted();let i=[t].flat(),s=[],{addListener:l,removeListener:u}=(e=>{let t=e.addEventListener||e.on||e.addListener,r=e.removeEventListener||e.off||e.removeListener;if(!t||!r)throw TypeError("Emitter is not compatible");return{addListener:t.bind(e),removeListener:r.bind(e)}})(e),p=(...e)=>{let t=r.multiArgs?e:e[0];(!r.filter||r.filter(t))&&(s.push(t),r.count===s.length&&(n(),o(s)))},c=e=>{n(),a(e)};for(let e of(n=()=>{for(let e of i)u(e,p);for(let e of r.rejectionEvents)u(e,c)},i))l(e,p);for(let e of r.rejectionEvents)l(e,c);r.signal&&r.signal.addEventListener("abort",()=>{c(r.signal.reason)},{once:!0}),r.resolveImmediately&&o(s)});if(o.cancel=n,"number"==typeof r.timeout){let e=function(e,t){let r,n,{milliseconds:o,fallback:a,message:i,customTimers:s={setTimeout,clearTimeout}}=t,l=new Promise((l,u)=>{if("number"!=typeof o||1!==Math.sign(o))throw TypeError(`Expected \`milliseconds\` to be a positive number, got \`${o}\``);if(t.signal){let{signal:e}=t;e.aborted&&u(rr(e)),n=()=>{u(rr(e))},e.addEventListener("abort",n,{once:!0})}if(o===1/0)return void e.then(l,u);let p=new t7;r=s.setTimeout.call(void 0,()=>{if(a){try{l(a())}catch(e){u(e)}return}"function"==typeof e.cancel&&e.cancel(),!1===i?l():i instanceof Error?u(i):(p.message=i??`Promise timed out after ${o} milliseconds`,u(p))},o),(async()=>{try{l(await e)}catch(e){u(e)}})()}).finally(()=>{l.clear(),n&&t.signal&&t.signal.removeEventListener("abort",n)});return l.clear=()=>{s.clearTimeout.call(void 0,r),r=void 0},l}(o,{milliseconds:r.timeout});return e.cancel=n,e}return o}(e,t,r={...r,count:1,resolveImmediately:!1}),o=n.then(e=>e[0]);return o.cancel=n.cancel,o}let ro=!!globalThis.process?.versions?.node;function ra(e){let t,r;if(ro){let t;r=new t8((t=globalThis.Buffer.from(e).toString("base64"),`data:text/javascript;base64,${t}`),{type:"module"})}else r=new t8(t=URL.createObjectURL(new globalThis.Blob([e],{type:"text/javascript"})),{type:"module"});return{worker:r,cleanup:()=>{t&&URL.revokeObjectURL(t),r?.terminate()}}}function ri(e){let t=`
|
|
3
3
|
globalThis.onmessage = async ({data: arguments_}) => {
|
|
4
4
|
try {
|
|
5
5
|
const output = await (${e.toString()})(...arguments_);
|
|
@@ -8,7 +8,7 @@ Please open an issue at ${i}.`)}function tW(e,t){if("AwaitExpression"===e.type||
|
|
|
8
8
|
globalThis.postMessage({error});
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
|
-
`;async function r({worker:e,arguments_:t}){let n=
|
|
11
|
+
`;async function r({worker:e,arguments_:t}){let n=rn(e,"message",{rejectionEvents:["error","messageerror"]});e.postMessage(t);let{data:{output:o,error:a}}=await n;if(a)throw a;return o}let n=async(...e)=>{let{worker:n,cleanup:o}=ra(t);try{return await r({arguments_:e,worker:n})}finally{o()}};return n.withSignal=e=>async(...n)=>{e.throwIfAborted();let{worker:o,cleanup:a}=ra(t),i=rn(e,[],{rejectionEvents:["abort"]});try{return await Promise.race([r({arguments_:n,worker:o}),i])}catch(t){throw e.throwIfAborted(),t}finally{i.cancel(),a()}},n}let rs={};function rl(e,{checkReserved:t=!0}={}){if("string"!=typeof e)throw TypeError(`Expected a string, got \`${typeof e}\`.`);return!(e.length>1e5)&&function(e,t,{timeout:r,throwOnTimeout:n}={}){try{return(function(e,{timeout:t,context:r=m.createContext()}={}){let n=(...n)=>(r.functionToRun=()=>e(...n),tZ.runInNewContext(r,{timeout:t}),r.returnValue);return Object.defineProperty(n,"name",{value:`functionTimeout(${e.name||"<anonymous>"})`,configurable:!0}),n})(()=>structuredClone(e).test(t),{timeout:(e=>{if(void 0===e||Number.isNaN(e))return;let t=Math.max(1,Math.trunc(Math.abs(e)));if(Number.isFinite(t))return t})(r),context:rs})()}catch(e){if(e?.code==="ERR_SCRIPT_EXECUTION_TIMEOUT"&&!n)return!1;throw e}}(function({exact:e=!0,checkReserved:t=!0}={}){let r=`${e}${t}`,n=tQ.get(r);if(!n){let o=`(?<![@#$_\\p{ID_Continue}\\p{ID_Start}])${t?tH:""}${tY.source}`;n=RegExp(e?`^${o}$`:o,"u"),tQ.set(r,n)}return n}({checkReserved:t}),e,{timeout:1e3})}function ru(e,t){for(;t;){let r=t.set.get(e);if(r)return r;t=t.upper}}ri((e,t,r)=>new a(e,t).test(r)),ri((e,t,r)=>{let n=new a(e,t).exec(r);if(null!==n)return{match:n[0],index:n.index,groups:n.slice(1),namedGroups:n.groups??{},input:n.input}}),t=function*(e,t,r){let n=new a(e,t);for(let e of r.matchAll(n))yield{match:e[0],index:e.index,groups:e.slice(1),namedGroups:e.groups??{},input:e.input}},r=`
|
|
12
12
|
const nothing = Symbol('nothing');
|
|
13
13
|
let iterator = nothing;
|
|
14
14
|
|
|
@@ -24,34 +24,34 @@ Please open an issue at ${i}.`)}function tW(e,t){if("AwaitExpression"===e.type||
|
|
|
24
24
|
globalThis.postMessage({error});
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
-
`,e=>(...t)=>({async *[Symbol.asyncIterator](){e.throwIfAborted();let{worker:n,cleanup:o}=ro(r),a=rr(e,[],{rejectionEvents:["abort"]});try{let e=!0;for(;;){let r=Promise.race([rr(n,"message",{rejectionEvents:["error","messageerror"]}),a]);n.postMessage(e?t:void 0),e=!1;let{data:{output:o,error:i}}=await r;if(i)throw i;let{value:s,done:l}=o;if(l)break;yield s}}catch(t){throw e.throwIfAborted(),t}finally{a.cancel(),o()}}});let ru=e=>[e,...e.childScopes.flatMap(e=>ru(e))],rp=e=>[...new i(ru(e).flatMap(({references:e})=>e))],rc=new i(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","as","implements","interface","let","package","private","protected","public","static","yield","any","boolean","constructor","declare","get","module","require","number","set","string","symbol","type","from","of"]),rd=e=>"string"==typeof e&&rs(e)&&!rc.has(e),rm=(e,t)=>t.every(t=>!(rl(e,t)||rp(t).some(({identifier:t,resolved:r})=>t?.name===e&&!r))),rf=()=>!0;function rg(e,t,r=rf){if(rd(e)||rd(e+="_")){for(;!rm(e,t)||!r(e,t);)e+="_";return e}}function ry(e,t){if(e.arguments.length>0)return!0;let{sourceCode:r}=t,[n,o]=r.getLastTokens(e,2);return ev(n)&&eC(o)&&r.getRange(e.callee)[1]<r.getRange(e)[1]}function rh(e,t){let{sourceCode:r}=t,n=e.typeArguments??e.callee,o=r.getTokenAfter(n,ev),[a,i]=r.getLastTokens(e,2);return{openingParenthesisToken:o,closingParenthesisToken:i,trailingCommaToken:ex(a)?a:void 0}}function rx(e,t,r=!0){let{sourceCode:n}=e,{openingParenthesisToken:o,closingParenthesisToken:a,trailingCommaToken:i}=rh(t,e),[,s]=n.getRange(o),[l]=n.getRange(r?a:i??a);return n.text.slice(s,l)}function rb(e){let t;switch(e?.type){case"MemberExpression":t=e.property;break;case"ChainExpression":return rb(e.expression);case"Property":case"MethodDefinition":t=e.key}if(t){if("Identifier"===t.type&&!e.computed)return t.name;let r=eN(t);if(!r)return;return String(r.value)}}function rE(e){return["ChainExpression","TSAsExpression","TSSatisfiesExpression","TSTypeAssertion","TSNonNullExpression"].includes(e.type)?rE(e.expression):e}function rv(e,t){if(e=rE(e),t=rE(t),e.type!==t.type)return!1;switch(e.type){case"Super":case"ThisExpression":return!0;case"Identifier":case"PrivateIdentifier":return e.name===t.name;case"Literal":var r,n;return r=e,n=t,r.regex||n.regex?!!(r.regex&&n.regex&&r.regex.pattern===n.regex.pattern&&r.regex.flags===n.regex.flags):r.bigint||n.bigint?r.bigint===n.bigint:r.value===n.value;case"MemberExpression":{let r=rb(e);if(void 0!==r)return rv(e.object,t.object)&&r===rb(t);return e.computed===t.computed&&rv(e.object,t.object)&&rv(e.property,t.property)}default:return!1}}let rC=e=>null===e||"object"!=typeof e&&"function"!=typeof e,rD=(e,t)=>{if(!e)return{value:void 0};let{sourceCode:r}=t,n=eN(e,r.getScope(e));if(n&&rC(n.value))return{value:n.value}},rS=(e,t,r)=>{let n=rD(e,r),o=rD(t,r);if(n&&o){let e,t;return(e=n.value)===(t=o.value)||"number"==typeof e&&"number"==typeof t&&Number.isNaN(e)&&Number.isNaN(t)}return!!e&&!!t&&"Literal"!==e.type&&"Literal"!==t.type&&rv(e,t)},rT=(e,t)=>{let r=[],n=[];for(let o of e)o?.type!=="SpreadElement"&&(r.some(e=>rS(e,o,t))&&n.push(o),r.push(o));return n};function rA(e,t){let{sourceCode:r}=t,{start:{line:n,column:o}}=r.getLoc(e);return r.getLines()[n-1].slice(0,o).match(/\s*$/)[0]}let rw=new i(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion"]),rk=e=>rw.has(e?.type);function rI(e){for(;rk(e);)e=e.expression;return e}function rj(e){return rs(e,{checkReserved:!1})}function rF(e){let{sourceCode:t}=e,r=t.getAllComments?.();return r?.length?r:t.comments??[]}let rB=(e,t)=>Array.isArray(t)?t:e.sourceCode.getRange(t),rR=([e,t],[r,n])=>e>=r&&t<=n;function rP(e,t,r=[]){let{sourceCode:n}=e,o=rB(e,t),a=r.map(t=>rB(e,t));return rF(e).some(e=>{let t=n.getRange(e);return rR(t,o)&&a.every(e=>!rR(t,e))})}function rL(e,t){let{sourceCode:r}=e,n=r.getLoc(t).end.line;return r.getCommentsAfter(t).findLast(e=>r.getLoc(e).start.line===n)}let rN=(e,[t,r])=>{let{sourceCode:n}=e;return n.getAllComments().some(e=>{let[o,a]=n.getRange(e);return o>=t&&a<=r})},r$=new i(["ClassDeclaration","FunctionDeclaration","TSEnumDeclaration","TSInterfaceDeclaration","TSModuleDeclaration","TSTypeAliasDeclaration"]),rM=e=>"VariableDeclaration"===e.type&&"var"!==e.kind||r$.has(e.type),rO=e=>rM(e)||"BlockStatement"===e.type&&e.body.some(e=>rM(e));function rU(e,t){if("Identifier"!==e.type)return;let r=eg(t.sourceCode.getScope(e),e);if(!r||1!==r.defs.length)return;let[n]=r.defs;if("Variable"===n.type&&"VariableDeclarator"===n.node.type&&"VariableDeclaration"===n.parent.type&&"const"===n.parent.kind)return n.node.init}function rq(e,t){let{sourceCode:r}=t,[,n]=e9(e.object,t);return[n,e.computed?r.getRange(r.getTokenBefore(e.property,e=>"["===e.value))[1]:r.getRange(e.property)[0]]}let rV=new i(["depth","height","width"]);function rW(e){return tS(e,{properties:["length","size"],optional:!1})}function r_(e){return/\.(?:ts|mts|cts|tsx)$/i.test(e)}let rz=["Program","StyleSheet","Document","root"];function rK(e,t){let{sourceCode:r}=e;return r.parserServices.getTemplateBodyTokenStore&&r.ast.templateBody&&r.getRange(r.ast.templateBody)[0]<=r.getRange(t)[0]&&r.getRange(t)[1]<=r.getRange(r.ast.templateBody)[1]?r.parserServices.getTemplateBodyTokenStore():r}let rG=({identifiers:e,references:t})=>[...new i([...e,...t.map(({identifier:e})=>e)])];function rJ(e,t){if(!e)return!1;if("ThisExpression"===e.type||"Super"===e.type||"MetaProperty"===e.type&&"new"===e.meta.name&&"target"===e.property.name||"Identifier"===e.type&&"arguments"===e.name||"CallExpression"===e.type&&"Identifier"===e.callee.type&&"eval"===e.callee.name)return!0;for(let r of t[e.type]??[]){let n=e[r];if(Array.isArray(n)){for(let e of n)if(rJ(e,t))return!0}else if(rJ(n,t))return!0}return!1}function rX(e){let t;return(e=rI(e),e?.type==="ChainExpression")?rX(e.expression):(t=e,(t?.type==="MemberExpression"||t?.type==="CallExpression")&&(!!e.optional||("MemberExpression"===e.type?rX(e.object):rX(e.callee))))}let rY=(e,t)=>{let{references:r=[]}=eg(e,t)||{};return r};function rH(e,t){if(t.block!==e)throw Error('"functionScope" should be the scope of "functionNode".');let{type:r,id:n}=e;return"ArrowFunctionExpression"!==r&&(!!(t.thisFound||rY(t,"arguments").some(({from:e})=>e===t))||!!(n&&rY(t,n).length>0))}let rQ=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float16Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"],rZ=new i(["any","error","unknown"]),r0=new i(["null","undefined"]),r1=e=>e.getSymbol()??e.aliasSymbol,r2=(e,t)=>e?.declarations?.some(e=>t.isSourceFileDefaultLibrary(e.getSourceFile()))??!1;function r3(e,t){try{return t.getBaseTypes(e)??e.getBaseTypes?.()??[]}catch{return[]}}let r8="target",r6="non-target",r9="nullish",r5="unknown",r4=new i(["ClassDeclaration","ClassExpression"]),r7=new i(["FunctionDeclaration","FunctionExpression"]),ne=new i(["ClassName","ImportBinding","TSEnumName","Type"]),nt=new i(["TSBigIntKeyword","TSBooleanKeyword","TSNeverKeyword","TSNumberKeyword","TSStringKeyword","TSSymbolKeyword","TSVoidKeyword","TSArrayType","TSLiteralType","TSTupleType","TSTypeLiteral","TSFunctionType","TSConstructorType"]),nr=new i(["TSNullKeyword","TSUndefinedKeyword"]),nn=e=>e===r9?r6:e,no=(e,t)=>0===(e=t.allowNullishInMixedUnion?e.filter(e=>e!==r9):e.map(nn)).length?r6:(t.treatMixedUnionAsTarget?e.includes(r8):e.every(e=>e===r8))?r8:(t.treatMixedUnionAsNonTarget?e.includes(r6):e.every(e=>e===r6))?r6:r5,na=e=>(e=e.map(nn)).includes(r8)?r8:e.every(e=>e===r6)?r6:r5,ni=(e,t)=>{for(;t;){let r=t.set.get(e)?.defs.find(e=>ne.has(e.type));if(r)return r;t=t.upper}},ns=e=>{if("Identifier"===e.type)return e.name;if("TSQualifiedName"===e.type){let t=ns(e.left);return t?`${t}.${e.right.name}`:void 0}},nl=(e,t)=>{let r=t.typeReferenceAliases?.get(e);return t.targetTypeNames.has(e)||r&&t.targetTypeNames.has(r)?r8:t.nonTargetTypeNames?.has(e)?r6:r5},nu=(e,t,r)=>{let{source:n,importedName:o,localName:a}=e,i=t?.get(n);return i?i.has(o)?r8:r6:t&&((e,t)=>{for(let r of t.values())if(r.has(e))return!0;return!1})(o,t)||nl(o,r)!==r5||nl(a,r)!==r5?r6:r5};function np(e,t,r,n=new i){switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return np(e.typeAnnotation,t,r,n);case"TSTypeOperator":return"readonly"===e.operator?np(e.typeAnnotation,t,r,n):r5;case"TSTypeReference":return function e(t,r,n,o){var a,i;let s=ns(t.typeName);if(!s)return r5;let l=((e,t,r)=>{if("TSQualifiedName"!==e.typeName.type||"Identifier"!==e.typeName.left.type||!r.targetTypeNamespaceImports)return r5;let n=e.typeName.right.name,o=ni(e.typeName.left.name,t);return o?.type!=="ImportBinding"||"ImportNamespaceSpecifier"!==o.node.type&&"ImportDefaultSpecifier"!==o.node.type?r5:nu({source:o.parent?.source?.value,importedName:n,localName:n},r.targetTypeNamespaceImports,r)})(t,r,n);if(l!==r5)return l;if(!n.preferTypeReferenceDefinitions){let e=nl(s,n);if(e!==r5)return e}if(o.has(s))return r5;o.add(s);let u=ni(s,r);if(!u)return o.delete(s),nl(s,n);let p=r5,c=((e,t)=>{if("ImportBinding"!==e.type)return r5;if("ImportDefaultSpecifier"===e.node.type)return nl(e.node.local.name,t)===r5?r5:r6;let r=e.node.imported?.name??e.node.imported?.value;return r?nu({source:e.parent?.source?.value,importedName:r,localName:e.node.local.name},t.targetTypeImports,t):r5})(u,n);return c!==r5?p=c:"Type"===u.type&&"TSTypeAliasDeclaration"===u.node.type?p=np(u.node.typeAnnotation,r,n,o):"Type"===u.type&&"TSTypeParameter"===u.node.type?p=np(u.node.constraint,r,n,o):"Type"===u.type&&"TSInterfaceDeclaration"===u.node.type?(a=u.node,p=0===a.extends.length?r6:na(a.extends.map(t=>ns(t.expression)?e({typeName:t.expression},r,n,o):r5))):"ClassName"===u.type&&(i=u.node,p=i.superClass&&n.checkClassHeritage?"Identifier"!==i.superClass.type?r5:nd(i.superClass,r,n,o):r6),o.delete(s),p}(e,t,r,n);case"TSUnionType":return no(e.types.map(e=>np(e,t,r,n)),r);case"TSIntersectionType":return na(e.types.map(e=>np(e,t,r,n)));default:if(r.isTargetTypeAnnotation?.(e))return r8;if(nr.has(e?.type))return r9;return nt.has(e?.type)?r6:r5}}let nc=(e,t,r,n)=>e.superClass&&r.checkClassHeritage?nd(e.superClass,t,r,n):r6;function nd(e,t,r,n=new i){if("Identifier"===e.type){let o=e.name;if(!r.checkClassHeritage)return nl(o,r);if(n.has(o))return r5;n.add(o);let a=((e,t)=>{for(;t;){let r=t.set.get(e);if(r)return r;t=t.upper}})(o,t),[i]=a?.defs??[],s=r5;return i?.type==="Variable"&&"const"===i.parent.kind&&i.node.id===i.name&&i.node.init?s=nd(i.node.init,t,r,n):i?.type==="ClassName"&&(s=nc(i.node,t,r,n)),n.delete(o),i?s:nl(o,r)}return r4.has(e.type)?nc(e,t,r,n):r5}let nm=(e,t,r)=>{let n=e.params.find(e=>"Identifier"===e.type&&"this"===e.name);return np(n?.typeAnnotation,t.sourceCode.getScope(e),r)};function nf(e,t,r,n=new i){if(!e)return r5;if("TSSatisfiesExpression"===e.type)return nf(e.expression,t,r,n);let o=t.sourceCode.getScope(e),a=np(e.typeAnnotation,o,r);if(a!==r5)return a;let s=((e,t,r,n)=>{let o=t.sourceCode.getScope(e);switch(e.type){case"Identifier":return((e,t,r,n)=>{let o=eg(t.sourceCode.getScope(e),e);if(!o||n.has(o)||1!==o.defs.length)return r5;n.add(o);let[a]=o.defs,i=t.sourceCode.getScope(a.name),s=np(a.name?.typeAnnotation,i,r),l=r5;return s!==r5?l=s:"Variable"===a.type&&"const"===a.parent.kind&&a.node.id===a.name&&a.node.init&&(l=nf(a.node.init,t,r,n)),n.delete(o),l})(e,t,r,n);case"ThisExpression":return r.checkClassSyntax?((e,t,r)=>{for(let{parent:n}=e;n;n=n.parent){if(r4.has(n.type))return nc(n,t.sourceCode.getScope(n),r);if("StaticBlock"===n.type||("AccessorProperty"===n.type||"PropertyDefinition"===n.type)&&n.static)return r6;if(r7.has(n.type)){let e=nm(n,t,r);if(e!==r5)return e;if(n.parent?.type==="Property"&&n.parent.parent?.type==="ObjectExpression")return r6;if(n.parent?.type==="MethodDefinition"){if(n.parent.static)return r6;continue}break}}return r5})(e,t,r):r5;case"Super":return r.checkClassSyntax?((e,t,r)=>{for(let{parent:n}=e;n;n=n.parent){if("StaticBlock"===n.type||("AccessorProperty"===n.type||"PropertyDefinition"===n.type)&&n.static||"MethodDefinition"===n.type&&n.static)return r6;if(r4.has(n.type))return n.superClass?nd(n.superClass,t.sourceCode.getScope(n),r):r6}return r5})(e,t,r):r5;case"NewExpression":let a;return r.checkClassSyntax?(a=e.callee,nd(a,t.sourceCode.getScope(a),r,void 0)):r5;case"TSAsExpression":case"TSTypeAssertion":{let a=np(e.typeAnnotation,o,r);return a===r5?nf(e.expression,t,r,n):a}case"TSNonNullExpression":case"ParenthesizedExpression":return nf(e.expression,t,r,n);case"SequenceExpression":return nf(e.expressions.at(-1),t,r,n);case"ConditionalExpression":return no([nf(e.consequent,t,r,n),nf(e.alternate,t,r,n)],r);default:return r5}})(e,t,r,n);if(s!==r5)return s;if("Identifier"!==e.type){let t,n=(t=eN(e,o))?r.getStaticType?.(t.value,e)??r5:r5;if(n!==r5)return n}if(r.isTargetNode?.(e,t)||r.targetConstructorNames?.some(t=>tm(e,{name:t}))||r.targetCallNames?.some(t=>td(e,{name:t},tu)))return r8;let l=((e,t,r)=>{let{parserServices:n}=t.sourceCode;if(!n?.program)return r5;try{let{program:t}=n;return function e(t,r,n,o){if(rZ.has(t.intrinsicName))return r5;if(r0.has(t.intrinsicName))return r9;if(t.isTypeParameter?.()){let a=t.getConstraint();return a?e(a,r,n,o):r5}if(t.isUnion())return no(t.types.map(t=>e(t,r,n,o)),o);if(t.isIntersection())return na(t.types.map(t=>e(t,r,n,o)));if(o.isTargetType?.(t,r,n))return r8;let a=r.getBaseConstraintOfType(t);if(a&&a!==t)return e(a,r,n,o);if(o.checkClassHeritage&&r3(t,r).some(t=>e(t,r,n,o)===r8))return r8;if(t.intrinsicName)return r6;let i=r1(t);if(!i)return r5;let s=i.getName(),l=o.typeReferenceAliases?.get(s);return o.targetTypeNames.has(s)||l&&o.targetTypeNames.has(l)?r8:r6}(n.getTypeAtLocation(e),t.getTypeChecker(),t,r)}catch{return r5}})(e,t,r);return l!==r5?l:r.isNonTargetNode?.(e,t)?r6:r5}let ng=e=>(e={checkClassHeritage:!0,checkClassSyntax:!1,...e},{getType:(t,r,n)=>nn(nf(t,r,{...e,...n})),isTarget:(t,r,n)=>nf(t,r,{...e,...n})===r8,isKnownNonTarget:(t,r,n)=>nn(nf(t,r,{...e,...n}))===r6}),ny=({name:e,aliases:t=[],checkConstructor:r=!0,...n})=>ng({...n,targetTypeNames:new i([e]),typeReferenceAliases:new o(t.map(t=>[t,e])),targetConstructorNames:r?[e]:void 0}),nh=new i(["ObjectExpression","FunctionExpression","ArrowFunctionExpression","ClassExpression","TemplateLiteral"]),nx=new i([...rQ,"Map","ReadonlyMap","WeakMap","Set","ReadonlySet","WeakSet"]),{isTarget:nb,isKnownNonTarget:nE}=ng({checkClassHeritage:!1,preferTypeReferenceDefinitions:!0,targetTypeNames:new i(["Array","ReadonlyArray"]),nonTargetTypeNames:nx,targetCallNames:["Array"],targetConstructorNames:["Array"],isTargetNode:e=>"ArrayExpression"===e.type||tA(e,{object:"Array",methods:["from","of"],optionalCall:!1,optionalMember:!1}),isNonTargetNode:e=>"NewExpression"===e.type||nh.has(e.type),isTargetTypeAnnotation:e=>e?.type==="TSArrayType"||e?.type==="TSTupleType",isTargetType:(e,t)=>t.isArrayType(e)||t.isTupleType(e),getStaticType:(e,t)=>Array.isArray(e)?r8:"Identifier"===t.type||"MemberExpression"===t.type?r5:r6}),nv=new i(["ArrayExpression","FunctionExpression","Literal","ObjectExpression","TemplateLiteral"]);function nC(e,t){return!nv.has(e.type)&&nE(e,t)}let nD=new i(["AnimationEvent","BaseSyntheticEvent","ChangeEvent","ClipboardEvent","CompositionEvent","DragEvent","FocusEvent","FormEvent","InputEvent","InvalidEvent","KeyboardEvent","MouseEvent","PointerEvent","SubmitEvent","SyntheticEvent","TouchEvent","ToggleEvent","TransitionEvent","UIEvent","WheelEvent"]),nS=new i(["AnimationEvent","AnimationPlaybackEvent","AudioProcessingEvent","BeforeUnloadEvent","BlobEvent","ClipboardEvent","CloseEvent","CommandEvent","CompositionEvent","ContentVisibilityAutoStateChangeEvent","CookieChangeEvent","CustomEvent","DeviceMotionEvent","DeviceOrientationEvent","DragEvent","ErrorEvent","Event","ExtendableCookieChangeEvent","ExtendableEvent","ExtendableMessageEvent","FetchEvent","FocusEvent","FontFaceSetLoadEvent","FormDataEvent","GPUUncapturedErrorEvent","GamepadEvent","HashChangeEvent","IDBVersionChangeEvent","InputEvent","KeyboardEvent","MIDIConnectionEvent","MIDIMessageEvent","MediaEncryptedEvent","MediaKeyMessageEvent","MediaQueryListEvent","MediaStreamTrackEvent","MessageEvent","MouseEvent","NavigateEvent","NavigationCurrentEntryChangeEvent","NotificationEvent","OfflineAudioCompletionEvent","PageRevealEvent","PageSwapEvent","PageTransitionEvent","PaymentMethodChangeEvent","PaymentRequestUpdateEvent","PictureInPictureEvent","PointerEvent","PopStateEvent","ProgressEvent","PromiseRejectionEvent","PushEvent","PushSubscriptionChangeEvent","RTCDataChannelEvent","RTCDTMFToneChangeEvent","RTCErrorEvent","RTCPeerConnectionIceErrorEvent","RTCPeerConnectionIceEvent","RTCTrackEvent","RTCTransformEvent","SecurityPolicyViolationEvent","SpeechRecognitionErrorEvent","SpeechRecognitionEvent","SpeechSynthesisErrorEvent","SpeechSynthesisEvent","StorageEvent","SubmitEvent","TaskPriorityChangeEvent","TextEvent","ToggleEvent","TouchEvent","TrackEvent","TransitionEvent","UIEvent","WebGLContextEvent","WheelEvent",...nD]),{isTarget:nT,isKnownNonTarget:nA}=ng({preferTypeReferenceDefinitions:!0,targetTypeImports:new o([["react",nD]]),targetTypeNamespaceImports:new o([["react",nD]]),targetTypeNames:nS}),{isTarget:nw}=ny({name:"Set",aliases:["ReadonlySet"],getStaticType:e=>e instanceof Set?r8:r5}),{isTarget:nk}=ny({name:"Map",aliases:["ReadonlyMap"],getStaticType:e=>e instanceof Map?r8:r5}),nI=new i(["CharacterData","Document","DocumentFragment","Element","HTMLElement","Node","SVGElement","Text"]),nj=new i(["KeyboardEvent","React.KeyboardEvent"]),nF=new i(["Event","MouseEvent","PointerEvent","React.MouseEvent","React.PointerEvent"]),{isKnownNonTarget:nB}=ng({targetTypeNames:nI,getStaticType:e=>{let{Node:t}=globalThis;return"function"==typeof t&&e instanceof t?r8:r5}}),{isKnownNonTarget:nR}=ng({targetTypeNames:nj,nonTargetTypeNames:nF}),nP=e=>("AssignmentExpression"===e.parent.type||"AssignmentPattern"===e.parent.type)&&e.parent.left===e||"UpdateExpression"===e.parent.type&&e.parent.argument===e||"ArrayPattern"===e.parent.type&&e.parent.elements.includes(e)||"RestElement"===e.parent.type&&e.parent.argument===e||"Property"===e.parent.type&&e.parent.value===e&&"ObjectPattern"===e.parent.parent.type&&e.parent.parent.properties.includes(e.parent)||"UnaryExpression"===e.parent.type&&"delete"===e.parent.operator&&e.parent.argument===e,nL=(e,t)=>"CallExpression"===e.type&&!e.optional&&"Identifier"===e.callee.type&&e.callee.name===t,nN=(e,t,r)=>"MemberExpression"===e.type&&!e.computed&&!e.optional&&"Identifier"===e.object.type&&e.object.name===t&&"Identifier"===e.property.type&&r.has(e.property.name),n$=new i(["E","LN2","LN10","LOG2E","LOG10E","PI","SQRT1_2","SQRT2"]),nM=new i(["abs","acos","acosh","asin","asinh","atan","atanh","atan2","cbrt","ceil","clz32","cos","cosh","exp","expm1","floor","fround","hypot","imul","log","log1p","log10","log2","max","min","pow","random","round","sign","sin","sinh","sqrt","tan","tanh","trunc"]),nO=new i(["EPSILON","MAX_SAFE_INTEGER","MAX_VALUE","MIN_SAFE_INTEGER","MIN_VALUE","NaN","NEGATIVE_INFINITY","POSITIVE_INFINITY"]),nU=new i(["parseFloat","parseInt"]),nq=e=>e?.type==="TSNumberKeyword"||e?.type==="TSLiteralType"&&tn(e.literal),nV=new i(["-","*","/","%","**","<<",">>","|","^","&"]);function nW(e,t){let r;if(tn(e)||nN(e,"Math",n$)||"CallExpression"===e.type&&!e.optional&&nN(e.callee,"Math",nM)||nL(e,"Number")||nN(e,"Number",nO)||"CallExpression"===e.type&&!e.optional&&nN(e.callee,"Number",nU)||nL(e,"parseInt")||nL(e,"parseFloat")||"MemberExpression"===e.type&&!e.computed&&!e.optional&&"Identifier"===e.property.type&&"length"===e.property.name)return!0;switch(e.type){case"AssignmentExpression":{let{operator:r}=e;if("="===r&&nW(e.right,t))return!0}case"BinaryExpression":{let{operator:r}=e;if("AssignmentExpression"===e.type&&(r=r.slice(0,-1)),"+"===r&&nW(e.left,t)&&nW(e.right,t)||">>>"===r||nV.has(r)&&(nW(e.left,t)||nW(e.right,t)))return!0;break}case"UnaryExpression":{let{operator:r}=e;if("+"===r||("-"===r||"~"===r)&&nW(e.argument,t))return!0;break}case"UpdateExpression":if(nW(e.argument,t))return!0;break;case"ConditionalExpression":{let r=nW(e.consequent,t),n=nW(e.alternate,t);if(r&&n)return!0;let o=eN(e.test,t);if(null!==o&&(r&&o.value||n&&!o.value))return!0;break}case"SequenceExpression":if(nW(e.expressions.at(-1),t))return!0;break;case"Identifier":if((r=eg(t,e))&&r.defs.some(e=>nq(e.name?.typeAnnotation?.typeAnnotation)))return!0;break;case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":if(nq(e.typeAnnotation))return!0;break;case"TSNonNullExpression":if(nW(e.expression,t))return!0}return"number"==typeof eN(e,t)?.value}ng({targetTypeNames:new i,targetCallNames:["Number"],isTargetTypeAnnotation:nq,isTargetType:e=>e.isNumberLiteral?.()||"number"===e.intrinsicName,getStaticType:e=>"number"==typeof e?r8:r5});let n_=new i([">",">=","<","<=","==","===","!=","!==","in","instanceof"]),nz=new i(["boolean","true","false"]),nK=new i(["isFinite","isNaN"]),nG=new o([["Array",new i(["isArray"])],["ArrayBuffer",new i(["isView"])],["Atomics",new i(["isLockFree"])],["Error",new i(["isError"])],["Number",new i(["isFinite","isInteger","isNaN","isSafeInteger"])],["Object",new i(["hasOwn","is","isExtensible","isFrozen","isSealed"])],["Reflect",new i(["deleteProperty","has"])],["URL",new i(["canParse"])]]),nJ=new o([["array",new i(["every","includes","some"])],["map",new i(["has"])],["regexp",new i(["test"])],["set",new i(["has","isDisjointFrom","isSubsetOf","isSupersetOf"])],["string",new i(["endsWith","includes","isWellFormed","startsWith"])],["weakSet",new i(["has"])]]),nX=new o([["regexp",new i(["dotAll","global","hasIndices","ignoreCase","multiline","sticky","unicode","unicodeSets"])]]);function nY(e,t){let{parserServices:r}=t.sourceCode;if(!r?.program)return!1;try{return function e(t,r){if(!t)return!1;if(t.isUnion?.())return t.types.every(t=>e(t,r));let n=r.getBaseConstraintOfType(t);return n&&n!==t?e(n,r):nz.has(r.typeToString(t))}(r.getTypeAtLocation(e),r.program.getTypeChecker())}catch{return!1}}function nH(e,t,r,n){let o=e.filter(e=>"TSCallSignatureDeclaration"===e.type);return o.length>0&&o.every(e=>nZ(e.returnType,t,r,n))}function nQ({node:e,context:t,scope:r,visitedTypeReferenceNames:n,predicate:o}){let a=function(e){if(e?.type==="Identifier")return e.name}(e.typeName);if(!a||n.has(a))return!1;n.add(a);let i=rl(a,r),[s]=i?.defs??[],l=s?.type==="Type"?t.sourceCode.getScope(s.node):r,u=s?.type==="Type"&&o(s.node,l);return n.delete(a),u}function nZ(e,t,r,n=new i){switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return nZ(e.typeAnnotation,t,r,n);case"TSBooleanKeyword":return!0;case"TSLiteralType":return"boolean"==typeof e.literal.value;case"TSTypeReference":return nQ({node:e,context:t,scope:r,visitedTypeReferenceNames:n,predicate:(e,r)=>"TSTypeAliasDeclaration"===e.type&&nZ(e.typeAnnotation,t,r,n)});case"TSTypePredicate":return!e.asserts;case"TSUnionType":return e.types.every(e=>nZ(e,t,r,n));case"TypeAnnotation":return e.typeAnnotation?.type==="BooleanTypeAnnotation";default:return!1}}function n0(e,t,r,n=new i){switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return n0(e.typeAnnotation,t,r,n);case"TSFunctionType":return nZ(e.returnType,t,r,n);case"TSTypeLiteral":return nH(e.members,t,r,n);case"TSTypeReference":return nQ({node:e,context:t,scope:r,visitedTypeReferenceNames:n,predicate:(e,r)=>"TSTypeAliasDeclaration"===e.type&&n0(e.typeAnnotation,t,r,n)||"TSInterfaceDeclaration"===e.type&&nH(e.body.body,t,r,n)});case"TSUnionType":return e.types.every(e=>n0(e,t,r,n));default:return!1}}function n1(e,t,r=new i){if(e.async||e.generator)return!1;let n=t.sourceCode.getScope(e);return!!nZ(e.returnType,t,n)||!!e.body&&("BlockStatement"===e.body.type&&1===e.body.body.length&&"ReturnStatement"===e.body.body[0].type?n8(e.body.body[0].argument,t,r):"ArrowFunctionExpression"===e.type&&"BlockStatement"!==e.body.type&&n8(e.body,t,r))}function n2(e,t,r=new i){if(e?.type!=="Identifier")return!1;let n=eg(t.sourceCode.getScope(e),e);if(!n||r.has(n))return!1;r.add(n);let o=!1;if(n.defs.length>1&&n.defs.every(e=>"FunctionName"===e.type)){let e=n.defs.filter(e=>"TSDeclareFunction"===e.node.type),a=e.length>0?e:n.defs;o=n.references.every(e=>!e.writeExpr)&&a.every(e=>n1(e.node,t,r))}else if(1===n.defs.length){let[e]=n.defs,a=t.sourceCode.getScope(e.name);if(n0(e.name?.typeAnnotation,t,a))o=!0;else{let a;"FunctionName"===e.type?n.references.every(e=>!e.writeExpr)&&(a=e.node):"Variable"===e.type&&"const"===e.parent.kind&&["ArrowFunctionExpression","FunctionExpression"].includes(e.node.init?.type)&&(a=e.node.init),o=!!a&&n1(a,t,r)}}return r.delete(n),o}function n3(e,t,r=new i){switch(e?.type){case"ArrayExpression":return"array";case"Literal":return"string"==typeof e.value?"string":e.regex?"regexp":void 0;case"TemplateLiteral":return 0===e.expressions.length?"string":void 0;case"NewExpression":if("Identifier"===e.callee.type&&t.sourceCode.isGlobalReference(e.callee)){if("RegExp"===e.callee.name)return"regexp";if(["Map","WeakMap"].includes(e.callee.name))return"map";if("Set"===e.callee.name)return"set";if("WeakSet"===e.callee.name)return"weakSet"}return;case"Identifier":return function(e,t,r){let n=eg(t.sourceCode.getScope(e),e),[o]=n?.defs??[];if(!n||r.has(n)||1!==n.defs.length||"Variable"!==o.type||"const"!==o.parent.kind)return;r.add(n);let a=n3(o.node.init,t,r);return r.delete(n),a}(e,t,r);case"ParenthesizedExpression":case"TSNonNullExpression":case"TSAsExpression":case"TSTypeAssertion":case"TSSatisfiesExpression":return n3(e.expression,t,r)}}function n8(e,t,r=new i){if(!e)return!1;let n=t.sourceCode.getScope(e);return!!nZ(e.typeAnnotation,t,n)||"boolean"==typeof eN(e,t.sourceCode.getScope(e))?.value||(function(e,t,r){switch(e.type){case"Identifier":return function(e,t,r){if(!e||r.has(e)||1!==e.defs.length)return!1;r.add(e);let[n]=e.defs,o=t.sourceCode.getScope(n.name);if(n.name?.typeAnnotation)return r.delete(e),!n.name.optional&&nZ(n.name.typeAnnotation,t,o);let a="Variable"===n.type&&"const"===n.parent.kind&&n8(n.node.init,t,r);if(!a&&"Parameter"===n.type){let e=n.name.parent;a="AssignmentPattern"===e.type&&e.left===n.name&&n.node.params.includes(e)&&n8(e.right,t,r)}return r.delete(e),a}(eg(t.sourceCode.getScope(e),e),t,r)||nY(e,t);case"UnaryExpression":return["!","delete"].includes(e.operator);case"LogicalExpression":return n8(e.left,t,r)&&n8(e.right,t,r);case"BinaryExpression":return n_.has(e.operator);case"ConditionalExpression":return n8(e.consequent,t,r)&&n8(e.alternate,t,r);case"TSAsExpression":case"TSTypeAssertion":case"TSSatisfiesExpression":let n;return n=t.sourceCode.getScope(e),nZ(e.typeAnnotation,t,n)||n8(e.expression,t,r);case"CallExpression":return!!(function(e,t){if("MemberExpression"!==e.callee.type||"Identifier"!==e.callee.object.type||!t.sourceCode.isGlobalReference(e.callee.object))return!1;let r=nG.get(e.callee.object.name),n=eM(e.callee,t.sourceCode.getScope(e.callee));return!!r?.has(n)}(e,t)||function(e,t){if("MemberExpression"!==e.callee.type)return!1;let r=nJ.get(n3(e.callee.object,t)),n=eM(e.callee,t.sourceCode.getScope(e.callee));return!!r?.has(n)}(e,t))||("Identifier"!==e.callee.type?nY(e,t):!!("Boolean"===e.callee.name&&t.sourceCode.isGlobalReference(e.callee)||nK.has(e.callee.name)&&t.sourceCode.isGlobalReference(e.callee))||n2(e.callee,t,r)||nY(e,t));case"MemberExpression":return function(e,t){if("MemberExpression"!==e.type||e.optional)return!1;let r=nX.get(n3(e.object,t)),n=eM(e,t.sourceCode.getScope(e));return!!r?.has(n)}(e,t)||void 0;default:switch(e.type){case"AwaitExpression":case"TSNonNullExpression":case"ParenthesizedExpression":return n8(e.argument??e.expression,t,r);case"SequenceExpression":return n8(e.expressions.at(-1),t,r);case"AssignmentExpression":return"="===e.operator&&n8(e.right,t,r)}return}}(e,t,r)??nY(e,t))}let n6=new i(["asIntN","asUintN"]),n9=e=>{switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return n9(e.typeAnnotation);case"TSBigIntKeyword":return!0;case"TSLiteralType":return ti(e.literal);default:return!1}},{isTarget:n5}=ng({targetTypeNames:new i,targetCallNames:["BigInt"],isTargetNode:e=>ti(e)||nL(e,"BigInt")||"CallExpression"===e.type&&!e.optional&&nN(e.callee,"BigInt",n6),isTargetTypeAnnotation:n9,isTargetType:e=>e.isBigIntLiteral?.()||"bigint"===e.intrinsicName,getStaticType:e=>"bigint"==typeof e?r8:r5}),n4=new i(["fromCharCode","fromCodePoint"]),n7=e=>{switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return n7(e.typeAnnotation);case"TSStringKeyword":return!0;case"TSLiteralType":return te(e.literal);default:return!1}},{isTarget:oe,isKnownNonTarget:ot}=ng({targetTypeNames:new i,targetCallNames:["String"],isTargetNode:(e,t)=>{if(te(e)||nL(e,"String")||"CallExpression"===e.type&&!e.optional&&nN(e.callee,"String",n4))return!0;switch(e.type){case"TemplateLiteral":return!0;case"UnaryExpression":return"typeof"===e.operator;case"BinaryExpression":return"+"===e.operator&&(or(e.left,t)||or(e.right,t));case"AssignmentExpression":if("="===e.operator)return or(e.right,t);return"+="===e.operator&&(or(e.left,t)||or(e.right,t));default:return!1}},isTargetTypeAnnotation:n7,isTargetType:e=>e.isStringLiteral?.()||"string"===e.intrinsicName,getStaticType:e=>"string"==typeof e?r8:r5});function or(e,t){return!!e&&(!!("TSSatisfiesExpression"===e.type&&n7(e.typeAnnotation)||oe(e,t))||"string"==typeof eN(e,t.sourceCode.getScope(e))?.value)}let on=new i(["ArrayExpression","ArrowFunctionExpression","ClassExpression","FunctionExpression","Literal","ObjectExpression","TemplateLiteral"]),oo=e=>on.has(e.type)||tR(e),oa=new i(["ArrayExpression","BinaryExpression","ClassExpression","Literal","ObjectExpression","TemplateLiteral","UnaryExpression","UpdateExpression"]),oi=new i(["AssignmentExpression","AwaitExpression","NewExpression","TaggedTemplateExpression","ThisExpression"]),os=e=>oa.has(e.type)||oi.has(e.type)||tR(e)||td(e,void 0,tu)&&!tA(e,{method:"bind",optionalCall:!1,optionalMember:!1}),ol=(e,t)=>{if("ThisExpression"===e.type)return!0;if("FunctionDeclaration"===e.type||"FunctionExpression"===e.type)return!1;if("ClassDeclaration"===e.type||"ClassExpression"===e.type){if(e.superClass&&ol(e.superClass,t))return!0;for(let r of e.body.body)if(r.computed&&ol(r.key,t))return!0;return!1}let r=t[e.type];if(!r)return!1;for(let n of r){let r=e[n];if(r){if(Array.isArray(r)){for(let e of r)if(e&&ol(e,t))return!0;continue}if(ol(r,t))return!0}}return!1};function ou(e,t,r){let[n,o]=[e,t].map(e=>r.sourceCode.getLoc(e).start.line);return n===o}function op(e,t){let r;if(r=e=t.getNonNullableType(e),!rZ.has(r.intrinsicName)){if(e.isUnion()){let r=e.types.map(e=>op(e,t));return!!r.every(Boolean)||!r.every(e=>!1===e)&&void 0}return void 0!==t.getPromisedTypeOfPromise(e)}}let oc=e=>"use"===e||/^use[\dA-Z]/.test(e),od=(e,t)=>"Identifier"===e.type&&"Identifier"===t.type&&e.name===t.name;function om(e,t){return"Identifier"===e.type&&(t.sourceCode.isGlobalReference(e)||!eg(t.sourceCode.getScope(e),e))}let of=(e,t,r)=>e&&t&&r.sourceCode.getRange(e)[0]===r.sourceCode.getRange(t)[0]&&r.sourceCode.getRange(e)[1]===r.sourceCode.getRange(t)[1],og=(e,t)=>{let{type:r,local:n,imported:o}=e.parent;return"ImportSpecifier"===r&&of(n,o,t)&&n===e},oy=new i(["ArrayExpression","CallExpression","ChainExpression","Identifier","ImportExpression","Literal","MemberExpression","NewExpression","Super","TaggedTemplateExpression","TemplateLiteral","ThisExpression","TSNonNullExpression"]);function oh(e){return oy.has(e.type)}let ox=e=>"Property"===e.parent.type&&e.parent.shorthand&&e===e.parent.value,ob=e=>tx(e.parent),oE=new i(["String","Null","Boolean","Numeric","RegularExpression"]),ov=new i(["[","(","/","`","+","-","*",",","."]);function oC(e,t,r){if(""===r||r&&!ov.has(r.charAt(0))||!e)return!1;let{sourceCode:n}=t,{type:o,value:a}=e,i=n.getRange(e),s=n.getNodeByRangeIndex(i[0]);if("Punctuator"===o){if(";"===a)return!1;if("]"===a)return!0;if(")"===a){switch(s.type){case"IfStatement":if(n.getTokenBefore(s.consequent)===e)return!1;break;case"ForStatement":case"ForInStatement":case"ForOfStatement":case"WhileStatement":case"DoWhileStatement":case"WithStatement":if(s.body&&n.getTokenBefore(s.body)===e)return!1}return!0}}return!!oE.has(o)||("Template"===o?a.endsWith("`"):"ObjectExpression"===s.type||"Identifier"===o&&("of"!==a||"ForOfStatement"!==s.type)&&("await"!==a||"AwaitExpression"!==s.type))}let oD=e=>"type"===e.importKind||"type"===e.parent.importKind,oS=(e,t,r)=>r.sourceCode.getRange(e.name??e.node)[0]<=r.sourceCode.getRange(t)[0],oT=(e,t)=>{for(;t;){let r=t.set.get(e);if(r)return r;t=t.upper}},oA=new i(["Map","ReadonlyMap"]),ow=new i(["Set","ReadonlySet"]),ok=oA.union(ow),oI=e=>new i([e]),oj=e=>ok.has(e)?e:void 0,oF=new i(["ClassName","ImportBinding","TSEnumName","Type"]),oB=(e,t,r)=>{let n=r.sourceCode.getScope(t);for(;n;){if(n.set.get(e)?.defs.find(e=>oF.has(e.type)))return!0;n=n.upper}return!1},oR=e=>{let t=new i;for(let r of e){if(!r)return;for(let e of r)t.add(e)}return t},oP=(e,t)=>{if(rZ.has(e.intrinsicName))return;if(e.isUnion())return oR(e.types.map(e=>oP(e,t)));let r=r1(e);if(!(r?.declarations?.length>0&&r.declarations.every(e=>t.isSourceFileDefaultLibrary(e.getSourceFile()))))return;let n=r.getName(),o=n&&oj(n);return o&&oI(o)},oL=(e,t)=>{switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return oL(e.typeAnnotation,t);case"TSTypeOperator":return"readonly"===e.operator?oL(e.typeAnnotation,t):void 0;case"TSTypeReference":{if("Identifier"!==e.typeName.type||oB(e.typeName.name,e,t))return;let r=oj(e.typeName.name);return r&&oI(r)}case"TSUnionType":return oR(e.types.map(e=>oL(e,t)))}},oN=(e,t,r=new i)=>((e,t)=>{let{parserServices:r}=t.sourceCode;if(r?.program)try{let{program:n}=r,o=oP(r.getTypeAtLocation(e),n);if(o&&!((e,t,r)=>{for(let n of e)if(oB(n,t,r))return!0;return!1})(o,e,t))return o}catch{}})(e,t)??((e,t,r)=>{if(tm(e,{names:["Map","Set"]})&&om(e.callee,t))return oI(e.callee.name);switch(e.type){case"Identifier":return((e,t,r)=>{let n,o=eg(t.sourceCode.getScope(e),e);if(!o||r.has(o)||1!==o.defs.length)return;r.add(o);let[a]=o.defs,i=oL(a.name?.typeAnnotation,t);return i?n=i:"Variable"===a.type&&"const"===a.parent.kind&&a.node.init&&(n=oN(a.node.init,t,r)),r.delete(o),n})(e,t,r);case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":return oL(e.typeAnnotation,t)??oN(e.expression,t,r);case"TSNonNullExpression":case"ParenthesizedExpression":return oN(e.expression,t,r);case"ConditionalExpression":return oR([oN(e.consequent,t,r),oN(e.alternate,t,r)])}})(e,t,r),o$=(e,t)=>{let r=oN(e,t);if(!r?.size)return;let n=!1,o=!1;for(let e of r){if(oA.has(e)){n=!0;continue}if(ow.has(e)){o=!0;continue}return}if(!n||!o)return n?"Map":"Set"};function oM(e,t){if("function"!=typeof e?.[Symbol.iterator])return void t(e);for(let r of e)oM(r,t)}class oO extends Error{name="FixAbortError"}let oU={abort(){throw new oO("Fix aborted.")}};function oq(e){return t=>{let r=e(t,oU),n=[];try{return oM(r,e=>{n.push(e)}),n}catch(e){if(e instanceof oO)return;throw e}}}class oV{#e;#t=new o;constructor(e){this.#e=e}#r(e,t){let r=this.#t;for(let n of e)r.has(n)?r.get(n).push(t):r.set(n,[t])}on(e,t){let r=Array.isArray(e)?e:[e];this.#r(r,t)}onExit(e,t){let r=Array.isArray(e)?e:[e];this.#r(r.map(e=>`${e}:exit`),t)}toEslintListeners(){let e={};for(let[t,r]of this.#t)e[t]=function(e,t){let r=t=>{let r;t&&e.report((r={...t},t.fix&&(r.fix=oq(t.fix)),Array.isArray(t.suggest)&&(r.suggest=t.suggest.map(e=>({...e,fix:oq(e.fix),data:{...t.data,...e.data}}))),r))};return(e,n,o)=>{for(let a of t){let t=a(e,n,o);t&&oM(t,r)}}}(this.#e,r);return e}}let oW=new i;function o_(e){return oW.has(e)?e:t=>{let r=new oV(t),n=e(new Proxy(t,{get:(e,t,n)=>"on"===t||"onExit"===t?r[t].bind(r):Reflect.get(e,t,n)}));return x.equal(n,void 0,`[${t.id}] Rule \`create\` function should return \`undefined\`, please use \`context.on()\` instead of return listeners.`),r.toEslintListeners()}}function oz(e,t){var r;let{visitScriptBlock:n=!0}={},o=o_(e);return r=e=>{let t=o(e),{parserServices:r}=e.sourceCode;return r?.defineTemplateBodyVisitor?n?r.defineTemplateBodyVisitor(t,t):r.defineTemplateBodyVisitor(t):t},oW.add(r),r}let oK={"??":4,"||":4,"&&":5},oG={"|":6,"^":7,"&":8,"==":9,"!=":9,"===":9,"!==":9,"<":10,"<=":10,">":10,">=":10,in:10,instanceof:10,"<<":11,">>":11,">>>":11,"+":12,"-":12,"*":13,"/":13,"%":13,"**":15};function oJ(e){switch(e.type){case"SequenceExpression":return 0;case"AssignmentExpression":case"ArrowFunctionExpression":case"YieldExpression":return 1;case"ConditionalExpression":return 3;case"LogicalExpression":return oK[e.operator];case"BinaryExpression":return oG[e.operator];case"TSAsExpression":case"TSSatisfiesExpression":return 10;case"UnaryExpression":case"AwaitExpression":case"TSTypeAssertion":case"TSNonNullExpression":return 16;case"UpdateExpression":return e.prefix?16:17;case"CallExpression":case"ChainExpression":case"ImportExpression":return 18;case"NewExpression":return 19;default:return 20}}function oX(e){return["AwaitExpression","AssignmentExpression","YieldExpression","SequenceExpression","TSAsExpression","TSTypeAssertion"].includes(e.type)}let oY=/^(?:0|0[0-7]*[89]\d*|[1-9](?:_?\d)*)$/u;function oH(e){if(tn(e=rI(e)))return e.value;if("UnaryExpression"===e.type&&("+"===e.operator||"-"===e.operator)){let t=oH(e.argument);if("number"==typeof t)return"-"===e.operator?-t:t}}function oQ(e,t){switch(e.type){case"Identifier":case"MemberExpression":case"CallExpression":case"ChainExpression":case"TemplateLiteral":case"ThisExpression":case"ArrayExpression":case"FunctionExpression":return!1;case"NewExpression":return!ry(e,t);case"Literal":let r;return!!(tn(e)&&(r=e.raw,oY.test(r)));default:return!0}}let oZ=new i(["!","typeof","void","delete","~","+","-"]),o0=new i(["UpdateExpression","TSNonNullExpression","TSTypeAssertion"]);function o1(e,t){if(!oZ.has(t))throw Error("Unexpected operator");return 16>oJ(e)||o0.has(e.type)}function o2(e,{operator:t,property:r}){if(!r)throw Error("`property` is required.");return("LogicalExpression"!==e.type||e.operator!==t)&&(!!["AwaitExpression","BinaryExpression"].includes(e.type)||["LogicalExpression","ConditionalExpression","AssignmentExpression","ArrowFunctionExpression","YieldExpression","SequenceExpression"].includes(e.type))}function o3(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var o8={exports:{}},o6=o8.exports,o9=o3(function(){return u?o8.exports:(u=1,o8.exports=function(){var e=[],t=[],r={},n={},o={};function a(e){return"string"==typeof e?RegExp("^"+e+"$","i"):e}function i(e,t){return e===t?t:e===e.toLowerCase()?t.toLowerCase():e===e.toUpperCase()?t.toUpperCase():e[0]===e[0].toUpperCase()?t.charAt(0).toUpperCase()+t.substr(1).toLowerCase():t.toLowerCase()}function s(e,t,n){if(!e.length||r.hasOwnProperty(e))return t;for(var o=n.length;o--;){var a=n[o];if(a[0].test(t))return function(e,t){return e.replace(t[0],function(r,n){var o,a,s=(o=t[1],a=arguments,o.replace(/\$(\d{1,2})/g,function(e,t){return a[t]||""}));return""===r?i(e[n-1],s):i(r,s)})}(t,a)}return t}function l(e,t,r){return function(n){var o=n.toLowerCase();return t.hasOwnProperty(o)?i(n,o):e.hasOwnProperty(o)?i(n,e[o]):s(o,n,r)}}function u(e,t,r,n){return function(n){var o=n.toLowerCase();return!!t.hasOwnProperty(o)||!e.hasOwnProperty(o)&&s(o,o,r)===o}}function p(e,t,r){var n=1===t?p.singular(e):p.plural(e);return(r?t+" ":"")+n}return p.plural=l(o,n,e),p.isPlural=u(o,n,e),p.singular=l(n,o,t),p.isSingular=u(n,o,t),p.addPluralRule=function(t,r){e.push([a(t),r])},p.addSingularRule=function(e,r){t.push([a(e),r])},p.addUncountableRule=function(e){if("string"==typeof e){r[e.toLowerCase()]=!0;return}p.addPluralRule(e,"$0"),p.addSingularRule(e,"$0")},p.addIrregularRule=function(e,t){t=t.toLowerCase(),o[e=e.toLowerCase()]=t,n[t]=e},[["I","we"],["me","us"],["he","they"],["she","they"],["them","them"],["myself","ourselves"],["yourself","yourselves"],["itself","themselves"],["herself","themselves"],["himself","themselves"],["themself","themselves"],["is","are"],["was","were"],["has","have"],["this","these"],["that","those"],["echo","echoes"],["dingo","dingoes"],["volcano","volcanoes"],["tornado","tornadoes"],["torpedo","torpedoes"],["genus","genera"],["viscus","viscera"],["stigma","stigmata"],["stoma","stomata"],["dogma","dogmata"],["lemma","lemmata"],["schema","schemata"],["anathema","anathemata"],["ox","oxen"],["axe","axes"],["die","dice"],["yes","yeses"],["foot","feet"],["eave","eaves"],["goose","geese"],["tooth","teeth"],["quiz","quizzes"],["human","humans"],["proof","proofs"],["carve","carves"],["valve","valves"],["looey","looies"],["thief","thieves"],["groove","grooves"],["pickaxe","pickaxes"],["passerby","passersby"]].forEach(function(e){return p.addIrregularRule(e[0],e[1])}),[[/s?$/i,"s"],[/[^\u0000-\u007F]$/i,"$0"],[/([^aeiou]ese)$/i,"$1"],[/(ax|test)is$/i,"$1es"],[/(alias|[^aou]us|t[lm]as|gas|ris)$/i,"$1es"],[/(e[mn]u)s?$/i,"$1s"],[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i,"$1"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1i"],[/(alumn|alg|vertebr)(?:a|ae)$/i,"$1ae"],[/(seraph|cherub)(?:im)?$/i,"$1im"],[/(her|at|gr)o$/i,"$1oes"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i,"$1a"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i,"$1a"],[/sis$/i,"ses"],[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i,"$1$2ves"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/([^ch][ieo][ln])ey$/i,"$1ies"],[/(x|ch|ss|sh|zz)$/i,"$1es"],[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i,"$1ices"],[/\b((?:tit)?m|l)(?:ice|ouse)$/i,"$1ice"],[/(pe)(?:rson|ople)$/i,"$1ople"],[/(child)(?:ren)?$/i,"$1ren"],[/eaux$/i,"$0"],[/m[ae]n$/i,"men"],["thou","you"]].forEach(function(e){return p.addPluralRule(e[0],e[1])}),[[/s$/i,""],[/(ss)$/i,"$1"],[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i,"$1fe"],[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i,"$1f"],[/ies$/i,"y"],[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i,"$1ie"],[/\b(mon|smil)ies$/i,"$1ey"],[/\b((?:tit)?m|l)ice$/i,"$1ouse"],[/(seraph|cherub)im$/i,"$1"],[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i,"$1"],[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i,"$1sis"],[/(movie|twelve|abuse|e[mn]u)s$/i,"$1"],[/(test)(?:is|es)$/i,"$1is"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1us"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i,"$1um"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i,"$1on"],[/(alumn|alg|vertebr)ae$/i,"$1a"],[/(cod|mur|sil|vert|ind)ices$/i,"$1ex"],[/(matr|append)ices$/i,"$1ix"],[/(pe)(rson|ople)$/i,"$1rson"],[/(child)ren$/i,"$1"],[/(eau)x?$/i,"$1"],[/men$/i,"man"]].forEach(function(e){return p.addSingularRule(e[0],e[1])}),["adulthood","advice","agenda","aid","aircraft","alcohol","ammo","analytics","anime","athletics","audio","bison","blood","bream","buffalo","butter","carp","cash","chassis","chess","clothing","cod","commerce","cooperation","corps","debris","diabetes","digestion","elk","energy","equipment","excretion","expertise","firmware","flounder","fun","gallows","garbage","graffiti","hardware","headquarters","health","herpes","highjinks","homework","housework","information","jeans","justice","kudos","labour","literature","machinery","mackerel","mail","media","mews","moose","music","mud","manga","news","only","personnel","pike","plankton","pliers","police","pollution","premises","rain","research","rice","salmon","scissors","series","sewage","shambles","shrimp","software","species","staff","swine","tennis","traffic","transportation","trout","tuna","wealth","welfare","whiting","wildebeest","wildlife","you",/pok[eé]mon$/i,/[^aeiou]ese$/i,/deer$/i,/fish$/i,/measles$/i,/o[iu]s$/i,/pox$/i,/sheep$/i].forEach(p.addUncountableRule),p}(),o8.exports)}());function o5(e,t,r=0,n=0){let{sourceCode:o}=t,[a,i]=Array.isArray(e)?e:o.getRange(e);return{start:o.getLocFromIndex(a+r),end:o.getLocFromIndex(i+n)}}function o4(e,t){let r=[],n=new s,o=new s,a=new l;return e.on("onCodePathStart",()=>{r.push(new i)}),e.on("onCodePathEnd",()=>{r.pop()}),e.on("onCodePathSegmentStart",e=>{r.at(-1).add(e)}),e.on("onCodePathSegmentEnd",e=>{r.at(-1).delete(e)}),e.on("onUnreachableCodePathSegmentStart",e=>{r.at(-1).add(e)}),e.on("onUnreachableCodePathSegmentEnd",e=>{r.at(-1).delete(e)}),e.on("IfStatement",e=>{[...r.at(-1)].some(e=>e.reachable)&&a.add(e)}),e.onExit(["IfStatement > .consequent","IfStatement > .alternate"],e=>{n.set(e,new i(r.at(-1)))}),e.onExit("IfStatement",e=>{let i=r.at(-1);for(let r of[e.consequent,e.alternate]){if(!r)continue;let s=n.get(r),l=s&&[...i].every(e=>e.prevSegments.every(e=>!s.has(e)))||t?.(r);o.set(r,a.has(e)&&!!l)}}),e=>!!(e&&o.get(e))}function o7(e,t,r){let{parent:n}=e;for(let o of t.sourceCode.visitorKeys[n.type]||Object.keys(n)){let t=n[o];if(t!==e&&Array.isArray(t)){let n=t.indexOf(e);if(-1!==n)return t[n+r]}}}let ae=(e,t)=>o7(e,t,-1),at=(e,t)=>o7(e,t,1),ar=e=>e.charAt(0).toUpperCase()+e.slice(1),an=e=>e.charAt(0).toLowerCase()+e.slice(1),ao="too-deep",aa="should-parenthesized",ai="prefer-event-target",as=new i(["@angular/core","eventemitter3"]),al=e=>"VariableDeclarator"===e.parent.type&&e.parent.id===e&&"VariableDeclaration"===e.parent.parent.type&&"const"===e.parent.parent.kind&&e.parent.parent.declarations.includes(e.parent);function au(e){let t;return!!e&&(tI(e)?[t]=e.arguments:"AwaitExpression"===e.type&&"ImportExpression"===e.argument.type&&({source:t}=e.argument),!!(te(t)&&as.has(t.value)))}let ap={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",186:";",187:"=",188:",",189:"-",190:".",191:"/",219:"[",220:"\\",221:"]",222:"'",224:"Meta"},ac="prefer-keyboard-event-key",ad="prefer-keyboard-event-key/suggestion",am=new i(["keyCode","charCode","which"]),af=new i(["onKeyDown","onKeyPress","onKeyUp"]),ag=e=>{var t;return e?.type==="TSTypeAnnotation"&&"TSTypeReference"===e.typeAnnotation.type&&("Identifier"===(t=e.typeAnnotation.typeName).type?"KeyboardEvent"===t.name:"TSQualifiedName"===t.type&&"Identifier"===t.left.type&&"React"===t.left.name&&"Identifier"===t.right.type&&"KeyboardEvent"===t.right.name)},ay=(e,t)=>{var r;let n,o=[],a="ArrowFunctionExpression"===t.type||"FunctionExpression"===t.type;for(let e of(a&&tA(t.parent,{method:"addEventListener",minimumArguments:2,optionalCall:!1,optionalMember:!1})&&t.parent.arguments[1]===t&&o.push({parameter:t.params[0],shouldAutofix:!0}),a&&"JSXExpressionContainer"===(r=t).parent.type&&r.parent.expression===r&&"JSXAttribute"===r.parent.parent.type&&r.parent.parent.value===r.parent&&"JSXAttribute"===(n=r.parent.parent).type&&"JSXIdentifier"===n.name.type&&af.has(n.name.name)&&o.push({parameter:t.params[0],shouldAutofix:!1}),t.params))ag(e.typeAnnotation)&&o.push({parameter:e,shouldAutofix:!1});let i=e.sourceCode.getDeclaredVariables(t);return o.filter(({parameter:t})=>t&&!nR(t,e)).map(e=>({...e,references:i.find(t=>t.identifiers.includes(e.parameter))?.references}))},ah=(e,t)=>e?.parent?.type==="MemberExpression"&&e.parent.property===e&&!e.parent.computed&&e.parent.object===t,ax=(e,t)=>{let r=[];for(let n=t.parent;n;n=n.parent)tE(n)&&r.push(...ay(e,n));return r},ab=(e,{shouldAutofix:t})=>{let r=(e=>{var t;if(e.parent?.type!=="MemberExpression"||e.parent.property!==e)return;let r=((e,t)=>{let r=e;for(;r&&t;)t--,r=r.parent;if(0===t)return r})(e,3);if(!r||"IfStatement"!==r.type)return;let{type:n,operator:o,right:a}=r.test;if(!("BinaryExpression"===n&&r.test.left===e.parent&&("=="===o||"==="===o)&&tn(a)))return;let i=Object.hasOwn(ap,t=a.value)?ap[t]:Number.isSafeInteger(t)&&t>=0&&t<=1114111?String.fromCodePoint(t):void 0;if(i)return{key:i,right:a}})(e),n={messageId:ac,data:{name:e.name},node:e};if(!r)return n;let o=t=>[t.replaceText(e,"key"),t.replaceText(r.right,tz(r.key))];return t?n.fix=o:n.suggest=[{messageId:ad,data:{key:r.key},fix:o}],n},aE=(e,{parameter:t})=>t?.type==="ObjectPattern"&&t.properties.includes(e.parent),av=(e,{references:t})=>{let r=((e,t,r=()=>!0)=>{let n=e;for(;n;){if(n.type===t&&r(n))return n;n=n.parent}})(e,"VariableDeclarator"),n=r?.init;return t&&r?.id===e.parent.parent&&t.some(e=>e.identifier===n)},aC="error",aD="suggestion";function*aS(e,t,r){for(let n of e6(e,r))yield t.remove(n)}function aT(e,t,r,n){if("CallExpression"!==t.type)throw Error(`Unexpected node "${t.type}".`);let{sourceCode:o}=n,[a,i]=o.getLastTokens(t,2);return t.arguments.length>0&&(r=ex(a)?` ${r},`:`, ${r}`),e.insertTextBefore(i,r)}function aA(e,t,r){let n=function(e,t){let r=e.parent,n=r.arguments.indexOf(e),o=e6(e,t),a=o[0]||e,i=o.at(-1)||e,{sourceCode:s}=t,[l]=s.getRange(a),[,u]=s.getRange(i);if(1===r.arguments.length){let e=s.getTokenAfter(i);ex(e)&&([,u]=s.getRange(e))}else if(0===n){let e=s.getTokenAfter(i),t=s.getTokenAfter(e,{includeComments:!0});[u]=s.getRange(t)}else{let e=s.getTokenBefore(a);[l]=s.getRange(e)}return[l,u]}(t,r),o=t.parent;if(0===o.arguments.indexOf(t)&&o.arguments.length>1&&rN(r,n)){let{sourceCode:o}=r,a=e6(t,r).at(-1)||t,[,i]=o.getRange(a),s=o.getTokenAfter(a),[l,u]=o.getRange(s),p=o.text.slice(...n),c=p.slice(i-n[0],l-n[0])+p.slice(u-n[0]);return e.replaceTextRange(n,c)}return e.removeRange(n)}function aw(e,t,r,n){return e.replaceTextRange(e9(t,n),r)}function ak(e,t,r,n){let o=e5(r,n);return("MemberExpression"===t.parent.type&&t.parent.object===t?!oQ(r,n):oh(r))||e4(r,n)||(o=`(${o})`),o.startsWith("{")&&(o=`(${o})`),oC(n.sourceCode.getTokenBefore(t),n,o)&&(o=`;${o}`),e.replaceText(t,o)}function*aI(e,t,r){if("ReturnStatement"!==t.type&&"ThrowStatement"!==t.type)return;let{sourceCode:n}=r,o=n.getFirstToken(t);yield e.insertTextAfter(o," (");let a=n.getLastToken(t);eb(a)?yield e.insertTextBefore(a,")"):yield e.insertTextAfter(t,")")}function aj(e,t,r){let n="object"==typeof e?t.sourceCode.getRange(e)[1]:e,[o]=t.sourceCode.text.slice(n).match(/^\s*/);return r.removeRange([n,n+o.length])}function*aF(e,t,r){let n=t.sourceCode.getFirstToken(e);yield r.remove(n),yield aj(n,t,r),ry(e,t)||(yield r.insertTextAfter(e,"()")),ou(n,e.callee,t)||e4(e,t)||(yield aI(r,e.parent,t))}let aB=({type:e,value:t})=>"Keyword"===e&&/^[a-z]*$/.test(t)||"Identifier"===e&&"of"===t||"Identifier"===e&&"await"===t;function*aR(e,t,r){let{sourceCode:n}=r,o=e9(t,r),a=n.getTokenBefore({range:o},{includeComments:!0});a&&o[0]===n.getRange(a)[1]&&aB(a)&&(yield e.insertTextAfter(a," "));let i=n.getTokenAfter({range:o},{includeComments:!0});i&&o[1]===n.getRange(i)[0]&&aB(i)&&(yield e.insertTextBefore(i," "))}function*aP(e,t,r){var n;yield aR(r,e,t),yield r.insertTextBefore(e,"new ");let{callee:o}=e;!e4(o,t)&&"MemberExpression"===(n=o).type&&function(e){let t=e.object,r=e.object.type;for(;"MemberExpression"===r;)r=(t=t.object).type;return"CallExpression"===r}(n)&&(yield r.insertTextBefore(o,"("),yield r.insertTextAfter(o,")"))}function aL(e,t,r,n){let[,o]=e9(t.object,r),[,a]=r.sourceCode.getRange(t);return e.replaceTextRange([o,a],n)}let aN=(e,t,r)=>aL(e,t,r,"");function*a$(e,t,r){let n=t.callee;yield aN(e,n,r);let[,o]=e9(n,r),[,a]=r.sourceCode.getRange(t);yield e.removeRange([o,a])}function aM(e,t,r,n=!1){let{sourceCode:o}=t,{lines:a}=o,i=e;if(n){let[t,r]=o.getLastTokens(e,2);eb(r)&&(i=t)}let s=o.getLoc(e).start,l=o.getLoc(i).end,u=a[s.line-1].slice(0,s.column),p=a[l.line-1].slice(l.column),[c]=o.getRange(e),[,d]=o.getRange(i);if(/^\s*$/.test(u)&&/^\s*$/.test(p))if(d+=p.length,0===c){let{text:e}=o;"\r"===e[d]&&"\n"===e[d+1]?d+=2:("\n"===e[d]||"\r"===e[d])&&d++}else c=Math.max(0,c-u.length-1);return r.removeRange([c,d])}function aO(e,t,r,n){if(ox(e)||"AssignmentPattern"===e.parent.type&&e.parent.left===e&&ox(e.parent))return n.replaceText(e,`${e.name}: ${t}`);if(og(e,r))return n.replaceText(e,`${e.name} as ${t}`);if(((e,t)=>{let{type:r,local:n,exported:o}=e.parent;return"ExportSpecifier"===r&&of(n,o,t)&&n===e})(e,r))return n.replaceText(e,`${t} as ${e.name}`);if(e.typeAnnotation){let{sourceCode:o}=r;return o.getCommentsInside(e).length>0?n.replaceText(o.getFirstToken(e),t):n.replaceTextRange([o.getRange(e)[0],o.getRange(e.typeAnnotation)[0]],`${t}${e.optional?"?":""}`)}return n.replaceText(e,t)}let aU=(e,t,r,n)=>rG(e).map(e=>aO(e,t,r,n)),aq=(e,t,r,n)=>{let{tail:o}=e,[a,i]=r.sourceCode.getRange(e);return n.replaceTextRange([a+1,i-(o?1:2)],t)};function*aV(e,t,r,n,o){for(let t of e6(e,o?{sourceCode:o}:n))yield aV(t,"",r,n,o);let{sourceCode:a}=n,[i,s]=a.getRange(e),[l]=a.text.slice(0,i).match(/\s*$/),[u]=l.match(/(?:\r?\n|\r)?/);i-=l.length,yield r.replaceTextRange([i,s],`${u}${t}`)}let aW="require-array-join-separator",a_="no-thenable-object",az="no-thenable-export",aK="no-thenable-class",aG=(e,t)=>eN(e,t.sourceCode.getScope(e))?.value==="then",aJ=(e,t)=>{let r="MemberExpression"===e.type?e.property:e.key;return"Literal"===r.type?"then"===r.value:e.computed||"Identifier"!==r.type?"then"===eM(e,t.sourceCode.getScope(e)):"then"===r.name},aX=[{selector:"ObjectExpression",*getNodes(e,t){for(let r of e.properties)"Property"===r.type&&aJ(r,t)&&(yield r.key)},messageId:a_},{selectors:["PropertyDefinition","MethodDefinition"],*getNodes(e,t){aJ(e,t)&&(yield e.key)},messageId:aK},{selector:"MemberExpression",*getNodes(e,t){"AssignmentExpression"===e.parent.type&&e.parent.left===e&&aJ(e,t)&&(yield e.property)},messageId:a_},{selector:"CallExpression",*getNodes(e,t){if(!tA(e,{objects:["Object","Reflect"],method:"defineProperty",minimumArguments:3,optionalCall:!1,optionalMember:!1})||"SpreadElement"===e.arguments[0].type)return;let[,r]=e.arguments;aG(r,t)&&(yield r)},messageId:a_},{selector:"CallExpression",*getNodes(e,t){if(tA(e,{object:"Object",method:"fromEntries",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&"ArrayExpression"===e.arguments[0].type)for(let r of e.arguments[0].elements){if(!(r?.type==="ArrayExpression"&&r.elements[0])||"SpreadElement"===r.elements[0].type)continue;let[e]=r.elements;aG(e,t)&&(yield e)}},messageId:a_},{selector:"Identifier",*getNodes(e){"then"===e.name&&"ExportSpecifier"===e.parent.type&&e.parent.exported===e&&(yield e)},messageId:az},{selector:"Identifier",*getNodes(e){"then"===e.name&&("FunctionDeclaration"===e.parent.type||"ClassDeclaration"===e.parent.type)&&e.parent.id===e&&"ExportNamedDeclaration"===e.parent.parent.type&&e.parent.parent.declaration===e.parent&&(yield e)},messageId:az},{selector:"VariableDeclaration",*getNodes(e,t){if("ExportNamedDeclaration"===e.parent.type&&e.parent.declaration===e)for(let r of t.sourceCode.getDeclaredVariables(e))"then"===r.name&&(yield*r.identifiers)},messageId:az}],aY="no-invalid-remove-event-listener",aH="consistent-function-scoping",aQ=(e,t)=>e&&t&&(e===t||e.block===t.block),aZ=(e,t)=>e.some(e=>aQ(e,t)),a0=["useState","useEffect","useContext","useReducer","useCallback","useMemo","useRef","useImperativeHandle","useLayoutEffect","useDebugValue"].flatMap(e=>[e,`React.${e}`]),a1=new i(["DoWhileStatement","ForInStatement","ForOfStatement","ForStatement","WhileStatement"]),a2=e=>e?.type==="BlockStatement"&&a1.has(e.parent.type)&&e.parent.body===e,a3=new i(["FunctionExpression","ArrowFunctionExpression"]),a8={create:e=>{let{checkArrowFunctions:t}=e.options[0],{sourceCode:r}=e,{scopeManager:n}=r;e.onExit(tb,e=>{if(("ArrowFunctionExpression"!==e.type||t)&&!function(e,t,r){let n,o,a,i=t.acquire(e);if(!i||(o=r.visitorKeys,"ArrowFunctionExpression"===e.type&&ol(e,o))||function(e){let t=e;for(;t.parent;){let{parent:e}=t;if("CallExpression"===e.type&&e.arguments[1]===t&&tb.includes(t.type)&&tF(e.callee,["jest.mock"]))return!0;t=e}return!1}(e))return!0;let s=e.parent;"VariableDeclarator"===s.type&&(s=s.parent),"VariableDeclaration"===s.type&&(s=s.parent),s?.type==="ReturnStatement"&&"ArrowFunctionExpression"===e.type&&(s=s.parent),s=function(e,t){if("ArrowFunctionExpression"===e.type&&"ArrowFunctionExpression"===t.type){let t=function(e){let t=e;for(;t&&"ArrowFunctionExpression"===t.type;)t=t.parent;return t}(e);t&&"ReturnStatement"===t.type&&"ReturnStatement"===(e=function(e){let t=e;for(;"ArrowFunctionExpression"===t.type;)t=t.parent;return t}(e)).type&&(e=e.parent)}return e}(s,e),s?.type==="BlockStatement"&&(n=s,s=s.parent);let l=t.acquire(s),u=function(e,t,r){let n=[];e&&n.push(e);let o=function(e){let t=[];for(;e?.type==="BlockStatement";){if(t.push(e),a2(e))return t;e=e.parent}return[]}(t);if(0===o.length)return n;let a=o.at(-1),i=r.acquire(a.parent);for(let e of(i&&n.push(i),o)){let t=r.acquire(e);t&&n.push(t)}return n}(l,n,t);return!!(0===u.length||u.some(e=>"global"===e.type)||l&&l.block?.parent?.callee&&tF(l.block.parent.callee,a0)||l&&(a=s,a3.has(a.type)&&"CallExpression"===a.parent.type&&a.parent.callee===a))||rp(i).map(({resolved:e})=>e).filter(Boolean).some(e=>e.references.some(e=>{if(aZ(u,e.from))return!0;let{resolved:t}=e,[r]=t.defs;return(r?.type!=="FunctionName"||t.name!==r.name.name)&&aZ(u,t.scope)})||e.defs.some(e=>aZ(u,t.acquire(e.node)))||e.identifiers.some(e=>{if(!e.parent||"FunctionDeclaration"!==e.parent.type||t.acquire(e))return!1;let r=t.acquire(e.parent);return!(!r||aQ(i,r))&&aZ(u,r.upper)}))}(e,n,r))return{node:e,loc:eA(e,r),messageId:aH,data:{functionNameWithKind:eO(e,r)}}})},meta:{type:"suggestion",docs:{description:"Move function definitions to the highest possible scope.",recommended:!0},schema:[{type:"object",additionalProperties:!1,properties:{checkArrowFunctions:{type:"boolean",description:"Whether to check arrow functions."}}}],defaultOptions:[{checkArrowFunctions:!0}],messages:{[aH]:"Move {{functionNameWithKind}} to the outer scope."},languages:["js/js"]}},a6="error",a9="error-unknown",a5="suggestion";function a4(e,t,r){return function*(n){yield n.insertTextAfter(e.callee,`.${r}`),yield aF(e,t,n)}}let a7="no-console-spaces",ie=e=>e.length>1&&" "===e.charAt(0)&&" "!==e.charAt(1),it=e=>e.length>1&&" "===e.at(-1)&&" "!==e.at(-2),ir="no-empty-file",io={create:e=>{let{allowComments:t}=e.options[0];e.filename===e.physicalFilename&&(e.on("Program",r=>{if(r.templateBody)return;if(1===r.body.length&&"Document"===r.body[0].type){let{children:e}=r.body[0];if(e.some(e=>"Comment"!==e.type&&("Text"!==e.type||""!==e.value.trim()))||t&&e.some(e=>"Comment"===e.type))return;return{node:r,messageId:ir}}if(r.body.some(e=>!tg(e,tf)))return;let{sourceCode:n}=e,o=rF(e);if(0!==n.ast.tokens.length||0!==o.length||""===n.text.trim()){if(!o.some(e=>"Line"===e.type&&e.value.startsWith("/"))&&(!(t&&o.length>0&&o.every(e=>"Line"===e.type||"Block"===e.type))||0!==n.ast.tokens.length))return{node:r,messageId:ir}}}),e.on("StyleSheet",r=>{if(r.children.length>0)return;let n=rF(e);if(!t||!(n.length>0))return{node:r,messageId:ir}}),e.on("Document",r=>{if(r.parent?.type==="Program"||null!==r.body&&void 0!==r.body)return;let n=rF(e);if(!t||!(n.length>0))return{node:r,messageId:ir}}),e.on("root",e=>{if(!e.children.some(e=>!("html"===e.type&&/^<!--(?:(?!-->)[\s\S])*-->$/.test(e.value.trim())))&&(!t||!(e.children.length>0)))return{node:e,messageId:ir}}))},meta:{type:"suggestion",docs:{description:"Disallow empty files.",recommended:"unopinionated"},schema:[{type:"object",additionalProperties:!1,properties:{allowComments:{type:"boolean",description:"Whether to allow files that only contain comments."}}}],defaultOptions:[{allowComments:!1}],messages:{[ir]:"Empty files are not allowed."},languages:["js/js","css/css","html/html","json/json","json/jsonc","json/json5","markdown/commonmark","markdown/gfm"]}},ia="no-useless-fallback-in-spread";function ii(e){return"AwaitExpression"===e.parent.type&&e.parent.argument===e?{expression:e.parent,parent:e.parent.parent,isAwaited:!0}:{expression:e,parent:e.parent,isAwaited:!1}}function is(e,t){let r=e?t.sourceCode.getText(e):"";return e?.type==="SequenceExpression"?`(${r})`:r}let il="zero-fraction",iu="dangling-dot",ip="error",ic="suggestion",id=Symbol.for("default"),im=Symbol("NAMESPACE_SPECIFIER_NAME"),ig=e=>{switch(e.type){case"Identifier":return Symbol.for(e.name);case"Literal":return e.value}},iy=e=>"type"===e.exportKind||"type"===e.parent.exportKind;function*ih(e,t,r){switch(e.type){case"ImportSpecifier":case"ExportSpecifier":case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":return void(yield function*(e,t,r,n=!1){let o=e.parent,{specifiers:a}=o;if(1===a.length&&!n)return void(yield t.remove(o));let{sourceCode:i}=r;switch(e.type){case"ImportSpecifier":if(a.every(t=>e===t||e.type!==t.type)){let r=i.getTokenAfter(e,e=>"Identifier"===e.type&&"from"===e.value),n=a.some(e=>"ImportDefaultSpecifier"===e.type),o=i.getTokenBefore(e,n?ex:eD),[s]=i.getRange(o),[l]=i.getRange(r),u=i.getTokenBefore(o),p=i.getRange(u)[1]===s;yield t.replaceTextRange([s,l],p?" ":"");return}case"ExportSpecifier":case"ImportNamespaceSpecifier":case"ImportDefaultSpecifier":{yield t.remove(e);let r=i.getTokenAfter(e);ex(r)&&(yield t.remove(r))}}}(e,t,r));case"ImportDeclaration":case"ExportDefaultDeclaration":case"ExportNamedDeclaration":yield t.remove(e)}}function ix(e,t){let{sourceCode:r}=t,n=r.getTokenBefore(e.source,e=>"Identifier"===e.type&&"from"===e.value),[o]=r.getRange(n),[,a]=r.getRange(e);return r.text.slice(o,a)}let ib={create:function(e){let{sourceCode:t}=e,{checkUsedVariables:r}=e.options[0],n=new i,o=[];e.on("ImportDeclaration",e=>{e.specifiers.length>0&&n.add(e)}),e.on("ExportNamedDeclaration",e=>{te(e.source)&&o.push(e)}),e.on("Program:exit",function*(a){for(let i of n){let n=t.getDeclaredVariables(i);if(n.some(e=>1!==e.defs.length||e.defs[0].parent!==i)||(n=n.map(e=>{let r=function(e,t){let r=e.defs[0].node,n={node:r,declaration:r.parent,variable:e,isTypeImport:oD(r)};switch(r.type){case"ImportDefaultSpecifier":return{name:id,text:"default",...n};case"ImportSpecifier":return{name:ig(r.imported),text:t.getText(r.imported),...n};case"ImportNamespaceSpecifier":return{name:im,text:"*",...n}}}(e,t),n=function(e,t){let r=[];for(let{identifier:n}of e.variable.references){let o=function(e,t){let{parent:r}=e;switch(r.type){case"ExportDefaultDeclaration":return{node:r,name:id,text:"default",isTypeExport:iy(r)};case"ExportSpecifier":return{node:r,name:ig(r.exported),text:t.getText(r.exported),isTypeExport:iy(r)};case"VariableDeclarator":{let n=r.parent.parent;if(r.init===e&&"Identifier"===r.id.type&&!r.id.typeAnnotation&&"VariableDeclaration"===r.parent.type&&"const"===r.parent.kind&&1===r.parent.declarations.length&&r.parent.declarations[0]===r&&"ExportNamedDeclaration"===n.type&&function(e,t){let r=t.getDeclaredVariables(e);if(1!==r.length)return!1;let[{identifiers:n,references:o}]=r;return 1===n.length&&n[0]===e.id&&1===o.length&&o[0].identifier===e.id}(r,t))return{node:n,name:Symbol.for(r.id.name),text:t.getText(r.id),isJSDocumentComment:function(e,t){let r=t.getTokenBefore(e,{includeComments:!0});if(r?.type!=="Block"||!r.value.startsWith("*")||r.value.startsWith("**"))return!1;let n=t.getTokenBefore(r),o=t.getLoc(r).start,a=t.getLoc(r).end,i=t.getLoc(e).start;return(!n||t.getLoc(n).end.line<o.line)&&(a.line===i.line||a.line===i.line-1)}(n,t)}}}}(n,t);o&&(e.name!==im||o.name!==id)&&r.push(o)}return r}(r,t);return{variable:e,imported:r,exports:n}}),!r&&n.some(({variable:e,exports:t})=>e.references.length!==t.length)))continue;let s=!r&&n.some(({variable:e})=>0===e.references.length);for(let{imported:t,exports:r}of n)for(let n of function*(e){for(let t of e)t.isJSDocumentComment||(yield t)}(r)){let r={node:n.node,messageId:ip,data:{exported:n.text}},i=function({context:e,imported:t,exported:r,exportDeclarations:n,program:o}){let a,i=t.declaration,s=i.source.value,l=t.isTypeImport||r.isTypeExport;return l&&(a=n.find(({source:e,exportKind:t})=>"type"===t&&e.value===s)),a||=n.find(({source:e,exportKind:t})=>"type"!==t&&e.value===s),function*(n){if(t.name===im)yield n.insertTextAfter(o,`
|
|
28
|
-
export ${l?"type ":""}* as ${r.text} ${
|
|
29
|
-
export {${s}} ${ix(i,e)}`)}let s=r.isTypeExport&&!t.isTypeImport;1!==t.variable.references.length||s||(yield ih(t.node,n,e)),yield ih(r.node,n,e)}}({context:e,imported:t,exported:n,exportDeclarations:o,program:a});s?r.suggest=[{messageId:ic,fix:i}]:r.fix=i,yield r}}})},meta:{type:"suggestion",docs:{description:"Prefer `export…from` when re-exporting.",recommended:!0},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,properties:{checkUsedVariables:{type:"boolean",description:"Whether to check variables that are used in the module."}}}],defaultOptions:[{checkUsedVariables:!0}],messages:{[ip]:"Use `export…from` to re-export `{{exported}}`.",[ic]:"Switch to `export…from`."},languages:["js/js"]}},iE="prefer-native-coercion-functions",iv=new i(["String","Number","BigInt","Boolean","Symbol"]),iC=new i(["every","filter","find","findLast","findIndex","findLastIndex","some"]),iD=(e,t)=>e?.type==="CallExpression"&&!e.optional&&"Identifier"===e.callee.type&&iv.has(e.callee.name)&&e.arguments[0]?.type==="Identifier"&&e.arguments[0].name===t,iS=(e,t)=>{let r={[t]:!0};for(let t of e.split(".").toReversed())r={[t]:r};return r},iT=(e,t)=>{for(let r of Reflect.ownKeys(t)){let n=t[r];"object"==typeof n?(e[r]??={},iT(e[r],n)):e[r]=n}};class iA{static READ=e0.READ;static CALL=e0.CALL;static CONSTRUCT=e0.CONSTRUCT;#n={};#e;#o;#a;constructor({object:e,objects:t=[e],type:r=e0.READ,context:n,filter:o,handle:a}){for(let e of t)iT(this.#n,iS(e,r));this.#e=n,this.#o=o,this.#a=a}*#i(e,t){let r=t?.context??this.#e,n=t?.filter??this.#o,o=t?.handle??this.#a;for(let t of new e0(e).iterateGlobalReferences(this.#n)){if(n&&!n(t))continue;let e=o(t,r);yield e}}listen(e){let t=e?.context??this.#e;t.onExit("Program",r=>this.#i(t.sourceCode.getScope(r),e))}}let iw="no-document-cookie",ik=new iA({object:"document.cookie",filter:({node:e})=>"AssignmentExpression"===e.parent.type&&e.parent.left===e,handle:({node:e})=>({node:e,messageId:iw})}),iI=e=>[`webkit${e}`,`o${e.toLowerCase()}`,e.toLowerCase()],ij=new i(["click","rightclick","dblclick","auxclick","mousedown","mouseup","mouseover","mouseout","mousemove","mouseenter","mouseleave","mousecancel","selectionchange","selectstart","wheel","keypress","keydown","keyup","blur","focus","deactivate","focusin","focusout","change","reset","select","submit","input","propertychange","dragstart","drag","dragenter","dragover","dragleave","drop","dragend","touchstart","touchmove","touchend","touchcancel","beforeunload","consolemessage","contextmenu","devicechange","devicemotion","deviceorientation","DOMContentLoaded","error","help","load","losecapture","orientationchange","readystatechange","resize","scroll","unload","canplay","canplaythrough","durationchange","emptied","ended","loadeddata","loadedmetadata","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","sourceopen","sourceended","sourceclosed","abort","update","updatestart","updateend","hashchange","pagehide","pageshow","popstate","copy","paste","cut","beforecopy","beforecut","beforepaste","online","offline","message","connect","install","activate","fetch","foreignfetch","messageerror","statechange","updatefound","controllerchange",...iI("AnimationStart"),...iI("AnimationEnd"),...iI("AnimationIteration"),...iI("TransitionEnd"),"pointerdown","pointerup","pointercancel","pointermove","pointerover","pointerout","pointerenter","pointerleave","gotpointercapture","lostpointercapture","MSGestureChange","MSGestureEnd","MSGestureHold","MSGestureStart","MSGestureTap","MSGotPointerCapture","MSInertiaStart","MSLostPointerCapture","MSPointerCancel","MSPointerDown","MSPointerEnter","MSPointerHover","MSPointerLeave","MSPointerMove","MSPointerOut","MSPointerOver","MSPointerUp","text","textinput","textInput","compositionstart","compositionupdate","compositionend","beforeinput","exit","loadabort","loadcommit","loadredirect","loadstart","loadstop","responsive","sizechanged","unresponsive","visibilitychange","storage","DOMSubtreeModified","DOMNodeInserted","DOMNodeRemoved","DOMNodeRemovedFromDocument","DOMNodeInsertedIntoDocument","DOMAttrModified","DOMCharacterDataModified","beforeprint","afterprint","beforeinstallprompt","appinstalled","afterblur","beforeblur","cancel","close","dragexit","encrypted","fullscreenchange","invalid","toggle","search","open","show"]),iF="prefer-add-event-listener",iB={create:e=>{let t,r,n=new i(e.options[0].excludedPackages),o=new s;e.on("onCodePathStart",(e,t)=>{r={node:t,upper:r,returnsSomething:!1}}),e.on("onCodePathEnd",()=>{o.set(r.node,r.returnsSomething),r=r.upper}),e.on("CallExpression",e=>{tI(e)&&!t&&n.has(e.arguments[0].value)&&(t=!0)}),e.on("Literal",e=>{"ImportDeclaration"===e.parent.type&&!t&&n.has(e.value)&&(t=!0)}),e.on("ReturnStatement",e=>{r.returnsSomething||=!!e.argument}),e.on("AssignmentExpression:exit",r=>{let n;if(t)return;let{left:a,right:i,operator:s}=r;if("MemberExpression"!==a.type||a.computed)return;let l=a.property.name;if(!l||!l.startsWith("on"))return;let u=l.slice(2);if(!ij.has(u))return;let p="addEventListener",c="";if(tR(i)||ta(i))p="removeEventListener";else"beforeunload"===u&&("ArrowFunctionExpression"!==i.type&&"FunctionExpression"!==i.type||"BlockStatement"!==i.body.type||o.get(i))?c="Use `event.preventDefault(); event.returnValue = 'foo'` to trigger the prompt.":"message"===u?c="Note that there is difference between `SharedWorker#onmessage` and `SharedWorker#addEventListener('message')`.":"error"===u?c="Note that there is difference between `{window,element}.onerror` and `{window,element}.addEventListener('error')`.":"="!==s||"ExpressionStatement"!==r.parent.type||r.parent.expression!==r||os(i)||(n=t=>((e,t,r,n)=>{let{sourceCode:o}=t,a=n.property.name.slice(2),i=o.getText(n.object);e4(n.object,t)&&(i=`(${i})`);let s=o.getText(r.right);e4(r.right,t)&&(s=`(${s})`);let l=`${i}.addEventListener('${a}', ${s})`;return e.replaceText(r,l)})(t,e,r,a));return{node:a.property,messageId:iF,data:{replacement:p,method:l,extra:c?` ${c}`:""},fix:n}})},meta:{type:"suggestion",docs:{description:"Prefer `.addEventListener()` and `.removeEventListener()` over `on`-functions.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{excludedPackages:{type:"array",items:{type:"string"},uniqueItems:!0,description:"Packages to exclude from checking."}}}],defaultOptions:[{excludedPackages:["koa","sax"]}],messages:{[iF]:"Prefer `{{replacement}}` over `{{method}}`.{{extra}}"},languages:["js/js"]}},iR=new i(["false","true"]),iP=(e,t)=>"BinaryExpression"===e.type&&"==="===e.operator&&(od(e.left,t)||od(e.right,t)),iL=({type:e,name:t},r)=>"Identifier"===e&&t===r;function iN({method:e,replacement:t,checkBooleanPredicate:r=!1}){let n=`prefer-${t}-over-${e}/`,o=`${n}error`,a=`${n}suggestion`;return{messages:{[o]:({findIndex:"Use `.indexOf()` instead of `.findIndex()` when looking for the index of an item.",findLastIndex:"Use `.lastIndexOf()` instead of `.findLastIndex() when looking for the index of an item.`",some:`Use \`.${t}()\` instead of \`.${e}()\` when checking value existence.`})[e],[a]:`Replace \`.${e}()\` with \`.${t}()\`.`},listen:function(n){let{sourceCode:i}=n,{scopeManager:s}=i;n.on("CallExpression",r=>{let l,u,p;if(!tA(r,{method:e,argumentsLength:1,optionalCall:!1})||!("ArrowFunctionExpression"===(p=r.arguments[0]).type&&!p.async&&1===p.params.length&&iP(p.body,p.params[0])||("ArrowFunctionExpression"===p.type||"FunctionExpression"===p.type)&&!p.async&&!p.generator&&1===p.params.length&&"BlockStatement"===p.body.type&&1===p.body.body.length&&"ReturnStatement"===p.body.body[0].type&&iP(p.body.body[0].argument,p.params[0]))||nC(r.callee.object,n))return;let[c]=r.arguments,d="BinaryExpression"===c.body.type?c.body:c.body.body[0].argument,[m]=c.params,{left:f,right:g}=d,{name:y}=m;if(iL(f,y))l=g,u=f;else{if(!iL(g,y))return;l=f,u=g}let h=s.acquire(c);if(!h||eg(h,m).references.some(({identifier:e})=>e!==u)||rH(c,h))return;let x=r.callee.property,b={node:x,messageId:o,suggest:[]},E=function*(e){let r=i.getText(l);e4(l,n)&&!e4(c,n)&&(r=`(${r})`),yield e.replaceText(x,t),yield e.replaceText(c,r)};return e_(l,i)?b.suggest.push({messageId:a,fix:E}):b.fix=E,b}),r&&i.parserServices?.program&&n.on("CallExpression",r=>{if(!tA(r,{method:e,argumentsLength:1,optionalCall:!1}))return;let[n]=r.arguments;if("ArrowFunctionExpression"!==n.type&&"FunctionExpression"!==n.type||1!==n.params.length||"Identifier"!==n.params[0].type)return;let[a]=n.params,{parserServices:l}=i,u=function(e,t){let r="ArrowFunctionExpression"!==e.type||e.async||1!==e.params.length||"BlockStatement"===e.body.type?"ArrowFunctionExpression"!==e.type&&"FunctionExpression"!==e.type||e.async||e.generator||1!==e.params.length||"BlockStatement"!==e.body.type||1!==e.body.body.length||"ReturnStatement"!==e.body.body[0].type?void 0:e.body.body[0].argument:e.body;if(r){if(od(r,t))return r;if("CallExpression"===r.type&&!r.optional&&iL(r.callee,"Boolean")&&1===r.arguments.length&&od(r.arguments[0],t))return r.arguments[0]}}(n,a);if(!u||!function(e){if("boolean"===e.intrinsicName||"true"===e.intrinsicName)return!0;if(!e.isUnion())return!1;let t=e.types.map(e=>e.intrinsicName);return t.includes("true")&&t.every(e=>iR.has(e))}(l.getTypeAtLocation(a))||!function(e,t){if(e.isUnion())return!1;let r=t.program.getTypeChecker();return!!e.getProperty("includes")&&(r.isArrayType(e)||r.isTupleType(e))}(l.getTypeAtLocation(r.callee.object),l))return;let p=s.acquire(n);if(!p||eg(p,a).references.some(({identifier:e})=>e!==u)||rH(n,p))return;let c=r.callee.property;return{node:c,messageId:o,*fix(e,{abort:r}){i.getCommentsInside(n).length>0&&r(),yield e.replaceText(c,t),yield e.replaceText(n,"true")}}})}}}let i$=iN({method:"findIndex",replacement:"indexOf"}),iM=iN({method:"findLastIndex",replacement:"lastIndexOf"}),iO={create(e){i$.listen(e),iM.listen(e)},meta:{type:"suggestion",docs:{description:"Prefer `Array#{indexOf,lastIndexOf}()` over `Array#{findIndex,findLastIndex}()` when looking for the index of an item.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{...i$.messages,...iM.messages},languages:["js/js"]}},iU="error",iq="prefer-date",iV="prefer-date-now-over-methods",iW="prefer-date-now-over-number-data-object",i_=e=>tm(e,{name:"Date",argumentsLength:0}),iz=(e,t,r)=>({node:e,messageId:iq,*fix(t){yield t.replaceText(e,"Date.now()"),"UnaryExpression"===e.type&&(yield aR(t,e,r))},...t}),iK="prefer-dataset",iG="prefer-attributes",iJ=e=>`data-${e.replaceAll(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`,iX=e=>tS(e,{property:"dataset"}),iY=e=>e.computed||"Identifier"!==e.property.type?e.computed&&te(e.property)?e.property.value:void 0:e.property.name,iH=new i(["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf","__proto__","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"]),iQ=/[\s\u0000-\u001F"'/<=>]/,iZ=e=>iH.has(e)||e.includes("-")||iQ.test(e);function i0(e,t){let r=e5(e,t);return!e4(e,t.sourceCode)&&oQ(e,t)?`(${r})`:r}let i1={create:e=>{let{preferAttributes:t}=e.options[0];if(t){let{sourceCode:t}=e,r=(r,n,o)=>{if(iZ(n.value)||nB(o.object,e))return;let a=i0(o.object,e),i=o.optional?"?.":".",s=tz(iJ(n.value),n.raw.charAt(0)),l=rP(e,r,[o.object])?void 0:n=>{let o=`${a}${i}hasAttribute(${s})`;return oC(t.getTokenBefore(r),e,o)&&(o=`;${o}`),n.replaceText(r,o)};return{node:r,messageId:iG,data:{method:"hasAttribute"},fix:l}};e.on("BinaryExpression",e=>{if("in"===e.operator&&te(e.left)&&iX(e.right))return r(e,e.left,e.right)}),e.on("CallExpression",e=>tA(e,{object:"Object",method:"hasOwn",argumentsLength:2,optionalCall:!1,optionalMember:!1})&&iX(e.arguments[0])&&te(e.arguments[1])?r(e,e.arguments[1],e.arguments[0]):tA(e,{method:"hasOwnProperty",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&iX(e.callee.object)&&te(e.arguments[0])?r(e,e.arguments[0],e.callee.object):void 0),e.on("VariableDeclarator",t=>{let r;if(!(t.init&&iX(t.init)&&("ObjectPattern"===t.id.type||"Identifier"===t.id.type))||nB(t.init.object,e))return;let n=t.init;if("Identifier"===t.id.type)return{node:n,messageId:iG,data:{method:"getAttribute"},fix:function(e,t){let{sourceCode:r}=t,n=e.init,o=e.parent,[a]=r.getDeclaredVariables(e);if(!a)return;let i=function(e){let t=[];for(let r of e.references){if(r.init)continue;let{identifier:e}=r,n=e.parent;if("MemberExpression"!==n.type||n.object!==e||n.optional)return;let o=iY(n);if(void 0===o||iZ(o))return;let{parent:a}=n;if(nP(n)||"CallExpression"===a.type&&a.callee===n||"TaggedTemplateExpression"===a.type&&a.tag===n)return;t.push(n)}return t}(a);if(!(i&&i.length>0&&"const"===o.kind&&1===o.declarations.length&&!o.parent.type.startsWith("For")&&"ExportNamedDeclaration"!==o.parent.type&&"Identifier"===n.object.type&&function(e,t,r){let{sourceCode:n}=r,{name:o}=e.object,a=e=>eg(n.getScope(e),o),i=a(e.object),s=t.some(e=>a(e)!==i),l=!!i?.references.some(e=>e.isWrite()&&!e.init);return!s&&!l}(n,i,t)&&!rP(t,o)&&i.every(e=>!rP(t,e))))return;let s=i0(n.object,t);return function*(e){for(let r of(yield aM(o,t,e),i)){let t=r.computed?r.property.raw.charAt(0):void 0,n=tz(iJ(iY(r)),t);yield e.replaceText(r,`${s}.getAttribute(${n})`)}}}(t,e)};let{properties:o}=t.id;if(o.some(e=>"Property"===e.type&&(e.computed||"Identifier"!==e.key.type?!te(e.key)||iZ(e.key.value):iZ(e.key.name))))return;let a=t.parent,i=i0(n.object,e),s=n.optional?"?.":".";if(o.length>0&&1===a.declarations.length&&!a.parent.type.startsWith("For")&&"ExportNamedDeclaration"!==a.parent.type&&!rP(e,a,[n.object])&&o.every(e=>"Property"===e.type&&!e.computed&&"Identifier"===e.key.type&&"Identifier"===e.value.type)&&(1===o.length||"Identifier"===n.object.type)){let t=rA(a,e),n=o.map(e=>{let t=tz(iJ(e.key.name),"'");return`${a.kind} ${e.value.name} = ${i}${s}getAttribute(${t})`});r=e=>e.replaceText(a,`${n.join(`;
|
|
30
|
-
${t}`)};`)}return{node:n,messageId:iG,data:{method:"getAttribute"},fix:r}}),e.on("MemberExpression",r=>{let n,{object:o}=r;if(!iX(o)||nB(o.object,e))return;let a=iY(r);if(void 0===a||iZ(a)||r.optional)return;let i="ChainExpression"===r.parent.type?r.parent.parent:r.parent;if("CallExpression"===i.type&&i.callee===r||"TaggedTemplateExpression"===i.type&&i.tag===r||"UpdateExpression"===i.type||"AssignmentExpression"===i.type&&i.left===r&&"="!==i.operator)return;let s="AssignmentExpression"===i.type&&i.left===r,l="UnaryExpression"===i.type&&"delete"===i.operator;if(nP(r)&&!s&&!l)return;let u=i0(o.object,e),p=o.optional?"?.":".",c=r.computed?r.property.raw.charAt(0):void 0,d=tz(iJ(a),c);return s&&ob(i)&&!rP(e,i,[o.object,i.right])?n=t=>t.replaceText(i,`${u}${p}setAttribute(${d}, ${e5(i.right,e)})`):l&&tx(i.parent)&&!rP(e,i,[o.object])?n=r=>{let n=`${u}${p}removeAttribute(${d})`;return oC(t.getTokenBefore(i),e,n)&&(n=`;${n}`),r.replaceText(i,n)}:s||l||rP(e,r,[o.object])||(n=e=>e.replaceText(r,`${u}${p}getAttribute(${d})`)),{node:r,messageId:iG,data:{method:s?"setAttribute":l?"removeAttribute":"getAttribute"},fix:n}});return}e.on("CallExpression",t=>{if(!((tA(t,{method:"setAttribute",argumentsLength:2,optionalCall:!1,optionalMember:!1})||tA(t,{methods:["removeAttribute","hasAttribute"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||tA(t,{method:"getAttribute",argumentsLength:1,optionalCall:!1}))&&te(t.arguments[0]))||nB(t.callee.object,e))return;let r=t.callee.property.name,n="ChainExpression"===t.parent.type?t.parent:t;if(("AwaitExpression"!==n.parent.type||n.parent.argument!==n||"getAttribute"!==r)&&t.arguments[0].value.toLowerCase().startsWith("data-"))return{node:t,messageId:iK,data:{method:r},fix:function(e,t){let r=e.callee.property.name;if("setAttribute"===r&&rX(e.callee)||"setAttribute"===r&&!ob(e)||"removeAttribute"===r&&!tx(e.parent))return;let n=[e.callee.object];if("setAttribute"===r&&n.push(e.arguments[1]),!rP(t,e,n))return n=>{let[o]=e.arguments,a=o.value.toLowerCase().slice(5).replaceAll(/-[a-z]/g,e=>e[1].toUpperCase()),i="",s=`${i0(e.callee.object,t)}${e.callee.optional?"?":""}.dataset`;switch(r){case"setAttribute":case"getAttribute":case"removeAttribute":i=rj(a)?`.${a}`:`[${tz(a,o.raw.charAt(0))}]`,i=`${s}${i}`,"setAttribute"===r?i+=` = ${e5(e.arguments[1],t)}`:"removeAttribute"===r&&(i=`delete ${i}`);break;case"hasAttribute":i=`Object.hasOwn(${s}, ${tz(a,o.raw.charAt(0))})`}return n.replaceText(e,i)}}(t,e)}})},meta:{type:"suggestion",docs:{description:"Enforce consistent style for DOM element dataset access.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{preferAttributes:{type:"boolean",description:"Prefer attribute methods over named `.dataset` access."}}}],defaultOptions:[{preferAttributes:!1}],messages:{[iK]:"Prefer `.dataset` over `{{method}}(…)`.",[iG]:"Prefer `.{{method}}(…)` over `.dataset`."},languages:["js/js"]}},i2="prefer-modern-math-apis",i3=(e,t)=>"MemberExpression"===e.type&&!e.optional&&!e.computed&&"Identifier"===e.object.type&&"Math"===e.object.name&&"Identifier"===e.property.type&&e.property.name===t,i8=(e,t)=>"CallExpression"===e.type&&!e.optional&&i3(e.callee,t)&&1===e.arguments.length&&"SpreadElement"!==e.arguments[0].type;function i6({constantName:e,replacementMethod:t}){let r=`Math.${t}(…)`;return function(n,o){let a,i;if("BinaryExpression"!==n.type||"*"!==n.operator||(i8(n.left,"log")&&i3(n.right,e)?(a=n.left,i=`Math.log(…) * Math.${e}`):i8(n.right,"log")&&i3(n.left,e)&&(a=n.right,i=`Math.${e} * Math.log(…)`),!a))return;let[s]=a.arguments;return{node:n,messageId:i2,data:{replacement:r,description:i},fix:e=>e.replaceText(n,`Math.${t}(${e5(s,o)})`)}}}function i9({constantName:e,replacementMethod:t}){let r={messageId:i2,data:{replacement:`Math.${t}(…)`,description:`Math.log(…) / Math.${e}`}};return function(n,o){if(!("BinaryExpression"===n.type&&"/"===n.operator&&i8(n.left,"log")&&i3(n.right,e)))return;let[a]=n.left.arguments;return{...r,node:n,fix:e=>e.replaceText(n,`Math.${t}(${e5(a,o)})`)}}}let i5=[i6({constantName:"LOG10E",replacementMethod:"log10"}),i6({constantName:"LOG2E",replacementMethod:"log2"}),i9({constantName:"LN10",replacementMethod:"log10"}),i9({constantName:"LN2",replacementMethod:"log2"})],i4=e=>"BinaryExpression"===e.type&&"+"===e.operator?[e.left,e.right].flatMap(e=>i4(e)):[e],i7="number-literal-case",se=(e,{hexadecimalValue:t})=>{let r=e.toLowerCase();return r.startsWith("0x")&&(r="0x"+r.slice(2)["lowercase"===t?"toLowerCase":"toUpperCase"]()),r},st={create:oz(e=>{e.on("Literal",t=>{let{raw:r}=t,n=e.options[0]??{};n.hexadecimalValue??="uppercase";let o=r;if(tn(t)?o=se(r,n):ti(t)&&(o=se(r.slice(0,-1),n)+"n"),r!==o)return{node:t,messageId:i7,fix:e=>e.replaceText(t,o)}})}),meta:{type:"suggestion",docs:{description:"Enforce proper case for numeric literals.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{hexadecimalValue:{enum:["uppercase","lowercase"]}}}],defaultOptions:[{hexadecimalValue:"uppercase"}],messages:{[i7]:"Invalid number literal casing."},languages:["js/js"]}},sr="error",sn="suggestion",so={parseInt:!0,parseFloat:!0,NaN:!0,Infinity:!0,isNaN:!1,isFinite:!1},sa=e=>{let{parent:t}=e;return"UnaryExpression"===t.type&&"-"===t.operator&&t.argument===e};function si(e,t){let{node:r,path:n}=e,[o]=n,{parent:a}=r,i=o;"Infinity"===o&&(i=sa(r)?"NEGATIVE_INFINITY":"POSITIVE_INFINITY");let s={node:r,messageId:sr,data:{description:o,property:i}};if("NEGATIVE_INFINITY"===i)return s.node=a,s.data.description="-Infinity",s.fix=function*(e){yield e.replaceText(a,"Number.NEGATIVE_INFINITY"),yield aR(e,a,t)},s;let l=e=>aO(r,`Number.${i}`,t,e);return so[o]||((e,t)=>{let{parent:r}=e;if("CallExpression"!==r.type||r.callee!==e||1!==r.arguments.length)return!1;let[n]=r.arguments;return"SpreadElement"!==n.type&&nW(n,t.sourceCode.getScope(e))})(r,t)?s.fix=l:s.suggest=[{messageId:sn,fix:l}],s}let ss={create:e=>{let{checkInfinity:t,checkNaN:r}=e.options[0];new iA({objects:Object.keys(so).filter(e=>(!!t||"Infinity"!==e)&&(r||"NaN"!==e)),context:e,handle:si,filter(t){let{node:r,path:n}=t,[o]=n;return!nP(r)&&!("Infinity"===o&&(e=>{if(!sa(e))return!1;let{parent:t}=e,{parent:r}=t;return"UnaryExpression"===r.type&&"delete"===r.operator&&r.argument===t})(r))&&!("parseInt"===o&&function(e,t){let{parent:r}=e;if("CallExpression"!==r.type||r.callee!==e)return!1;let n=r.arguments[1];return!n||"SpreadElement"!==n.type&&eN(n,t.sourceCode.getScope(n))?.value===10}(r,e))}}).listen()},meta:{type:"suggestion",docs:{description:"Prefer `Number` static methods over global functions and optionally static properties over global constants.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,properties:{checkInfinity:{type:"boolean",description:"Whether to check usage of the global `Infinity`."},checkNaN:{type:"boolean",description:"Whether to check usage of the global `NaN`."}}}],defaultOptions:[{checkInfinity:!1,checkNaN:!1}],messages:{[sr]:"Prefer `Number.{{property}}` over `{{description}}`.",[sn]:"Replace `{{description}}` with `Number.{{property}}`."},languages:["js/js"]}},sl="prefer-reflect-apply",su=(e,t)=>(ta(e)||"ThisExpression"===e.type)&&("ArrayExpression"===t.type||"Identifier"===t.type&&"arguments"===t.name),sp=(e,t,r,n)=>`Reflect.apply(${e.getText(t)}, ${e.getText(r)}, ${e.getText(n)})`,sc="prefer-set-size";var sd={exports:{}},sm=o3(function(){var e,t,r,n;return p?sd.exports:(p=1,r=String.fromCodePoint||(e=String.fromCharCode,t=Math.floor,function(){var r,n,o=[],a=-1,i=arguments.length;if(!i)return"";for(var s="";++a<i;){var l=Number(arguments[a]);if(!isFinite(l)||l<0||l>1114111||t(l)!=l)throw RangeError("Invalid code point: "+l);l<=65535?o.push(l):(l-=65536,r=(l>>10)+55296,n=l%1024+56320,o.push(r,n)),(a+1==i||o.length>16384)&&(s+=e.apply(null,o),o.length=0)}return s}),n={parse:function(e,t,n){function o(t,r){return t.range[0]=r,t.raw=e.substring(r,t.range[1]),t}function a(t,r){return{type:"anchor",kind:t,range:[H-r,H],raw:e.substring(H-r,H)}}function i(t,r,n,o){return{type:"value",kind:t,codePoint:r,range:[n,o],raw:e.substring(n,o)}}function s(e,t,r,n){return n=n||0,i(e,t,H-(r.length+n),H)}function l(e){var t,r=e[0],n=r.charCodeAt(0);return Y&&1===r.length&&n>=55296&&n<=56319&&(t=h().charCodeAt(0))>=56320&&t<=57343?i("symbol",(n-55296)*1024+t-56320+65536,++H-2,H):i("symbol",n,H-1,H)}function u(t,r,n,o,a){return null==o&&(n=H-1,o=H),{type:"quantifier",min:t,max:r,greedy:!0,body:null,symbol:a,range:[n,o],raw:e.substring(n,o)}}function p(t,r,n,o){return{type:"characterClass",kind:t.kind,body:t.body,negative:r,range:[n,o],raw:e.substring(n,o)}}function c(t,r,n,o){return t.codePoint>r.codePoint&&W("invalid range in character class",t.raw+"-"+r.raw,n,o),{type:"characterClassRange",min:t,max:r,range:[n,o],raw:e.substring(n,o)}}function d(e){return"alternative"===e.type?e.body:[e]}function m(e){H+=e=e||1}function f(e){g(e)||W("character",e)}function g(t){var r=t.length;if(e.substring(H,H+r)===t)return m(r),t}function y(t){if(e[H]===t)return H++,t}function h(){return e[H]}function x(t){return e[H]===t}function b(t){return e[H+1]===t}function E(t){var r=e.substring(H).match(t);return r&&(H+=r[0].length),r}function v(){var t,r=[],n=H;for(r.push(C());y("|");)r.push(C());return 1===r.length?r[0]:{type:"disjunction",body:r,range:[n,t=H],raw:e.substring(n,t)}}function C(){for(var t,r,s=[],u=H;r=function(){if(H>=e.length||x("|")||x(")"))return null;var t,r=function(){switch(h()){case"^":return m(),a("start",1);case"$":return m(),a("end",1);case"\\":if(b("b"))return m(2),a("boundary",2);if(b("B"))return m(2),a("not-boundary",2);break;case"(":return D("(?=","lookahead","(?!","negativeLookahead");default:return}}();if(r){var s=H;if(t=T()||!1){if(!Y&&"group"===r.type)return t.body=d(r),o(t,r.range[0]),t;H=s,W("Expected atom")}return r}var u=function(){var t;switch(t=h()){case".":return m(),{type:"dot",range:[H-1,H],raw:"."};case"\\":if(m(),!(t=w())){if(!Y&&"c"==h())return i("symbol",92,H-1,H);W("atomEscape")}return t;case"[":return N();case"(":if(n.lookbehind&&(t=D("(?<=","lookbehind","(?<!","negativeLookbehind")))return t;if(n.namedGroups&&g("(?<")){var r,o,a,s,u,p=B();f(">");var c=S("normal",p.range[0]-3);return c.name=p,c}if(!n.modifiers||"(?"!==e.substring(H,H+2)||":"==e[H+2])return D("(?:","ignore","(","normal");return o=H,m(2),a=E(/^[sim]+/),y("-")&&":"!==h()?(r=E(/^[sim]+/))||W("Invalid flags for modifiers group"):a||W("Invalid flags for modifiers group"),((s=(a=a?a[0]:"")+(r=r?r[0]:"")).length>3||function(e){for(var t=0;t<e.length;){if(-1!=e.indexOf(e[t],t+1))return!0;t++}return!1}(s))&&W("flags cannot be duplicated for modifiers group"),y(":")||W("Invalid flags for modifiers group"),(u=S("ignore",o)).modifierFlags={enabling:a,disabling:r},u;case"]":case"}":if(!Y)return m(),l(t);break;case"^":case"$":case"*":case"+":case"?":case"{":case")":case"|":break;default:return m(),l(t)}}();if(u||(s=H,(t=T()||!1)&&(H=s,W("Expected atom")),!Y&&y("{")?u=l("{"):W("Expected atom")),t=T()||!1){var p=u.type,c=u.behavior;return"group"===p&&("negativeLookbehind"===c||"lookbehind"===c)&&W("Invalid quantifier","",t.range[0],t.range[1]),t.body=d(u),o(t,u.range[0]),t}return u}();)s.push(r);return 1===s.length?s[0]:{type:"alternative",body:s,range:[u,t=H],raw:e.substring(u,t)}}function D(e,t,r,n){var o,a=H;if(g(e))o=t;else{if(!g(r))return!1;o=n}return S(o,a)}function S(t,r){var n,o=v();o||W("Expected disjunction"),f(")");var a={type:"group",behavior:t,body:d(o),range:[r,n=H],raw:e.substring(r,n)};return"normal"==t&&K&&z++,a}function T(){var e,t,r,n,o=H;switch(h()){case"*":m(),e=u(0,void 0,void 0,void 0,"*");break;case"+":m(),e=u(1,void 0,void 0,void 0,"+");break;case"?":m(),e=u(0,1,void 0,void 0,"?");break;case"{":(n=E(/^\{(\d+)\}/))?e=u(t=parseInt(n[1],10),t,o,H):(n=E(/^\{(\d+),\}/))?e=u(t=parseInt(n[1],10),void 0,o,H):(n=E(/^\{(\d+),(\d+)\}/))&&((t=parseInt(n[1],10))>(r=parseInt(n[2],10))&&W("numbers out of order in {} quantifier","",o,H),e=u(t,r,o,H)),(t&&!Number.isSafeInteger(t)||r&&!Number.isSafeInteger(r))&&W("iterations outside JS safe integer range in quantifier","",o,H)}return e&&y("?")&&(e.greedy=!1,e.range[1]+=1),e}function A(t,r){if(r){var n,o;if("unicodeEscape"==t.kind&&(n=t.codePoint)>=55296&&n<=56319&&x("\\")&&b("u")){var a=H;H++;var i=w(!0);"unicodeEscape"==i.kind&&(o=i.codePoint)>=56320&&o<=57343?(t.kind="unicodeCodePointEscape",t.codePoint=(n-55296)*1024+o-56320+65536,t.range[1]=H,t.raw=e.substring(t.range[0],H)):H=a}}return t}n||(n={});function w(t){var r,a,i,u,p=H;switch(u=h()){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return function(t){var r,n,a=H;if(r=E(/^(?!0)\d+/)){var i,u,p=parseInt(n=r[0],10);if(p<=z&&!t)return u=H-1-(i=n).length,{type:"reference",matchIndex:parseInt(i,10),range:[u,H],raw:e.substring(u,H)};if(_.push(p),K?G=!0:k(a,H),m(-n.length),r=E(/^[0-7]{1,3}/))return s("octal",parseInt(r[0],8),r[0],1);var c=H;return o(r=l(E(/^[89]/)),c-1)}return!!(r=E(/^[0-7]{1,3}/))&&(("0"!==(n=r[0])&&k(a,H),/^0{1,3}$/.test(n))?s("null",0,"0",n.length):s("octal",parseInt(n,8),n,1))}(t);case"B":if(!t)return L();W("\\B not possible inside of CharacterClass","",p);break;case"b":if(t)return m(),s("singleEscape",8,"\\b");return L();case"c":if(t){if(!Y&&(i=E(/^c(\d)/)))return s("controlLetter",i[1]+16,i[1],2);else if(!Y&&g("c_"))return s("controlLetter",31,"_",2)}return j();case"d":case"D":case"w":case"W":case"s":case"S":return m(),{type:"characterClassEscape",value:u,range:[H-2,H],raw:e.substring(H-2,H)};case"k":return function(){if(n.namedGroups&&E(/^k<(?=.*?>)/)){var t,r=B();return f(">"),t=r.range[0]-3,{type:"reference",name:r,range:[t,H],raw:e.substring(t,H)}}}()||L();case"p":case"P":return a=H,!!(n.unicodePropertyEscape&&Y&&(r=E(/^([pP])\{([^}]+)\}/)))&&{type:"unicodePropertyEscape",negative:"P"===r[1],value:r[2],range:[a-1,H],raw:e.substring(a-1,H)}||L();case"-":if(t&&Y)return m(),s("singleEscape",45,"\\-");return L();default:return j()}}function k(e,t){Y&&W("Invalid decimal escape in unicode mode",null,e,t)}function I(e){var t;return(t=E(/^u([0-9a-fA-F]{4})/))?A(s("unicodeEscape",parseInt(t[1],16),t[1],2),e):e&&(t=E(/^u\{([0-9a-fA-F]+)\}/))?s("unicodeCodePointEscape",parseInt(t[1],16),t[1],4):void 0}function j(){var e,t=H;switch(h()){case"t":return m(),s("singleEscape",9,"\\t");case"n":return m(),s("singleEscape",10,"\\n");case"v":return m(),s("singleEscape",11,"\\v");case"f":return m(),s("singleEscape",12,"\\f");case"r":return m(),s("singleEscape",13,"\\r");case"c":if(e=E(/^c([a-zA-Z])/))return s("controlLetter",e[1].charCodeAt(0)%32,e[1],2);break;case"x":if(e=E(/^x([0-9a-fA-F]{2})/))return s("hexadecimalEscape",parseInt(e[1],16),e[1],2);break;case"u":if(e=I(Y))return(!e||e.codePoint>1114111)&&W("Invalid escape sequence",null,t,H),e}return L()}function F(t){var n=h(),o=H;if("\\"===n){m();var a=I(!0);return a&&t(a.codePoint)||W("Invalid escape sequence",null,o,H),r(a.codePoint)}var i=n.charCodeAt(0);if(i>=55296&&i<=56319){var s=(n+=e[H+1]).charCodeAt(1);s>=56320&&s<=57343&&(i=(i-55296)*1024+s-56320+65536)}if(t(i))return m(),i>65535&&m(),n}function B(){var t,r=H,n=F(R);for(n||W("Invalid identifier");t=F(P);)n+=t;return{type:"identifier",value:n,range:[r,H],raw:e.substring(r,H)}}function R(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=128&&/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDDC0-\uDDF3\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD40-\uDD59\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC7\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8\uDFC0-\uDFE0]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDB0-\uDDDB\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE40-\uDE7F\uDEA0-\uDEB8\uDEBB-\uDED3\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3\uDFF2-\uDFF6]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDDD0-\uDDED\uDDF0\uDEC0-\uDEDE\uDEE0-\uDEE2\uDEE4\uDEE5\uDEE7-\uDEED\uDEF0-\uDEF4\uDEFE\uDEFF\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/.test(r(e))}function P(e){return R(e)||e>=48&&e<=57||e>=128&&/[\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD801[\uDCA0-\uDCA9]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDD30-\uDD39\uDD40-\uDD49\uDD69-\uDD6D\uDEAB\uDEAC\uDEFA-\uDEFF\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC66-\uDC70\uDC73\uDC74\uDC7F-\uDC82\uDCB0-\uDCBA\uDCC2\uDCF0-\uDCF9\uDD00-\uDD02\uDD27-\uDD34\uDD36-\uDD3F\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC9-\uDDCC\uDDCE-\uDDD9\uDE2C-\uDE37\uDE3E\uDE41\uDEDF-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74\uDFB8-\uDFC0\uDFC2\uDFC5\uDFC7-\uDFCA\uDFCC-\uDFD0\uDFD2\uDFE1\uDFE2]|\uD805[\uDC35-\uDC46\uDC50-\uDC59\uDC5E\uDCB0-\uDCC3\uDCD0-\uDCD9\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDE50-\uDE59\uDEAB-\uDEB7\uDEC0-\uDEC9\uDED0-\uDEE3\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDC2C-\uDC3A\uDCE0-\uDCE9\uDD30-\uDD35\uDD37\uDD38\uDD3B-\uDD3E\uDD40\uDD42\uDD43\uDD50-\uDD59\uDDD1-\uDDD7\uDDDA-\uDDE0\uDDE4\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE8A-\uDE99\uDF60-\uDF67\uDFF0-\uDFF9]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC50-\uDC59\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD50-\uDD59\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDDA0-\uDDA9\uDDE0-\uDDE9\uDEF3-\uDEF6\uDF00\uDF01\uDF03\uDF34-\uDF3A\uDF3E-\uDF42\uDF50-\uDF5A]|\uD80D[\uDC40\uDC47-\uDC55]|\uD818[\uDD1E-\uDD39]|\uD81A[\uDE60-\uDE69\uDEC0-\uDEC9\uDEF0-\uDEF4\uDF30-\uDF36\uDF50-\uDF59]|\uD81B[\uDD70-\uDD79\uDF4F\uDF51-\uDF87\uDF8F-\uDF92\uDFE4\uDFF0\uDFF1]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDCF0-\uDCF9\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDC8F\uDD30-\uDD36\uDD40-\uDD49\uDEAE\uDEEC-\uDEF9]|\uD839[\uDCEC-\uDCF9\uDDEE\uDDEF\uDDF1-\uDDFA\uDEE3\uDEE6\uDEEE\uDEEF\uDEF5]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A\uDD50-\uDD59]|\uD83E[\uDFF0-\uDFF9]|\uDB40[\uDD00-\uDDEF]/.test(r(e))}function L(){var t,r=h();return Y&&/[\^$.*+?()\\[\]{}|/]/.test(r)||!Y&&"c"!==r?"k"===r&&n.lookbehind?null:s("identifier",(t=e.substring(H,H+=1)).charCodeAt(0),t,1):null}function N(){var e,t=H;return g("[^")?(e=$(),f("]"),p(e,!0,t,H)):y("[")?(e=$(),f("]"),p(e,!1,t,H)):null}function $(){var e,t;return x("]")?{kind:"union",body:[]}:X?function(){var e,t=[],r=O(!0);for(t.push(r),e="classRange"===r.type?"union":x("&")?"intersection":x("-")?"subtraction":"union";!x("]");)"intersection"===e?(f("&"),f("&"),x("&")&&W("&& cannot be followed by &. Wrap it in brackets: &&[&].")):"subtraction"===e&&(f("-"),f("-")),t.push(r=O("union"===e));return{kind:e,body:t}}():((t=M())||W("classAtom"),(e=x("]")?[t]:function e(t){if(x("-")&&!b("]")){r=t.range[0],m(),i=l("-"),(a=M())||W("classAtom"),n=H;var r,n,o,a,i,s,u=$();return(u||W("classContents"),"codePoint"in t&&"codePoint"in a?o=[c(t,a,r,n)]:Y?W("invalid character class"):o=[t,i,a],"empty"===u.type)?o:o.concat(u.body)}return(s=M())||W("classAtom"),(o=x("]")?s:e(s))||W("nonEmptyClassRangesNoDash"),[t].concat(o)}(t))||W("nonEmptyClassRanges"),{kind:"union",body:e})}function M(){return y("-")?l("-"):function(){var e;switch(e=h()){case"\\":if(m(),!(e=w(!0))){if(!Y&&"c"==h())return l("\\");W("classEscape")}return A(e,Y);case"]":case"-":break;default:return m(),l(e)}}()}function O(t){var r,n,o=H;if(y("\\"))if(g("q{"))return function(){var t,r=H-3,n=[];do n.push(function(){for(var t,r,n=[],o=H;r=U();)n.push(r);return{type:"classString",characters:n,range:[o,t=H],raw:e.substring(o,t)}}());while(y("|"));return f("}"),{type:"classStrings",strings:n,range:[r,t=H],raw:e.substring(r,t)}}();else if(n=w(!0))r=n;else{if(n=V())return n;W("Invalid escape","\\"+h(),o)}else if(n=q())r=n;else{if(n=N())return n;W("Invalid character",h())}if(t&&x("-")&&!b("-")){if(m(),n=U())return c(r,n,o,H);W("Invalid range end",h())}return r}function U(){if(y("\\")){var e,t=H;if(e=V())return e;W("Invalid escape","\\"+h(),t)}return q()}function q(){var e;if(E(/^(?:&&|!!|##|\$\$|%%|\*\*|\+\+|,,|\.\.|::|;;|<<|==|>>|\?\?|@@|\^\^|``|~~)/)&&W("Invalid set operation in character class"),e=E(/^[^()[\]{}/\-\\|]/))return l(e)}function V(){var e;if(y("b"))return s("singleEscape",8,"\\b");if(y("B"))W("\\B not possible inside of ClassContents","",H-2);else if(e=E(/^[&\-!#%,:;<=>@`~]/))return s("identifier",e[0].codePointAt(0),e[0]);else if(e=j())return e;else return null}function W(t,r,n,o){n=null==n?H:n,o=null==o?n:o;var a=Math.max(0,n-10),i=Math.min(o+10,e.length),s=" "+e.substring(a,i),l=" "+Array(n-a+1).join(" ")+"^";throw SyntaxError(t+" at position "+n+(r?": "+r:"")+"\n"+s+"\n"+l)}var _=[],z=0,K=!0,G=!1,J=-1!==(t||"").indexOf("u"),X=-1!==(t||"").indexOf("v"),Y=J||X,H=0;if(X&&!n.unicodeSet)throw Error('The "v" flag is only supported when the .unicodeSet option is enabled.');if(J&&X)throw Error('The "u" and "v" flags are mutually exclusive.');""===(e=String(e))&&(e="(?:)");var Q=v();return(Q.range[1]!==e.length&&W("Could not parse entire input - got stuck","",Q.range[1]),G=G||_.some(function(e){return e<=z}))?(H=0,K=!1,v()):Q}},sd.exports?sd.exports=n:window.regjsparser=n,sd.exports)}());let sf=String.raw`\$&`,sg=new i(String.raw`\^$.*+?()[]{}|/-`),{parse:sy}=sm,sh="method",sx="pattern",sb="split-join",sE=new i(["i","y"]),sv=new i(["anchor","reference"]),sC=e=>String.raw`\u{${e.toString(16).toUpperCase()}}`;function sD(e){let{kind:t,codePoint:r,raw:n}=e;if("controlLetter"===t)return 13===r?String.raw`\r`:10===r?String.raw`\n`:9===r?String.raw`\t`:sC(r);if("null"===t||"octal"===t)return sC(r);let o=n;return(("identifier"===t||"symbol"===t&&n.length>1&&n.startsWith("\\"))&&(o=o.slice(1)),"'"===o||"\\"===o)?`\\${o}`:o}function sS(e){return"value"===e.type?sD(e):"characterClass"!==e.type||e.negative||1!==e.body.length||"value"!==e.body[0].type?"quantifier"===e.type&&1===e.min&&1===e.max||"group"===e.type&&"ignore"===e.behavior?sT(e.body):void 0:sD(e.body[0])}function sT(e){let t=[];for(let r of e){let e=sS(r);if(void 0===e)return;t.push(e)}return t.join("")}let sA=e=>{let{pattern:t,flags:r}=e.regex;try{return sy(t,r,{unicodePropertyEscape:r.includes("u"),unicodeSet:r.includes("v"),namedGroups:!0,lookbehind:!0})}catch{}},sw=e=>{let t=0;for(let r of e)t+=sk(r);return t};function sk(e){return sv.has(e.type)?0:["value","dot","characterClass","characterClassEscape","unicodePropertyEscape"].includes(e.type)?1:"alternative"===e.type?sw(e.body):"disjunction"===e.type?Math.min(...e.body.map(e=>sk(e))):"quantifier"===e.type?e.min*sw(e.body):"group"===e.type&&"ignore"===e.behavior?sw(e.body):0}let sI=e=>"group"===e.type&&"normal"===e.behavior||Array.isArray(e.body)&&e.body.some(e=>sI(e)),sj=e=>tn(e)&&Number.isSafeInteger(e.value)&&e.value>=0,sF=(e,t)=>{if("BinaryExpression"===e.type&&"+"===e.operator&&(rv(e.left,t)&&e7(e.right,1)||e7(e.left,1)&&rv(e.right,t)))return t},sB=e=>tn(e)?e.value:"UnaryExpression"===e.type&&"-"===e.operator?-sB(e.argument):void 0,sR=e=>e?.type==="MemberExpression"&&!1===e.computed&&"Identifier"===e.property.type&&"length"===e.property.name,sP="prefer-string-trim-start-end",sL="no-unreadable-iife",sN="suggestion",s$="throw-new-error",sM=/^(?:[A-Z][\da-z]*)*Error$/,sO="escape-uppercase",sU="escape-lowercase",sq=/(?<=(?:^|[^\\])(?:\\\\)*\\)(?<data>x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|u{[\dA-Fa-f]+})/g,sV=/(?<=(?:^|[^\\])(?:\\\\)*\\)(?<data>x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|u{[\dA-Fa-f]+}|c[A-Za-z])/g,sW=({node:e,original:t,regex:r=sq,lowercase:n,fix:o})=>{let a=t.replace(r,e=>e[0]+e.slice(1)[n?"toLowerCase":"toUpperCase"]());if(a!==t)return{node:e,messageId:n?sU:sO,fix:t=>o?o(t,a):t.replaceText(e,a)}},s_="prefer-unicode-code-point-escapes",sz="prefer-unicode-code-point-escapes/add-unicode-flag",sK=String.raw`\u{`,sG=/^[\da-f]$/iv,sJ=/^[0-7]$/v,sX=/^[A-Za-z]$/v;function sY(e){return sJ.test(e)}function sH(e,t){let r=0;for(let n=t-1;n>=0&&"\\"===e[n];n--)r++;return r%2==0}function sQ(e,t){let r=0;for(let n=t-1;n>=0&&"\\"===e[n];n--)r++;return r%2==1}function sZ(e,t,r){let n=e.slice(t,t+r);if(!(n.length!==r||[...n].some(e=>!sG.test(e))))return Number.parseInt(n,16)}function s0(e){return e>=55296&&e<=56319}function s1(e){return e>=56320&&e<=57343}function s2(e){return String.raw`\u{${e.toString(16).toUpperCase()}}`}function s3(e,{isRegex:t=!1,supportsNestedCharacterClasses:r=!1}={}){let n="",o=0,a=!1;for(let i=0;i<e.length;i++){let s=e[i],l=o>0;if(t&&"["===s&&(!l||r)&&!sQ(e,i)){o++,n+=s;continue}if(t&&"]"===s&&l&&!sQ(e,i)){o--,n+=s;continue}if("\\"!==s||!sH(e,i)){n+=s;continue}let u=function(e,t,{isRegex:r,isInCharacterClass:n}){return function(e,t){if("x"!==e[t+1])return;let r=sZ(e,t+2,2);if(void 0!==r)return{end:t+4,replacement:s2(r)}}(e,t)??function(e,t,{allowSurrogatePair:r,allowSurrogate:n}){if("u"!==e[t+1]||"{"===e[t+2])return;let o=sZ(e,t+2,4);if(void 0===o||!n&&(s0(o)||s1(o)))return;let a=t+6;if(r&&s0(o)&&"\\"===e[a]&&sH(e,a)&&"u"===e[a+1]){let t=sZ(e,a+2,4);if(s1(t))return{end:a+6,replacement:s2((o-55296)*1024+(t-56320)+65536)}}return{end:t+6,replacement:s2(o)}}(e,t,{allowSurrogatePair:!n,allowSurrogate:!r||!n})??(r?function(e,t){let r=e[t+2];if("c"===e[t+1]&&sX.test(r))return{end:t+3,replacement:s2(r.toUpperCase().codePointAt(0)%32)}}(e,t):function(e,t){let r=e[t+1];if("0"===r&&!sY(e[t+2])||!sY(r))return;let n=r>="0"&&r<="3"?3:2,o=t+1;for(;o<t+1+n&&sY(e[o]);)o++;return{end:o,replacement:s2(Number.parseInt(e.slice(t+1,o),8))}}(e,t))}(e,i,{isRegex:t,isInCharacterClass:l});if(!u){n+=s;continue}n+=u.replacement,i=u.end-1,a=!0}return{fixed:n,hasReplacement:a}}function s8(e,t,r){let{fixed:n,hasReplacement:o}=s3(t);if(o)return{node:e,messageId:s_,fix:t=>r?r(t,n):t.replaceText(e,n)}}function s6(e){return e.includes("u")||e.includes("v")?e:`${e}u`}let s9=["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],s5=["Error","EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError","AggregateError","SuppressedError"],s4="missing-message",s7="message-is-empty-string",le="message-is-not-a-string",lt=new o([["AggregateError",1],["SuppressedError",2]]),lr=e=>"instanceof"===e.value&&"Keyword"===e.type,ln="no-instanceof-builtins",lo="switch-to-type-of",la=new i(["String","Number","Boolean","BigInt","Symbol"]),li=new i(["global","globalThis","self","window"]),ls=[...s5,"Map","Set","WeakMap","WeakRef","WeakSet","ArrayBuffer",...rQ,"Object","RegExp","Promise","Proxy","DataView","Date","SharedArrayBuffer","FinalizationRegistry"],ll=(e,t,r)=>function*(n){let{left:o,right:a}=e,i=rK(t,e),s=i.getTokenAfter(o,lr),{sourceCode:l}=t,u=l.getAncestors(e).findLast(e=>"VExpressionContainer"===e.type),p=u?'"'===l.getText(u)[0]?"'":'"':"'";yield aR(n,e,t);let c=e9(o,{sourceCode:i});!e4(o,t)&&o1(o,"typeof")?(yield n.insertTextBeforeRange(c,"typeof ("),yield n.insertTextAfterRange(c,")")):yield n.insertTextBeforeRange(c,"typeof "),yield n.replaceText(s,"===");let d=e9(a,{sourceCode:i});yield n.replaceTextRange(d,p+r.toLowerCase()+p)},lu=(e,t)=>t.sourceCode.getCommentsInside(e).length>0,lp={create:oz(e=>{let{useErrorIsError:t=!1,strategy:r="loose",include:n=[],exclude:o=[]}=e.options[0]??{},a=new i("strict"===r?[...ls,...n]:n);e.on("BinaryExpression",r=>{let{right:n,operator:i}=r;if("instanceof"!==i)return;let s="Identifier"===n.type?{name:n.name,referenceText:n.name}:"MemberExpression"===n.type&&!n.computed&&"Identifier"===n.property.type&&"Identifier"===n.object.type&&li.has(n.object.name)&&om(n.object,e)?{name:n.property.name,referenceText:e.sourceCode.getText(n)}:void 0;if(!s||o.includes(s.name))return;let{name:l,referenceText:u}=s,p={node:r,messageId:ln};if("Array"===l||"Error"===l&&t){let t="Array"===l?"isArray":"isError",n=`${u}.${t}`;return p.fix=function*(t){let{left:o,right:a}=r,i=rK(e,r),s=i.getTokenAfter(o,lr);yield aR(t,r,e);let l=e9(o,{sourceCode:i});yield t.insertTextBeforeRange(l,n+"("),yield t.insertTextAfterRange(l,")"),yield aV(s,"",t,e,i),yield aV(a,"",t,e,i)},p}return"Function"===l?(lu(n,e)||(p.fix=ll(r,e,l)),p):la.has(l)?(lu(n,e)||(p.suggest=[{messageId:lo,data:{type:l.toLowerCase()},fix:ll(r,e,l)}]),p):a.has(l)?p:void 0})}),meta:{type:"problem",docs:{description:"Disallow `instanceof` with built-in objects",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",properties:{useErrorIsError:{type:"boolean"},strategy:{enum:["loose","strict"]},include:{type:"array",items:{type:"string"}},exclude:{type:"array",items:{type:"string"}}},additionalProperties:!1}],defaultOptions:[{useErrorIsError:!1,strategy:"loose",include:[],exclude:[]}],hasSuggestions:!0,messages:{[ln]:"Avoid using `instanceof` for type checking as it can lead to unreliable results.",[lo]:"Switch to `typeof … === '{{type}}'`."},languages:["js/js"]}},lc="prefer-type-error",ld=new i(["isArguments","isArray","isArrayBuffer","isArrayLike","isArrayLikeObject","isBigInt","isBoolean","isBuffer","isDate","isElement","isError","isFinite","isFunction","isInteger","isLength","isMap","isNaN","isNative","isNil","isNull","isNumber","isObject","isObjectLike","isPlainObject","isPrototypeOf","isRegExp","isSafeInteger","isSet","isString","isSymbol","isTypedArray","isUndefined","isView","isWeakMap","isWeakSet","isWindow","isXMLDoc"]),lm=new i(["isNaN","isFinite"]),lf=(e,t,r)=>void 0!==t&&t.arguments.length>0&&"Identifier"===e.type&&(!0===r&&ld.has(e.name)||!1===r&&lm.has(e.name)),lg=(e,t)=>!!lf(e.property,t,!0)||"MemberExpression"===e.object.type&&lg(e.object,t),ly=/^(?:[A-Z][\da-z]*)*Error$/,lh=e=>"UnaryExpression"===e.type&&"typeof"===e.operator,lx=(e,t)=>{switch(e.type){case"Identifier":return lf(e,t,!1);case"MemberExpression":return lg(e,t);case"CallExpression":return lx(e.callee,e);case"UnaryExpression":return"typeof"===e.operator||"!"===e.operator&&lx(e.argument);case"BinaryExpression":{let{operator:r,left:n,right:o}=e;if("instanceof"===r)return!("Identifier"===o.type?ly.test(o.name):"MemberExpression"===o.type&&!o.optional&&!o.computed&&"Identifier"===o.property.type&&ly.test(o.property.name));if((e=>{let{operator:t,left:r,right:n}=e;return("=="===t||"!="===t||"==="===t||"!=="===t)&&(lh(r)&&e7(n,"undefined")||lh(n)&&e7(r,"undefined"))})(e))return!1;return lx(n,t)||lx(o,t)}case"LogicalExpression":return lx(e.left,t)&&lx(e.right,t);default:return!1}},lb="consistentDestructuring",lE="consistentDestructuringSuggest",lv=new i(["FunctionDeclaration","FunctionExpression","MethodDefinition","PropertyDefinition","AccessorProperty","StaticBlock","Program"]),lC=e=>{for(;e.parent;)if(e=e.parent,lv.has(e.type))return e},lD=e=>"Property"===e.type&&!e.computed&&"Identifier"===e.key.type,lS=(e,t,r,n)=>{for(let o of e){if(o.key.name!==t)continue;let e=eg(n.getScope(o.value),o.value);if(e&&eg(r,o.value)===e)return o}},lT=({declaration:e,memberExpressionNode:t,memberScope:r,memberRootIdentifier:n,memberRootVariable:o,memberThisScopeBoundary:a,memberExpressionWrites:i,sourceCode:s})=>{if(!((e,t,r)=>{let[,n]=r.getRange(e.object),[o]=r.getRange(t);return n<o})(e,t,s)||e.rootIdentifierName&&n?.name===e.rootIdentifierName&&o!==e.rootVariable||e.thisScopeBoundary&&a!==e.thisScopeBoundary||((e,t,r,n)=>{if(!e.rootVariable)return!1;let[,o]=n.getRange(e.object),[a]=n.getRange(t);return e.rootVariable.references.some(e=>{if(!e.isWrite())return!1;let[t]=n.getRange(e.identifier);return!(t<o)&&(e.from.variableScope!==r.variableScope||t<=a)})})(e,t,r,s)||(({declaration:e,memberExpressionNode:t,memberScope:r,memberExpressionWrites:n,sourceCode:o})=>{let[,a]=o.getRange(e.object),[i]=o.getRange(t),s=t.property.name,l=rI(t.object),u="Identifier"===l.type?l.name:void 0,p="Identifier"===l.type?eg(r,l):void 0,c="ThisExpression"===l.type?lC(l):void 0;return n.some(e=>e.propertyName===s&&e.rootIdentifierName===u&&e.rootVariable===p&&e.thisScopeBoundary===c&&(e.scope.variableScope!==r.variableScope||e.start>=a&&e.start<=i))})({declaration:e,memberExpressionNode:t,memberScope:r,memberExpressionWrites:i,sourceCode:s}))return!1;for(var l=r,u=e.scope;l;){if(l===u)return!0;l=l.upper}return!1},lA=(e,t,r)=>!!("BinaryExpression"===e.type&&"in"===e.operator&&te(e.left))&&"Identifier"===t.property.type&&e.left.value===t.property.name&&r.getText(e.right)===r.getText(t.object)||"LogicalExpression"===e.type&&"&&"===e.operator&&(lA(e.left,t,r)||lA(e.right,t,r)),lw=(e,t,r,n)=>{switch(e.type){case"ConditionalExpression":case"IfStatement":return e.consequent===t&&lA(e.test,r,n);case"LogicalExpression":return"&&"===e.operator&&e.right===t&&lA(e.left,r,n);default:return!1}},lk=e=>["AccessorProperty","FunctionDeclaration","MethodDefinition","PropertyDefinition"].includes(e.type),lI=["Object","Array","ArrayBuffer","DataView","Date","Function","Map","WeakMap","Set","WeakSet","Promise","RegExp","SharedArrayBuffer","Proxy","WeakRef","FinalizationRegistry","DisposableStack","AsyncDisposableStack",...s5,...["Collator","DateTimeFormat","DisplayNames","DurationFormat","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"].map(e=>`Intl.${e}`),...["Duration","Instant","PlainDate","PlainDateTime","PlainMonthDay","PlainTime","PlainYearMonth","ZonedDateTime"].map(e=>`Temporal.${e}`),...["Module","Instance","Memory","Table","Global","Tag","Exception","CompileError","LinkError","RuntimeError"].map(e=>`WebAssembly.${e}`),...rQ],lj=["Temporal.Now","WebAssembly","WebAssembly.JSTag"],lF="error-date",lB="suggestion-date";function lR(e){let{node:t}=e;return{node:t,messageId:"disallowCallOrNew",data:{name:e.path.join(".")}}}let lP=new iA({objects:["BigInt","Boolean","Number","String","Symbol"],type:iA.CONSTRUCT,handle:function(e,t){let{node:r}=e,n=e.path.join("."),o={node:r,messageId:"disallow",data:{name:n}};return"String"!==n&&"Boolean"!==n&&"Number"!==n&&(o.fix=e=>aF(r,t,e)),o}}),lL=new iA({objects:lI,type:iA.CALL,handle:function(e,t){let{node:r}=e;if(r.optional||rX(r.callee))return;let n=e.path.join(".");if("Object"===n){let{parent:e}=r;if("BinaryExpression"===e.type&&("==="===e.operator||"!=="===e.operator)&&(e.left===r||e.right===r))return}else if("Date"===n){function*o(e){yield e.replaceText(r,"String(new Date())"),yield aR(e,r,t)}let e={node:r,messageId:lF};return 0===t.sourceCode.getCommentsInside(r).length&&0===r.arguments.length?e.fix=o:e.suggest=[{messageId:lB,fix:o}],e}return{node:r,messageId:"enforce",data:{name:n},fix:e=>aP(r,t,e)}}}),lN=new iA({objects:lj,type:iA.CALL,handle:lR}),l$=new iA({objects:lj,type:iA.CONSTRUCT,handle:lR}),lM="error/array-push",lO="suggestion",lU=e=>tS(e,{property:"classList",computed:!1}),lq=e=>e.arguments.some(e=>"SpreadElement"===e.type),lV=[{description:"Array#push()",test:e=>tA(e,{method:"push",optionalCall:!1}),ignore:["stream.push","this.push","this.stream.push","process.stdin.push","process.stdout.push","process.stderr.push"]},{description:"Array#unshift()",test:e=>tA(e,{method:"unshift",optionalCall:!1}),keepSecondCall:!0,ignore:["stream.unshift","this.unshift","this.stream.unshift","process.stdin.unshift","process.stdout.unshift","process.stderr.unshift"]},{description:"Element#classList.add()",test:e=>tA(e,{method:"add",optionalCall:!1,optionalMember:!1})&&lU(e.callee.object)},{description:"Element#classList.remove()",test:e=>tA(e,{method:"remove",optionalCall:!1,optionalMember:!1})&&lU(e.callee.object)},{description:"importScripts()",test:e=>td(e,{name:"importScripts"},tu)}],lW={create:function(e){let{ignore:t}=e.options[0],{sourceCode:r}=e;e.on("CallExpression",function*(n){for(let{description:o,test:a,ignore:i=[],keepSecondCall:s=!1}of lV){if(!a(n))continue;let l=[...i,...t];if(tF(n.callee,l))continue;let u=function(e){let t=e.parent;return"ChainExpression"===t.type&&e===t.expression&&(t=t.parent),"ExpressionStatement"===t.type?t:void 0}(n);if(!u)continue;let p=ae(u,e);if(p?.type!=="ExpressionStatement")continue;let c=function(e){let{expression:t}=e;return"ChainExpression"===t.type?t.expression:t}(p);if(!a(c)||!rv(c.callee,n.callee))continue;let{shouldKeepSecondCall:d,shouldPrependSourceArguments:m,targetCall:f,sourceCall:g}=function(e,t,r){let n=r&&(!rX(t.callee)||rX(e.callee));return{shouldKeepSecondCall:n,shouldPrependSourceArguments:r&&!n,targetCall:n?t:e,sourceCall:n?e:t}}(c,n,s),y=g.arguments,h=r.getRange(p),x=r.getRange(u),b=d?[h[0],x[0]]:[h[1],x[1]],E=!d&&!eb(r.getLastToken(p))&&eb(r.getLastToken(u)),v=d&&oC(r.getTokenBefore(p),e,r.text.slice(x[0],x[0]+1)),C={node:"Identifier"===n.callee.type?n.callee:n.callee.property,messageId:lM,data:{description:o}},D=function*(t){if(y.length>0){let r=rx(e,g,!m),{openingParenthesisToken:n,trailingCommaToken:o,closingParenthesisToken:a}=rh(f,e);m?yield t.insertTextAfter(n,f.arguments.length>0?`${r}, `:r):yield o?t.insertTextAfter(o,` ${r}`):t.insertTextBefore(a,f.arguments.length>0?`, ${r}`:r)}yield t.replaceTextRange(b,E||v?";":"")};!function(e,t){return e.getAllComments().some(r=>{let[n,o]=e.getRange(r);return n>=t[0]&&o<=t[1]})}(r,b)&&(function(e,t,r,n){let o=r?[...e.arguments,...t.arguments]:t.arguments;return r&&(lq(e)||lq(t))||r&&o.some(e=>null===eN(e,n.getScope(e)))||o.some(e=>e_(e,n))}(c,n,s,r)?C.suggest=[{messageId:lO,fix:D}]:C.fix=D),yield C}})},meta:{type:"suggestion",docs:{description:"Enforce combining multiple `Array#{push,unshift}()`, `Element#classList.{add,remove}()`, and `importScripts()` into one call.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,properties:{ignore:{type:"array",uniqueItems:!0,description:"Methods to ignore."}}}],defaultOptions:[{ignore:[]}],messages:{[lM]:"Do not call `{{description}}` multiple times.",[lO]:"Merge with previous one."},languages:["js/js"]}},l_="no-process-exit",lz=e=>e7(e,"node:worker_threads")||e7(e,"worker_threads"),lK="no-single-promise-in-promise-methods/error",lG="no-single-promise-in-promise-methods/unwrap",lJ="no-single-promise-in-promise-methods/use-promise-resolve",lX=["all","any","race"],lY=(e,t)=>{let[r]=e.arguments[0].elements,n=e5(r,t);return!e4(r,t)&&16>oJ(r)&&(n=`(${n})`),n},lH=(e,t)=>e.getCommentsInside(t).length>0,lQ=e=>"ArrayPattern"===e.type&&!e.typeAnnotation&&1===e.elements.length&&e.elements[0]?.type==="Identifier",lZ="no-static-only-class",l0=({type:e,value:t})=>"Punctuator"===e&&"="===t,l1=e=>"PropertyDefinition"===e.type,l2="ignored-elements",l3="property-assignment",l8={create:e=>{let{sourceCode:t}=e,{maximumIgnoredElements:r}=e.options[0];e.on("ArrayPattern",n=>{let{elements:o,parent:a}=n;if(function(e){let t=0,r=0;for(let n of e)null===n?t=Math.max(t,++r):r=0;return t}(o)<=r)return;let i={node:n,messageId:l2},s=o.filter(e=>null!==e);if("VariableDeclarator"===a.type&&a.id===n&&null!==a.init&&1===s.length){let[r]=s;"AssignmentPattern"!==r.type&&(i.fix=function*(i){let s=o.indexOf(r),l="RestElement"===r.type,u=l?r.argument:r;yield i.replaceText(n,t.getText(u));let p=l?`.slice(${s})`:`[${s}]`,c=a.init;!e4(c,e)&&oQ(c,e)?(yield i.insertTextBefore(c,"("),yield i.insertTextAfter(a,`)${p}`)):yield i.insertTextAfter(a,p),yield aR(i,n,e)})}return i}),e.on("MemberExpression",e=>{if(function e(t){let{parent:r}=t;if(r){if(rk(r)&&r.expression===t||"AssignmentPattern"===r.type&&r.left===t||"RestElement"===r.type&&r.argument===t)return e(r);if("Property"===r.type&&r.value===t&&"ObjectPattern"===r.parent.type)return r.parent;if("ObjectPattern"===r.type||"ArrayPattern"===r.type)return r}}(e)?.type==="ArrayPattern")return{node:e,messageId:l3}})},meta:{type:"suggestion",docs:{description:"Disallow unreadable array destructuring.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{maximumIgnoredElements:{type:"integer",minimum:0,description:"Maximum number of consecutive ignored elements allowed."}}}],defaultOptions:[{maximumIgnoredElements:1}],messages:{[l2]:"Array destructuring may not contain consecutive ignored values.",[l3]:"Do not assign destructured values to object properties."},languages:["js/js"]}},l6="spread-in-list",l9="iterable-to-array",l5="iterable-to-array-in-for-of",l4="iterable-to-array-in-yield-star",l7="spread-in-collection-constructor",ue="spread-in-object-assign",ut="clone-array",ur="suggestion/remove-object-assign-spread",un=["Map","WeakMap","Set","WeakSet"],uo=["copyWithin","flat","slice","splice","toReversed","toSorted","toSpliced","with"],ua=[...uo,"filter","flatMap","map"],ui=e=>"ArrayExpression"===e.type&&1===e.elements.length&&e.elements[0]?.type==="SpreadElement",us={ArrayExpression:"array literal",ObjectExpression:"object literal",CallExpression:"arguments",NewExpression:"arguments"};function*ul(e,t,r){let{sourceCode:n}=r,[o,a,i]=n.getFirstTokens(t,3);yield e.remove(o),yield e.remove(a);let[s,l]=n.getLastTokens(t,2);yield e.remove(l),ex(s)&&(yield e.remove(s));let{parent:u}=t;"ReturnStatement"!==u.type&&"ThrowStatement"!==u.type||u.argument!==t||ou(o,i,r)||e4(t,r)?yield aR(e,t,r):yield aI(e,u,r)}let uu=(e,t)=>"CallExpression"===e.type&&"MemberExpression"===e.callee.type&&nE(e.callee.object,t),up="no-useless-switch-case/error",uc="no-useless-switch-case/suggestion",ud=e=>e.consequent.every(e=>tg(e)),um=e=>tR(e.test)||ta(e.test),uf=new i(["CallExpression","MemberExpression"]),ug=new i(["Identifier","MemberExpression","Super","ThisExpression"]);[...new o([["===","!=="],["!==","==="],["==","!="],["!=","=="]])];let uy=e=>"MemberExpression"===(e=rI(e)).type?{...e,object:uy(e.object),property:e.computed?uy(e.property):e.property}:e,uh=(e,t)=>rv(uy(e),uy(t)),ux=e=>ug.has(rI(e).type),ub=e=>!!("ChainExpression"===e.type||uf.has(e.type)&&e.optional)||Object.entries(e).some(([e,t])=>"parent"!==e&&!!t&&(Array.isArray(t)?t.some(e=>e?.type&&ub(e)):t.type&&ub(t))),uE="no-useless-undefined",uv="no-useless-undefined/suggestion",uC=new i(["is","equal","notEqual","strictEqual","notStrictEqual","propertyVal","notPropertyVal","not","include","property","toBe","toHaveBeenCalledWith","toContain","toContainEqual","toEqual","same","notSame","strictSame","strictNotSame"]),uD=e=>{for(;e;e=e.upper)if("function"===e.type)return e.block},uS={">=":{valid:!0,addend:0},">":{valid:!0,addend:-1},"<":{valid:!1,addend:0},"<=":{valid:!1,addend:-1}},uT={"<=":{valid:!0,addend:0},"<":{valid:!0,addend:-1},">":{valid:!1,addend:0},">=":{valid:!1,addend:-1}},uA={"<":{valid:!0,kind:"length"},"<=":{valid:!0,kind:"lengthMinusOne"},">=":{valid:!1,kind:"length"},">":{valid:!1,kind:"lengthMinusOne"}},uw={">":{valid:!0,kind:"length"},">=":{valid:!0,kind:"lengthMinusOne"},"<=":{valid:!1,kind:"length"},"<":{valid:!1,kind:"lengthMinusOne"}},uk=new i(["<","<=",">",">="]);function uI(e,t,r,n){let o=e[t];if(o&&r===n+o.addend)return o.valid}function uj(e,t){return tS(e=rI(e),{property:"length",optional:!1,computed:!1})&&uh(e.object,t)}function uF(e,t){return uj(e=rI(e),t)?"length":"BinaryExpression"===e.type&&"-"===e.operator&&uj(e.left,t)&&1===oH(e.right)?"lengthMinusOne":void 0}function uB(e,t,r){let n=e[t];if(n?.kind===r)return n.valid}let uR={create:e=>{let{sourceCode:t}=e,r=(e,r,n)=>{if(n){let r=uD(t.getScope(e));if(r?.returnType)return}return{node:e,messageId:uE,fix:r}},n=e.options[0];e.on("Identifier",o=>{if(!tR(o))return;let{parent:a}=o;if("ReturnStatement"===a.type&&a.argument===o){let n,a=uD(t.getScope(o));if(a?.returnType&&"TSUndefinedKeyword"!==(n=a.returnType?.typeAnnotation?.type)&&"TSVoidKeyword"!==n)return;return r(o,t=>aV(o,"",t,e))}if("YieldExpression"===a.type&&!a.delegate&&a.argument===o)return r(o,t=>aV(o,"",t,e));if(n.checkArrowFunctionBody&&"ArrowFunctionExpression"===a.type&&a.body===o)return r(o,t=>aV(o," {}",t,e),!0);if("VariableDeclarator"===a.type&&a.init===o&&"VariableDeclaration"===a.parent.type&&"const"!==a.parent.kind&&a.parent.declarations.includes(a)){let[,e]=t.getRange(a.id),[,n]=t.getRange(o);return r(o,t=>t.removeRange([e,n]))}if("AssignmentPattern"===a.type&&a.right===o)return r(o,function*(r){let{left:n}=a,[,i]=t.getRange(n),[,s]=t.getRange(o);yield r.removeRange([i,s]),(n.typeAnnotation||r_(e.physicalFilename))&&!n.optional&&tE(a.parent)&&a.parent.params.includes(a)&&(yield n.typeAnnotation?r.insertTextBefore(n.typeAnnotation,"?"):r.insertTextAfter(n,"?"))})}),e.on("ConditionalExpression",r=>{let n=tR(r.consequent);if(n===tR(r.alternate))return;let o=n?r.alternate:r.consequent,a=function(e,t){if(!(!tS(e=rI(e),{computed:!0,optional:!1})||ub(e)||e_(e.object,t,{considerGetters:!0})||e_(e.property,t,{considerGetters:!0})))return{node:e,index:function(e){if("BinaryExpression"===(e=rI(e)).type&&"-"===e.operator){let t=oH(e.right);if(Number.isSafeInteger(t)&&t>0)return{node:e.left,offset:t}}return{node:e,offset:0}}(e.property)}}(o,t);if(!a||function(e,t){if(!("BinaryExpression"!==(e=rI(e)).type||!uk.has(e.operator)||ub(e)))return function(e,t){let{operator:r,left:n,right:o}=e,a=oH(n),i=oH(o);return Number.isSafeInteger(i)&&uh(n,t.node)?uI(uS,r,i,t.offset):Number.isSafeInteger(a)&&uh(o,t.node)?uI(uT,r,a,t.offset):void 0}(e,t.index)??function(e,t){if(0!==t.index.offset)return;let{operator:r,left:n,right:o}=e,a=uF(o,t.node.object);if(a&&uh(n,t.index.node))return uB(uA,r,a);let i=uF(n,t.node.object);if(i&&uh(o,t.index.node))return uB(uw,r,i)}(e,t)}(r.test,a)!==!n)return;let i={node:n?r.consequent:r.alternate,messageId:uE};return 0===t.getCommentsInside(r).length&&(i.suggest=[{messageId:uv,fix(n){let a=t.getText(o),i=oC(t.getTokenBefore(r),e,a)?";":"";return n.replaceText(r,i+a)}}]),i}),!n.checkArguments||r_(e.physicalFilename)||e.on("CallExpression",t=>{var r;let n,o=t.arguments,a=o.at(-1);if(!(!tR(a)||("Identifier"===(r=t.callee).type?n=r.name:"MemberExpression"===r.type&&!1===r.computed&&"Identifier"===r.property.type&&(n=r.property.name),uC.has(n)||"push"===n||"unshift"===n||"includes"===n||"add"===n||"has"===n||"delete"===n||"set"===n||"createContext"===n||/^set[A-Z]/v.test(n)||"useRef"===n||"ref"===n))&&(!(!t.optional&&"MemberExpression"===t.callee.type&&!t.callee.computed&&"Identifier"===t.callee.property.type&&"bind"===t.callee.property.name)||1===o.length))return{node:a,messageId:uE,fix:t=>aA(t,a,e)}})},meta:{type:"suggestion",docs:{description:"Disallow useless `undefined`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,properties:{checkArguments:{type:"boolean",description:"Whether to check function arguments."},checkArrowFunctionBody:{type:"boolean",description:"Whether to check arrow function bodies."}}}],defaultOptions:[{checkArguments:!0,checkArrowFunctionBody:!0}],messages:{[uE]:"Do not use useless `undefined`.",[uv]:"Use the indexed access directly."},languages:["js/js"]}},uP="numeric-separators-style";function uL(e,{minimumDigits:t,groupLength:r},n){let{length:o}=e;if(o<t)return e;let a=[];if(n)for(let t=0;t<o;t+=r){let n=Math.min(t+r,o);a.push(e.slice(t,n))}else for(let t=o;t>0;t-=r){let n=Math.max(t-r,0);a.unshift(e.slice(n,t))}return a.join("_")}let uN={binary:{minimumDigits:0,groupLength:4},octal:{minimumDigits:0,groupLength:4},hexadecimal:{minimumDigits:0,groupLength:2},number:{minimumDigits:5,groupLength:3,fractionGroupLength:1/0}},u$={create:e=>{let{onlyIfContainsSeparator:t,binary:r,octal:n,hexadecimal:o,number:a}=e.options[0],i={"0b":{onlyIfContainsSeparator:t,...r},"0o":{onlyIfContainsSeparator:t,...n},"0x":{onlyIfContainsSeparator:t,...o},"":{onlyIfContainsSeparator:t,...a}};e.on("Literal",e=>{let t,r;if(!(tn(e)||ti(e))||tn(e)&&/^0\d+$/.test(e.raw))return;let{raw:n}=e,o=n,a="";ti(e)&&(o=n.slice(0,-1),a="n");let s=o.replaceAll("_",""),{prefix:l,data:u}=(t="",r=s,/^0[box]/i.test(s)&&(t=s.slice(0,2),r=s.slice(2)),{prefix:t,data:r}),{onlyIfContainsSeparator:p}=i[l.toLowerCase()];if(p&&!n.includes("_"))return;let c=function(e,{prefix:t,data:r},n){let o=n[t.toLowerCase()];if(t)return t+uL(r,o);let{number:a,mark:i,sign:s,power:l}=function(e){let{number:t,mark:r="",sign:n="",power:o=""}=e.match(/^(?<number>[\d._]*)(?:(?<mark>e)(?<sign>[+-])?(?<power>[\d_]+))?$/i).groups;return{number:t,mark:r,sign:n,power:o}}(e);return function(e,t){let{integer:r,dot:n,fractional:o}=function(e){let t=e.split("."),[r,n=""]=t;return{integer:r,dot:2===t.length?".":"",fractional:n}}(e);return uL(r,t)+n+uL(o,{...t,groupLength:t.fractionGroupLength},!0)}(a,o)+i+s+uL(l,n[""])}(s,{prefix:l,data:u},i)+a;if(n!==c)return{node:e,messageId:uP,fix:t=>t.replaceText(e,c)}})},meta:{type:"suggestion",docs:{description:"Enforce the style of numeric separators by correctly grouping digits.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{...Object.fromEntries(Object.keys(uN).map(e=>[e,(({withFraction:e=!1}={})=>({type:"object",additionalProperties:!1,properties:{onlyIfContainsSeparator:{type:"boolean",description:"Whether to only enforce the style if the number already contains a separator."},minimumDigits:{type:"integer",minimum:0,description:"The minimum number of digits before separators are enforced."},groupLength:{type:"integer",minimum:1,description:"The number of digits in each group."},...e&&{fractionGroupLength:{type:"integer",minimum:1,description:"The number of digits in each group after the decimal point. Defaults to no grouping."}}}}))({withFraction:"number"===e})])),onlyIfContainsSeparator:{type:"boolean",description:"Whether to only enforce the style if the number already contains a separator."}}}],defaultOptions:[{onlyIfContainsSeparator:!1,binary:uN.binary,octal:uN.octal,hexadecimal:uN.hexadecimal,number:uN.number}],messages:{[uP]:"Invalid group length in numeric value."},languages:["js/js"]}},uM="error-zero-index",uO="error-shift",uU="error-pop",uq="error-at-zero",uV="error-at-minus-one",uW="error-slice-minus-one",u_="error-destructuring-declaration",uz="error-destructuring-assignment",uK="error-variable",uG="suggest-nullish-coalescing-operator",uJ="suggest-logical-or-operator",uX=(e,t,r)=>tA(e,{method:"filter",minimumArguments:1,maximumArguments:2,optionalCall:!1,...r})&&!nE(e.callee.object,t),uY=e=>"UnaryExpression"===e.type&&"-"===e.operator&&e.prefix&&"Literal"===e.argument.type&&"1"===e.argument.raw,uH=(e,t)=>tA(e,{method:"slice",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&uY(e.arguments[0])&&uX(e.callee.object,t),uQ=e=>e?"AssignmentExpression"===e.type?e:"VariableDeclarator"===e.type?{left:e.id,right:e.init}:{}:{};function*uZ(e,t,r){let{left:n}=uQ(e),[o]=n.elements,a=t.getText("AssignmentPattern"===o.type?o.left:o);yield r.replaceText(n,a),((e,t)=>{if("AssignmentExpression"!==e.type||ez(e,t))return!1;let{left:r}=uQ(e),[n]=r.elements,{type:o}="AssignmentPattern"===n.type?n.left:n;return"ObjectExpression"===o||"ObjectPattern"===o})(e,t)&&(yield r.insertTextBefore(e,"("),yield r.insertTextAfter(e,")"))}let u0=e=>"AssignmentPattern"===uQ(e).left.elements[0].type,u1=(e,t)=>{let r,n,{property:o}=uQ(t).right.callee;return u0(t)?r=[{operator:"??",messageId:uG},{operator:"||",messageId:uJ}].map(({messageId:r,operator:n})=>({messageId:r,*fix(r){yield r.replaceText(o,"find"),yield((e,t,r,n)=>{let{left:o,right:a}=uQ(e),[i]=o.elements,s=i.right,l=t.getText(s);return(ez(s,t)||"LogicalExpression"===s.type&&(s.operator===n||"||"===n&&"??"===s.operator||"??"===n&&("||"===s.operator||"&&"===s.operator))||"ConditionalExpression"===s.type||"AssignmentExpression"===s.type||"YieldExpression"===s.type||"SequenceExpression"===s.type)&&(l=`(${l})`),r.insertTextAfter(a,` ${n} ${l}`)})(t,e,r,n),yield uZ(t,e,r)}})):n=function*(r){yield r.replaceText(o,"find"),yield uZ(t,e,r)},{fix:n,suggest:r}},u2=e=>"MemberExpression"===e.parent.type&&!0===e.parent.computed&&e.parent.object===e&&"Literal"===e.parent.property.type&&"0"===e.parent.property.raw,u3=e=>{let{left:t,right:r}=uQ(e.parent);return t&&r&&r===e&&"ArrayPattern"===t.type&&1===t.elements.length&&t.elements[0]&&"RestElement"!==t.elements[0].type},u8={create:e=>{let{sourceCode:t}=e,{checkFromLast:r}=e.options[0];e.on("MemberExpression",t=>{if(!(!(t.computed&&"Literal"===t.property.type&&"0"===t.property.raw&&uX(t.object,e))||nP(t)))return{node:t.object.callee.property,messageId:uM,fix:r=>[r.replaceText(t.object.callee.property,"find"),aN(r,t,e)]}}),e.on("CallExpression",t=>{if(tA(t,{method:"shift",argumentsLength:0,optionalCall:!1,optionalMember:!1})&&uX(t.callee.object,e))return{node:t.callee.object.callee.property,messageId:uO,fix:r=>[r.replaceText(t.callee.object.callee.property,"find"),...a$(r,t,e)]}}),e.on("VariableDeclarator",r=>{if("ArrayPattern"===r.id.type&&1===r.id.elements.length&&r.id.elements[0]&&"RestElement"!==r.id.elements[0].type&&uX(r.init,e,{optionalMember:!1}))return{node:r.init.callee.property,messageId:u_,...u1(t,r)}}),e.on("AssignmentExpression",r=>{if("ArrayPattern"===r.left.type&&1===r.left.elements.length&&r.left.elements[0]&&"RestElement"!==r.left.elements[0].type&&uX(r.right,e,{optionalMember:!1}))return{node:r.right.callee.property,messageId:uz,...u1(t,r)}}),e.on("VariableDeclarator",r=>{if(!("Identifier"===r.id.type&&uX(r.init,e,{optionalMember:!1})&&"VariableDeclaration"===r.parent.type&&r.parent.declarations.includes(r)&&("ExportNamedDeclaration"!==r.parent.parent.type||r.parent.parent.declaration!==r.parent)))return;let n=t.getScope(r),o=eg(n,r.id),a=rG(o).filter(e=>e!==r.id);if(0===a.length)return;let i=[],s=[];for(let e of a)if(u2(e))i.push(e.parent);else{if(!u3(e))return;s.push(e.parent)}let l={node:r.init.callee.property,messageId:uK};return s.every(e=>!u0(e))&&(l.fix=function*(a){yield a.replaceText(r.init.callee.property,"find");let l=(e=>{let t=o9.singular(e);if(t!==e)return t})(r.id.name);if(l){let r=rg(l,ru(n));yield aU(o,r,e,a),yield function*(e,t){yield e.insertTextBeforeRange(t,""),yield e.insertTextAfterRange(t,"")}(a,t.getRange(t.ast))}for(let t of i)yield aN(a,t,e);for(let e of s)yield uZ(e,t,a)}),l}),e.on("CallExpression",t=>{if(tA(t,{method:"at",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&"Literal"===t.arguments[0].type&&"0"===t.arguments[0].raw&&uX(t.callee.object,e))return{node:t.callee.object.callee.property,messageId:uq,fix:r=>[r.replaceText(t.callee.object.callee.property,"find"),...a$(r,t,e)]}}),r&&(e.on("CallExpression",t=>{if(tA(t,{method:"pop",argumentsLength:0,optionalCall:!1,optionalMember:!1})&&uX(t.callee.object,e))return{node:t.callee.object.callee.property,messageId:uU,fix:r=>[r.replaceText(t.callee.object.callee.property,"findLast"),...a$(r,t,e)]}}),e.on("CallExpression",t=>{if(tA(t,{method:"at",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&uY(t.arguments[0])&&uX(t.callee.object,e))return{node:t.callee.object.callee.property,messageId:uV,fix:r=>[r.replaceText(t.callee.object.callee.property,"findLast"),...a$(r,t,e)]}}),e.on("MemberExpression",r=>{if(!(r.computed&&!r.optional&&"Literal"===r.property.type&&"0"===r.property.raw&&!nP(r)&&uH(r.object,e)))return;let n=r.object.callee.object;return{node:n.callee.property,messageId:uW,*fix(o,{abort:a}){if(rN(e,[e9(n,e)[1],t.getRange(r)[1]]))return a();yield o.replaceText(n.callee.property,"findLast"),yield a$(o,r.object,e),yield aN(o,r,e)}}}),e.on("CallExpression",r=>{if(!(tA(r,{methods:["pop","shift"],argumentsLength:0,optionalCall:!1,optionalMember:!1})&&uH(r.callee.object,e)))return;let n=r.callee.object.callee.object;return{node:n.callee.property,messageId:uW,*fix(o,{abort:a}){if(rN(e,[e9(n,e)[1],t.getRange(r)[1]]))return a();yield o.replaceText(n.callee.property,"findLast"),yield a$(o,r.callee.object,e),yield a$(o,r,e)}}}))},meta:{type:"suggestion",docs:{description:"Prefer `.find(…)` and `.findLast(…)` over the first or last element from `.filter(…)`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,properties:{checkFromLast:{type:"boolean",description:"Whether to also check for patterns that can be replaced with `findLast()`."}}}],defaultOptions:[{checkFromLast:!0}],messages:{[uK]:"Prefer `.find(…)` over `.filter(…)`.",[uM]:"Prefer `.find(…)` over `.filter(…)[0]`.",[uq]:"Prefer `.find(…)` over `.filter(…).at(0)`.",[uO]:"Prefer `.find(…)` over `.filter(…).shift()`.",[uU]:"Prefer `.findLast(…)` over `.filter(…).pop()`.",[uV]:"Prefer `.findLast(…)` over `.filter(…).at(-1)`.",[uW]:"Prefer `.findLast(…)` over `.filter(…).slice(-1)`.",[u_]:"Prefer `.find(…)` over destructuring `.filter(…)`.",[uz]:"Prefer `.find(…)` over destructuring `.filter(…)`.",[uG]:"Replace `.filter(…)` with `.find(…) ?? …`.",[uJ]:"Replace `.filter(…)` with `.find(…) || …`."},languages:["js/js"]}},u6="prefer-array-flat-map",u9="prefer-array-flat-map/filter-flat-map",u5="prefer-array-flat-map/filter-flat-map-suggestion",u4=["React.Children","Children"],u7=new i(["ArrowFunctionExpression","AssignmentExpression","ClassExpression","ConditionalExpression","FunctionExpression","ObjectExpression","SequenceExpression","TSAsExpression","TSNonNullExpression","TSSatisfiesExpression","TSTypeAssertion","YieldExpression"]),pe=e=>"ArrowFunctionExpression"===e.type&&!e.async&&!e.returnType&&!e.typeParameters&&1===e.params.length&&"Identifier"===e.params[0].type&&!e.params[0].optional&&!e.params[0].typeAnnotation&&"BlockStatement"!==e.body.type,pt="prefer-array-flat",pr={getArrayNode:e=>e.callee.object,isOptionalArray:e=>e.callee.optional,description:"Array#flatMap()",testFunction(e,t){if(!tA(e,{method:"flatMap",argumentsLength:1,optionalCall:!1}))return!1;let[r]=e.arguments;return"ArrowFunctionExpression"===r.type&&!r.async&&1===r.params.length&&od(r.params[0],r.body)&&!pl(e.callee.object,t)}},pn={testFunction(e){if(!tA(e,{method:"reduce",argumentsLength:2,optionalCall:!1}))return!1;let[t,r]=e.arguments;if(!("ArrowFunctionExpression"===t.type&&!t.async&&2===t.params.length&&ty(r)))return!1;let n=t.body,[o,a]=t.params;return tA(n,{method:"concat",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&od(o,n.callee.object)&&od(a,n.arguments[0])||"ArrayExpression"===n.type&&2===n.elements.length&&n.elements.every((e,r)=>e?.type==="SpreadElement"&&"Identifier"===e.argument.type&&od(t.params[r],e.argument))},getArrayNode:e=>e.callee.object,isOptionalArray:e=>e.callee.optional,description:"Array#reduce()"},po={testFunction:e=>tA(e,{method:"concat",argumentsLength:1,allowSpreadElement:!0,optionalCall:!1,optionalMember:!1})&&ty(e.callee.object)&&"SpreadElement"===e.arguments[0].type,getArrayNode:e=>e.arguments[0].argument,description:"[].concat()"},pa={testFunction(e){if(!(tA(e,{methods:["apply","call"],argumentsLength:2,allowSpreadElement:!0,optionalCall:!1,optionalMember:!1})&&tP(e.callee.object,{property:"concat"})))return!1;let[t,r]=e.arguments;return ty(t)&&("apply"===e.callee.property.name&&"SpreadElement"!==r.type||"call"===e.callee.property.name&&"SpreadElement"===r.type)},getArrayNode(e){let t=e.arguments[1];return"SpreadElement"===t.type?t.argument:t},description:"Array.prototype.concat()"},pi=["_.flatten","lodash.flatten","underscore.flatten"],ps=/^\p{Uppercase_Letter}/u,pl=(e,t)=>{let r,n;return"Identifier"===e.type&&ps.test(e.name)&&(!(r=rU(e,t))||"ArrayExpression"!==r.type&&("NewExpression"!==r.type||"Identifier"!==r.callee.type||"Array"!==r.callee.name))||!!((n=rU(e,t))&&("ObjectExpression"===n.type||"Literal"===n.type||"TemplateLiteral"===n.type||"ArrowFunctionExpression"===n.type||"FunctionExpression"===n.type||"ClassExpression"===n.type||"NewExpression"===n.type&&"Identifier"===n.callee.type&&"Array"!==n.callee.name))},pu={create:function(e){let{functions:t}=e.options[0],r=[...t,...pi],n=[pr,pn,po,pa,{testFunction:e=>td(e,{argumentsLength:1,optional:!1},tu)&&tF(e.callee,r),getArrayNode:e=>e.arguments[0],description:e=>`${r.find(t=>tj(e.callee,t)).trim()}()`}];e.on("CallExpression",function*(t){for(let{testFunction:r,description:o,getArrayNode:a,shouldSwitchToArray:i,isOptionalArray:s}of n){if(!r(t,e))continue;let n=a(t),l=s?.(t),u={description:"string"==typeof o?o:o(t)},p={node:t,messageId:pt,data:u},{sourceCode:c}=e;c.getCommentsInside(t).length===c.getCommentsInside(n).length&&(p.fix=function(e,t,r,n,o){return"function"==typeof n&&(n=n(e)),function*(a){let{sourceCode:i}=r,s=e5(t,r);n?s=`[${s}]`:!e4(t,i)&&oQ(t,r)&&(s=`(${s})`),s+=`${o?"?":""}.flat()`,oC(i.getTokenBefore(e),r,s)&&(s=`;${s}`),yield a.replaceText(e,s),yield aR(a,e,r)}}(t,n,e,i,l)),yield p}})},meta:{type:"suggestion",docs:{description:"Prefer `Array#flat()` over legacy techniques to flatten arrays.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{functions:{type:"array",uniqueItems:!0,description:"Additional functions to check."}}}],defaultOptions:[{functions:[]}],messages:{[pt]:"Prefer `Array#flat()` over `{{description}}` to flatten an array."},languages:["js/js"]}},pp="some",pc="some-suggestion",pd="filter",pm={create:oz(e=>{e.on("CallExpression",t=>{if(!tA(t,{methods:["find","findLast"],minimumArguments:1,maximumArguments:2,optionalCall:!1,optionalMember:!1})||t.typeArguments||t.typeParameters||nE(t.callee.object,e))return;let r="BinaryExpression"===t.parent.type&&t.parent.left===t&&(["!=","==","===","!=="].includes(t.parent.operator)&&tR(t.parent.right)||("!="===t.parent.operator||"=="===t.parent.operator)&&ta(t.parent.right));if(!r&&!(tU(t,e)||tq(t)||function(e,t){if(!nb(e.callee.object,t))return!1;let r=e.parent;if("VariableDeclarator"!==r.type||r.init!==e||"Identifier"!==r.id.type||r.id.typeAnnotation||"VariableDeclaration"!==r.parent.type||"const"!==r.parent.kind||"ExportNamedDeclaration"===r.parent.parent.type&&r.parent.parent.declaration===r.parent)return!1;let[n]=t.sourceCode.getDeclaredVariables(r);if(!n||1!==n.identifiers.length||n.identifiers[0]!==r.id)return!1;let o=n.references.filter(e=>!e.init);return 0!==o.length&&o.every(e=>{let{identifier:r}=e;return e.isRead()&&(tU(r,t)||tq(r))})}(t,e)))return;let n=t.callee.property,o=r&&rN(e,[e9(t,e)[1],e.sourceCode.getRange(t.parent)[1]]);return{node:n,messageId:pp,data:{method:n.name},suggest:o?void 0:[{messageId:pc,*fix(o){if(yield o.replaceText(n,"some"),!r)return;let{sourceCode:a}=e,i=e9(t,e);yield o.removeRange([i[1],a.getRange(t.parent)[1]]),"!="!==t.parent.operator&&"!=="!==t.parent.operator&&(yield o.insertTextBeforeRange(i,"!"))}}]}}),e.on("BinaryExpression",t=>{let{left:r,right:n,operator:o}=t;if(!(tA(r,{methods:["findIndex","findLastIndex"],argumentsLength:1,optionalCall:!1,optionalMember:!1})&&(["!==","!=",">","===","=="].includes(o)&&"UnaryExpression"===n.type&&"-"===n.operator&&n.argument&&"Literal"===n.argument.type&&1===n.argument.value||[">=","<"].includes(o)&&e7(n,0)))||nE(r.callee.object,e))return;let a=r.callee.property;return{node:a,messageId:pp,data:{method:a.name},*fix(n,{abort:i}){let{sourceCode:s}=e,l=s.getTokenAfter(r,e=>"Punctuator"===e.type&&e.value===o),[u]=s.getRange(l),[,p]=s.getRange(t);if(rN(e,[u,p]))return i();["===","==","<"].includes(o)&&(yield n.insertTextBefore(t,"!")),yield n.replaceText(a,"some"),yield n.removeRange([u,p])}}}),e.on("BinaryExpression",t=>{if(!((">"===t.operator||"!=="===t.operator)&&"Literal"===t.right.type&&"0"===t.right.raw&&tS(t.left,{property:"length",optional:!1})&&tA(t.left.object,{method:"filter",optionalCall:!1,optionalMember:!1})))return;let r=t.left.object,n=r.callee.object;if(nE(n,e)||"Identifier"===n.type&&n.name.startsWith("$"))return;let[o]=r.arguments;if(!o||os(o))return;let a=r.callee.property;return{node:a,messageId:pd,*fix(n,{abort:o}){let{sourceCode:i}=e,s=t.left;if(rN(e,[e9(r,e)[1],i.getRange(t)[1]]))return o();yield n.replaceText(a,"some"),yield aN(n,s,e),yield n.removeRange([e9(s,e)[1],i.getRange(t)[1]])}}})}),meta:{type:"suggestion",docs:{description:"Prefer `.some(…)` over `.filter(…).length` check and `.{find,findLast,findIndex,findLastIndex}(…)`.",recommended:"unopinionated"},fixable:"code",messages:{[pp]:"Prefer `.some(…)` over `.{{method}}(…)`.",[pc]:"Replace `.{{method}}(…)` with `.some(…)`.",[pd]:"Prefer `.some(…)` over non-zero length check from `.filter(…)`."},hasSuggestions:!0,languages:["js/js"]}},pf=(e,t,r=!0)=>({node:e,messageId:`error/${e.name}`,...r&&{suggest:[{messageId:`suggestion/${t}`,fix:r=>r.replaceText(e,t)}]}}),pg=new i(["+","-","*","/","%","**","&","|","^","<<",">>",">>>"]),py=new i(["+","-","~"]),ph="preferDefaultParameters",px="preferDefaultParametersSuggest",pb=new i(["CallExpression","NewExpression","ImportExpression","TaggedTemplateExpression"]),pE=(e,t)=>{if(!t)return!1;if(pb.has(t.type))return!0;for(let r of e.visitorKeys[t.type]){let n=t[r];if(Array.isArray(n)){for(let t of n)if(pE(e,t))return!0}else if(pE(e,n))return!0}return!1},pv="prefer-logical-operator-over-ternary/error",pC="prefer-logical-operator-over-ternary/optional-chain-error",pD="prefer-logical-operator-over-ternary/suggestion",pS="prefer-logical-operator-over-ternary/optional-chain-suggestion",pT=new i(["==","==="]),pA=new i(["!=","!=="]);function pw(e,t,r){if(rv(e,t))return!0;if(e.type!==t.type)return!1;switch(e.type){case"AwaitExpression":return pw(e.argument,t.argument,r);case"LogicalExpression":return e.operator===t.operator&&pw(e.left,t.left,r)&&pw(e.right,t.right,r);case"UnaryExpression":return e.operator===t.operator&&e.prefix===t.prefix&&pw(e.argument,t.argument,r);case"UpdateExpression":return!1}return r.getText(e)===r.getText(t)}function pk({context:e,conditionalExpression:t,left:r,right:n,operators:o=["??","||"]}){return e.sourceCode.getCommentsInside(t).length>0?{node:t,messageId:pv}:{node:t,messageId:pv,suggest:o.map(o=>({messageId:pD,data:{operator:o},fix:a=>(function({fixer:e,context:t,conditionalExpression:r,left:n,right:o,operator:a}){let{sourceCode:i}=t,s=[n,o].map((e,r)=>{let n=e4(e,t),o=n?e5(e,t):i.getText(e);return!n&&o2(e,{operator:a,property:0===r?"left":"right"})&&(o=`(${o})`),o}).join(` ${a} `);return oC(i.getTokenBefore(r),t,s)&&(s=`;${s}`),e.replaceText(r,s)})({fixer:a,context:e,conditionalExpression:t,left:r,right:n,operator:o})}))}}function pI(e){return ta(e)?"null":tR(e)?"undefined":void 0}function pj(e){if("BinaryExpression"!==e.type||!pT.has(e.operator)&&!pA.has(e.operator))return;let t=pI(e.left),r=pI(e.right);if(!!t==!!r)return;let n=pT.has(e.operator);return{reference:t?e.right:e.left,kind:2===e.operator.length?"nullish":t??r,isTrueWhenNullish:n}}let pF=(e,t)=>"null"===e.kind&&"undefined"===t.kind||"undefined"===e.kind&&"null"===t.kind,pB="with-name",pR="without-name",pP="regexp-exec",pL="string-match",pN="string-search",p$="suggestion",pM="string",pO="regexp",pU="other",pq="string-or-other",pV="regexp-or-other",pW="unknown";function*p_(e,{stringNode:t,methodNode:r,regexpNode:n},o){let{sourceCode:a}=o;yield e.replaceText(r,"test");let i=a.getText(t);ez(n,a)||"SequenceExpression"!==t.type||(i=`(${i})`),yield e.replaceText(n,i);let s=a.getText(n);!ez(t,a)&&oQ(n,o)&&(s=`(${s})`),yield e.replaceText(t,s)}let pz=[{type:pP,test:e=>tA(e,{method:"exec",argumentsLength:1,optionalCall:!1,optionalMember:!1}),getNodes:e=>({stringNode:e.arguments[0],methodNode:e.callee.property,regexpNode:e.callee.object}),*fix(e,{methodNode:t}){yield e.replaceText(t,"test")}},{type:pL,test:e=>tA(e,{method:"match",argumentsLength:1,optionalCall:!1,optionalMember:!1}),getNodes:e=>({stringNode:e.callee.object,methodNode:e.callee.property,regexpNode:e.arguments[0]}),fix:p_},{type:pN,test:e=>tA(e,{method:"search",argumentsLength:1,optionalCall:!1,optionalMember:!1}),getNodes:e=>({stringNode:e.callee.object,methodNode:e.callee.property,regexpNode:e.arguments[0]}),fix:p_}],pK=e=>to(e)||tm(e,{name:"RegExp"}),pG=e=>{if("[object RegExp]"===Object.prototype.toString.call(e))return e},pJ=e=>{if(e.includes(pW))return pW;let t=new i(e),r=t.has(pM)||t.has(pq),n=t.has(pO)||t.has(pV);if(r&&n)return pq;let o=t.has(pU)||t.has(pq)||t.has(pV);return r?o?pq:pM:n?o?pV:pO:pU},pX=e=>{let t=new i(e);return t.has(pW)?pW:t.has(pO)?pO:t.has(pM)?pM:pU},pY=new i(["TSBigIntKeyword","TSBooleanKeyword","TSNeverKeyword","TSNullKeyword","TSNumberKeyword","TSObjectKeyword","TSSymbolKeyword","TSUndefinedKeyword","TSVoidKeyword","TSArrayType","TSTypeLiteral","TSTupleType","TSFunctionType","TSConstructorType"]),pH=e=>{switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return pH(e.typeAnnotation);case"TSStringKeyword":return pM;case"TSLiteralType":return"Literal"===e.literal.type&&"string"==typeof e.literal.value?pM:pU;case"TSTypeReference":if("Identifier"!==e.typeName.type)return pW;if("String"===e.typeName.name)return pM;if("RegExp"===e.typeName.name)return pO;if("Array"===e.typeName.name||"ReadonlyArray"===e.typeName.name)return pU;return pW;case"TSUnionType":return pJ(e.types.map(e=>pH(e)));case"TSIntersectionType":return pX(e.types.map(e=>pH(e)));default:return pY.has(e?.type)?pU:pW}},pQ=(e,t)=>{let r,n;if(r=e,rZ.has(r.intrinsicName)||(n=e=t.getNonNullableType(e),rZ.has(n.intrinsicName)))return pW;if(e.isTypeParameter?.()){let r=e.getConstraint();return r?pQ(r,t):pW}return e.isUnion()?pJ(e.types.map(e=>pQ(e,t))):e.isIntersection()?pX(e.types.map(e=>pQ(e,t))):"string"===e.intrinsicName||e.isStringLiteral?.()?pM:"RegExp"===r1(e)?.getName()||r3(e,t).some(e=>pQ(e,t)===pO)?pO:pU},pZ=new i(["ArrayExpression","ArrowFunctionExpression","ClassExpression","FunctionExpression","ObjectExpression"]);function p0(e,t,r=new i){let n;if(pK(e))return pO;if(or(e,t))return pM;switch(e.type){case"Identifier":{let n=((e,t,r)=>{let{sourceCode:n}=t,o=eg(n.getScope(e),e);if(!o||r.has(o)||1!==o.defs.length)return pW;r.add(o);let[a]=o.defs,i=pH(a.name?.typeAnnotation),s=pW;return i!==pW?s=i:"Variable"===a.type&&"const"===a.parent.kind&&a.node.init&&(s=p0(a.node.init,t,r)),r.delete(o),s})(e,t,r);if(n!==pW)return n;break}case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":{let n=pH(e.typeAnnotation);return n===pW?p0(e.expression,t,r):n}case"TSNonNullExpression":case"ParenthesizedExpression":return p0(e.expression,t,r);case"SequenceExpression":return p0(e.expressions.at(-1),t,r);case"ConditionalExpression":return pJ([p0(e.consequent,t,r),p0(e.alternate,t,r)])}let o=t.sourceCode.getScope(e),a=(n=eN(e,o))?"string"==typeof n.value?pM:pG(n.value)?pO:void 0===n.value&&("Identifier"===e.type&&"undefined"===e.name||"UnaryExpression"===e.type&&"void"===e.operator)||null===n.value||["bigint","boolean","number","symbol"].includes(typeof n.value)?pU:pW:pW;return a!==pW?a:pZ.has(e.type)?pU:((e,t)=>{let{parserServices:r}=t.sourceCode;if(!r?.program)return pW;try{let{program:t}=r;return pQ(r.getTypeAtLocation(e),t.getTypeChecker())}catch{return pW}})(e,t)}let p1=(e,t)=>{let r;return"UnaryExpression"===(r=((e,t)=>{for(;;){if(tL(e.parent)||tO(e.parent,t)&&e.parent.arguments[0]===e){e=e.parent;continue}break}return e})(e,t)).parent.type&&"!"===r.parent.operator&&r.parent.argument===r},p2=(e,[t,r])=>e.getAllComments().some(n=>{let[o,a]=e.getRange(n);return o>=t&&a<=r}),p3=(e,t,r)=>[e9(t,r)[1],r.sourceCode.getRange(e.node)[1]],p8=e=>[{messageId:p$,fix:e}],p6=e=>[pO,pV,pU].includes(e),p9=e=>[pM,pq,pU].includes(e),p5=({type:e,stringType:t,regexpType:r})=>e===pP?p9(r)||p6(t):p6(t)||p9(r),p4=(e,t,r,{lengthCheck:n,searchCheck:o,callExpression:a,isRegExp:i,staticRegExp:s})=>{if(n){((e,t)=>{let{sourceCode:r}=t,n=[[e9(e.lengthNode.object,t)[1],r.getRange(e.lengthNode)[1]]];return e.comparisonLeftNode&&n.push([e9(e.comparisonLeftNode,t)[1],r.getRange(e.node)[1]]),n})(n,r).every(e=>!p2(r.sourceCode,e))&&(e.suggest=p8(t));return}if(!o||!p2(r.sourceCode,p3(o,a,r))){if((({searchCheck:e,isRegExp:t,staticRegExp:r})=>t||r?.global===!1&&(!e||!1===r.sticky))({searchCheck:o,isRegExp:i,staticRegExp:s})){e.fix=t;return}e.suggest=p8(t)}},p7={create:oz(e=>{e.on("CallExpression",function*(t){let r=((e,t)=>{let r,n="ChainExpression"===(r=e.parent).type?r.expression:r;if(!tS(n,{property:"length"})||n.object!==e)return;let o="ChainExpression"===n.parent.type?n.parent:n;if(p1(o,t))return;if(tU(o,t)||tq(o))return{lengthNode:n,node:o};let{parent:a}=o;if(a?.type==="BinaryExpression"&&a.left===o&&">"===a.operator&&e7(a.right,0)&&!p1(a,t)&&(tU(a,t)||tq(a)))return{lengthNode:n,node:a,comparisonLeftNode:o}})(t,e),n=(e=>{let{parent:t}=e;if(t?.type!=="BinaryExpression"||t.left!==e)return;let{operator:r,right:n}=t;return["!==","!=",">"].includes(r)&&tw(n)||">="===r&&e7(n,0)?{node:t,negate:!1}:["===","=="].includes(r)&&tw(n)||"<"===r&&e7(n,0)?{node:t,negate:!0}:void 0})(t);if(r||n||tU(t,e)||tq(t))for(let{type:o,test:a,getNodes:i,fix:s}of pz){if(o===pN!=!!n||!a(t))continue;let l=i(t),{methodNode:u,regexpNode:p}=l,c=e.sourceCode.getScope(p),d=eN(p,c),m=d?pG(d.value):void 0,f=pK(p);if(p5({type:o,stringType:p0(l.stringNode,e),regexpType:p0(p,e)}))continue;let g={node:o===pP?u:t,messageId:o};p4(g,function*(o){for(let a of(r?(yield aN(o,r.lengthNode,e),r.comparisonLeftNode&&(yield o.removeRange([e9(r.comparisonLeftNode,e)[1],e.sourceCode.getRange(r.node)[1]]))):n&&(n.negate&&(yield o.insertTextBefore(n.node,"!")),yield o.removeRange(p3(n,t,e))),s(o,l,e)))yield a},e,{lengthCheck:r,searchCheck:n,callExpression:t,isRegExp:f,staticRegExp:m}),yield g}})}),meta:{type:"suggestion",docs:{description:"Prefer `RegExp#test()` over `String#match()`, `String#search()`, and `RegExp#exec()`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[pP]:"Prefer `.test(…)` over `.exec(…)`.",[pL]:"Prefer `RegExp#test(…)` over `String#match(…)`.",[pN]:"Prefer `RegExp#test(…)` over `String#search(…)` when checking for existence.",[p$]:"Switch to `RegExp#test(…)`."},languages:["js/js"]}},ce="error",ct="suggestion",cr=["copyWithin","fill","filter","flat","flatMap","map","reverse","sort","splice","toReversed","toSorted","toSpliced","with","split","toArray"],cn=["slice","concat"],co=e=>tA(e.parent.parent,{method:"includes",optionalCall:!1,optionalMember:!1,argumentsLength:1})&&e.parent.object===e,ca=new i(["ForOfStatement","ForStatement","ForInStatement","WhileStatement","DoWhileStatement","FunctionDeclaration","FunctionExpression","ArrowFunctionExpression"]),ci=(e,t,r=new i)=>"ArrayExpression"===e.type||td(e,{name:"Array",optional:!1},tc)||tA(e,{object:"Array",methods:["from","of"],optionalCall:!1,optionalMember:!1})||tA(e,{methods:cr,optionalCall:!1,optionalMember:!1})||tA(e,{methods:cn,optionalCall:!1,optionalMember:!1})&&void 0===tr(e.callee.object)&&("Identifier"!==e.callee.object.type||((e,t,r=new i)=>{if("Identifier"!==e.type)return!1;let n=eg(t,e);if(!n||r.has(n)||1!==n.defs.length)return!1;r.add(n);let[o]=n.defs;return"Variable"===o.type&&"const"===o.kind&&!!o.node.init&&ci(o.node.init,t,r)})(e.callee.object,t,r)),cs=e=>Number.isSafeInteger(e)&&e>=0&&e<=0xffffffff,cl=e=>e.some(e=>e?.type==="SpreadElement"),cu=(e,t,r)=>e.getCommentsInside(t).some(t=>{let n,o;return n=e.getRange(t),o=e.getRange(r),!(n[0]>=o[0])||!(n[1]<=o[1])}),cp=(e,t)=>(e?.type==="TSAsExpression"||e?.type==="TSTypeAssertion"||e?.type==="TSNonNullExpression")&&e.expression===t,cc=e=>{let{parent:t}=e;if(!("MemberExpression"===t.type&&t.object===e&&!t.computed&&!t.optional&&"Identifier"===t.property.type&&"length"===t.property.name)||(e=>{let t,r=e;for(;cp(r.parent,r);)r=r.parent;return nP(r)||("ForInStatement"===(t=r).parent.type||"ForOfStatement"===t.parent.type)&&t.parent.left===t})(t))return!1;let r=t.parent;return"CallExpression"!==r.type||r.callee!==t},cd=e=>{let t,r;return"ForOfStatement"===e.parent.type&&e.parent.right===e||(e=>{let{parent:t}=e;return"SpreadElement"===t.type&&t.argument===e&&["ArrayExpression","CallExpression","NewExpression"].includes(t.parent.type)})(e)||tA(t=e.parent.parent,{method:"forEach",optionalCall:!1,optionalMember:!1,argumentsLength:1})&&e.parent.object===e&&"ArrowFunctionExpression"===(r=t.arguments[0]).type&&1===r.params.length&&"RestElement"!==r.params[0].type},cm={create:e=>{let{minimumItems:t}=e.options[0],{sourceCode:r}=e;e.on("Identifier",n=>{let o,{parent:a}=n;if(!((e,t)=>{let{parent:r}=e;return"VariableDeclarator"===r.type&&r.id===e&&!!r.init&&"VariableDeclaration"===r.parent.type&&("ExportNamedDeclaration"!==r.parent.parent.type||r.parent.parent.declaration!==r.parent)&&ci(r.init,t.getScope(r.init))})(n,r))return;if(t>0){var i,s;let e=(i=a.init,s=r.getScope(a.init),"ArrayExpression"===i.type?cl(i.elements)?void 0:i.elements.length:td(i,{name:"Array",optional:!1},tc)?((e,t)=>{if(cl(e.arguments))return;if(1!==e.arguments.length)return e.arguments.length;let r=eN(e.arguments[0],t);if(!r)return;let{value:n}=r;return"number"!=typeof n?1:cs(n)?n:void 0})(i,s):tA(i,{object:"Array",method:"of",optionalCall:!1,optionalMember:!1})?cl(i.arguments)?void 0:i.arguments.length:tA(i,{object:"Array",method:"from",optionalCall:!1,optionalMember:!1})?((e,t)=>{let[r]=e.arguments;if(r&&"SpreadElement"!==r.type){if("ArrayExpression"===r.type)return cl(r.elements)?void 0:r.elements.length;if(void 0!==tr(r)){let e=eN(r,t);return"string"==typeof e?.value?[...e.value].length:void 0}return((e,t)=>{if("ObjectExpression"!==e.type||1!==e.properties.length)return;let[r]=e.properties;if((e=>{if("Property"!==e.type||e.computed)return!1;let{key:t}=e;return"Identifier"===t.type&&"length"===t.name||"Literal"===t.type&&"length"===t.value})(r)){let e=eN(r.value,t);return cs(e?.value)?e.value:void 0}})(r,t)}})(i,s):void 0);if(void 0===e||e<t)return}let l=eg(r.getScope(n),n);if(!l)return;let u=(e=>{let t=[],r=[],n=[];for(let o of e){if(co(o)){t.push(o);continue}if(cc(o)){r.push(o),n.push(o);continue}if(cd(o)){n.push(o);continue}return}return{includes:t,lengths:r,extra:n}})(rG(l).filter(e=>e!==n));if(!u||0===u.includes.length||u.extra.length>0&&(o=a.init,!("ArrayExpression"===o.type&&!cl(o.elements)&&o.elements.every(Boolean)&&o.elements.every(t=>{let r;return(r=eN(t,e.sourceCode.getScope(t)))&&rC(r.value)&&!Object.is(r.value,-0)}))||0!==rT(o.elements,e).length)||1===u.includes.length&&!((e,t)=>{let r=t.parent.parent.parent,{parent:n}=e.parent;for(;n&&n!==r;){if(ca.has(n.type))return!0;n=n.parent}return!1})(u.includes[0],n))return;let p={node:n,messageId:ce,data:{name:n.name}},c=n.typeAnnotation&&((e,t)=>{if("TSArrayType"===e.type){if(cu(t,e,e.elementType))return;return`Set<${t.getText(e.elementType)}>`}if("TSTypeOperator"===e.type&&"readonly"===e.operator&&"TSArrayType"===e.typeAnnotation.type){if(cu(t,e,e.typeAnnotation.elementType))return;return`ReadonlySet<${t.getText(e.typeAnnotation.elementType)}>`}if("TSTypeReference"!==e.type||"Identifier"!==e.typeName.type)return;let r=e.typeArguments??e.typeParameters;if(r?.params.length===1&&!cu(t,e,r)){if("Array"===e.typeName.name)return`Set${t.getText(r)}`;if("ReadonlyArray"===e.typeName.name)return`ReadonlySet${t.getText(r)}`}})(n.typeAnnotation.typeAnnotation,r),d=function*(e){for(let t of(c&&(yield e.replaceText(n.typeAnnotation.typeAnnotation,c)),yield e.insertTextBefore(n.parent.init,"new Set("),yield e.insertTextAfter(n.parent.init,")"),u.includes))yield e.replaceText(t.parent.property,"has");for(let t of u.lengths)yield e.replaceText(t.parent.property,"size")};return n.typeAnnotation&&!c?p.suggest=[{messageId:ct,fix:d}]:p.fix=d,p})},meta:{type:"suggestion",docs:{description:"Prefer `Set#has()` over `Array#includes()` when checking for existence or non-existence.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,properties:{minimumItems:{type:"integer",minimum:0,description:"The minimum known array size before `Set#has()` is enforced."}}}],defaultOptions:[{minimumItems:0}],messages:{[ce]:"`{{name}}` should be a `Set`, and use `{{name}}.has()` to check existence or non-existence.",[ct]:"Switch `{{name}}` to `Set`."},languages:["js/js"]}},cf=e=>tA(e.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&e.parent.arguments[0]===e&&td(e.parent.callee.object,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1},tu),cg="prefer-string-raw",cy="unnecessary-string-raw";function ch(e,t=""){return e.replaceAll(RegExp(String.raw`\\(?<escapedCharacter>[\\${t}])`,"g"),"$<escapedCharacter>")}let cx="prefer-switch",cb=(e,t)=>e===t||rv(e,t),cE=({left:e,right:t})=>[e,t].filter(e=>!("Literal"===e.type||tR(e))),cv=new i(["WhileStatement","DoWhileStatement","ForStatement","ForOfStatement","ForInStatement","SwitchStatement"]),cC=e=>{for(;e.parent;e=e.parent)if(cv.has(e.type))return e},cD=(e,t,r)=>{let{sourceCode:n}=r;return n.getRange(e)[0]>=n.getRange(t)[0]&&n.getRange(e)[1]<=n.getRange(t)[1]},cS={create:e=>{let t={...e.options[0]},{sourceCode:r}=e,n=new i,o=[],a=new i;e.on("IfStatement",e=>{n.add(e)}),e.on("BreakStatement",e=>{e.label||o.push(e)}),e.on("Program:exit",function*(){for(let i of n){if(a.has(i))continue;let{discriminant:n,ifStatements:s}=function(e){let t,r=[];for(;e&&"IfStatement"===e.type;e=e.alternate){let{test:n}=e,o=function(e){let t=[e],r=[];for(;t.length>0;){if("LogicalExpression"===(e=t.pop()).type&&"||"===e.operator){t.push(e.right,e.left);continue}if("BinaryExpression"!==e.type||"==="!==e.operator)return[];r.push(e)}return r}(n);if(0===o.length)break;t||=cE(o[0]);let a=function(e,t){for(let{left:r,right:n}of e)if(0===(t=t.filter(e=>cb(e,r)||cb(e,n))).length)break;return t}(o,t);if(0===a.length)break;t=a,r.push({statement:e,compareExpressions:o})}return{ifStatements:r,discriminant:t&&t[0]}}(i);if(!n||s.length<t.minimumCases)continue;for(let{statement:e}of s)a.add(e);let l={loc:{start:r.getLoc(i).start,end:r.getLoc(i.consequent).start},messageId:cx};!e_(n,r)&&s.every(({statement:t})=>!function(e,t,r){for(let n of e){if(!cD(n,t,r))continue;let e=cC(n);if(!e||cD(t,e,r))return!0}return!1}(o,t,e))&&(l.fix=function({discriminant:e,ifStatements:t},r,n){let{sourceCode:o}=r,a=o.getText(e);return function*(i){let s=t[0].statement,l=rA(s,r);yield i.insertTextBefore(s,`switch (${a}) {`);let u=t.at(-1).statement;if(u.alternate){let{alternate:e}=u;yield i.insertTextBefore(e,`
|
|
27
|
+
`,e=>(...t)=>({async *[Symbol.asyncIterator](){e.throwIfAborted();let{worker:n,cleanup:o}=ra(r),a=rn(e,[],{rejectionEvents:["abort"]});try{let e=!0;for(;;){let r=Promise.race([rn(n,"message",{rejectionEvents:["error","messageerror"]}),a]);n.postMessage(e?t:void 0),e=!1;let{data:{output:o,error:i}}=await r;if(i)throw i;let{value:s,done:l}=o;if(l)break;yield s}}catch(t){throw e.throwIfAborted(),t}finally{a.cancel(),o()}}});let rp=e=>[e,...e.childScopes.flatMap(e=>rp(e))],rc=e=>[...new i(rp(e).flatMap(({references:e})=>e))],rd=new i(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","as","implements","interface","let","package","private","protected","public","static","yield","any","boolean","constructor","declare","get","module","require","number","set","string","symbol","type","from","of"]),rm=e=>"string"==typeof e&&rl(e)&&!rd.has(e),rf=(e,t)=>t.every(t=>!(ru(e,t)||rc(t).some(({identifier:t,resolved:r})=>t?.name===e&&!r))),rg=()=>!0;function ry(e,t,r=rg){if(rm(e)||rm(e+="_")){for(;!rf(e,t)||!r(e,t);)e+="_";return e}}function rh(e,t){if(e.arguments.length>0)return!0;let{sourceCode:r}=t,[n,o]=r.getLastTokens(e,2);return eC(n)&&eD(o)&&r.getRange(e.callee)[1]<r.getRange(e)[1]}function rx(e,t){let{sourceCode:r}=t,n=e.typeArguments??e.callee,o=r.getTokenAfter(n,eC),[a,i]=r.getLastTokens(e,2);return{openingParenthesisToken:o,closingParenthesisToken:i,trailingCommaToken:eb(a)?a:void 0}}function rb(e,t,r=!0){let{sourceCode:n}=e,{openingParenthesisToken:o,closingParenthesisToken:a,trailingCommaToken:i}=rx(t,e),[,s]=n.getRange(o),[l]=n.getRange(r?a:i??a);return n.text.slice(s,l)}function rE(e){let t;switch(e?.type){case"MemberExpression":t=e.property;break;case"ChainExpression":return rE(e.expression);case"Property":case"MethodDefinition":t=e.key}if(t){if("Identifier"===t.type&&!e.computed)return t.name;let r=e$(t);if(!r)return;return String(r.value)}}function rv(e){return["ChainExpression","TSAsExpression","TSSatisfiesExpression","TSTypeAssertion","TSNonNullExpression"].includes(e.type)?rv(e.expression):e}function rC(e,t){if(e=rv(e),t=rv(t),e.type!==t.type)return!1;switch(e.type){case"Super":case"ThisExpression":return!0;case"Identifier":case"PrivateIdentifier":return e.name===t.name;case"Literal":var r,n;return r=e,n=t,r.regex||n.regex?!!(r.regex&&n.regex&&r.regex.pattern===n.regex.pattern&&r.regex.flags===n.regex.flags):r.bigint||n.bigint?r.bigint===n.bigint:r.value===n.value;case"MemberExpression":{let r=rE(e);if(void 0!==r)return rC(e.object,t.object)&&r===rE(t);return e.computed===t.computed&&rC(e.object,t.object)&&rC(e.property,t.property)}default:return!1}}let rD=e=>null===e||"object"!=typeof e&&"function"!=typeof e,rS=(e,t)=>{if(!e)return{value:void 0};let{sourceCode:r}=t,n=e$(e,r.getScope(e));if(n&&rD(n.value))return{value:n.value}},rT=(e,t,r)=>{let n=rS(e,r),o=rS(t,r);if(n&&o){let e,t;return(e=n.value)===(t=o.value)||"number"==typeof e&&"number"==typeof t&&Number.isNaN(e)&&Number.isNaN(t)}return!!e&&!!t&&"Literal"!==e.type&&"Literal"!==t.type&&rC(e,t)},rA=(e,t)=>{let r=[],n=[];for(let o of e)o?.type!=="SpreadElement"&&(r.some(e=>rT(e,o,t))&&n.push(o),r.push(o));return n};function rw(e,t){let{sourceCode:r}=t,{start:{line:n,column:o}}=r.getLoc(e);return r.getLines()[n-1].slice(0,o).match(/\s*$/)[0]}let rk=new i(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion"]),rI=e=>rk.has(e?.type);function rj(e){for(;rI(e);)e=e.expression;return e}function rF(e){return rl(e,{checkReserved:!1})}function rB(e){let{sourceCode:t}=e,r=t.getAllComments?.();return r?.length?r:t.comments??[]}let rR=(e,t)=>Array.isArray(t)?t:e.sourceCode.getRange(t),rP=([e,t],[r,n])=>e>=r&&t<=n;function rL(e,t,r=[]){let{sourceCode:n}=e,o=rR(e,t),a=r.map(t=>rR(e,t));return rB(e).some(e=>{let t=n.getRange(e);return rP(t,o)&&a.every(e=>!rP(t,e))})}function rN(e,t){let{sourceCode:r}=e,n=r.getLoc(t).end.line;return r.getCommentsAfter(t).findLast(e=>r.getLoc(e).start.line===n)}let r$=(e,[t,r])=>{let{sourceCode:n}=e;return n.getAllComments().some(e=>{let[o,a]=n.getRange(e);return o>=t&&a<=r})},rM=new i(["ClassDeclaration","FunctionDeclaration","TSEnumDeclaration","TSInterfaceDeclaration","TSModuleDeclaration","TSTypeAliasDeclaration"]),rO=e=>"VariableDeclaration"===e.type&&"var"!==e.kind||rM.has(e.type),rU=e=>rO(e)||"BlockStatement"===e.type&&e.body.some(e=>rO(e));function rq(e,t){if("Identifier"!==e.type)return;let r=ey(t.sourceCode.getScope(e),e);if(!r||1!==r.defs.length)return;let[n]=r.defs;if("Variable"===n.type&&"VariableDeclarator"===n.node.type&&"VariableDeclaration"===n.parent.type&&"const"===n.parent.kind)return n.node.init}function rV(e,t){let{sourceCode:r}=t,[,n]=e5(e.object,t);return[n,e.computed?r.getRange(r.getTokenBefore(e.property,e=>"["===e.value))[1]:r.getRange(e.property)[0]]}let rW=new i(["depth","height","width"]);function r_(e){return tT(e,{properties:["length","size"],optional:!1})}function rz(e){return/\.(?:ts|mts|cts|tsx)$/i.test(e)}let rK=["Program","StyleSheet","Document","root"];function rG(e,t){let{sourceCode:r}=e;return r.parserServices.getTemplateBodyTokenStore&&r.ast.templateBody&&r.getRange(r.ast.templateBody)[0]<=r.getRange(t)[0]&&r.getRange(t)[1]<=r.getRange(r.ast.templateBody)[1]?r.parserServices.getTemplateBodyTokenStore():r}let rJ=({identifiers:e,references:t})=>[...new i([...e,...t.map(({identifier:e})=>e)])];function rX(e,t){if(!e)return!1;if("ThisExpression"===e.type||"Super"===e.type||"MetaProperty"===e.type&&"new"===e.meta.name&&"target"===e.property.name||"Identifier"===e.type&&"arguments"===e.name||"CallExpression"===e.type&&"Identifier"===e.callee.type&&"eval"===e.callee.name)return!0;for(let r of t[e.type]??[]){let n=e[r];if(Array.isArray(n)){for(let e of n)if(rX(e,t))return!0}else if(rX(n,t))return!0}return!1}function rY(e){let t;return(e=rj(e),e?.type==="ChainExpression")?rY(e.expression):(t=e,(t?.type==="MemberExpression"||t?.type==="CallExpression")&&(!!e.optional||("MemberExpression"===e.type?rY(e.object):rY(e.callee))))}let rH=(e,t)=>{let{references:r=[]}=ey(e,t)||{};return r};function rQ(e,t){if(t.block!==e)throw Error('"functionScope" should be the scope of "functionNode".');let{type:r,id:n}=e;return"ArrowFunctionExpression"!==r&&(!!(t.thisFound||rH(t,"arguments").some(({from:e})=>e===t))||!!(n&&rH(t,n).length>0))}let rZ=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float16Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"],r0=new i(["any","error","unknown"]),r1=new i(["null","undefined"]),r2=e=>e.getSymbol()??e.aliasSymbol,r3=(e,t)=>e?.declarations?.some(e=>t.isSourceFileDefaultLibrary(e.getSourceFile()))??!1;function r8(e,t){try{return t.getBaseTypes(e)??e.getBaseTypes?.()??[]}catch{return[]}}let r6="target",r9="non-target",r5="nullish",r4="unknown",r7=new i(["ClassDeclaration","ClassExpression"]),ne=new i(["FunctionDeclaration","FunctionExpression"]),nt=new i(["ClassName","ImportBinding","TSEnumName","Type"]),nr=new i(["TSBigIntKeyword","TSBooleanKeyword","TSNeverKeyword","TSNumberKeyword","TSStringKeyword","TSSymbolKeyword","TSVoidKeyword","TSArrayType","TSLiteralType","TSTupleType","TSTypeLiteral","TSFunctionType","TSConstructorType"]),nn=new i(["TSNullKeyword","TSUndefinedKeyword"]),no=e=>e===r5?r9:e,na=(e,t)=>0===(e=t.allowNullishInMixedUnion?e.filter(e=>e!==r5):e.map(no)).length?r9:(t.treatMixedUnionAsTarget?e.includes(r6):e.every(e=>e===r6))?r6:(t.treatMixedUnionAsNonTarget?e.includes(r9):e.every(e=>e===r9))?r9:r4,ni=e=>(e=e.map(no)).includes(r6)?r6:e.every(e=>e===r9)?r9:r4,ns=(e,t)=>{for(;t;){let r=t.set.get(e)?.defs.find(e=>nt.has(e.type));if(r)return r;t=t.upper}},nl=e=>{if("Identifier"===e.type)return e.name;if("TSQualifiedName"===e.type){let t=nl(e.left);return t?`${t}.${e.right.name}`:void 0}},nu=(e,t)=>{let r=t.typeReferenceAliases?.get(e);return t.targetTypeNames.has(e)||r&&t.targetTypeNames.has(r)?r6:t.nonTargetTypeNames?.has(e)?r9:r4},np=(e,t,r)=>{let{source:n,importedName:o,localName:a}=e,i=t?.get(n);return i?i.has(o)?r6:r9:t&&((e,t)=>{for(let r of t.values())if(r.has(e))return!0;return!1})(o,t)||nu(o,r)!==r4||nu(a,r)!==r4?r9:r4};function nc(e,t,r,n=new i){switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return nc(e.typeAnnotation,t,r,n);case"TSTypeOperator":return"readonly"===e.operator?nc(e.typeAnnotation,t,r,n):r4;case"TSTypeReference":return function e(t,r,n,o){var a,i;let s=nl(t.typeName);if(!s)return r4;let l=((e,t,r)=>{if("TSQualifiedName"!==e.typeName.type||"Identifier"!==e.typeName.left.type||!r.targetTypeNamespaceImports)return r4;let n=e.typeName.right.name,o=ns(e.typeName.left.name,t);return o?.type!=="ImportBinding"||"ImportNamespaceSpecifier"!==o.node.type&&"ImportDefaultSpecifier"!==o.node.type?r4:np({source:o.parent?.source?.value,importedName:n,localName:n},r.targetTypeNamespaceImports,r)})(t,r,n);if(l!==r4)return l;if(!n.preferTypeReferenceDefinitions){let e=nu(s,n);if(e!==r4)return e}if(o.has(s))return r4;o.add(s);let u=ns(s,r);if(!u)return o.delete(s),nu(s,n);let p=r4,c=((e,t)=>{if("ImportBinding"!==e.type)return r4;if("ImportDefaultSpecifier"===e.node.type)return nu(e.node.local.name,t)===r4?r4:r9;let r=e.node.imported?.name??e.node.imported?.value;return r?np({source:e.parent?.source?.value,importedName:r,localName:e.node.local.name},t.targetTypeImports,t):r4})(u,n);return c!==r4?p=c:"Type"===u.type&&"TSTypeAliasDeclaration"===u.node.type?p=nc(u.node.typeAnnotation,r,n,o):"Type"===u.type&&"TSTypeParameter"===u.node.type?p=nc(u.node.constraint,r,n,o):"Type"===u.type&&"TSInterfaceDeclaration"===u.node.type?(a=u.node,p=0===a.extends.length?r9:ni(a.extends.map(t=>nl(t.expression)?e({typeName:t.expression},r,n,o):r4))):"ClassName"===u.type&&(i=u.node,p=i.superClass&&n.checkClassHeritage?"Identifier"!==i.superClass.type?r4:nm(i.superClass,r,n,o):r9),o.delete(s),p}(e,t,r,n);case"TSUnionType":return na(e.types.map(e=>nc(e,t,r,n)),r);case"TSIntersectionType":return ni(e.types.map(e=>nc(e,t,r,n)));default:if(r.isTargetTypeAnnotation?.(e))return r6;if(nn.has(e?.type))return r5;return nr.has(e?.type)?r9:r4}}let nd=(e,t,r,n)=>e.superClass&&r.checkClassHeritage?nm(e.superClass,t,r,n):r9;function nm(e,t,r,n=new i){if("Identifier"===e.type){let o=e.name;if(!r.checkClassHeritage)return nu(o,r);if(n.has(o))return r4;n.add(o);let a=((e,t)=>{for(;t;){let r=t.set.get(e);if(r)return r;t=t.upper}})(o,t),[i]=a?.defs??[],s=r4;return i?.type==="Variable"&&"const"===i.parent.kind&&i.node.id===i.name&&i.node.init?s=nm(i.node.init,t,r,n):i?.type==="ClassName"&&(s=nd(i.node,t,r,n)),n.delete(o),i?s:nu(o,r)}return r7.has(e.type)?nd(e,t,r,n):r4}let nf=(e,t,r)=>{let n=e.params.find(e=>"Identifier"===e.type&&"this"===e.name);return nc(n?.typeAnnotation,t.sourceCode.getScope(e),r)};function ng(e,t,r,n=new i){if(!e)return r4;if("TSSatisfiesExpression"===e.type)return ng(e.expression,t,r,n);let o=t.sourceCode.getScope(e),a=nc(e.typeAnnotation,o,r);if(a!==r4)return a;let s=((e,t,r,n)=>{let o=t.sourceCode.getScope(e);switch(e.type){case"Identifier":return((e,t,r,n)=>{let o=ey(t.sourceCode.getScope(e),e);if(!o||n.has(o)||1!==o.defs.length)return r4;n.add(o);let[a]=o.defs,i=t.sourceCode.getScope(a.name),s=nc(a.name?.typeAnnotation,i,r),l=r4;return s!==r4?l=s:"Variable"===a.type&&"const"===a.parent.kind&&a.node.id===a.name&&a.node.init&&(l=ng(a.node.init,t,r,n)),n.delete(o),l})(e,t,r,n);case"ThisExpression":return r.checkClassSyntax?((e,t,r)=>{for(let{parent:n}=e;n;n=n.parent){if(r7.has(n.type))return nd(n,t.sourceCode.getScope(n),r);if("StaticBlock"===n.type||("AccessorProperty"===n.type||"PropertyDefinition"===n.type)&&n.static)return r9;if(ne.has(n.type)){let e=nf(n,t,r);if(e!==r4)return e;if(n.parent?.type==="Property"&&n.parent.parent?.type==="ObjectExpression")return r9;if(n.parent?.type==="MethodDefinition"){if(n.parent.static)return r9;continue}break}}return r4})(e,t,r):r4;case"Super":return r.checkClassSyntax?((e,t,r)=>{for(let{parent:n}=e;n;n=n.parent){if("StaticBlock"===n.type||("AccessorProperty"===n.type||"PropertyDefinition"===n.type)&&n.static||"MethodDefinition"===n.type&&n.static)return r9;if(r7.has(n.type))return n.superClass?nm(n.superClass,t.sourceCode.getScope(n),r):r9}return r4})(e,t,r):r4;case"NewExpression":let a;return r.checkClassSyntax?(a=e.callee,nm(a,t.sourceCode.getScope(a),r,void 0)):r4;case"TSAsExpression":case"TSTypeAssertion":{let a=nc(e.typeAnnotation,o,r);return a===r4?ng(e.expression,t,r,n):a}case"TSNonNullExpression":case"ParenthesizedExpression":return ng(e.expression,t,r,n);case"SequenceExpression":return ng(e.expressions.at(-1),t,r,n);case"ConditionalExpression":return na([ng(e.consequent,t,r,n),ng(e.alternate,t,r,n)],r);default:return r4}})(e,t,r,n);if(s!==r4)return s;if("Identifier"!==e.type){let t,n=(t=e$(e,o))?r.getStaticType?.(t.value,e)??r4:r4;if(n!==r4)return n}if(r.isTargetNode?.(e,t)||r.targetConstructorNames?.some(t=>tf(e,{name:t}))||r.targetCallNames?.some(t=>tm(e,{name:t},tp)))return r6;let l=((e,t,r)=>{let{parserServices:n}=t.sourceCode;if(!n?.program)return r4;try{let{program:t}=n;return function e(t,r,n,o){if(r0.has(t.intrinsicName))return r4;if(r1.has(t.intrinsicName))return r5;if(t.isTypeParameter?.()){let a=t.getConstraint();return a?e(a,r,n,o):r4}if(t.isUnion())return na(t.types.map(t=>e(t,r,n,o)),o);if(t.isIntersection())return ni(t.types.map(t=>e(t,r,n,o)));if(o.isTargetType?.(t,r,n))return r6;let a=r.getBaseConstraintOfType(t);if(a&&a!==t)return e(a,r,n,o);if(o.checkClassHeritage&&r8(t,r).some(t=>e(t,r,n,o)===r6))return r6;if(t.intrinsicName)return r9;let i=r2(t);if(!i)return r4;let s=i.getName(),l=o.typeReferenceAliases?.get(s);return o.targetTypeNames.has(s)||l&&o.targetTypeNames.has(l)?r6:r9}(n.getTypeAtLocation(e),t.getTypeChecker(),t,r)}catch{return r4}})(e,t,r);return l!==r4?l:r.isNonTargetNode?.(e,t)?r9:r4}let ny=e=>(e={checkClassHeritage:!0,checkClassSyntax:!1,...e},{getType:(t,r,n)=>no(ng(t,r,{...e,...n})),isTarget:(t,r,n)=>ng(t,r,{...e,...n})===r6,isKnownNonTarget:(t,r,n)=>no(ng(t,r,{...e,...n}))===r9}),nh=({name:e,aliases:t=[],checkConstructor:r=!0,...n})=>ny({...n,targetTypeNames:new i([e]),typeReferenceAliases:new o(t.map(t=>[t,e])),targetConstructorNames:r?[e]:void 0}),nx=new i(["ObjectExpression","FunctionExpression","ArrowFunctionExpression","ClassExpression","TemplateLiteral"]),nb=new i([...rZ,"Map","ReadonlyMap","WeakMap","Set","ReadonlySet","WeakSet"]),{isTarget:nE,isKnownNonTarget:nv}=ny({checkClassHeritage:!1,preferTypeReferenceDefinitions:!0,targetTypeNames:new i(["Array","ReadonlyArray"]),nonTargetTypeNames:nb,targetCallNames:["Array"],targetConstructorNames:["Array"],isTargetNode:e=>"ArrayExpression"===e.type||tw(e,{object:"Array",methods:["from","of"],optionalCall:!1,optionalMember:!1}),isNonTargetNode:e=>"NewExpression"===e.type||nx.has(e.type),isTargetTypeAnnotation:e=>e?.type==="TSArrayType"||e?.type==="TSTupleType",isTargetType:(e,t)=>t.isArrayType(e)||t.isTupleType(e),getStaticType:(e,t)=>Array.isArray(e)?r6:"Identifier"===t.type||"MemberExpression"===t.type?r4:r9}),nC=new i(["ArrayExpression","FunctionExpression","Literal","ObjectExpression","TemplateLiteral"]);function nD(e,t){return!nC.has(e.type)&&nv(e,t)}let nS=new i(["AnimationEvent","BaseSyntheticEvent","ChangeEvent","ClipboardEvent","CompositionEvent","DragEvent","FocusEvent","FormEvent","InputEvent","InvalidEvent","KeyboardEvent","MouseEvent","PointerEvent","SubmitEvent","SyntheticEvent","TouchEvent","ToggleEvent","TransitionEvent","UIEvent","WheelEvent"]),nT=new i(["AnimationEvent","AnimationPlaybackEvent","AudioProcessingEvent","BeforeUnloadEvent","BlobEvent","ClipboardEvent","CloseEvent","CommandEvent","CompositionEvent","ContentVisibilityAutoStateChangeEvent","CookieChangeEvent","CustomEvent","DeviceMotionEvent","DeviceOrientationEvent","DragEvent","ErrorEvent","Event","ExtendableCookieChangeEvent","ExtendableEvent","ExtendableMessageEvent","FetchEvent","FocusEvent","FontFaceSetLoadEvent","FormDataEvent","GPUUncapturedErrorEvent","GamepadEvent","HashChangeEvent","IDBVersionChangeEvent","InputEvent","KeyboardEvent","MIDIConnectionEvent","MIDIMessageEvent","MediaEncryptedEvent","MediaKeyMessageEvent","MediaQueryListEvent","MediaStreamTrackEvent","MessageEvent","MouseEvent","NavigateEvent","NavigationCurrentEntryChangeEvent","NotificationEvent","OfflineAudioCompletionEvent","PageRevealEvent","PageSwapEvent","PageTransitionEvent","PaymentMethodChangeEvent","PaymentRequestUpdateEvent","PictureInPictureEvent","PointerEvent","PopStateEvent","ProgressEvent","PromiseRejectionEvent","PushEvent","PushSubscriptionChangeEvent","RTCDataChannelEvent","RTCDTMFToneChangeEvent","RTCErrorEvent","RTCPeerConnectionIceErrorEvent","RTCPeerConnectionIceEvent","RTCTrackEvent","RTCTransformEvent","SecurityPolicyViolationEvent","SpeechRecognitionErrorEvent","SpeechRecognitionEvent","SpeechSynthesisErrorEvent","SpeechSynthesisEvent","StorageEvent","SubmitEvent","TaskPriorityChangeEvent","TextEvent","ToggleEvent","TouchEvent","TrackEvent","TransitionEvent","UIEvent","WebGLContextEvent","WheelEvent",...nS]),{isTarget:nA,isKnownNonTarget:nw}=ny({preferTypeReferenceDefinitions:!0,targetTypeImports:new o([["react",nS]]),targetTypeNamespaceImports:new o([["react",nS]]),targetTypeNames:nT}),{isTarget:nk}=nh({name:"Set",aliases:["ReadonlySet"],getStaticType:e=>e instanceof Set?r6:r4}),{isTarget:nI}=nh({name:"Map",aliases:["ReadonlyMap"],getStaticType:e=>e instanceof Map?r6:r4}),nj=new i(["CharacterData","Document","DocumentFragment","Element","HTMLElement","Node","SVGElement","Text"]),nF=new i(["KeyboardEvent","React.KeyboardEvent"]),nB=new i(["Event","MouseEvent","PointerEvent","React.MouseEvent","React.PointerEvent"]),{isKnownNonTarget:nR}=ny({targetTypeNames:nj,getStaticType:e=>{let{Node:t}=globalThis;return"function"==typeof t&&e instanceof t?r6:r4}}),{isKnownNonTarget:nP}=ny({targetTypeNames:nF,nonTargetTypeNames:nB}),nL=e=>("AssignmentExpression"===e.parent.type||"AssignmentPattern"===e.parent.type)&&e.parent.left===e||"UpdateExpression"===e.parent.type&&e.parent.argument===e||"ArrayPattern"===e.parent.type&&e.parent.elements.includes(e)||"RestElement"===e.parent.type&&e.parent.argument===e||"Property"===e.parent.type&&e.parent.value===e&&"ObjectPattern"===e.parent.parent.type&&e.parent.parent.properties.includes(e.parent)||"UnaryExpression"===e.parent.type&&"delete"===e.parent.operator&&e.parent.argument===e,nN=(e,t)=>"CallExpression"===e.type&&!e.optional&&"Identifier"===e.callee.type&&e.callee.name===t,n$=(e,t,r)=>"MemberExpression"===e.type&&!e.computed&&!e.optional&&"Identifier"===e.object.type&&e.object.name===t&&"Identifier"===e.property.type&&r.has(e.property.name),nM=new i(["E","LN2","LN10","LOG2E","LOG10E","PI","SQRT1_2","SQRT2"]),nO=new i(["abs","acos","acosh","asin","asinh","atan","atanh","atan2","cbrt","ceil","clz32","cos","cosh","exp","expm1","floor","fround","hypot","imul","log","log1p","log10","log2","max","min","pow","random","round","sign","sin","sinh","sqrt","tan","tanh","trunc"]),nU=new i(["EPSILON","MAX_SAFE_INTEGER","MAX_VALUE","MIN_SAFE_INTEGER","MIN_VALUE","NaN","NEGATIVE_INFINITY","POSITIVE_INFINITY"]),nq=new i(["parseFloat","parseInt"]),nV=e=>e?.type==="TSNumberKeyword"||e?.type==="TSLiteralType"&&to(e.literal),nW=new i(["-","*","/","%","**","<<",">>","|","^","&"]);function n_(e,t){let r;if(to(e)||n$(e,"Math",nM)||"CallExpression"===e.type&&!e.optional&&n$(e.callee,"Math",nO)||nN(e,"Number")||n$(e,"Number",nU)||"CallExpression"===e.type&&!e.optional&&n$(e.callee,"Number",nq)||nN(e,"parseInt")||nN(e,"parseFloat")||"MemberExpression"===e.type&&!e.computed&&!e.optional&&"Identifier"===e.property.type&&"length"===e.property.name)return!0;switch(e.type){case"AssignmentExpression":{let{operator:r}=e;if("="===r&&n_(e.right,t))return!0}case"BinaryExpression":{let{operator:r}=e;if("AssignmentExpression"===e.type&&(r=r.slice(0,-1)),"+"===r&&n_(e.left,t)&&n_(e.right,t)||">>>"===r||nW.has(r)&&(n_(e.left,t)||n_(e.right,t)))return!0;break}case"UnaryExpression":{let{operator:r}=e;if("+"===r||("-"===r||"~"===r)&&n_(e.argument,t))return!0;break}case"UpdateExpression":if(n_(e.argument,t))return!0;break;case"ConditionalExpression":{let r=n_(e.consequent,t),n=n_(e.alternate,t);if(r&&n)return!0;let o=e$(e.test,t);if(null!==o&&(r&&o.value||n&&!o.value))return!0;break}case"SequenceExpression":if(n_(e.expressions.at(-1),t))return!0;break;case"Identifier":if((r=ey(t,e))&&r.defs.some(e=>nV(e.name?.typeAnnotation?.typeAnnotation)))return!0;break;case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":if(nV(e.typeAnnotation))return!0;break;case"TSNonNullExpression":if(n_(e.expression,t))return!0}return"number"==typeof e$(e,t)?.value}ny({targetTypeNames:new i,targetCallNames:["Number"],isTargetTypeAnnotation:nV,isTargetType:e=>e.isNumberLiteral?.()||"number"===e.intrinsicName,getStaticType:e=>"number"==typeof e?r6:r4});let nz=new i([">",">=","<","<=","==","===","!=","!==","in","instanceof"]),nK=new i(["boolean","true","false"]),nG=new i(["isFinite","isNaN"]),nJ=new o([["Array",new i(["isArray"])],["ArrayBuffer",new i(["isView"])],["Atomics",new i(["isLockFree"])],["Error",new i(["isError"])],["Number",new i(["isFinite","isInteger","isNaN","isSafeInteger"])],["Object",new i(["hasOwn","is","isExtensible","isFrozen","isSealed"])],["Reflect",new i(["deleteProperty","has"])],["URL",new i(["canParse"])]]),nX=new o([["array",new i(["every","includes","some"])],["map",new i(["has"])],["regexp",new i(["test"])],["set",new i(["has","isDisjointFrom","isSubsetOf","isSupersetOf"])],["string",new i(["endsWith","includes","isWellFormed","startsWith"])],["weakSet",new i(["has"])]]),nY=new o([["regexp",new i(["dotAll","global","hasIndices","ignoreCase","multiline","sticky","unicode","unicodeSets"])]]);function nH(e,t){let{parserServices:r}=t.sourceCode;if(!r?.program)return!1;try{return function e(t,r){if(!t)return!1;if(t.isUnion?.())return t.types.every(t=>e(t,r));let n=r.getBaseConstraintOfType(t);return n&&n!==t?e(n,r):nK.has(r.typeToString(t))}(r.getTypeAtLocation(e),r.program.getTypeChecker())}catch{return!1}}function nQ(e,t,r,n){let o=e.filter(e=>"TSCallSignatureDeclaration"===e.type);return o.length>0&&o.every(e=>n0(e.returnType,t,r,n))}function nZ({node:e,context:t,scope:r,visitedTypeReferenceNames:n,predicate:o}){let a=function(e){if(e?.type==="Identifier")return e.name}(e.typeName);if(!a||n.has(a))return!1;n.add(a);let i=ru(a,r),[s]=i?.defs??[],l=s?.type==="Type"?t.sourceCode.getScope(s.node):r,u=s?.type==="Type"&&o(s.node,l);return n.delete(a),u}function n0(e,t,r,n=new i){switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return n0(e.typeAnnotation,t,r,n);case"TSBooleanKeyword":return!0;case"TSLiteralType":return"boolean"==typeof e.literal.value;case"TSTypeReference":return nZ({node:e,context:t,scope:r,visitedTypeReferenceNames:n,predicate:(e,r)=>"TSTypeAliasDeclaration"===e.type&&n0(e.typeAnnotation,t,r,n)});case"TSTypePredicate":return!e.asserts;case"TSUnionType":return e.types.every(e=>n0(e,t,r,n));case"TypeAnnotation":return e.typeAnnotation?.type==="BooleanTypeAnnotation";default:return!1}}function n1(e,t,r,n=new i){switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return n1(e.typeAnnotation,t,r,n);case"TSFunctionType":return n0(e.returnType,t,r,n);case"TSTypeLiteral":return nQ(e.members,t,r,n);case"TSTypeReference":return nZ({node:e,context:t,scope:r,visitedTypeReferenceNames:n,predicate:(e,r)=>"TSTypeAliasDeclaration"===e.type&&n1(e.typeAnnotation,t,r,n)||"TSInterfaceDeclaration"===e.type&&nQ(e.body.body,t,r,n)});case"TSUnionType":return e.types.every(e=>n1(e,t,r,n));default:return!1}}function n2(e,t,r=new i){if(e.async||e.generator)return!1;let n=t.sourceCode.getScope(e);return!!n0(e.returnType,t,n)||!!e.body&&("BlockStatement"===e.body.type&&1===e.body.body.length&&"ReturnStatement"===e.body.body[0].type?n6(e.body.body[0].argument,t,r):"ArrowFunctionExpression"===e.type&&"BlockStatement"!==e.body.type&&n6(e.body,t,r))}function n3(e,t,r=new i){if(e?.type!=="Identifier")return!1;let n=ey(t.sourceCode.getScope(e),e);if(!n||r.has(n))return!1;r.add(n);let o=!1;if(n.defs.length>1&&n.defs.every(e=>"FunctionName"===e.type)){let e=n.defs.filter(e=>"TSDeclareFunction"===e.node.type),a=e.length>0?e:n.defs;o=n.references.every(e=>!e.writeExpr)&&a.every(e=>n2(e.node,t,r))}else if(1===n.defs.length){let[e]=n.defs,a=t.sourceCode.getScope(e.name);if(n1(e.name?.typeAnnotation,t,a))o=!0;else{let a;"FunctionName"===e.type?n.references.every(e=>!e.writeExpr)&&(a=e.node):"Variable"===e.type&&"const"===e.parent.kind&&["ArrowFunctionExpression","FunctionExpression"].includes(e.node.init?.type)&&(a=e.node.init),o=!!a&&n2(a,t,r)}}return r.delete(n),o}function n8(e,t,r=new i){switch(e?.type){case"ArrayExpression":return"array";case"Literal":return"string"==typeof e.value?"string":e.regex?"regexp":void 0;case"TemplateLiteral":return 0===e.expressions.length?"string":void 0;case"NewExpression":if("Identifier"===e.callee.type&&t.sourceCode.isGlobalReference(e.callee)){if("RegExp"===e.callee.name)return"regexp";if(["Map","WeakMap"].includes(e.callee.name))return"map";if("Set"===e.callee.name)return"set";if("WeakSet"===e.callee.name)return"weakSet"}return;case"Identifier":return function(e,t,r){let n=ey(t.sourceCode.getScope(e),e),[o]=n?.defs??[];if(!n||r.has(n)||1!==n.defs.length||"Variable"!==o.type||"const"!==o.parent.kind)return;r.add(n);let a=n8(o.node.init,t,r);return r.delete(n),a}(e,t,r);case"ParenthesizedExpression":case"TSNonNullExpression":case"TSAsExpression":case"TSTypeAssertion":case"TSSatisfiesExpression":return n8(e.expression,t,r)}}function n6(e,t,r=new i){if(!e)return!1;let n=t.sourceCode.getScope(e);return!!n0(e.typeAnnotation,t,n)||"boolean"==typeof e$(e,t.sourceCode.getScope(e))?.value||(function(e,t,r){switch(e.type){case"Identifier":return function(e,t,r){if(!e||r.has(e)||1!==e.defs.length)return!1;r.add(e);let[n]=e.defs,o=t.sourceCode.getScope(n.name);if(n.name?.typeAnnotation)return r.delete(e),!n.name.optional&&n0(n.name.typeAnnotation,t,o);let a="Variable"===n.type&&"const"===n.parent.kind&&n6(n.node.init,t,r);if(!a&&"Parameter"===n.type){let e=n.name.parent;a="AssignmentPattern"===e.type&&e.left===n.name&&n.node.params.includes(e)&&n6(e.right,t,r)}return r.delete(e),a}(ey(t.sourceCode.getScope(e),e),t,r)||nH(e,t);case"UnaryExpression":return["!","delete"].includes(e.operator);case"LogicalExpression":return n6(e.left,t,r)&&n6(e.right,t,r);case"BinaryExpression":return nz.has(e.operator);case"ConditionalExpression":return n6(e.consequent,t,r)&&n6(e.alternate,t,r);case"TSAsExpression":case"TSTypeAssertion":case"TSSatisfiesExpression":let n;return n=t.sourceCode.getScope(e),n0(e.typeAnnotation,t,n)||n6(e.expression,t,r);case"CallExpression":return!!(function(e,t){if("MemberExpression"!==e.callee.type||"Identifier"!==e.callee.object.type||!t.sourceCode.isGlobalReference(e.callee.object))return!1;let r=nJ.get(e.callee.object.name),n=eO(e.callee,t.sourceCode.getScope(e.callee));return!!r?.has(n)}(e,t)||function(e,t){if("MemberExpression"!==e.callee.type)return!1;let r=nX.get(n8(e.callee.object,t)),n=eO(e.callee,t.sourceCode.getScope(e.callee));return!!r?.has(n)}(e,t))||("Identifier"!==e.callee.type?nH(e,t):!!("Boolean"===e.callee.name&&t.sourceCode.isGlobalReference(e.callee)||nG.has(e.callee.name)&&t.sourceCode.isGlobalReference(e.callee))||n3(e.callee,t,r)||nH(e,t));case"MemberExpression":return function(e,t){if("MemberExpression"!==e.type||e.optional)return!1;let r=nY.get(n8(e.object,t)),n=eO(e,t.sourceCode.getScope(e));return!!r?.has(n)}(e,t)||void 0;default:switch(e.type){case"AwaitExpression":case"TSNonNullExpression":case"ParenthesizedExpression":return n6(e.argument??e.expression,t,r);case"SequenceExpression":return n6(e.expressions.at(-1),t,r);case"AssignmentExpression":return"="===e.operator&&n6(e.right,t,r)}return}}(e,t,r)??nH(e,t))}let n9=new i(["asIntN","asUintN"]),n5=e=>{switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return n5(e.typeAnnotation);case"TSBigIntKeyword":return!0;case"TSLiteralType":return ts(e.literal);default:return!1}},{isTarget:n4}=ny({targetTypeNames:new i,targetCallNames:["BigInt"],isTargetNode:e=>ts(e)||nN(e,"BigInt")||"CallExpression"===e.type&&!e.optional&&n$(e.callee,"BigInt",n9),isTargetTypeAnnotation:n5,isTargetType:e=>e.isBigIntLiteral?.()||"bigint"===e.intrinsicName,getStaticType:e=>"bigint"==typeof e?r6:r4}),n7=new i(["fromCharCode","fromCodePoint"]),oe=e=>{switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return oe(e.typeAnnotation);case"TSStringKeyword":return!0;case"TSLiteralType":return tt(e.literal);default:return!1}},{isTarget:ot,isKnownNonTarget:or}=ny({targetTypeNames:new i,targetCallNames:["String"],isTargetNode:(e,t)=>{if(tt(e)||nN(e,"String")||"CallExpression"===e.type&&!e.optional&&n$(e.callee,"String",n7))return!0;switch(e.type){case"TemplateLiteral":return!0;case"UnaryExpression":return"typeof"===e.operator;case"BinaryExpression":return"+"===e.operator&&(on(e.left,t)||on(e.right,t));case"AssignmentExpression":if("="===e.operator)return on(e.right,t);return"+="===e.operator&&(on(e.left,t)||on(e.right,t));default:return!1}},isTargetTypeAnnotation:oe,isTargetType:e=>e.isStringLiteral?.()||"string"===e.intrinsicName,getStaticType:e=>"string"==typeof e?r6:r4});function on(e,t){return!!e&&(!!("TSSatisfiesExpression"===e.type&&oe(e.typeAnnotation)||ot(e,t))||"string"==typeof e$(e,t.sourceCode.getScope(e))?.value)}let oo=new i(["ArrayExpression","ArrowFunctionExpression","ClassExpression","FunctionExpression","Literal","ObjectExpression","TemplateLiteral"]),oa=e=>oo.has(e.type)||tP(e),oi=new i(["ArrayExpression","BinaryExpression","ClassExpression","Literal","ObjectExpression","TemplateLiteral","UnaryExpression","UpdateExpression"]),os=new i(["AssignmentExpression","AwaitExpression","NewExpression","TaggedTemplateExpression","ThisExpression"]),ol=e=>oi.has(e.type)||os.has(e.type)||tP(e)||tm(e,void 0,tp)&&!tw(e,{method:"bind",optionalCall:!1,optionalMember:!1}),ou=(e,t)=>{if("ThisExpression"===e.type)return!0;if("FunctionDeclaration"===e.type||"FunctionExpression"===e.type)return!1;if("ClassDeclaration"===e.type||"ClassExpression"===e.type){if(e.superClass&&ou(e.superClass,t))return!0;for(let r of e.body.body)if(r.computed&&ou(r.key,t))return!0;return!1}let r=t[e.type];if(!r)return!1;for(let n of r){let r=e[n];if(r){if(Array.isArray(r)){for(let e of r)if(e&&ou(e,t))return!0;continue}if(ou(r,t))return!0}}return!1};function op(e,t,r){let[n,o]=[e,t].map(e=>r.sourceCode.getLoc(e).start.line);return n===o}function oc(e,t){let r;if(r=e=t.getNonNullableType(e),!r0.has(r.intrinsicName)){if(e.isUnion()){let r=e.types.map(e=>oc(e,t));return!!r.every(Boolean)||!r.every(e=>!1===e)&&void 0}return void 0!==t.getPromisedTypeOfPromise(e)}}let od=e=>"use"===e||/^use[\dA-Z]/.test(e),om=(e,t)=>"Identifier"===e.type&&"Identifier"===t.type&&e.name===t.name;function of(e,t){return"Identifier"===e.type&&(t.sourceCode.isGlobalReference(e)||!ey(t.sourceCode.getScope(e),e))}let og=(e,t,r)=>e&&t&&r.sourceCode.getRange(e)[0]===r.sourceCode.getRange(t)[0]&&r.sourceCode.getRange(e)[1]===r.sourceCode.getRange(t)[1],oy=(e,t)=>{let{type:r,local:n,imported:o}=e.parent;return"ImportSpecifier"===r&&og(n,o,t)&&n===e},oh=new i(["ArrayExpression","CallExpression","ChainExpression","Identifier","ImportExpression","Literal","MemberExpression","NewExpression","Super","TaggedTemplateExpression","TemplateLiteral","ThisExpression","TSNonNullExpression"]);function ox(e){return oh.has(e.type)}let ob=e=>"Property"===e.parent.type&&e.parent.shorthand&&e===e.parent.value,oE=e=>tb(e.parent),ov=new i(["String","Null","Boolean","Numeric","RegularExpression"]),oC=new i(["[","(","/","`","+","-","*",",","."]);function oD(e,t,r){if(""===r||r&&!oC.has(r.charAt(0))||!e)return!1;let{sourceCode:n}=t,{type:o,value:a}=e,i=n.getRange(e),s=n.getNodeByRangeIndex(i[0]);if("Punctuator"===o){if(";"===a)return!1;if("]"===a)return!0;if(")"===a){switch(s.type){case"IfStatement":if(n.getTokenBefore(s.consequent)===e)return!1;break;case"ForStatement":case"ForInStatement":case"ForOfStatement":case"WhileStatement":case"DoWhileStatement":case"WithStatement":if(s.body&&n.getTokenBefore(s.body)===e)return!1}return!0}}return!!ov.has(o)||("Template"===o?a.endsWith("`"):"ObjectExpression"===s.type||"Identifier"===o&&("of"!==a||"ForOfStatement"!==s.type)&&("await"!==a||"AwaitExpression"!==s.type))}let oS=e=>"type"===e.importKind||"type"===e.parent.importKind,oT=(e,t,r)=>r.sourceCode.getRange(e.name??e.node)[0]<=r.sourceCode.getRange(t)[0],oA=(e,t)=>{for(;t;){let r=t.set.get(e);if(r)return r;t=t.upper}},ow=new i(["Map","ReadonlyMap"]),ok=new i(["Set","ReadonlySet"]),oI=ow.union(ok),oj=e=>new i([e]),oF=e=>oI.has(e)?e:void 0,oB=new i(["ClassName","ImportBinding","TSEnumName","Type"]),oR=(e,t,r)=>{let n=r.sourceCode.getScope(t);for(;n;){if(n.set.get(e)?.defs.find(e=>oB.has(e.type)))return!0;n=n.upper}return!1},oP=e=>{let t=new i;for(let r of e){if(!r)return;for(let e of r)t.add(e)}return t},oL=(e,t)=>{if(r0.has(e.intrinsicName))return;if(e.isUnion())return oP(e.types.map(e=>oL(e,t)));let r=r2(e);if(!(r?.declarations?.length>0&&r.declarations.every(e=>t.isSourceFileDefaultLibrary(e.getSourceFile()))))return;let n=r.getName(),o=n&&oF(n);return o&&oj(o)},oN=(e,t)=>{switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return oN(e.typeAnnotation,t);case"TSTypeOperator":return"readonly"===e.operator?oN(e.typeAnnotation,t):void 0;case"TSTypeReference":{if("Identifier"!==e.typeName.type||oR(e.typeName.name,e,t))return;let r=oF(e.typeName.name);return r&&oj(r)}case"TSUnionType":return oP(e.types.map(e=>oN(e,t)))}},o$=(e,t,r=new i)=>((e,t)=>{let{parserServices:r}=t.sourceCode;if(r?.program)try{let{program:n}=r,o=oL(r.getTypeAtLocation(e),n);if(o&&!((e,t,r)=>{for(let n of e)if(oR(n,t,r))return!0;return!1})(o,e,t))return o}catch{}})(e,t)??((e,t,r)=>{if(tf(e,{names:["Map","Set"]})&&of(e.callee,t))return oj(e.callee.name);switch(e.type){case"Identifier":return((e,t,r)=>{let n,o=ey(t.sourceCode.getScope(e),e);if(!o||r.has(o)||1!==o.defs.length)return;r.add(o);let[a]=o.defs,i=oN(a.name?.typeAnnotation,t);return i?n=i:"Variable"===a.type&&"const"===a.parent.kind&&a.node.init&&(n=o$(a.node.init,t,r)),r.delete(o),n})(e,t,r);case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":return oN(e.typeAnnotation,t)??o$(e.expression,t,r);case"TSNonNullExpression":case"ParenthesizedExpression":return o$(e.expression,t,r);case"ConditionalExpression":return oP([o$(e.consequent,t,r),o$(e.alternate,t,r)])}})(e,t,r),oM=(e,t)=>{let r=o$(e,t);if(!r?.size)return;let n=!1,o=!1;for(let e of r){if(ow.has(e)){n=!0;continue}if(ok.has(e)){o=!0;continue}return}if(!n||!o)return n?"Map":"Set"};function oO(e,t){if("function"!=typeof e?.[Symbol.iterator])return void t(e);for(let r of e)oO(r,t)}class oU extends Error{name="FixAbortError"}let oq={abort(){throw new oU("Fix aborted.")}};function oV(e){return t=>{let r=e(t,oq),n=[];try{return oO(r,e=>{n.push(e)}),n}catch(e){if(e instanceof oU)return;throw e}}}class oW{#e;#t=new o;constructor(e){this.#e=e}#r(e,t){let r=this.#t;for(let n of e)r.has(n)?r.get(n).push(t):r.set(n,[t])}on(e,t){let r=Array.isArray(e)?e:[e];this.#r(r,t)}onExit(e,t){let r=Array.isArray(e)?e:[e];this.#r(r.map(e=>`${e}:exit`),t)}toEslintListeners(){let e={};for(let[t,r]of this.#t)e[t]=function(e,t){let r=t=>{let r;t&&e.report((r={...t},t.fix&&(r.fix=oV(t.fix)),Array.isArray(t.suggest)&&(r.suggest=t.suggest.map(e=>({...e,fix:oV(e.fix),data:{...t.data,...e.data}}))),r))};return(e,n,o)=>{for(let a of t){let t=a(e,n,o);t&&oO(t,r)}}}(this.#e,r);return e}}let o_=new i;function oz(e){return o_.has(e)?e:t=>{let r=new oW(t),n=e(new Proxy(t,{get:(e,t,n)=>"on"===t||"onExit"===t?r[t].bind(r):Reflect.get(e,t,n)}));return b.equal(n,void 0,`[${t.id}] Rule \`create\` function should return \`undefined\`, please use \`context.on()\` instead of return listeners.`),r.toEslintListeners()}}function oK(e,t){var r;let{visitScriptBlock:n=!0}={},o=oz(e);return r=e=>{let t=o(e),{parserServices:r}=e.sourceCode;return r?.defineTemplateBodyVisitor?n?r.defineTemplateBodyVisitor(t,t):r.defineTemplateBodyVisitor(t):t},o_.add(r),r}let oG={"??":4,"||":4,"&&":5},oJ={"|":6,"^":7,"&":8,"==":9,"!=":9,"===":9,"!==":9,"<":10,"<=":10,">":10,">=":10,in:10,instanceof:10,"<<":11,">>":11,">>>":11,"+":12,"-":12,"*":13,"/":13,"%":13,"**":15};function oX(e){switch(e.type){case"SequenceExpression":return 0;case"AssignmentExpression":case"ArrowFunctionExpression":case"YieldExpression":return 1;case"ConditionalExpression":return 3;case"LogicalExpression":return oG[e.operator];case"BinaryExpression":return oJ[e.operator];case"TSAsExpression":case"TSSatisfiesExpression":return 10;case"UnaryExpression":case"AwaitExpression":case"TSTypeAssertion":case"TSNonNullExpression":return 16;case"UpdateExpression":return e.prefix?16:17;case"CallExpression":case"ChainExpression":case"ImportExpression":return 18;case"NewExpression":return 19;default:return 20}}function oY(e){return["AwaitExpression","AssignmentExpression","YieldExpression","SequenceExpression","TSAsExpression","TSTypeAssertion"].includes(e.type)}let oH=/^(?:0|0[0-7]*[89]\d*|[1-9](?:_?\d)*)$/u;function oQ(e){if(to(e=rj(e)))return e.value;if("UnaryExpression"===e.type&&("+"===e.operator||"-"===e.operator)){let t=oQ(e.argument);if("number"==typeof t)return"-"===e.operator?-t:t}}function oZ(e,t){switch(e.type){case"Identifier":case"MemberExpression":case"CallExpression":case"ChainExpression":case"TemplateLiteral":case"ThisExpression":case"ArrayExpression":case"FunctionExpression":return!1;case"NewExpression":return!rh(e,t);case"Literal":let r;return!!(to(e)&&(r=e.raw,oH.test(r)));default:return!0}}let o0=new i(["!","typeof","void","delete","~","+","-"]),o1=new i(["UpdateExpression","TSNonNullExpression","TSTypeAssertion"]);function o2(e,t){if(!o0.has(t))throw Error("Unexpected operator");return 16>oX(e)||o1.has(e.type)}function o3(e,{operator:t,property:r}){if(!r)throw Error("`property` is required.");return("LogicalExpression"!==e.type||e.operator!==t)&&(!!["AwaitExpression","BinaryExpression"].includes(e.type)||["LogicalExpression","ConditionalExpression","AssignmentExpression","ArrowFunctionExpression","YieldExpression","SequenceExpression"].includes(e.type))}function o8(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var o6={exports:{}},o9=o6.exports,o5=o8(function(){return u?o6.exports:(u=1,o6.exports=function(){var e=[],t=[],r={},n={},o={};function a(e){return"string"==typeof e?RegExp("^"+e+"$","i"):e}function i(e,t){return e===t?t:e===e.toLowerCase()?t.toLowerCase():e===e.toUpperCase()?t.toUpperCase():e[0]===e[0].toUpperCase()?t.charAt(0).toUpperCase()+t.substr(1).toLowerCase():t.toLowerCase()}function s(e,t,n){if(!e.length||r.hasOwnProperty(e))return t;for(var o=n.length;o--;){var a=n[o];if(a[0].test(t))return function(e,t){return e.replace(t[0],function(r,n){var o,a,s=(o=t[1],a=arguments,o.replace(/\$(\d{1,2})/g,function(e,t){return a[t]||""}));return""===r?i(e[n-1],s):i(r,s)})}(t,a)}return t}function l(e,t,r){return function(n){var o=n.toLowerCase();return t.hasOwnProperty(o)?i(n,o):e.hasOwnProperty(o)?i(n,e[o]):s(o,n,r)}}function u(e,t,r,n){return function(n){var o=n.toLowerCase();return!!t.hasOwnProperty(o)||!e.hasOwnProperty(o)&&s(o,o,r)===o}}function p(e,t,r){var n=1===t?p.singular(e):p.plural(e);return(r?t+" ":"")+n}return p.plural=l(o,n,e),p.isPlural=u(o,n,e),p.singular=l(n,o,t),p.isSingular=u(n,o,t),p.addPluralRule=function(t,r){e.push([a(t),r])},p.addSingularRule=function(e,r){t.push([a(e),r])},p.addUncountableRule=function(e){if("string"==typeof e){r[e.toLowerCase()]=!0;return}p.addPluralRule(e,"$0"),p.addSingularRule(e,"$0")},p.addIrregularRule=function(e,t){t=t.toLowerCase(),o[e=e.toLowerCase()]=t,n[t]=e},[["I","we"],["me","us"],["he","they"],["she","they"],["them","them"],["myself","ourselves"],["yourself","yourselves"],["itself","themselves"],["herself","themselves"],["himself","themselves"],["themself","themselves"],["is","are"],["was","were"],["has","have"],["this","these"],["that","those"],["echo","echoes"],["dingo","dingoes"],["volcano","volcanoes"],["tornado","tornadoes"],["torpedo","torpedoes"],["genus","genera"],["viscus","viscera"],["stigma","stigmata"],["stoma","stomata"],["dogma","dogmata"],["lemma","lemmata"],["schema","schemata"],["anathema","anathemata"],["ox","oxen"],["axe","axes"],["die","dice"],["yes","yeses"],["foot","feet"],["eave","eaves"],["goose","geese"],["tooth","teeth"],["quiz","quizzes"],["human","humans"],["proof","proofs"],["carve","carves"],["valve","valves"],["looey","looies"],["thief","thieves"],["groove","grooves"],["pickaxe","pickaxes"],["passerby","passersby"]].forEach(function(e){return p.addIrregularRule(e[0],e[1])}),[[/s?$/i,"s"],[/[^\u0000-\u007F]$/i,"$0"],[/([^aeiou]ese)$/i,"$1"],[/(ax|test)is$/i,"$1es"],[/(alias|[^aou]us|t[lm]as|gas|ris)$/i,"$1es"],[/(e[mn]u)s?$/i,"$1s"],[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i,"$1"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1i"],[/(alumn|alg|vertebr)(?:a|ae)$/i,"$1ae"],[/(seraph|cherub)(?:im)?$/i,"$1im"],[/(her|at|gr)o$/i,"$1oes"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i,"$1a"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i,"$1a"],[/sis$/i,"ses"],[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i,"$1$2ves"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/([^ch][ieo][ln])ey$/i,"$1ies"],[/(x|ch|ss|sh|zz)$/i,"$1es"],[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i,"$1ices"],[/\b((?:tit)?m|l)(?:ice|ouse)$/i,"$1ice"],[/(pe)(?:rson|ople)$/i,"$1ople"],[/(child)(?:ren)?$/i,"$1ren"],[/eaux$/i,"$0"],[/m[ae]n$/i,"men"],["thou","you"]].forEach(function(e){return p.addPluralRule(e[0],e[1])}),[[/s$/i,""],[/(ss)$/i,"$1"],[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i,"$1fe"],[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i,"$1f"],[/ies$/i,"y"],[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i,"$1ie"],[/\b(mon|smil)ies$/i,"$1ey"],[/\b((?:tit)?m|l)ice$/i,"$1ouse"],[/(seraph|cherub)im$/i,"$1"],[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i,"$1"],[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i,"$1sis"],[/(movie|twelve|abuse|e[mn]u)s$/i,"$1"],[/(test)(?:is|es)$/i,"$1is"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1us"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i,"$1um"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i,"$1on"],[/(alumn|alg|vertebr)ae$/i,"$1a"],[/(cod|mur|sil|vert|ind)ices$/i,"$1ex"],[/(matr|append)ices$/i,"$1ix"],[/(pe)(rson|ople)$/i,"$1rson"],[/(child)ren$/i,"$1"],[/(eau)x?$/i,"$1"],[/men$/i,"man"]].forEach(function(e){return p.addSingularRule(e[0],e[1])}),["adulthood","advice","agenda","aid","aircraft","alcohol","ammo","analytics","anime","athletics","audio","bison","blood","bream","buffalo","butter","carp","cash","chassis","chess","clothing","cod","commerce","cooperation","corps","debris","diabetes","digestion","elk","energy","equipment","excretion","expertise","firmware","flounder","fun","gallows","garbage","graffiti","hardware","headquarters","health","herpes","highjinks","homework","housework","information","jeans","justice","kudos","labour","literature","machinery","mackerel","mail","media","mews","moose","music","mud","manga","news","only","personnel","pike","plankton","pliers","police","pollution","premises","rain","research","rice","salmon","scissors","series","sewage","shambles","shrimp","software","species","staff","swine","tennis","traffic","transportation","trout","tuna","wealth","welfare","whiting","wildebeest","wildlife","you",/pok[eé]mon$/i,/[^aeiou]ese$/i,/deer$/i,/fish$/i,/measles$/i,/o[iu]s$/i,/pox$/i,/sheep$/i].forEach(p.addUncountableRule),p}(),o6.exports)}());function o4(e,t,r=0,n=0){let{sourceCode:o}=t,[a,i]=Array.isArray(e)?e:o.getRange(e);return{start:o.getLocFromIndex(a+r),end:o.getLocFromIndex(i+n)}}function o7(e,t){let r=[],n=new s,o=new s,a=new l;return e.on("onCodePathStart",()=>{r.push(new i)}),e.on("onCodePathEnd",()=>{r.pop()}),e.on("onCodePathSegmentStart",e=>{r.at(-1).add(e)}),e.on("onCodePathSegmentEnd",e=>{r.at(-1).delete(e)}),e.on("onUnreachableCodePathSegmentStart",e=>{r.at(-1).add(e)}),e.on("onUnreachableCodePathSegmentEnd",e=>{r.at(-1).delete(e)}),e.on("IfStatement",e=>{[...r.at(-1)].some(e=>e.reachable)&&a.add(e)}),e.onExit(["IfStatement > .consequent","IfStatement > .alternate"],e=>{n.set(e,new i(r.at(-1)))}),e.onExit("IfStatement",e=>{let i=r.at(-1);for(let r of[e.consequent,e.alternate]){if(!r)continue;let s=n.get(r),l=s&&[...i].every(e=>e.prevSegments.every(e=>!s.has(e)))||t?.(r);o.set(r,a.has(e)&&!!l)}}),e=>!!(e&&o.get(e))}function ae(e,t,r){let{parent:n}=e;for(let o of t.sourceCode.visitorKeys[n.type]||Object.keys(n)){let t=n[o];if(t!==e&&Array.isArray(t)){let n=t.indexOf(e);if(-1!==n)return t[n+r]}}}let at=(e,t)=>ae(e,t,-1),ar=(e,t)=>ae(e,t,1),an=e=>e.charAt(0).toUpperCase()+e.slice(1),ao=e=>e.charAt(0).toLowerCase()+e.slice(1),aa="too-deep",ai="should-parenthesized",as="prefer-event-target",al=new i(["@angular/core","eventemitter3"]),au=e=>"VariableDeclarator"===e.parent.type&&e.parent.id===e&&"VariableDeclaration"===e.parent.parent.type&&"const"===e.parent.parent.kind&&e.parent.parent.declarations.includes(e.parent);function ap(e){let t;return!!e&&(tj(e)?[t]=e.arguments:"AwaitExpression"===e.type&&"ImportExpression"===e.argument.type&&({source:t}=e.argument),!!(tt(t)&&al.has(t.value)))}let ac={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",186:";",187:"=",188:",",189:"-",190:".",191:"/",219:"[",220:"\\",221:"]",222:"'",224:"Meta"},ad="prefer-keyboard-event-key",am="prefer-keyboard-event-key/suggestion",af=new i(["keyCode","charCode","which"]),ag=new i(["onKeyDown","onKeyPress","onKeyUp"]),ay=e=>{var t;return e?.type==="TSTypeAnnotation"&&"TSTypeReference"===e.typeAnnotation.type&&("Identifier"===(t=e.typeAnnotation.typeName).type?"KeyboardEvent"===t.name:"TSQualifiedName"===t.type&&"Identifier"===t.left.type&&"React"===t.left.name&&"Identifier"===t.right.type&&"KeyboardEvent"===t.right.name)},ah=(e,t)=>{var r;let n,o=[],a="ArrowFunctionExpression"===t.type||"FunctionExpression"===t.type;for(let e of(a&&tw(t.parent,{method:"addEventListener",minimumArguments:2,optionalCall:!1,optionalMember:!1})&&t.parent.arguments[1]===t&&o.push({parameter:t.params[0],shouldAutofix:!0}),a&&"JSXExpressionContainer"===(r=t).parent.type&&r.parent.expression===r&&"JSXAttribute"===r.parent.parent.type&&r.parent.parent.value===r.parent&&"JSXAttribute"===(n=r.parent.parent).type&&"JSXIdentifier"===n.name.type&&ag.has(n.name.name)&&o.push({parameter:t.params[0],shouldAutofix:!1}),t.params))ay(e.typeAnnotation)&&o.push({parameter:e,shouldAutofix:!1});let i=e.sourceCode.getDeclaredVariables(t);return o.filter(({parameter:t})=>t&&!nP(t,e)).map(e=>({...e,references:i.find(t=>t.identifiers.includes(e.parameter))?.references}))},ax=(e,t)=>e?.parent?.type==="MemberExpression"&&e.parent.property===e&&!e.parent.computed&&e.parent.object===t,ab=(e,t)=>{let r=[];for(let n=t.parent;n;n=n.parent)tv(n)&&r.push(...ah(e,n));return r},aE=(e,{shouldAutofix:t})=>{let r=(e=>{var t;if(e.parent?.type!=="MemberExpression"||e.parent.property!==e)return;let r=((e,t)=>{let r=e;for(;r&&t;)t--,r=r.parent;if(0===t)return r})(e,3);if(!r||"IfStatement"!==r.type)return;let{type:n,operator:o,right:a}=r.test;if(!("BinaryExpression"===n&&r.test.left===e.parent&&("=="===o||"==="===o)&&to(a)))return;let i=Object.hasOwn(ac,t=a.value)?ac[t]:Number.isSafeInteger(t)&&t>=0&&t<=1114111?String.fromCodePoint(t):void 0;if(i)return{key:i,right:a}})(e),n={messageId:ad,data:{name:e.name},node:e};if(!r)return n;let o=t=>[t.replaceText(e,"key"),t.replaceText(r.right,tK(r.key))];return t?n.fix=o:n.suggest=[{messageId:am,data:{key:r.key},fix:o}],n},av=(e,{parameter:t})=>t?.type==="ObjectPattern"&&t.properties.includes(e.parent),aC=(e,{references:t})=>{let r=((e,t,r=()=>!0)=>{let n=e;for(;n;){if(n.type===t&&r(n))return n;n=n.parent}})(e,"VariableDeclarator"),n=r?.init;return t&&r?.id===e.parent.parent&&t.some(e=>e.identifier===n)},aD="error",aS="suggestion";function*aT(e,t,r){for(let n of e9(e,r))yield t.remove(n)}function aA(e,t,r,n){if("CallExpression"!==t.type)throw Error(`Unexpected node "${t.type}".`);let{sourceCode:o}=n,[a,i]=o.getLastTokens(t,2);return t.arguments.length>0&&(r=eb(a)?` ${r},`:`, ${r}`),e.insertTextBefore(i,r)}function aw(e,t,r){let n=function(e,t){let r=e.parent,n=r.arguments.indexOf(e),o=e9(e,t),a=o[0]||e,i=o.at(-1)||e,{sourceCode:s}=t,[l]=s.getRange(a),[,u]=s.getRange(i);if(1===r.arguments.length){let e=s.getTokenAfter(i);eb(e)&&([,u]=s.getRange(e))}else if(0===n){let e=s.getTokenAfter(i),t=s.getTokenAfter(e,{includeComments:!0});[u]=s.getRange(t)}else{let e=s.getTokenBefore(a);[l]=s.getRange(e)}return[l,u]}(t,r),o=t.parent;if(0===o.arguments.indexOf(t)&&o.arguments.length>1&&r$(r,n)){let{sourceCode:o}=r,a=e9(t,r).at(-1)||t,[,i]=o.getRange(a),s=o.getTokenAfter(a),[l,u]=o.getRange(s),p=o.text.slice(...n),c=p.slice(i-n[0],l-n[0])+p.slice(u-n[0]);return e.replaceTextRange(n,c)}return e.removeRange(n)}function ak(e,t,r,n){return e.replaceTextRange(e5(t,n),r)}function aI(e,t,r,n){let o=e4(r,n);return("MemberExpression"===t.parent.type&&t.parent.object===t?!oZ(r,n):ox(r))||e7(r,n)||(o=`(${o})`),o.startsWith("{")&&(o=`(${o})`),oD(n.sourceCode.getTokenBefore(t),n,o)&&(o=`;${o}`),e.replaceText(t,o)}function*aj(e,t,r){if("ReturnStatement"!==t.type&&"ThrowStatement"!==t.type)return;let{sourceCode:n}=r,o=n.getFirstToken(t);yield e.insertTextAfter(o," (");let a=n.getLastToken(t);eE(a)?yield e.insertTextBefore(a,")"):yield e.insertTextAfter(t,")")}function aF(e,t,r){let n="object"==typeof e?t.sourceCode.getRange(e)[1]:e,[o]=t.sourceCode.text.slice(n).match(/^\s*/);return r.removeRange([n,n+o.length])}function*aB(e,t,r){let n=t.sourceCode.getFirstToken(e);yield r.remove(n),yield aF(n,t,r),rh(e,t)||(yield r.insertTextAfter(e,"()")),op(n,e.callee,t)||e7(e,t)||(yield aj(r,e.parent,t))}let aR=({type:e,value:t})=>"Keyword"===e&&/^[a-z]*$/.test(t)||"Identifier"===e&&"of"===t||"Identifier"===e&&"await"===t;function*aP(e,t,r){let{sourceCode:n}=r,o=e5(t,r),a=n.getTokenBefore({range:o},{includeComments:!0});a&&o[0]===n.getRange(a)[1]&&aR(a)&&(yield e.insertTextAfter(a," "));let i=n.getTokenAfter({range:o},{includeComments:!0});i&&o[1]===n.getRange(i)[0]&&aR(i)&&(yield e.insertTextBefore(i," "))}function*aL(e,t,r){var n;yield aP(r,e,t),yield r.insertTextBefore(e,"new ");let{callee:o}=e;!e7(o,t)&&"MemberExpression"===(n=o).type&&function(e){let t=e.object,r=e.object.type;for(;"MemberExpression"===r;)r=(t=t.object).type;return"CallExpression"===r}(n)&&(yield r.insertTextBefore(o,"("),yield r.insertTextAfter(o,")"))}function aN(e,t,r,n){let[,o]=e5(t.object,r),[,a]=r.sourceCode.getRange(t);return e.replaceTextRange([o,a],n)}let a$=(e,t,r)=>aN(e,t,r,"");function*aM(e,t,r){let n=t.callee;yield a$(e,n,r);let[,o]=e5(n,r),[,a]=r.sourceCode.getRange(t);yield e.removeRange([o,a])}function aO(e,t,r,n=!1){let{sourceCode:o}=t,{lines:a}=o,i=e;if(n){let[t,r]=o.getLastTokens(e,2);eE(r)&&(i=t)}let s=o.getLoc(e).start,l=o.getLoc(i).end,u=a[s.line-1].slice(0,s.column),p=a[l.line-1].slice(l.column),[c]=o.getRange(e),[,d]=o.getRange(i);if(/^\s*$/.test(u)&&/^\s*$/.test(p))if(d+=p.length,0===c){let{text:e}=o;"\r"===e[d]&&"\n"===e[d+1]?d+=2:("\n"===e[d]||"\r"===e[d])&&d++}else c=Math.max(0,c-u.length-1);return r.removeRange([c,d])}function aU(e,t,r,n){if(ob(e)||"AssignmentPattern"===e.parent.type&&e.parent.left===e&&ob(e.parent))return n.replaceText(e,`${e.name}: ${t}`);if(oy(e,r))return n.replaceText(e,`${e.name} as ${t}`);if(((e,t)=>{let{type:r,local:n,exported:o}=e.parent;return"ExportSpecifier"===r&&og(n,o,t)&&n===e})(e,r))return n.replaceText(e,`${t} as ${e.name}`);if(e.typeAnnotation){let{sourceCode:o}=r;return o.getCommentsInside(e).length>0?n.replaceText(o.getFirstToken(e),t):n.replaceTextRange([o.getRange(e)[0],o.getRange(e.typeAnnotation)[0]],`${t}${e.optional?"?":""}`)}return n.replaceText(e,t)}let aq=(e,t,r,n)=>rJ(e).map(e=>aU(e,t,r,n)),aV=(e,t,r,n)=>{let{tail:o}=e,[a,i]=r.sourceCode.getRange(e);return n.replaceTextRange([a+1,i-(o?1:2)],t)};function*aW(e,t,r,n,o){for(let t of e9(e,o?{sourceCode:o}:n))yield aW(t,"",r,n,o);let{sourceCode:a}=n,[i,s]=a.getRange(e),[l]=a.text.slice(0,i).match(/\s*$/),[u]=l.match(/(?:\r?\n|\r)?/);i-=l.length,yield r.replaceTextRange([i,s],`${u}${t}`)}let a_="require-array-join-separator",az="no-thenable-object",aK="no-thenable-export",aG="no-thenable-class",aJ=(e,t)=>e$(e,t.sourceCode.getScope(e))?.value==="then",aX=(e,t)=>{let r="MemberExpression"===e.type?e.property:e.key;return"Literal"===r.type?"then"===r.value:e.computed||"Identifier"!==r.type?"then"===eO(e,t.sourceCode.getScope(e)):"then"===r.name},aY=[{selector:"ObjectExpression",*getNodes(e,t){for(let r of e.properties)"Property"===r.type&&aX(r,t)&&(yield r.key)},messageId:az},{selectors:["PropertyDefinition","MethodDefinition"],*getNodes(e,t){aX(e,t)&&(yield e.key)},messageId:aG},{selector:"MemberExpression",*getNodes(e,t){"AssignmentExpression"===e.parent.type&&e.parent.left===e&&aX(e,t)&&(yield e.property)},messageId:az},{selector:"CallExpression",*getNodes(e,t){if(!tw(e,{objects:["Object","Reflect"],method:"defineProperty",minimumArguments:3,optionalCall:!1,optionalMember:!1})||"SpreadElement"===e.arguments[0].type)return;let[,r]=e.arguments;aJ(r,t)&&(yield r)},messageId:az},{selector:"CallExpression",*getNodes(e,t){if(tw(e,{object:"Object",method:"fromEntries",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&"ArrayExpression"===e.arguments[0].type)for(let r of e.arguments[0].elements){if(!(r?.type==="ArrayExpression"&&r.elements[0])||"SpreadElement"===r.elements[0].type)continue;let[e]=r.elements;aJ(e,t)&&(yield e)}},messageId:az},{selector:"Identifier",*getNodes(e){"then"===e.name&&"ExportSpecifier"===e.parent.type&&e.parent.exported===e&&(yield e)},messageId:aK},{selector:"Identifier",*getNodes(e){"then"===e.name&&("FunctionDeclaration"===e.parent.type||"ClassDeclaration"===e.parent.type)&&e.parent.id===e&&"ExportNamedDeclaration"===e.parent.parent.type&&e.parent.parent.declaration===e.parent&&(yield e)},messageId:aK},{selector:"VariableDeclaration",*getNodes(e,t){if("ExportNamedDeclaration"===e.parent.type&&e.parent.declaration===e)for(let r of t.sourceCode.getDeclaredVariables(e))"then"===r.name&&(yield*r.identifiers)},messageId:aK}],aH="no-invalid-remove-event-listener",aQ="consistent-function-scoping",aZ=(e,t)=>e&&t&&(e===t||e.block===t.block),a0=(e,t)=>e.some(e=>aZ(e,t)),a1=["useState","useEffect","useContext","useReducer","useCallback","useMemo","useRef","useImperativeHandle","useLayoutEffect","useDebugValue"].flatMap(e=>[e,`React.${e}`]),a2=new i(["DoWhileStatement","ForInStatement","ForOfStatement","ForStatement","WhileStatement"]),a3=e=>e?.type==="BlockStatement"&&a2.has(e.parent.type)&&e.parent.body===e,a8=new i(["FunctionExpression","ArrowFunctionExpression"]),a6={create:e=>{let{checkArrowFunctions:t}=e.options[0],{sourceCode:r}=e,{scopeManager:n}=r;e.onExit(tE,e=>{if(("ArrowFunctionExpression"!==e.type||t)&&!function(e,t,r){let n,o,a,i=t.acquire(e);if(!i||(o=r.visitorKeys,"ArrowFunctionExpression"===e.type&&ou(e,o))||function(e){let t=e;for(;t.parent;){let{parent:e}=t;if("CallExpression"===e.type&&e.arguments[1]===t&&tE.includes(t.type)&&tB(e.callee,["jest.mock"]))return!0;t=e}return!1}(e))return!0;let s=e.parent;"VariableDeclarator"===s.type&&(s=s.parent),"VariableDeclaration"===s.type&&(s=s.parent),s?.type==="ReturnStatement"&&"ArrowFunctionExpression"===e.type&&(s=s.parent),s=function(e,t){if("ArrowFunctionExpression"===e.type&&"ArrowFunctionExpression"===t.type){let t=function(e){let t=e;for(;t&&"ArrowFunctionExpression"===t.type;)t=t.parent;return t}(e);t&&"ReturnStatement"===t.type&&"ReturnStatement"===(e=function(e){let t=e;for(;"ArrowFunctionExpression"===t.type;)t=t.parent;return t}(e)).type&&(e=e.parent)}return e}(s,e),s?.type==="BlockStatement"&&(n=s,s=s.parent);let l=t.acquire(s),u=function(e,t,r){let n=[];e&&n.push(e);let o=function(e){let t=[];for(;e?.type==="BlockStatement";){if(t.push(e),a3(e))return t;e=e.parent}return[]}(t);if(0===o.length)return n;let a=o.at(-1),i=r.acquire(a.parent);for(let e of(i&&n.push(i),o)){let t=r.acquire(e);t&&n.push(t)}return n}(l,n,t);return!!(0===u.length||u.some(e=>"global"===e.type)||l&&l.block?.parent?.callee&&tB(l.block.parent.callee,a1)||l&&(a=s,a8.has(a.type)&&"CallExpression"===a.parent.type&&a.parent.callee===a))||rc(i).map(({resolved:e})=>e).filter(Boolean).some(e=>e.references.some(e=>{if(a0(u,e.from))return!0;let{resolved:t}=e,[r]=t.defs;return(r?.type!=="FunctionName"||t.name!==r.name.name)&&a0(u,t.scope)})||e.defs.some(e=>a0(u,t.acquire(e.node)))||e.identifiers.some(e=>{if(!e.parent||"FunctionDeclaration"!==e.parent.type||t.acquire(e))return!1;let r=t.acquire(e.parent);return!(!r||aZ(i,r))&&a0(u,r.upper)}))}(e,n,r))return{node:e,loc:ew(e,r),messageId:aQ,data:{functionNameWithKind:eU(e,r)}}})},meta:{type:"suggestion",docs:{description:"Move function definitions to the highest possible scope.",recommended:!0},schema:[{type:"object",additionalProperties:!1,properties:{checkArrowFunctions:{type:"boolean",description:"Whether to check arrow functions."}}}],defaultOptions:[{checkArrowFunctions:!0}],messages:{[aQ]:"Move {{functionNameWithKind}} to the outer scope."},languages:["js/js"]}},a9="error",a5="error-unknown",a4="suggestion";function a7(e,t,r){return function*(n){yield n.insertTextAfter(e.callee,`.${r}`),yield aB(e,t,n)}}let ie="no-console-spaces",it=e=>e.length>1&&" "===e.charAt(0)&&" "!==e.charAt(1),ir=e=>e.length>1&&" "===e.at(-1)&&" "!==e.at(-2),io="no-empty-file",ia={create:e=>{let{allowComments:t}=e.options[0];e.filename===e.physicalFilename&&(e.on("Program",r=>{if(r.templateBody)return;if(1===r.body.length&&"Document"===r.body[0].type){let{children:e}=r.body[0];if(e.some(e=>"Comment"!==e.type&&("Text"!==e.type||""!==e.value.trim()))||t&&e.some(e=>"Comment"===e.type))return;return{node:r,messageId:io}}if(r.body.some(e=>!ty(e,tg)))return;let{sourceCode:n}=e,o=rB(e);if(0!==n.ast.tokens.length||0!==o.length||""===n.text.trim()){if(!o.some(e=>"Line"===e.type&&e.value.startsWith("/"))&&(!(t&&o.length>0&&o.every(e=>"Line"===e.type||"Block"===e.type))||0!==n.ast.tokens.length))return{node:r,messageId:io}}}),e.on("StyleSheet",r=>{if(r.children.length>0)return;let n=rB(e);if(!t||!(n.length>0))return{node:r,messageId:io}}),e.on("Document",r=>{if(r.parent?.type==="Program"||null!==r.body&&void 0!==r.body)return;let n=rB(e);if(!t||!(n.length>0))return{node:r,messageId:io}}),e.on("root",e=>{if(!e.children.some(e=>!("html"===e.type&&/^<!--(?:(?!-->)[\s\S])*-->$/.test(e.value.trim())))&&(!t||!(e.children.length>0)))return{node:e,messageId:io}}))},meta:{type:"suggestion",docs:{description:"Disallow empty files.",recommended:"unopinionated"},schema:[{type:"object",additionalProperties:!1,properties:{allowComments:{type:"boolean",description:"Whether to allow files that only contain comments."}}}],defaultOptions:[{allowComments:!1}],messages:{[io]:"Empty files are not allowed."},languages:["js/js","css/css","html/html","json/json","json/jsonc","json/json5","markdown/commonmark","markdown/gfm"]}},ii="no-useless-fallback-in-spread";function is(e){return"AwaitExpression"===e.parent.type&&e.parent.argument===e?{expression:e.parent,parent:e.parent.parent,isAwaited:!0}:{expression:e,parent:e.parent,isAwaited:!1}}function il(e,t){let r=e?t.sourceCode.getText(e):"";return e?.type==="SequenceExpression"?`(${r})`:r}let iu="zero-fraction",ip="dangling-dot",ic="error",id="suggestion",im=Symbol.for("default"),ig=Symbol("NAMESPACE_SPECIFIER_NAME"),iy=e=>{switch(e.type){case"Identifier":return Symbol.for(e.name);case"Literal":return e.value}},ih=e=>"type"===e.exportKind||"type"===e.parent.exportKind;function*ix(e,t,r){switch(e.type){case"ImportSpecifier":case"ExportSpecifier":case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":return void(yield function*(e,t,r,n=!1){let o=e.parent,{specifiers:a}=o;if(1===a.length&&!n)return void(yield t.remove(o));let{sourceCode:i}=r;switch(e.type){case"ImportSpecifier":if(a.every(t=>e===t||e.type!==t.type)){let r=i.getTokenAfter(e,e=>"Identifier"===e.type&&"from"===e.value),n=a.some(e=>"ImportDefaultSpecifier"===e.type),o=i.getTokenBefore(e,n?eb:eS),[s]=i.getRange(o),[l]=i.getRange(r),u=i.getTokenBefore(o),p=i.getRange(u)[1]===s;yield t.replaceTextRange([s,l],p?" ":"");return}case"ExportSpecifier":case"ImportNamespaceSpecifier":case"ImportDefaultSpecifier":{yield t.remove(e);let r=i.getTokenAfter(e);eb(r)&&(yield t.remove(r))}}}(e,t,r));case"ImportDeclaration":case"ExportDefaultDeclaration":case"ExportNamedDeclaration":yield t.remove(e)}}function ib(e,t){let{sourceCode:r}=t,n=r.getTokenBefore(e.source,e=>"Identifier"===e.type&&"from"===e.value),[o]=r.getRange(n),[,a]=r.getRange(e);return r.text.slice(o,a)}let iE={create:function(e){let{sourceCode:t}=e,{checkUsedVariables:r}=e.options[0],n=new i,o=[];e.on("ImportDeclaration",e=>{e.specifiers.length>0&&n.add(e)}),e.on("ExportNamedDeclaration",e=>{tt(e.source)&&o.push(e)}),e.on("Program:exit",function*(a){for(let i of n){let n=t.getDeclaredVariables(i);if(n.some(e=>1!==e.defs.length||e.defs[0].parent!==i)||(n=n.map(e=>{let r=function(e,t){let r=e.defs[0].node,n={node:r,declaration:r.parent,variable:e,isTypeImport:oS(r)};switch(r.type){case"ImportDefaultSpecifier":return{name:im,text:"default",...n};case"ImportSpecifier":return{name:iy(r.imported),text:t.getText(r.imported),...n};case"ImportNamespaceSpecifier":return{name:ig,text:"*",...n}}}(e,t),n=function(e,t){let r=[];for(let{identifier:n}of e.variable.references){let o=function(e,t){let{parent:r}=e;switch(r.type){case"ExportDefaultDeclaration":return{node:r,name:im,text:"default",isTypeExport:ih(r)};case"ExportSpecifier":return{node:r,name:iy(r.exported),text:t.getText(r.exported),isTypeExport:ih(r)};case"VariableDeclarator":{let n=r.parent.parent;if(r.init===e&&"Identifier"===r.id.type&&!r.id.typeAnnotation&&"VariableDeclaration"===r.parent.type&&"const"===r.parent.kind&&1===r.parent.declarations.length&&r.parent.declarations[0]===r&&"ExportNamedDeclaration"===n.type&&function(e,t){let r=t.getDeclaredVariables(e);if(1!==r.length)return!1;let[{identifiers:n,references:o}]=r;return 1===n.length&&n[0]===e.id&&1===o.length&&o[0].identifier===e.id}(r,t))return{node:n,name:Symbol.for(r.id.name),text:t.getText(r.id),isJSDocumentComment:function(e,t){let r=t.getTokenBefore(e,{includeComments:!0});if(r?.type!=="Block"||!r.value.startsWith("*")||r.value.startsWith("**"))return!1;let n=t.getTokenBefore(r),o=t.getLoc(r).start,a=t.getLoc(r).end,i=t.getLoc(e).start;return(!n||t.getLoc(n).end.line<o.line)&&(a.line===i.line||a.line===i.line-1)}(n,t)}}}}(n,t);o&&(e.name!==ig||o.name!==im)&&r.push(o)}return r}(r,t);return{variable:e,imported:r,exports:n}}),!r&&n.some(({variable:e,exports:t})=>e.references.length!==t.length)))continue;let s=!r&&n.some(({variable:e})=>0===e.references.length);for(let{imported:t,exports:r}of n)for(let n of function*(e){for(let t of e)t.isJSDocumentComment||(yield t)}(r)){let r={node:n.node,messageId:ic,data:{exported:n.text}},i=function({context:e,imported:t,exported:r,exportDeclarations:n,program:o}){let a,i=t.declaration,s=i.source.value,l=t.isTypeImport||r.isTypeExport;return l&&(a=n.find(({source:e,exportKind:t})=>"type"===t&&e.value===s)),a||=n.find(({source:e,exportKind:t})=>"type"!==t&&e.value===s),function*(n){if(t.name===ig)yield n.insertTextAfter(o,`
|
|
28
|
+
export ${l?"type ":""}* as ${r.text} ${ib(i,e)}`);else{let s=r.name===t.name?r.text:`${t.text} as ${r.text}`;if(l&&(!a||"type"!==a.exportKind)&&(s=`type ${s}`),a){let t=a.specifiers.at(-1);if(t)yield n.insertTextAfter(t,`, ${s}`);else{let t=e.sourceCode.getFirstToken(a,eS);yield n.insertTextAfter(t,s)}}else yield n.insertTextAfter(o,`
|
|
29
|
+
export {${s}} ${ib(i,e)}`)}let s=r.isTypeExport&&!t.isTypeImport;1!==t.variable.references.length||s||(yield ix(t.node,n,e)),yield ix(r.node,n,e)}}({context:e,imported:t,exported:n,exportDeclarations:o,program:a});s?r.suggest=[{messageId:id,fix:i}]:r.fix=i,yield r}}})},meta:{type:"suggestion",docs:{description:"Prefer `export…from` when re-exporting.",recommended:!0},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,properties:{checkUsedVariables:{type:"boolean",description:"Whether to check variables that are used in the module."}}}],defaultOptions:[{checkUsedVariables:!0}],messages:{[ic]:"Use `export…from` to re-export `{{exported}}`.",[id]:"Switch to `export…from`."},languages:["js/js"]}},iv="prefer-native-coercion-functions",iC=new i(["String","Number","BigInt","Boolean","Symbol"]),iD=new i(["every","filter","find","findLast","findIndex","findLastIndex","some"]),iS=(e,t)=>e?.type==="CallExpression"&&!e.optional&&"Identifier"===e.callee.type&&iC.has(e.callee.name)&&e.arguments[0]?.type==="Identifier"&&e.arguments[0].name===t,iT=(e,t)=>{let r={[t]:!0};for(let t of e.split(".").toReversed())r={[t]:r};return r},iA=(e,t)=>{for(let r of Reflect.ownKeys(t)){let n=t[r];"object"==typeof n?(e[r]??={},iA(e[r],n)):e[r]=n}};class iw{static READ=e1.READ;static CALL=e1.CALL;static CONSTRUCT=e1.CONSTRUCT;#n={};#e;#o;#a;constructor({object:e,objects:t=[e],type:r=e1.READ,context:n,filter:o,handle:a}){for(let e of t)iA(this.#n,iT(e,r));this.#e=n,this.#o=o,this.#a=a}*#i(e,t){let r=t?.context??this.#e,n=t?.filter??this.#o,o=t?.handle??this.#a;for(let t of new e1(e).iterateGlobalReferences(this.#n)){if(n&&!n(t))continue;let e=o(t,r);yield e}}listen(e){let t=e?.context??this.#e;t.onExit("Program",r=>this.#i(t.sourceCode.getScope(r),e))}}let ik="no-document-cookie",iI=new iw({object:"document.cookie",filter:({node:e})=>"AssignmentExpression"===e.parent.type&&e.parent.left===e,handle:({node:e})=>({node:e,messageId:ik})}),ij=e=>[`webkit${e}`,`o${e.toLowerCase()}`,e.toLowerCase()],iF=new i(["click","rightclick","dblclick","auxclick","mousedown","mouseup","mouseover","mouseout","mousemove","mouseenter","mouseleave","mousecancel","selectionchange","selectstart","wheel","keypress","keydown","keyup","blur","focus","deactivate","focusin","focusout","change","reset","select","submit","input","propertychange","dragstart","drag","dragenter","dragover","dragleave","drop","dragend","touchstart","touchmove","touchend","touchcancel","beforeunload","consolemessage","contextmenu","devicechange","devicemotion","deviceorientation","DOMContentLoaded","error","help","load","losecapture","orientationchange","readystatechange","resize","scroll","unload","canplay","canplaythrough","durationchange","emptied","ended","loadeddata","loadedmetadata","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","sourceopen","sourceended","sourceclosed","abort","update","updatestart","updateend","hashchange","pagehide","pageshow","popstate","copy","paste","cut","beforecopy","beforecut","beforepaste","online","offline","message","connect","install","activate","fetch","foreignfetch","messageerror","statechange","updatefound","controllerchange",...ij("AnimationStart"),...ij("AnimationEnd"),...ij("AnimationIteration"),...ij("TransitionEnd"),"pointerdown","pointerup","pointercancel","pointermove","pointerover","pointerout","pointerenter","pointerleave","gotpointercapture","lostpointercapture","MSGestureChange","MSGestureEnd","MSGestureHold","MSGestureStart","MSGestureTap","MSGotPointerCapture","MSInertiaStart","MSLostPointerCapture","MSPointerCancel","MSPointerDown","MSPointerEnter","MSPointerHover","MSPointerLeave","MSPointerMove","MSPointerOut","MSPointerOver","MSPointerUp","text","textinput","textInput","compositionstart","compositionupdate","compositionend","beforeinput","exit","loadabort","loadcommit","loadredirect","loadstart","loadstop","responsive","sizechanged","unresponsive","visibilitychange","storage","DOMSubtreeModified","DOMNodeInserted","DOMNodeRemoved","DOMNodeRemovedFromDocument","DOMNodeInsertedIntoDocument","DOMAttrModified","DOMCharacterDataModified","beforeprint","afterprint","beforeinstallprompt","appinstalled","afterblur","beforeblur","cancel","close","dragexit","encrypted","fullscreenchange","invalid","toggle","search","open","show"]),iB="prefer-add-event-listener",iR={create:e=>{let t,r,n=new i(e.options[0].excludedPackages),o=new s;e.on("onCodePathStart",(e,t)=>{r={node:t,upper:r,returnsSomething:!1}}),e.on("onCodePathEnd",()=>{o.set(r.node,r.returnsSomething),r=r.upper}),e.on("CallExpression",e=>{tj(e)&&!t&&n.has(e.arguments[0].value)&&(t=!0)}),e.on("Literal",e=>{"ImportDeclaration"===e.parent.type&&!t&&n.has(e.value)&&(t=!0)}),e.on("ReturnStatement",e=>{r.returnsSomething||=!!e.argument}),e.on("AssignmentExpression:exit",r=>{let n;if(t)return;let{left:a,right:i,operator:s}=r;if("MemberExpression"!==a.type||a.computed)return;let l=a.property.name;if(!l||!l.startsWith("on"))return;let u=l.slice(2);if(!iF.has(u))return;let p="addEventListener",c="";if(tP(i)||ti(i))p="removeEventListener";else"beforeunload"===u&&("ArrowFunctionExpression"!==i.type&&"FunctionExpression"!==i.type||"BlockStatement"!==i.body.type||o.get(i))?c="Use `event.preventDefault(); event.returnValue = 'foo'` to trigger the prompt.":"message"===u?c="Note that there is difference between `SharedWorker#onmessage` and `SharedWorker#addEventListener('message')`.":"error"===u?c="Note that there is difference between `{window,element}.onerror` and `{window,element}.addEventListener('error')`.":"="!==s||"ExpressionStatement"!==r.parent.type||r.parent.expression!==r||ol(i)||(n=t=>((e,t,r,n)=>{let{sourceCode:o}=t,a=n.property.name.slice(2),i=o.getText(n.object);e7(n.object,t)&&(i=`(${i})`);let s=o.getText(r.right);e7(r.right,t)&&(s=`(${s})`);let l=`${i}.addEventListener('${a}', ${s})`;return e.replaceText(r,l)})(t,e,r,a));return{node:a.property,messageId:iB,data:{replacement:p,method:l,extra:c?` ${c}`:""},fix:n}})},meta:{type:"suggestion",docs:{description:"Prefer `.addEventListener()` and `.removeEventListener()` over `on`-functions.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{excludedPackages:{type:"array",items:{type:"string"},uniqueItems:!0,description:"Packages to exclude from checking."}}}],defaultOptions:[{excludedPackages:["koa","sax"]}],messages:{[iB]:"Prefer `{{replacement}}` over `{{method}}`.{{extra}}"},languages:["js/js"]}},iP=new i(["false","true"]),iL=(e,t)=>"BinaryExpression"===e.type&&"==="===e.operator&&(om(e.left,t)||om(e.right,t)),iN=({type:e,name:t},r)=>"Identifier"===e&&t===r;function i$({method:e,replacement:t,checkBooleanPredicate:r=!1}){let n=`prefer-${t}-over-${e}/`,o=`${n}error`,a=`${n}suggestion`;return{messages:{[o]:({findIndex:"Use `.indexOf()` instead of `.findIndex()` when looking for the index of an item.",findLastIndex:"Use `.lastIndexOf()` instead of `.findLastIndex() when looking for the index of an item.`",some:`Use \`.${t}()\` instead of \`.${e}()\` when checking value existence.`})[e],[a]:`Replace \`.${e}()\` with \`.${t}()\`.`},listen:function(n){let{sourceCode:i}=n,{scopeManager:s}=i;n.on("CallExpression",r=>{let l,u,p;if(!tw(r,{method:e,argumentsLength:1,optionalCall:!1})||!("ArrowFunctionExpression"===(p=r.arguments[0]).type&&!p.async&&1===p.params.length&&iL(p.body,p.params[0])||("ArrowFunctionExpression"===p.type||"FunctionExpression"===p.type)&&!p.async&&!p.generator&&1===p.params.length&&"BlockStatement"===p.body.type&&1===p.body.body.length&&"ReturnStatement"===p.body.body[0].type&&iL(p.body.body[0].argument,p.params[0]))||nD(r.callee.object,n))return;let[c]=r.arguments,d="BinaryExpression"===c.body.type?c.body:c.body.body[0].argument,[m]=c.params,{left:f,right:g}=d,{name:y}=m;if(iN(f,y))l=g,u=f;else{if(!iN(g,y))return;l=f,u=g}let h=s.acquire(c);if(!h||ey(h,m).references.some(({identifier:e})=>e!==u)||rQ(c,h))return;let x=r.callee.property,b={node:x,messageId:o,suggest:[]},E=function*(e){let r=i.getText(l);e7(l,n)&&!e7(c,n)&&(r=`(${r})`),yield e.replaceText(x,t),yield e.replaceText(c,r)};return ez(l,i)?b.suggest.push({messageId:a,fix:E}):b.fix=E,b}),r&&i.parserServices?.program&&n.on("CallExpression",r=>{if(!tw(r,{method:e,argumentsLength:1,optionalCall:!1}))return;let[n]=r.arguments;if("ArrowFunctionExpression"!==n.type&&"FunctionExpression"!==n.type||1!==n.params.length||"Identifier"!==n.params[0].type)return;let[a]=n.params,{parserServices:l}=i,u=function(e,t){let r="ArrowFunctionExpression"!==e.type||e.async||1!==e.params.length||"BlockStatement"===e.body.type?"ArrowFunctionExpression"!==e.type&&"FunctionExpression"!==e.type||e.async||e.generator||1!==e.params.length||"BlockStatement"!==e.body.type||1!==e.body.body.length||"ReturnStatement"!==e.body.body[0].type?void 0:e.body.body[0].argument:e.body;if(r){if(om(r,t))return r;if("CallExpression"===r.type&&!r.optional&&iN(r.callee,"Boolean")&&1===r.arguments.length&&om(r.arguments[0],t))return r.arguments[0]}}(n,a);if(!u||!function(e){if("boolean"===e.intrinsicName||"true"===e.intrinsicName)return!0;if(!e.isUnion())return!1;let t=e.types.map(e=>e.intrinsicName);return t.includes("true")&&t.every(e=>iP.has(e))}(l.getTypeAtLocation(a))||!function(e,t){if(e.isUnion())return!1;let r=t.program.getTypeChecker();return!!e.getProperty("includes")&&(r.isArrayType(e)||r.isTupleType(e))}(l.getTypeAtLocation(r.callee.object),l))return;let p=s.acquire(n);if(!p||ey(p,a).references.some(({identifier:e})=>e!==u)||rQ(n,p))return;let c=r.callee.property;return{node:c,messageId:o,*fix(e,{abort:r}){i.getCommentsInside(n).length>0&&r(),yield e.replaceText(c,t),yield e.replaceText(n,"true")}}})}}}let iM=i$({method:"findIndex",replacement:"indexOf"}),iO=i$({method:"findLastIndex",replacement:"lastIndexOf"}),iU={create(e){iM.listen(e),iO.listen(e)},meta:{type:"suggestion",docs:{description:"Prefer `Array#{indexOf,lastIndexOf}()` over `Array#{findIndex,findLastIndex}()` when looking for the index of an item.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{...iM.messages,...iO.messages},languages:["js/js"]}},iq="error",iV="prefer-date",iW="prefer-date-now-over-methods",i_="prefer-date-now-over-number-data-object",iz=e=>tf(e,{name:"Date",argumentsLength:0}),iK=(e,t,r)=>({node:e,messageId:iV,*fix(t){yield t.replaceText(e,"Date.now()"),"UnaryExpression"===e.type&&(yield aP(t,e,r))},...t}),iG="prefer-dataset",iJ="prefer-attributes",iX=e=>`data-${e.replaceAll(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`,iY=e=>tT(e,{property:"dataset"}),iH=e=>e.computed||"Identifier"!==e.property.type?e.computed&&tt(e.property)?e.property.value:void 0:e.property.name,iQ=new i(["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf","__proto__","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"]),iZ=/[\s\u0000-\u001F"'/<=>]/,i0=e=>iQ.has(e)||e.includes("-")||iZ.test(e);function i1(e,t){let r=e4(e,t);return!e7(e,t.sourceCode)&&oZ(e,t)?`(${r})`:r}let i2={create:e=>{let{preferAttributes:t}=e.options[0];if(t){let{sourceCode:t}=e,r=(r,n,o)=>{if(i0(n.value)||nR(o.object,e))return;let a=i1(o.object,e),i=o.optional?"?.":".",s=tK(iX(n.value),n.raw.charAt(0)),l=rL(e,r,[o.object])?void 0:n=>{let o=`${a}${i}hasAttribute(${s})`;return oD(t.getTokenBefore(r),e,o)&&(o=`;${o}`),n.replaceText(r,o)};return{node:r,messageId:iJ,data:{method:"hasAttribute"},fix:l}};e.on("BinaryExpression",e=>{if("in"===e.operator&&tt(e.left)&&iY(e.right))return r(e,e.left,e.right)}),e.on("CallExpression",e=>tw(e,{object:"Object",method:"hasOwn",argumentsLength:2,optionalCall:!1,optionalMember:!1})&&iY(e.arguments[0])&&tt(e.arguments[1])?r(e,e.arguments[1],e.arguments[0]):tw(e,{method:"hasOwnProperty",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&iY(e.callee.object)&&tt(e.arguments[0])?r(e,e.arguments[0],e.callee.object):void 0),e.on("VariableDeclarator",t=>{let r;if(!(t.init&&iY(t.init)&&("ObjectPattern"===t.id.type||"Identifier"===t.id.type))||nR(t.init.object,e))return;let n=t.init;if("Identifier"===t.id.type)return{node:n,messageId:iJ,data:{method:"getAttribute"},fix:function(e,t){let{sourceCode:r}=t,n=e.init,o=e.parent,[a]=r.getDeclaredVariables(e);if(!a)return;let i=function(e){let t=[];for(let r of e.references){if(r.init)continue;let{identifier:e}=r,n=e.parent;if("MemberExpression"!==n.type||n.object!==e||n.optional)return;let o=iH(n);if(void 0===o||i0(o))return;let{parent:a}=n;if(nL(n)||"CallExpression"===a.type&&a.callee===n||"TaggedTemplateExpression"===a.type&&a.tag===n)return;t.push(n)}return t}(a);if(!(i&&i.length>0&&"const"===o.kind&&1===o.declarations.length&&!o.parent.type.startsWith("For")&&"ExportNamedDeclaration"!==o.parent.type&&"Identifier"===n.object.type&&function(e,t,r){let{sourceCode:n}=r,{name:o}=e.object,a=e=>ey(n.getScope(e),o),i=a(e.object),s=t.some(e=>a(e)!==i),l=!!i?.references.some(e=>e.isWrite()&&!e.init);return!s&&!l}(n,i,t)&&!rL(t,o)&&i.every(e=>!rL(t,e))))return;let s=i1(n.object,t);return function*(e){for(let r of(yield aO(o,t,e),i)){let t=r.computed?r.property.raw.charAt(0):void 0,n=tK(iX(iH(r)),t);yield e.replaceText(r,`${s}.getAttribute(${n})`)}}}(t,e)};let{properties:o}=t.id;if(o.some(e=>"Property"===e.type&&(e.computed||"Identifier"!==e.key.type?!tt(e.key)||i0(e.key.value):i0(e.key.name))))return;let a=t.parent,i=i1(n.object,e),s=n.optional?"?.":".";if(o.length>0&&1===a.declarations.length&&!a.parent.type.startsWith("For")&&"ExportNamedDeclaration"!==a.parent.type&&!rL(e,a,[n.object])&&o.every(e=>"Property"===e.type&&!e.computed&&"Identifier"===e.key.type&&"Identifier"===e.value.type)&&(1===o.length||"Identifier"===n.object.type)){let t=rw(a,e),n=o.map(e=>{let t=tK(iX(e.key.name),"'");return`${a.kind} ${e.value.name} = ${i}${s}getAttribute(${t})`});r=e=>e.replaceText(a,`${n.join(`;
|
|
30
|
+
${t}`)};`)}return{node:n,messageId:iJ,data:{method:"getAttribute"},fix:r}}),e.on("MemberExpression",r=>{let n,{object:o}=r;if(!iY(o)||nR(o.object,e))return;let a=iH(r);if(void 0===a||i0(a)||r.optional)return;let i="ChainExpression"===r.parent.type?r.parent.parent:r.parent;if("CallExpression"===i.type&&i.callee===r||"TaggedTemplateExpression"===i.type&&i.tag===r||"UpdateExpression"===i.type||"AssignmentExpression"===i.type&&i.left===r&&"="!==i.operator)return;let s="AssignmentExpression"===i.type&&i.left===r,l="UnaryExpression"===i.type&&"delete"===i.operator;if(nL(r)&&!s&&!l)return;let u=i1(o.object,e),p=o.optional?"?.":".",c=r.computed?r.property.raw.charAt(0):void 0,d=tK(iX(a),c);return s&&oE(i)&&!rL(e,i,[o.object,i.right])?n=t=>t.replaceText(i,`${u}${p}setAttribute(${d}, ${e4(i.right,e)})`):l&&tb(i.parent)&&!rL(e,i,[o.object])?n=r=>{let n=`${u}${p}removeAttribute(${d})`;return oD(t.getTokenBefore(i),e,n)&&(n=`;${n}`),r.replaceText(i,n)}:s||l||rL(e,r,[o.object])||(n=e=>e.replaceText(r,`${u}${p}getAttribute(${d})`)),{node:r,messageId:iJ,data:{method:s?"setAttribute":l?"removeAttribute":"getAttribute"},fix:n}});return}e.on("CallExpression",t=>{if(!((tw(t,{method:"setAttribute",argumentsLength:2,optionalCall:!1,optionalMember:!1})||tw(t,{methods:["removeAttribute","hasAttribute"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||tw(t,{method:"getAttribute",argumentsLength:1,optionalCall:!1}))&&tt(t.arguments[0]))||nR(t.callee.object,e))return;let r=t.callee.property.name,n="ChainExpression"===t.parent.type?t.parent:t;if(("AwaitExpression"!==n.parent.type||n.parent.argument!==n||"getAttribute"!==r)&&t.arguments[0].value.toLowerCase().startsWith("data-"))return{node:t,messageId:iG,data:{method:r},fix:function(e,t){let r=e.callee.property.name;if("setAttribute"===r&&rY(e.callee)||"setAttribute"===r&&!oE(e)||"removeAttribute"===r&&!tb(e.parent))return;let n=[e.callee.object];if("setAttribute"===r&&n.push(e.arguments[1]),!rL(t,e,n))return n=>{let[o]=e.arguments,a=o.value.toLowerCase().slice(5).replaceAll(/-[a-z]/g,e=>e[1].toUpperCase()),i="",s=`${i1(e.callee.object,t)}${e.callee.optional?"?":""}.dataset`;switch(r){case"setAttribute":case"getAttribute":case"removeAttribute":i=rF(a)?`.${a}`:`[${tK(a,o.raw.charAt(0))}]`,i=`${s}${i}`,"setAttribute"===r?i+=` = ${e4(e.arguments[1],t)}`:"removeAttribute"===r&&(i=`delete ${i}`);break;case"hasAttribute":i=`Object.hasOwn(${s}, ${tK(a,o.raw.charAt(0))})`}return n.replaceText(e,i)}}(t,e)}})},meta:{type:"suggestion",docs:{description:"Enforce consistent style for DOM element dataset access.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{preferAttributes:{type:"boolean",description:"Prefer attribute methods over named `.dataset` access."}}}],defaultOptions:[{preferAttributes:!1}],messages:{[iG]:"Prefer `.dataset` over `{{method}}(…)`.",[iJ]:"Prefer `.{{method}}(…)` over `.dataset`."},languages:["js/js"]}},i3="prefer-modern-math-apis",i8=(e,t)=>"MemberExpression"===e.type&&!e.optional&&!e.computed&&"Identifier"===e.object.type&&"Math"===e.object.name&&"Identifier"===e.property.type&&e.property.name===t,i6=(e,t)=>"CallExpression"===e.type&&!e.optional&&i8(e.callee,t)&&1===e.arguments.length&&"SpreadElement"!==e.arguments[0].type;function i9({constantName:e,replacementMethod:t}){let r=`Math.${t}(…)`;return function(n,o){let a,i;if("BinaryExpression"!==n.type||"*"!==n.operator||(i6(n.left,"log")&&i8(n.right,e)?(a=n.left,i=`Math.log(…) * Math.${e}`):i6(n.right,"log")&&i8(n.left,e)&&(a=n.right,i=`Math.${e} * Math.log(…)`),!a))return;let[s]=a.arguments;return{node:n,messageId:i3,data:{replacement:r,description:i},fix:e=>e.replaceText(n,`Math.${t}(${e4(s,o)})`)}}}function i5({constantName:e,replacementMethod:t}){let r={messageId:i3,data:{replacement:`Math.${t}(…)`,description:`Math.log(…) / Math.${e}`}};return function(n,o){if(!("BinaryExpression"===n.type&&"/"===n.operator&&i6(n.left,"log")&&i8(n.right,e)))return;let[a]=n.left.arguments;return{...r,node:n,fix:e=>e.replaceText(n,`Math.${t}(${e4(a,o)})`)}}}let i4=[i9({constantName:"LOG10E",replacementMethod:"log10"}),i9({constantName:"LOG2E",replacementMethod:"log2"}),i5({constantName:"LN10",replacementMethod:"log10"}),i5({constantName:"LN2",replacementMethod:"log2"})],i7=e=>"BinaryExpression"===e.type&&"+"===e.operator?[e.left,e.right].flatMap(e=>i7(e)):[e],se="number-literal-case",st=(e,{hexadecimalValue:t})=>{let r=e.toLowerCase();return r.startsWith("0x")&&(r="0x"+r.slice(2)["lowercase"===t?"toLowerCase":"toUpperCase"]()),r},sr={create:oK(e=>{e.on("Literal",t=>{let{raw:r}=t,n=e.options[0]??{};n.hexadecimalValue??="uppercase";let o=r;if(to(t)?o=st(r,n):ts(t)&&(o=st(r.slice(0,-1),n)+"n"),r!==o)return{node:t,messageId:se,fix:e=>e.replaceText(t,o)}})}),meta:{type:"suggestion",docs:{description:"Enforce proper case for numeric literals.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{hexadecimalValue:{enum:["uppercase","lowercase"]}}}],defaultOptions:[{hexadecimalValue:"uppercase"}],messages:{[se]:"Invalid number literal casing."},languages:["js/js"]}},sn="error",so="suggestion",sa={parseInt:!0,parseFloat:!0,NaN:!0,Infinity:!0,isNaN:!1,isFinite:!1},si=e=>{let{parent:t}=e;return"UnaryExpression"===t.type&&"-"===t.operator&&t.argument===e};function ss(e,t){let{node:r,path:n}=e,[o]=n,{parent:a}=r,i=o;"Infinity"===o&&(i=si(r)?"NEGATIVE_INFINITY":"POSITIVE_INFINITY");let s={node:r,messageId:sn,data:{description:o,property:i}};if("NEGATIVE_INFINITY"===i)return s.node=a,s.data.description="-Infinity",s.fix=function*(e){yield e.replaceText(a,"Number.NEGATIVE_INFINITY"),yield aP(e,a,t)},s;let l=e=>aU(r,`Number.${i}`,t,e);return sa[o]||((e,t)=>{let{parent:r}=e;if("CallExpression"!==r.type||r.callee!==e||1!==r.arguments.length)return!1;let[n]=r.arguments;return"SpreadElement"!==n.type&&n_(n,t.sourceCode.getScope(e))})(r,t)?s.fix=l:s.suggest=[{messageId:so,fix:l}],s}let sl={create:e=>{let{checkInfinity:t,checkNaN:r}=e.options[0];new iw({objects:Object.keys(sa).filter(e=>(!!t||"Infinity"!==e)&&(r||"NaN"!==e)),context:e,handle:ss,filter(t){let{node:r,path:n}=t,[o]=n;return!nL(r)&&!("Infinity"===o&&(e=>{if(!si(e))return!1;let{parent:t}=e,{parent:r}=t;return"UnaryExpression"===r.type&&"delete"===r.operator&&r.argument===t})(r))&&!("parseInt"===o&&function(e,t){let{parent:r}=e;if("CallExpression"!==r.type||r.callee!==e)return!1;let n=r.arguments[1];return!n||"SpreadElement"!==n.type&&e$(n,t.sourceCode.getScope(n))?.value===10}(r,e))}}).listen()},meta:{type:"suggestion",docs:{description:"Prefer `Number` static methods over global functions and optionally static properties over global constants.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,properties:{checkInfinity:{type:"boolean",description:"Whether to check usage of the global `Infinity`."},checkNaN:{type:"boolean",description:"Whether to check usage of the global `NaN`."}}}],defaultOptions:[{checkInfinity:!1,checkNaN:!1}],messages:{[sn]:"Prefer `Number.{{property}}` over `{{description}}`.",[so]:"Replace `{{description}}` with `Number.{{property}}`."},languages:["js/js"]}},su="prefer-reflect-apply",sp=(e,t)=>(ti(e)||"ThisExpression"===e.type)&&("ArrayExpression"===t.type||"Identifier"===t.type&&"arguments"===t.name),sc=(e,t,r,n)=>`Reflect.apply(${e.getText(t)}, ${e.getText(r)}, ${e.getText(n)})`,sd="prefer-set-size";var sm={exports:{}},sf=o8(function(){var e,t,r,n;return p?sm.exports:(p=1,r=String.fromCodePoint||(e=String.fromCharCode,t=Math.floor,function(){var r,n,o=[],a=-1,i=arguments.length;if(!i)return"";for(var s="";++a<i;){var l=Number(arguments[a]);if(!isFinite(l)||l<0||l>1114111||t(l)!=l)throw RangeError("Invalid code point: "+l);l<=65535?o.push(l):(l-=65536,r=(l>>10)+55296,n=l%1024+56320,o.push(r,n)),(a+1==i||o.length>16384)&&(s+=e.apply(null,o),o.length=0)}return s}),n={parse:function(e,t,n){function o(t,r){return t.range[0]=r,t.raw=e.substring(r,t.range[1]),t}function a(t,r){return{type:"anchor",kind:t,range:[H-r,H],raw:e.substring(H-r,H)}}function i(t,r,n,o){return{type:"value",kind:t,codePoint:r,range:[n,o],raw:e.substring(n,o)}}function s(e,t,r,n){return n=n||0,i(e,t,H-(r.length+n),H)}function l(e){var t,r=e[0],n=r.charCodeAt(0);return Y&&1===r.length&&n>=55296&&n<=56319&&(t=h().charCodeAt(0))>=56320&&t<=57343?i("symbol",(n-55296)*1024+t-56320+65536,++H-2,H):i("symbol",n,H-1,H)}function u(t,r,n,o,a){return null==o&&(n=H-1,o=H),{type:"quantifier",min:t,max:r,greedy:!0,body:null,symbol:a,range:[n,o],raw:e.substring(n,o)}}function p(t,r,n,o){return{type:"characterClass",kind:t.kind,body:t.body,negative:r,range:[n,o],raw:e.substring(n,o)}}function c(t,r,n,o){return t.codePoint>r.codePoint&&W("invalid range in character class",t.raw+"-"+r.raw,n,o),{type:"characterClassRange",min:t,max:r,range:[n,o],raw:e.substring(n,o)}}function d(e){return"alternative"===e.type?e.body:[e]}function m(e){H+=e=e||1}function f(e){g(e)||W("character",e)}function g(t){var r=t.length;if(e.substring(H,H+r)===t)return m(r),t}function y(t){if(e[H]===t)return H++,t}function h(){return e[H]}function x(t){return e[H]===t}function b(t){return e[H+1]===t}function E(t){var r=e.substring(H).match(t);return r&&(H+=r[0].length),r}function v(){var t,r=[],n=H;for(r.push(C());y("|");)r.push(C());return 1===r.length?r[0]:{type:"disjunction",body:r,range:[n,t=H],raw:e.substring(n,t)}}function C(){for(var t,r,s=[],u=H;r=function(){if(H>=e.length||x("|")||x(")"))return null;var t,r=function(){switch(h()){case"^":return m(),a("start",1);case"$":return m(),a("end",1);case"\\":if(b("b"))return m(2),a("boundary",2);if(b("B"))return m(2),a("not-boundary",2);break;case"(":return D("(?=","lookahead","(?!","negativeLookahead");default:return}}();if(r){var s=H;if(t=T()||!1){if(!Y&&"group"===r.type)return t.body=d(r),o(t,r.range[0]),t;H=s,W("Expected atom")}return r}var u=function(){var t;switch(t=h()){case".":return m(),{type:"dot",range:[H-1,H],raw:"."};case"\\":if(m(),!(t=w())){if(!Y&&"c"==h())return i("symbol",92,H-1,H);W("atomEscape")}return t;case"[":return N();case"(":if(n.lookbehind&&(t=D("(?<=","lookbehind","(?<!","negativeLookbehind")))return t;if(n.namedGroups&&g("(?<")){var r,o,a,s,u,p=B();f(">");var c=S("normal",p.range[0]-3);return c.name=p,c}if(!n.modifiers||"(?"!==e.substring(H,H+2)||":"==e[H+2])return D("(?:","ignore","(","normal");return o=H,m(2),a=E(/^[sim]+/),y("-")&&":"!==h()?(r=E(/^[sim]+/))||W("Invalid flags for modifiers group"):a||W("Invalid flags for modifiers group"),((s=(a=a?a[0]:"")+(r=r?r[0]:"")).length>3||function(e){for(var t=0;t<e.length;){if(-1!=e.indexOf(e[t],t+1))return!0;t++}return!1}(s))&&W("flags cannot be duplicated for modifiers group"),y(":")||W("Invalid flags for modifiers group"),(u=S("ignore",o)).modifierFlags={enabling:a,disabling:r},u;case"]":case"}":if(!Y)return m(),l(t);break;case"^":case"$":case"*":case"+":case"?":case"{":case")":case"|":break;default:return m(),l(t)}}();if(u||(s=H,(t=T()||!1)&&(H=s,W("Expected atom")),!Y&&y("{")?u=l("{"):W("Expected atom")),t=T()||!1){var p=u.type,c=u.behavior;return"group"===p&&("negativeLookbehind"===c||"lookbehind"===c)&&W("Invalid quantifier","",t.range[0],t.range[1]),t.body=d(u),o(t,u.range[0]),t}return u}();)s.push(r);return 1===s.length?s[0]:{type:"alternative",body:s,range:[u,t=H],raw:e.substring(u,t)}}function D(e,t,r,n){var o,a=H;if(g(e))o=t;else{if(!g(r))return!1;o=n}return S(o,a)}function S(t,r){var n,o=v();o||W("Expected disjunction"),f(")");var a={type:"group",behavior:t,body:d(o),range:[r,n=H],raw:e.substring(r,n)};return"normal"==t&&K&&z++,a}function T(){var e,t,r,n,o=H;switch(h()){case"*":m(),e=u(0,void 0,void 0,void 0,"*");break;case"+":m(),e=u(1,void 0,void 0,void 0,"+");break;case"?":m(),e=u(0,1,void 0,void 0,"?");break;case"{":(n=E(/^\{(\d+)\}/))?e=u(t=parseInt(n[1],10),t,o,H):(n=E(/^\{(\d+),\}/))?e=u(t=parseInt(n[1],10),void 0,o,H):(n=E(/^\{(\d+),(\d+)\}/))&&((t=parseInt(n[1],10))>(r=parseInt(n[2],10))&&W("numbers out of order in {} quantifier","",o,H),e=u(t,r,o,H)),(t&&!Number.isSafeInteger(t)||r&&!Number.isSafeInteger(r))&&W("iterations outside JS safe integer range in quantifier","",o,H)}return e&&y("?")&&(e.greedy=!1,e.range[1]+=1),e}function A(t,r){if(r){var n,o;if("unicodeEscape"==t.kind&&(n=t.codePoint)>=55296&&n<=56319&&x("\\")&&b("u")){var a=H;H++;var i=w(!0);"unicodeEscape"==i.kind&&(o=i.codePoint)>=56320&&o<=57343?(t.kind="unicodeCodePointEscape",t.codePoint=(n-55296)*1024+o-56320+65536,t.range[1]=H,t.raw=e.substring(t.range[0],H)):H=a}}return t}n||(n={});function w(t){var r,a,i,u,p=H;switch(u=h()){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return function(t){var r,n,a=H;if(r=E(/^(?!0)\d+/)){var i,u,p=parseInt(n=r[0],10);if(p<=z&&!t)return u=H-1-(i=n).length,{type:"reference",matchIndex:parseInt(i,10),range:[u,H],raw:e.substring(u,H)};if(_.push(p),K?G=!0:k(a,H),m(-n.length),r=E(/^[0-7]{1,3}/))return s("octal",parseInt(r[0],8),r[0],1);var c=H;return o(r=l(E(/^[89]/)),c-1)}return!!(r=E(/^[0-7]{1,3}/))&&(("0"!==(n=r[0])&&k(a,H),/^0{1,3}$/.test(n))?s("null",0,"0",n.length):s("octal",parseInt(n,8),n,1))}(t);case"B":if(!t)return L();W("\\B not possible inside of CharacterClass","",p);break;case"b":if(t)return m(),s("singleEscape",8,"\\b");return L();case"c":if(t){if(!Y&&(i=E(/^c(\d)/)))return s("controlLetter",i[1]+16,i[1],2);else if(!Y&&g("c_"))return s("controlLetter",31,"_",2)}return j();case"d":case"D":case"w":case"W":case"s":case"S":return m(),{type:"characterClassEscape",value:u,range:[H-2,H],raw:e.substring(H-2,H)};case"k":return function(){if(n.namedGroups&&E(/^k<(?=.*?>)/)){var t,r=B();return f(">"),t=r.range[0]-3,{type:"reference",name:r,range:[t,H],raw:e.substring(t,H)}}}()||L();case"p":case"P":return a=H,!!(n.unicodePropertyEscape&&Y&&(r=E(/^([pP])\{([^}]+)\}/)))&&{type:"unicodePropertyEscape",negative:"P"===r[1],value:r[2],range:[a-1,H],raw:e.substring(a-1,H)}||L();case"-":if(t&&Y)return m(),s("singleEscape",45,"\\-");return L();default:return j()}}function k(e,t){Y&&W("Invalid decimal escape in unicode mode",null,e,t)}function I(e){var t;return(t=E(/^u([0-9a-fA-F]{4})/))?A(s("unicodeEscape",parseInt(t[1],16),t[1],2),e):e&&(t=E(/^u\{([0-9a-fA-F]+)\}/))?s("unicodeCodePointEscape",parseInt(t[1],16),t[1],4):void 0}function j(){var e,t=H;switch(h()){case"t":return m(),s("singleEscape",9,"\\t");case"n":return m(),s("singleEscape",10,"\\n");case"v":return m(),s("singleEscape",11,"\\v");case"f":return m(),s("singleEscape",12,"\\f");case"r":return m(),s("singleEscape",13,"\\r");case"c":if(e=E(/^c([a-zA-Z])/))return s("controlLetter",e[1].charCodeAt(0)%32,e[1],2);break;case"x":if(e=E(/^x([0-9a-fA-F]{2})/))return s("hexadecimalEscape",parseInt(e[1],16),e[1],2);break;case"u":if(e=I(Y))return(!e||e.codePoint>1114111)&&W("Invalid escape sequence",null,t,H),e}return L()}function F(t){var n=h(),o=H;if("\\"===n){m();var a=I(!0);return a&&t(a.codePoint)||W("Invalid escape sequence",null,o,H),r(a.codePoint)}var i=n.charCodeAt(0);if(i>=55296&&i<=56319){var s=(n+=e[H+1]).charCodeAt(1);s>=56320&&s<=57343&&(i=(i-55296)*1024+s-56320+65536)}if(t(i))return m(),i>65535&&m(),n}function B(){var t,r=H,n=F(R);for(n||W("Invalid identifier");t=F(P);)n+=t;return{type:"identifier",value:n,range:[r,H],raw:e.substring(r,H)}}function R(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=128&&/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDDC0-\uDDF3\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD40-\uDD59\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC7\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8\uDFC0-\uDFE0]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDB0-\uDDDB\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE40-\uDE7F\uDEA0-\uDEB8\uDEBB-\uDED3\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3\uDFF2-\uDFF6]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDDD0-\uDDED\uDDF0\uDEC0-\uDEDE\uDEE0-\uDEE2\uDEE4\uDEE5\uDEE7-\uDEED\uDEF0-\uDEF4\uDEFE\uDEFF\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/.test(r(e))}function P(e){return R(e)||e>=48&&e<=57||e>=128&&/[\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD801[\uDCA0-\uDCA9]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDD30-\uDD39\uDD40-\uDD49\uDD69-\uDD6D\uDEAB\uDEAC\uDEFA-\uDEFF\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC66-\uDC70\uDC73\uDC74\uDC7F-\uDC82\uDCB0-\uDCBA\uDCC2\uDCF0-\uDCF9\uDD00-\uDD02\uDD27-\uDD34\uDD36-\uDD3F\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC9-\uDDCC\uDDCE-\uDDD9\uDE2C-\uDE37\uDE3E\uDE41\uDEDF-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74\uDFB8-\uDFC0\uDFC2\uDFC5\uDFC7-\uDFCA\uDFCC-\uDFD0\uDFD2\uDFE1\uDFE2]|\uD805[\uDC35-\uDC46\uDC50-\uDC59\uDC5E\uDCB0-\uDCC3\uDCD0-\uDCD9\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDE50-\uDE59\uDEAB-\uDEB7\uDEC0-\uDEC9\uDED0-\uDEE3\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDC2C-\uDC3A\uDCE0-\uDCE9\uDD30-\uDD35\uDD37\uDD38\uDD3B-\uDD3E\uDD40\uDD42\uDD43\uDD50-\uDD59\uDDD1-\uDDD7\uDDDA-\uDDE0\uDDE4\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE8A-\uDE99\uDF60-\uDF67\uDFF0-\uDFF9]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC50-\uDC59\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD50-\uDD59\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDDA0-\uDDA9\uDDE0-\uDDE9\uDEF3-\uDEF6\uDF00\uDF01\uDF03\uDF34-\uDF3A\uDF3E-\uDF42\uDF50-\uDF5A]|\uD80D[\uDC40\uDC47-\uDC55]|\uD818[\uDD1E-\uDD39]|\uD81A[\uDE60-\uDE69\uDEC0-\uDEC9\uDEF0-\uDEF4\uDF30-\uDF36\uDF50-\uDF59]|\uD81B[\uDD70-\uDD79\uDF4F\uDF51-\uDF87\uDF8F-\uDF92\uDFE4\uDFF0\uDFF1]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDCF0-\uDCF9\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDC8F\uDD30-\uDD36\uDD40-\uDD49\uDEAE\uDEEC-\uDEF9]|\uD839[\uDCEC-\uDCF9\uDDEE\uDDEF\uDDF1-\uDDFA\uDEE3\uDEE6\uDEEE\uDEEF\uDEF5]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A\uDD50-\uDD59]|\uD83E[\uDFF0-\uDFF9]|\uDB40[\uDD00-\uDDEF]/.test(r(e))}function L(){var t,r=h();return Y&&/[\^$.*+?()\\[\]{}|/]/.test(r)||!Y&&"c"!==r?"k"===r&&n.lookbehind?null:s("identifier",(t=e.substring(H,H+=1)).charCodeAt(0),t,1):null}function N(){var e,t=H;return g("[^")?(e=$(),f("]"),p(e,!0,t,H)):y("[")?(e=$(),f("]"),p(e,!1,t,H)):null}function $(){var e,t;return x("]")?{kind:"union",body:[]}:X?function(){var e,t=[],r=O(!0);for(t.push(r),e="classRange"===r.type?"union":x("&")?"intersection":x("-")?"subtraction":"union";!x("]");)"intersection"===e?(f("&"),f("&"),x("&")&&W("&& cannot be followed by &. Wrap it in brackets: &&[&].")):"subtraction"===e&&(f("-"),f("-")),t.push(r=O("union"===e));return{kind:e,body:t}}():((t=M())||W("classAtom"),(e=x("]")?[t]:function e(t){if(x("-")&&!b("]")){r=t.range[0],m(),i=l("-"),(a=M())||W("classAtom"),n=H;var r,n,o,a,i,s,u=$();return(u||W("classContents"),"codePoint"in t&&"codePoint"in a?o=[c(t,a,r,n)]:Y?W("invalid character class"):o=[t,i,a],"empty"===u.type)?o:o.concat(u.body)}return(s=M())||W("classAtom"),(o=x("]")?s:e(s))||W("nonEmptyClassRangesNoDash"),[t].concat(o)}(t))||W("nonEmptyClassRanges"),{kind:"union",body:e})}function M(){return y("-")?l("-"):function(){var e;switch(e=h()){case"\\":if(m(),!(e=w(!0))){if(!Y&&"c"==h())return l("\\");W("classEscape")}return A(e,Y);case"]":case"-":break;default:return m(),l(e)}}()}function O(t){var r,n,o=H;if(y("\\"))if(g("q{"))return function(){var t,r=H-3,n=[];do n.push(function(){for(var t,r,n=[],o=H;r=U();)n.push(r);return{type:"classString",characters:n,range:[o,t=H],raw:e.substring(o,t)}}());while(y("|"));return f("}"),{type:"classStrings",strings:n,range:[r,t=H],raw:e.substring(r,t)}}();else if(n=w(!0))r=n;else{if(n=V())return n;W("Invalid escape","\\"+h(),o)}else if(n=q())r=n;else{if(n=N())return n;W("Invalid character",h())}if(t&&x("-")&&!b("-")){if(m(),n=U())return c(r,n,o,H);W("Invalid range end",h())}return r}function U(){if(y("\\")){var e,t=H;if(e=V())return e;W("Invalid escape","\\"+h(),t)}return q()}function q(){var e;if(E(/^(?:&&|!!|##|\$\$|%%|\*\*|\+\+|,,|\.\.|::|;;|<<|==|>>|\?\?|@@|\^\^|``|~~)/)&&W("Invalid set operation in character class"),e=E(/^[^()[\]{}/\-\\|]/))return l(e)}function V(){var e;if(y("b"))return s("singleEscape",8,"\\b");if(y("B"))W("\\B not possible inside of ClassContents","",H-2);else if(e=E(/^[&\-!#%,:;<=>@`~]/))return s("identifier",e[0].codePointAt(0),e[0]);else if(e=j())return e;else return null}function W(t,r,n,o){n=null==n?H:n,o=null==o?n:o;var a=Math.max(0,n-10),i=Math.min(o+10,e.length),s=" "+e.substring(a,i),l=" "+Array(n-a+1).join(" ")+"^";throw SyntaxError(t+" at position "+n+(r?": "+r:"")+"\n"+s+"\n"+l)}var _=[],z=0,K=!0,G=!1,J=-1!==(t||"").indexOf("u"),X=-1!==(t||"").indexOf("v"),Y=J||X,H=0;if(X&&!n.unicodeSet)throw Error('The "v" flag is only supported when the .unicodeSet option is enabled.');if(J&&X)throw Error('The "u" and "v" flags are mutually exclusive.');""===(e=String(e))&&(e="(?:)");var Q=v();return(Q.range[1]!==e.length&&W("Could not parse entire input - got stuck","",Q.range[1]),G=G||_.some(function(e){return e<=z}))?(H=0,K=!1,v()):Q}},sm.exports?sm.exports=n:window.regjsparser=n,sm.exports)}());let sg=String.raw`\$&`,sy=new i(String.raw`\^$.*+?()[]{}|/-`),{parse:sh}=sf,sx="method",sb="pattern",sE="split-join",sv=new i(["i","y"]),sC=new i(["anchor","reference"]),sD=e=>String.raw`\u{${e.toString(16).toUpperCase()}}`;function sS(e){let{kind:t,codePoint:r,raw:n}=e;if("controlLetter"===t)return 13===r?String.raw`\r`:10===r?String.raw`\n`:9===r?String.raw`\t`:sD(r);if("null"===t||"octal"===t)return sD(r);let o=n;return(("identifier"===t||"symbol"===t&&n.length>1&&n.startsWith("\\"))&&(o=o.slice(1)),"'"===o||"\\"===o)?`\\${o}`:o}function sT(e){return"value"===e.type?sS(e):"characterClass"!==e.type||e.negative||1!==e.body.length||"value"!==e.body[0].type?"quantifier"===e.type&&1===e.min&&1===e.max||"group"===e.type&&"ignore"===e.behavior?sA(e.body):void 0:sS(e.body[0])}function sA(e){let t=[];for(let r of e){let e=sT(r);if(void 0===e)return;t.push(e)}return t.join("")}let sw=e=>{let{pattern:t,flags:r}=e.regex;try{return sh(t,r,{unicodePropertyEscape:r.includes("u"),unicodeSet:r.includes("v"),namedGroups:!0,lookbehind:!0})}catch{}},sk=e=>{let t=0;for(let r of e)t+=sI(r);return t};function sI(e){return sC.has(e.type)?0:["value","dot","characterClass","characterClassEscape","unicodePropertyEscape"].includes(e.type)?1:"alternative"===e.type?sk(e.body):"disjunction"===e.type?Math.min(...e.body.map(e=>sI(e))):"quantifier"===e.type?e.min*sk(e.body):"group"===e.type&&"ignore"===e.behavior?sk(e.body):0}let sj=e=>"group"===e.type&&"normal"===e.behavior||Array.isArray(e.body)&&e.body.some(e=>sj(e)),sF=e=>to(e)&&Number.isSafeInteger(e.value)&&e.value>=0,sB=(e,t)=>{if("BinaryExpression"===e.type&&"+"===e.operator&&(rC(e.left,t)&&te(e.right,1)||te(e.left,1)&&rC(e.right,t)))return t},sR=e=>to(e)?e.value:"UnaryExpression"===e.type&&"-"===e.operator?-sR(e.argument):void 0,sP=e=>e?.type==="MemberExpression"&&!1===e.computed&&"Identifier"===e.property.type&&"length"===e.property.name,sL="prefer-string-trim-start-end",sN="no-unreadable-iife",s$="suggestion",sM="throw-new-error",sO=/^(?:[A-Z][\da-z]*)*Error$/,sU="escape-uppercase",sq="escape-lowercase",sV=/(?<=(?:^|[^\\])(?:\\\\)*\\)(?<data>x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|u{[\dA-Fa-f]+})/g,sW=/(?<=(?:^|[^\\])(?:\\\\)*\\)(?<data>x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|u{[\dA-Fa-f]+}|c[A-Za-z])/g,s_=({node:e,original:t,regex:r=sV,lowercase:n,fix:o})=>{let a=t.replace(r,e=>e[0]+e.slice(1)[n?"toLowerCase":"toUpperCase"]());if(a!==t)return{node:e,messageId:n?sq:sU,fix:t=>o?o(t,a):t.replaceText(e,a)}},sz="prefer-unicode-code-point-escapes",sK="prefer-unicode-code-point-escapes/add-unicode-flag",sG=String.raw`\u{`,sJ=/^[\da-f]$/iv,sX=/^[0-7]$/v,sY=/^[A-Za-z]$/v;function sH(e){return sX.test(e)}function sQ(e,t){let r=0;for(let n=t-1;n>=0&&"\\"===e[n];n--)r++;return r%2==0}function sZ(e,t){let r=0;for(let n=t-1;n>=0&&"\\"===e[n];n--)r++;return r%2==1}function s0(e,t,r){let n=e.slice(t,t+r);if(!(n.length!==r||[...n].some(e=>!sJ.test(e))))return Number.parseInt(n,16)}function s1(e){return e>=55296&&e<=56319}function s2(e){return e>=56320&&e<=57343}function s3(e){return String.raw`\u{${e.toString(16).toUpperCase()}}`}function s8(e,{isRegex:t=!1,supportsNestedCharacterClasses:r=!1}={}){let n="",o=0,a=!1;for(let i=0;i<e.length;i++){let s=e[i],l=o>0;if(t&&"["===s&&(!l||r)&&!sZ(e,i)){o++,n+=s;continue}if(t&&"]"===s&&l&&!sZ(e,i)){o--,n+=s;continue}if("\\"!==s||!sQ(e,i)){n+=s;continue}let u=function(e,t,{isRegex:r,isInCharacterClass:n}){return function(e,t){if("x"!==e[t+1])return;let r=s0(e,t+2,2);if(void 0!==r)return{end:t+4,replacement:s3(r)}}(e,t)??function(e,t,{allowSurrogatePair:r,allowSurrogate:n}){if("u"!==e[t+1]||"{"===e[t+2])return;let o=s0(e,t+2,4);if(void 0===o||!n&&(s1(o)||s2(o)))return;let a=t+6;if(r&&s1(o)&&"\\"===e[a]&&sQ(e,a)&&"u"===e[a+1]){let t=s0(e,a+2,4);if(s2(t))return{end:a+6,replacement:s3((o-55296)*1024+(t-56320)+65536)}}return{end:t+6,replacement:s3(o)}}(e,t,{allowSurrogatePair:!n,allowSurrogate:!r||!n})??(r?function(e,t){let r=e[t+2];if("c"===e[t+1]&&sY.test(r))return{end:t+3,replacement:s3(r.toUpperCase().codePointAt(0)%32)}}(e,t):function(e,t){let r=e[t+1];if("0"===r&&!sH(e[t+2])||!sH(r))return;let n=r>="0"&&r<="3"?3:2,o=t+1;for(;o<t+1+n&&sH(e[o]);)o++;return{end:o,replacement:s3(Number.parseInt(e.slice(t+1,o),8))}}(e,t))}(e,i,{isRegex:t,isInCharacterClass:l});if(!u){n+=s;continue}n+=u.replacement,i=u.end-1,a=!0}return{fixed:n,hasReplacement:a}}function s6(e,t,r){let{fixed:n,hasReplacement:o}=s8(t);if(o)return{node:e,messageId:sz,fix:t=>r?r(t,n):t.replaceText(e,n)}}function s9(e){return e.includes("u")||e.includes("v")?e:`${e}u`}let s5=["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],s4=["Error","EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError","AggregateError","SuppressedError"],s7="missing-message",le="message-is-empty-string",lt="message-is-not-a-string",lr=new o([["AggregateError",1],["SuppressedError",2]]),ln=e=>"instanceof"===e.value&&"Keyword"===e.type,lo="no-instanceof-builtins",la="switch-to-type-of",li=new i(["String","Number","Boolean","BigInt","Symbol"]),ls=new i(["global","globalThis","self","window"]),ll=[...s4,"Map","Set","WeakMap","WeakRef","WeakSet","ArrayBuffer",...rZ,"Object","RegExp","Promise","Proxy","DataView","Date","SharedArrayBuffer","FinalizationRegistry"],lu=(e,t,r)=>function*(n){let{left:o,right:a}=e,i=rG(t,e),s=i.getTokenAfter(o,ln),{sourceCode:l}=t,u=l.getAncestors(e).findLast(e=>"VExpressionContainer"===e.type),p=u?'"'===l.getText(u)[0]?"'":'"':"'";yield aP(n,e,t);let c=e5(o,{sourceCode:i});!e7(o,t)&&o2(o,"typeof")?(yield n.insertTextBeforeRange(c,"typeof ("),yield n.insertTextAfterRange(c,")")):yield n.insertTextBeforeRange(c,"typeof "),yield n.replaceText(s,"===");let d=e5(a,{sourceCode:i});yield n.replaceTextRange(d,p+r.toLowerCase()+p)},lp=(e,t)=>t.sourceCode.getCommentsInside(e).length>0,lc={create:oK(e=>{let{useErrorIsError:t=!1,strategy:r="loose",include:n=[],exclude:o=[]}=e.options[0]??{},a=new i("strict"===r?[...ll,...n]:n);e.on("BinaryExpression",r=>{let{right:n,operator:i}=r;if("instanceof"!==i)return;let s="Identifier"===n.type?{name:n.name,referenceText:n.name}:"MemberExpression"===n.type&&!n.computed&&"Identifier"===n.property.type&&"Identifier"===n.object.type&&ls.has(n.object.name)&&of(n.object,e)?{name:n.property.name,referenceText:e.sourceCode.getText(n)}:void 0;if(!s||o.includes(s.name))return;let{name:l,referenceText:u}=s,p={node:r,messageId:lo};if("Array"===l||"Error"===l&&t){let t="Array"===l?"isArray":"isError",n=`${u}.${t}`;return p.fix=function*(t){let{left:o,right:a}=r,i=rG(e,r),s=i.getTokenAfter(o,ln);yield aP(t,r,e);let l=e5(o,{sourceCode:i});yield t.insertTextBeforeRange(l,n+"("),yield t.insertTextAfterRange(l,")"),yield aW(s,"",t,e,i),yield aW(a,"",t,e,i)},p}return"Function"===l?(lp(n,e)||(p.fix=lu(r,e,l)),p):li.has(l)?(lp(n,e)||(p.suggest=[{messageId:la,data:{type:l.toLowerCase()},fix:lu(r,e,l)}]),p):a.has(l)?p:void 0})}),meta:{type:"problem",docs:{description:"Disallow `instanceof` with built-in objects",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",properties:{useErrorIsError:{type:"boolean"},strategy:{enum:["loose","strict"]},include:{type:"array",items:{type:"string"}},exclude:{type:"array",items:{type:"string"}}},additionalProperties:!1}],defaultOptions:[{useErrorIsError:!1,strategy:"loose",include:[],exclude:[]}],hasSuggestions:!0,messages:{[lo]:"Avoid using `instanceof` for type checking as it can lead to unreliable results.",[la]:"Switch to `typeof … === '{{type}}'`."},languages:["js/js"]}},ld="prefer-type-error",lm=new i(["isArguments","isArray","isArrayBuffer","isArrayLike","isArrayLikeObject","isBigInt","isBoolean","isBuffer","isDate","isElement","isError","isFinite","isFunction","isInteger","isLength","isMap","isNaN","isNative","isNil","isNull","isNumber","isObject","isObjectLike","isPlainObject","isPrototypeOf","isRegExp","isSafeInteger","isSet","isString","isSymbol","isTypedArray","isUndefined","isView","isWeakMap","isWeakSet","isWindow","isXMLDoc"]),lf=new i(["isNaN","isFinite"]),lg=(e,t,r)=>void 0!==t&&t.arguments.length>0&&"Identifier"===e.type&&(!0===r&&lm.has(e.name)||!1===r&&lf.has(e.name)),ly=(e,t)=>!!lg(e.property,t,!0)||"MemberExpression"===e.object.type&&ly(e.object,t),lh=/^(?:[A-Z][\da-z]*)*Error$/,lx=e=>"UnaryExpression"===e.type&&"typeof"===e.operator,lb=(e,t)=>{switch(e.type){case"Identifier":return lg(e,t,!1);case"MemberExpression":return ly(e,t);case"CallExpression":return lb(e.callee,e);case"UnaryExpression":return"typeof"===e.operator||"!"===e.operator&&lb(e.argument);case"BinaryExpression":{let{operator:r,left:n,right:o}=e;if("instanceof"===r)return!("Identifier"===o.type?lh.test(o.name):"MemberExpression"===o.type&&!o.optional&&!o.computed&&"Identifier"===o.property.type&&lh.test(o.property.name));if((e=>{let{operator:t,left:r,right:n}=e;return("=="===t||"!="===t||"==="===t||"!=="===t)&&(lx(r)&&te(n,"undefined")||lx(n)&&te(r,"undefined"))})(e))return!1;return lb(n,t)||lb(o,t)}case"LogicalExpression":return lb(e.left,t)&&lb(e.right,t);default:return!1}},lE="consistentDestructuring",lv="consistentDestructuringSuggest",lC=new i(["FunctionDeclaration","FunctionExpression","MethodDefinition","PropertyDefinition","AccessorProperty","StaticBlock","Program"]),lD=e=>{for(;e.parent;)if(e=e.parent,lC.has(e.type))return e},lS=e=>"Property"===e.type&&!e.computed&&"Identifier"===e.key.type,lT=(e,t,r,n)=>{for(let o of e){if(o.key.name!==t)continue;let e=ey(n.getScope(o.value),o.value);if(e&&ey(r,o.value)===e)return o}},lA=({declaration:e,memberExpressionNode:t,memberScope:r,memberRootIdentifier:n,memberRootVariable:o,memberThisScopeBoundary:a,memberExpressionWrites:i,sourceCode:s})=>{if(!((e,t,r)=>{let[,n]=r.getRange(e.object),[o]=r.getRange(t);return n<o})(e,t,s)||e.rootIdentifierName&&n?.name===e.rootIdentifierName&&o!==e.rootVariable||e.thisScopeBoundary&&a!==e.thisScopeBoundary||((e,t,r,n)=>{if(!e.rootVariable)return!1;let[,o]=n.getRange(e.object),[a]=n.getRange(t);return e.rootVariable.references.some(e=>{if(!e.isWrite())return!1;let[t]=n.getRange(e.identifier);return!(t<o)&&(e.from.variableScope!==r.variableScope||t<=a)})})(e,t,r,s)||(({declaration:e,memberExpressionNode:t,memberScope:r,memberExpressionWrites:n,sourceCode:o})=>{let[,a]=o.getRange(e.object),[i]=o.getRange(t),s=t.property.name,l=rj(t.object),u="Identifier"===l.type?l.name:void 0,p="Identifier"===l.type?ey(r,l):void 0,c="ThisExpression"===l.type?lD(l):void 0;return n.some(e=>e.propertyName===s&&e.rootIdentifierName===u&&e.rootVariable===p&&e.thisScopeBoundary===c&&(e.scope.variableScope!==r.variableScope||e.start>=a&&e.start<=i))})({declaration:e,memberExpressionNode:t,memberScope:r,memberExpressionWrites:i,sourceCode:s}))return!1;for(var l=r,u=e.scope;l;){if(l===u)return!0;l=l.upper}return!1},lw=(e,t,r)=>!!("BinaryExpression"===e.type&&"in"===e.operator&&tt(e.left))&&"Identifier"===t.property.type&&e.left.value===t.property.name&&r.getText(e.right)===r.getText(t.object)||"LogicalExpression"===e.type&&"&&"===e.operator&&(lw(e.left,t,r)||lw(e.right,t,r)),lk=(e,t,r,n)=>{switch(e.type){case"ConditionalExpression":case"IfStatement":return e.consequent===t&&lw(e.test,r,n);case"LogicalExpression":return"&&"===e.operator&&e.right===t&&lw(e.left,r,n);default:return!1}},lI=e=>["AccessorProperty","FunctionDeclaration","MethodDefinition","PropertyDefinition"].includes(e.type),lj=["Object","Array","ArrayBuffer","DataView","Date","Function","Map","WeakMap","Set","WeakSet","Promise","RegExp","SharedArrayBuffer","Proxy","WeakRef","FinalizationRegistry","DisposableStack","AsyncDisposableStack",...s4,...["Collator","DateTimeFormat","DisplayNames","DurationFormat","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"].map(e=>`Intl.${e}`),...["Duration","Instant","PlainDate","PlainDateTime","PlainMonthDay","PlainTime","PlainYearMonth","ZonedDateTime"].map(e=>`Temporal.${e}`),...["Module","Instance","Memory","Table","Global","Tag","Exception","CompileError","LinkError","RuntimeError"].map(e=>`WebAssembly.${e}`),...rZ],lF=["Temporal.Now","WebAssembly","WebAssembly.JSTag"],lB="error-date",lR="suggestion-date";function lP(e){let{node:t}=e;return{node:t,messageId:"disallowCallOrNew",data:{name:e.path.join(".")}}}let lL=new iw({objects:["BigInt","Boolean","Number","String","Symbol"],type:iw.CONSTRUCT,handle:function(e,t){let{node:r}=e,n=e.path.join("."),o={node:r,messageId:"disallow",data:{name:n}};return"String"!==n&&"Boolean"!==n&&"Number"!==n&&(o.fix=e=>aB(r,t,e)),o}}),lN=new iw({objects:lj,type:iw.CALL,handle:function(e,t){let{node:r}=e;if(r.optional||rY(r.callee))return;let n=e.path.join(".");if("Object"===n){let{parent:e}=r;if("BinaryExpression"===e.type&&("==="===e.operator||"!=="===e.operator)&&(e.left===r||e.right===r))return}else if("Date"===n){function*o(e){yield e.replaceText(r,"String(new Date())"),yield aP(e,r,t)}let e={node:r,messageId:lB};return 0===t.sourceCode.getCommentsInside(r).length&&0===r.arguments.length?e.fix=o:e.suggest=[{messageId:lR,fix:o}],e}return{node:r,messageId:"enforce",data:{name:n},fix:e=>aL(r,t,e)}}}),l$=new iw({objects:lF,type:iw.CALL,handle:lP}),lM=new iw({objects:lF,type:iw.CONSTRUCT,handle:lP}),lO="error/array-push",lU="suggestion",lq=e=>tT(e,{property:"classList",computed:!1}),lV=e=>e.arguments.some(e=>"SpreadElement"===e.type),lW=[{description:"Array#push()",test:e=>tw(e,{method:"push",optionalCall:!1}),ignore:["stream.push","this.push","this.stream.push","process.stdin.push","process.stdout.push","process.stderr.push"]},{description:"Array#unshift()",test:e=>tw(e,{method:"unshift",optionalCall:!1}),keepSecondCall:!0,ignore:["stream.unshift","this.unshift","this.stream.unshift","process.stdin.unshift","process.stdout.unshift","process.stderr.unshift"]},{description:"Element#classList.add()",test:e=>tw(e,{method:"add",optionalCall:!1,optionalMember:!1})&&lq(e.callee.object)},{description:"Element#classList.remove()",test:e=>tw(e,{method:"remove",optionalCall:!1,optionalMember:!1})&&lq(e.callee.object)},{description:"importScripts()",test:e=>tm(e,{name:"importScripts"},tp)}],l_={create:function(e){let{ignore:t}=e.options[0],{sourceCode:r}=e;e.on("CallExpression",function*(n){for(let{description:o,test:a,ignore:i=[],keepSecondCall:s=!1}of lW){if(!a(n))continue;let l=[...i,...t];if(tB(n.callee,l))continue;let u=function(e){let t=e.parent;return"ChainExpression"===t.type&&e===t.expression&&(t=t.parent),"ExpressionStatement"===t.type?t:void 0}(n);if(!u)continue;let p=at(u,e);if(p?.type!=="ExpressionStatement")continue;let c=function(e){let{expression:t}=e;return"ChainExpression"===t.type?t.expression:t}(p);if(!a(c)||!rC(c.callee,n.callee))continue;let{shouldKeepSecondCall:d,shouldPrependSourceArguments:m,targetCall:f,sourceCall:g}=function(e,t,r){let n=r&&(!rY(t.callee)||rY(e.callee));return{shouldKeepSecondCall:n,shouldPrependSourceArguments:r&&!n,targetCall:n?t:e,sourceCall:n?e:t}}(c,n,s),y=g.arguments,h=r.getRange(p),x=r.getRange(u),b=d?[h[0],x[0]]:[h[1],x[1]],E=!d&&!eE(r.getLastToken(p))&&eE(r.getLastToken(u)),v=d&&oD(r.getTokenBefore(p),e,r.text.slice(x[0],x[0]+1)),C={node:"Identifier"===n.callee.type?n.callee:n.callee.property,messageId:lO,data:{description:o}},D=function*(t){if(y.length>0){let r=rb(e,g,!m),{openingParenthesisToken:n,trailingCommaToken:o,closingParenthesisToken:a}=rx(f,e);m?yield t.insertTextAfter(n,f.arguments.length>0?`${r}, `:r):yield o?t.insertTextAfter(o,` ${r}`):t.insertTextBefore(a,f.arguments.length>0?`, ${r}`:r)}yield t.replaceTextRange(b,E||v?";":"")};!function(e,t){return e.getAllComments().some(r=>{let[n,o]=e.getRange(r);return n>=t[0]&&o<=t[1]})}(r,b)&&(function(e,t,r,n){let o=r?[...e.arguments,...t.arguments]:t.arguments;return r&&(lV(e)||lV(t))||r&&o.some(e=>null===e$(e,n.getScope(e)))||o.some(e=>ez(e,n))}(c,n,s,r)?C.suggest=[{messageId:lU,fix:D}]:C.fix=D),yield C}})},meta:{type:"suggestion",docs:{description:"Enforce combining multiple `Array#{push,unshift}()`, `Element#classList.{add,remove}()`, and `importScripts()` into one call.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,properties:{ignore:{type:"array",uniqueItems:!0,description:"Methods to ignore."}}}],defaultOptions:[{ignore:[]}],messages:{[lO]:"Do not call `{{description}}` multiple times.",[lU]:"Merge with previous one."},languages:["js/js"]}},lz="no-process-exit",lK=e=>te(e,"node:worker_threads")||te(e,"worker_threads"),lG="no-single-promise-in-promise-methods/error",lJ="no-single-promise-in-promise-methods/unwrap",lX="no-single-promise-in-promise-methods/use-promise-resolve",lY=["all","any","race"],lH=(e,t)=>{let[r]=e.arguments[0].elements,n=e4(r,t);return!e7(r,t)&&16>oX(r)&&(n=`(${n})`),n},lQ=(e,t)=>e.getCommentsInside(t).length>0,lZ=e=>"ArrayPattern"===e.type&&!e.typeAnnotation&&1===e.elements.length&&e.elements[0]?.type==="Identifier",l0="no-static-only-class",l1=({type:e,value:t})=>"Punctuator"===e&&"="===t,l2=e=>"PropertyDefinition"===e.type,l3="ignored-elements",l8="property-assignment",l6={create:e=>{let{sourceCode:t}=e,{maximumIgnoredElements:r}=e.options[0];e.on("ArrayPattern",n=>{let{elements:o,parent:a}=n;if(function(e){let t=0,r=0;for(let n of e)null===n?t=Math.max(t,++r):r=0;return t}(o)<=r)return;let i={node:n,messageId:l3},s=o.filter(e=>null!==e);if("VariableDeclarator"===a.type&&a.id===n&&null!==a.init&&1===s.length){let[r]=s;"AssignmentPattern"!==r.type&&(i.fix=function*(i){let s=o.indexOf(r),l="RestElement"===r.type,u=l?r.argument:r;yield i.replaceText(n,t.getText(u));let p=l?`.slice(${s})`:`[${s}]`,c=a.init;!e7(c,e)&&oZ(c,e)?(yield i.insertTextBefore(c,"("),yield i.insertTextAfter(a,`)${p}`)):yield i.insertTextAfter(a,p),yield aP(i,n,e)})}return i}),e.on("MemberExpression",e=>{if(function e(t){let{parent:r}=t;if(r){if(rI(r)&&r.expression===t||"AssignmentPattern"===r.type&&r.left===t||"RestElement"===r.type&&r.argument===t)return e(r);if("Property"===r.type&&r.value===t&&"ObjectPattern"===r.parent.type)return r.parent;if("ObjectPattern"===r.type||"ArrayPattern"===r.type)return r}}(e)?.type==="ArrayPattern")return{node:e,messageId:l8}})},meta:{type:"suggestion",docs:{description:"Disallow unreadable array destructuring.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{maximumIgnoredElements:{type:"integer",minimum:0,description:"Maximum number of consecutive ignored elements allowed."}}}],defaultOptions:[{maximumIgnoredElements:1}],messages:{[l3]:"Array destructuring may not contain consecutive ignored values.",[l8]:"Do not assign destructured values to object properties."},languages:["js/js"]}},l9="spread-in-list",l5="iterable-to-array",l4="iterable-to-array-in-for-of",l7="iterable-to-array-in-yield-star",ue="spread-in-collection-constructor",ut="spread-in-object-assign",ur="clone-array",un="suggestion/remove-object-assign-spread",uo=["Map","WeakMap","Set","WeakSet"],ua=["copyWithin","flat","slice","splice","toReversed","toSorted","toSpliced","with"],ui=[...ua,"filter","flatMap","map"],us=e=>"ArrayExpression"===e.type&&1===e.elements.length&&e.elements[0]?.type==="SpreadElement",ul={ArrayExpression:"array literal",ObjectExpression:"object literal",CallExpression:"arguments",NewExpression:"arguments"};function*uu(e,t,r){let{sourceCode:n}=r,[o,a,i]=n.getFirstTokens(t,3);yield e.remove(o),yield e.remove(a);let[s,l]=n.getLastTokens(t,2);yield e.remove(l),eb(s)&&(yield e.remove(s));let{parent:u}=t;"ReturnStatement"!==u.type&&"ThrowStatement"!==u.type||u.argument!==t||op(o,i,r)||e7(t,r)?yield aP(e,t,r):yield aj(e,u,r)}let up=(e,t)=>"CallExpression"===e.type&&"MemberExpression"===e.callee.type&&nv(e.callee.object,t),uc="no-useless-switch-case/error",ud="no-useless-switch-case/suggestion",um=e=>e.consequent.every(e=>ty(e)),uf=e=>tP(e.test)||ti(e.test),ug=new i(["CallExpression","MemberExpression"]),uy=new i(["Identifier","MemberExpression","Super","ThisExpression"]);[...new o([["===","!=="],["!==","==="],["==","!="],["!=","=="]])];let uh=e=>"MemberExpression"===(e=rj(e)).type?{...e,object:uh(e.object),property:e.computed?uh(e.property):e.property}:e,ux=(e,t)=>rC(uh(e),uh(t)),ub=e=>uy.has(rj(e).type),uE=e=>!!("ChainExpression"===e.type||ug.has(e.type)&&e.optional)||Object.entries(e).some(([e,t])=>"parent"!==e&&!!t&&(Array.isArray(t)?t.some(e=>e?.type&&uE(e)):t.type&&uE(t))),uv="no-useless-undefined",uC="no-useless-undefined/suggestion",uD=new i(["is","equal","notEqual","strictEqual","notStrictEqual","propertyVal","notPropertyVal","not","include","property","toBe","toHaveBeenCalledWith","toContain","toContainEqual","toEqual","same","notSame","strictSame","strictNotSame"]),uS=e=>{for(;e;e=e.upper)if("function"===e.type)return e.block},uT={">=":{valid:!0,addend:0},">":{valid:!0,addend:-1},"<":{valid:!1,addend:0},"<=":{valid:!1,addend:-1}},uA={"<=":{valid:!0,addend:0},"<":{valid:!0,addend:-1},">":{valid:!1,addend:0},">=":{valid:!1,addend:-1}},uw={"<":{valid:!0,kind:"length"},"<=":{valid:!0,kind:"lengthMinusOne"},">=":{valid:!1,kind:"length"},">":{valid:!1,kind:"lengthMinusOne"}},uk={">":{valid:!0,kind:"length"},">=":{valid:!0,kind:"lengthMinusOne"},"<=":{valid:!1,kind:"length"},"<":{valid:!1,kind:"lengthMinusOne"}},uI=new i(["<","<=",">",">="]);function uj(e,t,r,n){let o=e[t];if(o&&r===n+o.addend)return o.valid}function uF(e,t){return tT(e=rj(e),{property:"length",optional:!1,computed:!1})&&ux(e.object,t)}function uB(e,t){return uF(e=rj(e),t)?"length":"BinaryExpression"===e.type&&"-"===e.operator&&uF(e.left,t)&&1===oQ(e.right)?"lengthMinusOne":void 0}function uR(e,t,r){let n=e[t];if(n?.kind===r)return n.valid}let uP={create:e=>{let{sourceCode:t}=e,r=(e,r,n)=>{if(n){let r=uS(t.getScope(e));if(r?.returnType)return}return{node:e,messageId:uv,fix:r}},n=e.options[0];e.on("Identifier",o=>{if(!tP(o))return;let{parent:a}=o;if("ReturnStatement"===a.type&&a.argument===o){let n,a=uS(t.getScope(o));if(a?.returnType&&"TSUndefinedKeyword"!==(n=a.returnType?.typeAnnotation?.type)&&"TSVoidKeyword"!==n)return;return r(o,t=>aW(o,"",t,e))}if("YieldExpression"===a.type&&!a.delegate&&a.argument===o)return r(o,t=>aW(o,"",t,e));if(n.checkArrowFunctionBody&&"ArrowFunctionExpression"===a.type&&a.body===o)return r(o,t=>aW(o," {}",t,e),!0);if("VariableDeclarator"===a.type&&a.init===o&&"VariableDeclaration"===a.parent.type&&"const"!==a.parent.kind&&a.parent.declarations.includes(a)){let[,e]=t.getRange(a.id),[,n]=t.getRange(o);return r(o,t=>t.removeRange([e,n]))}if("AssignmentPattern"===a.type&&a.right===o)return r(o,function*(r){let{left:n}=a,[,i]=t.getRange(n),[,s]=t.getRange(o);yield r.removeRange([i,s]),(n.typeAnnotation||rz(e.physicalFilename))&&!n.optional&&tv(a.parent)&&a.parent.params.includes(a)&&(yield n.typeAnnotation?r.insertTextBefore(n.typeAnnotation,"?"):r.insertTextAfter(n,"?"))})}),e.on("ConditionalExpression",r=>{let n=tP(r.consequent);if(n===tP(r.alternate))return;let o=n?r.alternate:r.consequent,a=function(e,t){if(!(!tT(e=rj(e),{computed:!0,optional:!1})||uE(e)||ez(e.object,t,{considerGetters:!0})||ez(e.property,t,{considerGetters:!0})))return{node:e,index:function(e){if("BinaryExpression"===(e=rj(e)).type&&"-"===e.operator){let t=oQ(e.right);if(Number.isSafeInteger(t)&&t>0)return{node:e.left,offset:t}}return{node:e,offset:0}}(e.property)}}(o,t);if(!a||function(e,t){if(!("BinaryExpression"!==(e=rj(e)).type||!uI.has(e.operator)||uE(e)))return function(e,t){let{operator:r,left:n,right:o}=e,a=oQ(n),i=oQ(o);return Number.isSafeInteger(i)&&ux(n,t.node)?uj(uT,r,i,t.offset):Number.isSafeInteger(a)&&ux(o,t.node)?uj(uA,r,a,t.offset):void 0}(e,t.index)??function(e,t){if(0!==t.index.offset)return;let{operator:r,left:n,right:o}=e,a=uB(o,t.node.object);if(a&&ux(n,t.index.node))return uR(uw,r,a);let i=uB(n,t.node.object);if(i&&ux(o,t.index.node))return uR(uk,r,i)}(e,t)}(r.test,a)!==!n)return;let i={node:n?r.consequent:r.alternate,messageId:uv};return 0===t.getCommentsInside(r).length&&(i.suggest=[{messageId:uC,fix(n){let a=t.getText(o),i=oD(t.getTokenBefore(r),e,a)?";":"";return n.replaceText(r,i+a)}}]),i}),!n.checkArguments||rz(e.physicalFilename)||e.on("CallExpression",t=>{var r;let n,o=t.arguments,a=o.at(-1);if(!(!tP(a)||("Identifier"===(r=t.callee).type?n=r.name:"MemberExpression"===r.type&&!1===r.computed&&"Identifier"===r.property.type&&(n=r.property.name),uD.has(n)||"push"===n||"unshift"===n||"includes"===n||"add"===n||"has"===n||"delete"===n||"set"===n||"createContext"===n||/^set[A-Z]/v.test(n)||"useRef"===n||"ref"===n))&&(!(!t.optional&&"MemberExpression"===t.callee.type&&!t.callee.computed&&"Identifier"===t.callee.property.type&&"bind"===t.callee.property.name)||1===o.length))return{node:a,messageId:uv,fix:t=>aw(t,a,e)}})},meta:{type:"suggestion",docs:{description:"Disallow useless `undefined`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,properties:{checkArguments:{type:"boolean",description:"Whether to check function arguments."},checkArrowFunctionBody:{type:"boolean",description:"Whether to check arrow function bodies."}}}],defaultOptions:[{checkArguments:!0,checkArrowFunctionBody:!0}],messages:{[uv]:"Do not use useless `undefined`.",[uC]:"Use the indexed access directly."},languages:["js/js"]}},uL="numeric-separators-style";function uN(e,{minimumDigits:t,groupLength:r},n){let{length:o}=e;if(o<t)return e;let a=[];if(n)for(let t=0;t<o;t+=r){let n=Math.min(t+r,o);a.push(e.slice(t,n))}else for(let t=o;t>0;t-=r){let n=Math.max(t-r,0);a.unshift(e.slice(n,t))}return a.join("_")}let u$={binary:{minimumDigits:0,groupLength:4},octal:{minimumDigits:0,groupLength:4},hexadecimal:{minimumDigits:0,groupLength:2},number:{minimumDigits:5,groupLength:3,fractionGroupLength:1/0}},uM={create:e=>{let{onlyIfContainsSeparator:t,binary:r,octal:n,hexadecimal:o,number:a}=e.options[0],i={"0b":{onlyIfContainsSeparator:t,...r},"0o":{onlyIfContainsSeparator:t,...n},"0x":{onlyIfContainsSeparator:t,...o},"":{onlyIfContainsSeparator:t,...a}};e.on("Literal",e=>{let t,r;if(!(to(e)||ts(e))||to(e)&&/^0\d+$/.test(e.raw))return;let{raw:n}=e,o=n,a="";ts(e)&&(o=n.slice(0,-1),a="n");let s=o.replaceAll("_",""),{prefix:l,data:u}=(t="",r=s,/^0[box]/i.test(s)&&(t=s.slice(0,2),r=s.slice(2)),{prefix:t,data:r}),{onlyIfContainsSeparator:p}=i[l.toLowerCase()];if(p&&!n.includes("_"))return;let c=function(e,{prefix:t,data:r},n){let o=n[t.toLowerCase()];if(t)return t+uN(r,o);let{number:a,mark:i,sign:s,power:l}=function(e){let{number:t,mark:r="",sign:n="",power:o=""}=e.match(/^(?<number>[\d._]*)(?:(?<mark>e)(?<sign>[+-])?(?<power>[\d_]+))?$/i).groups;return{number:t,mark:r,sign:n,power:o}}(e);return function(e,t){let{integer:r,dot:n,fractional:o}=function(e){let t=e.split("."),[r,n=""]=t;return{integer:r,dot:2===t.length?".":"",fractional:n}}(e);return uN(r,t)+n+uN(o,{...t,groupLength:t.fractionGroupLength},!0)}(a,o)+i+s+uN(l,n[""])}(s,{prefix:l,data:u},i)+a;if(n!==c)return{node:e,messageId:uL,fix:t=>t.replaceText(e,c)}})},meta:{type:"suggestion",docs:{description:"Enforce the style of numeric separators by correctly grouping digits.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{...Object.fromEntries(Object.keys(u$).map(e=>[e,(({withFraction:e=!1}={})=>({type:"object",additionalProperties:!1,properties:{onlyIfContainsSeparator:{type:"boolean",description:"Whether to only enforce the style if the number already contains a separator."},minimumDigits:{type:"integer",minimum:0,description:"The minimum number of digits before separators are enforced."},groupLength:{type:"integer",minimum:1,description:"The number of digits in each group."},...e&&{fractionGroupLength:{type:"integer",minimum:1,description:"The number of digits in each group after the decimal point. Defaults to no grouping."}}}}))({withFraction:"number"===e})])),onlyIfContainsSeparator:{type:"boolean",description:"Whether to only enforce the style if the number already contains a separator."}}}],defaultOptions:[{onlyIfContainsSeparator:!1,binary:u$.binary,octal:u$.octal,hexadecimal:u$.hexadecimal,number:u$.number}],messages:{[uL]:"Invalid group length in numeric value."},languages:["js/js"]}},uO="error-zero-index",uU="error-shift",uq="error-pop",uV="error-at-zero",uW="error-at-minus-one",u_="error-slice-minus-one",uz="error-destructuring-declaration",uK="error-destructuring-assignment",uG="error-variable",uJ="suggest-nullish-coalescing-operator",uX="suggest-logical-or-operator",uY=(e,t,r)=>tw(e,{method:"filter",minimumArguments:1,maximumArguments:2,optionalCall:!1,...r})&&!nv(e.callee.object,t),uH=e=>"UnaryExpression"===e.type&&"-"===e.operator&&e.prefix&&"Literal"===e.argument.type&&"1"===e.argument.raw,uQ=(e,t)=>tw(e,{method:"slice",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&uH(e.arguments[0])&&uY(e.callee.object,t),uZ=e=>e?"AssignmentExpression"===e.type?e:"VariableDeclarator"===e.type?{left:e.id,right:e.init}:{}:{};function*u0(e,t,r){let{left:n}=uZ(e),[o]=n.elements,a=t.getText("AssignmentPattern"===o.type?o.left:o);yield r.replaceText(n,a),((e,t)=>{if("AssignmentExpression"!==e.type||eK(e,t))return!1;let{left:r}=uZ(e),[n]=r.elements,{type:o}="AssignmentPattern"===n.type?n.left:n;return"ObjectExpression"===o||"ObjectPattern"===o})(e,t)&&(yield r.insertTextBefore(e,"("),yield r.insertTextAfter(e,")"))}let u1=e=>"AssignmentPattern"===uZ(e).left.elements[0].type,u2=(e,t)=>{let r,n,{property:o}=uZ(t).right.callee;return u1(t)?r=[{operator:"??",messageId:uJ},{operator:"||",messageId:uX}].map(({messageId:r,operator:n})=>({messageId:r,*fix(r){yield r.replaceText(o,"find"),yield((e,t,r,n)=>{let{left:o,right:a}=uZ(e),[i]=o.elements,s=i.right,l=t.getText(s);return(eK(s,t)||"LogicalExpression"===s.type&&(s.operator===n||"||"===n&&"??"===s.operator||"??"===n&&("||"===s.operator||"&&"===s.operator))||"ConditionalExpression"===s.type||"AssignmentExpression"===s.type||"YieldExpression"===s.type||"SequenceExpression"===s.type)&&(l=`(${l})`),r.insertTextAfter(a,` ${n} ${l}`)})(t,e,r,n),yield u0(t,e,r)}})):n=function*(r){yield r.replaceText(o,"find"),yield u0(t,e,r)},{fix:n,suggest:r}},u3=e=>"MemberExpression"===e.parent.type&&!0===e.parent.computed&&e.parent.object===e&&"Literal"===e.parent.property.type&&"0"===e.parent.property.raw,u8=e=>{let{left:t,right:r}=uZ(e.parent);return t&&r&&r===e&&"ArrayPattern"===t.type&&1===t.elements.length&&t.elements[0]&&"RestElement"!==t.elements[0].type},u6={create:e=>{let{sourceCode:t}=e,{checkFromLast:r}=e.options[0];e.on("MemberExpression",t=>{if(!(!(t.computed&&"Literal"===t.property.type&&"0"===t.property.raw&&uY(t.object,e))||nL(t)))return{node:t.object.callee.property,messageId:uO,fix:r=>[r.replaceText(t.object.callee.property,"find"),a$(r,t,e)]}}),e.on("CallExpression",t=>{if(tw(t,{method:"shift",argumentsLength:0,optionalCall:!1,optionalMember:!1})&&uY(t.callee.object,e))return{node:t.callee.object.callee.property,messageId:uU,fix:r=>[r.replaceText(t.callee.object.callee.property,"find"),...aM(r,t,e)]}}),e.on("VariableDeclarator",r=>{if("ArrayPattern"===r.id.type&&1===r.id.elements.length&&r.id.elements[0]&&"RestElement"!==r.id.elements[0].type&&uY(r.init,e,{optionalMember:!1}))return{node:r.init.callee.property,messageId:uz,...u2(t,r)}}),e.on("AssignmentExpression",r=>{if("ArrayPattern"===r.left.type&&1===r.left.elements.length&&r.left.elements[0]&&"RestElement"!==r.left.elements[0].type&&uY(r.right,e,{optionalMember:!1}))return{node:r.right.callee.property,messageId:uK,...u2(t,r)}}),e.on("VariableDeclarator",r=>{if(!("Identifier"===r.id.type&&uY(r.init,e,{optionalMember:!1})&&"VariableDeclaration"===r.parent.type&&r.parent.declarations.includes(r)&&("ExportNamedDeclaration"!==r.parent.parent.type||r.parent.parent.declaration!==r.parent)))return;let n=t.getScope(r),o=ey(n,r.id),a=rJ(o).filter(e=>e!==r.id);if(0===a.length)return;let i=[],s=[];for(let e of a)if(u3(e))i.push(e.parent);else{if(!u8(e))return;s.push(e.parent)}let l={node:r.init.callee.property,messageId:uG};return s.every(e=>!u1(e))&&(l.fix=function*(a){yield a.replaceText(r.init.callee.property,"find");let l=(e=>{let t=o5.singular(e);if(t!==e)return t})(r.id.name);if(l){let r=ry(l,rp(n));yield aq(o,r,e,a),yield function*(e,t){yield e.insertTextBeforeRange(t,""),yield e.insertTextAfterRange(t,"")}(a,t.getRange(t.ast))}for(let t of i)yield a$(a,t,e);for(let e of s)yield u0(e,t,a)}),l}),e.on("CallExpression",t=>{if(tw(t,{method:"at",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&"Literal"===t.arguments[0].type&&"0"===t.arguments[0].raw&&uY(t.callee.object,e))return{node:t.callee.object.callee.property,messageId:uV,fix:r=>[r.replaceText(t.callee.object.callee.property,"find"),...aM(r,t,e)]}}),r&&(e.on("CallExpression",t=>{if(tw(t,{method:"pop",argumentsLength:0,optionalCall:!1,optionalMember:!1})&&uY(t.callee.object,e))return{node:t.callee.object.callee.property,messageId:uq,fix:r=>[r.replaceText(t.callee.object.callee.property,"findLast"),...aM(r,t,e)]}}),e.on("CallExpression",t=>{if(tw(t,{method:"at",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&uH(t.arguments[0])&&uY(t.callee.object,e))return{node:t.callee.object.callee.property,messageId:uW,fix:r=>[r.replaceText(t.callee.object.callee.property,"findLast"),...aM(r,t,e)]}}),e.on("MemberExpression",r=>{if(!(r.computed&&!r.optional&&"Literal"===r.property.type&&"0"===r.property.raw&&!nL(r)&&uQ(r.object,e)))return;let n=r.object.callee.object;return{node:n.callee.property,messageId:u_,*fix(o,{abort:a}){if(r$(e,[e5(n,e)[1],t.getRange(r)[1]]))return a();yield o.replaceText(n.callee.property,"findLast"),yield aM(o,r.object,e),yield a$(o,r,e)}}}),e.on("CallExpression",r=>{if(!(tw(r,{methods:["pop","shift"],argumentsLength:0,optionalCall:!1,optionalMember:!1})&&uQ(r.callee.object,e)))return;let n=r.callee.object.callee.object;return{node:n.callee.property,messageId:u_,*fix(o,{abort:a}){if(r$(e,[e5(n,e)[1],t.getRange(r)[1]]))return a();yield o.replaceText(n.callee.property,"findLast"),yield aM(o,r.callee.object,e),yield aM(o,r,e)}}}))},meta:{type:"suggestion",docs:{description:"Prefer `.find(…)` and `.findLast(…)` over the first or last element from `.filter(…)`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,properties:{checkFromLast:{type:"boolean",description:"Whether to also check for patterns that can be replaced with `findLast()`."}}}],defaultOptions:[{checkFromLast:!0}],messages:{[uG]:"Prefer `.find(…)` over `.filter(…)`.",[uO]:"Prefer `.find(…)` over `.filter(…)[0]`.",[uV]:"Prefer `.find(…)` over `.filter(…).at(0)`.",[uU]:"Prefer `.find(…)` over `.filter(…).shift()`.",[uq]:"Prefer `.findLast(…)` over `.filter(…).pop()`.",[uW]:"Prefer `.findLast(…)` over `.filter(…).at(-1)`.",[u_]:"Prefer `.findLast(…)` over `.filter(…).slice(-1)`.",[uz]:"Prefer `.find(…)` over destructuring `.filter(…)`.",[uK]:"Prefer `.find(…)` over destructuring `.filter(…)`.",[uJ]:"Replace `.filter(…)` with `.find(…) ?? …`.",[uX]:"Replace `.filter(…)` with `.find(…) || …`."},languages:["js/js"]}},u9="prefer-array-flat-map",u5="prefer-array-flat-map/filter-flat-map",u4="prefer-array-flat-map/filter-flat-map-suggestion",u7=["React.Children","Children"],pe=new i(["ArrowFunctionExpression","AssignmentExpression","ClassExpression","ConditionalExpression","FunctionExpression","ObjectExpression","SequenceExpression","TSAsExpression","TSNonNullExpression","TSSatisfiesExpression","TSTypeAssertion","YieldExpression"]),pt=e=>"ArrowFunctionExpression"===e.type&&!e.async&&!e.returnType&&!e.typeParameters&&1===e.params.length&&"Identifier"===e.params[0].type&&!e.params[0].optional&&!e.params[0].typeAnnotation&&"BlockStatement"!==e.body.type,pr="prefer-array-flat",pn={getArrayNode:e=>e.callee.object,isOptionalArray:e=>e.callee.optional,description:"Array#flatMap()",testFunction(e,t){if(!tw(e,{method:"flatMap",argumentsLength:1,optionalCall:!1}))return!1;let[r]=e.arguments;return"ArrowFunctionExpression"===r.type&&!r.async&&1===r.params.length&&om(r.params[0],r.body)&&!pu(e.callee.object,t)}},po={testFunction(e){if(!tw(e,{method:"reduce",argumentsLength:2,optionalCall:!1}))return!1;let[t,r]=e.arguments;if(!("ArrowFunctionExpression"===t.type&&!t.async&&2===t.params.length&&th(r)))return!1;let n=t.body,[o,a]=t.params;return tw(n,{method:"concat",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&om(o,n.callee.object)&&om(a,n.arguments[0])||"ArrayExpression"===n.type&&2===n.elements.length&&n.elements.every((e,r)=>e?.type==="SpreadElement"&&"Identifier"===e.argument.type&&om(t.params[r],e.argument))},getArrayNode:e=>e.callee.object,isOptionalArray:e=>e.callee.optional,description:"Array#reduce()"},pa={testFunction:e=>tw(e,{method:"concat",argumentsLength:1,allowSpreadElement:!0,optionalCall:!1,optionalMember:!1})&&th(e.callee.object)&&"SpreadElement"===e.arguments[0].type,getArrayNode:e=>e.arguments[0].argument,description:"[].concat()"},pi={testFunction(e){if(!(tw(e,{methods:["apply","call"],argumentsLength:2,allowSpreadElement:!0,optionalCall:!1,optionalMember:!1})&&tL(e.callee.object,{property:"concat"})))return!1;let[t,r]=e.arguments;return th(t)&&("apply"===e.callee.property.name&&"SpreadElement"!==r.type||"call"===e.callee.property.name&&"SpreadElement"===r.type)},getArrayNode(e){let t=e.arguments[1];return"SpreadElement"===t.type?t.argument:t},description:"Array.prototype.concat()"},ps=["_.flatten","lodash.flatten","underscore.flatten"],pl=/^\p{Uppercase_Letter}/u,pu=(e,t)=>{let r,n;return"Identifier"===e.type&&pl.test(e.name)&&(!(r=rq(e,t))||"ArrayExpression"!==r.type&&("NewExpression"!==r.type||"Identifier"!==r.callee.type||"Array"!==r.callee.name))||!!((n=rq(e,t))&&("ObjectExpression"===n.type||"Literal"===n.type||"TemplateLiteral"===n.type||"ArrowFunctionExpression"===n.type||"FunctionExpression"===n.type||"ClassExpression"===n.type||"NewExpression"===n.type&&"Identifier"===n.callee.type&&"Array"!==n.callee.name))},pp={create:function(e){let{functions:t}=e.options[0],r=[...t,...ps],n=[pn,po,pa,pi,{testFunction:e=>tm(e,{argumentsLength:1,optional:!1},tp)&&tB(e.callee,r),getArrayNode:e=>e.arguments[0],description:e=>`${r.find(t=>tF(e.callee,t)).trim()}()`}];e.on("CallExpression",function*(t){for(let{testFunction:r,description:o,getArrayNode:a,shouldSwitchToArray:i,isOptionalArray:s}of n){if(!r(t,e))continue;let n=a(t),l=s?.(t),u={description:"string"==typeof o?o:o(t)},p={node:t,messageId:pr,data:u},{sourceCode:c}=e;c.getCommentsInside(t).length===c.getCommentsInside(n).length&&(p.fix=function(e,t,r,n,o){return"function"==typeof n&&(n=n(e)),function*(a){let{sourceCode:i}=r,s=e4(t,r);n?s=`[${s}]`:!e7(t,i)&&oZ(t,r)&&(s=`(${s})`),s+=`${o?"?":""}.flat()`,oD(i.getTokenBefore(e),r,s)&&(s=`;${s}`),yield a.replaceText(e,s),yield aP(a,e,r)}}(t,n,e,i,l)),yield p}})},meta:{type:"suggestion",docs:{description:"Prefer `Array#flat()` over legacy techniques to flatten arrays.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{functions:{type:"array",uniqueItems:!0,description:"Additional functions to check."}}}],defaultOptions:[{functions:[]}],messages:{[pr]:"Prefer `Array#flat()` over `{{description}}` to flatten an array."},languages:["js/js"]}},pc="some",pd="some-suggestion",pm="filter",pf={create:oK(e=>{e.on("CallExpression",t=>{if(!tw(t,{methods:["find","findLast"],minimumArguments:1,maximumArguments:2,optionalCall:!1,optionalMember:!1})||t.typeArguments||t.typeParameters||nv(t.callee.object,e))return;let r="BinaryExpression"===t.parent.type&&t.parent.left===t&&(["!=","==","===","!=="].includes(t.parent.operator)&&tP(t.parent.right)||("!="===t.parent.operator||"=="===t.parent.operator)&&ti(t.parent.right));if(!r&&!(tq(t,e)||tV(t)||function(e,t){if(!nE(e.callee.object,t))return!1;let r=e.parent;if("VariableDeclarator"!==r.type||r.init!==e||"Identifier"!==r.id.type||r.id.typeAnnotation||"VariableDeclaration"!==r.parent.type||"const"!==r.parent.kind||"ExportNamedDeclaration"===r.parent.parent.type&&r.parent.parent.declaration===r.parent)return!1;let[n]=t.sourceCode.getDeclaredVariables(r);if(!n||1!==n.identifiers.length||n.identifiers[0]!==r.id)return!1;let o=n.references.filter(e=>!e.init);return 0!==o.length&&o.every(e=>{let{identifier:r}=e;return e.isRead()&&(tq(r,t)||tV(r))})}(t,e)))return;let n=t.callee.property,o=r&&r$(e,[e5(t,e)[1],e.sourceCode.getRange(t.parent)[1]]);return{node:n,messageId:pc,data:{method:n.name},suggest:o?void 0:[{messageId:pd,*fix(o){if(yield o.replaceText(n,"some"),!r)return;let{sourceCode:a}=e,i=e5(t,e);yield o.removeRange([i[1],a.getRange(t.parent)[1]]),"!="!==t.parent.operator&&"!=="!==t.parent.operator&&(yield o.insertTextBeforeRange(i,"!"))}}]}}),e.on("BinaryExpression",t=>{let{left:r,right:n,operator:o}=t;if(!(tw(r,{methods:["findIndex","findLastIndex"],argumentsLength:1,optionalCall:!1,optionalMember:!1})&&(["!==","!=",">","===","=="].includes(o)&&"UnaryExpression"===n.type&&"-"===n.operator&&n.argument&&"Literal"===n.argument.type&&1===n.argument.value||[">=","<"].includes(o)&&te(n,0)))||nv(r.callee.object,e))return;let a=r.callee.property;return{node:a,messageId:pc,data:{method:a.name},*fix(n,{abort:i}){let{sourceCode:s}=e,l=s.getTokenAfter(r,e=>"Punctuator"===e.type&&e.value===o),[u]=s.getRange(l),[,p]=s.getRange(t);if(r$(e,[u,p]))return i();["===","==","<"].includes(o)&&(yield n.insertTextBefore(t,"!")),yield n.replaceText(a,"some"),yield n.removeRange([u,p])}}}),e.on("BinaryExpression",t=>{if(!((">"===t.operator||"!=="===t.operator)&&"Literal"===t.right.type&&"0"===t.right.raw&&tT(t.left,{property:"length",optional:!1})&&tw(t.left.object,{method:"filter",optionalCall:!1,optionalMember:!1})))return;let r=t.left.object,n=r.callee.object;if(nv(n,e)||"Identifier"===n.type&&n.name.startsWith("$"))return;let[o]=r.arguments;if(!o||ol(o))return;let a=r.callee.property;return{node:a,messageId:pm,*fix(n,{abort:o}){let{sourceCode:i}=e,s=t.left;if(r$(e,[e5(r,e)[1],i.getRange(t)[1]]))return o();yield n.replaceText(a,"some"),yield a$(n,s,e),yield n.removeRange([e5(s,e)[1],i.getRange(t)[1]])}}})}),meta:{type:"suggestion",docs:{description:"Prefer `.some(…)` over `.filter(…).length` check and `.{find,findLast,findIndex,findLastIndex}(…)`.",recommended:"unopinionated"},fixable:"code",messages:{[pc]:"Prefer `.some(…)` over `.{{method}}(…)`.",[pd]:"Replace `.{{method}}(…)` with `.some(…)`.",[pm]:"Prefer `.some(…)` over non-zero length check from `.filter(…)`."},hasSuggestions:!0,languages:["js/js"]}},pg=(e,t,r=!0)=>({node:e,messageId:`error/${e.name}`,...r&&{suggest:[{messageId:`suggestion/${t}`,fix:r=>r.replaceText(e,t)}]}}),py=new i(["+","-","*","/","%","**","&","|","^","<<",">>",">>>"]),ph=new i(["+","-","~"]),px="preferDefaultParameters",pb="preferDefaultParametersSuggest",pE=new i(["CallExpression","NewExpression","ImportExpression","TaggedTemplateExpression"]),pv=(e,t)=>{if(!t)return!1;if(pE.has(t.type))return!0;for(let r of e.visitorKeys[t.type]){let n=t[r];if(Array.isArray(n)){for(let t of n)if(pv(e,t))return!0}else if(pv(e,n))return!0}return!1},pC="prefer-logical-operator-over-ternary/error",pD="prefer-logical-operator-over-ternary/optional-chain-error",pS="prefer-logical-operator-over-ternary/suggestion",pT="prefer-logical-operator-over-ternary/optional-chain-suggestion",pA=new i(["==","==="]),pw=new i(["!=","!=="]);function pk(e,t,r){if(rC(e,t))return!0;if(e.type!==t.type)return!1;switch(e.type){case"AwaitExpression":return pk(e.argument,t.argument,r);case"LogicalExpression":return e.operator===t.operator&&pk(e.left,t.left,r)&&pk(e.right,t.right,r);case"UnaryExpression":return e.operator===t.operator&&e.prefix===t.prefix&&pk(e.argument,t.argument,r);case"UpdateExpression":return!1}return r.getText(e)===r.getText(t)}function pI({context:e,conditionalExpression:t,left:r,right:n,operators:o=["??","||"]}){return e.sourceCode.getCommentsInside(t).length>0?{node:t,messageId:pC}:{node:t,messageId:pC,suggest:o.map(o=>({messageId:pS,data:{operator:o},fix:a=>(function({fixer:e,context:t,conditionalExpression:r,left:n,right:o,operator:a}){let{sourceCode:i}=t,s=[n,o].map((e,r)=>{let n=e7(e,t),o=n?e4(e,t):i.getText(e);return!n&&o3(e,{operator:a,property:0===r?"left":"right"})&&(o=`(${o})`),o}).join(` ${a} `);return oD(i.getTokenBefore(r),t,s)&&(s=`;${s}`),e.replaceText(r,s)})({fixer:a,context:e,conditionalExpression:t,left:r,right:n,operator:o})}))}}function pj(e){return ti(e)?"null":tP(e)?"undefined":void 0}function pF(e){if("BinaryExpression"!==e.type||!pA.has(e.operator)&&!pw.has(e.operator))return;let t=pj(e.left),r=pj(e.right);if(!!t==!!r)return;let n=pA.has(e.operator);return{reference:t?e.right:e.left,kind:2===e.operator.length?"nullish":t??r,isTrueWhenNullish:n}}let pB=(e,t)=>"null"===e.kind&&"undefined"===t.kind||"undefined"===e.kind&&"null"===t.kind,pR="with-name",pP="without-name",pL="regexp-exec",pN="string-match",p$="string-search",pM="suggestion",pO="string",pU="regexp",pq="other",pV="string-or-other",pW="regexp-or-other",p_="unknown";function*pz(e,{stringNode:t,methodNode:r,regexpNode:n},o){let{sourceCode:a}=o;yield e.replaceText(r,"test");let i=a.getText(t);eK(n,a)||"SequenceExpression"!==t.type||(i=`(${i})`),yield e.replaceText(n,i);let s=a.getText(n);!eK(t,a)&&oZ(n,o)&&(s=`(${s})`),yield e.replaceText(t,s)}let pK=[{type:pL,test:e=>tw(e,{method:"exec",argumentsLength:1,optionalCall:!1,optionalMember:!1}),getNodes:e=>({stringNode:e.arguments[0],methodNode:e.callee.property,regexpNode:e.callee.object}),*fix(e,{methodNode:t}){yield e.replaceText(t,"test")}},{type:pN,test:e=>tw(e,{method:"match",argumentsLength:1,optionalCall:!1,optionalMember:!1}),getNodes:e=>({stringNode:e.callee.object,methodNode:e.callee.property,regexpNode:e.arguments[0]}),fix:pz},{type:p$,test:e=>tw(e,{method:"search",argumentsLength:1,optionalCall:!1,optionalMember:!1}),getNodes:e=>({stringNode:e.callee.object,methodNode:e.callee.property,regexpNode:e.arguments[0]}),fix:pz}],pG=e=>ta(e)||tf(e,{name:"RegExp"}),pJ=e=>{if("[object RegExp]"===Object.prototype.toString.call(e))return e},pX=e=>{if(e.includes(p_))return p_;let t=new i(e),r=t.has(pO)||t.has(pV),n=t.has(pU)||t.has(pW);if(r&&n)return pV;let o=t.has(pq)||t.has(pV)||t.has(pW);return r?o?pV:pO:n?o?pW:pU:pq},pY=e=>{let t=new i(e);return t.has(p_)?p_:t.has(pU)?pU:t.has(pO)?pO:pq},pH=new i(["TSBigIntKeyword","TSBooleanKeyword","TSNeverKeyword","TSNullKeyword","TSNumberKeyword","TSObjectKeyword","TSSymbolKeyword","TSUndefinedKeyword","TSVoidKeyword","TSArrayType","TSTypeLiteral","TSTupleType","TSFunctionType","TSConstructorType"]),pQ=e=>{switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return pQ(e.typeAnnotation);case"TSStringKeyword":return pO;case"TSLiteralType":return"Literal"===e.literal.type&&"string"==typeof e.literal.value?pO:pq;case"TSTypeReference":if("Identifier"!==e.typeName.type)return p_;if("String"===e.typeName.name)return pO;if("RegExp"===e.typeName.name)return pU;if("Array"===e.typeName.name||"ReadonlyArray"===e.typeName.name)return pq;return p_;case"TSUnionType":return pX(e.types.map(e=>pQ(e)));case"TSIntersectionType":return pY(e.types.map(e=>pQ(e)));default:return pH.has(e?.type)?pq:p_}},pZ=(e,t)=>{let r,n;if(r=e,r0.has(r.intrinsicName)||(n=e=t.getNonNullableType(e),r0.has(n.intrinsicName)))return p_;if(e.isTypeParameter?.()){let r=e.getConstraint();return r?pZ(r,t):p_}return e.isUnion()?pX(e.types.map(e=>pZ(e,t))):e.isIntersection()?pY(e.types.map(e=>pZ(e,t))):"string"===e.intrinsicName||e.isStringLiteral?.()?pO:"RegExp"===r2(e)?.getName()||r8(e,t).some(e=>pZ(e,t)===pU)?pU:pq},p0=new i(["ArrayExpression","ArrowFunctionExpression","ClassExpression","FunctionExpression","ObjectExpression"]);function p1(e,t,r=new i){let n;if(pG(e))return pU;if(on(e,t))return pO;switch(e.type){case"Identifier":{let n=((e,t,r)=>{let{sourceCode:n}=t,o=ey(n.getScope(e),e);if(!o||r.has(o)||1!==o.defs.length)return p_;r.add(o);let[a]=o.defs,i=pQ(a.name?.typeAnnotation),s=p_;return i!==p_?s=i:"Variable"===a.type&&"const"===a.parent.kind&&a.node.init&&(s=p1(a.node.init,t,r)),r.delete(o),s})(e,t,r);if(n!==p_)return n;break}case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":{let n=pQ(e.typeAnnotation);return n===p_?p1(e.expression,t,r):n}case"TSNonNullExpression":case"ParenthesizedExpression":return p1(e.expression,t,r);case"SequenceExpression":return p1(e.expressions.at(-1),t,r);case"ConditionalExpression":return pX([p1(e.consequent,t,r),p1(e.alternate,t,r)])}let o=t.sourceCode.getScope(e),a=(n=e$(e,o))?"string"==typeof n.value?pO:pJ(n.value)?pU:void 0===n.value&&("Identifier"===e.type&&"undefined"===e.name||"UnaryExpression"===e.type&&"void"===e.operator)||null===n.value||["bigint","boolean","number","symbol"].includes(typeof n.value)?pq:p_:p_;return a!==p_?a:p0.has(e.type)?pq:((e,t)=>{let{parserServices:r}=t.sourceCode;if(!r?.program)return p_;try{let{program:t}=r;return pZ(r.getTypeAtLocation(e),t.getTypeChecker())}catch{return p_}})(e,t)}let p2=(e,t)=>{let r;return"UnaryExpression"===(r=((e,t)=>{for(;;){if(tN(e.parent)||tU(e.parent,t)&&e.parent.arguments[0]===e){e=e.parent;continue}break}return e})(e,t)).parent.type&&"!"===r.parent.operator&&r.parent.argument===r},p3=(e,[t,r])=>e.getAllComments().some(n=>{let[o,a]=e.getRange(n);return o>=t&&a<=r}),p8=(e,t,r)=>[e5(t,r)[1],r.sourceCode.getRange(e.node)[1]],p6=e=>[{messageId:pM,fix:e}],p9=e=>[pU,pW,pq].includes(e),p5=e=>[pO,pV,pq].includes(e),p4=({type:e,stringType:t,regexpType:r})=>e===pL?p5(r)||p9(t):p9(t)||p5(r),p7=(e,t,r,{lengthCheck:n,searchCheck:o,callExpression:a,isRegExp:i,staticRegExp:s})=>{if(n){((e,t)=>{let{sourceCode:r}=t,n=[[e5(e.lengthNode.object,t)[1],r.getRange(e.lengthNode)[1]]];return e.comparisonLeftNode&&n.push([e5(e.comparisonLeftNode,t)[1],r.getRange(e.node)[1]]),n})(n,r).every(e=>!p3(r.sourceCode,e))&&(e.suggest=p6(t));return}if(!o||!p3(r.sourceCode,p8(o,a,r))){if((({searchCheck:e,isRegExp:t,staticRegExp:r})=>t||r?.global===!1&&(!e||!1===r.sticky))({searchCheck:o,isRegExp:i,staticRegExp:s})){e.fix=t;return}e.suggest=p6(t)}},ce={create:oK(e=>{e.on("CallExpression",function*(t){let r=((e,t)=>{let r,n="ChainExpression"===(r=e.parent).type?r.expression:r;if(!tT(n,{property:"length"})||n.object!==e)return;let o="ChainExpression"===n.parent.type?n.parent:n;if(p2(o,t))return;if(tq(o,t)||tV(o))return{lengthNode:n,node:o};let{parent:a}=o;if(a?.type==="BinaryExpression"&&a.left===o&&">"===a.operator&&te(a.right,0)&&!p2(a,t)&&(tq(a,t)||tV(a)))return{lengthNode:n,node:a,comparisonLeftNode:o}})(t,e),n=(e=>{let{parent:t}=e;if(t?.type!=="BinaryExpression"||t.left!==e)return;let{operator:r,right:n}=t;return["!==","!=",">"].includes(r)&&tk(n)||">="===r&&te(n,0)?{node:t,negate:!1}:["===","=="].includes(r)&&tk(n)||"<"===r&&te(n,0)?{node:t,negate:!0}:void 0})(t);if(r||n||tq(t,e)||tV(t))for(let{type:o,test:a,getNodes:i,fix:s}of pK){if(o===p$!=!!n||!a(t))continue;let l=i(t),{methodNode:u,regexpNode:p}=l,c=e.sourceCode.getScope(p),d=e$(p,c),m=d?pJ(d.value):void 0,f=pG(p);if(p4({type:o,stringType:p1(l.stringNode,e),regexpType:p1(p,e)}))continue;let g={node:o===pL?u:t,messageId:o};p7(g,function*(o){for(let a of(r?(yield a$(o,r.lengthNode,e),r.comparisonLeftNode&&(yield o.removeRange([e5(r.comparisonLeftNode,e)[1],e.sourceCode.getRange(r.node)[1]]))):n&&(n.negate&&(yield o.insertTextBefore(n.node,"!")),yield o.removeRange(p8(n,t,e))),s(o,l,e)))yield a},e,{lengthCheck:r,searchCheck:n,callExpression:t,isRegExp:f,staticRegExp:m}),yield g}})}),meta:{type:"suggestion",docs:{description:"Prefer `RegExp#test()` over `String#match()`, `String#search()`, and `RegExp#exec()`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[pL]:"Prefer `.test(…)` over `.exec(…)`.",[pN]:"Prefer `RegExp#test(…)` over `String#match(…)`.",[p$]:"Prefer `RegExp#test(…)` over `String#search(…)` when checking for existence.",[pM]:"Switch to `RegExp#test(…)`."},languages:["js/js"]}},ct="error",cr="suggestion",cn=["copyWithin","fill","filter","flat","flatMap","map","reverse","sort","splice","toReversed","toSorted","toSpliced","with","split","toArray"],co=["slice","concat"],ca=e=>tw(e.parent.parent,{method:"includes",optionalCall:!1,optionalMember:!1,argumentsLength:1})&&e.parent.object===e,ci=new i(["ForOfStatement","ForStatement","ForInStatement","WhileStatement","DoWhileStatement","FunctionDeclaration","FunctionExpression","ArrowFunctionExpression"]),cs=(e,t,r=new i)=>"ArrayExpression"===e.type||tm(e,{name:"Array",optional:!1},td)||tw(e,{object:"Array",methods:["from","of"],optionalCall:!1,optionalMember:!1})||tw(e,{methods:cn,optionalCall:!1,optionalMember:!1})||tw(e,{methods:co,optionalCall:!1,optionalMember:!1})&&void 0===tn(e.callee.object)&&("Identifier"!==e.callee.object.type||((e,t,r=new i)=>{if("Identifier"!==e.type)return!1;let n=ey(t,e);if(!n||r.has(n)||1!==n.defs.length)return!1;r.add(n);let[o]=n.defs;return"Variable"===o.type&&"const"===o.kind&&!!o.node.init&&cs(o.node.init,t,r)})(e.callee.object,t,r)),cl=e=>Number.isSafeInteger(e)&&e>=0&&e<=0xffffffff,cu=e=>e.some(e=>e?.type==="SpreadElement"),cp=(e,t,r)=>e.getCommentsInside(t).some(t=>{let n,o;return n=e.getRange(t),o=e.getRange(r),!(n[0]>=o[0])||!(n[1]<=o[1])}),cc=(e,t)=>(e?.type==="TSAsExpression"||e?.type==="TSTypeAssertion"||e?.type==="TSNonNullExpression")&&e.expression===t,cd=e=>{let{parent:t}=e;if(!("MemberExpression"===t.type&&t.object===e&&!t.computed&&!t.optional&&"Identifier"===t.property.type&&"length"===t.property.name)||(e=>{let t,r=e;for(;cc(r.parent,r);)r=r.parent;return nL(r)||("ForInStatement"===(t=r).parent.type||"ForOfStatement"===t.parent.type)&&t.parent.left===t})(t))return!1;let r=t.parent;return"CallExpression"!==r.type||r.callee!==t},cm=e=>{let t,r;return"ForOfStatement"===e.parent.type&&e.parent.right===e||(e=>{let{parent:t}=e;return"SpreadElement"===t.type&&t.argument===e&&["ArrayExpression","CallExpression","NewExpression"].includes(t.parent.type)})(e)||tw(t=e.parent.parent,{method:"forEach",optionalCall:!1,optionalMember:!1,argumentsLength:1})&&e.parent.object===e&&"ArrowFunctionExpression"===(r=t.arguments[0]).type&&1===r.params.length&&"RestElement"!==r.params[0].type},cf={create:e=>{let{minimumItems:t}=e.options[0],{sourceCode:r}=e;e.on("Identifier",n=>{let o,{parent:a}=n;if(!((e,t)=>{let{parent:r}=e;return"VariableDeclarator"===r.type&&r.id===e&&!!r.init&&"VariableDeclaration"===r.parent.type&&("ExportNamedDeclaration"!==r.parent.parent.type||r.parent.parent.declaration!==r.parent)&&cs(r.init,t.getScope(r.init))})(n,r))return;if(t>0){var i,s;let e=(i=a.init,s=r.getScope(a.init),"ArrayExpression"===i.type?cu(i.elements)?void 0:i.elements.length:tm(i,{name:"Array",optional:!1},td)?((e,t)=>{if(cu(e.arguments))return;if(1!==e.arguments.length)return e.arguments.length;let r=e$(e.arguments[0],t);if(!r)return;let{value:n}=r;return"number"!=typeof n?1:cl(n)?n:void 0})(i,s):tw(i,{object:"Array",method:"of",optionalCall:!1,optionalMember:!1})?cu(i.arguments)?void 0:i.arguments.length:tw(i,{object:"Array",method:"from",optionalCall:!1,optionalMember:!1})?((e,t)=>{let[r]=e.arguments;if(r&&"SpreadElement"!==r.type){if("ArrayExpression"===r.type)return cu(r.elements)?void 0:r.elements.length;if(void 0!==tn(r)){let e=e$(r,t);return"string"==typeof e?.value?[...e.value].length:void 0}return((e,t)=>{if("ObjectExpression"!==e.type||1!==e.properties.length)return;let[r]=e.properties;if((e=>{if("Property"!==e.type||e.computed)return!1;let{key:t}=e;return"Identifier"===t.type&&"length"===t.name||"Literal"===t.type&&"length"===t.value})(r)){let e=e$(r.value,t);return cl(e?.value)?e.value:void 0}})(r,t)}})(i,s):void 0);if(void 0===e||e<t)return}let l=ey(r.getScope(n),n);if(!l)return;let u=(e=>{let t=[],r=[],n=[];for(let o of e){if(ca(o)){t.push(o);continue}if(cd(o)){r.push(o),n.push(o);continue}if(cm(o)){n.push(o);continue}return}return{includes:t,lengths:r,extra:n}})(rJ(l).filter(e=>e!==n));if(!u||0===u.includes.length||u.extra.length>0&&(o=a.init,!("ArrayExpression"===o.type&&!cu(o.elements)&&o.elements.every(Boolean)&&o.elements.every(t=>{let r;return(r=e$(t,e.sourceCode.getScope(t)))&&rD(r.value)&&!Object.is(r.value,-0)}))||0!==rA(o.elements,e).length)||1===u.includes.length&&!((e,t)=>{let r=t.parent.parent.parent,{parent:n}=e.parent;for(;n&&n!==r;){if(ci.has(n.type))return!0;n=n.parent}return!1})(u.includes[0],n))return;let p={node:n,messageId:ct,data:{name:n.name}},c=n.typeAnnotation&&((e,t)=>{if("TSArrayType"===e.type){if(cp(t,e,e.elementType))return;return`Set<${t.getText(e.elementType)}>`}if("TSTypeOperator"===e.type&&"readonly"===e.operator&&"TSArrayType"===e.typeAnnotation.type){if(cp(t,e,e.typeAnnotation.elementType))return;return`ReadonlySet<${t.getText(e.typeAnnotation.elementType)}>`}if("TSTypeReference"!==e.type||"Identifier"!==e.typeName.type)return;let r=e.typeArguments??e.typeParameters;if(r?.params.length===1&&!cp(t,e,r)){if("Array"===e.typeName.name)return`Set${t.getText(r)}`;if("ReadonlyArray"===e.typeName.name)return`ReadonlySet${t.getText(r)}`}})(n.typeAnnotation.typeAnnotation,r),d=function*(e){for(let t of(c&&(yield e.replaceText(n.typeAnnotation.typeAnnotation,c)),yield e.insertTextBefore(n.parent.init,"new Set("),yield e.insertTextAfter(n.parent.init,")"),u.includes))yield e.replaceText(t.parent.property,"has");for(let t of u.lengths)yield e.replaceText(t.parent.property,"size")};return n.typeAnnotation&&!c?p.suggest=[{messageId:cr,fix:d}]:p.fix=d,p})},meta:{type:"suggestion",docs:{description:"Prefer `Set#has()` over `Array#includes()` when checking for existence or non-existence.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,properties:{minimumItems:{type:"integer",minimum:0,description:"The minimum known array size before `Set#has()` is enforced."}}}],defaultOptions:[{minimumItems:0}],messages:{[ct]:"`{{name}}` should be a `Set`, and use `{{name}}.has()` to check existence or non-existence.",[cr]:"Switch `{{name}}` to `Set`."},languages:["js/js"]}},cg=e=>tw(e.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&e.parent.arguments[0]===e&&tm(e.parent.callee.object,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1},tp),cy="prefer-string-raw",ch="unnecessary-string-raw";function cx(e,t=""){return e.replaceAll(RegExp(String.raw`\\(?<escapedCharacter>[\\${t}])`,"g"),"$<escapedCharacter>")}let cb="prefer-switch",cE=(e,t)=>e===t||rC(e,t),cv=({left:e,right:t})=>[e,t].filter(e=>!("Literal"===e.type||tP(e))),cC=new i(["WhileStatement","DoWhileStatement","ForStatement","ForOfStatement","ForInStatement","SwitchStatement"]),cD=e=>{for(;e.parent;e=e.parent)if(cC.has(e.type))return e},cS=(e,t,r)=>{let{sourceCode:n}=r;return n.getRange(e)[0]>=n.getRange(t)[0]&&n.getRange(e)[1]<=n.getRange(t)[1]},cT={create:e=>{let t={...e.options[0]},{sourceCode:r}=e,n=new i,o=[],a=new i;e.on("IfStatement",e=>{n.add(e)}),e.on("BreakStatement",e=>{e.label||o.push(e)}),e.on("Program:exit",function*(){for(let i of n){if(a.has(i))continue;let{discriminant:n,ifStatements:s}=function(e){let t,r=[];for(;e&&"IfStatement"===e.type;e=e.alternate){let{test:n}=e,o=function(e){let t=[e],r=[];for(;t.length>0;){if("LogicalExpression"===(e=t.pop()).type&&"||"===e.operator){t.push(e.right,e.left);continue}if("BinaryExpression"!==e.type||"==="!==e.operator)return[];r.push(e)}return r}(n);if(0===o.length)break;t||=cv(o[0]);let a=function(e,t){for(let{left:r,right:n}of e)if(0===(t=t.filter(e=>cE(e,r)||cE(e,n))).length)break;return t}(o,t);if(0===a.length)break;t=a,r.push({statement:e,compareExpressions:o})}return{ifStatements:r,discriminant:t&&t[0]}}(i);if(!n||s.length<t.minimumCases)continue;for(let{statement:e}of s)a.add(e);let l={loc:{start:r.getLoc(i).start,end:r.getLoc(i.consequent).start},messageId:cb};!ez(n,r)&&s.every(({statement:t})=>!function(e,t,r){for(let n of e){if(!cS(n,t,r))continue;let e=cD(n);if(!e||cS(t,e,r))return!0}return!1}(o,t,e))&&(l.fix=function({discriminant:e,ifStatements:t},r,n){let{sourceCode:o}=r,a=o.getText(e);return function*(i){let s=t[0].statement,l=rw(s,r);yield i.insertTextBefore(s,`switch (${a}) {`);let u=t.at(-1).statement;if(u.alternate){let{alternate:e}=u;yield i.insertTextBefore(e,`
|
|
31
31
|
${l}default: `)}else switch(n.emptyDefaultCase){case"no-default-comment":yield i.insertTextAfter(s,`
|
|
32
32
|
${l}// No default`);break;case"do-nothing-comment":yield i.insertTextAfter(s,`
|
|
33
33
|
${l}default:
|
|
34
34
|
${l}// Do nothing`)}for(let{statement:r,compareExpressions:n}of(yield i.insertTextAfter(s,`
|
|
35
|
-
${l}}`),t)){let{consequent:t,alternate:a}=r;if(a){let[,e]=o.getRange(t),[r]=o.getRange(a);yield i.removeRange([e,r])}let s=[o.getRange(r)[0],o.getRange(t)[0]];for(let{left:r,right:a}of(yield i.removeRange(s),n)){let n=
|
|
35
|
+
${l}}`),t)){let{consequent:t,alternate:a}=r;if(a){let[,e]=o.getRange(t),[r]=o.getRange(a);yield i.removeRange([e,r])}let s=[o.getRange(r)[0],o.getRange(t)[0]];for(let{left:r,right:a}of(yield i.removeRange(s),n)){let n=cE(r,e)?a:r,s=o.getText(n);yield i.insertTextBefore(t,`
|
|
36
36
|
${l}case ${s}: `)}(function e(t){switch(t.type){case"ReturnStatement":case"ThrowStatement":return!1;case"IfStatement":return!t.alternate||e(t.consequent)||e(t.alternate);case"BlockStatement":{let r=function e(t){let{body:r}=t;for(let t=r.length-1;t>=0;t--){let n=r[t];if("FunctionDeclaration"!==n.type&&"EmptyStatement"!==n.type){if("BlockStatement"===n.type){let t=e(n);if(t)return t;continue}return n}}}(t);return!r||e(r)}default:return!0}})(t)&&(yield function*(e,t,r,n){if("BlockStatement"===e.type){let o=r.getLastToken(e);yield t.insertTextBefore(o,`
|
|
37
37
|
${n}break;
|
|
38
38
|
${n}`)}else yield t.insertTextAfter(e,`
|
|
39
39
|
${n}break;`)}(t,i,o,l),yield function*(e,t,r){e&&"BlockStatement"!==e.type&&(yield t.insertTextBefore(e,`{
|
|
40
40
|
${r}`),yield t.insertTextAfter(e,`
|
|
41
|
-
${r}}`))}(t,i,l))}}}({discriminant:n,ifStatements:s},e,t)),yield l}})},meta:{type:"suggestion",docs:{description:"Prefer `switch` over multiple `else-if`.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{minimumCases:{type:"integer",minimum:2,description:"The minimum number of `if`/`else if` cases before suggesting a `switch` statement."},emptyDefaultCase:{enum:["no-default-comment","do-nothing-comment","no-default-case"],description:"How to handle an empty `default` case."}}}],defaultOptions:[{minimumCases:3,emptyDefaultCase:"no-default-comment"}],messages:{[
|
|
41
|
+
${r}}`))}(t,i,l))}}}({discriminant:n,ifStatements:s},e,t)),yield l}})},meta:{type:"suggestion",docs:{description:"Prefer `switch` over multiple `else-if`.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{minimumCases:{type:"integer",minimum:2,description:"The minimum number of `if`/`else if` cases before suggesting a `switch` statement."},emptyDefaultCase:{enum:["no-default-comment","do-nothing-comment","no-default-case"],description:"How to handle an empty `default` case."}}}],defaultOptions:[{minimumCases:3,emptyDefaultCase:"no-default-comment"}],messages:{[cb]:"Use `switch` instead of multiple `else-if`."},languages:["js/js"]}},cA="require-number-to-fixed-digits-argument";function cw(e){let t=e.match(/^[ \t]*(?=\S)/gm);if(!t)return e;let r=1/0;for(let e of t)r=Math.min(r,e.length);return 0===r||r===1/0?e:e.replace(RegExp(`^[ \\t]{${r}}`,"gm"),"")}let ck=/^(?:( )+|\t+)/,cI="space";function cj(e,t){let r,n,a=new o,i=0;for(let o of e.split(/\n/g)){if(!o)continue;let e=o.match(ck);if(null===e)i=0,r="";else{let o=e[0].length,s=e[1]?cI:"tab";if(t&&s===cI&&1===o)continue;s!==r&&(i=0),r=s;let l=1,u=0,p=o-i;if(i=o,0===p)l=0,u=1;else{let e=Math.abs(p);if(t&&s===cI&&1===e)continue;n=(s===cI?"s":"t")+String(e)}let c=a.get(n);a.set(n,void 0===c?[1,0]:[c[0]+l,c[1]+u])}}return a}function cF(e){let t;if("string"!=typeof e)throw TypeError("Expected a string");let r=cj(e,!0);0===r.size&&(r=cj(e,!1));let n=function(e){let t,r=0,n=0;for(let[o,[a,i]]of e)(a>r||a===r&&i>n)&&(r=a,n=i,t=o);return t}(r),o=0,a="";if(void 0!==n){var i,s;({type:t,amount:o}={type:"s"===n[0]?cI:"tab",amount:Number(n.slice(1))}),i=t,s=o,a=(i===cI?" ":" ").repeat(s)}return{amount:o,type:t,indent:a}}let cB="template-indent",cR=(e,t=new i)=>e.map((e,r)=>t.has(r+1)||""===e.trim()?"":e).join("\n"),cP=[{type:"object",additionalProperties:!1,properties:{indent:{oneOf:[{type:"string",pattern:/^\s+$/.source,description:"Whitespace string to use as indentation."},{type:"integer",minimum:1,description:"Number of spaces to use as indentation."}],description:"The indentation to use inside the template literal."},tags:{type:"array",uniqueItems:!0,items:{type:"string"},description:"Tagged template names to check."},functions:{type:"array",uniqueItems:!0,items:{type:"string"},description:"Function names whose template literal arguments to check."},selectors:{type:"array",uniqueItems:!0,items:{type:"string"},description:"AST selectors for template literals to check."},comments:{type:"array",uniqueItems:!0,items:{type:"string"},description:"Comment patterns to mark template literals for checking."}}}],cL="no-await-in-promise-methods/error",cN="no-await-in-promise-methods/suggestion",c$=["all","allSettled","any","race"],cM="no-negation-in-equality-check/error",cO="no-negation-in-equality-check/suggestion",cU=new i(["===","!==","==","!="]),cq=e=>"UnaryExpression"===e.type&&e.prefix&&"!"===e.operator;function cV(e,{methods:t,messageId:r}){e.on("CallExpression",n=>{if(!tw(n,{methods:t,argumentsLength:2,optionalCall:!1}))return;let o=n.arguments[1],a=function(e,t){if("Identifier"===e.type&&"Infinity"===e.name)return"Infinity";if(tT(e,{object:"Number",property:"POSITIVE_INFINITY",computed:!1,optional:!1}))return"Number.POSITIVE_INFINITY";let r="ChainExpression"===e.type;if(r&&(e=e.expression),tT(e,{property:"length",computed:!1})&&rC(t,e.object))return`${"Identifier"===t.type?t.name:"…"}${r?"?.":"."}length`}(o,n.callee.object);if(!a)return;let i=n.callee.property.name,s={description:a};return"splice"===i?s.argumentName="deleteCount":"toSpliced"===i&&(s.argumentName="skipCount"),{node:o,messageId:r,data:s,fix:t=>aw(t,o,e)}})}let cW="no-unnecessary-slice-end",c_="catch-error-name",cz={create:e=>{let t=e.options[0],{name:r}=t,n=t.ignore.map(e=>E.isRegExp(e)?e:RegExp(e,"u")),o=e=>e===r||n.some(t=>t.test(e))||e.endsWith(r)||e.endsWith(an(r));e.on("Identifier",t=>{if(("CatchClause"!==t.parent.type||t.parent.param!==t)&&!(("FunctionExpression"===t.parent.type||"ArrowFunctionExpression"===t.parent.type)&&t.parent.params[0]===t&&(tw(t.parent.parent,{method:"then",argumentsLength:2,optionalCall:!1})||tw(t.parent.parent,{method:"catch",argumentsLength:1,optionalCall:!1}))&&t.parent.parent.arguments.at(-1)===t.parent))return;let n=t.name;if(o(n)||o(n.replaceAll(/_+$/g,"")))return;let a=ey(e.sourceCode.getScope(t),t);if(!a||"_"===n&&0===a.references.length)return;let i=ry(r,[a.scope,...a.references.map(({from:e})=>e)]),s={node:t,messageId:c_,data:{originalName:n,fixedName:i||r}};return i&&(s.fix=t=>aq(a,i,e,t)),s})},meta:{type:"suggestion",docs:{description:"Enforce a specific parameter name in catch clauses.",recommended:!0},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{name:{type:"string",description:"The expected name for the error variable."},ignore:{type:"array",uniqueItems:!0,description:"Patterns to ignore."}}}],defaultOptions:[{name:"error",ignore:[]}],messages:{[c_]:"The catch parameter `{{originalName}}` should be named `{{fixedName}}`."},languages:["js/js"]}},cK="invalidExport",cG="doNotPassMessageToSuper",cJ="doNotAssignMessageWithoutSetter",cX="missingOptionsParameter",cY="invalidOptionsParameter",cH="passMessageToSuper",cQ="passOptionsToSuper",cZ=/^(?:[A-Z][\da-z]*)*Error$/,c0=e=>`
|
|
42
42
|
name = '${e}';
|
|
43
|
-
`,c0=e=>{var t;let r=(t=e.superClass,t?.type==="Identifier"?t.name:t?.type!=="MemberExpression"||t.computed||"Identifier"!==t.property.type?void 0:t.property.name);return!!r&&cQ.test(r)},c1=e=>"ExpressionStatement"===e.type&&"CallExpression"===e.expression.type&&tj(e.expression.callee,"super"),c2=(e,t)=>"ExpressionStatement"===e.type&&"AssignmentExpression"===e.expression.type&&"="===e.expression.operator&&tj(e.expression.left,`this.${t}`),c3=(e,t)=>({node:e,message:`The \`name\` property should be set to \`${t}\`.`}),c8=(e,t)=>tr(e?.value)===t,c6=(e,t)=>"MethodDefinition"===e.type&&e.kind===t&&!e.static&&!e.computed&&"Identifier"===e.key.type&&"message"===e.key.name,c9=e=>e?.type==="Identifier"?e:e?.type==="AssignmentPattern"&&"Identifier"===e.left.type?e.left:void 0,c5=e=>c9(e)?.name==="options",c4=(e,t)=>{if("ThisExpression"===e.type||"Super"===e.type)return!0;for(let r of t[e.type]??[]){let n=e[r];if(n){if(Array.isArray(n)){if(n.some(e=>e&&c4(e,t)))return!0;continue}if(c4(n,t))return!0}}return!1},c7=e=>{let t=c9(e);return t.typeAnnotation?t.optional?"options?: ErrorOptions":"options: ErrorOptions":"options"},de=(e,t,r)=>n=>{let o=t.arguments;if(0===o.length){let o=e.getTokenAfter(t.callee,e=>"("===e.value);return n.insertTextAfter(o,`${r}, options`)}if(1===o.length){let e;return"undefined"!==r&&(!(e=o[0])||tR(e))?n.replaceText(o[0],`${r}, options`):n.insertTextAfter(o[0],", options")}},dt=(e,t)=>e?.type==="Identifier"&&e.name===t.name;function*dr(e,t){if(!c0(t)||null===t.id)return;let{name:r}=t.id,n=ar(r).replace(/(?:error)?$/i,"Error");r!==n&&(yield{node:t.id,message:`Invalid class name, use \`${n}\`.`});let{body:o}=t.body,{sourceCode:a}=e,i=o.find(e=>"constructor"===e.kind),s=o.find(e=>"PropertyDefinition"===e.type&&!e.static&&!e.computed&&"Identifier"===e.key.type&&"name"===e.key.name);if(!i){if(c8(s,r))return;let e=a.getRange(t.body);yield{...c3(s?.value??t,r),fix:t=>s?.value?t.replaceText(s.value,`'${r}'`):s?t.replaceText(s,cZ(r).trim()):t.insertTextAfterRange([e[0],e[0]+1],cZ(r))};return}let l=o.some(e=>c6(e,"get")),u=o.some(e=>c6(e,"set"));yield*function*(e,t,r){let{sourceCode:n}=e,o=t.value.body;if(!o)return;let a=o.body,{hasMessageGetter:i,hasMessageSetter:s,checkOptions:l}=r,u=a.find(e=>c1(e)),p=a.findIndex(e=>c1(e)),c=a.findIndex(e=>c2(e,"message")),d=i||s,m=!1;if(u){let r;if(d&&!(!(r=u.expression.arguments[0])||tR(r)))m=!0,yield{node:u,messageId:cK};else if(i&&!s&&-1!==c)m=!0,yield{node:a[c],messageId:cG};else if(!s&&-1!==c){let r=a[c];m=!0,yield{node:u,message:"Pass the error message to `super()` instead of setting `this.message`.",*fix(i){let s=r.expression.right,[l,d]=t.value.params,m=c9(l),f=1===t.value.params.length&&m&&!c5(l),g=f||c5(d);if(0===u.expression.arguments.length){if(c!==p+1||c4(s,n.visitorKeys))return;let[t]=n.getRange(u);yield i.insertTextAfterRange([t,t+6],g?`${e5(s,e)}, options`:e5(s,e))}else{let e;if(e=u.expression.arguments[0],n.getText(e)!==n.getText(s))return;g&&1===u.expression.arguments.length&&(yield i.insertTextAfter(u.expression.arguments[0],", options"))}f&&(yield i.insertTextAfter(l,`, ${c7(l)}`));let y=0===c?n.getRange(o)[0]:n.getRange(a[c-1])[1],[,h]=n.getRange(r);yield i.removeRange([y,h])}}}}else m=!0,yield{node:o,message:"Missing call to `super()` in constructor."};let f=function(e,t,r){let{name:n,nameProperty:o}=r,a=t.find(e=>c2(e,"name"));return a?tr(a.expression.right)!==n?c3(a.expression.right??e,n):void 0:c8(o,n)?void 0:c3(o?.value??e,n)}(o,a,r);if(f&&(yield f),!f&&l&&!m){let r=((e,t,r,n)=>{let o=t.value.params,a=o[0],i=c9(a);if(0===o.length||!i)return;let s=r.expression;if(c5(a)){if(!c5(s.arguments[1])){let t={node:s,messageId:cH};return dt(s.arguments[0],i)||(t.fix=de(e.sourceCode,s,"undefined")),t}return}let l=o[1],u=!n&&"message"===i.name,p=u?i.name:"undefined";if(!l){if(((e,t)=>{if(t)return!1;let[r,n]=e.arguments;return 2===e.arguments.length&&void 0!==tr(r)&&"ObjectExpression"===n.type&&1===n.properties.length&&"cause"===eM(n.properties[0])})(s,u))return;return{node:a,messageId:cJ,fix:function*(r){let{sourceCode:n}=e,o=de(n,s,p)(r);if(!o)return;let a=t.value.params[0];yield r.insertTextAfter(a,`, ${c7(a)}`),yield o}}}if(!c5(l))return{node:l,messageId:cX};if(u&&!dt(s.arguments[0],i)){let t;return{node:s,messageId:cY,fix:(t=e.sourceCode,e=>{let r,n=s.arguments;if(0===n.length){let r=t.getTokenAfter(s.callee,e=>"("===e.value);return e.insertTextAfter(r,`${p}, options`)}if(!(r=n[0])||tR(r))return e.replaceText(n[0],1===n.length?`${p}, options`:p)})}}if(!c5(s.arguments[1]))return{node:s,messageId:cH,fix:de(e.sourceCode,s,p)}})(e,t,u,d);r&&(yield r)}}(e,i,{name:r,nameProperty:s,hasMessageGetter:l,hasMessageSetter:u,checkOptions:r===n})}let dn="no-lonely-if",da=e=>"IfStatement"===e.type&&!e.alternate;function di(e,t){let r={ifToken:t.getFirstToken(e),openingParenthesisToken:t.getFirstToken(e,1)},{consequent:n}=e;return r.closingParenthesisToken=t.getTokenBefore(n),"BlockStatement"===n.type&&(r.openingBraceToken=t.getFirstToken(n),r.closingBraceToken=t.getLastToken(n)),r}let ds=(e,t,r)=>r.text.slice(r.getRange(e)[1],r.getRange(t)[0]),dl=e=>e.trim()?e:"",du=(e,t)=>/\s$/u.test(e)&&/^\s/u.test(t)?e+t.trimStart():e+t,dp=(e,t)=>ds(e.ifToken,e.openingParenthesisToken,t),dc=(e,t,r)=>{let n,o=ds(e.openingParenthesisToken,e.closingParenthesisToken,r);return e4(e.test,t)?o:"LogicalExpression"===(n=e.test).type&&("||"===n.operator||"??"===n.operator)||"ConditionalExpression"===n.type||"AssignmentExpression"===n.type||"YieldExpression"===n.type||"SequenceExpression"===n.type?`(${o})`:o},dd="no-magic-array-flat-depth",dm="no-negated-condition",df="identifier",dg="non-identifier",dy="prefer-negative-index",dh=new o([["slice",{argumentsIndexes:[0,1],supportObjects:new i(["Array","String","ArrayBuffer",...rQ])}],["subarray",{argumentsIndexes:[0,1],supportObjects:new i(rQ)}],["splice",{argumentsIndexes:[0],supportObjects:new i(["Array"])}],["toSpliced",{argumentsIndexes:[0],supportObjects:new i(["Array"])}],["at",{argumentsIndexes:[0],supportObjects:new i(["Array","String",...rQ])}]]),dx=e=>{let{type:t,property:r}=e;if("MemberExpression"===t&&"Identifier"===r.type)return r.name};var db=["node:assert","assert","node:assert/strict","assert/strict","node:async_hooks","async_hooks","node:buffer","buffer","node:child_process","child_process","node:cluster","cluster","node:console","console","node:constants","constants","node:crypto","crypto","node:dgram","dgram","node:diagnostics_channel","diagnostics_channel","node:dns","dns","node:dns/promises","dns/promises","node:domain","domain","node:events","events","node:ffi","node:fs","fs","node:fs/promises","fs/promises","node:http","http","node:http2","http2","node:https","https","node:inspector","inspector","node:inspector/promises","inspector/promises","node:module","module","node:net","net","node:os","os","node:path","path","node:path/posix","path/posix","node:path/win32","path/win32","node:perf_hooks","perf_hooks","node:process","process","node:querystring","querystring","node:quic","node:readline","readline","node:readline/promises","readline/promises","node:repl","repl","node:sea","node:sqlite","node:stream","stream","node:stream/consumers","stream/consumers","node:stream/iter","stream/iter","node:stream/promises","stream/promises","node:stream/web","stream/web","node:string_decoder","string_decoder","node:test","node:test/reporters","node:timers","timers","node:timers/promises","timers/promises","node:tls","tls","node:trace_events","trace_events","node:tty","tty","node:url","url","node:util","util","node:util/types","util/types","node:v8","v8","node:vm","vm","node:wasi","wasi","node:worker_threads","worker_threads","node:zlib","zlib","node:zlib/iter","zlib/iter"];function dE(t){if("string"!=typeof t)throw TypeError("Expected a string");return(e??=new i(db)).has(t)}let dv="prefer-node-protocol",dC="node:",dD="consistent-date-clone/error",dS="no-accessor-recursion/error",dT=e=>"Identifier"===e.type||"PrivateIdentifier"===e.type,dA=(e,t)=>["type","name"].every(r=>e[r]===t[r]),dw=(e,t)=>"MemberExpression"===e.parent.type&&e.parent.object===e&&!e.parent.computed&&dT(e.parent.property)&&dA(e.parent.property,t.key),dk="error/calculate-dirname",dI="error/calculate-filename";function dj(e,{modules:t,functionName:r,sourceCode:n}){if(!td(e,{optional:!1,argumentsLength:1},tu))return!1;let o=new i;return function e(t,i){if("MemberExpression"===t.type)return!!("property"===i&&tS(t,{property:r,computed:!1,optional:!1}))&&e(t.object,"module");if("CallExpression"===t.type)return"module"===i&&tA(t,{object:"process",method:"getBuiltinModule",argumentsLength:1,optionalMember:!1,optionalCall:!1})&&a(t.arguments[0]);if("Identifier"!==t.type||o.has(t))return!1;o.add(t);let s=eg(n.getScope(t),t);return!!s&&1===s.defs.length&&function(t,n){if("ImportBinding"===t.type){if(!a(t.parent.source))return!1;let e=t.node;return"module"===n?e?.type==="ImportDefaultSpecifier"||e?.type==="ImportNamespaceSpecifier":e?.type==="ImportSpecifier"&&e.imported.name===r}return"Variable"===t.type&&function t(n,o){let{parent:a}=n;return"VariableDeclarator"===a.type?!!a.init&&a.id===n&&"VariableDeclaration"===a.parent.type&&"const"===a.parent.kind&&e(a.init,o):"Property"===a.type&&!!("property"===o&&a.value===n&&!a.computed&&"Identifier"===a.key.type&&a.key.name===r)&&t(a.parent,"module")}(t.name,n)}(s.defs[0],i)}(e.callee,"property");function a(e){return e?.type==="Literal"&&t.has(e.value)}}function dF(e,t){return dj(e,{modules:new i(["url","node:url"]),functionName:"fileURLToPath",sourceCode:t})}function dB(e,t){return dj(e,{modules:new i(["path","node:path"]),functionName:"dirname",sourceCode:t})}let dR="no-unnecessary-array-flat-depth",dP="no-unnecessary-array-splice-count",dL="no-useless-error-capture-stack-trace/error",dN="prefer-class-fields/error",d$="prefer-class-fields/suggestion",dM="prefer-bigint-literals/error",dO="prefer-bigint-literals/suggestion",dU="prefer-classlist-toggle/error",dq="prefer-classlist-toggle/suggestion",dV=e=>tS(e,{property:"classList",computed:!1}),dW=(e,t,r)=>{let n={node:r??e,messageId:dU};return"IfStatement"===e.type||tx(e)||tx(e.parent)?n.fix=t:n.suggest=[{messageId:dq,fix:t}],n},d_=(e,t,r)=>{let{sourceCode:n}=t,o=e5(e,t);return r?(!e4(e,n)&&o1(e,"!")&&(o=`(${o})`),o=`!${o}`):(e4(e,n)||"SequenceExpression"!==e.type||(o=`(${o})`),o)},dz=(e,t)=>tA(e,{methods:t,argumentsLength:1,optionalCall:!1,optionalMember:!1})&&dV(e.callee.object),dK=(e,t)=>rv(e.callee.object,t.callee.object)&&rv(e.arguments[0],t.arguments[0]),dG=(e,t,r)=>t?("ChainExpression"===e.type&&(e=e.expression),dz(e,["contains"])&&dK(e,r))?e:void 0:"UnaryExpression"===e.type&&"!"===e.operator&&e.prefix?dG(e.argument,!t,r):void 0,dJ="require-module-attributes",dX="error",dY="suggestion/array",dH="suggestion/object",dQ="suggestion/object-assign",dZ="suggestion/set",d0="suggestion/map",d1=(e,t,r)=>{let{sourceCode:n}=r,o=rG(e);return t.some(e=>{let t=n.getRange(e);return o.some(e=>{let[r,o]=n.getRange(e);return r>=t[0]&&o<=t[1]})})};function d2(e,t){if(!tm(e,{names:t,maximumArguments:1}))return!1;let[r]=e.arguments;return!r||"ArrayExpression"===r.type}function*d3(e,t,r){let n=!eb(t.sourceCode.getTokenBefore(e));yield aM(e,t,r,n)}function d8(e,t,r,n){let{sourceCode:o}=e,[a,i]=o.getLastTokens(r,2),s=("ArrayExpression"===r.type?r.elements:r.properties).length>0&&!ex(a);return t.insertTextBefore(i,`${s?",":""} ${n}`)}function*d6({context:e,fixer:t,newExpression:r,elementsText:n,nextExpressionStatement:o}){if(ry(r,e)){let[o]=r.arguments;if(o)yield d8(e,t,o,n);else{let{openingParenthesisToken:o}=ry(r,e)?rh(r,e):{};yield t.insertTextAfter(o,`[${n}]`)}}else yield t.insertTextAfter(r,`([${n}])`);yield*d3(o,e,t)}let d9=[{testValue:e=>e?.type==="ArrayExpression",getProblematicNode({context:e,variable:t,nextExpressionStatement:r}){let n=r.expression;if(tA(n,{object:t.name,methods:["push","unshift"],optionalMember:!1,optionalCall:!1})&&n.arguments.length>0&&!d1(t,n.arguments,e))return n},getProblem(e,t){let{context:r,assignType:n,getFix:o}=t,{sourceCode:a}=r,i=e.callee,s=i.property,l={node:i,messageId:dX,data:{objectType:"array"}},u="unshift"===s.name,p=o(t,{callExpression:e,isPrepend:u});return e.arguments.some(e=>e_(e,a))?l.suggest=[{messageId:dY,fix:p,data:{operation:u?"Prepend":"Append",assignType:n}}]:l.fix=p,l},getFix:({context:e,valueNode:t,nextExpressionStatement:r},{callExpression:n,isPrepend:o})=>function*(a){let i=rx(e,n,!1);yield o?a.insertTextAfter(e.sourceCode.getFirstToken(t),`${i}, `):d8(e,a,t,i),yield d3(r,e,a)}},{testValue:e=>e?.type==="ObjectExpression",getProblematicNode({context:e,variable:t,nextExpressionStatement:r}){let n=r.expression;if(!("AssignmentExpression"===n.type&&"="===n.operator&&tS(n.left,{object:t.name,optional:!1})))return;let o=n.right,a=n.left,{property:i}=a;if(!d1(t,a.computed?[i,o]:[o],e))return n},getProblem(e,t){let{context:r,assignType:n,getFix:o}=t,{sourceCode:a}=r,{left:i,right:s}=e,{property:l}=i,u=a.getTokenAfter(i,t=>"Punctuator"===t.type&&t.value===e.operator),p={node:e,loc:{start:a.getLoc(e).start,end:a.getLoc(u).end},messageId:dX,data:{objectType:"object"}},c=o(t,{assignmentExpression:e,memberExpression:i,property:l,value:s});return i.computed&&e_(l,a)||e_(s,a)?p.suggest=[{messageId:dH,data:{assignType:n},fix:c}]:p.fix=c,p},getFix:({context:e,valueNode:t,nextExpressionStatement:r},{memberExpression:n,property:o,value:a})=>function*(i){let s=e5(o,e);n.computed&&(s=`[${s}]`);let l=e5(a,e),u=`${s}: ${l},`,[p,c]=e.sourceCode.getLastTokens(t,2),d=t.properties.length>0&&!ex(p);yield i.insertTextBefore(c,`${d?",":""} ${u}`),yield d3(r,e,i)}},{testValue:e=>e?.type==="ObjectExpression",getProblematicNode({context:e,variable:t,nextExpressionStatement:r}){let n=r.expression;if(!tA(n,{object:"Object",method:"assign",minimumArguments:2,optionalMember:!1,optionalCall:!1}))return;let[o,a]=n.arguments;if(!("Identifier"!==o.type||o.name!==t.name||"SpreadElement"===a.type||d1(t,[a],e)))return n},getProblem(e,t){let{context:r,assignType:n,getFix:o}=t,{sourceCode:a}=r,[,i]=e.arguments,s={node:e.callee,messageId:dX,data:{objectType:"object"}},l=o(t,{callExpression:e,firstValue:i});return e_(i,a)?s.suggest=[{messageId:dQ,data:{description:"ObjectExpression"===i.type?"Move properties to":"Spread properties in",assignType:n},fix:l}]:s.fix=l,s},getFix:({context:e,valueNode:t,nextExpressionStatement:r},{callExpression:n,firstValue:o})=>function*(a){let i;("ObjectExpression"===o.type?o.properties.length>0&&(i=function(e,t){let{sourceCode:r}=t,n=r.getFirstToken(e),[o,a]=r.getLastTokens(e,2),[,i]=r.getRange(n),[s]=r.getRange(ex(o)?o:a);return r.text.slice(i,s)}(o,e)):i=`...${e5(o,e)}`,i&&(yield d8(e,a,t,i)),2!==n.arguments.length)?yield aA(a,o,e):yield d3(r,e,a)}},{testValue:e=>d2(e,["Set","WeakSet"]),getProblematicNode({context:e,variable:t,nextExpressionStatement:r}){let n=r.expression;if(("ChainExpression"===n.type&&(n=n.expression),tA(n,{object:t.name,method:"add",argumentsLength:1,optionalMember:!1,optionalCall:!1}))&&!d1(t,n.arguments,e))return n},getProblem(e,t){let{context:r,assignType:n,valueNode:o,getFix:a}=t,{sourceCode:i}=r,s={node:e.callee,messageId:dX,data:{objectType:`\`${o.callee.name}\``}},l=a(t,{callExpression:e,newExpression:o});return e.arguments.some(e=>e_(e,i))?s.suggest=[{messageId:dZ,data:{assignType:n},fix:l}]:s.fix=l,s},getFix:({context:e,nextExpressionStatement:t},{callExpression:r,newExpression:n})=>o=>{let a=rx(e,r,!1);return d6({context:e,fixer:o,newExpression:n,elementsText:a,nextExpressionStatement:t})}},{testValue:e=>d2(e,["Map","WeakMap"]),getProblematicNode({context:e,variable:t,nextExpressionStatement:r}){let n=r.expression;if(tA(n,{object:t.name,method:"set",argumentsLength:2,optionalCall:!1})&&!d1(t,n.arguments,e))return n},getProblem(e,t){let{context:r,assignType:n,valueNode:o,getFix:a}=t,{sourceCode:i}=r,s={node:e.callee,messageId:dX,data:{objectType:`\`${o.callee.name}\``}},l=a(t,{callExpression:e,newExpression:o});return e.arguments.some(e=>e_(e,i))?s.suggest=[{messageId:d0,data:{assignType:n},fix:l}]:s.fix=l,s},getFix:({context:e,nextExpressionStatement:t},{callExpression:r,newExpression:n})=>o=>{let a=rx(e,r,!1);return d6({context:e,fixer:o,newExpression:n,elementsText:`[${a}]`,nextExpressionStatement:t})}}],d5="no-useless-collection-argument/error",d4="no-useless-collection-argument/suggestion",d7="prefer-response-static-json",me=/([\p{Ll}\d])(\p{Lu})/gu,mt=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,mr=/(\d)\p{Ll}|(\p{L})\d/u,mn=/[^\p{L}\d]+/giu,mo="$1\0$2";function ma(e){let t=e.trim();t=(t=t.replace(me,mo).replace(mt,mo)).replace(mn,"\0");let r=0,n=t.length;for(;"\0"===t.charAt(r);)r++;if(r===n)return[];for(;"\0"===t.charAt(n-1);)n--;return t.slice(r,n).split(/\0/g)}function mi(e){let t=ma(e);for(let e=0;e<t.length;e++){let r=t[e],n=mr.exec(r);if(n){let o=n.index+(n[1]??n[2]).length;t.splice(e,1,r.slice(0,o),r.slice(o))}}return t}function ms(e,t){let[r,n,o]=mm(e,t);return r+n.map(mp(t?.locale)).join(t?.delimiter??" ")+o}function ml(e,t){var r,n;let[o,a,i]=mm(e,t),s=mp(t?.locale),l=mc(t?.locale),u=t?.mergeAmbiguousCharacters?(r=s,n=l,e=>`${n(e[0])}${r(e.slice(1))}`):md(s,l);return o+a.map((e,t)=>0===t?s(e):u(e,t)).join(t?.delimiter??"")+i}function mu(e,t){let[r,n,o]=mm(e,t),a=md(mp(t?.locale),mc(t?.locale));return r+n.map(a).join("")+o}function mp(e){return!1===e?e=>e.toLowerCase():t=>t.toLocaleLowerCase(e)}function mc(e){return!1===e?e=>e.toUpperCase():t=>t.toLocaleUpperCase(e)}function md(e,t){return(r,n)=>{let o=r[0];return(n>0&&o>="0"&&o<="9"?"_"+o:t(o))+e(r.slice(1))}}function mm(e,t={}){let r=t.split??(t.separateNumbers?mi:ma),n=t.prefixCharacters??"",o=t.suffixCharacters??"",a=0,i=e.length;for(;a<e.length;){let t=e.charAt(a);if(!n.includes(t))break;a++}for(;i>a;){let t=i-1,r=e.charAt(t);if(!o.includes(r))break;i=t}return[e.slice(0,a),r(e.slice(a,i)),e.slice(i)]}let mf="filename-case",mg="directory-case",my="filename-extension",mh=e=>!/^[\w-]$/.test(e),mx=new i(["index.js","index.mjs","index.cjs","index.ts","index.tsx","index.vue"]),mb=new Intl.ListFormat("en-US",{type:"disjunction"}),mE=/^[\da-z]+$/i,mv=/^[A-Z]{3,}(?=\d*[A-Z](?:[a-z]|\d+[a-z]))/,mC=e=>e>="0"&&e<="9",mD=e=>e>="a"&&e<="z",mS=e=>e>="A"&&e<="Z",mT={camelCase:{fn:ml,name:"camel case"},camelCaseWithAcronyms:{fn:function(e){return!function(e){if(!mD(e[0]))return!1;for(let t=1;t<e.length;t++){let r=e[t];if(mD(r)||mC(r))continue;if(!mS(r))return!1;let n=t;for(;mS(e[t+1]);)t++;if(t!==n){if(mD(e[t+1])){t--;continue}for(;mC(e[t+1]);)t++;if(t===e.length-1)return!0;if(!mS(e[t+1]))return!1}}return!0}(e)?ml(e):e},name:"camel case with acronyms"},kebabCase:{fn:function(e,t){return ms(e,{delimiter:"-",...t})},name:"kebab case"},snakeCase:{fn:function(e,t){return ms(e,{delimiter:"_",...t})},name:"snake case"},pascalCase:{fn:function(e){if(mE.test(e)){let t=mv.exec(e)?.[0],r=t&&e.slice(t.length);if(r&&mu(r)===r)return e}return mu(e)},name:"pascal case"}};function mA(e,t){return e.filter(({ignored:e})=>!e).every(({word:e})=>t.some(t=>t(e)===e))}function mw(e,t,{leading:r,trailing:n}){let{samples:o}=function(e,t=1/0){let r=e.reduce((e,{length:t})=>e*t,1),n=Array.from({length:Math.min(r,t)},(t,r)=>{let n=r,o=[];for(let t=e.length-1;t>=0;t--){let r=e[t],{length:a}=r,i=n%a;n=(n-i)/a,o.unshift(r[i])}return o});return{total:r,samples:n}}(e.map(({word:e,ignored:r})=>r?[e]:t.map(t=>t(e))));return[...new i(o.map(e=>`${r}${e.join("")}${n}`))]}let mk=/^(?<leading>_+)(?<tailing>.*)$/;function mI(e){let t,{leading:r="",tailing:n=e}=(mk.exec(e)||{groups:{}}).groups,o=[];for(let e of n){let r=mh(e);t?.ignored===r?t.word+=e:(t={word:e,ignored:r},o.push(t))}return{leading:r,words:o}}function mj(e){let t;return t=e.map(e=>mT[e].name),mb.format(t)}let mF=[{description:"The rule options.",anyOf:[{properties:{case:{enum:["camelCase","camelCaseWithAcronyms","snakeCase","kebabCase","pascalCase"],description:"The filename and directory name case style."},ignore:{type:"array",uniqueItems:!0,description:"Path segment patterns to ignore."},multipleFileExtensions:{type:"boolean",description:"Whether to treat additional, dot-separated parts of a filename as file extensions."},checkDirectories:{type:"boolean",description:"Whether to check directory names."}},additionalProperties:!1},{properties:{cases:{properties:{camelCase:{type:"boolean",description:"Whether to allow camelCase filenames and directory names."},camelCaseWithAcronyms:{type:"boolean",description:"Whether to allow camelCase filenames and directory names with acronym segments."},snakeCase:{type:"boolean",description:"Whether to allow snake_case filenames and directory names."},kebabCase:{type:"boolean",description:"Whether to allow kebab-case filenames and directory names."},pascalCase:{type:"boolean",description:"Whether to allow PascalCase filenames and directory names."}},additionalProperties:!1,description:"The allowed filename and directory name case styles."},ignore:{type:"array",uniqueItems:!0,description:"Path segment patterns to ignore."},multipleFileExtensions:{type:"boolean",description:"Whether to treat additional, dot-separated parts of a filename as file extensions."},checkDirectories:{type:"boolean",description:"Whether to check directory names."}},additionalProperties:!1}]}],mB="consistent-template-literal-escape",mR=["entries","keys","values"],mP=["drop","filter","flatMap","map","take"],mL=["concat","from","zip","zipKeyed"],mN=new i(["ArrayIterator","Generator","IterableIterator","Iterator","IteratorObject","MapIterator","RegExpStringIterator","SetIterator"]),{isTarget:m$}=ng({checkClassHeritage:!1,preferTypeReferenceDefinitions:!0,targetTypeNames:mN}),mM=e=>{for(;rk(e)||"ChainExpression"===e.type||"ParenthesizedExpression"===e.type;)e=e.expression;return e},mO="iterable-accepting",mU="for-of",mq="yield-star",mV="spread",mW="iterator-method",m_="iterable-accepting/suggestion",mz="iterator-method/suggestion",mK=["every","find","forEach","some"],mG="reduce",mJ=e=>tA(e,{method:"toArray",argumentsLength:0,optionalCall:!1,optionalMember:!1}),mX=(e,t)=>{if(!(t.sourceCode.getCommentsInside(e).length>0))return r=>a$(r,e,t)},mY=(e,t,r,n)=>{let o=mX(e,t);if(o)return{messageId:r,...n&&{data:n},fix:o}},mH="prefer-simple-condition-first",mQ="prefer-simple-condition-first/unsafe";function mZ(e){return"Identifier"===(e=rI(e)).type||"UnaryExpression"===e.type&&"typeof"===e.operator&&"Identifier"===rI(e.argument).type}function m0(e){if(mZ(e=rI(e))||"Literal"===e.type)return!0;if("UnaryExpression"!==e.type||"-"!==e.operator&&"+"!==e.operator)return!1;let t=rI(e.argument);return"Literal"===t.type&&("number"==typeof t.value||"-"===e.operator&&"bigint"==typeof t.value)}function m1(e){if("Identifier"===(e=rI(e)).type)return!0;if("UnaryExpression"===e.type&&"!"===e.operator)return m1(e.argument);if("BinaryExpression"===e.type&&("==="===e.operator||"!=="===e.operator)){let t=rI(e.left),r=rI(e.right);return m0(t)&&m0(r)&&(mZ(t)||mZ(r))}return!1}let m2="switch-case-break-position",m3=new i(["BreakStatement","ReturnStatement","ContinueStatement","ThrowStatement"]),m8="first-child",m6="first-element-child",m9="query-selector",m5="closest",m4="merge-query-selector",m7="suggestion-first-child",fe="suggestion-first-element-child",ft="suggestion-merge-query-selector",fr={method:"querySelector",argumentsLength:1,optionalCall:!1,optionalMember:!1},fn=(e,t)=>tS(e,{property:t,optional:!1,computed:!1}),fo=e=>"MemberExpression"===e.type&&!e.optional&&e.computed&&tn(e.property)&&Number.isSafeInteger(e.property.value)&&e.property.value>=0,fa=(e,t)=>t.getCommentsInside(e).length>0,fi=(e,t,r,n)=>{let{sourceCode:o}=n;if(fa(e,o))return;let[,a]=e9(e.object,n),[,i]=o.getRange(e);return[{messageId:r,fix:r=>[r.replaceText(e.object.property,t),r.removeRange([a,i])]}]},fs=e=>tS(e,{property:"parentElement",optional:!1,computed:!1}),fl=e=>void 0!==tr(e),fu=e=>tA(e,fr),fp=new i(["FunctionDeclaration","ClassDeclaration","TSTypeAliasDeclaration","TSInterfaceDeclaration","TSEnumDeclaration"]),fc=new i(["AccessorProperty","MethodDefinition","PropertyDefinition","TSAbstractAccessorProperty","TSAbstractMethodDefinition","TSAbstractPropertyDefinition","TSMethodSignature","TSPropertySignature"]),fd=e=>{let t="";return"Variable"===e.type?t=e.node.init.arguments[0].value:"ImportBinding"===e.type&&(t=e.parent.source.value),!t.includes("node_modules")&&(t.startsWith(".")||t.startsWith("/"))},fm="consistent-compound-words/error",ff="consistent-compound-words/rename",fg={backGround:"background",callBack:"callback",checkBox:"checkbox",clipBoard:"clipboard",codeBase:"codebase",dataBase:"database",downLoad:"download",feedBack:"feedback",foreGround:"foreground",frameWork:"framework",headLine:"headline",keyBoard:"keyboard",keyFrame:"keyframe",lifeCycle:"lifecycle",metaData:"metadata",midPoint:"midpoint",nameSpace:"namespace",overRide:"override",passWord:"password",payLoad:"payload",placeHolder:"placeholder",preView:"preview",screenShot:"screenshot",sideBar:"sidebar",subClass:"subclass",subDirectory:"subdirectory",subDomain:"subdomain",subMenu:"submenu",subProcess:"subprocess",subString:"substring",subTree:"subtree",subType:"subtype",subTitle:"subtitle",timeOut:"timeout",timeStamp:"timestamp",toolBar:"toolbar",toolKit:"toolkit",toolTip:"tooltip",touchScreen:"touchscreen",unSubscribe:"unsubscribe",underScore:"underscore",upLoad:"upload",userName:"username",viewPort:"viewport",webCam:"webcam",webHook:"webhook",webSite:"website",weekEnd:"weekend",whiteSpace:"whitespace",wildCard:"wildcard",workFlow:"workflow",workSpace:"workspace"},fy=new i(String.raw`\^$.*+?()[]{}|`),fh=e=>{let t="";for(let r of e)t+=fy.has(r)?`\\${r}`:r;return t},fx=String.raw`(?=$|[\d_$]|\p{Uppercase_Letter})`,fb=(e,{replacementRegExp:t,replacements:r,allowList:n})=>{if(!t||e===e.toUpperCase()||n.has(e))return;let o=e.replaceAll(t,e=>((e,t)=>{let r=t.get(e)??t.get(an(e));if(r){let t;return(t=e[0])===t.toUpperCase()?ar(r):an(r)}})(e,r));if(o!==e)return o},fE=(e,t)=>({node:e,messageId:fm,data:{name:e.name,replacement:t}}),fv={type:"array",additionalItems:!1,items:[{type:"object",additionalProperties:!1,properties:{checkProperties:{type:"boolean",description:"Whether to check property names."},checkVariables:{type:"boolean",description:"Whether to check variable names."},checkDefaultAndNamespaceImports:{anyOf:[{type:"boolean"},{enum:["internal"]}],description:"Whether to check default and namespace import names."},checkShorthandImports:{anyOf:[{type:"boolean"},{enum:["internal"]}],description:"Whether to check shorthand import names."},checkShorthandProperties:{type:"boolean",description:"Whether to check shorthand property names."},extendDefaultReplacements:{type:"boolean",description:"Whether to extend the default replacements."},replacements:{$ref:"#/definitions/replacements",description:"Custom compound word replacements."},allowList:{$ref:"#/definitions/trueObject",description:"Custom allow list of names."}}}],definitions:{replacements:{type:"object",propertyNames:{minLength:1},additionalProperties:{anyOf:[{enum:[!1]},{type:"string",minLength:1}]}},trueObject:{type:"object",propertyNames:{minLength:1},additionalProperties:{enum:[!0]}}}},fC="no-blob-to-file",fD="suggestion";function fS(e,t){let r=eg(t.sourceCode.getScope(e),e);return!r||0===r.defs.length}function fT(e,t){if(e?.type!=="Identifier")return;let r=eg(t.sourceCode.getScope(e),e),n=r?.defs[0],o=n?.node;if(n?.type==="Variable"&&"const"===n.kind&&o?.type==="VariableDeclarator")return o}let fA="no-canvas-to-image",fw=e=>{for(;e?.type==="AwaitExpression";)e=e.argument;return e};function fk(e,t){if(e=fw(e),e?.type!=="Identifier")return e;let r=eg(t.getScope(e),e);if(!r||1!==r.identifiers.length||2!==r.references.length)return;let[n]=r.identifiers;if("VariableDeclarator"===n.parent.type&&n.parent.id===n&&"VariableDeclaration"===n.parent.parent.type&&"const"===n.parent.parent.kind&&!(t.getRange(n)[0]>t.getRange(e)[0]))return fw(n.parent.init)}let fI=e=>e.toLowerCase().includes("canvas"),fj="replace-one-element",fF="insert-at-negative-one",fB="suggestion-replace-one-element",fR="suggestion-insert-at-negative-one";function fP(e){return"Identifier"===e.type||"ThisExpression"===e.type||"MemberExpression"===e.type&&!e.computed&&!e.optional&&fP(e.object)}let fL=(e,t)=>t.getCommentsInside(e).length>0,fN="no-duplicate-set-values",f$="first-match",fM="id-selector",fO="length-check",fU="query-selector-all-nullish",fq="query-selector-undefined",fV=e=>tA(e,{method:"querySelector",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&!oo(e.callee.object),fW=e=>tA(e,{method:"querySelectorAll",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&!oo(e.callee.object),f_=e=>{let t,r;return t=e,r=fW,"MemberExpression"===t.type&&t.computed&&!t.optional&&r(t.object)&&e7(t.property,0)},fz=e=>{let t,r;return t=e,r=fW,tA(t,{methods:["at","item"],argumentsLength:1,optionalCall:!1,optionalMember:!1})&&r(t.callee.object)&&e7(t.arguments[0],0)},fK=e=>nP(e)||("ForInStatement"===e.parent.type||"ForOfStatement"===e.parent.type)&&e.parent.left===e,fG=(e,t,r,n)=>{let[,o]=e9(t,n),[,a]=r.getRange(e);return r.getAllComments().some(e=>{let[t,n]=r.getRange(e);return t>=o&&n<=a})},fJ=(e,t,r)=>{if("Identifier"!==e.type)return;let n=eg(t.getScope(e),e);if(!n||1!==n.defs.length)return;let[o]=n.defs;if("Variable"===o.type&&"const"===o.parent.kind&&o.node.id===o.name&&r(o.node.init))return o.node.init},fX=(e,t)=>{let{sourceCode:r}=t,{node:n,isNegative:o}=function(e,t){let r=!1;for(;;)if(t$(e))r=!r,e=e.parent;else if(tM(e,t))e=e.parent;else break;return{node:e,isNegative:r}}(e,t);if(!tq(n)||(fW(e)?!e:!fJ(e,r,fW)))return;let a=r.getText(e);return{node:e,messageId:fO,fix:((e,t,r)=>{let[n,o]=r.getRange(e),[a,i]=r.getRange(t);return r.getAllComments().some(e=>{let[t,s]=r.getRange(e);return t>=n&&s<=o&&(s<=a||t>=i)})})(n,e,r)?void 0:e=>e.replaceText(n,`${a}.length ${o?"=== 0":"> 0"}`)}},fY=(e,t,r)=>({node:e,messageId:f$,*fix(n){yield n.replaceText(t.callee.property,"querySelector"),yield"MemberExpression"===e.type?aN(n,e,r):a$(n,e,r)}}),fH=(e,t)=>ta(e)||tR(e)&&t.isGlobalReference(e),fQ=(e,t,r)=>{let{left:n,operator:o,right:a}=e;return["==","===","!=","!=="].includes(o)?(t(n)?n:fJ(n,r,t))&&fH(a,r)?{node:n,value:a}:(t(a)?a:fJ(a,r,t))&&fH(n,r)?{node:a,value:n}:void 0:void 0},fZ="no-invalid-file-input-accept/invalid",f0="no-invalid-file-input-accept/static",f1="no-invalid-file-input-accept/normalize",f2=new i(["audio/*","image/*","video/*"]),f3=new o([["application/x-rar-compressed","application/vnd.rar"],["application/x-zip-compressed","application/zip"],["image/jpg","image/jpeg"],["image/svg","image/svg+xml"],["image/x-icon","image/vnd.microsoft.icon"]]),f8=/&(?:#\d+|#x[\da-f]+|[a-z][\da-z]*);/iv,f6=e=>{for(let t of e)if(""===t.trim()||","===t||"/"===t||"*"===t||"$"===t||"{"===t||"}"===t)return!0;return!1},f9=e=>{if(e.startsWith("."))return e.length>1&&!f6(e.slice(1))?{replacement:e.toLowerCase()}:{reason:"File extensions must start with `.` and cannot contain whitespace, commas, slashes, wildcards, or template markers."};if(!e.includes("/"))return e.length>0&&"."!==e[0]&&!f6(e)?{replacement:`.${e.toLowerCase()}`}:{reason:"File extensions must start with `.` and cannot contain whitespace, commas, slashes, wildcards, or template markers."};let t=e.toLowerCase();if(t.includes("*"))return f2.has(t)?{replacement:t}:{reason:"Wildcard MIME types must be `audio/*`, `image/*`, or `video/*`."};try{let{essence:t}=new v.MIMEType(e);return{replacement:f3.get(t)??t}}catch{return{reason:"MIME types must use valid `type/subtype` syntax."}}},f5=e=>{if("JSXIdentifier"===e.type)return e.name},f4=(e,t)=>e.attributes.find(e=>"JSXAttribute"===e.type&&f5(e.name)===t),f7=(e,t)=>{let r=e.sourceCode.getScope(t),n=eN(t,r)?.value;if("string"==typeof n)return n},ge=e=>">"===e||""===e.trim(),gt=(e,t,r)=>{for(;t<r&&""===e[t].trim();)t++;return t},gr=(e,t,r)=>t>=r||">"===e[t]||"/"===e[t]&&">"===e[t+1],gn=(e,t,r)=>{let n=t;for(;t<r&&""!==e[t].trim()&&"="!==e[t]&&">"!==e[t]&&("/"!==e[t]||">"!==e[t+1]);)t++;return{name:e.slice(n,t).toLowerCase(),index:t}},go=(e,t,r)=>{let n='"'===e[t]||"'"===e[t]?e[t]:void 0;if(n){let o=t+1;for(t=o;t<r&&e[t]!==n;)t++;return{value:e.slice(o,t),valueRange:[o,t],isQuoted:!0,index:t+1}}let o=t;for(;t<r&&!ge(e[t]);)t++;return{value:e.slice(o,t),valueRange:[o,t],isQuoted:!1,index:t}},ga=(e,t,r)=>{let n=e.sourceCode.text,o=e.sourceCode.getRange(t.openStart)[1],a=e.sourceCode.getRange(t.openEnd)[1],i=o;for(;i<a&&(i=gt(n,i,a),!gr(n,i,a));){let e=gn(n,i,a);if(i=gt(n,e.index,a),"="!==n[i]){if(e.name===r)return{missing:!0};continue}i=gt(n,++i,a);let t=go(n,i,a);if(i=t.index,e.name===r)return t}},gi=({valueInfo:e,fix:t})=>{if(e.missing)return{node:e.node,messageId:fZ,data:{reason:"The `accept` attribute must have a value."}};if(e.dynamic)return{node:e.node,messageId:f0};let r=(e=>{let t=e.split(","),r=new i,n=[];for(let e of t){let t=e.trim();if(0===t.length)return{reason:"Empty entries are not allowed."};let o=f9(t);if(o.reason)return o;let{replacement:a}=o;r.has(a)||(r.add(a),n.push(a))}let o=n.join(", ");return o===e?{}:{replacement:o}})(e.value),n=r.replacement&&e.fixable&&(!e.isReplacementFixable||e.isReplacementFixable(r.replacement));return(({valueNode:e,checkResult:t,fix:r})=>{if(t.reason)return{node:e,messageId:fZ,data:{reason:t.reason}};if(t.replacement){let n={node:e,messageId:f1,data:{replacement:t.replacement}};return r&&(n.fix=r),n}})({valueNode:e.node,checkResult:r,fix:n?t(r.replacement):void 0})},gs=/^(?:e|event|evt|[a-z][\dA-Za-z]*Event)$/u,gl=e=>{for(let t=e.parent;t;t=t.parent)if(tE(t))return t},gu=(e,t)=>{switch(e.type){case"ForStatement":return[e.test,e.update,e.body].includes(t);case"ForInStatement":case"ForOfStatement":return t!==e.right;case"DoWhileStatement":case"WhileStatement":return!0;default:return!1}},gp=e=>{let{sourceCode:t}=e,r=new i,n=e=>{let t=gl(e);t&&r.add(t)};return e.onExit("AwaitExpression",n),e.onExit("YieldExpression",n),e.onExit("ForOfStatement",e=>{e.await&&n(e)}),{isFunctionSuspended:e=>r.has(e),isInsideSuspendingLoop(e,r){for(let n=e,o=e.parent;o&&o!==r;n=o,o=o.parent)if(gu(o,n)&&tW(o,t.visitorKeys))return!0;return!1}}},gc="after-suspension",gd="in-nested-function",gm="no-unnecessary-nested-ternary";function gf(e,t,r){return r.getText(e)===r.getText(t)}function gg(e,t,r,n){let o=e5(e,t);return!e4(e,t)&&o2(e,{operator:r,property:n})&&(o=`(${o})`),o}function gy(e,t){let r=e5(e,t);return!e4(e,t)&&oX(e)&&(r=`(${r})`),r}function gh(e,t,r){let n={node:t,messageId:gm};return 0===e.sourceCode.getCommentsInside(t).length&&(n.fix=n=>n.replaceText(t,function({context:e,node:t,left:r,operator:n,right:o,consequent:a,alternate:i}){let{sourceCode:s}=e,l=[gg(r,e,n,"left"),gg(o,e,n,"right")].join(` ${n} `),u=`${l} ? ${gy(a,e)} : ${gy(i,e)}`;return oC(s.getTokenBefore(t),e,u)&&(u=`;${u}`),u}({context:e,node:t,...r}))),n}let gx="no-unused-array-method-return",gb=new i(["at","concat","entries","every","filter","find","findIndex","findLast","findLastIndex","flat","flatMap","includes","indexOf","join","keys","lastIndexOf","map","some","slice","toReversed","toSorted","toSpliced","values","with"]),gE=/^\p{Uppercase_Letter}/v,gv=Symbol("uncertainValue"),gC=["BigInt","Boolean","Number","RegExp","String","Symbol"],gD=(e,t,r)=>"Identifier"===e.type&&e.name===t&&r.sourceCode.isGlobalReference(e),gS="prefer-array-last-methods",gT="replace",gA=new o([["find","findLast"],["findIndex","findLastIndex"],["indexOf","lastIndexOf"],["reduce","reduceRight"]]),gw=["reverse","toReversed"],gk="prefer-math-abs",gI=new i([">",">=","<","<="]),gj={">":"<",">=":"<=","<":">","<=":">="},gF={">":"<",">=":"<="};function gB(e){return"TSBigIntKeyword"===e.type||"TSLiteralType"===e.type&&ti(e.literal)||"TSTypeAnnotation"===e.type&&gB(e.typeAnnotation)||"TSUnionType"===e.type&&e.types.some(e=>gB(e))||"TSIntersectionType"===e.type&&e.types.some(e=>gB(e))}function gR(e){return["TSAsExpression","TSTypeAssertion","TSNonNullExpression"].includes(e.type)?gR(e.expression):e}function gP(e){let t;return ti(e)||td(e,{name:"BigInt",argumentsLength:1,optional:!1},tu)||"UnaryExpression"===e.type&&"-"===e.operator&&gP(e.argument)||(t=function e(t){return"TSNonNullExpression"===t.type?e(t.expression):"TSAsExpression"===t.type||"TSTypeAssertion"===t.type?t.typeAnnotation:void 0}(e))&&gB(t)}function gL(e,t){return gP(e)||function(e,t){let r=gR(e);if("Identifier"!==r.type)return!1;let n=eg(t.sourceCode.getScope(r),r);return n?.defs.some(e=>"Parameter"===e.type?e.name.typeAnnotation&&gB(e.name.typeAnnotation)||"AssignmentPattern"===e.name.parent.type&&gP(e.name.parent.right):"Variable"===e.type&&(e.node.id.typeAnnotation&&gB(e.node.id.typeAnnotation)||e.node.init&&gP(e.node.init)))??!1}(e,t)}function gN(e,t){return"UnaryExpression"===e.type&&"-"===e.operator?rv(e.argument,t):"BinaryExpression"===e.type&&"-"===e.operator&&e7(e.left,0)?rv(e.right,t):"BinaryExpression"===e.type&&"*"===e.operator&&(rv(e.left,t)&&tw(e.right)||tw(e.left)&&rv(e.right,t))}function g$(e,t){if(!("BinaryExpression"!==e.type||!gI.has(e.operator)||gL(e.left,t)||gL(e.right,t)))return">"===e.operator||">="===e.operator?{value:e.left,threshold:e.right,operator:e.operator}:{value:e.right,threshold:e.left,operator:gj[e.operator]}}function gM(e,t){if(!("BinaryExpression"!==e.type||!gI.has(e.operator)||gL(e.left,t)||gL(e.right,t)))return"<"===e.operator||"<="===e.operator?{value:e.left,negativeThreshold:e.right,operator:e.operator}:{value:e.right,negativeThreshold:e.left,operator:gj[e.operator]}}function gO(e,t){let r=e5(e,t);return"SequenceExpression"===e.type?`(${r})`:r}function gU(e,t,r){let n={node:e,messageId:gk};return r&&!(t.sourceCode.getCommentsInside(e).length>0)&&(n.fix=r),n}function gq(e){return["Identifier","Literal","ThisExpression"].includes((e=gR(e)).type)}let gV="prefer-split-limit",gW=(e,t)=>{let r=eN(e,t.getScope(e));if(r&&Number.isSafeInteger(r.value)&&!(r.value<0)&&!(r.value>=0xfffffffe))return r.value},g_=e=>{let t,r=e?.type==="ChainExpression"?e.expression:e;if(tA(r,{method:"split",argumentsLength:1})&&(te(t=r.arguments[0])&&""!==t.value||to(t)))return r},gz=(e,t,r,n)=>({node:e,messageId:gV,fix:e=>aT(e,t,String(r),n)}),gK=(e,t,r)=>{let{elements:n}=e,o=g_(t);if(0!==n.length&&n.at(-1)?.type!=="RestElement"&&o)return gz(e,o,n.length,r)},gG="prefer-queue-microtask",gJ={create:e=>{let{checkSetImmediate:t,checkSetTimeout:r}=e.options[0];e.on("MemberExpression",t=>{if(tS(t,{object:"process",property:"nextTick",computed:!1,optional:!1})&&om(t.object,e)&&("CallExpression"!==t.parent.type||t.parent.callee!==t||!t.parent.optional))return{node:t.property,messageId:gG,data:{name:"process.nextTick()"},fix:((e,t)=>{let{parent:r}=e;if("CallExpression"===r.type&&r.callee===e&&1===r.arguments.length&&"SpreadElement"!==r.arguments[0].type&&!(t.sourceCode.getCommentsInside(e).length>0))return t=>t.replaceText(e,"queueMicrotask")})(t,e)}}),e.on("CallExpression",n=>{let o;return t&&"Identifier"===n.callee.type&&"setImmediate"===n.callee.name&&!n.optional&&n.arguments.length>0&&"SpreadElement"!==n.arguments[0].type&&!os(n.arguments[0])&&ob(n)&&om(n.callee,e)?{node:n.callee,messageId:gG,data:{name:"setImmediate()"},fix:(e=>{if(1===e.arguments.length)return t=>t.replaceText(e.callee,"queueMicrotask")})(n)}:r&&"Identifier"===n.callee.type&&"setTimeout"===n.callee.name&&!n.optional&&n.arguments.length>=2&&"Literal"===(o=n.arguments[1]).type&&0===o.value&&"SpreadElement"!==n.arguments[0].type&&!os(n.arguments[0])&&ob(n)&&om(n.callee,e)?{node:n.callee,messageId:gG,data:{name:"setTimeout()"},fix:((e,t)=>{if(2!==e.arguments.length)return;let r=((e,t)=>{let{sourceCode:r}=t,[,n]=e.arguments,o=r.getTokenBefore(n),a=r.getTokenAfter(n),i=a?.value===","?r.getTokenAfter(a):a,s=[r.getRange(o)[0],a?.value===","?r.getRange(a)[1]:r.getRange(n)[1]];if(!rN(t,[s[0],r.getRange(i)[0]]))return s})(e,t);if(r)return function*(t){yield t.replaceText(e.callee,"queueMicrotask"),yield t.removeRange(r)}})(n,e)}:void 0})},meta:{type:"suggestion",docs:{description:"Prefer `queueMicrotask()` over `process.nextTick()`, `setImmediate()`, and `setTimeout(…, 0)`.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{checkSetImmediate:{type:"boolean",description:"Whether to also check `setImmediate()`."},checkSetTimeout:{type:"boolean",description:"Whether to also check `setTimeout(…, 0)`."}}}],defaultOptions:[{checkSetImmediate:!1,checkSetTimeout:!1}],messages:{[gG]:"Prefer `queueMicrotask()` over `{{name}}`."},languages:["js/js"]}},gX="prefer-string-pad-start-end",gY="suggest-padding-method",gH=new i(["ArrayExpression","ArrowFunctionExpression","ClassExpression","FunctionExpression","ObjectExpression"]),gQ=(e,t)=>{let r,n=((e,t)=>{if("Identifier"!==e.type)return;let r=eg(t.sourceCode.getScope(e),e),n=r?.defs[0]?.node;return n?.type==="FunctionDeclaration"||n?.type==="ClassDeclaration"?n:n?.type==="VariableDeclarator"?n.init:void 0})(e,t);return(r=eN(e,t.sourceCode.getScope(e)))&&"string"!=typeof r.value||gH.has(e.type)||gH.has(n?.type)||n?.type==="FunctionDeclaration"||n?.type==="ClassDeclaration"},gZ=(e,t)=>t.sourceCode.getCommentsInside(e).length>0,g0=e=>"Literal"===e.type&&"string"==typeof e.value||"TemplateLiteral"===e.type&&0===e.expressions.length,g1=({targetNode:e,targetLengthNode:t,paddingNode:r})=>"Identifier"===e.type&&tn(t)&&g0(r),g2=(e,t)=>{if(!tA(e,{method:"repeat",argumentsLength:1,optionalCall:!1,optionalMember:!1}))return;let r=e.callee.object,n=((e,t)=>{let r=eN(e,t.sourceCode.getScope(e));if("string"==typeof r?.value)return r.value})(r,t);if(n?.length===1)return{paddingNode:r,paddingString:n,widthNode:e.arguments[0]}},g3=(e,t)=>{let r,n=g2(e,t);if(!n)return;let{widthNode:o}=n;if("BinaryExpression"===o.type&&"-"===o.operator&&(r=o.right,r?.type==="MemberExpression"&&!1===r.computed&&"Identifier"===r.property.type&&"length"===r.property.name))return{...n,targetLengthNode:o.left,targetNode:o.right.object}},g8=({method:e,targetNode:t,targetLengthNode:r,paddingNode:n,paddingString:o},a)=>{let i=e5(t,a),s=e5(r,a),l=(({paddingNode:e,paddingString:t},r)=>" "===t?"":`, ${e5(e,r)}`)({paddingNode:n,paddingString:o},a);return`${i}.${e}(${s}${l})`},g6=({node:e,method:t,replacement:r,context:n,canFix:o})=>{let a={node:e,messageId:gX,data:{method:t}};return o&&!gZ(e,n)&&(a.fix=function(t){let o=oC(n.sourceCode.getTokenBefore(e),n,r)?";":"";return t.replaceText(e,`${o}${r}`)}),a},g9=({node:e,method:t,replacement:r,context:n,canSuggest:o})=>{let a={node:e,messageId:gX,data:{method:t}};return o&&!gZ(e,n)&&(a.suggest=[{messageId:gY,data:{method:t},fix:t=>t.replaceText(e,r)}]),a},g5="require-css-escape",g4=["closest","matches","querySelector","querySelectorAll"],g7=e=>e.value.cooked,ye=(e,t)=>{let r,n="";for(let r of e.quasis.slice(0,t+1)){let e=g7(r);if(void 0===e)return!1;n+=e}if(!((r=n).lastIndexOf("[")>r.lastIndexOf("]")))return!1;for(let r of e.quasis.slice(t+1)){let e=g7(r);if(void 0===e)break;if(e.includes("]"))return!0}return!1},yt=e=>tA(e,{object:"CSS",method:"escape",argumentsLength:1,optionalCall:!1,optionalMember:!1}),yr=e=>t=>"SequenceExpression"===e.type?[t.insertTextBefore(e,"CSS.escape(("),t.insertTextAfter(e,"))")]:[t.insertTextBefore(e,"CSS.escape("),t.insertTextAfter(e,")")],yn={create:e=>{let{checkAllSelectors:t}=e.options[0];e.on("CallExpression",function*(e){if(!tA(e,{methods:g4,minimumArguments:1})||oo(e.callee.object))return;let[r]=e.arguments;if("TemplateLiteral"===r.type&&0!==r.expressions.length)for(let[e,n]of r.expressions.entries())!yt(n)&&(t||ye(r,e))&&(yield{node:n,messageId:g5,fix:yr(n)})})},meta:{type:"suggestion",docs:{description:"Require `CSS.escape()` for interpolated values in CSS selectors.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{checkAllSelectors:{type:"boolean",description:"Check all selector interpolations instead of only attribute selector interpolations."}}}],defaultOptions:[{checkAllSelectors:!1}],messages:{[g5]:"Use `CSS.escape()` for interpolated values in CSS selectors."},languages:["js/js"]}},yo="require-passive-events",ya=new i(["touchstart","touchmove","touchenter","touchend","touchleave","wheel","mousewheel"]),yi=e=>e.computed||"Identifier"!==e.property.type?te(e.property)?e.property.value:void 0:e.property.name,ys=e=>{var t,r;return"MemberExpression"===e.parent.type&&e.parent.object===e&&"MemberExpression"===(t=e.parent).type&&"preventDefault"===yi(t)&&("CallExpression"===(r=t).parent.type&&r.parent.callee===r?r.parent:"ChainExpression"===r.parent.type&&"CallExpression"===r.parent.parent.type&&r.parent.parent.callee===r.parent?r.parent.parent:void 0)},yl=e=>{if("MemberExpression"!==e.parent.type||e.parent.object!==e)return!1;let t=yi(e.parent);return t&&"preventDefault"!==t&&!nP((e=>{for(;"MemberExpression"===e.parent.type&&e.parent.object===e;)e=e.parent;return e})(e.parent))},yu="this",yp="class",yc="class-unavailable",yd="super",ym="super-class",yf="super-class-unavailable",yg="suggestion",yy=new i(["PropertyDefinition","AccessorProperty","StaticBlock","ClassBody"]),yh=new i(["TSAsExpression","TSInstantiationExpression","TSNonNullExpression","TSSatisfiesExpression","TSTypeAssertion"]),yx=e=>"MethodDefinition"===e.parent.type&&e.parent.value===e,yb=e=>"FunctionDeclaration"===e.type||"FunctionExpression"===e.type,yE=e=>{let t=e;for(let{parent:r}=e;r;t=r,r=r.parent)if("ArrowFunctionExpression"!==r.type){if(yb(r)&&!yx(r))return;if("MethodDefinition"===r.type)return r.static&&r.value===t?r:void 0;if(yy.has(r.type))return}},yv=e=>{if(e.id)return e.id;let{parent:t}=e;if("ClassExpression"===e.type&&"VariableDeclarator"===t.type&&t.init===e&&"Identifier"===t.id.type)return t.id},yC=(e,t,r)=>eg(e.getScope(t),t)===eg(e.getScope(r),r),yD=(e,t,r)=>eg(e.getScope(t),r.name)===eg(e.getScope(r),r),yS=(e,t)=>"AssignmentExpression"===e.type&&e.left===t||"UpdateExpression"===e.type&&e.argument===t||"UnaryExpression"===e.type&&"delete"===e.operator&&e.argument===t||("ForInStatement"===e.type||"ForOfStatement"===e.type)&&e.left===t,yT=e=>{let t;return(t=e.parent,yh.has(t.type)&&t.expression===e)?e.parent:void 0},yA=e=>{let{parent:t}=e;if("MemberExpression"===t.type&&t.object===e||"ChainExpression"===t.type&&t.expression===e)return t;let r=yT(e);return r||("Property"===t.type&&t.value===e&&"ObjectPattern"===t.parent.type?t.parent:"ObjectPattern"===t.type&&t.properties.includes(e)||"ArrayPattern"===t.type&&t.elements.includes(e)||"AssignmentPattern"===t.type&&t.left===e||"RestElement"===t.type&&t.argument===e?t:void 0)},yw=e=>{let t=e;for(;t.parent;){if(yS(t.parent,t))return!0;let e=yA(t);if(!e)break;t=e}return!1},yk=e=>"MemberExpression"===e.parent.type&&e.parent.object===e,yI=e=>{let t=e;for(;t.parent;){let e=yT(t);if(!e)break;t=e}return t},yj=e=>{let t=yI(e);return"CallExpression"===t.parent.type&&t.parent.callee===t||"NewExpression"===t.parent.type&&t.parent.callee===t||"TaggedTemplateExpression"===t.parent.type&&t.parent.tag===t},yF=e=>{let t=yI(e);return yk(t)&&"PrivateIdentifier"===t.parent.property.type},yB=e=>{let t=yI(e);return"BinaryExpression"===t.parent.type&&"in"===t.parent.operator&&"PrivateIdentifier"===t.parent.left.type&&t.parent.right===t},yR=e=>e.superClass?.type==="Identifier"?e.superClass:void 0,yP=({node:e,messageId:t,source:r,replacement:n,name:o})=>({node:e,messageId:t,data:{name:o},suggest:[{messageId:yg,data:{source:r,replacement:n},fix:t=>t.replaceText("ChainExpression"===e.parent.type?e.parent:e,n)}]}),yL=(e,t,r)=>({node:e,messageId:t,data:{name:r}}),yN={create:e=>{let{sourceCode:t}=e,{preferThis:r,preferSuper:n}=e.options[0];e.on("ThisExpression",e=>{if(r||yw(e)||yj(e)||yF(e)||yB(e))return;let n=yE(e);if(!n)return;let o=yv(n.parent.parent);return o&&yD(t,e,o)?yP({node:e,messageId:yp,source:"this",replacement:o.name,name:o.name}):yL(e,yc)}),e.on("Super",e=>{if(n||yw(e))return;let r=yE(e);if(!r)return;let o=yR(r.parent.parent);return o&&yD(t,e,o)?yP({node:e,messageId:ym,source:"super",replacement:o.name,name:o.name}):yL(e,yf)}),e.on("Identifier",o=>{if(!tk(o)||(e=>{let t=e;for(;"TSQualifiedName"===t.parent.type;)t=t.parent;return"TSTypeReference"===t.parent.type&&t.parent.typeName===t||"TSTypeQuery"===t.parent.type&&t.parent.exprName===t})(o)||yw(o)||yj(o)||yF(o)||yB(o))return;let a=yE(o);if(!a)return;let i=a.parent.parent;if(r){let e=yv(i);if(e&&o.name===e.name&&yC(t,o,e))return yP({node:o,messageId:yu,source:o.name,replacement:"this",name:o.name})}if(!n||!(yk(o)&&!o.parent.optional&&!yw(o.parent))||e4(o,e))return;let s=yR(i);if(s&&o.name===s.name&&yC(t,o,s))return yP({node:o,messageId:yd,source:o.name,replacement:"super",name:o.name})})},meta:{type:"suggestion",docs:{description:"Enforce consistent class references in static methods.",recommended:!0},hasSuggestions:!0,schema:[{type:"object",properties:{preferThis:{type:"boolean",description:"Prefer `this` over the current class name in static methods."},preferSuper:{type:"boolean",description:"Prefer `super` over the superclass name in static methods."}},additionalProperties:!1}],defaultOptions:[{preferThis:!0,preferSuper:!0}],messages:{[yu]:"Use `this` instead of `{{name}}` in static methods.",[yp]:"Use `{{name}}` instead of `this` in static methods.",[yc]:"Use the class name instead of `this` in static methods.",[yd]:"Use `super` instead of `{{name}}` in static methods.",[ym]:"Use `{{name}}` instead of `super` in static methods.",[yf]:"Use the superclass name instead of `super` in static methods.",[yg]:"Replace `{{source}}` with `{{replacement}}`."},languages:["js/js"]}},y$="consistent-optional-chaining/remove-optional",yM="consistent-optional-chaining/use-optional",yO="consistent-optional-chaining/suggest-remove-optional",yU="consistent-optional-chaining/suggest-use-optional",yq=new i(["Identifier","ThisExpression","Super"]);function yV(e){let t;for(;e!==t;)t=e,"ChainExpression"===(e=rI(e)).type&&(e=e.expression);return e}function yW(e){return"MemberExpression"===(e=yV(e)).type?e:void 0}function y_(e){return e=yV(e),!!yq.has(e.type)||"MemberExpression"===e.type&&y_(e.object)}function yz(e,t){let r=rq(e,t);return!rN(t,r)}function yK({memberExpression:e,context:t,fixer:r,replacement:n}){let o=rq(e,t);return r.replaceTextRange(o,n)}function yG(e,t,r){return yK({memberExpression:e,context:t,fixer:r,replacement:e.computed?"[":"."})}let yJ="always",yX="never",yY="missing-delay",yH="redundant-delay",yQ=new i(["setTimeout","setInterval"]),yZ=new i(["window","globalThis","global","self"]),y0=e=>e7(e,0)||"UnaryExpression"===e.type&&("+"===e.operator||"-"===e.operator)&&y0(e.argument),y1="negative-index",y2="length-index",y3="no-duplicate-loops",y8=["filter","map"],y6="no-declarations-before-early-exit",y9=e=>"VariableDeclaration"===e.type&&("let"===e.kind||"const"===e.kind),y5=e=>!e||"Literal"===e.type||"TemplateLiteral"===e.type&&0===e.expressions.length,y4=(e,t,r)=>{let n="before"===r?e.getTokenBefore(t,{includeComments:!0}):e.getTokenAfter(t,{includeComments:!0});return n&&eS(n)},y7=(e,t)=>{let[r,n]=e.getRange(t);return new i(rp(e.getScope(t)).filter(({identifier:t})=>{let[o,a]=e.getRange(t);return o>=r&&a<=n}).map(({identifier:e})=>e.name))};function*he(e,t,r){let n;for(let[o,a]of t.entries())if(y9(a)&&!a.declare){n??=t.map(e=>{var t,n;return(t=e,n=r,"IfStatement"!==t.type||n(t.consequent)===(!!t.alternate&&n(t.alternate)))?void 0:e});for(let r=o+1;r<t.length;r++){let t=n[r];if(t){for(let n of a.declarations){let i=function({sourceCode:e,declaration:t,declarator:r,guardStatement:n,declarationIndex:o,guardIndex:a}){var i;let s;if("Identifier"!==r.id.type||(e=>{if(e?.type!=="CallExpression")return!1;let{callee:t}=e;return"Identifier"===t.type?oc(t.name):"MemberExpression"===t.type&&!t.computed&&"Identifier"===t.object.type&&/^[A-Z]/.test(t.object.name)&&"Identifier"===t.property.type&&oc(t.property.name)})(r.init)||r.init&&tW(r.init,e.visitorKeys)||a>o+1&&!y5(r.init)||r.init&&(i=r.init,s=y7(e,n),[...y7(e,i)].some(e=>s.has(e)))&&(e_(r.init,e)||e_(n.test,e)))return;let[l]=e.getDeclaredVariables(r),u=l.references.filter(e=>!e.init&&!function(e){let t=e;for(;"TSQualifiedName"===t.parent.type;)t=t.parent;return"TSTypeQuery"===t.parent.type}(e.identifier));if(0===u.length)return;let[,p]=e.getRange(n);if(u.some(t=>e.getRange(t.identifier)[0]<p))return;let c={node:r.id,messageId:y6};return(({sourceCode:e,declaration:t,guardStatement:r,declarationIndex:n,guardIndex:o})=>o===n+1&&1===t.declarations.length&&y5(t.declarations[0].init)&&0===e.getCommentsInside(t).length&&!y4(e,t,"before")&&!y4(e,r,"after")&&!e.getTokensBetween(t,r,{includeComments:!0}).some(e=>eS(e)))({sourceCode:e,declaration:t,guardStatement:n,declarationIndex:o,guardIndex:a})&&(c.fix=function(e,t,r){let n=e.getText(t),o=e.getText(r),[a,i]=e.getRange(t),[s,l]=e.getRange(r),u=e.text.slice(i,s);return e=>e.replaceTextRange([a,l],`${o}${u}${n}`)}(e,t,n)),c}({sourceCode:e,declaration:a,declarator:n,guardStatement:t,declarationIndex:o,guardIndex:r});i&&(yield i)}break}}}}let ht="no-optional-chaining-on-undeclared-variable",hr=e=>"Type"===e.type||"ImportBinding"===e.type&&oD(e.node);function hn(e){let t;for(;e!==t;)t=e,("ChainExpression"===(e=rI(e)).type||"TSInstantiationExpression"===e.type)&&(e=e.expression);return e}let ho="no-object-methods-with-collections/error",ha="no-object-methods-with-collections/suggestion",hi=new i(["entries","keys","values"]),hs="no-subtraction-comparison/error",hl="no-subtraction-comparison/suggestion",hu={">":"<",">=":"<=","<":">","<=":">=","===":"===","!==":"!==","==":"==","!=":"!="},hp=new i(Object.keys(hu)),hc=new i([">","<"]),hd=e=>"BinaryExpression"===e.type&&"-"===e.operator,hm=(e,t)=>{let r=eN(e,t)?.value;return"number"==typeof r&&Number.isFinite(r)},hf="no-unnecessary-global-this",hg=new i(["TSAsExpression","TSInstantiationExpression","TSNonNullExpression","TSSatisfiesExpression","TSTypeAssertion"]);function hy(e){for(;hg.has(e.type);)e=e.expression;return e}let hh=e=>{for(;hg.has(e.parent.type)&&e.parent.expression===e;)e=e.parent;return e},hx=tJ();function hb(e){return"CallExpression"===(e=hh(e)).parent.type&&e.parent.callee===e}let hE=new i(["==","!=","===","!=="]),hv="computed-key",hC="nested-array",hD="deep-object",hS="property-assignment";function hT(e){let{parent:t}=e;if(t){if(rk(t)&&t.expression===e||"AssignmentPattern"===t.type&&t.left===e||"RestElement"===t.type&&t.argument===e)return hT(t);if("Property"===t.type&&t.value===e&&"ObjectPattern"===t.parent.type)return t.parent;if("ObjectPattern"===t.type||"ArrayPattern"===t.type)return t}}function hA(e){let t=0;for(;e;)"ObjectPattern"===e.type&&t++,e=hT(e);return t}let hw="no-useless-else",hk=new i(["Program","BlockStatement","StaticBlock","SwitchCase"]),hI=new i(["[","(","<","/","`","+","-"]),hj=(e,t)=>{let r=e.text.lastIndexOf("\n",t-1)+1;return/^[\t ]*/.exec(e.text.slice(r,t))[0]},hF=e=>hI.has(e.value[0]),hB="no-useless-recursion",hR=new i(["using","await using"]),hP=e=>e?.type==="VariableDeclaration"&&hR.has(e.kind),hL=e=>"ForStatement"===e.type?hP(e.init):"ForOfStatement"===e.type&&hP(e.left),hN="prefer-add-event-listener-options",h$="prefer-direct-iteration",hM="Array",hO="FormData",hU="URLSearchParams",hq=new i([hM,"Map","Set",hO,hU,...rQ]),hV=new o([["ReadonlyArray",hM],["ReadonlyMap","Map"],["ReadonlySet","Set"]]),hW=new o([[hM,["values"]],["Map",["entries"]],["Set",["values","keys"]],[hO,["entries"]],[hU,["entries"]],...rQ.map(e=>[e,["values"]])]),h_=["Map","WeakMap","Set","WeakSet"],hz=["all","allSettled","any","race"],hK=new i(["ArrayExpression","CallExpression","NewExpression"]),hG=e=>new i([e]),hJ=(e,t)=>tA(e,{objects:rQ,methods:t,optionalCall:!1,optionalMember:!1}),hX=e=>hq.has(e)?e:hV.get(e),hY=e=>{let t=new i;for(let r of e){if(!r)return;for(let e of r)t.add(e)}return t},hH=(e,t,r)=>{if("any"===e.intrinsicName||"unknown"===e.intrinsicName)return;if(e.isUnion())return hY(e.types.map(e=>hH(e,t,r)));if(t.isArrayType(e)||t.isTupleType(e))return hG(hM);let n=r1(e);if(!r2(n,r))return;let o=n.getName(),a=o&&hX(o);return a&&hG(a)},hQ=e=>{switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return hQ(e.typeAnnotation);case"TSArrayType":case"TSTupleType":return hG(hM);case"TSTypeOperator":return"readonly"===e.operator?hQ(e.typeAnnotation):void 0;case"TSTypeReference":{if("Identifier"!==e.typeName.type)return;let t=hX(e.typeName.name);return t&&hG(t)}case"TSUnionType":return hY(e.types.map(e=>hQ(e)))}},hZ=(e,t,r=new i)=>((e,t,r)=>{if("ArrayExpression"===e.type||tm(e,{name:"Array"}))return hG(hM);if(tm(e,{names:rQ})||tm(e,{names:["Map","Set",hO,hU]}))return hG(e.callee.name);if(td(e,{name:"Array"},tu)||tA(e,{object:"Array",methods:["from","of"],optionalCall:!1,optionalMember:!1}))return hG(hM);if(hJ(e,["from","of"]))return hG(e.callee.object.name);switch(e.type){case"Identifier":return((e,t,r)=>{let n=eg(t.sourceCode.getScope(e),e);if(!n||r.has(n)||1!==n.defs.length)return;r.add(n);let[o]=n.defs,a=hQ(o.name?.typeAnnotation);return a||("Variable"===o.type&&"const"===o.parent.kind&&o.node.init?hZ(o.node.init,t,r):void 0)})(e,t,r);case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":return hQ(e.typeAnnotation)??hZ(e.expression,t,r);case"TSNonNullExpression":case"ParenthesizedExpression":return hZ(e.expression,t,r)}})(e,t,r)??((e,t)=>{let{parserServices:r}=t.sourceCode;if(r?.program)try{let{program:t}=r;return hH(r.getTypeAtLocation(e),t.getTypeChecker(),t)}catch{}})(e,t),h0="prefer-number-is-safe-integer/error",h1="prefer-number-is-safe-integer/suggestion",h2="prefer-number-is-safe-integer/integer-check-error",h3="prefer-number-is-safe-integer/integer-check-suggestion",h8=["_","lodash","underscore"],h6=["floor","trunc"],h9=(e,t)=>{let r=eg(t.getScope(e),"Number");return!r||"global"===r.scope.type&&0===r.defs.length},h5=e=>{if("BinaryExpression"===e.type&&"%"===e.operator&&e7(e.right,1))return e.left},h4=(e,t)=>{if(tA(e,{object:"Math",methods:h6,argumentsLength:1,optionalCall:!1,optionalMember:!1,computed:!1})&&t.isGlobalReference(e.callee.object))return e.arguments[0]},h7="prefer-object-define-properties";function xe(e){if(e?.type!=="ExpressionStatement")return;let{expression:t}=e;if(tA(t,{object:"Object",method:"defineProperty",argumentsLength:3,optionalCall:!1,optionalMember:!1,computed:!1}))return t}let xt="prefer-object-destructuring-defaults",xr="prefer-object-destructuring-defaults/suggestion",xn=new i(Object.getOwnPropertyNames(Object.prototype)),xo={considerGetters:!0,considerImplicitTypeConversion:!0},xa=e=>"Property"===e.type&&"init"===e.kind&&!e.computed&&!e.method,xi=(e,t,r)=>rp(r.sourceCode.getScope(e)).some(n=>t.has(n.identifier.name)&&((e,t,r)=>{let[n,o]=r.getRange(e),[a,i]=r.getRange(t);return n>=a&&o<=i})(n.identifier,e,r.sourceCode)),xs=(e,t,r)=>{let{sourceCode:n}=r,o=n.getText(e.node.value),a=e5(t.value,r);return e.node.shorthand?`${o} = ${a}`:`${n.getText(e.node.key)}: ${o} = ${a}`},xl="prefer-single-object-destructuring",xu=(e,t)=>{let r,n;if(!("VariableDeclaration"===t.type&&("const"===(r=t.kind)||"let"===r)&&!t.declare&&1===t.declarations.length))return;let[o]=t.declarations;if("ObjectPattern"===o.id.type&&!o.id.typeAnnotation&&(n=o.id).properties.length>0&&n.properties.every(e=>"Property"===e.type&&!e.computed&&"Identifier"===e.value.type)&&o.init?.type==="Identifier"&&((e,t)=>{let r=eg(e.getScope(t),t);if(!r||1!==r.defs.length)return!1;let[n]=r.defs;return"Variable"===n.type&&"VariableDeclarator"===n.node.type&&"VariableDeclaration"===n.parent.type&&!n.parent.declare&&"const"===n.parent.kind})(e,o.init))return{node:t,declarator:o,source:o.init.name}},xp=(e,t,r)=>{let n,o,a=xu(e,t),i=xu(e,r);if(!(a&&i&&a.node.kind===i.node.kind&&a.source===i.source&&0===e.getCommentsInside(a.node).length&&0===e.getCommentsInside(i.node).length)||(n=a.node,o=i.node,e.getTokensBetween(n,o,{includeComments:!0}).some(e=>eS(e))))return;let s=t=>t.properties.map(t=>e.getText(t)).join(", "),l=`${a.node.kind} {${s(a.declarator.id)}, ${s(i.declarator.id)}} = ${a.source};`;return{node:i.node,messageId:xl,data:{source:a.source},fix:t=>t.replaceTextRange([e.getRange(a.node)[0],e.getRange(i.node)[1]],l)}};function*xc(e,t){for(let[r,n]of t.entries()){if(0===r)continue;let o=xp(e,t[r-1],n);o&&(yield o)}}let xd="prefer-smaller-scope",xm=new i(["ArrowFunctionExpression","ClassDeclaration","ClassExpression","FunctionDeclaration","FunctionExpression","StaticBlock","WithStatement"]);function xf(e,t){let r=e.parent;for(;r&&r!==t;){if(xm.has(r.type))return!1;r=r.parent}return r===t}function xg(e,t,r){let n="before"===r?e.getTokenBefore(t,{includeComments:!0}):e.getTokenAfter(t,{includeComments:!0});return!!(n&&eS(n))}function xy(e,t){let r=e.getTokenBefore(t),n=e.getTokenAfter(t);return r?.value==="("&&n?.value===")"}let xh="prefer-single-array-predicate/error",xx="prefer-single-array-predicate/suggestion",xb=new o([["||","some"],["&&","every"]]),xE=new i(["AssignmentExpression","ArrowFunctionExpression","ConditionalExpression","SequenceExpression","TSAsExpression","TSNonNullExpression","TSSatisfiesExpression","TSTypeAssertion","YieldExpression"]),xv="prefer-url-href",xC="non-url",xD="unknown",xS=new i(["ClassName","ImportBinding","Type"]),xT=new i(["any","error","unknown"]),xA=new i(["node:url","url"]),xw=e=>xS.has(e.type),xk=(e,t,r,n)=>{for(;t;){let o=t.set.get(e);if(o?.defs.some(e=>oS(e,r,n)))return o;t=t.upper}},xI=e=>e.every(e=>"url"===e)?"url":!e.includes(xD)&&e.includes(xC)?xC:xD,xj=e=>{let t;if("ImportBinding"!==e.type)return!1;let{node:r,parent:n}=e;return t=n.source,xA.has(t.value)&&"ImportSpecifier"===r.type&&"Identifier"===r.imported.type&&"URL"===r.imported.name},xF=e=>"ImportBinding"===e.type&&("type"===e.parent.importKind||oD(e.node)),xB=e=>"Type"===e.type||xF(e),xR=e=>xj(e)&&!xF(e),xP=(e,t)=>{let r;return"NewExpression"===e.type&&(((e,t)=>{if("Identifier"!==e.type||"URL"!==e.name||((e,t,r)=>{for(;e;){let n=e.set.get("URL");if(n?.defs.some(e=>!xB(e)&&oS(e,t,r)))return!0;e=e.upper}return!1})(t.sourceCode.getScope(e),e,t))return!1;if(om(e,t))return!0;let r=eg(t.sourceCode.getScope(e),e);return r?.defs.length>0&&r.defs.every(e=>xB(e))})(r=e.callee,t)||((e,t)=>{if("Identifier"!==e.type)return!1;let r=eg(t.sourceCode.getScope(e),e);return r?.defs.some(e=>xR(e))??!1})(r,t))},xL=(e,t)=>t.sourceCode.getScope(e.name??e.node),xN=(e,t,r,n=new i)=>{switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return xN(e.typeAnnotation,t,r,n);case"TSTypeReference":return((e,t,r,n)=>{if("Identifier"!==e.typeName.type)return xD;let o=e.typeName.name,a=xk(o,r,e.typeName,t),[i]=a?.defs??[];if(!i)return"URL"!==o||((e,t)=>{for(;t;){let r=t.set.get(e);if(r?.defs.some(e=>xw(e)))return!0;t=t.upper}return!1})(o,r)?xD:"url";if(n.has(o))return xD;if(xj(i))return"url";n.add(o);let s=xD;return"Type"===i.type&&"TSTypeAliasDeclaration"===i.node.type?s=xN(i.node.typeAnnotation,t,xL(i,t),n):"Type"===i.type&&"TSTypeParameter"===i.node.type?s=xD:"ClassName"===i.type&&(s=xC),n.delete(o),s})(e,t,r,n);case"TSUnionType":return xI(e.types.map(e=>xN(e,t,r,n)));case"TSIntersectionType":return xI(e.types.map(e=>xN(e,t,r,n)));case"TSImportType":let o;return(o=e.source,xA.has(o.value)&&e.qualifier?.type==="Identifier"&&"URL"===e.qualifier.name)?"url":xC;default:return e?xC:xD}},x$=(e,t)=>{let{checker:r,context:n,node:o,program:a}=t;if(xT.has(e.intrinsicName)||e.isTypeParameter?.())return xD;let i=r.getBaseConstraintOfType(e);if(i&&i!==e)return x$(i,t);if(e.isUnion()||e.isIntersection())return xI(e.types.map(e=>x$(e,t)));let s=((e,t,r)=>{if(!/^[\w$]+$/.test(e))return xD;let n=xk(e,r.sourceCode.getScope(t),t,r),o=n?.defs.filter(e=>"Type"===e.type||"ClassName"===e.type||xj(e))??[];return 0===o.length?xD:o.every(e=>xj(e))?"url":xC})(r.typeToString(e),o,n);if(s!==xD)return s;let l=r1(e);return r2(l,a)&&"URL"===l.getName()?"url":xC},xM=(e,t)=>{let{parserServices:r}=t.sourceCode;if(!r?.program)return xD;try{let{program:n}=r;return x$(r.getTypeAtLocation(e),{checker:n.getTypeChecker(),context:t,node:e,program:n})}catch{return xD}};function xO(e,t,r=new i){if(!e)return xD;let n=t.sourceCode.getScope(e);switch(e.type){case"Identifier":{let n=((e,t,r)=>{let n=eg(t.sourceCode.getScope(e),e);if(!n||r.has(n)||1!==n.defs.length)return xD;let[o]=n.defs;if(!oS(o,e,t))return xD;r.add(n);let a="Variable"===o.type&&"const"===o.parent.kind&&o.node.init?xO(o.node.init,t,r):xD,i=xN(o.name?.typeAnnotation,t,xL(o,t)),s=xD;return a!==xD?s=a:i!==xD&&(s=i),r.delete(n),s})(e,t,r);if(n!==xD)return n;break}case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":{let o=xN(e.typeAnnotation,t,n);return o===xD?xO(e.expression,t,r):o}case"TSNonNullExpression":case"ParenthesizedExpression":return xO(e.expression,t,r);case"SequenceExpression":return xO(e.expressions.at(-1),t,r);case"ConditionalExpression":return xI([xO(e.consequent,t,r),xO(e.alternate,t,r)])}if(xP(e,t))return"url";if("NewExpression"===e.type){if(((e,t)=>{if("Identifier"!==e.type)return!1;let r=eg(t.sourceCode.getScope(e),e);return r?.defs.some(e=>!xB(e)&&!xR(e))??!1})(e.callee,t))return xC;let r=xM(e,t);return r===xD?xC:r}let o=((e,t)=>{if("CallExpression"!==e.type||"Identifier"!==e.callee.type)return xD;let r=eg(t.sourceCode.getScope(e.callee),e.callee);if(r?.defs.length!==1)return xD;let[n]=r.defs;return xN(n.node.returnType,t,xL(n,t))})(e,t);return o!==xD?o:xM(e,t)}let xU=(e,t)=>{switch(e.type){case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":case"ParenthesizedExpression":case"TSNonNullExpression":return xU(e.expression,t);case"SequenceExpression":return xU(e.expressions.at(-1),t);case"ConditionalExpression":return xU(e.consequent,t)&&xU(e.alternate,t);case"NewExpression":return xP(e,t);default:return!1}},xq=(e,t)=>0===t.sourceCode.getCommentsInside(e).length,xV="require-proxy-trap-boolean-return",xW=new i(["defineProperty","deleteProperty","has","isExtensible","preventExtensions","set","setPrototypeOf"]),x_=new i(["ArrowFunctionExpression","FunctionDeclaration","FunctionExpression"]),xz=new i(["ArrayExpression","ArrowFunctionExpression","ClassExpression","FunctionExpression","NewExpression","ObjectExpression","TemplateLiteral","UpdateExpression"]),xK=new i(["%","&","*","**","+","-","/","<<",">>",">>>","^","|"]),xG=(e,t)=>({node:e,messageId:xV,data:{name:t}}),xJ=e=>{if(e)return xG(e.node,e.data.name)},xX=(e,t,r)=>{if("AssignmentExpression"===e.type)return"="===e.operator?xJ(xX(e.right,t,r)):xG(e,t);if("ConditionalExpression"===e.type)return xX(e.consequent,t,r)??xX(e.alternate,t,r);if("LogicalExpression"===e.type)return xJ(xX(e.left,t,r)??xX(e.right,t,r));if("SequenceExpression"===e.type)return xJ(xX(e.expressions.at(-1),t,r));let n=((e,t)=>{let r=eN(e,t.getScope(e));if(null!==r&&"boolean"!=typeof r.value)return!!r.value})(e,r);if(void 0===n&&!(xz.has(e.type)||"UnaryExpression"===e.type&&"!"!==e.operator&&"delete"!==e.operator||"BinaryExpression"===e.type&&xK.has(e.operator)))return;let o=((e,t,r)=>{if(!(r.getCommentsInside(e).length>0)&&("Literal"===e.type&&!e.regex||"TemplateLiteral"===e.type&&0===e.expressions.length||"Identifier"===e.type&&"undefined"===e.name))return String(t)})(e,n,r);return{...xG(e,t),...o&&{fix:t=>t.replaceText(e,o)}}},xY=(e,t)=>{if("Property"!==e.type||"init"!==e.kind)return;let r=eM(e,t.getScope(e));if(xW.has(r)&&x_.has(e.value.type))return{name:r,functionNode:e.value}},xH=({functionNode:e,name:t},r,n)=>{if(e.async||e.generator)return xG(e,t);if("BlockStatement"!==e.body.type)return xX(e.body,t,r);let o=[...function* e(t){if(t&&"string"==typeof t.type){if("ReturnStatement"===t.type)return void(yield t);if(!("BlockStatement"!==t.type&&x_.has(t.type))){for(let[r,n]of Object.entries(t))if("parent"!==r){if(Array.isArray(n)){for(let t of n)yield*e(t);continue}yield*e(n)}}}}(e.body)],a=n.get(e)??!1;if(0===o.length){if(a)return;return xG(e,t)}for(let e of o){if(!e.argument)return xG(e,t);let n=xX(e.argument,t,r);if(n)return n}if(!a)return xG(e,t)},xQ=C.builtinRules.get("logical-assignment-operators"),xZ="ifNullish",x0="convertIf",x1={...xQ.meta.messages,[xZ]:"'if' statement can be replaced with a logical operator assignment with operator ||= or ??=."},x2=e=>e.fix??e.suggest?.[0]?.fix,x3={create:e=>{let{sourceCode:t}=e,r=Object.create(e,{report:{value(r){e.report(function(e,t){let r;if("if"!==e.messageId||e.data?.operator!=="||="||"function"!=typeof x2(e))return e;let n={...(r={...e},delete r.fix,delete r.suggest,r),messageId:xZ};if(t.getCommentsInside(e.node).length>0)return n;let o=x2(e);return{...n,suggest:[{messageId:x0,data:{operator:"||="},fix:o},{messageId:x0,data:{operator:"??="},fix:e=>o(new Proxy(e,{get(e,t){if("insertTextBefore"!==t){let r=Reflect.get(e,t,e);return"function"==typeof r?r.bind(e):r}return(t,r)=>e.insertTextBefore(t,"||"===r?"??":r)}}))}]}}(r,t))}}});for(let[t,n]of Object.entries(xQ.create(r)))e.on(t,n)},meta:{type:xQ.meta.type,docs:{description:xQ.meta.docs.description,recommended:!0},fixable:xQ.meta.fixable,hasSuggestions:xQ.meta.hasSuggestions,schema:xQ.meta.schema,defaultOptions:[xQ.meta.defaultOptions?.[0]],messages:x1,languages:["js/js"]}},x8="no-useless-coercion",x6=new o([["Boolean",{type:"boolean",isType:n8}],["String",{type:"string",isType:or}],["BigInt",{type:"bigint",isType:function(e,t){return!!e&&(!!("TSSatisfiesExpression"===e.type&&n9(e.typeAnnotation)||n5(e,t))||"bigint"==typeof eN(e,t.sourceCode.getScope(e))?.value)}}],["Number",{type:"number",isType:(e,t)=>nW(e,t.sourceCode.getScope(e))}]]),x9="no-useless-boolean-cast",x5=["every","filter","find","findIndex","findLast","findLastIndex","some"],x4="no-useless-continue",x7="no-useless-override",be=e=>e.isUnion()?e.types.every(e=>be(e)):"void"===e.intrinsicName||"undefined"===e.intrinsicName,bt=(e,t)=>{let{parserServices:r}=t.sourceCode;if(r?.program)try{return{type:r.getTypeAtLocation(e),checker:r.program.getTypeChecker()}}catch{}},br="prefer-has-check",bn=new i(["Map","ReadonlyMap","WeakMap"]),bo=new i(["Map","WeakMap"]),ba=new i(["FormData","Headers","URLSearchParams"]),bi=new i(["Array","ReadonlyArray"]),bs=bo.union(ba),bl=new i(["ClassName","ImportBinding","TSEnumName","Type"]),bu=new i(["any","bigint","boolean","false","number","string","unknown","undefined","null","void"]),bp=new i(["TSTypeAnnotation","TSParenthesizedType"]),bc=new i(["TSAnyKeyword","TSNeverKeyword","TSUndefinedKeyword","TSUnknownKeyword","TSVoidKeyword"]),bd=new i(["TSBigIntKeyword","TSBooleanKeyword","TSNumberKeyword","TSStringKeyword"]),bm=new i(["TSArrayType","TSConstructorType","TSFunctionType","TSObjectKeyword","TSSymbolKeyword","TSTupleType"]),bf=new i(["ArrayExpression","ArrowFunctionExpression","ClassExpression","FunctionExpression","NewExpression","ObjectExpression"]),bg=new i(["ParenthesizedExpression","TSAsExpression","TSSatisfiesExpression","TSTypeAssertion","TSNonNullExpression"]),by=e=>{for(;bg.has(e.type);)e=e.expression;return e},bh=e=>{if("Identifier"===e.type)return e.name;if("TSQualifiedName"===e.type){let t=bh(e.left);return t?`${t}.${e.right.name}`:void 0}},bx=e=>e.typeArguments?.params??e.typeParameters?.params??[],bb=(e,t)=>{for(;t;){let r=t.set.get(e)?.defs.find(e=>bl.has(e.type));if(r)return r;t=t.upper}},bE=e=>{if(e?.type==="Type"&&"TSTypeAliasDeclaration"===e.node.type&&0===bx(e.node).length)return e.node.typeAnnotation},bv=(e,t)=>{if(t.sourceCode.isGlobalReference(e))return!0;let r=eg(t.sourceCode.getScope(e),e);return!r||0===r.defs.length},bC=(e,t)=>tR(e)&&bv(e,t)||"UnaryExpression"===e.type&&"void"===e.operator&&"Literal"===e.argument.type&&0===e.argument.value,bD=(e,t)=>bn.has(e)?{kind:"map",typeName:e,valueType:t}:ba.has(e)?{kind:"null-sentinel",typeName:e}:void 0,bS=(e,t,r=new i)=>{switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return bS(e.typeAnnotation,t,r);case"TSTypeOperator":return"readonly"===e.operator?bS(e.typeAnnotation,t,r):void 0;case"TSTypeReference":{let n=bh(e.typeName);if(!n)return;if((bn.has(n)||ba.has(n))&&!bb(n,t))return bD(n,bx(e).at(-1));let o=((e,t,r)=>{if(!r.has(e))return r.add(e),bE(bb(e,t))})(n,t,r);return o?bS(o,t,r):void 0}}},bT=(e,t)=>{let r=t.sourceCode.getScope(e);return bS(e.typeAnnotation,r)},bA=(e,t,r=new i)=>{let n=bT(e,t);if(n)return n;if(tm(e=by(e))&&"Identifier"===e.callee.type&&bs.has(e.callee.name)&&bv(e.callee,t))return bD(e.callee.name);if("Identifier"!==e.type)return;let o=eg(t.sourceCode.getScope(e),e);if(!o||r.has(o)||1!==o.defs.length)return;r.add(o);let[a]=o.defs,s=bS(a.name?.typeAnnotation,t.sourceCode.getScope(a.name));return s||("Variable"===a.type&&"const"===a.parent.kind&&a.node.id===a.name&&a.node.init?bA(a.node.init,t,r):void 0)},bw=(e,t)=>{for(let r of[e,e.target]){if(!r)continue;let e=r1(r);if(r2(e,t))return e.getName()}},bk=(e,t,r)=>{if(rZ.has(e.intrinsicName)||r0.has(e.intrinsicName))return;if(e.isUnion()){let n=e.types.map(e=>bk(e,t,r));if(1===new i(n.map(e=>e?.typeName)).size){let[e]=n;if(e?.kind!=="map")return e;let r=n.map(e=>e?.valueType);return{...e,valueType:r.every(Boolean)?t.getUnionType(r):void 0}}if(n.every(e=>e?.kind==="map")){let e=n.map(e=>e.valueType);return{kind:"map",typeName:"Map",valueType:e.every(Boolean)?t.getUnionType(e):void 0}}return n.every(e=>e?.kind==="null-sentinel")?{kind:"null-sentinel",typeName:"null-sentinel"}:void 0}if(e.isIntersection())return e.types.map(e=>bk(e,t,r)).find(e=>e?.kind==="map");let n=bw(e,r);return bD(n,bn.has(n)?t.getTypeArguments(e).at(-1):void 0)},bI=(e,t)=>{let{parserServices:r}=t.sourceCode;if(r?.program)try{let{program:t}=r;return bk(r.getTypeAtLocation(e),t.getTypeChecker(),t)}catch{}},bj=(e,t)=>bI(e,t)??bA(e,t),bF=(e,t)=>"truthy"===t?!!e:"not-undefined"===t?void 0!==e:null!=e,bB=(e,t,r,n=new i)=>{if(!e||bc.has(e.type))return!1;if(bp.has(e.type))return bB(e.typeAnnotation,t,r,n);if("TSTypeOperator"===e.type)return"readonly"===e.operator&&bB(e.typeAnnotation,t,r,n);if("TSUnionType"===e.type||"TSIntersectionType"===e.type)return e.types.every(e=>bB(e,t,r,n));if("TSNullKeyword"===e.type)return"not-undefined"===r;if(bd.has(e.type))return"truthy"!==r;if(bm.has(e.type))return!0;if("TSTypeLiteral"===e.type)return"truthy"!==r;if("TSLiteralType"===e.type){var o;let t="Literal"===(o=e.literal).type?o.value:"TemplateLiteral"===o.type&&0===o.expressions.length?o.quasis[0].value.cooked:"UnaryExpression"===o.type&&("-"===o.operator||"+"===o.operator)&&"Literal"===o.argument.type&&("number"==typeof o.argument.value||"bigint"==typeof o.argument.value)?"-"===o.operator?-o.argument.value:o.argument.value:void 0;return void 0!==t&&bF(t,r)}return"TSTypeReference"===e.type&&((e,t,r,n)=>{let o,a,i=bh(e.typeName);if(!i||n.has(i))return!1;n.add(i);let s=(a=bE(o=bb(i,t.sourceCode.getScope(e.typeName))))?{type:"alias",node:a}:o?.type==="ClassName"||o?.type==="Type"&&"TSInterfaceDeclaration"===o.node.type?{type:"object"}:void 0,l=!1;return s?.type==="alias"?l=bB(s.node,t,r,n):s?.type==="object"&&(l="truthy"!==r),n.delete(i),l})(e,t,r,n)},bR=(e,t)=>e.isTypeParameter?.()?e.getConstraint()??t.getBaseConstraintOfType(e):e,bP=(e,t,r)=>{if(rZ.has(e.intrinsicName))return!1;let n=bR(e,t);return n&&n!==e?bP(n,t,r):!e.isTypeParameter?.()&&(e.isUnion()||e.isIntersection()?e.types.every(e=>bP(e,t,r)):!r.has(e.intrinsicName))},bL=(e,t,r)=>{if(rZ.has(e.intrinsicName)||r0.has(e.intrinsicName))return!1;let n=bR(e,t);if(n&&n!==e)return bL(n,t,r);if(e.isUnion()||e.isIntersection())return e.types.every(e=>bL(e,t,r));if(bu.has(e.intrinsicName))return!1;if("true"===e.intrinsicName||"symbol"===e.intrinsicName)return!0;if(e.isStringLiteral?.())return e.value.length>0;if(e.isNumberLiteral?.())return 0!==e.value;if(e.isBigIntLiteral?.())return e.value.negative||"0"!==e.value.base10Value;let o=t.typeToString(e);return/^-?\d+n$/u.test(o)?!/^-?0n$/u.test(o):"object"===t.typeToString(e)||bi.has(bw(e,r))||e.getCallSignatures().length>0||e.getConstructSignatures().length>0},bN=(e,t,r)=>{if(!tm(e)||"Identifier"!==e.callee.type||!bo.has(e.callee.name)||!bv(e.callee,t))return;if(0===e.arguments.length)return!0;if(1!==e.arguments.length)return;let[n]=e.arguments;if("ArrayExpression"===n.type)return n.elements.every(e=>{var n;let o;return e?.type==="ArrayExpression"&&e.elements.length>=2&&e.elements[1]&&"SpreadElement"!==e.elements[1].type&&(n=e.elements[1],(o=eN(n,t.sourceCode.getScope(n)))?bF(o.value,r):!tR(n)&&bf.has(n.type))})},b$=(e,t,r)=>{let n=bN(by(e),t,r);if(void 0!==n)return n;let o=bI(e,t)?.valueType;if(o){let{program:e}=t.sourceCode.parserServices,n=e.getTypeChecker();if("truthy"===r?bL(o,n,e):"not-undefined"===r?bP(o,n,new i(["undefined","void"])):bP(o,n,new i(["undefined","void","null"])))return!0}return function e(t,r,n,o={}){let a,s=o.visitedVariables??new i,l=o.checkConstructorValues??!0,u=bT(t,r);if(u?.kind==="map")return!!u.valueType&&bB(u.valueType,r,n);let p=((e,t,r,n)=>{if(!tm(e)||"Identifier"!==e.callee.type||!bo.has(e.callee.name)||!bv(e.callee,t))return;if(n){let n=bN(e,t,r);if(void 0!==n)return n}let o=bx(e).at(-1);return!!o&&bB(o,t,r)})(t=by(t),r,n,l);if(void 0!==p)return p;let c=((e,t,r)=>{if("Identifier"!==e.type)return;let n=eg(t.sourceCode.getScope(e),e);if(!(!n||r.has(n))&&1===n.defs.length)return n})(t,r,s);if(!c)return!1;s.add(c);let[d]=c.defs,m=(a=bS(d.name?.typeAnnotation,r.sourceCode.getScope(d.name)),a?.kind==="map"?!!a.valueType&&bB(a.valueType,r,n):"Variable"===d.type&&"const"===d.parent.kind&&d.node.id===d.name&&!!d.node.init&&e(d.node.init,r,n,{visitedVariables:s,checkConstructorValues:!1}));return s.delete(c),m}(e,t,r)},bM="logical",bO="ternary",bU="consistent-conditional-object-spread",bq=new i(["==","==="]),bV=new i(["!=","!=="]),bW=e=>th(e)||tR(e)||ta(e),b_=e=>"SpreadElement"===e.parent.type&&e.parent.argument===e&&"ObjectExpression"===e.parent.parent.type&&e.parent.parent.properties.includes(e.parent);function bz(e,t,r){if(rv(e,t))return!0;if(e.type!==t.type)return!1;switch(e.type){case"AwaitExpression":return bz(e.argument,t.argument,r);case"LogicalExpression":return e.operator===t.operator&&bz(e.left,t.left,r)&&bz(e.right,t.right,r);case"UnaryExpression":return e.operator===t.operator&&e.prefix===t.prefix&&bz(e.argument,t.argument,r);case"UpdateExpression":return!1}return r.getText(e)===r.getText(t)}function bK(e){return ta(e)?"null":tR(e)?"undefined":void 0}function bG(e){if("BinaryExpression"!==e.type||!bq.has(e.operator)&&!bV.has(e.operator))return;let t=bK(e.left),r=bK(e.right);if(!!t!=!!r)return{reference:t?e.right:e.left,kind:2===e.operator.length?"nullish":t??r,isTrueWhenNullish:bq.has(e.operator)}}let bJ=(e,t)=>"null"===e.kind&&"undefined"===t.kind||"undefined"===e.kind&&"null"===t.kind;function bX(e,t){let r=bG(e);if(r?.kind==="nullish")return r;if("LogicalExpression"!==e.type)return;let n=bG(e.left),o=bG(e.right);if(n&&o&&bz(n.reference,o.reference,t)){if("||"===e.operator&&n.isTrueWhenNullish&&o.isTrueWhenNullish&&bJ(n,o))return{reference:n.reference,isTrueWhenNullish:!0};if("&&"===e.operator&&!n.isTrueWhenNullish&&!o.isTrueWhenNullish&&bJ(n,o))return{reference:n.reference,isTrueWhenNullish:!1}}}function bY(e,t,r){let n=e5(e,r);return!e4(e,r)&&o2(e,{operator:"&&",property:t})&&(n=`(${n})`),n}function bH(e,t){let r=e5(e,t);return!e4(e,t)&&oX(e)&&(r=`(${r})`),r}let bQ="default-export-style/inline",bZ="default-export-style/separate",b0="default-export-style/suggestion-inline",b1="default-export-style/suggestion-separate",b2="inline",b3="separate",b8="ignore",b6="class",b9="function",b5=()=>({enum:[b2,b3,b8]}),b4=(e,t)=>e?.type==="ExportDefaultDeclaration"&&"Identifier"===e.declaration.type&&e.declaration.name===t,b7=e=>e.id?.name,Ee=e=>{switch(e.type){case"ClassDeclaration":return b6;case"FunctionDeclaration":return b9}},Et=e=>e===b6?"classes":"functions",Er=(e,t)=>{let[,r]=e.sourceCode.getRange(t),n=e.sourceCode.getLoc(t).end.line;return rF(e).some(t=>e.sourceCode.getRange(t)[0]>=r&&e.sourceCode.getLoc(t).start.line===n)},En=(e,t)=>eg(e,t)?.references.some(e=>!e.init&&e.isWrite())??!1,Eo=e=>!!e&&!!(e.type.startsWith("TS")||e.typeAnnotation||e.typeParameters||e.returnType||e.implements?.length>0||e.superTypeArguments||e.accessibility||e.readonly||e.override||e.definite||e.optional&&"MemberExpression"!==e.type&&"CallExpression"!==e.type||e.abstract||e.declare||e.decorators?.length>0),Ea=(e,t)=>{if(Eo(e))return!0;for(let r of t[e.type]??[]){let n=e[r];if(Array.isArray(n)){if(n.some(e=>e?.type&&Ea(e,t)))return!0;continue}if(n?.type&&Ea(n,t))return!0}return!1},Ei=(e,t)=>e.params.every(e=>!rJ(e,t.sourceCode.visitorKeys)),Es=(e,t,r)=>eg(e,t)?.references.some(e=>!e.init&&e.identifier!==r)??!1,El=(e,t)=>{let r=b7(e);if(r){let t=Ee(e);return t&&{kind:t,name:r,declaration:e}}let n=((e,t)=>{if("VariableDeclaration"!==e.type||"const"!==e.kind||1!==e.declarations.length)return;let[r]=e.declarations;if(!("Identifier"!==r.id.type||Eo(r.id)||r.init?.type!=="ArrowFunctionExpression"||Ea(r.init,t.sourceCode.visitorKeys)))return r})(e,t);if(n)return{kind:b9,name:n.id.name,declaration:e,functionNode:n.init}},Eu=(e,t)=>e.params.map(e=>t.getText(e)).join(", "),Ep=({context:e,declaration:t,exportDeclaration:r,name:n,scope:o,rangeStartNode:a=t})=>{if(!(e.sourceCode.getCommentsInside(r).length>e.sourceCode.getCommentsInside(t).length||Es(o,t.id,"Identifier"===r.declaration.type?r.declaration:void 0))&&"FunctionDeclaration"===t.type&&!t.generator&&!Ea(t,e.sourceCode.visitorKeys)&&0===e.sourceCode.getCommentsInside(t).length&&Ei(t,e)&&!rJ(t.body,e.sourceCode.visitorKeys))return[{messageId:b1,fix:o=>o.replaceTextRange([e.sourceCode.getRange(a)[0],e.sourceCode.getRange(r)[1]],`const ${n} = ${t.async?"async ":""}(${Eu(t,e.sourceCode)}) => ${e.sourceCode.getText(t.body)};
|
|
44
|
-
export default ${n};`)}]},
|
|
45
|
-
export default ${n.id.name};`)}}}},Em={create:e=>{let t=e.options[0];e.on("Program",r=>{for(let[n,o]of r.body.entries()){if("ExportDefaultDeclaration"===o.type){let{declaration:r}=o,n=Ee(r),a=b7(r);if(!n||!a)continue;let i=Ed({context:e,exportDeclaration:o,expectedStyle:t[Et(n)],kind:n});if(i)return i;continue}let a=r.body[n+1],i=El(o,e);if(!i||!b4(a,i.name))continue;let s=Ec({context:e,exportDeclaration:a,expectedStyle:t[Et(i.kind)],scope:e.sourceCode.getScope(a),...i});if(s)return s}})},meta:{type:"suggestion",docs:{description:"Enforce consistent default export declarations.",recommended:!0},fixable:"code",hasSuggestions:!0,schema:[{type:"object",properties:{functions:b5(),classes:b5()},additionalProperties:!1}],defaultOptions:[{functions:b2,classes:b2}],messages:{[bQ]:"Prefer declaring this default-exported {{kind}} inline.",[bZ]:"Prefer declaring this default-exported {{kind}} as a separate {{style}}.",[b0]:"Use an inline default {{kind}} declaration.",[b1]:"Use a separate const arrow function default export."},languages:["js/js"]}};function Ef(e){for(;;){let t=rI(e);if(t!==e){e=t;continue}if(e?.type!=="ParenthesizedExpression")return e;e=e.expression}}function Eg(e,t){return eg(t.sourceCode.getScope(e),e)}let Ey="no-array-concat-in-loop",Eh="no-array-front-mutation",Ex=["stream.unshift","this.unshift","this.stream.unshift","process.stdin.unshift","process.stdout.unshift","process.stderr.unshift"],Eb="no-array-sort-for-min-max/error",EE="no-array-sort-for-min-max/suggestion",Ev=e=>tn(e)&&0===e.value,EC=(e,t)=>{if(!tA(e,{methods:["sort","toSorted"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||nE(e.callee.object,t)||rX(e.callee.object))return;let[r]=e.arguments,n=(e=>{if(!tE(e)||e.async||e.generator||2!==e.params.length||e.params.some(e=>"Identifier"!==e.type))return;let t=rI((e=>{if("BlockStatement"!==e.body.type)return e.body;if(1!==e.body.body.length)return;let[t]=e.body.body;if("ReturnStatement"===t.type)return t.argument})(e));if(t?.type!=="BinaryExpression"||"-"!==t.operator)return;let[r,n]=e.params;if(r.name!==n.name){if(rv(t.left,r)&&rv(t.right,n))return"ascending";if(rv(t.left,n)&&rv(t.right,r))return"descending"}})(r);if(n)return{direction:n,node:e.callee.object}},ED=(e,t,r,n)=>{var o,a,i;let s=(o=t.direction,"first"===r?"ascending"===o?"min":"max":"ascending"===o?"max":"min"),l={node:e,messageId:Eb,data:{method:s,extreme:"min"===s?"minimum":"maximum"}};if("Super"!==t.node.type&&0===n.sourceCode.getCommentsInside(e).length){let r,o=(a=t.node,i=n.sourceCode,r=oh(a)?i.getText(a):`(${i.getText(a)})`,`Math.${s}(...${r})`);l.suggest=[{messageId:EE,data:{replacement:o},fix:t=>t.replaceText(e,o)}]}return l},ES="no-boolean-sort-comparator",ET="no-boolean-sort-comparator/suggestion",EA=new i(["sort","toSorted"]),Ew=new i([">",">=","<","<="]),Ek=(e,t,r,n)=>(e=rI(e),t=rI(t),"Identifier"===e.type&&"Identifier"===t.type)?e.name===r.name&&t.name===n.name||e.name===n.name&&t.name===r.name:"MemberExpression"===e.type&&"MemberExpression"===t.type&&e.computed===t.computed&&(e.computed?!!rv(e.property,t.property):e.property.name===t.property.name)&&Ek(e.object,t.object,r,n),EI=(e,t)=>{for(;rk(e);){if(e.typeAnnotation&&n0(e.typeAnnotation,t,t.sourceCode.getScope(e)))return!0;e=e.expression}return!1},Ej="no-chained-comparison/error",EF="no-chained-comparison/suggestion",EB=new i(["<",">","<=",">="]),ER=new i(["===","!==","==","!="]),EP=EB.union(ER),EL=e=>"BinaryExpression"===e.type&&EP.has(e.operator),EN="no-constant-zero-expression/error",E$="no-constant-zero-expression/suggestion",EM="no-duplicate-logical-operands",EO="no-duplicate-logical-operands/suggestion",EU=new i(["Identifier","ThisExpression","Literal"]),Eq=new i(["Identifier","ThisExpression"]),EV=e=>{if(ub(e=rI(e)))return!1;switch(e.type){case"Identifier":case"Super":case"ThisExpression":return!0;case"MemberExpression":var t;return EV(e.object)&&(!e.computed||(t=rI(t=e.property),EU.has(t.type)));default:return!1}},EW="no-impossible-length-comparison",E_={"<":">","<=":">=",">":"<",">=":"<=","===":"===","!==":"!==","==":"==","!=":"!="},Ez="no-invalid-character-comparison",EK=new i(["==","===","!=","!=="]),EG=(e,t)=>!!(tA(e,{method:"charAt",maximumArguments:1,optionalCall:!1,optionalMember:!1})&&or(e.callee.object,t)||tA(e,{method:"at",maximumArguments:1,optionalCall:!1,optionalMember:!1})&&or(e.callee.object,t))||"MemberExpression"===e.type&&e.computed&&!e.optional&&(e=>{if(tn(e))return!0;if(!te(e))return!1;let t=Number(e.value);return Number.isSafeInteger(t)&&t>=0&&String(t)===e.value})(e.property)&&or(e.object,t),EJ="no-loop-iterable-mutation",EX=["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"],EY=["add","clear","delete"],EH=["clear","delete","set"],EQ={array:new i(EX),set:new i(EY),map:new i(EH),unknown:new i([...EX,...EY,...EH])},EZ=new i(["entries","keys","values"]),E0=new i(["ArrowFunctionExpression","ClassDeclaration","ClassExpression","FunctionDeclaration","FunctionExpression"]);function E1(e,t){return nb(e,t)?"array":nw(e,t)?"set":nk(e,t)?"map":void 0}function E2(e){return"VariableDeclaration"===e.left.type?e.left.declarations[0].id:e.left}function E3(e){return"Identifier"===(e=rI(e)).type?e:void 0}function E8(e){if("ArrayPattern"!==(e=rI(e)).type)return;let[t]=e.elements;return t&&E3(t)}function E6(e,t){if(ub(e=rI(e)))return;if(ux(e))return{collectionKind:E1(e,t),reference:e,method:"direct"};if("CallExpression"!==e.type||"MemberExpression"!==e.callee.type||e.arguments.length>0)return;let r=eM(e.callee,t.sourceCode.getScope(e.callee));if(!(!EZ.has(r)||ub(e.callee.object))&&ux(e.callee.object))return{collectionKind:E1(e.callee.object,t),reference:e.callee.object,method:r}}function E9(e,t){let r=E2(e);return"keys"===t.method?E3(r):"entries"===t.method||"direct"===t.method&&"set"!==t.collectionKind?E8(r):void 0}function E5(e,t){let r,n;if("VariableDeclaration"!==e.left.type||"const"!==e.left.kind)return{collectionKind:t.collectionKind,iterable:t.reference,loopBody:e.body};let o=(r=E2(e),"entries"===t.method?E8(r):"direct"!==t.method||"map"!==t.collectionKind?E3(r):void 0),a=E9(e,t),i=(n=E2(e),"set"===t.collectionKind&&("direct"===t.method||"values"===t.method)?E3(n):"direct"===t.method&&"map"!==t.collectionKind?E3(n)??E8(n):E9(e,t));return{addArgumentIdentifier:o,collectionKind:t.collectionKind,deleteArgumentIdentifier:i,iterable:t.reference,loopBody:e.body,setKeyIdentifier:a}}function*E4(e){"Identifier"===(e=rI(e)).type?yield e:"MemberExpression"===e.type&&(yield*E4(e.object),e.computed&&(yield*E4(e.property)))}function E7(e,t,r){if(!uh(e,t))return!1;let n=[...E4(e)],o=[...E4(t)];return n.length!==o.length||0===n.length?n.length===o.length:n.every((e,t)=>{var n;let a,i;return n=o[t],a=eg(r.sourceCode.getScope(e),e),i=eg(r.sourceCode.getScope(n),n),a||i?a===i:e.name===n.name})}function ve(e,t,r){let[n]=e.arguments;return!!(t&&n&&E7(n,t,r))}function vt(e,t,r,n){return"add"===r&&ve(e,t.addArgumentIdentifier,n)||"set"===r&&ve(e,t.setKeyIdentifier,n)}let vr="no-selector-as-dom-name",vn=["add","remove","contains","toggle","replace"],vo=/^[#.]-?[A-Z_a-z][\w-]*$/u,va=new i([".","#"]),vi=e=>va.has(e?.[0]),vs=e=>tr(e)??("TemplateLiteral"===e.type&&e.quasis[0].value.cooked),vl=(e,t,r,n)=>({node:e,messageId:vr,fix:((e,t,r,n)=>{let o=((e,t)=>{let[r]=t.getRange(e);return[r+1,r+2]})(e,n);if(t.startsWith(r)&&n.text[o[0]]===r){if("TemplateLiteral"===e.type&&e.expressions.length>0){if(1!==e.expressions.length||e.quasis[0].value.cooked!==r||""!==e.quasis[1].value.cooked)return;return e=>e.removeRange(o)}if(vo.test(t))return e=>e.removeRange(o)}})(e,t,r,n)}),vu=(e,t)=>e.map(e=>({node:e,expectedPrefix:t})),vp="no-useless-compound-assignment/error",vc="no-useless-compound-assignment/remove",vd="no-useless-compound-assignment/replace",vm=new o([["+=",0],["-=",0],["*=",1],["/=",1],["**=",1]]),vf="no-useless-delete-check",vg="removeCheck",vy={considerGetters:!0},vh=new i(["Map","Set","WeakMap","WeakSet"]),vx=new i(["ArrayExpression","ArrowFunctionExpression","ClassExpression","FunctionExpression","ObjectExpression"]),vb=new i(["ClassName","FunctionName"]),vE=new i(["TSConstructorType","TSFunctionType","TSObjectKeyword"]),vv=e=>null!==e&&("object"==typeof e||"function"==typeof e),vC=e=>!!vE.has(e?.type)||e?.type==="TSUnionType"&&e.types.every(e=>vC(e)),vD=(e,t)=>{if("Identifier"!==e.type)return!1;let r=eg(t.sourceCode.getScope(e),e);return r?.defs.some(e=>vb.has(e.type))??!1},vS=(e,t)=>{let r=eN(e,t.sourceCode.getScope(e));return r&&"symbol"!=typeof r.value&&!vv(r.value)?String(r.value):void 0},vT=(e,t)=>{let r=eN(e,t.sourceCode.getScope(e));if(r)return vv(r.value);let n=rU(rI(e),t);if(n){let e=rI(n),r=eN(e,t.sourceCode.getScope(e));if(r)return vv(r.value);if(vx.has(e.type))return!0}return!vD(rI(e),t)&&vC(((e,t)=>{if("Identifier"!==(e=rI(e)).type)return;let r=eg(t.sourceCode.getScope(e),e);return r?.defs[0]?.name?.typeAnnotation?.typeAnnotation??e.typeAnnotation?.typeAnnotation})(e,t))},vA=(e,t)=>!e_(e,t.sourceCode,vy),vw=(e,t)=>tA(e,{method:t,argumentsLength:1,computed:!1,optionalCall:!1,optionalMember:!1,allowSpreadElement:!1}),vk=(e,t,r)=>n=>{if(rN(r,r.sourceCode.getRange(e)))return;let o=r.sourceCode.getText(t.parent);return o.trimEnd().endsWith(";")||(o+=";"),oC(r.sourceCode.getTokenBefore(e),r,o)&&(o=`;${o}`),n.replaceText(e,o)},vI="no-useless-logical-operand",vj=new o([["&&",!0],["||",!1]]),vF=new o([["&&",!1],["||",!0]]),vB=new i(["FunctionExpression","ClassExpression","ObjectExpression"]),vR="prefer-boolean-return",vP=new i(["==","!=","===","!==","<","<=",">",">=","in","instanceof"]);function vL(e){if(e){if("BlockStatement"===e.type){let t=e.body.filter(({type:e})=>"EmptyStatement"!==e);if(1===t.length)return vL(t[0])}return e}}let vN=e=>{if(e?.type==="ReturnStatement"&&e.argument?.type==="Literal"&&"boolean"==typeof e.argument.value)return e.argument.value};function v$(e,t){switch(e.type){case"Literal":return"boolean"==typeof e.value;case"UnaryExpression":return["!","delete"].includes(e.operator);case"BinaryExpression":return vP.has(e.operator);case"LogicalExpression":return v$(e.left,t)&&v$(e.right,t);case"CallExpression":return tO(e,t)||"CallExpression"===e.type&&!e.optional&&"MemberExpression"===e.callee.type&&!e.callee.optional&&!e.callee.computed&&"Identifier"===e.callee.object.type&&"Array"===e.callee.object.name&&t.sourceCode.isGlobalReference(e.callee.object)&&"Identifier"===e.callee.property.type&&"isArray"===e.callee.property.name;default:return!1}}let vM="prefer-flat-math-min-max",vO=["min","max"],vU=(e,t)=>tA(e,{object:"Math",method:t,optionalCall:!1,optionalMember:!1}),vq=(e,t)=>{let r=[];for(let n of e.arguments){if(vU(n,t)){r.push(...vq(n,t));continue}r.push(n)}return r},vV="prefer-hoisting-branch-code/start",vW="prefer-hoisting-branch-code/end",v_="prefer-hoisting-branch-code/suggestion",vz=new i(["await using","using"]),vK=(e,t)=>e_(e,t)||function e(t,r){if("TaggedTemplateExpression"===t.type)return!0;for(let n of r.visitorKeys[t.type]??[]){let o=t[n];if(Array.isArray(o)){for(let t of o)if(t&&e(t,r))return!0;continue}if(o&&e(o,r))return!0}return!1}(e,t),vG=(e,t)=>{let r=t.getTokens(e),n=r.at(-1);return n?.type==="Punctuator"&&";"===n.value?r.slice(0,-1):r},vJ=(e,t,r)=>{let n=vG(e,r),o=vG(t,r);return 0!==n.length&&n.length===o.length&&n.every((e,t)=>e.type===o[t].type&&e.value===o[t].value)};function vX(e,{leading:t,trailing:r,isStart:n},o){let{sourceCode:a}=o,{body:i}=e;if(n){let[e]=a.getRange(i[0]),[r]=a.getRange(i[t]);return[e,r]}let[,s]=a.getRange(i[i.length-r-1]),[,l]=a.getRange(i.at(-1));return[s,l]}function vY({ifStatement:e,blocks:t,leading:r,trailing:n,isStart:o},a){var i;let{sourceCode:s}=a,l=t[0].body,u=o?l.slice(0,r):l.slice(l.length-n),p=u.every(e=>!rO(e))&&function(e){let{parent:t}=e;return["Program","BlockStatement","StaticBlock","SwitchCase"].includes(t.type)}(e)&&!((i={leading:r,trailing:n,isStart:o}).isStart&&((e,t)=>{let{sourceCode:r}=t,[n]=r.getRange(e),o=r.getTokenBefore(e);return rN(t,[o?r.getRange(o)[1]:0,n])})(e,a)||!i.isStart&&((e,t)=>{let{sourceCode:r}=t,n=r.getCommentsAfter(e)[0];return!!(n&&r.getLoc(n).start.line===r.getLoc(e).end.line)})(e,a)||t.some(e=>{let{sourceCode:t}=a,[r]=t.getRange(e),[n]=t.getRange(e.body[0]);if(i.isStart&&rN(a,[r+1,n]))return!0;if(!i.isStart){let[,r]=t.getRange(e.body.at(-1)),[,n]=t.getRange(e);if(rN(a,[r,n-1]))return!0}return rN(a,vX(e,i,a))}))&&(o||t.every(e=>!function(e,t,r){let{sourceCode:n}=r,{body:o}=e,[a]=n.getRange(o[o.length-t]),[i,s]=n.getRange(e);for(let t of n.getScope(e).variables){let[e]=t.defs;if(!e||e.parent?.type==="VariableDeclaration"&&"var"===e.parent.kind)continue;let[r]=n.getRange(e.name);if(!(r<=i)&&!(r>=a)){if(e.parent?.type==="VariableDeclaration"&&vz.has(e.parent.kind))return!0;for(let e of t.references){let[t]=n.getRange(e.identifier);if(t>=a&&t<=s)return!0}}}return!1}(e,n,a))),c={loc:{start:s.getLoc(u[0]).start,end:s.getLoc(u.at(-1)).end},messageId:o?vV:vW};if(p){let i=function({ifStatement:e,blocks:t,leading:r,trailing:n,isStart:o},a){let{sourceCode:i}=a,s=rA(e,a),l=o?r:n,u=t[0].body,p=o?u.slice(0,l):u.slice(u.length-l),c=function(e,t,r){let{sourceCode:n}=r,[o]=n.getRange(e[0]),[,a]=n.getRange(e.at(-1)),i=n.text.slice(o,a),s=rA(e[0],r);return s===t?i:i.split("\n").map((e,r)=>0===r?e:e.startsWith(s)?`${t}${e.slice(s.length)}`:e).join("\n")}(p,s,a);return function*(l){if(o){let t=i.getTokenBefore(e),r=t&&oC(t,a,c)?";":"";yield l.insertTextBefore(e,`${r}${c}
|
|
46
|
-
${s}`)}else{let t=i.getLastToken(p.at(-1)),r=i.getTokenAfter(e),n=r&&
|
|
47
|
-
${s}${c}${n}`)}for(let e of t)yield l.removeRange(vX(e,{leading:r,trailing:n,isStart:o},a))}}({ifStatement:e,blocks:t,leading:r,trailing:n,isStart:o},a);!o||function(e,t){for(let r=e;r?.type==="IfStatement";r=r.alternate)if(vK(r.test,t))return!1;return!0}(e,s)&&u.every(e=>"ExpressionStatement"===e.type&&!vK(e,s))?c.fix=i:c.suggest=[{messageId:v_,fix:i}]}return c}let{parse:vH}=sm,vQ="prefer-single-replace",vZ=new i(["g","m","s"]),v0=new o([["\\",String.raw`\\`],["]",String.raw`\]`],["\n",String.raw`\n`],["\r",String.raw`\r`],[" ",String.raw`\t`],["\f",String.raw`\f`],["\v",String.raw`\v`],["\u2028",String.raw`\u2028`],["\u2029",String.raw`\u2029`]]);function v1(e){if(!tA(e,{methods:["replace","replaceAll"],argumentsLength:2,optionalCall:!1,optionalMember:!1,computed:!1}))return;let[t]=e.arguments;if(te(t)){if("replaceAll"!==e.callee.property.name)return;return 1===t.value.length?t.value:void 0}if(to(t))return function({pattern:e,flags:t}){let r;if(t.includes("g")){for(let e of t)if(!vZ.has(e))return;try{r=vH(e,t,{namedGroups:!0,lookbehind:!0})}catch{return}return function e(t){return"value"===t.type?String.fromCodePoint(t.codePoint):("alternative"!==t.type||1!==t.body.length)&&("characterClass"!==t.type||t.negative||1!==t.body.length)?void 0:e(t.body[0])}(r)}}(t.regex)}let v2="consistent-tuple-labels",v3="no-invalid-well-known-symbol-methods/async-dispose",v8="no-invalid-well-known-symbol-methods/dispose-generator",v6="no-invalid-well-known-symbol-methods/sync-iterator",v9="no-invalid-well-known-symbol-methods/async-iterator",v5="no-invalid-well-known-symbol-methods/suggestion",v4=new i(["Promise","PromiseLike"]),v7=new i(["dispose","iterator","asyncIterator"]);function Ce(e){return"TSTypeReference"===e.type&&"Identifier"===e.typeName.type&&v4.has(e.typeName.name)}function Ct(e,t){let r,n=function(e){if(e.computed&&"MemberExpression"===e.key.type&&!e.key.computed&&"Identifier"===e.key.object.type&&"Symbol"===e.key.object.name&&"Identifier"===e.key.property.type)return e.key.property.name}(e);if(!v7.has(n))return;let o=function(e){if("get"!==e.kind&&"set"!==e.kind&&("MethodDefinition"===e.type||"PropertyDefinition"===e.type||"Property"===e.type))return e.value}(e);if(o?.type!=="FunctionExpression"&&o?.type!=="ArrowFunctionExpression")return;if("dispose"===n&&o.generator)return{node:e.key,messageId:v8};let a=!o.async&&(!!(r=o.returnType?.typeAnnotation)&&("TSTypeReference"===r.type?Ce(r):"TSUnionType"===r.type&&r.types.some(e=>Ce(e)))||function(e,t){let{parserServices:r}=t.sourceCode;if(!r?.program)return!1;try{let t=r.program.getTypeChecker(),n=r.esTreeNodeToTSNodeMap.get(e),o=t.getSignatureFromDeclaration(n);if(o)return!0===op(t.getReturnTypeOfSignature(o),t);return r.getTypeAtLocation(e).getCallSignatures().some(e=>!0===op(t.getReturnTypeOfSignature(e),t))}catch{return!1}}(o,t));if("dispose"===n&&(o.async||a))return{node:e.key,messageId:v3,fix:t=>t.replaceText(e.key.property,"asyncDispose")};if("iterator"===n&&(o.async||a)){let t={node:e.key,messageId:v6};return o.generator&&(t.suggest=[{messageId:v5,data:{replacement:"asyncIterator"},fix:t=>t.replaceText(e.key.property,"asyncIterator")}]),t}if("asyncIterator"===n&&!o.generator&&(o.async||a))return{node:e.key,messageId:v9}}let Cr="after-suspension",Cn="in-generator",Co="in-nested-function",Ca=["preventDefault","stopImmediatePropagation","stopPropagation"],Ci="prefer-abort-signal-timeout",Cs="prefer-abort-signal-timeout/suggestion",Cl=new i(["reason","throwIfAborted"]),Cu=(e,t)=>{let r,{parent:n}=e;if(!(!tS(n,{property:"signal",computed:!1,optional:!1})||n.object!==e||nP(n)||("ForInStatement"===n.parent.type||"ForOfStatement"===n.parent.type)&&n.parent.left===n||tS(n.parent)&&n.parent.object===n&&(r=n.parent,Cl.has(eM(r,t.sourceCode.getScope(r))))||(e=>{let{expression:t,parent:r}=(e=>{let t=e,{parent:r}=e;for(;rk(r);)t=r,r=r.parent;return{expression:t,parent:r}})(e);return"VariableDeclarator"===r.type&&r.init===t||"AssignmentExpression"===r.type&&r.right===t})(n)||rN(t,t.sourceCode.getRange(n))))return n},Cp=(e,t,r,n)=>{let o=eg(n.sourceCode.getScope(r),e);return o&&o!==t},Cc="prefer-aggregate-error",Cd=/[Ee]rrors$|[Ee]rror(?:List|Array|Collection)$/u,Cm=new i(s5);function Cf(e){for(;e?.type==="ParenthesizedExpression";)e=e.expression;return rI(e)}function Cg(e){if("Identifier"===e.type)return e.name;if("TSQualifiedName"===e.type){let t=Cg(e.left);return t?`${t}.${e.right.name}`:void 0}}function Cy(e){return e=e?.type==="TSTypeAnnotation"?e.typeAnnotation:e,e?.type==="TSTypeOperator"&&"readonly"===e.operator&&(e=e.typeAnnotation),e?.type==="TSParenthesizedType"?Cy(e.typeAnnotation):e}function Ch(e,t,r,n=new i){switch(e=Cy(e),e?.type){case"TSTypeReference":{let o=Cg(e.typeName);if(!o)return!1;let a=oT(o,t);if(Cm.has(o)&&!((a?.defs.length??0)>0))return!0;if(n.has(o))return!1;n.add(o);let[i]=a?.defs??[],s=i?r.sourceCode.getScope(i.name):t,l=i?.type==="Type"&&"TSTypeAliasDeclaration"===i.node.type&&Ch(i.node.typeAnnotation,s,r,n);return n.delete(o),l}case"TSUnionType":return e.types.every(e=>Ch(e,t,r,n));case"TSIntersectionType":return e.types.some(e=>Ch(e,t,r,n));default:return!1}}function Cx(e,t){let r;if(tS(e=Cf(e),{property:"length",optional:!1})&&"Identifier"===e.object.type&&(r=e.object.name,Cd.test(r))&&nb(e.object,t)&&function(e,t){let r=oT(e.name,t.sourceCode.getScope(e)),[n]=r?.defs??[],o=n?t.sourceCode.getScope(n.name):t.sourceCode.getScope(e);return function e(t,r,n,o=new i){switch(t=Cy(t),t?.type){case"TSArrayType":return Ch(t.elementType,r,n,o);case"TSTupleType":return t.elementTypes.length>0&&t.elementTypes.every(e=>Ch("TSNamedTupleMember"===e.type?e.elementType:"TSRestType"===e.type?e.typeAnnotation:e,r,n,o));case"TSTypeReference":return function(t,r,n,o){let a=Cg(t.typeName),i=t.typeArguments?.params??t.typeParameters?.params;if(("Array"===a||"ReadonlyArray"===a)&&i?.length===1)return Ch(i[0],r,n,o);if(!a||o.has(a))return!1;o.add(a);let s=oT(a,r),[l]=s?.defs??[],u=l?n.sourceCode.getScope(l.name):r,p=l?.type==="Type"&&"TSTypeAliasDeclaration"===l.node.type&&e(l.node.typeAnnotation,u,n,o);return o.delete(a),p}(t,r,n,o);case"TSUnionType":return t.types.every(t=>e(t,r,n,o));case"TSIntersectionType":return t.types.some(t=>e(t,r,n,o));default:return!1}}(n?.name?.typeAnnotation,o,t)||function(e,t){let{parserServices:r}=t.sourceCode;if(!r?.program)return!1;try{let{program:t}=r;return function e(t,r,n,o=new i){if(!t||o.has(t))return!1;if(o.add(t),t.isUnion())return t.types.every(t=>e(t,r,n,o));if(t.isIntersection())return t.types.some(t=>e(t,r,n,o));let a=r.getBaseConstraintOfType(t);if(a&&a!==t)return e(a,r,n,o);if(!(r.isArrayType(t)||r.isTupleType(t)))return!1;let s=r.getTypeArguments(t);return s.length>0&&s.every(e=>(function e(t,r,n,o=new i){if(!t||o.has(t))return!1;if(o.add(t),t.isUnion())return t.types.every(t=>e(t,r,n,o));if(t.isIntersection())return t.types.some(t=>e(t,r,n,o));let a=r.getBaseConstraintOfType(t);if(a&&a!==t)return e(a,r,n,o);let s=r1(t);return!!(Cm.has(s?.getName())&&r2(s,n))||r3(t,r).some(t=>e(t,r,n,o))})(e,r,n))}(r.getTypeAtLocation(e),t.getTypeChecker(),t)}catch{return!1}}(e,t)}(e.object,t))return e.object}let Cb=(e,t,r)=>{var n;if(("!=="===e||"!="===e)&&e7(Cf(t),0))return!0;let o=(n=Cf(n=t),n?.type==="Literal"&&"number"==typeof n.value?n.value:void 0);return void 0!==o&&(r?">"===e&&o>=0||">="===e&&o>=1:"<"===e&&o>=0||"<="===e&&o>=1)},CE=e=>"LogicalExpression"!==(e=Cf(e)).type||"&&"!==e.operator?[e]:[...CE(e.left),...CE(e.right)],Cv={resize:"Prefer ResizeObserver over a resize listener with layout reads.",scroll:"Prefer IntersectionObserver over a scroll listener with layout reads."},CC=new i(Object.keys(Cv)),CD=new i(["globalThis","self","window"]),CS=new i(["getBoundingClientRect","getClientRects"]),CT=new i(["clientHeight","clientLeft","clientTop","clientWidth","offsetHeight","offsetLeft","offsetParent","offsetTop","offsetWidth","scrollHeight","scrollWidth"]),CA=new i(["innerHeight","innerWidth"]),Cw=new i(["height","width"]),Ck=new i(["Window"]),CI=new i(["VisualViewport"]),Cj=new i(["Document","Element","HTMLElement","Node","SVGElement","VisualViewport","Window"]),CF=(e,t,r)=>{let n;if(rZ.has(e.intrinsicName))return!1;if(r0.has(e.intrinsicName)||e.intrinsicName)return!0;if(e.isUnion()||e.isIntersection())return e.types.every(e=>CF(e,t,r));let o=t.getBaseConstraintOfType(e);if(o&&o!==e)return CF(o,t,r);let a=r1(e);return!(!a||r3(e,t).some(e=>!CF(e,t,r)))&&(!r2(a,r)||(n=a.getName(),!(Cj.has(n)||/^HTML\w*Element$/.test(n)||/^SVG\w*Element$/.test(n))))},CB=(e,t,r,n)=>{if(rZ.has(e.intrinsicName)||r0.has(e.intrinsicName))return!1;if(e.isUnion()){let o=e.types.filter(e=>!r0.has(e.intrinsicName));return o.length>0&&o.every(e=>CB(e,t,r,n))}if(e.isIntersection())return e.types.some(e=>CB(e,t,r,n));let o=t.getBaseConstraintOfType(e);if(o&&o!==e)return CB(o,t,r,n);let a=r1(e);return!!(a&&r2(a,r)&&n.has(a.getName()))||r3(e,t).some(e=>CB(e,t,r,n))},CR=(e,t,r)=>{let{parserServices:n}=t.sourceCode;if(!n?.program)return!1;try{let{program:t}=n,o=t.getTypeChecker();return CB(n.getTypeAtLocation(e),o,t,r)}catch{return!1}},CP=(e,t)=>{let{parserServices:r}=t.sourceCode;if(!r?.program)return!1;try{let{program:t}=r,n=t.getTypeChecker();return CF(r.getTypeAtLocation(e),n,t)}catch{return!1}},CL=e=>e.computed||"Identifier"!==e.property.type?tr(rI(e.property)):e.property.name,CN=(e,t)=>e.properties.some(e=>t.has((e=>{if("Property"===e.type)return e.computed||"Identifier"!==e.key.type?tr(rI(e.key)):e.key.name})(e))),C$=(e,t)=>"Identifier"===e.type&&CD.has(e.name)&&om(e,t),CM=e=>nP(e)&&"UpdateExpression"!==e.parent.type&&("AssignmentExpression"!==e.parent.type||e.parent.left!==e||"="===e.parent.operator),CO=(e,t)=>"Identifier"===(e=rI(e)).type?"visualViewport"===e.name&&om(e,t):"MemberExpression"===e.type&&"visualViewport"===CL(e)&&C$(rI(e.object),t),CU=(e,t)=>{var r;return C$(e=rI(e),t)||("Identifier"===(r=rI(r=e)).type?"document"===r.name&&om(r,t):"MemberExpression"===r.type&&"document"===CL(r)&&C$(rI(r.object),t))||CO(e,t)},Cq=(e,t,r)=>{let n=rI(t);return CN(e,CA)&&(C$(n,r)||CR(t,r,Ck))||CN(e,Cw)&&(CO(n,r)||CR(t,r,CI))||CN(e,CT)&&!CU(n,r)&&!CP(t,r)},CV=(e,t,r=e)=>{let n,o,a,i;if(!e||e!==r&&tE(e))return!1;if(a=e,i=t,td(a,void 0,tu)&&"MemberExpression"===a.callee.type&&CS.has(CL(a.callee))&&!CU(a.callee.object,i)&&!CP(a.callee.object,i)||tk(e)&&CA.has(e.name)&&!CM(e)&&om(e,t)||"MemberExpression"===e.type&&!CM(e)&&(n=CL(e),o=rI(e.object),CA.has(n)&&(C$(o,t)||CR(e.object,t,Ck))||Cw.has(n)&&(CO(o,t)||CR(e.object,t,CI))||CT.has(CL(e))&&!CU(e.object,t)&&!CP(e.object,t))||("VariableDeclarator"===e.type&&"ObjectPattern"===e.id.type&&e.init?Cq(e.id,e.init,t):"AssignmentExpression"===e.type&&"ObjectPattern"===e.left.type&&Cq(e.left,e.right,t)))return!0;for(let n of t.sourceCode.visitorKeys[e.type]??[]){let o=e[n];if(Array.isArray(o)){if(o.some(e=>CV(e,t,r)))return!0;continue}if(CV(o,t,r))return!0}return!1},CW="prefer-set-methods/union",C_="prefer-set-methods/intersection",Cz="prefer-set-methods/intersection-suggestion",CK="prefer-set-methods/difference",CG="prefer-set-methods/difference-suggestion",CJ=(e,t)=>tm(e,{name:"Set",argumentsLength:1})&&om(e.callee,t),CX=(e,t)=>{let r=e5(e,t);return oQ(e,t)&&!e4(e,t)?`(${r})`:r},CY=(e,t,r)=>((e,t)=>{let r=e;for(;r.parent;){if("ExpressionStatement"===r.parent.type)return t.sourceCode.getRange(t.sourceCode.getFirstToken(r.parent.expression))[0]===t.sourceCode.getRange(t.sourceCode.getFirstToken(e))[0];r=r.parent}return!1})(e,r)&&oC(r.sourceCode.getTokenBefore(e),r,t)?`;${t}`:t,CH=(e,t)=>("ParenthesizedExpression"===e.type||rk(e))&&e.expression===t,CQ=e=>{for(;e.parent;){let{parent:t}=e;if(CH(t,e)){e=t;continue}break}return e},CZ=(e,t)=>e?.type==="SpreadElement"&&"Set"===o$(e.argument,t),C0=(e,t,r)=>{if(!(!tA(e,{method:"has",argumentsLength:1,optionalCall:!1,optionalMember:!1})||!rv(e.arguments[0],t)||rv(e.callee.object,t))&&"Set"===o$(e.callee.object,r))return e.callee.object},C1=(e,t,r)=>{var n;if(r.sourceCode.getCommentsInside(t).length>0||(n=CQ(n=e),n.parent?.type==="MemberExpression"&&n.parent.object===n)||e===t&&rk(e.parent))return;let o=((e,t)=>{if(!tA(e,{method:"filter",argumentsLength:1,optionalCall:!1,optionalMember:!1})||t.sourceCode.getCommentsInside(e).length>0)return;let r=((e,t)=>{if("ArrayExpression"===e.type&&1===e.elements.length&&CZ(e.elements[0],t))return e.elements[0].argument})(e.callee.object,t);if(!r)return;let[n]=e.arguments;if("ArrowFunctionExpression"!==n.type||n.async||1!==n.params.length||"Identifier"!==n.params[0].type)return;let o=((e,t,r)=>{let n=C0(e,t,r);if(n)return{method:"intersection",messageId:C_,suggestionMessageId:Cz,otherSet:n};if("UnaryExpression"!==e.type||"!"!==e.operator||!e.prefix)return;let o=C0(e.argument,t,r);if(o)return{method:"difference",messageId:CK,suggestionMessageId:CG,otherSet:o}})(n.body,n.params[0],t);if(!(!o||e_(o.otherSet,t.sourceCode,{considerGetters:!0})))return{messageId:o.messageId,suggestionMessageId:o.suggestionMessageId,replacement:`${CX(r,t)}.${o.method}(${e5(o.otherSet,t)})`}})(e,r);if(o)return{node:t,messageId:o.messageId,suggest:[{messageId:o.suggestionMessageId,fix:e=>e.replaceText(t,CY(t,o.replacement,r))}]}},C2="prefer-toggle-attribute/error",C3="prefer-toggle-attribute/suggestion",C8=(e,t,r)=>{let n=e5(e,t);return r?"UnaryExpression"===e.type&&"!"===e.operator&&e.prefix&&t.sourceCode.getCommentsInside(e).length===t.sourceCode.getCommentsInside(e.argument).length?C8(e.argument,t,!1):(!e4(e,t.sourceCode)&&o1(e,"!")&&(n=`(${n})`),`!${n}`):e4(e,t.sourceCode)||"SequenceExpression"!==e.type?n:`(${n})`},C6=(e,t,r)=>tA(e,{methods:t,argumentsLength:r,optionalCall:!1,computed:!1});function C9(e){if(e?.type==="ChainExpression"&&(e=e.expression),C6(e,["removeAttribute","hasAttribute"],1)||C6(e,["setAttribute"],2)){let{callee:t}=e,[r,n]=e.arguments;if(tr(r)?.toLowerCase().startsWith("data-"))return;let o=t.property.name;return{node:e,method:o,receiver:t.object,attributeName:r,attributeValue:n,isOptional:!!t.optional,hasEmptyAttributeValue:"setAttribute"!==o||e7(n,"")}}}function C5(e){if(e){if("BlockStatement"===e.type){if(1!==e.body.length)return;e=e.body[0]}return"ExpressionStatement"===e.type&&(e=e.expression),C9(e)}}let C4=(e,t)=>e.isOptional===t.isOptional&&rv(e.receiver,t.receiver)&&rv(e.attributeName,t.attributeName),C7=(e,t)=>oo(e.receiver)||nB(e.receiver,t),De="prefer-url-search-parameters/error",Dt="prefer-url-search-parameters/suggestion",Dr=new i(["node:url","url"]),Dn=e=>"Type"===e.type||"ImportBinding"===e.type&&oD(e.node),Do=(e,t,r)=>{let n=eg(r.sourceCode.getScope(t),e);return!n||n.defs.every(e=>Dn(e))},Da=(e,t)=>tr(rI(e))===t,Di=(e,t)=>{let r=t.sourceCode.getText(e);return"SequenceExpression"===e.type?`(${r})`:r},Ds=(e,t)=>{if(!tA(e=rI(e),{method:"map",argumentsLength:1,computed:!1,optionalCall:!1,optionalMember:!1})||e.typeArguments||e.typeParameters)return;let r=((e,t)=>{var r;let n;if(tA(e=rI(e),{method:"split",argumentsLength:1,computed:!1,optionalCall:!1,optionalMember:!1})&&!(!Da(e.arguments[0],"&")||ot(e.callee.object,t)||(n=eN(r=e.callee.object,t.sourceCode.getScope(r)))&&"string"!=typeof n.value))return e})(e.callee.object,t);if(!r)return;let[n]=e.arguments,o="ArrowFunctionExpression"!==n.type&&"FunctionExpression"!==n.type||n.async||n.generator||1!==n.params.length||"Identifier"!==n.params[0].type?void 0:"BlockStatement"!==n.body.type?{parameter:n.params[0],returnExpression:n.body}:1===n.body.body.length&&"ReturnStatement"===n.body.body[0].type&&n.body.body[0].argument?{parameter:n.params[0],returnExpression:n.body.body[0].argument}:void 0;if(o&&((e,t,r)=>{let n;return!!tA(e=rI(e),{method:"split",minimumArguments:1,maximumArguments:2,computed:!1,optionalCall:!1,optionalMember:!1})&&!!od(rI(e.callee.object),t)&&!!Da(e.arguments[0],"=")&&(1===e.arguments.length||2===(n=e.arguments[1],eN(n,r.sourceCode.getScope(n))?.value))})(o.returnExpression,o.parameter,t))return{node:e,query:r.callee.object}},Dl=(e,t)=>`new URLSearchParams(${Di(e,t)})`,Du=(e,t,r,n)=>{let{sourceCode:o}=n,[a,i]=o.getRange(e),[s,l]=e9(t,n);return o.text.slice(a,s)+r+o.text.slice(l,i)},Dp=(e,t,r)=>{let[n,o]=r.sourceCode.getRange(e),[a,i]=e9(t,r);return[[n,a],[i,o]]},Dc=({node:e,query:t,replacement:r,preservedNodes:n=[t]},o)=>{let a=(({node:e,replacement:t,preservedNodes:r},n)=>{let o;if(!(!(!(o=eg(n.sourceCode.getScope(e),"URLSearchParams"))||o.defs.every(e=>Dn(e))||o.defs.some(e=>(e=>{if("ImportBinding"!==e.type)return!1;let{node:t,parent:r}=e;return Dr.has(r.source.value)&&"type"!==r.importKind&&"ImportSpecifier"===t.type&&"type"!==t.importKind&&"Identifier"===t.imported.type&&"URLSearchParams"===t.imported.name})(e)))||rP(n,e,r)))return[{messageId:Dt,data:{replacement:t},fix:r=>r.replaceText(e,t)}]})({node:e,replacement:r,preservedNodes:n},o);if(a)return{node:e,messageId:De,suggest:a}},Dd="no-unsafe-promise-all-settled-values",Dm=new i(["PromiseSettledResult","PromiseRejectedResult"]),Df=new i(["PromiseFulfilledResult"]),Dg=new i(["ChainExpression","ParenthesizedExpression","TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion"]),Dy=e=>e?.type==="ArrowFunctionExpression"||e?.type==="FunctionExpression"||e?.type==="FunctionDeclaration",Dh=e=>{for(;e&&Dg.has(e.type);)e=e.expression;return e},Dx=e=>tA(Dh(e),{object:"Promise",method:"allSettled",argumentsLength:1,optionalCall:!1,optionalMember:!1}),Db=e=>e?.parent.type==="ReturnStatement"&&e.parent.argument===e,DE=e=>tA(Dh(e),{method:"filter",minimumArguments:1,maximumArguments:2,optionalCall:!1,optionalMember:!1});function Dv(e){return"Identifier"===e.type?e.name:"TSQualifiedName"===e.type?Dv(e.right):void 0}function DC(e){for(e=e?.type==="TSTypeAnnotation"?e.typeAnnotation:e;e?.type==="TSParenthesizedType"||e?.type==="TSTypeOperator";)e=e.typeAnnotation;return e?.type==="TSArrayType"?e.elementType:e?.type==="TSTypeReference"&&"Identifier"===e.typeName.type&&("Array"===e.typeName.name||"ReadonlyArray"===e.typeName.name)?e.typeArguments?.params[0]??e.typeParameters?.params[0]:void 0}function DD(e){return function e(t){if(t?.type==="TSTypeReference"){let e=Dv(t.typeName);return Dm.has(e)}return t?.type==="TSUnionType"&&t.types.some(t=>e(t))}(DC(e))}function DS(e){return function e(t){if(t?.type==="TSTypeReference"){let e=Dv(t.typeName);return Df.has(e)}return t?.type==="TSUnionType"&&t.types.every(t=>e(t))}(DC(e))}function DT(e){if(e.isUnion())return e.types.every(e=>DT(e));let t=e.aliasSymbol??e.getSymbol();return Df.has(t?.getName())}function DA(e,t){if((e=t.getNonNullableType(e)).isUnion()){let r=e.types.map(e=>DA(e,t));return r.every(Boolean)?t.getUnionType(r):void 0}if(t.isArrayType(e)||t.isTupleType(e))return t.getTypeArguments(e)[0]}function Dw(e,t){let{parserServices:r}=t.sourceCode;if(r?.program)try{return{checker:r.program.getTypeChecker(),type:r.getTypeAtLocation(e)}}catch{}}let Dk=e=>e?.type==="TSAsExpression"||e?.type==="TSTypeAssertion";function DI(e,t,r=new i){var n;let o;return!!(Dk(o=e)&&DD(o.typeAnnotation))||!!(e=Dh(e))&&(n=Dh(n=e),!!(n?.type==="AwaitExpression"&&Dx(n.argument)||DD(e.typeAnnotation)||function(e,t){let r=Dw(e,t);if(!r)return!1;let{type:n,checker:o}=r,a=DA(n,o);return!!(a&&function e(t){if(t.isUnion())return t.types.some(t=>e(t));let r=t.aliasSymbol??t.getSymbol();return Dm.has(r?.getName())}(a))}(e,t))||(DE(e)?DI(e.callee.object,t,r):"Identifier"===e.type&&function(e,t,r){let n=eg(t.sourceCode.getScope(e),e);if(!n||r.has(n)||1!==n.defs.length)return!1;r.add(n);let[o]=n.defs,a=!!(DD(o.name?.typeAnnotation)||"Variable"===o.type&&"const"===o.parent.kind&&o.node.id===o.name&&o.node.init&&DI(o.node.init,t,r));return r.delete(n),a}(e,t,r)))}let Dj=e=>(e=Dh(e),e?.type==="Identifier"?e.name:void 0),DF=e=>{if(e=Dh(e),e?.type==="ObjectPattern"){for(let t of e.properties)if("Property"===t.type&&!t.computed&&"status"===eM(t)&&"Identifier"===t.value.type)return t.value}},DB=e=>{if(e?.type==="Literal"&&("fulfilled"===e.value||"rejected"===e.value))return e.value};function DR(e,t){return e=Dh(e),!!(t.statusVariable&&DW(e,t.statusVariable,t.context)||!t.statusVariable&&t.statusName&&e?.type==="Identifier"&&e.name===t.statusName||t.entryVariable&&e?.type==="MemberExpression"&&DW(e.object,t.entryVariable,t.context)&&"status"===eM(e))||!!(!t.entryVariable&&t.entryName&&e?.type==="MemberExpression"&&Dj(e.object)===t.entryName&&"status"===eM(e))}function DP(e,t){if(e=Dh(e),e?.type!=="BinaryExpression"||!["===","==","!==","!="].includes(e.operator))return;let r=DR(e.left,t)?DB(e.right):DR(e.right,t)?DB(e.left):void 0;if(!r)return;let n="==="===e.operator||"=="===e.operator;return n&&"fulfilled"===r||!n&&"rejected"===r?"fulfilled":"unfulfilled"}function DL(e,t){return"fulfilled"===DP(e=Dh(e),t)||e?.type==="LogicalExpression"&&"&&"===e.operator&&(DL(e.left,t)||DL(e.right,t))}function DN(e,t){return"unfulfilled"===DP(e=Dh(e),t)||e?.type==="LogicalExpression"&&"||"===e.operator&&(DN(e.left,t)||DN(e.right,t))}let D$=(e,t,r)=>"ConditionalExpression"===e.type&&(e.consequent===t&&DL(e.test,r)||e.alternate===t&&DN(e.test,r)),DM=(e,t,r)=>"LogicalExpression"===e.type&&("&&"===e.operator&&e.right===t&&DL(e.left,r)||"||"===e.operator&&e.right===t&&DN(e.left,r)),DO=(e,t,r)=>"IfStatement"===e.type&&(e.consequent===t&&DL(e.test,r)||e.alternate===t&&DN(e.test,r)),DU=e=>{let t;if(!Dy(e)||0===e.params.length)return!1;let r={entryName:Dj(e.params[0]),statusName:(t=e.params[0],DF(t)?.name)},n=Dh(e.body);if(n?.type==="BlockStatement"){let[e]=n.body;return 1===n.body.length&&"ReturnStatement"===e.type&&e.argument&&DL(e.argument,r)}return DL(n,r)};function Dq(e){if(e=Dh(e),e?.type==="ObjectPattern"){for(let t of e.properties)if("Property"===t.type&&!t.computed&&"value"===eM(t))return t}}let DV=(e,t)=>"MemberExpression"===e.type&&"property"===t&&!e.computed||["Property","PropertyDefinition","MethodDefinition"].includes(e.type)&&"key"===t&&!e.computed;function DW(e,t,r){return e=Dh(e),e?.type==="Identifier"&&t&&eg(r.sourceCode.getScope(e),e)===t}function D_(e){for(e=Dh(e);DE(e);){if(DU(e.arguments[0]))return!0;e=Dh(e.callee.object)}return!1}function Dz(e,t,{knownPromiseSettledResultArray:r=!1}={}){let n,o;if(!tA(e,{method:"map",minimumArguments:1,maximumArguments:2,optionalCall:!1,optionalMember:!1})||!r&&!DI(e.callee.object,t)||function e(t,r,n=new i){return!!(Dk(t)&&DS(t.typeAnnotation)||function(e,t){let r=Dw(e,t);if(!r)return!1;let{type:n,checker:o}=r,a=DA(n,o);return!!(a&&DT(a))}(t=Dh(t),r))||("Identifier"===t.type?function(t,r,n){let o=eg(r.sourceCode.getScope(t),t);if(!o||n.has(o)||1!==o.defs.length)return!1;n.add(o);let[a]=o.defs,i=!!(DS(a.name?.typeAnnotation)||"Variable"===a.type&&"const"===a.parent.kind&&a.node.id===a.name&&a.node.init&&e(a.node.init,r,n));return n.delete(o),i}(t,r,n):DE(t)&&D_(t)&&DI(t,r))}(e.callee.object,t))return;let[a]=e.arguments;if(!Dy(a)||0===a.params.length)return;let[s]=a.params;if(function(e,t){let r=Dw(e,t);if(!r)return!1;let{type:n}=r;return DT(n)}(s,t))return;let l=Dq(s);if(l&&"Identifier"!==l.value.type)return{node:l.key,messageId:Dd};let u=Dj(s),p=u&&eg(t.sourceCode.getScope(s),s),c=(n=Dq(s),o=n?.value,o?.type==="Identifier"?o:o?.type==="AssignmentPattern"&&"Identifier"===o.left.type?o.left:void 0),d=c&&eg(t.sourceCode.getScope(c),c),m=DF(s),f=m?.name,g=m&&eg(t.sourceCode.getScope(m),m),y=function e(t,r){var n;if(n=t=Dh(t),n=Dh(n),(n?.type==="MemberExpression"&&DW(n.object,r.entryVariable,r.context)&&"value"===eM(n)||n?.type==="Identifier"&&DW(n,r.valueVariable,r.context))&&!function(e,t){for(let r=e,n=e.parent;n&&"ArrowFunctionExpression"!==n.type&&"FunctionExpression"!==n.type;r=n,n=n.parent){if(D$(n,r,t)||DM(n,r,t)||DO(n,r,t)||function(e,t){let r=e.parent?.body;if(!Array.isArray(r))return!1;let n=r.indexOf(e),o=r[n-1];return o?.type==="IfStatement"&&!o.alternate&&DN(o.test,t)&&function e(t){return t=Dh(t),t?.type==="ReturnStatement"||t?.type==="ThrowStatement"||t?.type==="BlockStatement"&&t.body.length>0&&e(t.body.at(-1))}(o.consequent)}(n,t))return!0;if(Db(n))break}return!1}(t,r))return t;for(let[n,o]of Object.entries(t)){if("parent"===n||DV(t,n)||!o||"object"!=typeof o)continue;let a=function(t,r){for(let n of t){if(!n?.type||Dy(n)||"ClassExpression"===n.type||"ClassDeclaration"===n.type)continue;let t=e(n,r);if(t)return t}}(Array.isArray(o)?o:[o],r);if(a)return a}}(a.body,{entryName:u,entryVariable:p,statusName:f,statusVariable:g,valueVariable:d,context:t});if(y)return{node:y,messageId:Dd}}let DK="prefer-abort-signal-any",DG="prefer-abort-signal-any/suggestion",DJ=new i(["reason","throwIfAborted"]),DX=new i(["capture","once","passive"]),DY=new i(["TSAsExpression","TSTypeAssertion","TSSatisfiesExpression"]),DH=e=>{let t=Array.isArray(e.parent.body)?e.parent.body:Array.isArray(e.parent.consequent)?e.parent.consequent:void 0;if(t)return t[t.indexOf(e)+1]},DQ=(e,t,r)=>{let{sourceCode:n}=e,[,o]=n.getRange(t),[a]=n.getRange(r);return n.getAllComments().some(e=>{let[t,r]=n.getRange(e);return t>=o&&r<=a})},DZ=e=>{let t=e,{parent:r}=e;for(;rk(r);)t=r,r=r.parent;return{expression:t,parent:r}},D0=(e,t)=>{let{parent:r}=e;if(!(!tS(r,{property:"signal",computed:!1,optional:!1})||r.object!==e||nP(r)||("ForInStatement"===r.parent.type||"ForOfStatement"===r.parent.type)&&r.parent.left===r||((e,t)=>{let{expression:r,parent:n}=DZ(e);return tS(n)&&n.object===r&&DJ.has(eM(n,t.sourceCode.getScope(n)))})(r,t)||(e=>{let{expression:t,parent:r}=DZ(e);return"VariableDeclarator"===r.type&&r.init===t||"AssignmentExpression"===r.type&&r.right===t})(r)||rN(t,t.sourceCode.getRange(r))))return r},D1=(e,t,r)=>{if(rZ.has(e.intrinsicName))return;if(r0.has(e.intrinsicName))return!1;if(e.isUnion()){let n=e.types.filter(e=>!r0.has(e.intrinsicName));if(0===n.length)return!1;let o=n.map(e=>D1(e,t,r));return!!o.every(Boolean)||!o.every(e=>!1===e)&&void 0}if(e.isIntersection()){let n=e.types.map(e=>D1(e,t,r));return!!n.some(Boolean)||!n.every(e=>!1===e)&&void 0}let n=t.getBaseConstraintOfType(e);if(n&&n!==e)return D1(n,t,r);let o=r1(e);if(o&&r2(o,r))return"AbortSignal"===o.getName();let a=r3(e,t).map(e=>D1(e,t,r));return!!a.some(Boolean)||!(a.length>0&&a.every(e=>!1===e))&&void 0},D2=(e,t)=>td(e,{optional:!1},tu)&&tS(e.callee,{object:"AbortSignal",properties:t,computed:!1,optional:!1}),D3=e=>D2(e,["any","timeout"]),D8=e=>D2(e,["any"]),D6=(e,t)=>{if("Identifier"!==(e=rI(e)).type)return;let r=eg(t.sourceCode.getScope(e),e),n=r?.defs[0];if(r&&1===r.defs.length&&"Variable"===n.type&&"const"===n.parent.kind)return n.node.init},D9=(e,t)=>{if("Identifier"!==(e=rI(e)).type)return!1;let r=eg(t.sourceCode.getScope(e),e),n=r?.defs[0];if(!r||1!==r.defs.length||"Variable"!==n.type||"const"!==n.parent.kind||!n.node.init)return!1;let[,o]=t.sourceCode.getRange(n.node.init),[a]=t.sourceCode.getRange(e);return r.references.some(r=>{if(r.init||r.identifier===e)return!1;let[n]=t.sourceCode.getRange(r.identifier);return n>o&&n<a})},D5=(e,t,r)=>td(e,{optional:!1},tu)&&tS(e.callee,{object:"Array",property:t,computed:!1,optional:!1})&&om(e.callee.object,r),D4=(e,t)=>(td(e,{name:"Array",optional:!1},tu)||tm(e,{name:"Array"}))&&om(e.callee,t),D7=(e,t,r=new i)=>{if(e=rI(e),r.has(e))return!1;if(r.add(e),"SpreadElement"===e.type)return!0;if("ArrayExpression"===e.type)return e.elements.some(e=>e&&D7(e,t,r));if(D5(e,"of",t)||D4(e,t))return e.arguments.some(e=>D7(e,t,r));if(D5(e,"from",t)){if(1!==e.arguments.length)return!0;let[n]=e.arguments;if("SpreadElement"===n.type)return!0;let o=D6(n,t);if(o)return!!(!nb(o,t)||D9(n,t))||D7(o,t,r);let a=rI(n);return"ArrayExpression"!==a.type||D7(a,t,r)}if(D8(e))return e.arguments[0]&&D7(e.arguments[0],t,r);let n=D6(e,t);return n?!!(nb(n,t)&&D9(e,t))||D7(n,t,r):D2(rI(e),["abort"])},Se=(e,t,r,n=new i)=>{var o;if(e=rI(e),n.has(e))return!1;if(n.add(e),"SpreadElement"===e.type)return!0;if("ArrayExpression"===e.type)return e.elements.some(e=>e&&Se(e,t,r,n));if(D5(e,"of",r)||D4(e,r))return e.arguments.some(e=>Se(e,t,r,n));if(D5(e,"from",r)){if(1!==e.arguments.length)return!0;let[o]=e.arguments;if("SpreadElement"===o.type)return!0;let a=D6(o,r);if(a)return!!(!nb(a,r)||D9(o,r))||Se(a,t,r,n);let i=rI(o);return"ArrayExpression"!==i.type||Se(i,t,r,n)}if(D8(e))return e.arguments[0]&&Se(e.arguments[0],t,r,n);let a=D6(e,r);return a?!!(nb(a,r)&&D9(e,r))||Se(a,t,r,n):tS(o=rI(o=e),{property:"signal",computed:!1,optional:!1})&&"Identifier"===o.object.type&&o.object.name===t},St=(e,t)=>{let r=((e,t)=>{let{parserServices:r}=t.sourceCode;if(r?.program)try{let{program:t}=r;return D1(r.getTypeAtLocation(e),t.getTypeChecker(),t)}catch{}})(e=rI(e),t);if(!0===r)return!0;if(!1===r||t.sourceCode.parserServices?.program)return!1;if("Identifier"===e.type){let t;return"signal"===(t=e.name)||t.endsWith("Signal")}return D3(e)},Sr=(e,t)=>"Identifier"===(e=rI(e)).type?St(e,t):D3(e)&&e.arguments.every(e=>"SpreadElement"!==e.type&&!e_(e,t.sourceCode)),Sn=(e,t)=>{if(!D5(e,"from",t)||1!==e.arguments.length)return;let[r]=e.arguments;if("SpreadElement"===r.type)return;let n=rI(r);if("ArrayExpression"===n.type)return n;let o=D6(r,t);if(o&&nb(o,t)&&!D9(r,t))return o},So=(e,t,r=new i)=>{if(e=rI(e),r.has(e))return;if(r.add(e),"ArrayExpression"===e.type)return e.elements.every(e=>e&&"SpreadElement"!==e.type)?e.elements:void 0;if(D5(e,"of",t)||D4(e,t))return e.arguments.every(e=>"SpreadElement"!==e.type)?e.arguments:void 0;let n=Sn(e,t);if(n)return So(n,t,r);let o=D6(e,t);if(o&&nb(o,t)&&!D9(e,t))return So(o,t,r)},Sa=(e,t,r=new i)=>{if(e=rI(e),r.has(e))return!1;if(r.add(e),"Identifier"===e.type||"ArrayExpression"===e.type||D5(e,"of",t)||D4(e,t))return!0;let n=Sn(e,t);return!!n&&Sa(n,t,r)},Si=e=>"Identifier"===e.type?e.name:"TSQualifiedName"===e.type?Si(e.right):void 0,Ss=(e,t,r=new i)=>{if(e?.type==="TSTypeAnnotation"&&(e=e.typeAnnotation),e?.type==="TSParenthesizedType")return Ss(e.typeAnnotation,t,r);if(e?.type!=="TSTypeReference")return!1;var n=e;let o=Si(n.typeName);if("AbortSignal"===o)return!0;if(!o||"Identifier"!==n.typeName.type||r.has(n.typeName.name))return!1;r.add(n.typeName.name);let a=eg(t.sourceCode.getScope(n),n.typeName),s=a?.defs[0],l=s?.type==="Type"&&"TSTypeAliasDeclaration"===s.node.type&&Ss(s.node.typeAnnotation,t,r);return r.delete(n.typeName.name),l},Sl=(e,t,r=new i)=>(e?.type==="TSTypeAnnotation"&&(e=e.typeAnnotation),e?.type==="TSParenthesizedType")?Sl(e.typeAnnotation,t,r):e?.type==="TSTypeOperator"?"readonly"===e.operator?Sl(e.typeAnnotation,t,r):void 0:e?.type==="TSArrayType"?Ss(e.elementType,t,r):e?.type==="TSTupleType"?e.elementTypes.length>0&&e.elementTypes.every(e=>Ss("TSNamedTupleMember"===e.type?e.elementType:e,t,r)):e?.type==="TSTypeReference"?((e,t,r)=>{let n,o=Si(e.typeName),a=e.typeArguments?.params??e.typeParameters?.params;if(("Array"===o||"ReadonlyArray"===o)&&a?.length===1)return Ss(a[0],t,r);if(!o||"Identifier"!==e.typeName.type||r.has(e.typeName.name))return!1;r.add(e.typeName.name);let i=eg(t.sourceCode.getScope(e),e.typeName),s=i?.defs[0];return s?.type==="Type"&&"TSTypeAliasDeclaration"===s.node.type&&(n=Sl(s.node.typeAnnotation,t,r)),r.delete(e.typeName.name),n})(e,t,r):void 0,Su=(e,t,r=new i)=>{if(e?.type==="TSTypeAnnotation"&&(e=e.typeAnnotation),e?.type==="TSParenthesizedType")return Su(e.typeAnnotation,t,r);if(e?.type==="TSTypeOperator")return"readonly"===e.operator&&("TSArrayType"===e.typeAnnotation.type||"TSTupleType"===e.typeAnnotation.type);if(e?.type!=="TSTypeReference")return!1;if("ReadonlyArray"===Si(e.typeName))return!0;if("Identifier"!==e.typeName.type||r.has(e.typeName.name))return!1;r.add(e.typeName.name);let n=eg(t.sourceCode.getScope(e),e.typeName),o=n?.defs[0];return o?.type==="Type"&&"TSTypeAliasDeclaration"===o.node.type&&Su(o.node.typeAnnotation,t,r)},Sp=(e,t,r,n=new i)=>{if(!e||rZ.has(e.intrinsicName)||r0.has(e.intrinsicName)||n.has(e))return!1;if(n.add(e),e.isUnion()||e.isIntersection())return e.types.some(e=>Sp(e,t,r,n));let o=t.getBaseConstraintOfType(e);if(o&&o!==e)return Sp(o,t,r,n);let a=r1(e);if(a&&r2(a,r)&&"ReadonlyArray"===a.getName())return!0;let s=t.typeToString(e);return!!(s.startsWith("readonly ")||s.startsWith("ReadonlyArray<"))||r3(e,t).some(e=>Sp(e,t,r,n))},Sc=(e,t)=>{if(DY.has(e.type)){let r;return r=e.typeAnnotation,r?.type==="TSTypeReference"&&"const"===Si(r.typeName)||Su(e.typeAnnotation,t)||Sc(e.expression,t)}if("Identifier"!==(e=rI(e)).type)return!1;let r=eg(t.sourceCode.getScope(e),e),n=r?.defs[0];return!!(n?.name?.typeAnnotation&&Su(n.name.typeAnnotation,t)||n?.type==="Variable"&&n.node.init&&Sc(n.node.init,t)||((e,t)=>{let{parserServices:r}=t.sourceCode;if(!r?.program)return!1;try{let{program:t}=r;return Sp(r.getTypeAtLocation(e),t.getTypeChecker(),t)}catch{return!1}})(e,t))},Sd=(e,t,r=new i)=>{if(r.has(e))return!1;if(r.add(e),DY.has(e.type))return Sl(e.typeAnnotation,t)??Sd(e.expression,t,r);if("Identifier"===(e=rI(e)).type){let n=eg(t.sourceCode.getScope(e),e),o=n?.defs[0];if(o?.name?.typeAnnotation){let e=Sl(o.name.typeAnnotation,t);if(void 0!==e)return e}if(o?.type==="Variable"&&o.node.init&&Sd(o.node.init,t,r))return!0}return nb(e,t)},Sm=(e,t,r,n)=>{var o,a;let i,s=!e||"ArrowFunctionExpression"!==e.type&&"FunctionExpression"!==e.type||e.async||e.generator||e.params.length>0?void 0:"BlockStatement"!==e.body.type?e.body:1===e.body.body.length&&"ExpressionStatement"===e.body.body[0].type?e.body.body[0].expression:void 0;if(td(s,{optional:!1},tu)&&tS(s.callee,{property:"abort",computed:!1,optional:!1})&&"Identifier"===s.callee.object.type&&s.callee.object.name===t&&(0===s.arguments.length||1===s.arguments.length&&(i=s.arguments[0],tS(i,{property:"reason",computed:!1,optional:!1})&&(o=i.object,a=r,o=rI(o),a=rI(a),"Identifier"===o.type&&"Identifier"===a.type&&o.name===a.name&&eg(n.sourceCode.getScope(o),o)===eg(n.sourceCode.getScope(a),a)))))return s.callee.object},Sf=e=>{var t;if(e?.type!=="ExpressionStatement")return;let{expression:r}=e;if(td(r,{minimumArguments:2,maximumArguments:3,optional:!1},tu)&&tS(r.callee,{property:"addEventListener",computed:!1,optional:!1})&&"abort"===tr(rI(r.arguments[0]))&&(!(t=r.arguments[2])||"Literal"===(t=rI(t)).type&&"boolean"==typeof t.value||"ObjectExpression"===t.type&&t.properties.every(e=>{if("Property"!==e.type||e.computed||"init"!==e.kind||e.method||e.shorthand||"Literal"!==e.value.type||"boolean"!=typeof e.value.value)return!1;let t="Identifier"===e.key.type?e.key.name:e.key.value;return DX.has(t)})))return{call:r,sourceSignal:r.callee.object}},Sg=(e,t)=>!rN(t,t.sourceCode.getRange(e))&&!rL(t,e),Sy=(e,t,r,n)=>{let o=eg(n.sourceCode.getScope(r),e);return o&&o!==t},Sh="prefer-block-statement-over-iife",Sx=e=>"ThisExpression"===e.type||"MetaProperty"===e.type&&"new"===e.meta.name&&"target"===e.property.name||"Identifier"===e.type&&"arguments"===e.name,Sb=(e,t)=>e!==t&&tE(e),SE=(e,t)=>Sb(e,t)&&"ArrowFunctionExpression"!==e.type;function Sv(e,t,r,n=Sb){return function o(a){if(r(a))return!0;if(n(a,e))return!1;for(let e of t[a.type]??[]){let t=a[e];for(let e of Array.isArray(t)?t:[t])if(e?.type&&o(e))return!0}return!1}(e)}let SC=(e,t)=>{let[r,n]=t.getRange(e),o=t.getLastToken(e);return[r,eb(o)?t.getRange(o)[1]:n]},SD="no-multiple-promise-resolver-calls",SS=e=>rk(e)||e?.type==="TSInstantiationExpression";function ST(e){for(;SS(e.parent)&&e.parent.expression===e;)e=e.parent;return e}function SA(e){for(;SS(e);)e=e.expression;return e}let Sw=(e,t)=>{if(!(("FunctionExpression"===e.type||"ArrowFunctionExpression"===e.type)&&!e.generator))return!1;let r=ST(e);return tm(r.parent,{name:"Promise",argumentsLength:1})&&r.parent.arguments[0]===r&&om(r.parent.callee,t)},Sk=e=>e.references.some(e=>e.isWrite()),SI=({resolverUncalled:e=!1,resolverCalled:t=!1,catchClausesAfterResolverCall:r=new i,pendingFinallyBlocksByCatchClause:n=new o}={})=>({resolverUncalled:e,resolverCalled:t,catchClausesAfterResolverCall:r,pendingFinallyBlocksByCatchClause:n}),Sj=e=>SI({resolverUncalled:e.resolverUncalled,resolverCalled:e.resolverCalled,catchClausesAfterResolverCall:new i(e.catchClausesAfterResolverCall),pendingFinallyBlocksByCatchClause:function(e){let t=new o;for(let[r,n]of e)t.set(r,new i(n));return t}(e.pendingFinallyBlocksByCatchClause)}),SF=(e,t,r)=>{if(t.executor===r){let r=Sj(e);for(let[e,n]of r.pendingFinallyBlocksByCatchClause)t.finallyBlocks.some(e=>n.has(e))&&r.catchClausesAfterResolverCall.add(e);return r.resolverCalled=e.resolverUncalled||e.resolverCalled,r.resolverUncalled=!1,r}if(t.executor)return e;let n=Sj(e);if(t.catchClause){if(e.resolverUncalled){let e=n.pendingFinallyBlocksByCatchClause.get(t.catchClause);for(let r of(e||(e=new i,n.pendingFinallyBlocksByCatchClause.set(t.catchClause,e)),t.finallyBlocks))e.add(r)}e.resolverCalled&&n.catchClausesAfterResolverCall.add(t.catchClause)}return n};function SB(e,t){if(e.size!==t.size)return!1;for(let r of e)if(!t.has(r))return!1;return!0}let SR=(e,t)=>void 0!==t&&e.resolverUncalled===t.resolverUncalled&&e.resolverCalled===t.resolverCalled&&SB(e.catchClausesAfterResolverCall,t.catchClausesAfterResolverCall)&&function(e,t){if(e.size!==t.size)return!1;for(let[r,n]of e){let e=t.get(r);if(!e||!SB(n,e))return!1}return!0}(e.pendingFinallyBlocksByCatchClause,t.pendingFinallyBlocksByCatchClause);function SP(e,t,r){let n=SI({resolverUncalled:e===r.codePath.initialSegment});for(let o of e.prevSegments){let a=function(e,t,r,n){if(!t.reachable||n.ignoredLoopEdges.some(e=>e.previousSegment===t&&e.segment===r))return SI();let o=n.catchClausesBySegment.get(r);return o?SI({resolverUncalled:e.pendingFinallyBlocksByCatchClause.has(o),resolverCalled:e.catchClausesAfterResolverCall.has(o)}):e}(t.get(o)??SI(),o,e,r);for(let e of(n.resolverUncalled||=a.resolverUncalled,n.resolverCalled||=a.resolverCalled,a.catchClausesAfterResolverCall))n.catchClausesAfterResolverCall.add(e);for(let[e,t]of a.pendingFinallyBlocksByCatchClause){let r=n.pendingFinallyBlocksByCatchClause.get(e);for(let o of(r||(r=new i,n.pendingFinallyBlocksByCatchClause.set(e,r)),t))r.add(o)}}return n}let SL=e=>{let t=SA(e.test);return t?.type==="Literal"&&!t.value},SN=e=>{let t=ST(e);return t.parent?.type==="AwaitExpression"&&t.parent.argument===t},S$="no-unnecessary-string-trim",SM=["startsWith","endsWith"],SO=new i(["bigint","boolean","number","string","undefined"]),SU=new i(["ArrayExpression","ArrowFunctionExpression","ClassExpression","FunctionExpression","ObjectExpression"]),Sq=(e,t)=>eN(e=rI(e),t.sourceCode.getScope(e)),SV="no-useless-re-export",SW=e=>"Identifier"===e.type?e.name:e.value;function S_(e,t){let r=e.attributes??[];return`${e.source.value}\u0000${r.map(e=>t.getText(e)).join("\0")}`}let Sz={configs:{node:{name:"@eslint-sukka/eslint-plugin-sukka-full node preset",plugins:{get sukka(){return Sz}},rules:{"sukka/unicorn/prefer-node-protocol":"error","sukka/unicorn/prefer-import-meta-properties":"error","no-process-exit":"off","sukka/unicorn/no-process-exit":"warn","no-buffer-constructor":"off","sukka/unicorn/no-new-buffer":"error"}},comment:{name:"@eslint-sukka/eslint-plugin-sukka-full comments preset",plugins:{get sukka(){return Sz}},rules:{"sukka/ban-eslint-disable":["error","allow-with-description"]}},recommended:{...c.eslint_plugin_sukka.configs.recommended,plugins:{get sukka(){return Sz}},rules:{...c.eslint_plugin_sukka.configs.recommended.rules,"sukka/prefer-single-boolean-return":"off","sukka/array/no-unneeded-flat-map":"error","sukka/browser/prefer-location-assign":"warn","sukka/jsx/no-template-literal":"error","sukka/jsx/no-unneeded-nested":"error","sukka/string/no-locale-case":"warn","sukka/string/no-simple-template-literal":"error","sukka/unicode/no-bidi":"warn","sukka/unicode/no-invisible":"warn","sukka/no-redundant-variable":"error","sukka/no-single-return":"warn","sukka/prefer-early-return":["error",{maximumStatements:16}],"sukka/prefer-fetch":"error","sukka/prefer-timer-id":"warn"}},recommended_unicorn:{name:"@eslint-sukka/eslint-plugin-sukka-full recommended unicorn preset",plugins:{get sukka(){return Sz}},rules:{"sukka/unicorn/no-lonely-if":"error","sukka/unicorn/no-negated-condition":"warn","sukka/unicorn/catch-error-name":["error",{ignore:[/^(?:e|err|error|\w+Err|\w+Error)[\d_]?$/]}],"sukka/unicorn/custom-error-definition":"error","sukka/unicorn/require-array-join-separator":"warn","sukka/unicorn/no-thenable":"error","sukka/unicorn/no-invalid-remove-event-listener":"error","sukka/unicorn/consistent-function-scoping":"warn","sukka/unicorn/prefer-event-target":"warn","sukka/unicorn/prefer-keyboard-event-key":"warn","sukka/unicorn/prefer-text-content":"warn","sukka/unicorn/no-console-spaces":"warn","sukka/unicorn/no-empty-file":"warn","sukka/unicorn/no-useless-fallback-in-spread":"warn","sukka/unicorn/no-useless-length-check":"warn","sukka/unicorn/no-useless-promise-resolve-reject":"warn","sukka/unicorn/no-zero-fractions":"warn","sukka/unicorn/prefer-export-from":["warn",{checkUsedVariables:!1}],"sukka/unicorn/prefer-native-coercion-functions":"warn","sukka/unicorn/prefer-negative-index":"warn","sukka/unicorn/no-document-cookie":"error","sukka/unicorn/prefer-add-event-listener":"warn","sukka/unicorn/prefer-array-index-of":"warn","sukka/unicorn/prefer-blob-reading-methods":"warn","sukka/unicorn/prefer-date-now":"warn","sukka/unicorn/dom-node-dataset":"warn","sukka/unicorn/prefer-modern-math-apis":"warn","sukka/unicorn/number-literal-case":"error","sukka/unicorn/prefer-number-properties":["warn",{checkInfinity:!1}],"sukka/unicorn/prefer-reflect-apply":"warn","sukka/unicorn/prefer-set-size":"warn","sukka/unicorn/prefer-string-replace-all":"warn","sukka/unicorn/prefer-string-slice":"warn","sukka/unicorn/prefer-string-trim-start-end":"warn","sukka/unicorn/no-unreadable-iife":"warn","sukka/unicorn/throw-new-error":"warn","sukka/unicorn/escape-case":"warn","sukka/unicorn/prefer-unicode-code-point-escapes":"warn","sukka/unicorn/prefer-prototype-methods":"warn","sukka/unicorn/error-message":"error","sukka/unicorn/no-instanceof-builtins":["error",{strategy:"loose"}],"sukka/unicorn/prefer-type-error":"error","sukka/unicorn/consistent-destructuring":"warn","sukka/unicorn/new-for-builtins":"warn","sukka/unicorn/prefer-single-call":"warn","sukka/unicorn/no-static-only-class":"warn","sukka/unicorn/no-unreadable-array-destructuring":"error","sukka/unicorn/no-useless-spread":"error","sukka/unicorn/no-useless-switch-case":"warn","sukka/unicorn/no-useless-undefined":["error",{checkArguments:!1}],"sukka/unicorn/numeric-separators-style":["warn",{onlyIfContainsSeparator:!1,number:{minimumDigits:7,groupLength:3},binary:{minimumDigits:9,groupLength:4},octal:{minimumDigits:9,groupLength:4},hexadecimal:{minimumDigits:5,groupLength:2}}],"sukka/unicorn/prefer-array-find":"warn","sukka/unicorn/prefer-array-flat-map":"warn","sukka/unicorn/prefer-array-flat":"warn","sukka/unicorn/prefer-array-some":"warn","sukka/unicorn/prefer-code-point":"warn","sukka/unicorn/prefer-default-parameters":"warn","sukka/unicorn/prefer-logical-operator-over-ternary":"warn","sukka/unicorn/prefer-optional-catch-binding":"error","sukka/unicorn/prefer-regexp-test":"warn","sukka/unicorn/prefer-set-has":"error","sukka/unicorn/prefer-switch":"warn","sukka/unicorn/require-number-to-fixed-digits-argument":"warn","sukka/unicorn/prefer-string-raw":"warn","sukka/unicorn/no-single-promise-in-promise-methods":"error","sukka/unicorn/no-await-in-promise-methods":"error","sukka/unicorn/no-magic-array-flat-depth":"error","sukka/unicorn/no-object-as-default-parameter":"error","sukka/unicorn/template-indent":["warn",{tags:["outdent","dedent","gql","sql","html","styled","css"],functions:["dedent","stripIndent","strip_indent","stripTags","striptags","strip_tags","stripHtml","stripHTML","strip_html"],selectors:[],comments:["HTML","html","CSS","css","indent"]}],"sukka/unicorn/no-negation-in-equality-check":"error","sukka/unicorn/no-unnecessary-slice-end":"error","sukka/unicorn/consistent-date-clone":"error","sukka/unicorn/no-accessor-recursion":"error","sukka/unicorn/no-unnecessary-array-flat-depth":"error","sukka/unicorn/no-unnecessary-array-splice-count":"error","sukka/unicorn/no-useless-error-capture-stack-trace":"error","sukka/unicorn/prefer-class-fields":"error","sukka/unicorn/prefer-bigint-literals":"error","sukka/unicorn/prefer-classlist-toggle":"warn","sukka/unicorn/require-module-attributes":"error","sukka/unicorn/no-immediate-mutation":"error","sukka/unicorn/no-useless-collection-argument":"error","sukka/unicorn/prefer-response-static-json":"error","sukka/unicorn/consistent-template-literal-escape":"error","sukka/unicorn/no-useless-iterator-to-array":"error","sukka/unicorn/prefer-simple-condition-first":"error","sukka/unicorn/switch-case-break-position":"error","sukka/unicorn/better-dom-traversing":"warn","sukka/unicorn/no-blob-to-file":"error","sukka/unicorn/no-canvas-to-image":"warn","sukka/unicorn/no-confusing-array-splice":"error","sukka/unicorn/no-duplicate-set-values":"error","sukka/unicorn/no-incorrect-query-selector":"error","sukka/unicorn/no-invalid-file-input-accept":"error","sukka/unicorn/no-late-current-target-access":"error","sukka/unicorn/no-unused-array-method-return":"error","sukka/unicorn/prefer-array-last-methods":"warn","sukka/unicorn/prefer-math-abs":"warn","sukka/unicorn/prefer-split-limit":"error","sukka/unicorn/prefer-queue-microtask":"warn","sukka/unicorn/prefer-string-pad-start-end":"warn","sukka/unicorn/require-css-escape":"warn","sukka/unicorn/require-passive-events":"warn","sukka/unicorn/class-reference-in-static-methods":["warn",{preferThis:!1,preferSuper:!1}],"sukka/unicorn/consistent-optional-chaining":"error","sukka/unicorn/explicit-timer-delay":"error","sukka/unicorn/no-confusing-array-with":"error","sukka/unicorn/no-duplicate-loops":"warn","sukka/unicorn/no-declarations-before-early-exit":"error","sukka/unicorn/no-optional-chaining-on-undeclared-variable":"error","sukka/unicorn/no-object-methods-with-collections":"error","sukka/unicorn/no-subtraction-comparison":"warn","sukka/unicorn/no-unnecessary-global-this":"warn","sukka/unicorn/no-useless-else":"error","sukka/unicorn/no-useless-recursion":"error","sukka/unicorn/prefer-add-event-listener-options":"warn","sukka/unicorn/prefer-direct-iteration":"warn","sukka/unicorn/prefer-number-is-safe-integer":"warn","sukka/unicorn/prefer-object-define-properties":"error","sukka/unicorn/prefer-object-destructuring-defaults":"warn","sukka/unicorn/prefer-single-object-destructuring":"warn","sukka/unicorn/prefer-smaller-scope":"warn","sukka/unicorn/prefer-single-array-predicate":"warn","sukka/unicorn/prefer-url-href":"error","sukka/unicorn/require-proxy-trap-boolean-return":"error","sukka/unicorn/logical-assignment-operators":"error","sukka/unicorn/no-useless-coercion":"error","sukka/unicorn/no-useless-boolean-cast":"warn","sukka/unicorn/no-useless-continue":"error","sukka/unicorn/no-useless-override":"error","sukka/unicorn/prefer-has-check":"warn","sukka/unicorn/consistent-conditional-object-spread":"error","sukka/unicorn/no-boolean-sort-comparator":"error","sukka/unicorn/no-chained-comparison":"error","sukka/unicorn/no-constant-zero-expression":"error","sukka/unicorn/no-duplicate-logical-operands":"error","sukka/unicorn/no-impossible-length-comparison":"error","sukka/unicorn/no-invalid-character-comparison":"error","sukka/unicorn/no-loop-iterable-mutation":"error","sukka/unicorn/no-selector-as-dom-name":"error","sukka/unicorn/no-array-concat-in-loop":"error","sukka/unicorn/no-array-front-mutation":"warn","sukka/unicorn/no-array-sort-for-min-max":"error","sukka/unicorn/no-useless-compound-assignment":"warn","sukka/unicorn/no-useless-delete-check":"warn","sukka/unicorn/no-useless-logical-operand":"error","sukka/unicorn/prefer-boolean-return":"warn","sukka/unicorn/prefer-flat-math-min-max":"warn","sukka/unicorn/prefer-hoisting-branch-code":"warn","sukka/unicorn/prefer-single-replace":"warn","sukka/unicorn/no-invalid-well-known-symbol-methods":"error","sukka/unicorn/no-late-event-control":"error","sukka/unicorn/prefer-abort-signal-timeout":"warn","sukka/unicorn/prefer-aggregate-error":"warn","sukka/unicorn/prefer-observer-apis":"warn","sukka/unicorn/prefer-set-methods":"warn","sukka/unicorn/prefer-toggle-attribute":"warn","sukka/unicorn/prefer-url-search-parameters":"warn","sukka/unicorn/no-unsafe-promise-all-settled-values":"error","sukka/unicorn/prefer-abort-signal-any":"warn","sukka/unicorn/prefer-block-statement-over-iife":"warn","sukka/unicorn/no-multiple-promise-resolver-calls":"error","sukka/unicorn/no-unnecessary-string-trim":"error","sukka/unicorn/no-useless-re-export":"warn"}},stylistic_unicorn:{name:"@eslint-sukka/eslint-plugin-sukka-full stylistic unicorn preset",plugins:{get sukka(){return Sz}},rules:{"sukka/unicorn/no-nested-ternary":"warn","sukka/unicorn/filename-case":["error",{cases:{kebabCase:!0,snakeCase:!0},ignore:[/fixtures/i,/^_/,/^\./,/rc$/i,/\.(md|json|yaml|toml|yml|ini|conf|jsonc|json5)$/i]}],"sukka/unicorn/no-unnecessary-nested-ternary":"error","sukka/unicorn/no-unreadable-object-destructuring":"error","sukka/unicorn/consistent-compound-words":"warn","sukka/unicorn/default-export-style":"warn"}},recommended_extra_with_typed_lint:{...c.eslint_plugin_sukka.configs.recommended_extra_with_typed_lint,plugins:{get sukka(){return Sz}},rules:{...c.eslint_plugin_sukka.configs.recommended_extra_with_typed_lint.rules,"sukka/string/no-unneeded-to-string":"error","sukka/type/no-force-cast-via-top-type":"error","sukka/type/no-wrapper-type-reference":"error","sukka/no-default-error":"off","sukka/unicorn/consistent-tuple-labels":"warn"}},recommended_react:{...c.eslint_plugin_sukka.configs.recommended_react,plugins:{get sukka(){return Sz}}}},rules:Object.assign(c.eslint_plugin_sukka.rules,{"array/no-unneeded-flat-map":P,"browser/prefer-location-assign":N,"jsx/no-template-literal":M,"jsx/no-unneeded-nested":O,"string/no-locale-case":q,"string/no-simple-template-literal":V,"unicode/no-bidi":X,"unicode/no-invisible":H,"no-redundant-variable":Q,"no-single-return":ee,"prefer-early-return":er,"prefer-fetch":en,"prefer-timer-id":ei,"string/no-unneeded-to-string":es,"type/no-force-cast-via-top-type":el,"type/no-wrapper-type-reference":ep,"no-default-error":ec},Object.fromEntries(Object.entries({"unicorn/catch-error-name":c_,"unicorn/custom-error-definition":{create:e=>{e.on("ClassDeclaration",t=>dr(e,t)),e.on("AssignmentExpression",t=>{if("ClassExpression"===t.right.type)return dr(e,t.right)}),e.on("AssignmentExpression",e=>{if("MemberExpression"===e.left.type&&"Identifier"===e.left.object.type&&"exports"===e.left.object.name){let t=e.right;if("ClassExpression"!==t.type||!c0(t)||!t.id)return;let r=t.id.name;return e.left.property.name!==r?{node:e.left.property,messageId:cz,fix:t=>t.replaceText(e.left.property,r)}:void 0}})},meta:{type:"problem",docs:{description:"Enforce correct `Error` subclassing.",recommended:!1},fixable:"code",messages:{[cz]:"Exported error name should match error class",[cK]:"Do not pass the error message to `super()` when the class defines a `message` accessor.",[cG]:"Do not assign to `this.message` when the class defines a `message` getter without a setter.",[cJ]:"Error constructors should accept `options` as the second parameter.",[cX]:"Error constructors should use `options` as the second parameter.",[cY]:"Pass the error message to `super()` as the first argument.",[cH]:"Pass `options` to `super()` as the second argument."},languages:["js/js"]}},"unicorn/no-nested-ternary":{create:e=>{e.on("ConditionalExpression",t=>{if([t.test,t.consequent,t.alternate].some(e=>"ConditionalExpression"===e.type))return;let{sourceCode:r}=e,n=r.getAncestors(t).toReversed(),o=n.findIndex(e=>"ConditionalExpression"!==e.type);return 1!==o||e4(t,e)?o>1?{node:o>2?n[o-3]:t,messageId:ao}:void 0:{node:t,messageId:aa,fix:e=>[e.insertTextBefore(t,"("),e.insertTextAfter(t,")")]}})},meta:{type:"suggestion",docs:{description:"Disallow nested ternary expressions.",recommended:!0},fixable:"code",messages:{[ao]:"Do not nest ternary expressions.",[aa]:"Nested ternary expression should be parenthesized."},languages:["js/js"]}},"unicorn/prefer-event-target":{create:e=>{e.on("Identifier",t=>{if("EventEmitter"!==t.name||("ClassDeclaration"!==t.parent.type&&"ClassExpression"!==t.parent.type||t.parent.superClass!==t)&&("NewExpression"!==t.parent.type||t.parent.callee!==t))return;let r=e.sourceCode.getScope(t);if(!function(e){if(!e)return!1;let t=function(e,t){let r=e=>e.type===t;for(;e.parent;e=e.parent)if(r(e))return e}(e,"ImportDeclaration");return!!(as.has(t?.source.value)||"Property"===e.parent.type&&e.parent.value===e&&"Identifier"===e.parent.key.type&&"EventEmitter"===e.parent.key.name&&"ObjectPattern"===e.parent.parent.type&&e.parent.parent.properties.includes(e.parent)&&al(e.parent.parent)&&au(e.parent.parent.parent.init))||!!(al(e)&&tS(e.parent.init,{property:"EventEmitter",optional:!1,computed:!1})&&au(e.parent.init.object))}(eg(r,t)?.defs[0]?.name))return{node:t,messageId:ai}})},meta:{type:"suggestion",docs:{description:"Prefer `EventTarget` over `EventEmitter`.",recommended:"unopinionated"},messages:{[ai]:"Prefer `EventTarget` over `EventEmitter`."},languages:["js/js"]}},"unicorn/prefer-keyboard-event-key":{create:e=>{e.on("Identifier",t=>{if(am.has(t.name)){for(let r of ax(e,t))if(r.references?.some(e=>ah(t,e.identifier)))return ab(t,r)}}),e.on("Property",t=>{let r;if("Identifier"===t.key.type&&am.has(t.key.name)&&"Property"===(r=t.key).parent.type&&r.parent.key===r&&"ObjectPattern"===r.parent.parent.type&&!r.parent.computed){for(let r of ax(e,t))if(av(t.key,r))return ab(t.key,r);for(let r of ax(e,t))if(aE(t.key,r))return ab(t.key,r)}})},meta:{type:"suggestion",docs:{description:"Prefer `KeyboardEvent#key` over deprecated keyboard event properties.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[ac]:"Use `.key` instead of `.{{name}}`.",[ad]:"Use `.key` with `{{key}}`."},languages:["js/js"]}},"unicorn/prefer-text-content":{create:e=>{e.on("MemberExpression",t=>{if(!tS(t,{property:"innerText"})||nB(t.object,e))return;let r=t.property;return{node:r,messageId:aC,suggest:[{messageId:aD,fix:e=>e.replaceText(r,"textContent")}]}}),e.on("Identifier",t=>{if("innerText"===t.name&&"Property"===t.parent.type&&t.parent.key===t&&!t.parent.computed&&"init"===t.parent.kind&&"ObjectPattern"===t.parent.parent.type&&t.parent.parent.properties.includes(t.parent)&&!((e,t)=>{if(nB(e,t))return!0;let{parent:r}=e;return"VariableDeclarator"===r.type?r.id===e&&r.init&&nB(r.init,t):"AssignmentExpression"===r.type&&r.left===e&&nB(r.right,t)})(t.parent.parent,e))return{node:t,messageId:aC,suggest:[{messageId:aD,fix:e=>e.replaceText(t,t.parent.shorthand?"textContent: innerText":"textContent")}]}})},meta:{type:"suggestion",docs:{description:"Prefer `.textContent` over `.innerText`.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[aC]:"Prefer `.textContent` over `.innerText`.",[aD]:"Switch to `.textContent`."},languages:["js/js"]}},"unicorn/require-array-join-separator":{create:e=>{e.on("CallExpression",t=>{if(!(tA(t,{method:"join",argumentsLength:0,optionalCall:!1})||tA(t,{method:"call",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&tP(t.callee.object,{property:"join"}))||0===t.arguments.length&&nC(t.callee.object,e))return;let{sourceCode:r}=e,[n,o]=r.getLastTokens(t,2),a=1===t.arguments.length;return{loc:{start:r.getLoc(n)[a?"end":"start"],end:r.getLoc(o).end},messageId:aW,fix:r=>aT(r,t,"','",e)}})},meta:{type:"suggestion",docs:{description:"Enforce using the separator argument with `Array#join()`.",recommended:"unopinionated"},fixable:"code",messages:{[aW]:"Missing the separator argument."},languages:["js/js"]}},"unicorn/no-thenable":{create:e=>{for(let{selector:t,selectors:r,messageId:n,getNodes:o}of aX)e.on(t??r,function*(t){for(let r of o(t,e))yield{node:r,messageId:n}})},meta:{type:"problem",docs:{description:"Disallow `then` property.",recommended:"unopinionated"},messages:{[a_]:"Do not add `then` to an object.",[az]:"Do not export `then`.",[aK]:"Do not add `then` to a class."},languages:["js/js"]}},"unicorn/no-invalid-remove-event-listener":{create:e=>{e.on("CallExpression",t=>{if(!(tA(t,{method:"removeEventListener",minimumArguments:2,optionalCall:!1})&&"SpreadElement"!==t.arguments[0].type&&("FunctionExpression"===t.arguments[1].type||"ArrowFunctionExpression"===t.arguments[1].type||tA(t.arguments[1],{method:"bind",optionalCall:!1,optionalMember:!1}))))return;let[,r]=t.arguments;return["ArrowFunctionExpression","FunctionExpression"].includes(r.type)?{node:r,loc:eA(r,e.sourceCode),messageId:aY}:{node:r.callee.property,messageId:aY}})},meta:{type:"problem",docs:{description:"Prevent calling `EventTarget#removeEventListener()` with the result of an expression.",recommended:"unopinionated"},messages:{[aY]:"The listener argument should be a function reference."},languages:["js/js"]}},"unicorn/consistent-function-scoping":a8,"unicorn/no-new-buffer":{create:e=>{let{sourceCode:t}=e;e.on("NewExpression",r=>{if(!tm(r,{name:"Buffer"}))return;let n=((e,t)=>{if(1!==e.length)return"from";let[r]=e;if("SpreadElement"===r.type)return;if("ArrayExpression"===r.type||"TemplateLiteral"===r.type)return"from";if(nW(r,t))return"alloc";let n=eN(r,t);if(n){let{value:e}=n;if("string"==typeof e||Array.isArray(e))return"from"}})(r.arguments,t.getScope(r));return n?{node:r,messageId:a6,data:{method:n},fix:a4(r,e,n)}:{node:r,messageId:a9,suggest:["from","alloc"].map(t=>({messageId:a5,data:{replacement:t},fix:a4(r,e,t)}))}})},meta:{type:"problem",docs:{description:"Enforce the use of `Buffer.from()` and `Buffer.alloc()` instead of the deprecated `new Buffer()`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[a6]:"`new Buffer()` is deprecated, use `Buffer.{{method}}()` instead.",[a9]:"`new Buffer()` is deprecated, use `Buffer.alloc()` or `Buffer.from()` instead.",[a5]:"Switch to `Buffer.{{replacement}}()`."},languages:["js/js"]}},"unicorn/no-console-spaces":{create:e=>{let{sourceCode:t}=e,r=(r,n,o)=>{let[a,i]=t.getRange(r),s="leading"===o?a+1:i-2,l=[s,s+1];return{loc:o5(l,e),messageId:a7,data:{method:n,position:o},fix:e=>e.removeRange(l)}};e.on("CallExpression",function*(e){if(!tA(e,{object:"console",methods:["log","debug","info","warn","error"],minimumArguments:1,optionalCall:!1,optionalMember:!1}))return;let n=e.callee.property.name,{arguments:o}=e,{length:a}=o;for(let[e,i]of o.entries()){if(!te(i)&&"TemplateLiteral"!==i.type)continue;let o=t.getText(i).slice(1,-1);0!==e&&ie(o)&&(yield r(i,n,"leading")),e!==a-1&&it(o)&&(yield r(i,n,"trailing"))}})},meta:{type:"suggestion",docs:{description:"Do not use leading/trailing space between `console.log` parameters.",recommended:"unopinionated"},fixable:"code",messages:{[a7]:"Do not use {{position}} space between `console.{{method}}` parameters."},languages:["js/js"]}},"unicorn/no-empty-file":io,"unicorn/no-useless-fallback-in-spread":{create:e=>{e.on("ObjectExpression",t=>{if(th(t)&&"LogicalExpression"===t.parent.type&&t.parent.right===t&&("||"===t.parent.operator||"??"===t.parent.operator)&&"SpreadElement"===t.parent.parent.type&&t.parent.parent.argument===t.parent&&"ObjectExpression"===t.parent.parent.parent.type&&t.parent.parent.parent.properties.includes(t.parent.parent))return{node:t,messageId:ia,*fix(r,{abort:n}){let{sourceCode:o}=e,a=t.parent;if(o.getCommentsInside(a).length>0)return n();let{left:i}=a,s=e4(i,e),[,l]=s?e9(i,e):o.getRange(i),[,u]=o.getRange(a);yield r.removeRange([l,u]),(s||"SequenceExpression"!==i.type)&&(yield aS(a,r,e))}}})},meta:{type:"suggestion",docs:{description:"Disallow useless fallback when spreading in object literals.",recommended:"unopinionated"},fixable:"code",messages:{[ia]:"The empty object is useless."},languages:["js/js"]}},"unicorn/no-useless-length-check":{create:e=>{let t=[],r=new i,n=new i,o=new i,a=new i;e.on("BinaryExpression",e=>{if(!("BinaryExpression"===e.type&&"Literal"===e.right.type&&"0"===e.right.raw&&tS(e.left,{property:"length",optional:!1})&&tL(e.parent)))return;let{operator:t}=e;"==="===t?r.add(e):(">"===t||"!=="===t)&&n.add(e)}),e.on("CallExpression",t=>{tA(t,{optionalCall:!1,optionalMember:!1,computed:!1})&&"Identifier"===t.callee.property.type&&!nE(t.callee.object,e)&&("some"===t.callee.property.name?o.add(t):"every"===t.callee.property.name&&a.add(t))}),e.on("LogicalExpression",e=>{tL(e)&&t.push(e)}),e.on("Program:exit",function*(){let s=new i(t.flatMap(e=>(function(e){let{operator:t}=e;return(function e(t){return[t.left,t.right].flatMap(r=>"LogicalExpression"===r.type&&r.operator===t.operator?e(r):[r])})(e).filter((e,i,s)=>(function({node:e,operator:t,siblings:i}){return"||"===t&&r.has(e)&&i.some(t=>a.has(t)&&rv(e.left.object,t.callee.object))||"&&"===t&&n.has(e)&&i.some(t=>o.has(t)&&rv(e.left.object,t.callee.object))})({node:e,operator:t,siblings:[s[i-1],s[i+1]].filter(Boolean)}))})(e))),{sourceCode:l}=e;for(let t of s)yield{loc:{start:l.getLoc(t.left.property).start,end:l.getLoc(t).end},messageId:r.has(t)?"zero":"non-zero",fix(r){let{left:n,right:o}=t.parent,a=e9(n,e),i=e9(o,e),s=[];return n===t?(s[0]=a[0],s[1]=i[0]):(s[0]=a[1],s[1]=i[1]),r.removeRange(s)}}})},meta:{type:"suggestion",docs:{description:"Disallow useless array length check.",recommended:"unopinionated"},fixable:"code",messages:{"non-zero":"The non-empty check is useless as `Array#some()` returns `false` for an empty array.",zero:"The empty check is useless as `Array#every()` returns `true` for an empty array."},languages:["js/js"]}},"unicorn/no-useless-promise-resolve-reject":{create:e=>{e.on("CallExpression",t=>{let{expression:r,parent:n}=ii(t);if(!(tA(t,{object:"Promise",methods:["resolve","reject"],optionalCall:!1,optionalMember:!1})&&("ArrowFunctionExpression"===n.type&&n.body===r||"ReturnStatement"===n.type&&n.argument===r||"YieldExpression"===n.type&&!n.delegate&&n.argument===r)))return;let{functionNode:o,isInTryStatement:a}=function(e){let t,r=!1;for(;e;e=e.parent){if(tE(e)){t=e;break}"TryStatement"===e.type&&(r=!0)}return{functionNode:t,isInTryStatement:r}}(t);if(o&&(o.async||function(e){if("CallExpression"===e.parent.type&&"MemberExpression"===e.parent.callee.type&&!e.parent.callee.computed&&"Identifier"===e.parent.callee.property.type){let{callee:{property:t},arguments:r}=e.parent;if(1===r.length&&["then","catch","finally"].includes(t.name)&&r[0]===e||2===r.length&&"then"===t.name&&(r[0]===e||"SpreadElement"!==r[0].type&&r[1]===e))return!0}return!1}(o)))return function(e,t){let{callee:r}=e,n=r.property.name,{parent:o}=ii(e);return{node:r,messageId:n,data:{type:"YieldExpression"===o.type?"yield":"return"},fix:t}}(t,function(e,t,r){if(e.arguments.length>1)return;let{callee:n,arguments:o}=e,{expression:a,parent:i,isAwaited:s}=ii(e),[l]=o;if(l?.type==="SpreadElement")return;let u="reject"===n.property.name,p="YieldExpression"===i.type;if(u&&(t||p&&"ExpressionStatement"!==i.parent.type))return;let c=function({callExpression:e,parent:t,expression:r,isAwaited:n,isReject:o,context:a}){return n&&!o?e9(e,a):o&&"YieldExpression"===t.type?e9(t,a):"ArrowFunctionExpression"===t.type?o?e9(r,a):e:t}({callExpression:e,parent:i,expression:a,isAwaited:s,isReject:u,context:r});if(!rP(r,c,l?[l]:[]))return function(t){let n="ArrowFunctionExpression"===i.type,o=is(l,r);if(u){if(o||="undefined",o=`throw ${o}`,p)return t.replaceTextRange(e9(i,r),o);if(o+=";",n)return o=`{ ${o} }`,t.replaceTextRange(e9(a,r),o)}else{if(s){var c;let n;return t.replaceTextRange(e9(e,r),(n=is(c=l,r)||"undefined",c&&"SequenceExpression"!==c.type&&16>oJ(c)?`(${n})`:n))}p?o=`yield${o?" ":""}${o}`:"ReturnStatement"===i.type?o=`return${o?" ":""}${o};`:(l?.type==="ObjectExpression"&&(o=`(${o})`),o||="{}")}return t.replaceText(n?e:i,o)}}(t,a,e))})},meta:{type:"suggestion",docs:{description:"Disallow returning/yielding `Promise.resolve/reject()` in async functions or promise callbacks",recommended:"unopinionated"},fixable:"code",messages:{resolve:"Prefer `{{type}} value` over `{{type}} Promise.resolve(value)`.",reject:"Prefer `throw error` over `{{type}} Promise.reject(error)`."},languages:["js/js"]}},"unicorn/no-zero-fractions":{create:e=>{e.on("Literal",t=>{if(!tn(t))return;let{raw:r}=t,n=r.match(/^(?<before>[\d_]*)(?<dotAndFractions>\.[\d_]*)(?<after>.*)$/);if(!n)return;let{before:o,dotAndFractions:a,after:i}=n.groups,s=(o+a.replaceAll(/[.0_]+$/g,"")||"0")+i;if(s===r)return;let l="."===a,{sourceCode:u}=e,p=u.getRange(t)[0]+o.length+a.length;return{loc:o5([p-(r.length-s.length),p],e),messageId:l?iu:il,*fix(r){let n=s;"MemberExpression"===t.parent.type&&t.parent.object===t&&oY.test(s)&&!e4(t,e)&&(n=`(${n})`,oC(u.getTokenBefore(t),e,n)&&(n=`;${n}`)),yield r.replaceText(t,n),yield aR(r,t,e)}}})},meta:{type:"suggestion",docs:{description:"Disallow number literals with zero fractions or dangling dots.",recommended:"unopinionated"},fixable:"code",messages:{[il]:"Don't use a zero fraction in the number.",[iu]:"Don't use a dangling dot in the number."},languages:["js/js"]}},"unicorn/prefer-export-from":ib,"unicorn/prefer-native-coercion-functions":{create:e=>{e.on(tb,t=>{if(t.async||t.generator||t.returnType?.type==="TSTypeAnnotation"&&"TSTypePredicate"===t.returnType.typeAnnotation.type||0===t.params.length||"Identifier"!==t.params[0].type||("MethodDefinition"===t.parent.type&&("constructor"===t.parent.kind||"set"===t.parent.kind)||"Property"===t.parent.type&&"set"===t.parent.kind)&&t.parent.value===t)return;let r=function(e){if(("ArrowFunctionExpression"===e.type&&"Identifier"===e.body.type&&e.body.name===e.params[0].name||"BlockStatement"===e.body.type&&1===e.body.body.length&&"ReturnStatement"===e.body.body[0].type&&e.body.body[0].argument?.type==="Identifier"&&e.body.body[0].argument.name===e.params[0].name)&&"CallExpression"===e.parent.type&&!e.parent.optional&&e.parent.arguments[0]===e&&"MemberExpression"===e.parent.callee.type&&!e.parent.callee.computed&&!e.parent.callee.optional&&"Identifier"===e.parent.callee.property.type&&iC.has(e.parent.callee.property.name))return{replacementFunction:"Boolean",fix:t=>t.replaceText(e,"Boolean")}}(t)||function(e){let t,r=(t=e.params[0].name,"ArrowFunctionExpression"===e.type&&iD(e.body,t)?e.body:"BlockStatement"===e.body.type&&1===e.body.body.length&&"ReturnStatement"===e.body.body[0].type&&iD(e.body.body[0].argument,t)?e.body.body[0].argument:void 0);if(!r)return;let{name:n}=r.callee,o={replacementFunction:n};return"FunctionDeclaration"===e.type||1!==r.arguments.length||(o.fix=t=>{let r=n;return"Property"===e.parent.type&&e.parent.method&&e.parent.value===e?r=`: ${r}`:"MethodDefinition"===e.parent.type&&(r=` = ${r};`),t.replaceText(e,r)}),o}(t);if(!r)return;let{sourceCode:n}=e,{replacementFunction:o,fix:a}=r;return r={node:t,loc:eA(t,n),messageId:iE,data:{functionNameWithKind:eO(t,n),replacementFunction:o}},!a||1!==t.params.length||n.getCommentsInside(t).length>0||(r.fix=a),r})},meta:{type:"suggestion",docs:{description:"Prefer using `String`, `Number`, `BigInt`, `Boolean`, and `Symbol` directly.",recommended:"unopinionated"},fixable:"code",messages:{[iE]:"{{functionNameWithKind}} is equivalent to `{{replacementFunction}}`. Use `{{replacementFunction}}` directly."},languages:["js/js"]}},"unicorn/no-document-cookie":{create(e){ik.listen({context:e})},meta:{type:"problem",docs:{description:"Do not use `document.cookie` directly.",recommended:"unopinionated"},messages:{[iw]:"Do not use `document.cookie` directly."},languages:["js/js"]}},"unicorn/prefer-add-event-listener":iB,"unicorn/prefer-array-index-of":iO,"unicorn/prefer-blob-reading-methods":{create:e=>{e.on("CallExpression",e=>{if(!tA(e,{methods:["readAsText","readAsArrayBuffer"],argumentsLength:1,optionalCall:!1,optionalMember:!1}))return;let t=e.callee.property,r=t.name;return{node:t,messageId:iU,data:{method:r,replacement:"readAsArrayBuffer"===r?"arrayBuffer":"text"}}})},meta:{type:"suggestion",docs:{description:"Prefer `Blob#arrayBuffer()` over `FileReader#readAsArrayBuffer(…)` and `Blob#text()` over `FileReader#readAsText(…)`.",recommended:"unopinionated"},messages:{[iU]:"Prefer `Blob#{{replacement}}()` over `FileReader#{{method}}(blob)`."},languages:["js/js"]}},"unicorn/prefer-date-now":{create:e=>{e.on("CallExpression",e=>{if(tA(e,{methods:["getTime","valueOf"],argumentsLength:0,optionalCall:!1,optionalMember:!1})&&i_(e.callee.object)){let t=e.callee.property;return iz(e,{node:t,messageId:iV,data:{method:t.name}})}if(td(e,{names:["Number","BigInt"],argumentsLength:1,optional:!1},tu)&&i_(e.arguments[0])){let{name:t}=e.callee;return"Number"===t?iz(e,{messageId:iW}):iz(e.arguments[0])}}),e.on("UnaryExpression",t=>{if(("+"===t.operator||"-"===t.operator)&&i_(t.argument))return iz("-"===t.operator?t.argument:t,{},e)}),e.on("AssignmentExpression",e=>{if(("-="===e.operator||"*="===e.operator||"/="===e.operator||"%="===e.operator||"**="===e.operator)&&i_(e.right))return iz(e.right)}),e.on("BinaryExpression",function*(e){if("-"===e.operator||"*"===e.operator||"/"===e.operator||"%"===e.operator||"**"===e.operator)for(let t of[e.left,e.right])i_(t)&&(yield iz(t))})},meta:{type:"suggestion",docs:{description:"Prefer `Date.now()` to get the number of milliseconds since the Unix Epoch.",recommended:"unopinionated"},fixable:"code",messages:{[iq]:"Prefer `Date.now()` over `new Date()`.",[iV]:"Prefer `Date.now()` over `Date#{{method}}()`.",[iW]:"Prefer `Date.now()` over `Number(new Date())`."},languages:["js/js"]}},"unicorn/dom-node-dataset":i1,"unicorn/prefer-modern-math-apis":{create:e=>{let t=[];e.on("CallExpression",t=>{if(!tA(t,{object:"Math",method:"sqrt",argumentsLength:1,optionalCall:!1,optionalMember:!1}))return;let r=i4(t.arguments[0]);if(r.some(e=>!("BinaryExpression"===e.type&&("*"===e.operator&&rv(e.left,e.right)||"**"===e.operator&&e7(e.right,2)))))return;let n=1===r.length?"abs":"hypot",o=new i(1===r.length?[]:r.map(e=>e.parent));return{node:t.callee.property,messageId:i2,data:{replacement:`Math.${n}(…)`,description:"Math.sqrt(…)"},*fix(a){let{sourceCode:i}=e;for(let r of(yield a.replaceText(t.callee.property,n),o)){let t=i.getTokenAfter(r.left,e=>"Punctuator"===e.type&&"+"===e.value);yield aV(t,",",a,e),yield aS(r,a,e)}for(let t of r)yield a.removeRange([e9(t.left,e)[1],i.getRange(t)[1]])}}}),e.on("BinaryExpression",e=>{t.push(e)}),e.on("Program:exit",function*(){for(let r of t)for(let t of i5){let n=t(r,e);n&&(yield n)}})},meta:{type:"suggestion",docs:{description:"Prefer modern `Math` APIs over legacy patterns.",recommended:"unopinionated"},fixable:"code",messages:{[i2]:"Prefer `{{replacement}}` over `{{description}}`."},languages:["js/js"]}},"unicorn/number-literal-case":st,"unicorn/prefer-number-properties":ss,"unicorn/prefer-reflect-apply":{create:e=>{e.on("CallExpression",t=>{if(!tA(t,{optionalCall:!1,optionalMember:!1})||"Literal"===t.callee.object.type||"ArrayExpression"===t.callee.object.type||"ObjectExpression"===t.callee.object.type)return;let{sourceCode:r}=e,n=((e,t)=>{if("apply"===eM(e.callee)&&2===e.arguments.length&&su(e.arguments[0],e.arguments[1]))return r=>r.replaceText(e,sp(t,e.callee.object,e.arguments[0],e.arguments[1]))})(t,r)||((e,t)=>{if("call"===eM(e.callee)&&"apply"===eM(e.callee.object)&&"prototype"===eM(e.callee.object.object)&&e.callee.object.object.object?.type==="Identifier"&&"Function"===e.callee.object.object.object.name&&3===e.arguments.length&&su(e.arguments[1],e.arguments[2]))return r=>r.replaceText(e,sp(t,e.arguments[0],e.arguments[1],e.arguments[2]))})(t,r);if(n)return{node:t,messageId:sl,fix:n}})},meta:{type:"suggestion",docs:{description:"Prefer `Reflect.apply()` over `Function#apply()`.",recommended:"unopinionated"},fixable:"code",messages:{[sl]:"Prefer `Reflect.apply()` over `Function#apply()`."},languages:["js/js"]}},"unicorn/prefer-set-size":{create:e=>{e.on("MemberExpression",t=>{var r;if(!tS(t,{property:"length",optional:!1}))return;let n="ArrayExpression"===(r=t.object).type&&1===r.elements.length&&r.elements[0]?.type==="SpreadElement"?r.elements[0].argument:tA(r,{object:"Array",method:"from",argumentsLength:1,optionalCall:!1,optionalMember:!1})?r.arguments[0]:void 0;if(n&&nw(n,e))return{node:t.property,messageId:sc,fix:function(e,t,r){let{sourceCode:n}=e,{object:o,property:a}=t;if(!(n.getCommentsInside(o).length>n.getCommentsInside(r).length))return function*(i){yield i.replaceText(a,"size");let s=n.getText(r);oQ(r,e)&&(s=`(${s})`),yield i.replaceText(o,s),"ArrayExpression"===o.type&&(yield aR(i,t,e))}}(e,t,n)}})},meta:{type:"suggestion",docs:{description:"Prefer using `Set#size` instead of `Array#length`.",recommended:"unopinionated"},fixable:"code",messages:{[sc]:"Prefer using `Set#size` instead of `Array#length`."},languages:["js/js"]}},"unicorn/prefer-string-replace-all":{create:e=>{e.on("CallExpression",t=>{let r,n,o=((e,t)=>{let r;if(!tA(e,{method:"join",argumentsLength:1,optionalCall:!1,optionalMember:!1})||!tA(e.callee.object,{method:"split",argumentsLength:1,optionalCall:!1,optionalMember:!1})||t.sourceCode.getCommentsInside(e).length>0)return;let n=e.callee.object;if(ot(n.callee.object,t))return;let[o]=n.arguments,[a]=e.arguments,i=tr(o);if("string"==typeof i){if(0===i.length)return;r=tz(i)}else if(!(r=(e=>{if(!to(e)||e.regex.flags.includes("y"))return;let t=sA(e);if(!t||sI(t)||0===sk(t))return;let{pattern:r,flags:n}=e.regex;return`/${r}/${n.includes("g")?n:`g${n}`}`})(o)))return;let s=tr(a);if("string"==typeof s)return`${e5(n.callee.object,t)}.replaceAll(${r}, ${tz(s.replaceAll("$","$$$$"))})`})(t,e);if(o)return{node:t.callee.property,messageId:sb,fix:e=>e.replaceText(t,o)};if(!tA(t,{methods:["replace","replaceAll"],argumentsLength:2,optionalCall:!1})||tA(t,{method:"replace",argumentsLength:2,optionalCall:!1,optionalMember:!1})&&to(r=t.arguments[0])&&r.regex.flags.includes("g")&&!r.regex.flags.includes("y")&&(e=>{if(!e.startsWith("[")||!e.endsWith("]")||e.startsWith("[^"))return;let t=new i,r=e.slice(1,-1);for(let e=0;e<r.length;e++){let n=r[e],o=!1;if("\\"===n&&(n=r[++e],o=!0,!n)||"-"===n&&!o&&0!==e&&e!==r.length-1||"]"===n&&!o&&0!==e||!sg.has(n))return;t.add(n)}return t})(r.regex.pattern)?.size>=8&&te(n=t.arguments[1])&&n.value===sf)return;let{arguments:a,callee:{property:s}}=t;if(ot(t.callee.object,e))return;let[l]=a;if(!((e,t)=>{if(to(e))return e.regex.flags.includes("g");if(tm(e,{name:"RegExp"})&&e.arguments[0]?.type!=="SpreadElement"&&e.arguments[1]?.type==="Literal"&&"string"==typeof e.arguments[1].value)return e.arguments[1].value.includes("g");let r=eN(e,t);if(!r)return!1;let{value:n}=r;return"[object RegExp]"===Object.prototype.toString.call(n)&&n.global})(l,e.sourceCode.getScope(l)))return;let u=s.name,p=function(e){if(!to(e))return;let t=sA(e);if(!t)return;let{flags:r}=e.regex;if(!function(e){if(!e.includes("g"))return!1;for(let t of e)if(sE.has(t))return!1;return!0}(r))return;let n="alternative"===t.type?sT(t.body):sS(t);if(n)return"'"+n+"'"}(l);if("replaceAll"===u){if(!p)return;return{node:l,messageId:sx,data:{replacement:p.length<20?p:"a string literal"},fix:e=>e.replaceText(l,p)}}return{node:s,messageId:sh,*fix(e){yield e.insertTextAfter(s,"All"),p&&(yield e.replaceText(l,p))}}})},meta:{type:"suggestion",docs:{description:"Prefer `String#replaceAll()` over regex searches with the global flag and `String#split().join()`.",recommended:"unopinionated"},fixable:"code",messages:{[sh]:"Prefer `String#replaceAll()` over `String#replace()`.",[sx]:"This pattern can be replaced with {{replacement}}.",[sb]:"Prefer `String#replaceAll()` over `String#split().join()`."},languages:["js/js"]}},"unicorn/prefer-string-slice":{create:e=>{e.on("CallExpression",t=>{if(!tA(t,{methods:["substr","substring"]})||ot(t.callee.object,e))return;let r=t.callee.property.name;if(!("substring"===r&&(e=>{if(!tA(e,{method:"substring",argumentsLength:2}))return;let[t,r]=e.arguments;if(sj(t)&&sj(r)&&1===Math.abs(t.value-r.value))return t.value<r.value?t:r;let n=(e=>{if("BinaryExpression"===e.type&&"-"===e.operator&&e7(e.right,1))return e.left})(t);return sF(r,t)??(sF(t,r)?r:void 0)??(n&&rv(n,r)?t:void 0)})(t)))return{node:t,messageId:r,*fix(n,{abort:o}){if(yield n.replaceText(t.callee.property,"slice"),0!==t.arguments.length){if(t.arguments.length>2||t.arguments.some(e=>"SpreadElement"===e.type))return o();yield("substr"===r?function*({node:e,fixer:t,context:r,abort:n}){let o=e.arguments,[a,i]=o;if(!i)return;let{sourceCode:s}=r,l=eN(a,s.getScope(e)),u=e9(i,r);if(l?.value===0){let n=((e,t,r)=>{let n,o,{sourceCode:a}=r;if(!("BinaryExpression"!==e.type||"-"!==e.operator||!(tn(n=e.right)&&Number.isSafeInteger(n.value)&&n.value>0)||!sR(e.left)||!("Identifier"===t.type||te(t))||!rv(e.left.object,t)||(o=((e,t)=>{let[r,n]=e9(e,t),o=t.sourceCode.getTokenByRangeStart(r),a=t.sourceCode.getTokenBefore(o);return[t.sourceCode.getRange(a)[1],n]})(e,r),a.getAllComments().some(e=>{let t=a.getRange(e);return t[0]>=o[0]&&t[1]<=o[1]}))))return`-${e.right.raw}`})(i,e.callee.object,r);if(n)return void(yield aw(t,i,n,r));if(tn(i)||sR(i))return;let o=sB(i);return"number"==typeof o?void(yield aw(t,i,String(Math.max(0,o)),r)):(yield t.insertTextBeforeRange(u,"Math.max(0, "),void(yield t.insertTextAfterRange(u,")")))}if(o.every(e=>tn(e))){let e;return void(yield(e=String(a.value+i.value),aw(t,i,e,r)))}return n()}:function*({node:e,fixer:t,context:r,abort:n}){let[o,a]=e.arguments,i=o?sB(o):void 0;if(!a){if(sR(o))return;if(void 0!==i)return void(yield aw(t,o,String(Math.max(0,i)),r));let e=e9(o,r);return yield t.insertTextBeforeRange(e,"Math.max(0, "),void(yield t.insertTextAfterRange(e,")"))}let s=sB(a);if(void 0!==i&&void 0!==s){let e=[Math.max(0,i),Math.max(0,s)];i>s&&e.reverse(),e[0]!==i&&(yield aw(t,o,String(e[0]),r)),e[1]!==s&&(yield aw(t,a,String(e[1]),r));return}if(0===i||0===s){let e=e5(o,r),n=e5(a,r);yield aw(t,o,"0",r),yield aw(t,a,`Math.max(0, ${0===i?n:e})`,r);return}return n()})({node:t,fixer:n,context:e,abort:o})}}}})},meta:{type:"suggestion",docs:{description:"Prefer `String#slice()` over `String#substr()` and `String#substring()`.",recommended:"unopinionated"},fixable:"code",messages:{substr:"Prefer `String#slice()` over `String#substr()`.",substring:"Prefer `String#slice()` over `String#substring()`."},languages:["js/js"]}},"unicorn/prefer-string-trim-start-end":{create:e=>{e.on("CallExpression",t=>{if(!tA(t,{methods:["trimLeft","trimRight"],argumentsLength:0,optionalCall:!1})||ot(t.callee.object,e))return;let r=t.callee.property,n=r.name,o="trimLeft"===n?"trimStart":"trimEnd";return{node:r,messageId:sP,data:{method:n,replacement:o},fix:e=>e.replaceText(r,o)}})},meta:{type:"suggestion",docs:{description:"Prefer `String#trimStart()` / `String#trimEnd()` over `String#trimLeft()` / `String#trimRight()`.",recommended:"unopinionated"},fixable:"code",messages:{[sP]:"Prefer `String#{{replacement}}()` over `String#{{method}}()`."},languages:["js/js"]}},"unicorn/no-unreadable-iife":{create:e=>{e.on("CallExpression",t=>{if("ArrowFunctionExpression"!==t.callee.type||"BlockStatement"===t.callee.body.type||!e4(t.callee.body,e))return;let{body:r}=t.callee,n={node:t,loc:o5(e9(r,e),e),messageId:sL};return!function(e,t){let{sourceCode:r}=t,[n,o]=e9(e,t),[a,i]=r.getRange(e);return r.getCommentsInside(e.parent).some(e=>{let[t,s]=r.getRange(e);return t>=n&&s<=o&&(t<a||s>i)})}(r,e)&&(n.suggest=[{messageId:sN,fix:t=>t.replaceTextRange(e9(r,e),`{ return ${e.sourceCode.getText(r)}; }`)}]),n})},meta:{type:"suggestion",docs:{description:"Disallow unreadable IIFEs.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[sL]:"IIFE with parenthesized arrow function body is considered unreadable.",[sN]:"Use a block statement body."},languages:["js/js"]}},"unicorn/throw-new-error":{create:e=>{e.on("CallExpression",t=>{if("Decorator"===t.parent.type)return;let{callee:r}=t;if(!(t.optional||rX(r))&&("Identifier"===r.type&&sM.test(r.name)||"MemberExpression"===r.type&&!r.computed&&"Identifier"===r.property.type&&sM.test(r.property.name))&&!tS(r,{object:"Data",property:"TaggedError",computed:!1}))return{node:t,messageId:s$,fix:r=>aP(t,e,r)}})},meta:{type:"suggestion",docs:{description:"Require `new` when creating an error.",recommended:"unopinionated"},fixable:"code",messages:{[s$]:"Use `new` when creating an error."},languages:["js/js"]}},"unicorn/escape-case":{create:e=>{let t="lowercase"===e.options[0];e.on("Literal",e=>{if(te(e))return sW({node:e,original:e.raw,lowercase:t})}),e.on("Literal",e=>{if(to(e))return sW({node:e,original:e.raw,regex:sV,lowercase:t})}),e.on("TemplateElement",r=>{if(!tB(r.parent))return sW({node:r,original:r.value.raw,lowercase:t,fix:(t,n)=>aq(r,n,e,t)})})},meta:{type:"suggestion",docs:{description:"Require escape sequences to use uppercase or lowercase values.",recommended:"unopinionated"},fixable:"code",schema:[{enum:["uppercase","lowercase"],description:"The case style for escape sequences."}],defaultOptions:["uppercase"],messages:{[sO]:"Use uppercase characters for the value of the escape sequence.",[sU]:"Use lowercase characters for the value of the escape sequence."},languages:["js/js"]}},"unicorn/prefer-unicode-code-point-escapes":{create:e=>{e.on("Literal",e=>te(e)?s8(e,e.raw):to(e)?function(e){let t,{raw:r}=e,{pattern:n,flags:o}=(t=r.lastIndexOf("/"),{pattern:r.slice(1,t),flags:r.slice(t+1)}),{fixed:i,hasReplacement:s}=s3(n,{isRegex:!0,supportsNestedCharacterClasses:o.includes("v")}),l=o.includes("u")||o.includes("v"),u=function(e){for(let t=0;t<e.length;t++)if(void 0!==function(e,t){var r;if(!e.startsWith(sK,t))return;let n=t+sK.length;for(;r=e[n],sG.test(r);)n++;if(n===t+sK.length||"}"!==e[n])return;let o=Number.parseInt(e.slice(t+sK.length,n),16);if(!(o>1114111))return o}(e,t)&&sH(e,t))return!0;return!1}(n);if(!s&&(l||!u))return;let p=`/${s?i:n}/${s6(o)}`;return l?{node:e,messageId:s_,fix:t=>t.replaceText(e,p)}:!function(e,t){try{return new a(e,t),!0}catch{return!1}}(s?i:n,s6(o))?{node:e,messageId:s_}:{node:e,messageId:s_,suggest:[{messageId:sz,fix:t=>t.replaceText(e,p)}]}}(e):void 0),e.on("TemplateElement",t=>{if(!tB(t.parent))return s8(t,t.value.raw,(r,n)=>aq(t,n,e,r))})},meta:{type:"suggestion",docs:{description:"Prefer Unicode code point escapes over legacy escape sequences.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[s_]:"Prefer Unicode code point escapes.",[sz]:"Use Unicode code point escapes and add the `u` flag."},languages:["js/js"]}},"unicorn/prefer-prototype-methods":{create:function(e){let{sourceCode:t}=e,r=[];e.on("CallExpression",e=>{r.push(e)}),e.onExit("Program",function*(n){let o=new s;for(let{node:e,path:r}of new e0(t.getScope(n)).iterateGlobalReferences(Object.fromEntries(s9.map(e=>[e,{[e0.READ]:!0}]))))o.set(e,r);for(let t of r)yield function(e,{context:t,globalReferences:r}){let n;tA(e,{object:"Reflect",method:"apply",minimumArguments:1,optionalCall:!1,optionalMember:!1})?n=e.arguments[0]:tA(e,{methods:["apply","bind","call"],optionalCall:!1,optionalMember:!1})&&(n=e.callee.object);let{isGlobalReference:o,constructorName:a,methodName:i}=function(e,{context:t,globalReferences:r}){if(!e)return;if(r.has(e))return{isGlobalReference:!0,constructorName:"Object",methodName:r.get(e).at(-1)};if(!tS(e,{optional:!1}))return;let n=e.object;if(ty(n)||th(n))return{constructorName:"ArrayExpression"===n.type?"Array":"Object",methodName:eM(e,t.sourceCode.getScope(e))}}(n,{context:t,globalReferences:r})??{};if(a)return{node:n,messageId:i?"known-method":"unknown-method",data:{constructorName:a,methodName:i},*fix(r){if(o)return void(yield r.replaceText(n,`${a}.prototype.${i}`));if(tS(n)){let o=n.object;yield r.replaceText(o,`${a}.prototype`),("ArrayExpression"===o.type||"ObjectExpression"===o.type)&&(yield aR(r,e,t))}}}}(t,{context:e,globalReferences:o})})},meta:{type:"suggestion",docs:{description:"Prefer borrowing methods from the prototype instead of the instance.",recommended:"unopinionated"},fixable:"code",messages:{"known-method":"Prefer using `{{constructorName}}.prototype.{{methodName}}`.","unknown-method":"Prefer using method from `{{constructorName}}.prototype`."},languages:["js/js"]}},"unicorn/error-message":{create:e=>{e.on(["CallExpression","NewExpression"],t=>{if(!(td(t,{names:s5,optional:!1},tc)&&e.sourceCode.isGlobalReference(t.callee)))return;let r=t.callee.name,n=lt.has(r)?lt.get(r):0,o=t.arguments;if(o.some((e,t)=>t<=n&&"SpreadElement"===e.type))return;let a=o[n];if(!a)return{node:t,messageId:s4,data:{constructorName:r}};if("ArrayExpression"===a.type||"ObjectExpression"===a.type)return{node:a,messageId:le};let i=eN(a,e.sourceCode.getScope(a));if(!i)return;let{value:s}=i;return"string"!=typeof s?{node:a,messageId:le}:""===s?{node:a,messageId:s7}:void 0})},meta:{type:"problem",docs:{description:"Enforce passing a `message` value when creating a built-in error.",recommended:"unopinionated"},messages:{[s4]:"Pass a message to the `{{constructorName}}` constructor.",[s7]:"Error message should not be an empty string.",[le]:"Error message should be a string."},languages:["js/js"]}},"unicorn/no-instanceof-builtins":lp,"unicorn/prefer-type-error":{create:e=>{e.on("ThrowStatement",e=>{let t;if(!(tm(e.argument,{name:"Error"})&&e.parent&&e.parent.body&&1===e.parent.body.length&&e.parent.parent&&"IfStatement"===(t=e.parent.parent).type&&lx(t.test)))return;let r=e.argument.callee;return{node:r,messageId:lc,fix:e=>e.insertTextBefore(r,"Type")}})},meta:{type:"suggestion",docs:{description:"Enforce throwing `TypeError` in type checking conditions.",recommended:"unopinionated"},fixable:"code",messages:{[lc]:"`new Error()` is too unspecific for a type check. Use `new TypeError()` instead."},languages:["js/js"]}},"unicorn/consistent-destructuring":{create:e=>{let{sourceCode:t}=e,r=new o,n=[],a=[],i=e=>{let r=rI(e.object);if(e.computed||"Identifier"!==e.property.type||!["Identifier","ThisExpression"].includes(r.type))return;let n=t.getScope(e);a.push({propertyName:e.property.name,rootIdentifierName:"Identifier"===r.type?r.name:void 0,rootVariable:"Identifier"===r.type?eg(n,r):void 0,thisScopeBoundary:"ThisExpression"===r.type?lC(r):void 0,start:t.getRange(e)[0],scope:n})},s=e=>{switch(e.type){case"MemberExpression":i(e);break;case"AssignmentPattern":s(e.left);break;case"RestElement":s(e.argument);break;case"ObjectPattern":for(let t of e.properties)s("Property"===t.type?t.value:t.argument);break;case"ArrayPattern":for(let t of e.elements)t&&s(t)}};e.on("AssignmentExpression",e=>{s(e.left)}),e.on(["ForInStatement","ForOfStatement"],e=>{"VariableDeclaration"!==e.left.type&&s(e.left)}),e.on("UpdateExpression",e=>{"MemberExpression"===e.argument.type&&i(e.argument)}),e.on("UnaryExpression",e=>{"delete"===e.operator&&"MemberExpression"===e.argument.type&&i(e.argument)}),e.on("VariableDeclarator",e=>{let n;if(!("ObjectPattern"===e.id.type&&"const"===e.parent.kind&&e.init&&("Identifier"===(n=e.init).type||"ThisExpression"===n.type)))return;let o="Identifier"===e.init.type?e.init:void 0,a={scope:t.getScope(e),object:e.init,rootIdentifierName:o?.name,rootVariable:o&&eg(t.getScope(e),o),thisScopeBoundary:"ThisExpression"===e.init.type?lC(e.init):void 0,objectPattern:e.id},i=t.getText(e.init);r.set(i,[...r.get(i)??[],a])});let l=e=>{let n,o;if((o=e).computed||td(o.parent,void 0,tc)&&o.parent.callee===o||"TaggedTemplateExpression"===o.parent.type&&o.parent.tag===o||nP(o))return;let i=rI(e.object),s=r.get(t.getText(i));if(!s)return;let l=t.getScope(e),u="Identifier"===i.type?i:void 0,p=u&&eg(l,u),c="ThisExpression"===i.type?lC(i):void 0,d=t.getText(e.property);for(let r of s.toReversed())if(lT({declaration:r,memberExpressionNode:e,memberScope:l,memberRootIdentifier:u,memberRootVariable:p,memberThisScopeBoundary:c,memberExpressionWrites:a,sourceCode:t})&&(n=lS(r.objectPattern.properties.filter(e=>lD(e)&&"Identifier"===e.value.type),d,l,t)))break;if(!n||((e,t)=>{let r=e,{parent:n}=e;for(;n&&!lk(n);){if(lw(n,r,e,t))return!0;r=n,n=n.parent}return!1})(e,t))return;if("MemberExpression"===e.parent.type)return{node:e,messageId:lb};let m=t.getText(e),f=n.value.name;return{node:e,messageId:lb,suggest:[{messageId:lE,data:{expression:m,property:f},fix:t=>t.replaceText(e,f)}]}};e.on("MemberExpression",e=>{n.push(e)}),e.onExit("Program",function*(){for(let e of n){let t=l(e);t&&(yield t)}})},meta:{type:"suggestion",docs:{description:"Use destructured variables over properties.",recommended:!1},hasSuggestions:!0,messages:{[lb]:"Use destructured variables over properties.",[lE]:"Replace `{{expression}}` with destructured property `{{property}}`."},languages:["js/js"]}},"unicorn/new-for-builtins":{create:e=>{lP.listen({context:e}),lL.listen({context:e}),lN.listen({context:e}),l$.listen({context:e})},meta:{type:"suggestion",docs:{description:"Enforce correct use of `new` for builtin constructors.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{enforce:"Use `new {{name}}()` instead of `{{name}}()`.",disallow:"Use `{{name}}()` instead of `new {{name}}()`.",disallowCallOrNew:"`{{name}}` is not a function or constructor.",[lF]:"Use `String(new Date())` instead of `Date()`.",[lB]:"Switch to `String(new Date())`."},languages:["js/js"]}},"unicorn/prefer-single-call":lW,"unicorn/no-process-exit":{create:e=>{if(0===e.sourceCode.lines[0].indexOf("#!"))return;let t=0,r=!1,n=[],o=e=>tA(e,{object:"process",methods:["on","once"],minimumArguments:1,optionalCall:!1,optionalMember:!1});e.on("CallExpression",e=>{tI(e)&&lz(e.arguments[0])&&(r=!0)}),e.on("ImportDeclaration",e=>{"Literal"===e.source.type&&lz(e.source)&&(r=!0)}),e.on("CallExpression",e=>{o(e)&&t++}),e.onExit("CallExpression",e=>{o(e)&&t--}),e.on("CallExpression",e=>{0===t&&tA(e,{object:"process",method:"exit",optionalCall:!1,optionalMember:!1})&&n.push(e)}),e.onExit("Program",function*(){if(!r)for(let e of n)yield{node:e,messageId:l_}})},meta:{type:"suggestion",docs:{description:"Disallow `process.exit()`.",recommended:"unopinionated"},messages:{[l_]:"Only use `process.exit()` in CLI apps. Throw an error instead."},languages:["js/js"]}},"unicorn/no-static-only-class":{create:function(e){e.on(["ClassDeclaration","ClassExpression"],t=>{if(!(t.superClass||t.decorators&&t.decorators.length>0||"ClassBody"!==t.body.type||0===t.body.body.length||t.body.body.some(e=>!function(e){let{private:t,static:r,declare:n,readonly:o,accessibility:a,decorators:i,key:s}=e;return(!!l1(e)||"MethodDefinition"===e.type)&&!!r&&!t&&"PrivateIdentifier"!==s.type&&!(n||o||void 0!==a||Array.isArray(i)&&i.length>0)}(e))))return{node:t,loc:function(e,t){let{sourceCode:r}=t,{body:n}=e,o=r.getTokenBefore(n),{start:a}=r.getLoc(e),{end:i}=r.getLoc(o);return{start:a,end:i}}(t,e),messageId:lZ,fix:function(e,t){let{type:r,id:n,body:o,declare:a,abstract:i,implements:s,parent:l}=e;if(a||i||Array.isArray(s)&&s.length>0||"ClassExpression"===r&&n)return;let u="ClassDeclaration"===e.type&&"ExportDefaultDeclaration"===e.parent.type&&e.parent.declaration===e;if(u&&n)return;let{sourceCode:p}=t;for(let e of o.body)if(l1(e)&&(e.typeAnnotation||e.value&&p.getText(e.value).includes("this")))return;return function*(n){let a=p.getFirstToken(e);if(tV(a,{expected:{type:"Keyword",value:"class"},ruleId:"no-static-only-class"}),u||"ClassExpression"===r)if("ClassExpression"===r&&"ReturnStatement"===l.type&&p.getLoc(o).start.line!==p.getLoc(l).start.line&&p.text.slice(p.getRange(a)[1],p.getRange(o)[0]).trim()){yield n.replaceText(a,"{");let e=p.getFirstToken(o);yield n.remove(e)}else yield n.replaceText(a,""),yield aj(a,t,n);else yield n.replaceText(a,"const"),yield n.insertTextBefore(o,"= "),yield n.insertTextAfter(o,";");for(let e of o.body)yield function*(e,t,r){let{sourceCode:n}=t,o=n.getFirstToken(e);tV(o,{expected:{type:"Keyword",value:"static"},ruleId:"no-static-only-class"}),yield r.remove(o),yield aj(o,t,r);let a=l1(e)?n.getLastToken(e):n.getTokenAfter(e),i=eb(a);if(l1(e)){let{key:t,value:o}=e;if(o){let e=n.getTokenAfter(t,l0);yield r.replaceText(e,":")}else i?yield r.insertTextBefore(a,": undefined"):yield r.insertTextAfter(e,": undefined")}yield i?r.replaceText(a,","):r.insertTextAfter(e,",")}(e,t,n)}}(t,e)}})},meta:{type:"suggestion",docs:{description:"Disallow classes that only have static members.",recommended:"unopinionated"},fixable:"code",messages:{[lZ]:"Use an object instead of a class with only static members."},languages:["js/js"]}},"unicorn/no-unreadable-array-destructuring":l8,"unicorn/no-useless-spread":{create:e=>{let{sourceCode:t}=e;e.on(["ArrayExpression","ObjectExpression"],r=>{if(!("SpreadElement"===r.parent.type&&r.parent.argument===r&&("ObjectExpression"===r.type&&"ObjectExpression"===r.parent.parent.type&&r.parent.parent.properties.includes(r.parent)||"ArrayExpression"===r.type&&("ArrayExpression"===r.parent.parent.type&&r.parent.parent.elements.includes(r.parent)||td(r.parent.parent,void 0,tc)&&r.parent.parent.arguments.includes(r.parent)))))return;let n=r.parent,o=t.getFirstToken(n),a=n.parent.type,i={node:o,messageId:l6,data:{argumentType:"ArrayExpression"===r.type?"array":"object",parentDescription:us[a]}};return"NewExpression"===a&&ui(r)&&tm(n.parent,{names:un,argumentsLength:1,allowSpreadElement:!0})?i:{...i,*fix(i){let s;yield i.remove(o),yield aS(r,i,e);let l=t.getFirstToken(r);yield i.remove(l);let[u,p]=t.getLastTokens(r,2);if(yield i.remove(p),ex(u)&&(yield i.remove(u)),ty(r)||th(r)){let e=t.getTokenAfter(n);ex(e)&&(yield i.remove(e))}if("CallExpression"===a||"NewExpression"===a)for(let[e,n]of(s=t.getFirstToken(r),r.elements.map((e,n,o)=>{if(n===o.length-1){let e=t.getLastToken(r,{skip:1});return ex(e)?e:void 0}let a=t.getTokenAfter(e||s,ex);return s=a,a})).entries())null===r.elements[e]&&(yield i.insertTextBefore(n,"undefined"))}}}),e.on("ObjectExpression",r=>{if(!("ObjectExpression"===r.type&&r.properties.length>0&&r.properties.every(e=>"SpreadElement"===e.type&&"ObjectExpression"!==e.argument.type)))return;let n=r.parent;if(!tA(n,{object:"Object",method:"assign",minimumArguments:2,optionalMember:!1,optionalCall:!1}))return;let o=n.arguments.indexOf(r),a=n.arguments.slice(0,o).some(e=>"SpreadElement"!==e.type);if(o<=0||!a)return;let i={node:t.getFirstToken(r.properties[0]),messageId:ue};return t.getCommentsInside(r).length>0?i:{...i,suggest:[{messageId:ur,fix:t=>t.replaceText(r,r.properties.map(t=>e5(t.argument,e)).join(", "))}]}}),e.on("NewExpression",e=>{if(tm(e,{names:un,argumentsLength:1,allowSpreadElement:!0})&&"SpreadElement"===e.arguments[0].type&&"ArrayExpression"!==e.arguments[0].argument.type)return{node:e.arguments[0],messageId:l7,data:{constructorName:`new ${e.callee.name}(…)`}}}),e.on("ArrayExpression",t=>{if(!ui(t))return;let{parent:r}=t;if(!("ForOfStatement"===r.type&&r.right===t||"YieldExpression"===r.type&&r.delegate&&r.argument===t||(tm(r,{names:un,argumentsLength:1})||tm(r,{names:rQ,minimumArguments:1})||tA(r,{object:"Promise",methods:["all","allSettled","any","race"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||tA(r,{objects:["Array",...rQ],method:"from",argumentsLength:1,optionalCall:!1,optionalMember:!1})||tA(r,{object:"Object",method:"fromEntries",argumentsLength:1,optionalCall:!1,optionalMember:!1}))&&r.arguments[0]===t))return;let n="",o=l9;switch(r.type){case"ForOfStatement":o=l5;break;case"YieldExpression":o=l4;break;case"NewExpression":n=`new ${r.callee.name}(…)`;break;case"CallExpression":n=`${r.callee.object.name}.${r.callee.property.name}(…)`}return{node:t,messageId:o,data:{parentDescription:n},fix:r=>ul(r,t,e)}}),e.on("ArrayExpression",t=>{if(!ui(t))return;let r=t.elements[0].argument,n=!!tA(r,{methods:ua,optionalCall:!1,optionalMember:!1})&&nb(r.callee.object,e)&&nb(r,e);if(!n&&!(!nE(r,e)&&(tA(r,{methods:uo,optionalCall:!1,optionalMember:!1})?!uu(r,e):tA(r,{method:"concat",optionalCall:!1,optionalMember:!1})?!("Identifier"===r.callee.object.type&&"Iterator"===r.callee.object.name||uu(r,e)):tA(r,{method:"split",optionalCall:!1,optionalMember:!1})||tA(r,{object:"Object",methods:["keys","values"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||"AwaitExpression"===r.type&&tA(r.argument,{object:"Promise",methods:["all","allSettled"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||tA(r,{object:"Array",methods:["from","of"],optionalCall:!1,optionalMember:!1})||tm(r,{name:"Array"}))))return;let o={node:t,messageId:ut};return tm(r,{name:"Array"})||tA(r,{method:"slice",optionalCall:!1,optionalMember:!1})&&!n?o:Object.assign(o,{fix:r=>ul(r,t,e)})})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary spread.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[l6]:"Spread an {{argumentType}} literal in {{parentDescription}} is unnecessary.",[l9]:"`{{parentDescription}}` accepts an iterable as an argument, it's unnecessary to convert to an array.",[l5]:"`for…of` can iterate over an iterable, it's unnecessary to convert to an array.",[l4]:"`yield*` can delegate to an iterable, it's unnecessary to convert to an array.",[l7]:"`{{constructorName}}` accepts a single iterable argument, spreading is misleading.",[ue]:"`Object.assign(…)` source object with only spread properties is unnecessary.",[ut]:"Unnecessarily cloning an array.",[ur]:"Remove the object literal wrapper."},languages:["js/js"]}},"unicorn/no-useless-switch-case":{create:e=>{let t=r_(e.physicalFilename);e.on("SwitchStatement",function*(r){let{cases:n}=r;if(!(n.length<2)&&null===n.at(-1).test)for(let r=n.length-2;r>=0;r--){let o=n[r];if(!ud(o))break;t&&um(o)||(yield{node:o,loc:function(e,t){let{sourceCode:r}=t,n=e.test||r.getFirstToken(e),o=r.getTokenAfter(n,eE);return{start:r.getLoc(e).start,end:r.getLoc(o).end}}(o,e),messageId:up,suggest:[{messageId:uc,fix:e=>e.remove(o)}]})}})},meta:{type:"suggestion",docs:{description:"Disallow useless case in switch statements.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[up]:"Useless case in switch statement.",[uc]:"Remove this case."},languages:["js/js"]}},"unicorn/no-useless-undefined":uR,"unicorn/numeric-separators-style":u$,"unicorn/prefer-array-find":u8,"unicorn/prefer-array-flat-map":{create:e=>{e.on("CallExpression",t=>{if(!(tA(t,{method:"flat",optionalCall:!1,optionalMember:!1})&&(0===t.arguments.length||1===t.arguments.length&&"Literal"===t.arguments[0].type&&"1"===t.arguments[0].raw)&&tA(t.callee.object,{method:"map",optionalCall:!1})))return;let r=t.callee.object;if(tF(r.callee.object,u4)||nC(r.callee.object,e))return;let{sourceCode:n}=e,o=r.callee.property,a=rP(e,t,[r])||t.typeArguments||t.typeParameters||r.typeArguments||r.typeParameters?void 0:function*(r){yield a$(r,t,e),yield r.replaceText(o,"flatMap")};return{node:t,loc:{start:n.getLoc(o).start,end:n.getLoc(t).end},messageId:u6,fix:a}}),e.on("CallExpression",t=>{let r;if(!tA(t,{method:"flatMap",argumentsLength:1,optionalCall:!1,optionalMember:!1,computed:!1})||t.typeArguments||t.typeParameters)return;let n=t.callee.object;if(!tA(n,{method:"filter",argumentsLength:1,optionalCall:!1,optionalMember:!1,computed:!1})||n.typeArguments||n.typeParameters||rX(n.callee.object)||nE(n.callee.object,e))return;let{sourceCode:o}=e;if(o.getCommentsInside(t).length>0)return;let[a]=n.arguments,[i]=t.arguments;if(!pe(a)||!pe(i)||!("ArrayExpression"===(r=i.body).type&&r.elements.length>1))return;let[s]=a.params,[l]=i.params;if(!od(s,l))return;let u=function(e,t){if(e4(e,t))return e5(e,t);let r=t.sourceCode.getText(e);return oQ(e,t)?`(${r})`:r}(n.callee.object,e),p=o.getText(s),c=function(e,t){if(e4(e,t))return e5(e,t);let r=t.sourceCode.getText(e);return u7.has(e.type)?`(${r})`:r}(a.body,e),d=o.getText(i.body);return{node:t.callee.property,messageId:u9,suggest:[{messageId:u5,fix:e=>e.replaceText(t,`${u}.flatMap(${p} => ${c} ? ${d} : [])`)}]}})},meta:{type:"suggestion",docs:{description:"Prefer `.flatMap(…)` over `.map(…).flat()` and `.filter(…).flatMap(…)`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[u6]:"Prefer `.flatMap(…)` over `.map(…).flat()`.",[u9]:"Prefer a single `.flatMap(…)` over `.filter(…).flatMap(…)`.",[u5]:"Replace `.filter(…).flatMap(…)` with a single `.flatMap(…)`."},languages:["js/js"]}},"unicorn/prefer-array-flat":pu,"unicorn/prefer-array-some":pm,"unicorn/prefer-code-point":{create:e=>{e.on("CallExpression",e=>{if(tA(e,{method:"charCodeAt",optionalCall:!1}))return pf(e.callee.property,"codePointAt",!(e=>{let t=(e=>{let t=e;for(;;){let{parent:e}=t;if("ChainExpression"===e.type||"LogicalExpression"===e.type||"ConditionalExpression"===e.type&&(e.consequent===t||e.alternate===t)){t=e;continue}return t}})(e),{parent:r}=t;switch(r.type){case"BinaryExpression":return pg.has(r.operator);case"UnaryExpression":return py.has(r.operator);case"AssignmentExpression":return r.right===t&&pg.has(r.operator.slice(0,-1));default:return!1}})(e))}),e.on("MemberExpression",e=>{if(tS(e,{object:"String",property:"fromCharCode",optional:!1}))return pf(e.property,"fromCodePoint")})},meta:{type:"suggestion",docs:{description:"Prefer `String#codePointAt(…)` over `String#charCodeAt(…)` and `String.fromCodePoint(…)` over `String.fromCharCode(…)`.",recommended:"unopinionated"},hasSuggestions:!0,messages:{"error/charCodeAt":"Prefer `String#codePointAt()` over `String#charCodeAt()`.","error/fromCharCode":"Prefer `String.fromCodePoint()` over `String.fromCharCode()`.","suggestion/codePointAt":"Use `String#codePointAt()`.","suggestion/fromCodePoint":"Use `String.fromCodePoint()`."},languages:["js/js"]}},"unicorn/prefer-default-parameters":{create:e=>{let{sourceCode:t}=e,r=[],n=(e,n,o,a)=>{let i,s=r.at(-1);if(!s||!n||!o||"Identifier"!==n.type||"LogicalExpression"!==o.type||"||"!==o.operator&&"??"!==o.operator||"Identifier"!==o.left.type||"Literal"!==o.right.type)return;let{name:l}=n,{left:{name:u},right:{raw:p}}=o;if(a&&l!==u)return;let c=eg(t.getScope(e),u);if(!c)return;let{references:d}=c,{params:m}=s,f=m.find(e=>"Identifier"===e.type&&e.name===u);if(((e,t,r)=>{for(let n of t.body.body){if(n===r)break;if(pE(e,n))return!0}return!1})(t,s,e)||a&&d[0].identifier!==n||!a&&d.length>1||(i=m.at(-1),!f||f!==i))return;let g=((e,t)=>{if("ArrowFunctionExpression"!==t.type||t.params.length>1)return!1;let[r]=t.params,n=e.getTokenBefore(r),o=e.getTokenAfter(r);return!o||!n||"("!==n.value||")"!==o.value})(t,s)?`(${l} = ${p})`:`${l} = ${p}`;return{node:e,messageId:ph,suggest:[{messageId:px,fix:r=>[r.replaceText(f,g),((e,t,r)=>{let{line:n}=t.getLoc(r).start,{column:o}=t.getLoc(r).end,a=t.getText(r),i=t.lines[n-1];if(i.trim()===a)return e.removeRange([t.getIndexFromLoc({line:n,column:0}),t.getIndexFromLoc({line:n+1,column:0})]);if(" "===i[o]){let[n,o]=t.getRange(r);return e.removeRange([n,o+1])}return e.remove(r)})(r,t,e)]}]}};e.on(tb,e=>{r.push(e)}),e.onExit(tb,()=>{r.pop()}),e.on("AssignmentExpression",e=>{if("ExpressionStatement"===e.parent.type&&e.parent.expression===e)return n(e.parent,e.left,e.right,!0)}),e.on("VariableDeclarator",e=>{if("VariableDeclaration"===e.parent.type&&e.parent.declarations[0]===e)return n(e.parent,e.id,e.init,!1)})},meta:{type:"suggestion",docs:{description:"Prefer default parameters over reassignment.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[ph]:"Prefer default parameters over reassignment.",[px]:"Replace reassignment with default parameter."},languages:["js/js"]}},"unicorn/prefer-logical-operator-over-ternary":{create:e=>{let{sourceCode:t}=e;e.on("ConditionalExpression",r=>{let{test:n,consequent:o,alternate:a}=r,i=function(e,t){let{test:r,consequent:n,alternate:o}=e,a=function(e,t){let r=pj(e);if(r?.kind==="nullish")return r;if("LogicalExpression"!==e.type)return;let n=pj(e.left),o=pj(e.right);if(n&&o&&pw(n.reference,o.reference,t)){if("||"===e.operator&&n.isTrueWhenNullish&&o.isTrueWhenNullish&&pF(n,o))return{reference:n.reference,isTrueWhenNullish:!0};if("&&"===e.operator&&!n.isTrueWhenNullish&&!o.isTrueWhenNullish&&pF(n,o))return{reference:n.reference,isTrueWhenNullish:!1}}}(r,t.sourceCode);if(!a||t.sourceCode.getCommentsInside(e).length>0)return;let{reference:i}=a;if(a.isTrueWhenNullish&&pw(i,o,t.sourceCode))return pk({context:t,conditionalExpression:e,left:o,right:n,operators:["??"]});if(!a.isTrueWhenNullish&&pw(i,n,t.sourceCode))return pk({context:t,conditionalExpression:e,left:n,right:o,operators:["??"]});let s=a.isTrueWhenNullish?n:o,l=a.isTrueWhenNullish?o:n;if(!tR(s)||!tS(l)||l.optional||!rv(rI(i),rI(l.object))||function(e){let t=e,{parent:r}=t;for(;rk(r)&&r.expression===t;)r=(t=r).parent;return"UnaryExpression"===r.type&&"delete"===r.operator&&r.argument===t||"CallExpression"===r.type&&r.callee===t||"TaggedTemplateExpression"===r.type&&r.tag===t}(e))return;let u=function(e,t){let{sourceCode:r}=t,n=rq(e,t);if(rN(t,n))return;let[o,a]=r.getRange(e),[i,s]=n;return r.text.slice(o,i)+(e.computed?"?.[":"?.")+r.text.slice(s,a)}(l,t);if(u)return{node:e,messageId:pC,suggest:[{messageId:pS,fix(r){let n=u;return oC(t.sourceCode.getTokenBefore(e),t,n)&&(n=`;${n}`),r.replaceText(e,n)}}]}}(r,e);return i||(pw(n,o,t)?pk({context:e,conditionalExpression:r,left:n,right:a}):"UnaryExpression"===n.type&&"!"===n.operator&&n.prefix&&pw(n.argument,a,t)?pk({context:e,conditionalExpression:r,left:n.argument,right:o}):void 0)})},meta:{type:"suggestion",docs:{description:"Prefer using a logical operator over a ternary.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[pv]:"Prefer using a logical operator over a ternary.",[pC]:"Prefer using optional chaining over a ternary.",[pD]:"Switch to `{{operator}}` operator.",[pS]:"Switch to optional chaining."},languages:["js/js"]}},"unicorn/prefer-optional-catch-binding":{create:e=>{e.on("CatchClause",t=>{let r=t.param;if(!r)return;let{sourceCode:n}=e;if(n.getDeclaredVariables(r.parent).some(e=>e.references.length>0))return;let{type:o,name:a,parent:i}=r,s=n.getCommentsInside(r).length>0;return{node:r,messageId:"Identifier"===o?pB:pR,data:{name:a},fix:s?void 0:function*(e){let t=n.getTokenBefore(r);tV(t,{test:ev,expected:"(",ruleId:"prefer-optional-catch-binding"});let o=n.getTokenAfter(r);tV(o,{test:eC,expected:")",ruleId:"prefer-optional-catch-binding"}),yield e.remove(t),yield e.remove(r),yield e.remove(o);let[,a]=n.getRange(o),[s]=n.getRange(i.body),l=n.text.slice(a,s),u=l.length-l.trimStart().length;0!==u&&(yield e.removeRange([a,a+u]))}}})},meta:{type:"suggestion",docs:{description:"Prefer omitting the `catch` binding parameter.",recommended:"unopinionated"},fixable:"code",messages:{[pB]:"Remove unused catch binding `{{name}}`.",[pR]:"Remove unused catch binding."},languages:["js/js"]}},"unicorn/prefer-regexp-test":p7,"unicorn/prefer-set-has":cm,"unicorn/prefer-string-raw":{create:e=>{e.on("Literal",t=>{if(!te(t)||function(e){let{parent:t}=e,{type:r}=t;return tf(t)||["Property","PropertyDefinition","MethodDefinition","AccessorProperty"].includes(r)&&!t.computed&&t.key===e||["TSAbstractPropertyDefinition","TSAbstractMethodDefinition","TSAbstractAccessorProperty","TSPropertySignature"].includes(r)&&t.key===e||["ImportDeclaration","ExportNamedDeclaration","ExportAllDeclaration"].includes(r)&&t.source===e||"ImportAttribute"===r&&(t.key===e||t.value===e)||"ImportSpecifier"===r&&t.imported===e||"ExportSpecifier"===r&&(t.local===e||t.exported===e)||"ExportAllDeclaration"===r&&t.exported===e||"JSXAttribute"===r&&t.value===e||"TSEnumMember"===r&&(t.initializer===e||t.id===e)||"TSModuleDeclaration"===r&&t.id===e||"TSExternalModuleReference"===r&&t.expression===e||"TSLiteralType"===r&&t.literal===e||"TSImportType"===r&&t.source===e}(t)||cf(t))return;let{sourceCode:r}=e,{raw:n}=t;if("\\"===n.at(-2)||!n.includes("\\\\")||n.includes("`")||n.includes("${")||r.getLoc(t).start.line!==r.getLoc(t).end.line)return;let o=ch(n.slice(1,-1),n.charAt(0));if(o===t.value)return{node:t,messageId:cg,*fix(r){yield aR(r,t,e),yield r.replaceText(t,`String.raw\`${o}\``)}}}),e.on("TemplateLiteral",t=>{if(!("TaggedTemplateExpression"===t.parent.type&&t.parent.quasi===t||t.quasis.every(({value:{cooked:e,raw:t}})=>e===t)||t.quasis.some(({value:{cooked:e,raw:t}})=>"\\"===e.at(-1)||ch(t)!==e)||cf(t)))return{node:t,messageId:cg,*fix(r){for(let n of(yield aR(r,t,e),yield r.insertTextBefore(t,"String.raw"),t.quasis)){let{cooked:t,raw:o}=n.value;t!==o&&(yield aq(n,t,e,r))}}}}),e.on("TaggedTemplateExpression",t=>{let{quasi:r,tag:n,parent:o}=t,{sourceCode:a}=e;if(!tS(n,{object:"String",property:"raw",optional:!1})||!a.isGlobalReference(n.object)||r.quasis.some(e=>e.value.raw.includes("\\")))return;let i=a.getText(r),s=r.expressions.length>0||/\r?\n/.test(i)?i:`'${i.slice(1,-1).replaceAll("'",()=>String.raw`\'`)}'`;return{node:n,messageId:cy,*fix(r){let n=a.getTokenBefore(t);oC(n,e,s)&&(yield r.insertTextBefore(t,";")),"ReturnStatement"!==o.type&&"ThrowStatement"!==o.type||ou(n,t.quasi,e)||e4(t,e)||(yield aI(r,o,e)),"YieldExpression"!==o.type||o.delegate||o.argument!==t||ou(n,t.quasi,e)||e4(t,e)||(yield r.insertTextBefore(t,"("),yield r.insertTextAfter(t,")")),yield r.replaceText(t.quasi,s),yield aS(t.tag,r,e),yield r.remove(t.tag)}}})},meta:{type:"suggestion",docs:{description:"Prefer using the `String.raw` tag to avoid escaping `\\`.",recommended:"unopinionated"},fixable:"code",messages:{[cg]:"`String.raw` should be used to avoid escaping `\\`.",[cy]:"Using `String.raw` is unnecessary as the string does not contain any `\\`."},languages:["js/js"]}},"unicorn/prefer-switch":cS,"unicorn/require-number-to-fixed-digits-argument":{create:e=>{e.on("CallExpression",t=>{if(!tA(t,{method:"toFixed",argumentsLength:0,optionalCall:!1})||"NewExpression"===t.callee.object.type)return;let{sourceCode:r}=e,[n,o]=r.getLastTokens(t,2);return{loc:{start:r.getLoc(n).start,end:r.getLoc(o).end},messageId:cT,fix:r=>aT(r,t,"0",e)}})},meta:{type:"suggestion",docs:{description:"Enforce using the digits argument with `Number#toFixed()`.",recommended:"unopinionated"},fixable:"code",messages:{[cT]:"Missing the digits argument."},languages:["js/js"]}},"unicorn/template-indent":{create:e=>{let{sourceCode:t}=e,r={...e.options[0]},n=(e=>{let t=new i,r=[e.ast];for(;r.length>0;){let n=r.pop();if(n){if("TemplateLiteral"===n.type){let{start:{line:r},end:{line:o}}=e.getLoc(n);for(let e=r+1;e<=o;e++)t.add(e)}for(let t of e.visitorKeys[n.type]??[]){let e=n[t];Array.isArray(e)?r.push(...e):r.push(e)}}}return t})(t);r.comments=r.comments.map(e=>e.toLowerCase());let o=new l,a=a=>{let i;if("TemplateLiteral"!==a.type||o.has(a))return;o.add(a);let s="__PLACEHOLDER__"+Math.random(),l=a.quasis.map(e=>t.getText(e).slice(1,e.tail?-1:-2)).join(s),u=l.match(/\r?\n/);if(!u)return;let p=u[0],c=t.getLoc(a),d=t.lines[c.start.line-1].match(/^(\s*)\S/),m=d?d[1]:"";i="string"==typeof r.indent?r.indent:"number"==typeof r.indent?" ".repeat(r.indent):((e,t,r,n)=>{if(""===r){let r;return cj(cB(e.lines,t)).indent||cj(cA(r=cB(n.split(/\r?\n/)))).indent||cj(r).indent||" "}return r.startsWith(" ")?" ":" "})(t,n,m,l);let f=cA(l).replaceAll(RegExp(`^${p}|${p}[ ]*$`,"g"),""),g=p+function(e,t=1,r={}){let{indent:n=" ",includeEmptyLines:o=!1}=r;if("string"!=typeof e)throw TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof e}\``);if("number"!=typeof t)throw TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof t}\``);if(t<0)throw RangeError(`Expected \`count\` to be at least 0, got \`${t}\``);if("string"!=typeof n)throw TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof n}\``);return 0===t?e:e.replace(o?/^/gm:/^(?!\s*$)/gm,n.repeat(t))}(f,1,{indent:m+i})+p+m;if(g!==l)return{node:a,messageId:cF,fix:t=>g.split(s).map((r,n)=>aq(a.quasis[n],r,e,t))}};e.on("TemplateLiteral",e=>{if((e=>{if(r.comments.length>0){let n=t.getTokenBefore(e,{includeComments:!0});if(n?.type==="Block"&&r.comments.includes(n.value.trim().toLowerCase()))return!0}return!!(cf(e)||r.tags.length>0&&tB(e,r.tags))||!!(r.functions.length>0&&"CallExpression"===e.parent.type&&e.parent.arguments.includes(e)&&tF(e.parent.callee,r.functions))})(e))return a(e)}),e.on(r.selectors,e=>a(e))},meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation.",recommended:!0},fixable:"code",schema:cR,defaultOptions:[{tags:["outdent","dedent","gql","sql","html","styled"],functions:["dedent","stripIndent"],selectors:[],comments:["HTML","indent"]}],messages:{[cF]:"Templates should be properly indented."},languages:["js/js"]}},"unicorn/no-single-promise-in-promise-methods":{create:e=>{e.on("CallExpression",t=>{if(!(tA(t,{object:"Promise",methods:lX,optionalMember:!1,optionalCall:!1,argumentsLength:1})&&"ArrayExpression"===t.arguments[0].type&&1===t.arguments[0].elements.length&&t.arguments[0].elements[0]&&"SpreadElement"!==t.arguments[0].elements[0].type))return;let r=t.callee.property.name,n={node:t.arguments[0],messageId:lK,data:{method:r}},{sourceCode:o}=e;if("AwaitExpression"===t.parent.type&&t.parent.argument===t&&("all"!==r||tx(t.parent.parent)))return n.fix=r=>r.replaceText(t,lY(t,e)),n;return"all"===r?(n.fix=((e,t)=>{let{sourceCode:r}=t;if(lH(r,e))return;let n=e.parent;if("AwaitExpression"!==n.type||n.argument!==e)return;let o=(e=>{let{parent:t}=e;return"VariableDeclarator"===t.type&&t.init===e&&lQ(t.id)?t.id:"AssignmentExpression"===t.type&&t.right===e&&lQ(t.left)&&tx(t.parent)?t.left:void 0})(n);if(o){if(lH(r,o))return;return function*(n){yield n.replaceText(o,r.getText(o.elements[0])),yield n.replaceText(e,lY(e,t))}}let a=n.parent;if("MemberExpression"===a.type&&a.computed&&e7(a.property,0)&&a.object===n&&("VariableDeclarator"===a.parent.type&&a.parent.init===a||"AssignmentExpression"===a.parent.type&&a.parent.right===a)&&!lH(r,a))return r=>r.replaceText(a,`await ${lY(e,t)}`)})(t,e),n):(n.suggest=[{messageId:lG,fix:r=>{let[n]=t.arguments[0].elements,o=e5(n,e);return e4(n,e)||"Identifier"===n.type||"MemberExpression"===n.type||(o=`(${o})`),oC(e.sourceCode.getTokenBefore(t),e,o)&&(o=`;${o}`),r.replaceText(t,o)}},{messageId:lJ,fix:function*(e){let r=t.callee.property;yield e.replaceText(r,"resolve");let[n]=t.arguments,a=o.getFirstToken(n),[i,s]=o.getLastTokens(n,2);yield e.remove(a),yield e.remove(s),ex(i)&&(yield e.remove(i))}}],n)})},meta:{type:"suggestion",docs:{description:"Disallow passing single-element arrays to `Promise` methods.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[lK]:"Wrapping single-element array with `Promise.{{method}}()` is unnecessary.",[lG]:"Use the value directly.",[lJ]:"Switch to `Promise.resolve(…)`."},languages:["js/js"]}},"unicorn/no-await-in-promise-methods":{create:e=>{e.on("CallExpression",function*(t){if(tA(t,{object:"Promise",methods:cN,optionalMember:!1,optionalCall:!1,argumentsLength:1})&&"ArrayExpression"===t.arguments[0].type)for(let r of t.arguments[0].elements)r?.type==="AwaitExpression"&&(yield{node:r,messageId:cP,data:{method:t.callee.property.name},suggest:[{messageId:cL,*fix(t){let n=e.sourceCode.getFirstToken(r);yield t.remove(n),yield aj(n,e,t)}}]})})},meta:{type:"suggestion",docs:{description:"Disallow using `await` in `Promise` method parameters.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[cP]:"Promise in `Promise.{{method}}()` should not be awaited.",[cL]:"Remove `await`."},languages:["js/js"]}},"unicorn/no-negation-in-equality-check":{create:e=>{e.on("BinaryExpression",t=>{let{operator:r,left:n}=t;if(!("BinaryExpression"===t.type&&cO.has(t.operator)&&cU(n))||cU(n.argument))return;let{sourceCode:o}=e,a=o.getFirstToken(n),i=`${r.startsWith("!")?"=":"!"}${r.slice(1)}`;return{node:a,messageId:c$,suggest:[{messageId:cM,data:{operator:i},*fix(s){yield aR(s,t,e);let l=o.getTokenAfter(a),{parent:u}=t;("ReturnStatement"===u.type||"ThrowStatement"===u.type)&&!e4(t,e)&&(ou(o.getFirstToken(u),l,e)||(yield aI(s,u,e))),yield s.remove(a),oC(o.getTokenBefore(a),e,l.value)&&(yield s.insertTextAfter(a,";"));let p=o.getTokenAfter(n,e=>"Punctuator"===e.type&&e.value===r);yield s.replaceText(p,i)}}]}})},meta:{type:"problem",docs:{description:"Disallow negated expression in equality check.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[c$]:"Negated expression is not allowed in equality check.",[cM]:"Switch to '{{operator}}' check."},languages:["js/js"]}},"unicorn/no-unnecessary-slice-end":{create(e){cq(e,{methods:["slice"],messageId:cV})},meta:{type:"suggestion",docs:{description:"Disallow using `.length` or `Infinity` as the `end` argument of `{Array,String,TypedArray}#slice()`.",recommended:"unopinionated"},fixable:"code",messages:{[cV]:"Passing `{{description}}` as the `end` argument is unnecessary."},languages:["js/js"]}},"unicorn/no-lonely-if":{create:e=>{e.on("IfStatement",t=>{if(da(t)&&("BlockStatement"===t.parent.type&&1===t.parent.body.length&&t.parent.body[0]===t&&da(t.parent.parent)&&t.parent.parent.consequent===t.parent||da(t.parent)&&t.parent.consequent===t))return{node:t,messageId:dn,fix:function(e,t){let{sourceCode:r}=t;return n=>{var o,a;let i=("BlockStatement"===e.parent.type?e.parent:e).parent,s={...i,...di(i,r)},l={...e,...di(e,r)},u=dp(s,r),p=dc(s,t,r),c=du(dl(dp(l,r)),dc(l,t,r)),d=function(e,t,r,n){let o=[...n.getRange(e)];if("BlockStatement"===t.type)return o;let a=n.getLastToken(t);if(eT(a)){let t=n.getTokenAfter(e);t&&oC(a,r,t.value)&&(o[1]=n.getRange(t)[0])}return o}(i,l.consequent,t,r),m={outerConditionGap:s.openingBraceToken?dl(ds(s.closingParenthesisToken,s.openingBraceToken,r)):"",outerLeadingContent:s.openingBraceToken?dl(ds(s.openingBraceToken,l.ifToken,r)):dl(ds(s.closingParenthesisToken,l.ifToken,r)),outerTrailingContent:s.openingBraceToken?dl(ds(l,s.closingBraceToken,r)):""},f=(o=m.outerConditionGap,a=m.outerLeadingContent,o.trimStart().startsWith("//")?{leadingStatementText:dl(a).trimStart(),conditionSuffixText:o}:{leadingStatementText:dl(du(o,a)).trimStart(),conditionSuffixText:""}),{leadingStatementText:g}=f,y=function({outerIfStatement:e,inner:t,replacementRange:r,sourceCode:n,consequentTextPieces:o,outerConditionGapTextPieces:a}){let{outerTrailingContent:i}=o,{conditionSuffixText:s}=a;if("BlockStatement"===t.consequent.type){let e=ds(t.closingParenthesisToken,t.openingBraceToken,n),r=ds(t.openingBraceToken,t.closingBraceToken,n);return`${s}${e}{${r}${i}}`}let l=ds(t.closingParenthesisToken,t.consequent,n),u=`${s}${l}${((e,t)=>{let[r,n]=t.getRange(e);return t.text.slice(r,n)})(t.consequent,n)}${i}`;return`${u}${((e,t,r)=>{let[,n]=r.getRange(e);if(t[1]===n)return"";let o=r.text.slice(n,t[1]);return""===o.trim()?o.includes("\n")?`;${o}`:";":`;${o}`})(e,r,n)}`}({outerIfStatement:i,inner:l,replacementRange:d,sourceCode:r,consequentTextPieces:m,outerConditionGapTextPieces:f});return n.replaceTextRange(d,`${g}if${u}(${p} && ${c})${y}`)}}(t,e)}})},meta:{type:"suggestion",docs:{description:"Disallow `if` statements as the only statement in `if` blocks without `else`.",recommended:"unopinionated"},fixable:"code",messages:{[dn]:"Unexpected `if` as the only statement in a `if` block without `else`."},languages:["js/js"]}},"unicorn/no-magic-array-flat-depth":{create:e=>{e.on("CallExpression",t=>{if(!tA(t,{method:"flat",argumentsLength:1,optionalCall:!1}))return;let[r]=t.arguments;if(!tn(r)||1===r.value)return;let{sourceCode:n}=e,{openingParenthesisToken:o,closingParenthesisToken:a}=rh(t,e);if(!n.commentsExistBetween(o,a))return{node:r,messageId:dd}})},meta:{type:"suggestion",docs:{description:"Disallow a magic number as the `depth` argument in `Array#flat(…).`",recommended:"unopinionated"},messages:{[dd]:"Magic number as depth is not allowed."},languages:["js/js"]}},"unicorn/no-negated-condition":{create:e=>{e.on(["IfStatement","ConditionalExpression"],t=>{if("IfStatement"===t.type&&(!t.alternate||"IfStatement"===t.alternate.type))return;let{test:r}=t;if("UnaryExpression"===r.type&&"!"===r.operator||"BinaryExpression"===r.type&&("!="===r.operator||"!=="===r.operator))return{node:r,messageId:dm,*fix(n){if(yield function*(e,t,r){let{sourceCode:n}=r,{test:o}=t;if("UnaryExpression"===o.type){let a=n.getFirstToken(o);"IfStatement"===t.type&&(yield aS(o.argument,e,r)),yield e.remove(a);return}let a=n.getTokenAfter(o.left,e=>"Punctuator"===e.type&&e.value===o.operator);yield e.replaceText(a,"="+a.value.slice(1))}(n,t,e),yield function*(e,t,r){let n="IfStatement"===t.type,[o,a]=[t.consequent,t.alternate].map(e=>{let t=e9(e,r),o=r.sourceCode.text.slice(...t);return n&&"BlockStatement"!==e.type&&(o=`{${o}}`),{range:t,text:o}});if(o.text===a.text)return;let{sourceCode:i}=r;yield e.replaceTextRange(i.getRange(o),a.text),yield e.replaceTextRange(i.getRange(a),o.text)}(n,t,e),"ConditionalExpression"!==t.type||"UnaryExpression"!==r.type)return;yield aR(n,t,e);let{sourceCode:o}=e,{parent:a}=t,[i,s]=o.getFirstTokens(r,2);"ReturnStatement"!==a.type&&"ThrowStatement"!==a.type||a.argument!==t||ou(i,s,e)||e4(t,e)||e4(r,e)?oC(o.getTokenBefore(t),e,s.value)&&(yield n.insertTextBefore(t,";")):yield aI(n,a,e)}}})},meta:{type:"suggestion",docs:{description:"Disallow negated conditions.",recommended:"unopinionated"},fixable:"code",messages:{[dm]:"Unexpected negated condition."},languages:["js/js"]}},"unicorn/no-object-as-default-parameter":{create:e=>{e.on("AssignmentPattern",e=>{if(!("ObjectExpression"===e.right.type&&e.right.properties.length>0&&tE(e.parent)&&e.parent.params.includes(e)))return;let{left:t,right:r}=e;return"Identifier"===t.type?{node:t,messageId:df,data:{parameter:t.name}}:{node:r,messageId:dg}})},meta:{type:"problem",docs:{description:"Disallow the use of objects as default parameters.",recommended:"unopinionated"},messages:{[df]:"Do not use an object literal as default for parameter `{{parameter}}`.",[dg]:"Do not use an object literal as default."},languages:["js/js"]}},"unicorn/prefer-negative-index":{create:e=>{e.on("CallExpression",t=>{if("MemberExpression"!==t.callee.type)return;let r=function(e){let{callee:t,arguments:r}=e,n=t.property.name,o=t.object,a=r;if(dh.has(n))return{method:n,target:o,argumentsNodes:a};if("call"!==n&&"apply"!==n||(n=dx(t.object),!dh.has(n)))return;let i="apply"===t.property.name,{supportObjects:s}=dh.get(n),l=t.object.object;if(ty(l)||"slice"===n&&e7(l,"")||"prototype"===dx(l)&&"Identifier"===l.object.type&&s.has(l.object.name)){if([o]=r,i){let[,e]=r;if(!e||"ArrayExpression"!==e.type)return;a=e.elements}else a=r.slice(1);return{method:n,target:o,argumentsNodes:a}}}(t);if(!r)return;let{method:n,target:o,argumentsNodes:a}=r,{argumentsIndexes:i}=dh.get(n),s=i.map(e=>(function e(t,r){let n;if(!t)return;let{type:o,operator:a,left:i,right:s}=t=rI(t);if("BinaryExpression"!==o||"-"!==a||!(tn(n=rI(s))&&n.value>0))return;let l=rI(i);return"MemberExpression"===l.type&&!l.computed&&!l.optional&&"Identifier"===l.property.type&&"length"===l.property.name&&uh(l.object,r)?i:e(i,r)})(a[e],o)).filter(Boolean);if(0!==s.length)return{node:t,messageId:dy,data:{method:n},*fix(t){for(let r of s)yield function(e,t,r){let[n,o]=e9(e,r);return t.removeRange([n,o+r.sourceCode.text.slice(o).match(/\S|$/).index])}(r,t,e)}}})},meta:{type:"suggestion",docs:{description:"Prefer negative index over `.length - index` when possible.",recommended:"unopinionated"},fixable:"code",messages:{[dy]:"Prefer negative index over length minus index for `{{method}}`."},languages:["js/js"]}},"unicorn/prefer-node-protocol":{create:e=>{e.on("Literal",t=>{if(!(["ImportDeclaration","ExportNamedDeclaration","ExportAllDeclaration","ImportExpression","TSImportType"].includes(t.parent.type)&&t.parent.source===t||(tA(t.parent,{object:"process",method:"getBuiltinModule",argumentsLength:1,optionalCall:!1,optionalMember:!1})||tI(t.parent))&&t.parent.arguments[0]===t))return;let{value:r}=t;if(!("string"==typeof r&&!r.startsWith(dC)&&dE(r)&&dE(`${dC}${r}`)))return;let n=e.sourceCode.getRange(t)[0]+1;return{node:t,messageId:dv,data:{moduleName:r},fix:e=>e.insertTextAfterRange([n,n],dC)}})},meta:{type:"suggestion",docs:{description:"Prefer using the `node:` protocol when importing Node.js builtin modules.",recommended:"unopinionated"},fixable:"code",messages:{[dv]:"Prefer `node:{{moduleName}}` over `{{moduleName}}`."},languages:["js/js"]}},"unicorn/consistent-date-clone":{create:e=>{e.on("NewExpression",t=>{if(!tm(t,{name:"Date",argumentsLength:1}))return;let[r]=t.arguments;if(!tA(r,{method:"getTime",argumentsLength:0,optionalCall:!1,optionalMember:!1}))return;let{sourceCode:n}=e;return{node:r,loc:{start:n.getLoc(r.callee.property).start,end:n.getLoc(r).end},messageId:dD,fix:t=>a$(t,r,e)}})},meta:{type:"suggestion",docs:{description:"Prefer passing `Date` directly to the constructor when cloning.",recommended:"unopinionated"},fixable:"code",messages:{[dD]:"Unnecessary `.getTime()` call."},languages:["js/js"]}},"unicorn/no-accessor-recursion":{create:e=>{let{sourceCode:t}=e;e.on("ThisExpression",e=>{let r=((e,t)=>{for(let r=e.getScope(t);r;r=r.upper){if("class"===r.type)return;if("function"===r.type&&"ArrowFunctionExpression"!==r.block.type)return r}})(t,e);if(!r)return;let n=r.block.parent;if(["Property","MethodDefinition"].includes(n?.type)&&!n.computed&&["set","get"].includes(n.kind)&&dT(n.key)&&("get"===n.kind&&(dw(e,n)||"VariableDeclarator"===e.parent.type&&e.parent.init===e&&"ObjectPattern"===e.parent.id.type&&e.parent.id.properties.some(e=>"Property"===e.type&&!e.computed&&dA(e.key,n.key)))||"set"===n.kind&&((e,t)=>{if(!dw(e,t))return!1;let r=e.parent,{parent:n}=r;return("AssignmentExpression"===n.type||"AssignmentPattern"===n.type)&&n.left===r||"UpdateExpression"===n.type&&n.argument===r||"ArrayPattern"===n.type&&n.elements.includes(r)||"RestElement"===n.type&&n.argument===r||("ForOfStatement"===n.type||"ForInStatement"===n.type)&&n.left===r||"Property"===n.type&&n.value===r&&"ObjectPattern"===n.parent.type&&n.parent.properties.includes(r.parent)})(e,n)))return{node:e.parent,messageId:dS,data:{kind:n.kind}}})},meta:{type:"problem",docs:{description:"Disallow recursive access to `this` within getters and setters.",recommended:"unopinionated"},defaultOptions:[],messages:{[dS]:"Disallow recursive access to `this` within {{kind}}ters."},languages:["js/js"]}},"unicorn/prefer-import-meta-properties":{create:function(e){let{sourceCode:t}=e;e.on("MetaProperty",function*(e){if("MetaProperty"!==e.type||"import"!==e.meta.name||"meta"!==e.property.name)return;let r=e.parent;if(!tS(r,{properties:["url","filename"],computed:!1,optional:!1}))return;let n=r.property.name;if("url"===n){if(dF(r.parent,t)&&r.parent.arguments[0]===r)return void(yield a(r.parent,{reportFilenameNode:!0}));if(tm(r.parent,{name:"URL",minimumArguments:1,maximumArguments:2})){var o;let e=r.parent,n=e.parent;if(1===e.arguments.length&&e.arguments[0]===r&&dF(n,t)&&n.arguments[0]===e)return void(yield a(n,{reportFilenameNode:!0}));2===e.arguments.length&&(o=e.arguments[0],o?.type==="Literal"&&("."===o.value||"./"===o.value))&&e.arguments[1]===r&&dF(n,t)&&n.arguments[0]===e&&(yield i(n,"dirname"))}return}function*a(e,{reportFilenameNode:r=!1}={}){let{parent:n}=e;if(dB(n,t)&&n.arguments[0]===e)return void(yield i(n,"dirname"));if(r&&(yield i(e,"filename")),"VariableDeclarator"!==n.type||n.init!==e||"Identifier"!==n.id.type||"VariableDeclaration"!==n.parent.type||"const"!==n.parent.kind)return;let o=eg(t.getScope(n.id),n.id);if(o)for(let e of o.references){if(!e.isReadOnly())continue;let{parent:r}=e.identifier;dB(r,t)&&r.arguments[0]===e.identifier&&(yield i(r,"dirname"))}}function i(e,t){return{node:e,messageId:"dirname"===t?dk:dI,fix:r=>r.replaceText(e,`import.meta.${t}`)}}"filename"===n&&(yield a(r))})},meta:{type:"suggestion",docs:{description:"Prefer `import.meta.{dirname,filename}` over legacy techniques for getting file paths.",recommended:!1},fixable:"code",messages:{[dk]:"Do not construct dirname.",[dI]:"Do not construct filename using `fileURLToPath()`."},languages:["js/js"]}},"unicorn/no-unnecessary-array-flat-depth":{create:e=>{e.on("CallExpression",t=>{if(!(tA(t,{method:"flat",argumentsLength:1,optionalCall:!1})&&e7(t.arguments[0],1)))return;let[r]=t.arguments;return{node:r,messageId:dR,fix:t=>aA(t,r,e)}})},meta:{type:"suggestion",docs:{description:"Disallow using `1` as the `depth` argument of `Array#flat()`.",recommended:"unopinionated"},fixable:"code",messages:{[dR]:"Passing `1` as the `depth` argument is unnecessary."},languages:["js/js"]}},"unicorn/no-unnecessary-array-splice-count":{create(e){cq(e,{methods:["splice","toSpliced"],messageId:dP})},meta:{type:"suggestion",docs:{description:"Disallow using `.length` or `Infinity` as the `deleteCount` or `skipCount` argument of `Array#{splice,toSpliced}()`.",recommended:"unopinionated"},fixable:"code",messages:{[dP]:"Passing `{{description}}` as the `{{argumentName}}` argument is unnecessary."},languages:["js/js"]}},"unicorn/no-useless-error-capture-stack-trace":{create:e=>{let t=[],r=[];e.on(["ClassDeclaration","ClassExpression"],e=>{t.push(e),r.push(e)}),e.onExit(["ClassDeclaration","ClassExpression"],()=>{t.pop(),r.pop()}),e.on(["FunctionDeclaration","FunctionExpression"],e=>{r.push(e)}),e.onExit(["FunctionDeclaration","FunctionExpression"],()=>{r.pop()}),e.on("CallExpression",n=>{let o,a=t.at(-1);if(!(a?.superClass&&"Identifier"===a.superClass.type&&s5.includes(a.superClass.name)&&e.sourceCode.isGlobalReference(a.superClass)&&(o=r.at(-1),o&&"MethodDefinition"===o.parent.type&&"constructor"===o.parent.kind&&o.parent.value===o&&a.body.body.includes(o.parent))&&tA(n,{object:"Error",method:"captureStackTrace",argumentsLength:2,optionalMember:!1})&&e.sourceCode.isGlobalReference(n.callee.object)))return;let[i,s]=n.arguments;if("ThisExpression"!==i.type||!((e,t,r)=>{if("MetaProperty"===e.type&&"Identifier"===e.meta.type&&"new"===e.meta.name&&"Identifier"===e.property.type&&"target"===e.property.name||tS(e,{property:"constructor",computed:!1,optional:!1})&&"ThisExpression"===e.object.type)return!0;if("Identifier"!==e.type||!t.id)return!1;let n=eg(r.sourceCode.getScope(e),e);return n&&1===n.defs.length&&"ClassName"===n.defs[0].type&&n.defs[0].node===t})(s,a,e))return;let l={node:n,messageId:dL},u="ChainExpression"===n.parent.type?n.parent.parent:n.parent;return"ExpressionStatement"===u.type&&"BlockStatement"===u.parent.type&&(l.fix=e=>e.remove(u)),l})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary `Error.captureStackTrace(…)`.",recommended:"unopinionated"},fixable:"code",messages:{[dL]:"Unnecessary `Error.captureStackTrace(…)` call."},languages:["js/js"]}},"unicorn/prefer-class-fields":{create:e=>{let{sourceCode:t}=e;e.on("ClassBody",r=>{let n=r.body.find(e=>"constructor"===e.kind&&!e.computed&&!e.static&&"MethodDefinition"===e.type&&"FunctionExpression"===e.value.type);if(!n)return;let o=n.value.body.body.find(e=>"EmptyStatement"!==e.type);if(!(o?.type==="ExpressionStatement"&&"AssignmentExpression"===o.expression.type&&"="===o.expression.operator&&"MemberExpression"===o.expression.left.type&&"ThisExpression"===o.expression.left.object.type&&!o.expression.left.computed&&["Identifier","PrivateIdentifier"].includes(o.expression.left.property.type)&&"Literal"===o.expression.right.type))return;let a=o.expression.left.property.name,i=o.expression.right.raw,s=o.expression.left.property.type,l=r.body.find(e=>"PropertyDefinition"===e.type&&!e.computed&&!e.static&&e.key.type===s&&e.key.name===a),u={node:o,messageId:dN};function*p(s){if(yield((e,t,r)=>{let{line:n}=t.getLoc(e).start,o=t.getText(e);return t.lines[n-1].trim()===o?r.removeRange([t.getIndexFromLoc({line:n,column:0}),t.getIndexFromLoc({line:n+1,column:0})]):r.remove(e)})(o,t,s),l){if(l.value)return void(yield s.replaceText(l.value,i));let e=` = ${i}`,r=t.getLastToken(l);return eb(r)?void(yield s.insertTextBefore(r,e)):void(yield s.insertTextAfter(l,`${e};`))}let u=t.getLastToken(r),p=rA(n,e),c=`${p}${a} = ${i};
|
|
43
|
+
`,c1=e=>{var t;let r=(t=e.superClass,t?.type==="Identifier"?t.name:t?.type!=="MemberExpression"||t.computed||"Identifier"!==t.property.type?void 0:t.property.name);return!!r&&cZ.test(r)},c2=e=>"ExpressionStatement"===e.type&&"CallExpression"===e.expression.type&&tF(e.expression.callee,"super"),c3=(e,t)=>"ExpressionStatement"===e.type&&"AssignmentExpression"===e.expression.type&&"="===e.expression.operator&&tF(e.expression.left,`this.${t}`),c8=(e,t)=>({node:e,message:`The \`name\` property should be set to \`${t}\`.`}),c6=(e,t)=>tn(e?.value)===t,c9=(e,t)=>"MethodDefinition"===e.type&&e.kind===t&&!e.static&&!e.computed&&"Identifier"===e.key.type&&"message"===e.key.name,c5=e=>e?.type==="Identifier"?e:e?.type==="AssignmentPattern"&&"Identifier"===e.left.type?e.left:void 0,c4=e=>c5(e)?.name==="options",c7=(e,t)=>{if("ThisExpression"===e.type||"Super"===e.type)return!0;for(let r of t[e.type]??[]){let n=e[r];if(n){if(Array.isArray(n)){if(n.some(e=>e&&c7(e,t)))return!0;continue}if(c7(n,t))return!0}}return!1},de=e=>{let t=c5(e);return t.typeAnnotation?t.optional?"options?: ErrorOptions":"options: ErrorOptions":"options"},dt=(e,t,r)=>n=>{let o=t.arguments;if(0===o.length){let o=e.getTokenAfter(t.callee,e=>"("===e.value);return n.insertTextAfter(o,`${r}, options`)}if(1===o.length){let e;return"undefined"!==r&&(!(e=o[0])||tP(e))?n.replaceText(o[0],`${r}, options`):n.insertTextAfter(o[0],", options")}},dr=(e,t)=>e?.type==="Identifier"&&e.name===t.name;function*dn(e,t){if(!c1(t)||null===t.id)return;let{name:r}=t.id,n=an(r).replace(/(?:error)?$/i,"Error");r!==n&&(yield{node:t.id,message:`Invalid class name, use \`${n}\`.`});let{body:o}=t.body,{sourceCode:a}=e,i=o.find(e=>"constructor"===e.kind),s=o.find(e=>"PropertyDefinition"===e.type&&!e.static&&!e.computed&&"Identifier"===e.key.type&&"name"===e.key.name);if(!i){if(c6(s,r))return;let e=a.getRange(t.body);yield{...c8(s?.value??t,r),fix:t=>s?.value?t.replaceText(s.value,`'${r}'`):s?t.replaceText(s,c0(r).trim()):t.insertTextAfterRange([e[0],e[0]+1],c0(r))};return}let l=o.some(e=>c9(e,"get")),u=o.some(e=>c9(e,"set"));yield*function*(e,t,r){let{sourceCode:n}=e,o=t.value.body;if(!o)return;let a=o.body,{hasMessageGetter:i,hasMessageSetter:s,checkOptions:l}=r,u=a.find(e=>c2(e)),p=a.findIndex(e=>c2(e)),c=a.findIndex(e=>c3(e,"message")),d=i||s,m=!1;if(u){let r;if(d&&!(!(r=u.expression.arguments[0])||tP(r)))m=!0,yield{node:u,messageId:cG};else if(i&&!s&&-1!==c)m=!0,yield{node:a[c],messageId:cJ};else if(!s&&-1!==c){let r=a[c];m=!0,yield{node:u,message:"Pass the error message to `super()` instead of setting `this.message`.",*fix(i){let s=r.expression.right,[l,d]=t.value.params,m=c5(l),f=1===t.value.params.length&&m&&!c4(l),g=f||c4(d);if(0===u.expression.arguments.length){if(c!==p+1||c7(s,n.visitorKeys))return;let[t]=n.getRange(u);yield i.insertTextAfterRange([t,t+6],g?`${e4(s,e)}, options`:e4(s,e))}else{let e;if(e=u.expression.arguments[0],n.getText(e)!==n.getText(s))return;g&&1===u.expression.arguments.length&&(yield i.insertTextAfter(u.expression.arguments[0],", options"))}f&&(yield i.insertTextAfter(l,`, ${de(l)}`));let y=0===c?n.getRange(o)[0]:n.getRange(a[c-1])[1],[,h]=n.getRange(r);yield i.removeRange([y,h])}}}}else m=!0,yield{node:o,message:"Missing call to `super()` in constructor."};let f=function(e,t,r){let{name:n,nameProperty:o}=r,a=t.find(e=>c3(e,"name"));return a?tn(a.expression.right)!==n?c8(a.expression.right??e,n):void 0:c6(o,n)?void 0:c8(o?.value??e,n)}(o,a,r);if(f&&(yield f),!f&&l&&!m){let r=((e,t,r,n)=>{let o=t.value.params,a=o[0],i=c5(a);if(0===o.length||!i)return;let s=r.expression;if(c4(a)){if(!c4(s.arguments[1])){let t={node:s,messageId:cQ};return dr(s.arguments[0],i)||(t.fix=dt(e.sourceCode,s,"undefined")),t}return}let l=o[1],u=!n&&"message"===i.name,p=u?i.name:"undefined";if(!l){if(((e,t)=>{if(t)return!1;let[r,n]=e.arguments;return 2===e.arguments.length&&void 0!==tn(r)&&"ObjectExpression"===n.type&&1===n.properties.length&&"cause"===eO(n.properties[0])})(s,u))return;return{node:a,messageId:cX,fix:function*(r){let{sourceCode:n}=e,o=dt(n,s,p)(r);if(!o)return;let a=t.value.params[0];yield r.insertTextAfter(a,`, ${de(a)}`),yield o}}}if(!c4(l))return{node:l,messageId:cY};if(u&&!dr(s.arguments[0],i)){let t;return{node:s,messageId:cH,fix:(t=e.sourceCode,e=>{let r,n=s.arguments;if(0===n.length){let r=t.getTokenAfter(s.callee,e=>"("===e.value);return e.insertTextAfter(r,`${p}, options`)}if(!(r=n[0])||tP(r))return e.replaceText(n[0],1===n.length?`${p}, options`:p)})}}if(!c4(s.arguments[1]))return{node:s,messageId:cQ,fix:dt(e.sourceCode,s,p)}})(e,t,u,d);r&&(yield r)}}(e,i,{name:r,nameProperty:s,hasMessageGetter:l,hasMessageSetter:u,checkOptions:r===n})}let da="no-lonely-if",di=e=>"IfStatement"===e.type&&!e.alternate;function ds(e,t){let r={ifToken:t.getFirstToken(e),openingParenthesisToken:t.getFirstToken(e,1)},{consequent:n}=e;return r.closingParenthesisToken=t.getTokenBefore(n),"BlockStatement"===n.type&&(r.openingBraceToken=t.getFirstToken(n),r.closingBraceToken=t.getLastToken(n)),r}let dl=(e,t,r)=>r.text.slice(r.getRange(e)[1],r.getRange(t)[0]),du=e=>e.trim()?e:"",dp=(e,t)=>/\s$/u.test(e)&&/^\s/u.test(t)?e+t.trimStart():e+t,dc=(e,t)=>dl(e.ifToken,e.openingParenthesisToken,t),dd=(e,t,r)=>{let n,o=dl(e.openingParenthesisToken,e.closingParenthesisToken,r);return e7(e.test,t)?o:"LogicalExpression"===(n=e.test).type&&("||"===n.operator||"??"===n.operator)||"ConditionalExpression"===n.type||"AssignmentExpression"===n.type||"YieldExpression"===n.type||"SequenceExpression"===n.type?`(${o})`:o},dm="no-magic-array-flat-depth",df="no-negated-condition",dg="identifier",dy="non-identifier",dh="prefer-negative-index",dx=new o([["slice",{argumentsIndexes:[0,1],supportObjects:new i(["Array","String","ArrayBuffer",...rZ])}],["subarray",{argumentsIndexes:[0,1],supportObjects:new i(rZ)}],["splice",{argumentsIndexes:[0],supportObjects:new i(["Array"])}],["toSpliced",{argumentsIndexes:[0],supportObjects:new i(["Array"])}],["at",{argumentsIndexes:[0],supportObjects:new i(["Array","String",...rZ])}]]),db=e=>{let{type:t,property:r}=e;if("MemberExpression"===t&&"Identifier"===r.type)return r.name};var dE=["node:assert","assert","node:assert/strict","assert/strict","node:async_hooks","async_hooks","node:buffer","buffer","node:child_process","child_process","node:cluster","cluster","node:console","console","node:constants","constants","node:crypto","crypto","node:dgram","dgram","node:diagnostics_channel","diagnostics_channel","node:dns","dns","node:dns/promises","dns/promises","node:domain","domain","node:events","events","node:ffi","node:fs","fs","node:fs/promises","fs/promises","node:http","http","node:http2","http2","node:https","https","node:inspector","inspector","node:inspector/promises","inspector/promises","node:module","module","node:net","net","node:os","os","node:path","path","node:path/posix","path/posix","node:path/win32","path/win32","node:perf_hooks","perf_hooks","node:process","process","node:querystring","querystring","node:quic","node:readline","readline","node:readline/promises","readline/promises","node:repl","repl","node:sea","node:sqlite","node:stream","stream","node:stream/consumers","stream/consumers","node:stream/iter","stream/iter","node:stream/promises","stream/promises","node:stream/web","stream/web","node:string_decoder","string_decoder","node:test","node:test/reporters","node:timers","timers","node:timers/promises","timers/promises","node:tls","tls","node:trace_events","trace_events","node:tty","tty","node:url","url","node:util","util","node:util/types","util/types","node:v8","v8","node:vm","vm","node:wasi","wasi","node:worker_threads","worker_threads","node:zlib","zlib","node:zlib/iter","zlib/iter"];function dv(t){if("string"!=typeof t)throw TypeError("Expected a string");return(e??=new i(dE)).has(t)}let dC="prefer-node-protocol",dD="node:",dS="consistent-date-clone/error",dT="no-accessor-recursion/error",dA=e=>"Identifier"===e.type||"PrivateIdentifier"===e.type,dw=(e,t)=>["type","name"].every(r=>e[r]===t[r]),dk=(e,t)=>"MemberExpression"===e.parent.type&&e.parent.object===e&&!e.parent.computed&&dA(e.parent.property)&&dw(e.parent.property,t.key),dI="error/calculate-dirname",dj="error/calculate-filename";function dF(e,{modules:t,functionName:r,sourceCode:n}){if(!tm(e,{optional:!1,argumentsLength:1},tp))return!1;let o=new i;return function e(t,i){if("MemberExpression"===t.type)return!!("property"===i&&tT(t,{property:r,computed:!1,optional:!1}))&&e(t.object,"module");if("CallExpression"===t.type)return"module"===i&&tw(t,{object:"process",method:"getBuiltinModule",argumentsLength:1,optionalMember:!1,optionalCall:!1})&&a(t.arguments[0]);if("Identifier"!==t.type||o.has(t))return!1;o.add(t);let s=ey(n.getScope(t),t);return!!s&&1===s.defs.length&&function(t,n){if("ImportBinding"===t.type){if(!a(t.parent.source))return!1;let e=t.node;return"module"===n?e?.type==="ImportDefaultSpecifier"||e?.type==="ImportNamespaceSpecifier":e?.type==="ImportSpecifier"&&e.imported.name===r}return"Variable"===t.type&&function t(n,o){let{parent:a}=n;return"VariableDeclarator"===a.type?!!a.init&&a.id===n&&"VariableDeclaration"===a.parent.type&&"const"===a.parent.kind&&e(a.init,o):"Property"===a.type&&!!("property"===o&&a.value===n&&!a.computed&&"Identifier"===a.key.type&&a.key.name===r)&&t(a.parent,"module")}(t.name,n)}(s.defs[0],i)}(e.callee,"property");function a(e){return e?.type==="Literal"&&t.has(e.value)}}function dB(e,t){return dF(e,{modules:new i(["url","node:url"]),functionName:"fileURLToPath",sourceCode:t})}function dR(e,t){return dF(e,{modules:new i(["path","node:path"]),functionName:"dirname",sourceCode:t})}let dP="no-unnecessary-array-flat-depth",dL="no-unnecessary-array-splice-count",dN="no-useless-error-capture-stack-trace/error",d$="prefer-class-fields/error",dM="prefer-class-fields/suggestion",dO="prefer-bigint-literals/error",dU="prefer-bigint-literals/suggestion",dq="prefer-classlist-toggle/error",dV="prefer-classlist-toggle/suggestion",dW=e=>tT(e,{property:"classList",computed:!1}),d_=(e,t,r)=>{let n={node:r??e,messageId:dq};return"IfStatement"===e.type||tb(e)||tb(e.parent)?n.fix=t:n.suggest=[{messageId:dV,fix:t}],n},dz=(e,t,r)=>{let{sourceCode:n}=t,o=e4(e,t);return r?(!e7(e,n)&&o2(e,"!")&&(o=`(${o})`),o=`!${o}`):(e7(e,n)||"SequenceExpression"!==e.type||(o=`(${o})`),o)},dK=(e,t)=>tw(e,{methods:t,argumentsLength:1,optionalCall:!1,optionalMember:!1})&&dW(e.callee.object),dG=(e,t)=>rC(e.callee.object,t.callee.object)&&rC(e.arguments[0],t.arguments[0]),dJ=(e,t,r)=>t?("ChainExpression"===e.type&&(e=e.expression),dK(e,["contains"])&&dG(e,r))?e:void 0:"UnaryExpression"===e.type&&"!"===e.operator&&e.prefix?dJ(e.argument,!t,r):void 0,dX="require-module-attributes",dY="error",dH="suggestion/array",dQ="suggestion/object",dZ="suggestion/object-assign",d0="suggestion/set",d1="suggestion/map",d2=(e,t,r)=>{let{sourceCode:n}=r,o=rJ(e);return t.some(e=>{let t=n.getRange(e);return o.some(e=>{let[r,o]=n.getRange(e);return r>=t[0]&&o<=t[1]})})};function d3(e,t){if(!tf(e,{names:t,maximumArguments:1}))return!1;let[r]=e.arguments;return!r||"ArrayExpression"===r.type}function*d8(e,t,r){let n=!eE(t.sourceCode.getTokenBefore(e));yield aO(e,t,r,n)}function d6(e,t,r,n){let{sourceCode:o}=e,[a,i]=o.getLastTokens(r,2),s=("ArrayExpression"===r.type?r.elements:r.properties).length>0&&!eb(a);return t.insertTextBefore(i,`${s?",":""} ${n}`)}function*d9({context:e,fixer:t,newExpression:r,elementsText:n,nextExpressionStatement:o}){if(rh(r,e)){let[o]=r.arguments;if(o)yield d6(e,t,o,n);else{let{openingParenthesisToken:o}=rh(r,e)?rx(r,e):{};yield t.insertTextAfter(o,`[${n}]`)}}else yield t.insertTextAfter(r,`([${n}])`);yield*d8(o,e,t)}let d5=[{testValue:e=>e?.type==="ArrayExpression",getProblematicNode({context:e,variable:t,nextExpressionStatement:r}){let n=r.expression;if(tw(n,{object:t.name,methods:["push","unshift"],optionalMember:!1,optionalCall:!1})&&n.arguments.length>0&&!d2(t,n.arguments,e))return n},getProblem(e,t){let{context:r,assignType:n,getFix:o}=t,{sourceCode:a}=r,i=e.callee,s=i.property,l={node:i,messageId:dY,data:{objectType:"array"}},u="unshift"===s.name,p=o(t,{callExpression:e,isPrepend:u});return e.arguments.some(e=>ez(e,a))?l.suggest=[{messageId:dH,fix:p,data:{operation:u?"Prepend":"Append",assignType:n}}]:l.fix=p,l},getFix:({context:e,valueNode:t,nextExpressionStatement:r},{callExpression:n,isPrepend:o})=>function*(a){let i=rb(e,n,!1);yield o?a.insertTextAfter(e.sourceCode.getFirstToken(t),`${i}, `):d6(e,a,t,i),yield d8(r,e,a)}},{testValue:e=>e?.type==="ObjectExpression",getProblematicNode({context:e,variable:t,nextExpressionStatement:r}){let n=r.expression;if(!("AssignmentExpression"===n.type&&"="===n.operator&&tT(n.left,{object:t.name,optional:!1})))return;let o=n.right,a=n.left,{property:i}=a;if(!d2(t,a.computed?[i,o]:[o],e))return n},getProblem(e,t){let{context:r,assignType:n,getFix:o}=t,{sourceCode:a}=r,{left:i,right:s}=e,{property:l}=i,u=a.getTokenAfter(i,t=>"Punctuator"===t.type&&t.value===e.operator),p={node:e,loc:{start:a.getLoc(e).start,end:a.getLoc(u).end},messageId:dY,data:{objectType:"object"}},c=o(t,{assignmentExpression:e,memberExpression:i,property:l,value:s});return i.computed&&ez(l,a)||ez(s,a)?p.suggest=[{messageId:dQ,data:{assignType:n},fix:c}]:p.fix=c,p},getFix:({context:e,valueNode:t,nextExpressionStatement:r},{memberExpression:n,property:o,value:a})=>function*(i){let s=e4(o,e);n.computed&&(s=`[${s}]`);let l=e4(a,e),u=`${s}: ${l},`,[p,c]=e.sourceCode.getLastTokens(t,2),d=t.properties.length>0&&!eb(p);yield i.insertTextBefore(c,`${d?",":""} ${u}`),yield d8(r,e,i)}},{testValue:e=>e?.type==="ObjectExpression",getProblematicNode({context:e,variable:t,nextExpressionStatement:r}){let n=r.expression;if(!tw(n,{object:"Object",method:"assign",minimumArguments:2,optionalMember:!1,optionalCall:!1}))return;let[o,a]=n.arguments;if(!("Identifier"!==o.type||o.name!==t.name||"SpreadElement"===a.type||d2(t,[a],e)))return n},getProblem(e,t){let{context:r,assignType:n,getFix:o}=t,{sourceCode:a}=r,[,i]=e.arguments,s={node:e.callee,messageId:dY,data:{objectType:"object"}},l=o(t,{callExpression:e,firstValue:i});return ez(i,a)?s.suggest=[{messageId:dZ,data:{description:"ObjectExpression"===i.type?"Move properties to":"Spread properties in",assignType:n},fix:l}]:s.fix=l,s},getFix:({context:e,valueNode:t,nextExpressionStatement:r},{callExpression:n,firstValue:o})=>function*(a){let i;("ObjectExpression"===o.type?o.properties.length>0&&(i=function(e,t){let{sourceCode:r}=t,n=r.getFirstToken(e),[o,a]=r.getLastTokens(e,2),[,i]=r.getRange(n),[s]=r.getRange(eb(o)?o:a);return r.text.slice(i,s)}(o,e)):i=`...${e4(o,e)}`,i&&(yield d6(e,a,t,i)),2!==n.arguments.length)?yield aw(a,o,e):yield d8(r,e,a)}},{testValue:e=>d3(e,["Set","WeakSet"]),getProblematicNode({context:e,variable:t,nextExpressionStatement:r}){let n=r.expression;if(("ChainExpression"===n.type&&(n=n.expression),tw(n,{object:t.name,method:"add",argumentsLength:1,optionalMember:!1,optionalCall:!1}))&&!d2(t,n.arguments,e))return n},getProblem(e,t){let{context:r,assignType:n,valueNode:o,getFix:a}=t,{sourceCode:i}=r,s={node:e.callee,messageId:dY,data:{objectType:`\`${o.callee.name}\``}},l=a(t,{callExpression:e,newExpression:o});return e.arguments.some(e=>ez(e,i))?s.suggest=[{messageId:d0,data:{assignType:n},fix:l}]:s.fix=l,s},getFix:({context:e,nextExpressionStatement:t},{callExpression:r,newExpression:n})=>o=>{let a=rb(e,r,!1);return d9({context:e,fixer:o,newExpression:n,elementsText:a,nextExpressionStatement:t})}},{testValue:e=>d3(e,["Map","WeakMap"]),getProblematicNode({context:e,variable:t,nextExpressionStatement:r}){let n=r.expression;if(tw(n,{object:t.name,method:"set",argumentsLength:2,optionalCall:!1})&&!d2(t,n.arguments,e))return n},getProblem(e,t){let{context:r,assignType:n,valueNode:o,getFix:a}=t,{sourceCode:i}=r,s={node:e.callee,messageId:dY,data:{objectType:`\`${o.callee.name}\``}},l=a(t,{callExpression:e,newExpression:o});return e.arguments.some(e=>ez(e,i))?s.suggest=[{messageId:d1,data:{assignType:n},fix:l}]:s.fix=l,s},getFix:({context:e,nextExpressionStatement:t},{callExpression:r,newExpression:n})=>o=>{let a=rb(e,r,!1);return d9({context:e,fixer:o,newExpression:n,elementsText:`[${a}]`,nextExpressionStatement:t})}}],d4="no-useless-collection-argument/error",d7="no-useless-collection-argument/suggestion",me="prefer-response-static-json",mt=/([\p{Ll}\d])(\p{Lu})/gu,mr=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,mn=/(\d)\p{Ll}|(\p{L})\d/u,mo=/[^\p{L}\d]+/giu,ma="$1\0$2";function mi(e){let t=e.trim();t=(t=t.replace(mt,ma).replace(mr,ma)).replace(mo,"\0");let r=0,n=t.length;for(;"\0"===t.charAt(r);)r++;if(r===n)return[];for(;"\0"===t.charAt(n-1);)n--;return t.slice(r,n).split(/\0/g)}function ms(e){let t=mi(e);for(let e=0;e<t.length;e++){let r=t[e],n=mn.exec(r);if(n){let o=n.index+(n[1]??n[2]).length;t.splice(e,1,r.slice(0,o),r.slice(o))}}return t}function ml(e,t){let[r,n,o]=mf(e,t);return r+n.map(mc(t?.locale)).join(t?.delimiter??" ")+o}function mu(e,t){var r,n;let[o,a,i]=mf(e,t),s=mc(t?.locale),l=md(t?.locale),u=t?.mergeAmbiguousCharacters?(r=s,n=l,e=>`${n(e[0])}${r(e.slice(1))}`):mm(s,l);return o+a.map((e,t)=>0===t?s(e):u(e,t)).join(t?.delimiter??"")+i}function mp(e,t){let[r,n,o]=mf(e,t),a=mm(mc(t?.locale),md(t?.locale));return r+n.map(a).join("")+o}function mc(e){return!1===e?e=>e.toLowerCase():t=>t.toLocaleLowerCase(e)}function md(e){return!1===e?e=>e.toUpperCase():t=>t.toLocaleUpperCase(e)}function mm(e,t){return(r,n)=>{let o=r[0];return(n>0&&o>="0"&&o<="9"?"_"+o:t(o))+e(r.slice(1))}}function mf(e,t={}){let r=t.split??(t.separateNumbers?ms:mi),n=t.prefixCharacters??"",o=t.suffixCharacters??"",a=0,i=e.length;for(;a<e.length;){let t=e.charAt(a);if(!n.includes(t))break;a++}for(;i>a;){let t=i-1,r=e.charAt(t);if(!o.includes(r))break;i=t}return[e.slice(0,a),r(e.slice(a,i)),e.slice(i)]}let mg="filename-case",my="directory-case",mh="filename-extension",mx=e=>!/^[\w-]$/.test(e),mb=new i(["index.js","index.mjs","index.cjs","index.ts","index.tsx","index.vue"]),mE=new Intl.ListFormat("en-US",{type:"disjunction"}),mv=/^[\da-z]+$/i,mC=/^[A-Z]{3,}(?=\d*[A-Z](?:[a-z]|\d+[a-z]))/,mD=e=>e>="0"&&e<="9",mS=e=>e>="a"&&e<="z",mT=e=>e>="A"&&e<="Z",mA={camelCase:{fn:mu,name:"camel case"},camelCaseWithAcronyms:{fn:function(e){return!function(e){if(!mS(e[0]))return!1;for(let t=1;t<e.length;t++){let r=e[t];if(mS(r)||mD(r))continue;if(!mT(r))return!1;let n=t;for(;mT(e[t+1]);)t++;if(t!==n){if(mS(e[t+1])){t--;continue}for(;mD(e[t+1]);)t++;if(t===e.length-1)return!0;if(!mT(e[t+1]))return!1}}return!0}(e)?mu(e):e},name:"camel case with acronyms"},kebabCase:{fn:function(e,t){return ml(e,{delimiter:"-",...t})},name:"kebab case"},snakeCase:{fn:function(e,t){return ml(e,{delimiter:"_",...t})},name:"snake case"},pascalCase:{fn:function(e){if(mv.test(e)){let t=mC.exec(e)?.[0],r=t&&e.slice(t.length);if(r&&mp(r)===r)return e}return mp(e)},name:"pascal case"}};function mw(e,t){return e.filter(({ignored:e})=>!e).every(({word:e})=>t.some(t=>t(e)===e))}function mk(e,t,{leading:r,trailing:n}){let{samples:o}=function(e,t=1/0){let r=e.reduce((e,{length:t})=>e*t,1),n=Array.from({length:Math.min(r,t)},(t,r)=>{let n=r,o=[];for(let t=e.length-1;t>=0;t--){let r=e[t],{length:a}=r,i=n%a;n=(n-i)/a,o.unshift(r[i])}return o});return{total:r,samples:n}}(e.map(({word:e,ignored:r})=>r?[e]:t.map(t=>t(e))));return[...new i(o.map(e=>`${r}${e.join("")}${n}`))]}let mI=/^(?<leading>_+)(?<tailing>.*)$/;function mj(e){let t,{leading:r="",tailing:n=e}=(mI.exec(e)||{groups:{}}).groups,o=[];for(let e of n){let r=mx(e);t?.ignored===r?t.word+=e:(t={word:e,ignored:r},o.push(t))}return{leading:r,words:o}}function mF(e){let t;return t=e.map(e=>mA[e].name),mE.format(t)}let mB=[{description:"The rule options.",anyOf:[{properties:{case:{enum:["camelCase","camelCaseWithAcronyms","snakeCase","kebabCase","pascalCase"],description:"The filename and directory name case style."},ignore:{type:"array",uniqueItems:!0,description:"Path segment patterns to ignore."},multipleFileExtensions:{type:"boolean",description:"Whether to treat additional, dot-separated parts of a filename as file extensions."},checkDirectories:{type:"boolean",description:"Whether to check directory names."}},additionalProperties:!1},{properties:{cases:{properties:{camelCase:{type:"boolean",description:"Whether to allow camelCase filenames and directory names."},camelCaseWithAcronyms:{type:"boolean",description:"Whether to allow camelCase filenames and directory names with acronym segments."},snakeCase:{type:"boolean",description:"Whether to allow snake_case filenames and directory names."},kebabCase:{type:"boolean",description:"Whether to allow kebab-case filenames and directory names."},pascalCase:{type:"boolean",description:"Whether to allow PascalCase filenames and directory names."}},additionalProperties:!1,description:"The allowed filename and directory name case styles."},ignore:{type:"array",uniqueItems:!0,description:"Path segment patterns to ignore."},multipleFileExtensions:{type:"boolean",description:"Whether to treat additional, dot-separated parts of a filename as file extensions."},checkDirectories:{type:"boolean",description:"Whether to check directory names."}},additionalProperties:!1}]}],mR="consistent-template-literal-escape",mP=["entries","keys","values"],mL=["drop","filter","flatMap","map","take"],mN=["concat","from","zip","zipKeyed"],m$=new i(["ArrayIterator","Generator","IterableIterator","Iterator","IteratorObject","MapIterator","RegExpStringIterator","SetIterator"]),{isTarget:mM}=ny({checkClassHeritage:!1,preferTypeReferenceDefinitions:!0,targetTypeNames:m$}),mO=e=>{for(;rI(e)||"ChainExpression"===e.type||"ParenthesizedExpression"===e.type;)e=e.expression;return e},mU="iterable-accepting",mq="for-of",mV="yield-star",mW="spread",m_="iterator-method",mz="iterable-accepting/suggestion",mK="iterator-method/suggestion",mG=["every","find","forEach","some"],mJ="reduce",mX=e=>tw(e,{method:"toArray",argumentsLength:0,optionalCall:!1,optionalMember:!1}),mY=(e,t)=>{if(!(t.sourceCode.getCommentsInside(e).length>0))return r=>aM(r,e,t)},mH=(e,t,r,n)=>{let o=mY(e,t);if(o)return{messageId:r,...n&&{data:n},fix:o}},mQ="prefer-simple-condition-first",mZ="prefer-simple-condition-first/unsafe";function m0(e){return"Identifier"===(e=rj(e)).type||"UnaryExpression"===e.type&&"typeof"===e.operator&&"Identifier"===rj(e.argument).type}function m1(e){if(m0(e=rj(e))||"Literal"===e.type)return!0;if("UnaryExpression"!==e.type||"-"!==e.operator&&"+"!==e.operator)return!1;let t=rj(e.argument);return"Literal"===t.type&&("number"==typeof t.value||"-"===e.operator&&"bigint"==typeof t.value)}function m2(e){if("Identifier"===(e=rj(e)).type)return!0;if("UnaryExpression"===e.type&&"!"===e.operator)return m2(e.argument);if("BinaryExpression"===e.type&&("==="===e.operator||"!=="===e.operator)){let t=rj(e.left),r=rj(e.right);return m1(t)&&m1(r)&&(m0(t)||m0(r))}return!1}let m3="switch-case-break-position",m8=new i(["BreakStatement","ReturnStatement","ContinueStatement","ThrowStatement"]),m6="first-child",m9="first-element-child",m5="query-selector",m4="closest",m7="merge-query-selector",fe="suggestion-first-child",ft="suggestion-first-element-child",fr="suggestion-merge-query-selector",fn={method:"querySelector",argumentsLength:1,optionalCall:!1,optionalMember:!1},fo=(e,t)=>tT(e,{property:t,optional:!1,computed:!1}),fa=e=>"MemberExpression"===e.type&&!e.optional&&e.computed&&to(e.property)&&Number.isSafeInteger(e.property.value)&&e.property.value>=0,fi=(e,t)=>t.getCommentsInside(e).length>0,fs=(e,t,r,n)=>{let{sourceCode:o}=n;if(fi(e,o))return;let[,a]=e5(e.object,n),[,i]=o.getRange(e);return[{messageId:r,fix:r=>[r.replaceText(e.object.property,t),r.removeRange([a,i])]}]},fl=e=>tT(e,{property:"parentElement",optional:!1,computed:!1}),fu=e=>void 0!==tn(e),fp=e=>tw(e,fn),fc=new i(["FunctionDeclaration","ClassDeclaration","TSTypeAliasDeclaration","TSInterfaceDeclaration","TSEnumDeclaration"]),fd=new i(["AccessorProperty","MethodDefinition","PropertyDefinition","TSAbstractAccessorProperty","TSAbstractMethodDefinition","TSAbstractPropertyDefinition","TSMethodSignature","TSPropertySignature"]),fm=e=>{let t="";return"Variable"===e.type?t=e.node.init.arguments[0].value:"ImportBinding"===e.type&&(t=e.parent.source.value),!t.includes("node_modules")&&(t.startsWith(".")||t.startsWith("/"))},ff="consistent-compound-words/error",fg="consistent-compound-words/rename",fy={backGround:"background",callBack:"callback",checkBox:"checkbox",clipBoard:"clipboard",codeBase:"codebase",dataBase:"database",downLoad:"download",feedBack:"feedback",foreGround:"foreground",frameWork:"framework",headLine:"headline",keyBoard:"keyboard",keyFrame:"keyframe",lifeCycle:"lifecycle",metaData:"metadata",midPoint:"midpoint",nameSpace:"namespace",overRide:"override",passWord:"password",payLoad:"payload",placeHolder:"placeholder",preView:"preview",screenShot:"screenshot",sideBar:"sidebar",subClass:"subclass",subDirectory:"subdirectory",subDomain:"subdomain",subMenu:"submenu",subProcess:"subprocess",subString:"substring",subTree:"subtree",subType:"subtype",subTitle:"subtitle",timeOut:"timeout",timeStamp:"timestamp",toolBar:"toolbar",toolKit:"toolkit",toolTip:"tooltip",touchScreen:"touchscreen",unSubscribe:"unsubscribe",underScore:"underscore",upLoad:"upload",userName:"username",viewPort:"viewport",webCam:"webcam",webHook:"webhook",webSite:"website",weekEnd:"weekend",whiteSpace:"whitespace",wildCard:"wildcard",workFlow:"workflow",workSpace:"workspace"},fh=new i(String.raw`\^$.*+?()[]{}|`),fx=e=>{let t="";for(let r of e)t+=fh.has(r)?`\\${r}`:r;return t},fb=String.raw`(?=$|[\d_$]|\p{Uppercase_Letter})`,fE=(e,{replacementRegExp:t,replacements:r,allowList:n})=>{if(!t||e===e.toUpperCase()||n.has(e))return;let o=e.replaceAll(t,e=>((e,t)=>{let r=t.get(e)??t.get(ao(e));if(r){let t;return(t=e[0])===t.toUpperCase()?an(r):ao(r)}})(e,r));if(o!==e)return o},fv=(e,t)=>({node:e,messageId:ff,data:{name:e.name,replacement:t}}),fC={type:"array",additionalItems:!1,items:[{type:"object",additionalProperties:!1,properties:{checkProperties:{type:"boolean",description:"Whether to check property names."},checkVariables:{type:"boolean",description:"Whether to check variable names."},checkDefaultAndNamespaceImports:{anyOf:[{type:"boolean"},{enum:["internal"]}],description:"Whether to check default and namespace import names."},checkShorthandImports:{anyOf:[{type:"boolean"},{enum:["internal"]}],description:"Whether to check shorthand import names."},checkShorthandProperties:{type:"boolean",description:"Whether to check shorthand property names."},extendDefaultReplacements:{type:"boolean",description:"Whether to extend the default replacements."},replacements:{$ref:"#/definitions/replacements",description:"Custom compound word replacements."},allowList:{$ref:"#/definitions/trueObject",description:"Custom allow list of names."}}}],definitions:{replacements:{type:"object",propertyNames:{minLength:1},additionalProperties:{anyOf:[{enum:[!1]},{type:"string",minLength:1}]}},trueObject:{type:"object",propertyNames:{minLength:1},additionalProperties:{enum:[!0]}}}},fD="no-blob-to-file",fS="suggestion";function fT(e,t){let r=ey(t.sourceCode.getScope(e),e);return!r||0===r.defs.length}function fA(e,t){if(e?.type!=="Identifier")return;let r=ey(t.sourceCode.getScope(e),e),n=r?.defs[0],o=n?.node;if(n?.type==="Variable"&&"const"===n.kind&&o?.type==="VariableDeclarator")return o}let fw="no-canvas-to-image",fk=e=>{for(;e?.type==="AwaitExpression";)e=e.argument;return e};function fI(e,t){if(e=fk(e),e?.type!=="Identifier")return e;let r=ey(t.getScope(e),e);if(!r||1!==r.identifiers.length||2!==r.references.length)return;let[n]=r.identifiers;if("VariableDeclarator"===n.parent.type&&n.parent.id===n&&"VariableDeclaration"===n.parent.parent.type&&"const"===n.parent.parent.kind&&!(t.getRange(n)[0]>t.getRange(e)[0]))return fk(n.parent.init)}let fj=e=>e.toLowerCase().includes("canvas"),fF="replace-one-element",fB="insert-at-negative-one",fR="suggestion-replace-one-element",fP="suggestion-insert-at-negative-one";function fL(e){return"Identifier"===e.type||"ThisExpression"===e.type||"MemberExpression"===e.type&&!e.computed&&!e.optional&&fL(e.object)}let fN=(e,t)=>t.getCommentsInside(e).length>0,f$="no-duplicate-set-values",fM="first-match",fO="id-selector",fU="length-check",fq="query-selector-all-nullish",fV="query-selector-undefined",fW=e=>tw(e,{method:"querySelector",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&!oa(e.callee.object),f_=e=>tw(e,{method:"querySelectorAll",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&!oa(e.callee.object),fz=e=>{let t,r;return t=e,r=f_,"MemberExpression"===t.type&&t.computed&&!t.optional&&r(t.object)&&te(t.property,0)},fK=e=>{let t,r;return t=e,r=f_,tw(t,{methods:["at","item"],argumentsLength:1,optionalCall:!1,optionalMember:!1})&&r(t.callee.object)&&te(t.arguments[0],0)},fG=e=>nL(e)||("ForInStatement"===e.parent.type||"ForOfStatement"===e.parent.type)&&e.parent.left===e,fJ=(e,t,r,n)=>{let[,o]=e5(t,n),[,a]=r.getRange(e);return r.getAllComments().some(e=>{let[t,n]=r.getRange(e);return t>=o&&n<=a})},fX=(e,t,r)=>{if("Identifier"!==e.type)return;let n=ey(t.getScope(e),e);if(!n||1!==n.defs.length)return;let[o]=n.defs;if("Variable"===o.type&&"const"===o.parent.kind&&o.node.id===o.name&&r(o.node.init))return o.node.init},fY=(e,t)=>{let{sourceCode:r}=t,{node:n,isNegative:o}=function(e,t){let r=!1;for(;;)if(tM(e))r=!r,e=e.parent;else if(tO(e,t))e=e.parent;else break;return{node:e,isNegative:r}}(e,t);if(!tV(n)||(f_(e)?!e:!fX(e,r,f_)))return;let a=r.getText(e);return{node:e,messageId:fU,fix:((e,t,r)=>{let[n,o]=r.getRange(e),[a,i]=r.getRange(t);return r.getAllComments().some(e=>{let[t,s]=r.getRange(e);return t>=n&&s<=o&&(s<=a||t>=i)})})(n,e,r)?void 0:e=>e.replaceText(n,`${a}.length ${o?"=== 0":"> 0"}`)}},fH=(e,t,r)=>({node:e,messageId:fM,*fix(n){yield n.replaceText(t.callee.property,"querySelector"),yield"MemberExpression"===e.type?a$(n,e,r):aM(n,e,r)}}),fQ=(e,t)=>ti(e)||tP(e)&&t.isGlobalReference(e),fZ=(e,t,r)=>{let{left:n,operator:o,right:a}=e;return["==","===","!=","!=="].includes(o)?(t(n)?n:fX(n,r,t))&&fQ(a,r)?{node:n,value:a}:(t(a)?a:fX(a,r,t))&&fQ(n,r)?{node:a,value:n}:void 0:void 0},f0="no-invalid-file-input-accept/invalid",f1="no-invalid-file-input-accept/static",f2="no-invalid-file-input-accept/normalize",f3=new i(["audio/*","image/*","video/*"]),f8=new o([["application/x-rar-compressed","application/vnd.rar"],["application/x-zip-compressed","application/zip"],["image/jpg","image/jpeg"],["image/svg","image/svg+xml"],["image/x-icon","image/vnd.microsoft.icon"]]),f6=/&(?:#\d+|#x[\da-f]+|[a-z][\da-z]*);/iv,f9=e=>{for(let t of e)if(""===t.trim()||","===t||"/"===t||"*"===t||"$"===t||"{"===t||"}"===t)return!0;return!1},f5=e=>{if(e.startsWith("."))return e.length>1&&!f9(e.slice(1))?{replacement:e.toLowerCase()}:{reason:"File extensions must start with `.` and cannot contain whitespace, commas, slashes, wildcards, or template markers."};if(!e.includes("/"))return e.length>0&&"."!==e[0]&&!f9(e)?{replacement:`.${e.toLowerCase()}`}:{reason:"File extensions must start with `.` and cannot contain whitespace, commas, slashes, wildcards, or template markers."};let t=e.toLowerCase();if(t.includes("*"))return f3.has(t)?{replacement:t}:{reason:"Wildcard MIME types must be `audio/*`, `image/*`, or `video/*`."};try{let{essence:t}=new C.MIMEType(e);return{replacement:f8.get(t)??t}}catch{return{reason:"MIME types must use valid `type/subtype` syntax."}}},f4=e=>{if("JSXIdentifier"===e.type)return e.name},f7=(e,t)=>e.attributes.find(e=>"JSXAttribute"===e.type&&f4(e.name)===t),ge=(e,t)=>{let r=e.sourceCode.getScope(t),n=e$(t,r)?.value;if("string"==typeof n)return n},gt=e=>">"===e||""===e.trim(),gr=(e,t,r)=>{for(;t<r&&""===e[t].trim();)t++;return t},gn=(e,t,r)=>t>=r||">"===e[t]||"/"===e[t]&&">"===e[t+1],go=(e,t,r)=>{let n=t;for(;t<r&&""!==e[t].trim()&&"="!==e[t]&&">"!==e[t]&&("/"!==e[t]||">"!==e[t+1]);)t++;return{name:e.slice(n,t).toLowerCase(),index:t}},ga=(e,t,r)=>{let n='"'===e[t]||"'"===e[t]?e[t]:void 0;if(n){let o=t+1;for(t=o;t<r&&e[t]!==n;)t++;return{value:e.slice(o,t),valueRange:[o,t],isQuoted:!0,index:t+1}}let o=t;for(;t<r&&!gt(e[t]);)t++;return{value:e.slice(o,t),valueRange:[o,t],isQuoted:!1,index:t}},gi=(e,t,r)=>{let n=e.sourceCode.text,o=e.sourceCode.getRange(t.openStart)[1],a=e.sourceCode.getRange(t.openEnd)[1],i=o;for(;i<a&&(i=gr(n,i,a),!gn(n,i,a));){let e=go(n,i,a);if(i=gr(n,e.index,a),"="!==n[i]){if(e.name===r)return{missing:!0};continue}i=gr(n,++i,a);let t=ga(n,i,a);if(i=t.index,e.name===r)return t}},gs=({valueInfo:e,fix:t})=>{if(e.missing)return{node:e.node,messageId:f0,data:{reason:"The `accept` attribute must have a value."}};if(e.dynamic)return{node:e.node,messageId:f1};let r=(e=>{let t=e.split(","),r=new i,n=[];for(let e of t){let t=e.trim();if(0===t.length)return{reason:"Empty entries are not allowed."};let o=f5(t);if(o.reason)return o;let{replacement:a}=o;r.has(a)||(r.add(a),n.push(a))}let o=n.join(", ");return o===e?{}:{replacement:o}})(e.value),n=r.replacement&&e.fixable&&(!e.isReplacementFixable||e.isReplacementFixable(r.replacement));return(({valueNode:e,checkResult:t,fix:r})=>{if(t.reason)return{node:e,messageId:f0,data:{reason:t.reason}};if(t.replacement){let n={node:e,messageId:f2,data:{replacement:t.replacement}};return r&&(n.fix=r),n}})({valueNode:e.node,checkResult:r,fix:n?t(r.replacement):void 0})},gl=/^(?:e|event|evt|[a-z][\dA-Za-z]*Event)$/u,gu=e=>{for(let t=e.parent;t;t=t.parent)if(tv(t))return t},gp=(e,t)=>{switch(e.type){case"ForStatement":return[e.test,e.update,e.body].includes(t);case"ForInStatement":case"ForOfStatement":return t!==e.right;case"DoWhileStatement":case"WhileStatement":return!0;default:return!1}},gc=e=>{let{sourceCode:t}=e,r=new i,n=e=>{let t=gu(e);t&&r.add(t)};return e.onExit("AwaitExpression",n),e.onExit("YieldExpression",n),e.onExit("ForOfStatement",e=>{e.await&&n(e)}),{isFunctionSuspended:e=>r.has(e),isInsideSuspendingLoop(e,r){for(let n=e,o=e.parent;o&&o!==r;n=o,o=o.parent)if(gp(o,n)&&t_(o,t.visitorKeys))return!0;return!1}}},gd="after-suspension",gm="in-nested-function",gf="no-unnecessary-nested-ternary";function gg(e,t,r){return r.getText(e)===r.getText(t)}function gy(e,t,r,n){let o=e4(e,t);return!e7(e,t)&&o3(e,{operator:r,property:n})&&(o=`(${o})`),o}function gh(e,t){let r=e4(e,t);return!e7(e,t)&&oY(e)&&(r=`(${r})`),r}function gx(e,t,r){let n={node:t,messageId:gf};return 0===e.sourceCode.getCommentsInside(t).length&&(n.fix=n=>n.replaceText(t,function({context:e,node:t,left:r,operator:n,right:o,consequent:a,alternate:i}){let{sourceCode:s}=e,l=[gy(r,e,n,"left"),gy(o,e,n,"right")].join(` ${n} `),u=`${l} ? ${gh(a,e)} : ${gh(i,e)}`;return oD(s.getTokenBefore(t),e,u)&&(u=`;${u}`),u}({context:e,node:t,...r}))),n}let gb="no-unused-array-method-return",gE=new i(["at","concat","entries","every","filter","find","findIndex","findLast","findLastIndex","flat","flatMap","includes","indexOf","join","keys","lastIndexOf","map","some","slice","toReversed","toSorted","toSpliced","values","with"]),gv=/^\p{Uppercase_Letter}/v,gC=Symbol("uncertainValue"),gD=["BigInt","Boolean","Number","RegExp","String","Symbol"],gS=(e,t,r)=>"Identifier"===e.type&&e.name===t&&r.sourceCode.isGlobalReference(e),gT="prefer-array-last-methods",gA="replace",gw=new o([["find","findLast"],["findIndex","findLastIndex"],["indexOf","lastIndexOf"],["reduce","reduceRight"]]),gk=["reverse","toReversed"],gI="prefer-math-abs",gj=new i([">",">=","<","<="]),gF={">":"<",">=":"<=","<":">","<=":">="},gB={">":"<",">=":"<="};function gR(e){return"TSBigIntKeyword"===e.type||"TSLiteralType"===e.type&&ts(e.literal)||"TSTypeAnnotation"===e.type&&gR(e.typeAnnotation)||"TSUnionType"===e.type&&e.types.some(e=>gR(e))||"TSIntersectionType"===e.type&&e.types.some(e=>gR(e))}function gP(e){return["TSAsExpression","TSTypeAssertion","TSNonNullExpression"].includes(e.type)?gP(e.expression):e}function gL(e){let t;return ts(e)||tm(e,{name:"BigInt",argumentsLength:1,optional:!1},tp)||"UnaryExpression"===e.type&&"-"===e.operator&&gL(e.argument)||(t=function e(t){return"TSNonNullExpression"===t.type?e(t.expression):"TSAsExpression"===t.type||"TSTypeAssertion"===t.type?t.typeAnnotation:void 0}(e))&&gR(t)}function gN(e,t){return gL(e)||function(e,t){let r=gP(e);if("Identifier"!==r.type)return!1;let n=ey(t.sourceCode.getScope(r),r);return n?.defs.some(e=>"Parameter"===e.type?e.name.typeAnnotation&&gR(e.name.typeAnnotation)||"AssignmentPattern"===e.name.parent.type&&gL(e.name.parent.right):"Variable"===e.type&&(e.node.id.typeAnnotation&&gR(e.node.id.typeAnnotation)||e.node.init&&gL(e.node.init)))??!1}(e,t)}function g$(e,t){return"UnaryExpression"===e.type&&"-"===e.operator?rC(e.argument,t):"BinaryExpression"===e.type&&"-"===e.operator&&te(e.left,0)?rC(e.right,t):"BinaryExpression"===e.type&&"*"===e.operator&&(rC(e.left,t)&&tk(e.right)||tk(e.left)&&rC(e.right,t))}function gM(e,t){if(!("BinaryExpression"!==e.type||!gj.has(e.operator)||gN(e.left,t)||gN(e.right,t)))return">"===e.operator||">="===e.operator?{value:e.left,threshold:e.right,operator:e.operator}:{value:e.right,threshold:e.left,operator:gF[e.operator]}}function gO(e,t){if(!("BinaryExpression"!==e.type||!gj.has(e.operator)||gN(e.left,t)||gN(e.right,t)))return"<"===e.operator||"<="===e.operator?{value:e.left,negativeThreshold:e.right,operator:e.operator}:{value:e.right,negativeThreshold:e.left,operator:gF[e.operator]}}function gU(e,t){let r=e4(e,t);return"SequenceExpression"===e.type?`(${r})`:r}function gq(e,t,r){let n={node:e,messageId:gI};return r&&!(t.sourceCode.getCommentsInside(e).length>0)&&(n.fix=r),n}function gV(e){return["Identifier","Literal","ThisExpression"].includes((e=gP(e)).type)}let gW="prefer-split-limit",g_=(e,t)=>{let r=e$(e,t.getScope(e));if(r&&Number.isSafeInteger(r.value)&&!(r.value<0)&&!(r.value>=0xfffffffe))return r.value},gz=e=>{let t,r=e?.type==="ChainExpression"?e.expression:e;if(tw(r,{method:"split",argumentsLength:1})&&(tt(t=r.arguments[0])&&""!==t.value||ta(t)))return r},gK=(e,t,r,n)=>({node:e,messageId:gW,fix:e=>aA(e,t,String(r),n)}),gG=(e,t,r)=>{let{elements:n}=e,o=gz(t);if(0!==n.length&&n.at(-1)?.type!=="RestElement"&&o)return gK(e,o,n.length,r)},gJ="prefer-queue-microtask",gX={create:e=>{let{checkSetImmediate:t,checkSetTimeout:r}=e.options[0];e.on("MemberExpression",t=>{if(tT(t,{object:"process",property:"nextTick",computed:!1,optional:!1})&&of(t.object,e)&&("CallExpression"!==t.parent.type||t.parent.callee!==t||!t.parent.optional))return{node:t.property,messageId:gJ,data:{name:"process.nextTick()"},fix:((e,t)=>{let{parent:r}=e;if("CallExpression"===r.type&&r.callee===e&&1===r.arguments.length&&"SpreadElement"!==r.arguments[0].type&&!(t.sourceCode.getCommentsInside(e).length>0))return t=>t.replaceText(e,"queueMicrotask")})(t,e)}}),e.on("CallExpression",n=>{let o;return t&&"Identifier"===n.callee.type&&"setImmediate"===n.callee.name&&!n.optional&&n.arguments.length>0&&"SpreadElement"!==n.arguments[0].type&&!ol(n.arguments[0])&&oE(n)&&of(n.callee,e)?{node:n.callee,messageId:gJ,data:{name:"setImmediate()"},fix:(e=>{if(1===e.arguments.length)return t=>t.replaceText(e.callee,"queueMicrotask")})(n)}:r&&"Identifier"===n.callee.type&&"setTimeout"===n.callee.name&&!n.optional&&n.arguments.length>=2&&"Literal"===(o=n.arguments[1]).type&&0===o.value&&"SpreadElement"!==n.arguments[0].type&&!ol(n.arguments[0])&&oE(n)&&of(n.callee,e)?{node:n.callee,messageId:gJ,data:{name:"setTimeout()"},fix:((e,t)=>{if(2!==e.arguments.length)return;let r=((e,t)=>{let{sourceCode:r}=t,[,n]=e.arguments,o=r.getTokenBefore(n),a=r.getTokenAfter(n),i=a?.value===","?r.getTokenAfter(a):a,s=[r.getRange(o)[0],a?.value===","?r.getRange(a)[1]:r.getRange(n)[1]];if(!r$(t,[s[0],r.getRange(i)[0]]))return s})(e,t);if(r)return function*(t){yield t.replaceText(e.callee,"queueMicrotask"),yield t.removeRange(r)}})(n,e)}:void 0})},meta:{type:"suggestion",docs:{description:"Prefer `queueMicrotask()` over `process.nextTick()`, `setImmediate()`, and `setTimeout(…, 0)`.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{checkSetImmediate:{type:"boolean",description:"Whether to also check `setImmediate()`."},checkSetTimeout:{type:"boolean",description:"Whether to also check `setTimeout(…, 0)`."}}}],defaultOptions:[{checkSetImmediate:!1,checkSetTimeout:!1}],messages:{[gJ]:"Prefer `queueMicrotask()` over `{{name}}`."},languages:["js/js"]}},gY="prefer-string-pad-start-end",gH="suggest-padding-method",gQ=new i(["ArrayExpression","ArrowFunctionExpression","ClassExpression","FunctionExpression","ObjectExpression"]),gZ=(e,t)=>{let r,n=((e,t)=>{if("Identifier"!==e.type)return;let r=ey(t.sourceCode.getScope(e),e),n=r?.defs[0]?.node;return n?.type==="FunctionDeclaration"||n?.type==="ClassDeclaration"?n:n?.type==="VariableDeclarator"?n.init:void 0})(e,t);return(r=e$(e,t.sourceCode.getScope(e)))&&"string"!=typeof r.value||gQ.has(e.type)||gQ.has(n?.type)||n?.type==="FunctionDeclaration"||n?.type==="ClassDeclaration"},g0=(e,t)=>t.sourceCode.getCommentsInside(e).length>0,g1=e=>"Literal"===e.type&&"string"==typeof e.value||"TemplateLiteral"===e.type&&0===e.expressions.length,g2=({targetNode:e,targetLengthNode:t,paddingNode:r})=>"Identifier"===e.type&&to(t)&&g1(r),g3=(e,t)=>{if(!tw(e,{method:"repeat",argumentsLength:1,optionalCall:!1,optionalMember:!1}))return;let r=e.callee.object,n=((e,t)=>{let r=e$(e,t.sourceCode.getScope(e));if("string"==typeof r?.value)return r.value})(r,t);if(n?.length===1)return{paddingNode:r,paddingString:n,widthNode:e.arguments[0]}},g8=(e,t)=>{let r,n=g3(e,t);if(!n)return;let{widthNode:o}=n;if("BinaryExpression"===o.type&&"-"===o.operator&&(r=o.right,r?.type==="MemberExpression"&&!1===r.computed&&"Identifier"===r.property.type&&"length"===r.property.name))return{...n,targetLengthNode:o.left,targetNode:o.right.object}},g6=({method:e,targetNode:t,targetLengthNode:r,paddingNode:n,paddingString:o},a)=>{let i=e4(t,a),s=e4(r,a),l=(({paddingNode:e,paddingString:t},r)=>" "===t?"":`, ${e4(e,r)}`)({paddingNode:n,paddingString:o},a);return`${i}.${e}(${s}${l})`},g9=({node:e,method:t,replacement:r,context:n,canFix:o})=>{let a={node:e,messageId:gY,data:{method:t}};return o&&!g0(e,n)&&(a.fix=function(t){let o=oD(n.sourceCode.getTokenBefore(e),n,r)?";":"";return t.replaceText(e,`${o}${r}`)}),a},g5=({node:e,method:t,replacement:r,context:n,canSuggest:o})=>{let a={node:e,messageId:gY,data:{method:t}};return o&&!g0(e,n)&&(a.suggest=[{messageId:gH,data:{method:t},fix:t=>t.replaceText(e,r)}]),a},g4="require-css-escape",g7=["closest","matches","querySelector","querySelectorAll"],ye=e=>e.value.cooked,yt=(e,t)=>{let r,n="";for(let r of e.quasis.slice(0,t+1)){let e=ye(r);if(void 0===e)return!1;n+=e}if(!((r=n).lastIndexOf("[")>r.lastIndexOf("]")))return!1;for(let r of e.quasis.slice(t+1)){let e=ye(r);if(void 0===e)break;if(e.includes("]"))return!0}return!1},yr=e=>tw(e,{object:"CSS",method:"escape",argumentsLength:1,optionalCall:!1,optionalMember:!1}),yn=e=>t=>"SequenceExpression"===e.type?[t.insertTextBefore(e,"CSS.escape(("),t.insertTextAfter(e,"))")]:[t.insertTextBefore(e,"CSS.escape("),t.insertTextAfter(e,")")],yo={create:e=>{let{checkAllSelectors:t}=e.options[0];e.on("CallExpression",function*(e){if(!tw(e,{methods:g7,minimumArguments:1})||oa(e.callee.object))return;let[r]=e.arguments;if("TemplateLiteral"===r.type&&0!==r.expressions.length)for(let[e,n]of r.expressions.entries())!yr(n)&&(t||yt(r,e))&&(yield{node:n,messageId:g4,fix:yn(n)})})},meta:{type:"suggestion",docs:{description:"Require `CSS.escape()` for interpolated values in CSS selectors.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{checkAllSelectors:{type:"boolean",description:"Check all selector interpolations instead of only attribute selector interpolations."}}}],defaultOptions:[{checkAllSelectors:!1}],messages:{[g4]:"Use `CSS.escape()` for interpolated values in CSS selectors."},languages:["js/js"]}},ya="require-passive-events",yi=new i(["touchstart","touchmove","touchenter","touchend","touchleave","wheel","mousewheel"]),ys=e=>e.computed||"Identifier"!==e.property.type?tt(e.property)?e.property.value:void 0:e.property.name,yl=e=>{var t,r;return"MemberExpression"===e.parent.type&&e.parent.object===e&&"MemberExpression"===(t=e.parent).type&&"preventDefault"===ys(t)&&("CallExpression"===(r=t).parent.type&&r.parent.callee===r?r.parent:"ChainExpression"===r.parent.type&&"CallExpression"===r.parent.parent.type&&r.parent.parent.callee===r.parent?r.parent.parent:void 0)},yu=e=>{if("MemberExpression"!==e.parent.type||e.parent.object!==e)return!1;let t=ys(e.parent);return t&&"preventDefault"!==t&&!nL((e=>{for(;"MemberExpression"===e.parent.type&&e.parent.object===e;)e=e.parent;return e})(e.parent))},yp="this",yc="class",yd="class-unavailable",ym="super",yf="super-class",yg="super-class-unavailable",yy="suggestion",yh=new i(["PropertyDefinition","AccessorProperty","StaticBlock","ClassBody"]),yx=new i(["TSAsExpression","TSInstantiationExpression","TSNonNullExpression","TSSatisfiesExpression","TSTypeAssertion"]),yb=e=>"MethodDefinition"===e.parent.type&&e.parent.value===e,yE=e=>"FunctionDeclaration"===e.type||"FunctionExpression"===e.type,yv=e=>{let t=e;for(let{parent:r}=e;r;t=r,r=r.parent)if("ArrowFunctionExpression"!==r.type){if(yE(r)&&!yb(r))return;if("MethodDefinition"===r.type)return r.static&&r.value===t?r:void 0;if(yh.has(r.type))return}},yC=e=>{if(e.id)return e.id;let{parent:t}=e;if("ClassExpression"===e.type&&"VariableDeclarator"===t.type&&t.init===e&&"Identifier"===t.id.type)return t.id},yD=(e,t,r)=>ey(e.getScope(t),t)===ey(e.getScope(r),r),yS=(e,t,r)=>ey(e.getScope(t),r.name)===ey(e.getScope(r),r),yT=(e,t)=>"AssignmentExpression"===e.type&&e.left===t||"UpdateExpression"===e.type&&e.argument===t||"UnaryExpression"===e.type&&"delete"===e.operator&&e.argument===t||("ForInStatement"===e.type||"ForOfStatement"===e.type)&&e.left===t,yA=e=>{let t;return(t=e.parent,yx.has(t.type)&&t.expression===e)?e.parent:void 0},yw=e=>{let{parent:t}=e;if("MemberExpression"===t.type&&t.object===e||"ChainExpression"===t.type&&t.expression===e)return t;let r=yA(e);return r||("Property"===t.type&&t.value===e&&"ObjectPattern"===t.parent.type?t.parent:"ObjectPattern"===t.type&&t.properties.includes(e)||"ArrayPattern"===t.type&&t.elements.includes(e)||"AssignmentPattern"===t.type&&t.left===e||"RestElement"===t.type&&t.argument===e?t:void 0)},yk=e=>{let t=e;for(;t.parent;){if(yT(t.parent,t))return!0;let e=yw(t);if(!e)break;t=e}return!1},yI=e=>"MemberExpression"===e.parent.type&&e.parent.object===e,yj=e=>{let t=e;for(;t.parent;){let e=yA(t);if(!e)break;t=e}return t},yF=e=>{let t=yj(e);return"CallExpression"===t.parent.type&&t.parent.callee===t||"NewExpression"===t.parent.type&&t.parent.callee===t||"TaggedTemplateExpression"===t.parent.type&&t.parent.tag===t},yB=e=>{let t=yj(e);return yI(t)&&"PrivateIdentifier"===t.parent.property.type},yR=e=>{let t=yj(e);return"BinaryExpression"===t.parent.type&&"in"===t.parent.operator&&"PrivateIdentifier"===t.parent.left.type&&t.parent.right===t},yP=e=>e.superClass?.type==="Identifier"?e.superClass:void 0,yL=({node:e,messageId:t,source:r,replacement:n,name:o})=>({node:e,messageId:t,data:{name:o},suggest:[{messageId:yy,data:{source:r,replacement:n},fix:t=>t.replaceText("ChainExpression"===e.parent.type?e.parent:e,n)}]}),yN=(e,t,r)=>({node:e,messageId:t,data:{name:r}}),y$={create:e=>{let{sourceCode:t}=e,{preferThis:r,preferSuper:n}=e.options[0];e.on("ThisExpression",e=>{if(r||yk(e)||yF(e)||yB(e)||yR(e))return;let n=yv(e);if(!n)return;let o=yC(n.parent.parent);return o&&yS(t,e,o)?yL({node:e,messageId:yc,source:"this",replacement:o.name,name:o.name}):yN(e,yd)}),e.on("Super",e=>{if(n||yk(e))return;let r=yv(e);if(!r)return;let o=yP(r.parent.parent);return o&&yS(t,e,o)?yL({node:e,messageId:yf,source:"super",replacement:o.name,name:o.name}):yN(e,yg)}),e.on("Identifier",o=>{if(!tI(o)||(e=>{let t=e;for(;"TSQualifiedName"===t.parent.type;)t=t.parent;return"TSTypeReference"===t.parent.type&&t.parent.typeName===t||"TSTypeQuery"===t.parent.type&&t.parent.exprName===t})(o)||yk(o)||yF(o)||yB(o)||yR(o))return;let a=yv(o);if(!a)return;let i=a.parent.parent;if(r){let e=yC(i);if(e&&o.name===e.name&&yD(t,o,e))return yL({node:o,messageId:yp,source:o.name,replacement:"this",name:o.name})}if(!n||!(yI(o)&&!o.parent.optional&&!yk(o.parent))||e7(o,e))return;let s=yP(i);if(s&&o.name===s.name&&yD(t,o,s))return yL({node:o,messageId:ym,source:o.name,replacement:"super",name:o.name})})},meta:{type:"suggestion",docs:{description:"Enforce consistent class references in static methods.",recommended:!0},hasSuggestions:!0,schema:[{type:"object",properties:{preferThis:{type:"boolean",description:"Prefer `this` over the current class name in static methods."},preferSuper:{type:"boolean",description:"Prefer `super` over the superclass name in static methods."}},additionalProperties:!1}],defaultOptions:[{preferThis:!0,preferSuper:!0}],messages:{[yp]:"Use `this` instead of `{{name}}` in static methods.",[yc]:"Use `{{name}}` instead of `this` in static methods.",[yd]:"Use the class name instead of `this` in static methods.",[ym]:"Use `super` instead of `{{name}}` in static methods.",[yf]:"Use `{{name}}` instead of `super` in static methods.",[yg]:"Use the superclass name instead of `super` in static methods.",[yy]:"Replace `{{source}}` with `{{replacement}}`."},languages:["js/js"]}},yM="consistent-optional-chaining/remove-optional",yO="consistent-optional-chaining/use-optional",yU="consistent-optional-chaining/suggest-remove-optional",yq="consistent-optional-chaining/suggest-use-optional",yV=new i(["Identifier","ThisExpression","Super"]);function yW(e){let t;for(;e!==t;)t=e,"ChainExpression"===(e=rj(e)).type&&(e=e.expression);return e}function y_(e){return"MemberExpression"===(e=yW(e)).type?e:void 0}function yz(e){return e=yW(e),!!yV.has(e.type)||"MemberExpression"===e.type&&yz(e.object)}function yK(e,t){let r=rV(e,t);return!r$(t,r)}function yG({memberExpression:e,context:t,fixer:r,replacement:n}){let o=rV(e,t);return r.replaceTextRange(o,n)}function yJ(e,t,r){return yG({memberExpression:e,context:t,fixer:r,replacement:e.computed?"[":"."})}let yX="always",yY="never",yH="missing-delay",yQ="redundant-delay",yZ=new i(["setTimeout","setInterval"]),y0=new i(["window","globalThis","global","self"]),y1=e=>te(e,0)||"UnaryExpression"===e.type&&("+"===e.operator||"-"===e.operator)&&y1(e.argument),y2="negative-index",y3="length-index",y8="no-duplicate-loops",y6=["filter","map"],y9="no-declarations-before-early-exit",y5=e=>"VariableDeclaration"===e.type&&("let"===e.kind||"const"===e.kind),y4=e=>!e||"Literal"===e.type||"TemplateLiteral"===e.type&&0===e.expressions.length,y7=(e,t,r)=>{let n="before"===r?e.getTokenBefore(t,{includeComments:!0}):e.getTokenAfter(t,{includeComments:!0});return n&&eT(n)},he=(e,t)=>{let[r,n]=e.getRange(t);return new i(rc(e.getScope(t)).filter(({identifier:t})=>{let[o,a]=e.getRange(t);return o>=r&&a<=n}).map(({identifier:e})=>e.name))};function*ht(e,t,r){let n;for(let[o,a]of t.entries())if(y5(a)&&!a.declare){n??=t.map(e=>{var t,n;return(t=e,n=r,"IfStatement"!==t.type||n(t.consequent)===(!!t.alternate&&n(t.alternate)))?void 0:e});for(let r=o+1;r<t.length;r++){let t=n[r];if(t){for(let n of a.declarations){let i=function({sourceCode:e,declaration:t,declarator:r,guardStatement:n,declarationIndex:o,guardIndex:a}){var i;let s;if("Identifier"!==r.id.type||(e=>{if(e?.type!=="CallExpression")return!1;let{callee:t}=e;return"Identifier"===t.type?od(t.name):"MemberExpression"===t.type&&!t.computed&&"Identifier"===t.object.type&&/^[A-Z]/.test(t.object.name)&&"Identifier"===t.property.type&&od(t.property.name)})(r.init)||r.init&&t_(r.init,e.visitorKeys)||a>o+1&&!y4(r.init)||r.init&&(i=r.init,s=he(e,n),[...he(e,i)].some(e=>s.has(e)))&&(ez(r.init,e)||ez(n.test,e)))return;let[l]=e.getDeclaredVariables(r),u=l.references.filter(e=>!e.init&&!function(e){let t=e;for(;"TSQualifiedName"===t.parent.type;)t=t.parent;return"TSTypeQuery"===t.parent.type}(e.identifier));if(0===u.length)return;let[,p]=e.getRange(n);if(u.some(t=>e.getRange(t.identifier)[0]<p))return;let c={node:r.id,messageId:y9};return(({sourceCode:e,declaration:t,guardStatement:r,declarationIndex:n,guardIndex:o})=>o===n+1&&1===t.declarations.length&&y4(t.declarations[0].init)&&0===e.getCommentsInside(t).length&&!y7(e,t,"before")&&!y7(e,r,"after")&&!e.getTokensBetween(t,r,{includeComments:!0}).some(e=>eT(e)))({sourceCode:e,declaration:t,guardStatement:n,declarationIndex:o,guardIndex:a})&&(c.fix=function(e,t,r){let n=e.getText(t),o=e.getText(r),[a,i]=e.getRange(t),[s,l]=e.getRange(r),u=e.text.slice(i,s);return e=>e.replaceTextRange([a,l],`${o}${u}${n}`)}(e,t,n)),c}({sourceCode:e,declaration:a,declarator:n,guardStatement:t,declarationIndex:o,guardIndex:r});i&&(yield i)}break}}}}let hr="no-optional-chaining-on-undeclared-variable",hn=e=>"Type"===e.type||"ImportBinding"===e.type&&oS(e.node);function ho(e){let t;for(;e!==t;)t=e,("ChainExpression"===(e=rj(e)).type||"TSInstantiationExpression"===e.type)&&(e=e.expression);return e}let ha="no-object-methods-with-collections/error",hi="no-object-methods-with-collections/suggestion",hs=new i(["entries","keys","values"]),hl="no-subtraction-comparison/error",hu="no-subtraction-comparison/suggestion",hp={">":"<",">=":"<=","<":">","<=":">=","===":"===","!==":"!==","==":"==","!=":"!="},hc=new i(Object.keys(hp)),hd=new i([">","<"]),hm=e=>"BinaryExpression"===e.type&&"-"===e.operator,hf=(e,t)=>{let r=e$(e,t)?.value;return"number"==typeof r&&Number.isFinite(r)},hg="no-unnecessary-global-this",hy=new i(["TSAsExpression","TSInstantiationExpression","TSNonNullExpression","TSSatisfiesExpression","TSTypeAssertion"]);function hh(e){for(;hy.has(e.type);)e=e.expression;return e}let hx=e=>{for(;hy.has(e.parent.type)&&e.parent.expression===e;)e=e.parent;return e},hb=tX();function hE(e){return"CallExpression"===(e=hx(e)).parent.type&&e.parent.callee===e}let hv=new i(["==","!=","===","!=="]),hC="computed-key",hD="nested-array",hS="deep-object",hT="property-assignment";function hA(e){let{parent:t}=e;if(t){if(rI(t)&&t.expression===e||"AssignmentPattern"===t.type&&t.left===e||"RestElement"===t.type&&t.argument===e)return hA(t);if("Property"===t.type&&t.value===e&&"ObjectPattern"===t.parent.type)return t.parent;if("ObjectPattern"===t.type||"ArrayPattern"===t.type)return t}}function hw(e){let t=0;for(;e;)"ObjectPattern"===e.type&&t++,e=hA(e);return t}let hk="no-useless-else",hI=new i(["Program","BlockStatement","StaticBlock","SwitchCase"]),hj=new i(["[","(","<","/","`","+","-"]),hF=(e,t)=>{let r=e.text.lastIndexOf("\n",t-1)+1;return/^[\t ]*/.exec(e.text.slice(r,t))[0]},hB=e=>hj.has(e.value[0]),hR="no-useless-recursion",hP=new i(["using","await using"]),hL=e=>e?.type==="VariableDeclaration"&&hP.has(e.kind),hN=e=>"ForStatement"===e.type?hL(e.init):"ForOfStatement"===e.type&&hL(e.left),h$="prefer-add-event-listener-options",hM="prefer-direct-iteration",hO="Array",hU="FormData",hq="URLSearchParams",hV=new i([hO,"Map","Set",hU,hq,...rZ]),hW=new o([["ReadonlyArray",hO],["ReadonlyMap","Map"],["ReadonlySet","Set"]]),h_=new o([[hO,["values"]],["Map",["entries"]],["Set",["values","keys"]],[hU,["entries"]],[hq,["entries"]],...rZ.map(e=>[e,["values"]])]),hz=["Map","WeakMap","Set","WeakSet"],hK=["all","allSettled","any","race"],hG=new i(["ArrayExpression","CallExpression","NewExpression"]),hJ=e=>new i([e]),hX=(e,t)=>tw(e,{objects:rZ,methods:t,optionalCall:!1,optionalMember:!1}),hY=e=>hV.has(e)?e:hW.get(e),hH=e=>{let t=new i;for(let r of e){if(!r)return;for(let e of r)t.add(e)}return t},hQ=(e,t,r)=>{if("any"===e.intrinsicName||"unknown"===e.intrinsicName)return;if(e.isUnion())return hH(e.types.map(e=>hQ(e,t,r)));if(t.isArrayType(e)||t.isTupleType(e))return hJ(hO);let n=r2(e);if(!r3(n,r))return;let o=n.getName(),a=o&&hY(o);return a&&hJ(a)},hZ=e=>{switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return hZ(e.typeAnnotation);case"TSArrayType":case"TSTupleType":return hJ(hO);case"TSTypeOperator":return"readonly"===e.operator?hZ(e.typeAnnotation):void 0;case"TSTypeReference":{if("Identifier"!==e.typeName.type)return;let t=hY(e.typeName.name);return t&&hJ(t)}case"TSUnionType":return hH(e.types.map(e=>hZ(e)))}},h0=(e,t,r=new i)=>((e,t,r)=>{if("ArrayExpression"===e.type||tf(e,{name:"Array"}))return hJ(hO);if(tf(e,{names:rZ})||tf(e,{names:["Map","Set",hU,hq]}))return hJ(e.callee.name);if(tm(e,{name:"Array"},tp)||tw(e,{object:"Array",methods:["from","of"],optionalCall:!1,optionalMember:!1}))return hJ(hO);if(hX(e,["from","of"]))return hJ(e.callee.object.name);switch(e.type){case"Identifier":return((e,t,r)=>{let n=ey(t.sourceCode.getScope(e),e);if(!n||r.has(n)||1!==n.defs.length)return;r.add(n);let[o]=n.defs,a=hZ(o.name?.typeAnnotation);return a||("Variable"===o.type&&"const"===o.parent.kind&&o.node.init?h0(o.node.init,t,r):void 0)})(e,t,r);case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":return hZ(e.typeAnnotation)??h0(e.expression,t,r);case"TSNonNullExpression":case"ParenthesizedExpression":return h0(e.expression,t,r)}})(e,t,r)??((e,t)=>{let{parserServices:r}=t.sourceCode;if(r?.program)try{let{program:t}=r;return hQ(r.getTypeAtLocation(e),t.getTypeChecker(),t)}catch{}})(e,t),h1="prefer-number-is-safe-integer/error",h2="prefer-number-is-safe-integer/suggestion",h3="prefer-number-is-safe-integer/integer-check-error",h8="prefer-number-is-safe-integer/integer-check-suggestion",h6=["_","lodash","underscore"],h9=["floor","trunc"],h5=(e,t)=>{let r=ey(t.getScope(e),"Number");return!r||"global"===r.scope.type&&0===r.defs.length},h4=e=>{if("BinaryExpression"===e.type&&"%"===e.operator&&te(e.right,1))return e.left},h7=(e,t)=>{if(tw(e,{object:"Math",methods:h9,argumentsLength:1,optionalCall:!1,optionalMember:!1,computed:!1})&&t.isGlobalReference(e.callee.object))return e.arguments[0]},xe="prefer-object-define-properties";function xt(e){if(e?.type!=="ExpressionStatement")return;let{expression:t}=e;if(tw(t,{object:"Object",method:"defineProperty",argumentsLength:3,optionalCall:!1,optionalMember:!1,computed:!1}))return t}let xr="prefer-object-destructuring-defaults",xn="prefer-object-destructuring-defaults/suggestion",xo=new i(Object.getOwnPropertyNames(Object.prototype)),xa={considerGetters:!0,considerImplicitTypeConversion:!0},xi=e=>"Property"===e.type&&"init"===e.kind&&!e.computed&&!e.method,xs=(e,t,r)=>rc(r.sourceCode.getScope(e)).some(n=>t.has(n.identifier.name)&&((e,t,r)=>{let[n,o]=r.getRange(e),[a,i]=r.getRange(t);return n>=a&&o<=i})(n.identifier,e,r.sourceCode)),xl=(e,t,r)=>{let{sourceCode:n}=r,o=n.getText(e.node.value),a=e4(t.value,r);return e.node.shorthand?`${o} = ${a}`:`${n.getText(e.node.key)}: ${o} = ${a}`},xu="prefer-single-object-destructuring",xp=(e,t)=>{let r,n;if(!("VariableDeclaration"===t.type&&("const"===(r=t.kind)||"let"===r)&&!t.declare&&1===t.declarations.length))return;let[o]=t.declarations;if("ObjectPattern"===o.id.type&&!o.id.typeAnnotation&&(n=o.id).properties.length>0&&n.properties.every(e=>"Property"===e.type&&!e.computed&&"Identifier"===e.value.type)&&o.init?.type==="Identifier"&&((e,t)=>{let r=ey(e.getScope(t),t);if(!r||1!==r.defs.length)return!1;let[n]=r.defs;return"Variable"===n.type&&"VariableDeclarator"===n.node.type&&"VariableDeclaration"===n.parent.type&&!n.parent.declare&&"const"===n.parent.kind})(e,o.init))return{node:t,declarator:o,source:o.init.name}},xc=(e,t,r)=>{let n,o,a=xp(e,t),i=xp(e,r);if(!(a&&i&&a.node.kind===i.node.kind&&a.source===i.source&&0===e.getCommentsInside(a.node).length&&0===e.getCommentsInside(i.node).length)||(n=a.node,o=i.node,e.getTokensBetween(n,o,{includeComments:!0}).some(e=>eT(e))))return;let s=t=>t.properties.map(t=>e.getText(t)).join(", "),l=`${a.node.kind} {${s(a.declarator.id)}, ${s(i.declarator.id)}} = ${a.source};`;return{node:i.node,messageId:xu,data:{source:a.source},fix:t=>t.replaceTextRange([e.getRange(a.node)[0],e.getRange(i.node)[1]],l)}};function*xd(e,t){for(let[r,n]of t.entries()){if(0===r)continue;let o=xc(e,t[r-1],n);o&&(yield o)}}let xm="prefer-smaller-scope",xf=new i(["ArrowFunctionExpression","ClassDeclaration","ClassExpression","FunctionDeclaration","FunctionExpression","StaticBlock","WithStatement"]);function xg(e,t){let r=e.parent;for(;r&&r!==t;){if(xf.has(r.type))return!1;r=r.parent}return r===t}function xy(e,t,r){let n="before"===r?e.getTokenBefore(t,{includeComments:!0}):e.getTokenAfter(t,{includeComments:!0});return!!(n&&eT(n))}function xh(e,t){let r=e.getTokenBefore(t),n=e.getTokenAfter(t);return r?.value==="("&&n?.value===")"}let xx="prefer-single-array-predicate/error",xb="prefer-single-array-predicate/suggestion",xE=new o([["||","some"],["&&","every"]]),xv=new i(["AssignmentExpression","ArrowFunctionExpression","ConditionalExpression","SequenceExpression","TSAsExpression","TSNonNullExpression","TSSatisfiesExpression","TSTypeAssertion","YieldExpression"]),xC="prefer-url-href",xD="non-url",xS="unknown",xT=new i(["ClassName","ImportBinding","Type"]),xA=new i(["any","error","unknown"]),xw=new i(["node:url","url"]),xk=e=>xT.has(e.type),xI=(e,t,r,n)=>{for(;t;){let o=t.set.get(e);if(o?.defs.some(e=>oT(e,r,n)))return o;t=t.upper}},xj=e=>e.every(e=>"url"===e)?"url":!e.includes(xS)&&e.includes(xD)?xD:xS,xF=e=>{let t;if("ImportBinding"!==e.type)return!1;let{node:r,parent:n}=e;return t=n.source,xw.has(t.value)&&"ImportSpecifier"===r.type&&"Identifier"===r.imported.type&&"URL"===r.imported.name},xB=e=>"ImportBinding"===e.type&&("type"===e.parent.importKind||oS(e.node)),xR=e=>"Type"===e.type||xB(e),xP=e=>xF(e)&&!xB(e),xL=(e,t)=>{let r;return"NewExpression"===e.type&&(((e,t)=>{if("Identifier"!==e.type||"URL"!==e.name||((e,t,r)=>{for(;e;){let n=e.set.get("URL");if(n?.defs.some(e=>!xR(e)&&oT(e,t,r)))return!0;e=e.upper}return!1})(t.sourceCode.getScope(e),e,t))return!1;if(of(e,t))return!0;let r=ey(t.sourceCode.getScope(e),e);return r?.defs.length>0&&r.defs.every(e=>xR(e))})(r=e.callee,t)||((e,t)=>{if("Identifier"!==e.type)return!1;let r=ey(t.sourceCode.getScope(e),e);return r?.defs.some(e=>xP(e))??!1})(r,t))},xN=(e,t)=>t.sourceCode.getScope(e.name??e.node),x$=(e,t,r,n=new i)=>{switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return x$(e.typeAnnotation,t,r,n);case"TSTypeReference":return((e,t,r,n)=>{if("Identifier"!==e.typeName.type)return xS;let o=e.typeName.name,a=xI(o,r,e.typeName,t),[i]=a?.defs??[];if(!i)return"URL"!==o||((e,t)=>{for(;t;){let r=t.set.get(e);if(r?.defs.some(e=>xk(e)))return!0;t=t.upper}return!1})(o,r)?xS:"url";if(n.has(o))return xS;if(xF(i))return"url";n.add(o);let s=xS;return"Type"===i.type&&"TSTypeAliasDeclaration"===i.node.type?s=x$(i.node.typeAnnotation,t,xN(i,t),n):"Type"===i.type&&"TSTypeParameter"===i.node.type?s=xS:"ClassName"===i.type&&(s=xD),n.delete(o),s})(e,t,r,n);case"TSUnionType":return xj(e.types.map(e=>x$(e,t,r,n)));case"TSIntersectionType":return xj(e.types.map(e=>x$(e,t,r,n)));case"TSImportType":let o;return(o=e.source,xw.has(o.value)&&e.qualifier?.type==="Identifier"&&"URL"===e.qualifier.name)?"url":xD;default:return e?xD:xS}},xM=(e,t)=>{let{checker:r,context:n,node:o,program:a}=t;if(xA.has(e.intrinsicName)||e.isTypeParameter?.())return xS;let i=r.getBaseConstraintOfType(e);if(i&&i!==e)return xM(i,t);if(e.isUnion()||e.isIntersection())return xj(e.types.map(e=>xM(e,t)));let s=((e,t,r)=>{if(!/^[\w$]+$/.test(e))return xS;let n=xI(e,r.sourceCode.getScope(t),t,r),o=n?.defs.filter(e=>"Type"===e.type||"ClassName"===e.type||xF(e))??[];return 0===o.length?xS:o.every(e=>xF(e))?"url":xD})(r.typeToString(e),o,n);if(s!==xS)return s;let l=r2(e);return r3(l,a)&&"URL"===l.getName()?"url":xD},xO=(e,t)=>{let{parserServices:r}=t.sourceCode;if(!r?.program)return xS;try{let{program:n}=r;return xM(r.getTypeAtLocation(e),{checker:n.getTypeChecker(),context:t,node:e,program:n})}catch{return xS}};function xU(e,t,r=new i){if(!e)return xS;let n=t.sourceCode.getScope(e);switch(e.type){case"Identifier":{let n=((e,t,r)=>{let n=ey(t.sourceCode.getScope(e),e);if(!n||r.has(n)||1!==n.defs.length)return xS;let[o]=n.defs;if(!oT(o,e,t))return xS;r.add(n);let a="Variable"===o.type&&"const"===o.parent.kind&&o.node.init?xU(o.node.init,t,r):xS,i=x$(o.name?.typeAnnotation,t,xN(o,t)),s=xS;return a!==xS?s=a:i!==xS&&(s=i),r.delete(n),s})(e,t,r);if(n!==xS)return n;break}case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":{let o=x$(e.typeAnnotation,t,n);return o===xS?xU(e.expression,t,r):o}case"TSNonNullExpression":case"ParenthesizedExpression":return xU(e.expression,t,r);case"SequenceExpression":return xU(e.expressions.at(-1),t,r);case"ConditionalExpression":return xj([xU(e.consequent,t,r),xU(e.alternate,t,r)])}if(xL(e,t))return"url";if("NewExpression"===e.type){if(((e,t)=>{if("Identifier"!==e.type)return!1;let r=ey(t.sourceCode.getScope(e),e);return r?.defs.some(e=>!xR(e)&&!xP(e))??!1})(e.callee,t))return xD;let r=xO(e,t);return r===xS?xD:r}let o=((e,t)=>{if("CallExpression"!==e.type||"Identifier"!==e.callee.type)return xS;let r=ey(t.sourceCode.getScope(e.callee),e.callee);if(r?.defs.length!==1)return xS;let[n]=r.defs;return x$(n.node.returnType,t,xN(n,t))})(e,t);return o!==xS?o:xO(e,t)}let xq=(e,t)=>{switch(e.type){case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":case"ParenthesizedExpression":case"TSNonNullExpression":return xq(e.expression,t);case"SequenceExpression":return xq(e.expressions.at(-1),t);case"ConditionalExpression":return xq(e.consequent,t)&&xq(e.alternate,t);case"NewExpression":return xL(e,t);default:return!1}},xV=(e,t)=>0===t.sourceCode.getCommentsInside(e).length,xW="require-proxy-trap-boolean-return",x_=new i(["defineProperty","deleteProperty","has","isExtensible","preventExtensions","set","setPrototypeOf"]),xz=new i(["ArrowFunctionExpression","FunctionDeclaration","FunctionExpression"]),xK=new i(["ArrayExpression","ArrowFunctionExpression","ClassExpression","FunctionExpression","NewExpression","ObjectExpression","TemplateLiteral","UpdateExpression"]),xG=new i(["%","&","*","**","+","-","/","<<",">>",">>>","^","|"]),xJ=(e,t)=>({node:e,messageId:xW,data:{name:t}}),xX=e=>{if(e)return xJ(e.node,e.data.name)},xY=(e,t,r)=>{if("AssignmentExpression"===e.type)return"="===e.operator?xX(xY(e.right,t,r)):xJ(e,t);if("ConditionalExpression"===e.type)return xY(e.consequent,t,r)??xY(e.alternate,t,r);if("LogicalExpression"===e.type)return xX(xY(e.left,t,r)??xY(e.right,t,r));if("SequenceExpression"===e.type)return xX(xY(e.expressions.at(-1),t,r));let n=((e,t)=>{let r=e$(e,t.getScope(e));if(null!==r&&"boolean"!=typeof r.value)return!!r.value})(e,r);if(void 0===n&&!(xK.has(e.type)||"UnaryExpression"===e.type&&"!"!==e.operator&&"delete"!==e.operator||"BinaryExpression"===e.type&&xG.has(e.operator)))return;let o=((e,t,r)=>{if(!(r.getCommentsInside(e).length>0)&&("Literal"===e.type&&!e.regex||"TemplateLiteral"===e.type&&0===e.expressions.length||"Identifier"===e.type&&"undefined"===e.name))return String(t)})(e,n,r);return{...xJ(e,t),...o&&{fix:t=>t.replaceText(e,o)}}},xH=(e,t)=>{if("Property"!==e.type||"init"!==e.kind)return;let r=eO(e,t.getScope(e));if(x_.has(r)&&xz.has(e.value.type))return{name:r,functionNode:e.value}},xQ=({functionNode:e,name:t},r,n)=>{if(e.async||e.generator)return xJ(e,t);if("BlockStatement"!==e.body.type)return xY(e.body,t,r);let o=[...function* e(t){if(t&&"string"==typeof t.type){if("ReturnStatement"===t.type)return void(yield t);if(!("BlockStatement"!==t.type&&xz.has(t.type))){for(let[r,n]of Object.entries(t))if("parent"!==r){if(Array.isArray(n)){for(let t of n)yield*e(t);continue}yield*e(n)}}}}(e.body)],a=n.get(e)??!1;if(0===o.length){if(a)return;return xJ(e,t)}for(let e of o){if(!e.argument)return xJ(e,t);let n=xY(e.argument,t,r);if(n)return n}if(!a)return xJ(e,t)},xZ=D.builtinRules.get("logical-assignment-operators"),x0="ifNullish",x1="convertIf",x2={...xZ.meta.messages,[x0]:"'if' statement can be replaced with a logical operator assignment with operator ||= or ??=."},x3=e=>e.fix??e.suggest?.[0]?.fix,x8={create:e=>{let{sourceCode:t}=e,r=Object.create(e,{report:{value(r){e.report(function(e,t){let r;if("if"!==e.messageId||e.data?.operator!=="||="||"function"!=typeof x3(e))return e;let n={...(r={...e},delete r.fix,delete r.suggest,r),messageId:x0};if(t.getCommentsInside(e.node).length>0)return n;let o=x3(e);return{...n,suggest:[{messageId:x1,data:{operator:"||="},fix:o},{messageId:x1,data:{operator:"??="},fix:e=>o(new Proxy(e,{get(e,t){if("insertTextBefore"!==t){let r=Reflect.get(e,t,e);return"function"==typeof r?r.bind(e):r}return(t,r)=>e.insertTextBefore(t,"||"===r?"??":r)}}))}]}}(r,t))}}});for(let[t,n]of Object.entries(xZ.create(r)))e.on(t,n)},meta:{type:xZ.meta.type,docs:{description:xZ.meta.docs.description,recommended:!0},fixable:xZ.meta.fixable,hasSuggestions:xZ.meta.hasSuggestions,schema:xZ.meta.schema,defaultOptions:[xZ.meta.defaultOptions?.[0]],messages:x2,languages:["js/js"]}},x6="no-useless-coercion",x9=new o([["Boolean",{type:"boolean",isType:n6}],["String",{type:"string",isType:on}],["BigInt",{type:"bigint",isType:function(e,t){return!!e&&(!!("TSSatisfiesExpression"===e.type&&n5(e.typeAnnotation)||n4(e,t))||"bigint"==typeof e$(e,t.sourceCode.getScope(e))?.value)}}],["Number",{type:"number",isType:(e,t)=>n_(e,t.sourceCode.getScope(e))}]]),x5="no-useless-boolean-cast",x4=["every","filter","find","findIndex","findLast","findLastIndex","some"],x7="no-useless-continue",be="no-useless-override",bt=e=>e.isUnion()?e.types.every(e=>bt(e)):"void"===e.intrinsicName||"undefined"===e.intrinsicName,br=(e,t)=>{let{parserServices:r}=t.sourceCode;if(r?.program)try{return{type:r.getTypeAtLocation(e),checker:r.program.getTypeChecker()}}catch{}},bn="prefer-has-check",bo=new i(["Map","ReadonlyMap","WeakMap"]),ba=new i(["Map","WeakMap"]),bi=new i(["FormData","Headers","URLSearchParams"]),bs=new i(["Array","ReadonlyArray"]),bl=ba.union(bi),bu=new i(["ClassName","ImportBinding","TSEnumName","Type"]),bp=new i(["any","bigint","boolean","false","number","string","unknown","undefined","null","void"]),bc=new i(["TSTypeAnnotation","TSParenthesizedType"]),bd=new i(["TSAnyKeyword","TSNeverKeyword","TSUndefinedKeyword","TSUnknownKeyword","TSVoidKeyword"]),bm=new i(["TSBigIntKeyword","TSBooleanKeyword","TSNumberKeyword","TSStringKeyword"]),bf=new i(["TSArrayType","TSConstructorType","TSFunctionType","TSObjectKeyword","TSSymbolKeyword","TSTupleType"]),bg=new i(["ArrayExpression","ArrowFunctionExpression","ClassExpression","FunctionExpression","NewExpression","ObjectExpression"]),by=new i(["ParenthesizedExpression","TSAsExpression","TSSatisfiesExpression","TSTypeAssertion","TSNonNullExpression"]),bh=e=>{for(;by.has(e.type);)e=e.expression;return e},bx=e=>{if("Identifier"===e.type)return e.name;if("TSQualifiedName"===e.type){let t=bx(e.left);return t?`${t}.${e.right.name}`:void 0}},bb=e=>e.typeArguments?.params??e.typeParameters?.params??[],bE=(e,t)=>{for(;t;){let r=t.set.get(e)?.defs.find(e=>bu.has(e.type));if(r)return r;t=t.upper}},bv=e=>{if(e?.type==="Type"&&"TSTypeAliasDeclaration"===e.node.type&&0===bb(e.node).length)return e.node.typeAnnotation},bC=(e,t)=>{if(t.sourceCode.isGlobalReference(e))return!0;let r=ey(t.sourceCode.getScope(e),e);return!r||0===r.defs.length},bD=(e,t)=>tP(e)&&bC(e,t)||"UnaryExpression"===e.type&&"void"===e.operator&&"Literal"===e.argument.type&&0===e.argument.value,bS=(e,t)=>bo.has(e)?{kind:"map",typeName:e,valueType:t}:bi.has(e)?{kind:"null-sentinel",typeName:e}:void 0,bT=(e,t,r=new i)=>{switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return bT(e.typeAnnotation,t,r);case"TSTypeOperator":return"readonly"===e.operator?bT(e.typeAnnotation,t,r):void 0;case"TSTypeReference":{let n=bx(e.typeName);if(!n)return;if((bo.has(n)||bi.has(n))&&!bE(n,t))return bS(n,bb(e).at(-1));let o=((e,t,r)=>{if(!r.has(e))return r.add(e),bv(bE(e,t))})(n,t,r);return o?bT(o,t,r):void 0}}},bA=(e,t)=>{let r=t.sourceCode.getScope(e);return bT(e.typeAnnotation,r)},bw=(e,t,r=new i)=>{let n=bA(e,t);if(n)return n;if(tf(e=bh(e))&&"Identifier"===e.callee.type&&bl.has(e.callee.name)&&bC(e.callee,t))return bS(e.callee.name);if("Identifier"!==e.type)return;let o=ey(t.sourceCode.getScope(e),e);if(!o||r.has(o)||1!==o.defs.length)return;r.add(o);let[a]=o.defs,s=bT(a.name?.typeAnnotation,t.sourceCode.getScope(a.name));return s||("Variable"===a.type&&"const"===a.parent.kind&&a.node.id===a.name&&a.node.init?bw(a.node.init,t,r):void 0)},bk=(e,t)=>{for(let r of[e,e.target]){if(!r)continue;let e=r2(r);if(r3(e,t))return e.getName()}},bI=(e,t,r)=>{if(r0.has(e.intrinsicName)||r1.has(e.intrinsicName))return;if(e.isUnion()){let n=e.types.map(e=>bI(e,t,r));if(1===new i(n.map(e=>e?.typeName)).size){let[e]=n;if(e?.kind!=="map")return e;let r=n.map(e=>e?.valueType);return{...e,valueType:r.every(Boolean)?t.getUnionType(r):void 0}}if(n.every(e=>e?.kind==="map")){let e=n.map(e=>e.valueType);return{kind:"map",typeName:"Map",valueType:e.every(Boolean)?t.getUnionType(e):void 0}}return n.every(e=>e?.kind==="null-sentinel")?{kind:"null-sentinel",typeName:"null-sentinel"}:void 0}if(e.isIntersection())return e.types.map(e=>bI(e,t,r)).find(e=>e?.kind==="map");let n=bk(e,r);return bS(n,bo.has(n)?t.getTypeArguments(e).at(-1):void 0)},bj=(e,t)=>{let{parserServices:r}=t.sourceCode;if(r?.program)try{let{program:t}=r;return bI(r.getTypeAtLocation(e),t.getTypeChecker(),t)}catch{}},bF=(e,t)=>bj(e,t)??bw(e,t),bB=(e,t)=>"truthy"===t?!!e:"not-undefined"===t?void 0!==e:null!=e,bR=(e,t,r,n=new i)=>{if(!e||bd.has(e.type))return!1;if(bc.has(e.type))return bR(e.typeAnnotation,t,r,n);if("TSTypeOperator"===e.type)return"readonly"===e.operator&&bR(e.typeAnnotation,t,r,n);if("TSUnionType"===e.type||"TSIntersectionType"===e.type)return e.types.every(e=>bR(e,t,r,n));if("TSNullKeyword"===e.type)return"not-undefined"===r;if(bm.has(e.type))return"truthy"!==r;if(bf.has(e.type))return!0;if("TSTypeLiteral"===e.type)return"truthy"!==r;if("TSLiteralType"===e.type){var o;let t="Literal"===(o=e.literal).type?o.value:"TemplateLiteral"===o.type&&0===o.expressions.length?o.quasis[0].value.cooked:"UnaryExpression"===o.type&&("-"===o.operator||"+"===o.operator)&&"Literal"===o.argument.type&&("number"==typeof o.argument.value||"bigint"==typeof o.argument.value)?"-"===o.operator?-o.argument.value:o.argument.value:void 0;return void 0!==t&&bB(t,r)}return"TSTypeReference"===e.type&&((e,t,r,n)=>{let o,a,i=bx(e.typeName);if(!i||n.has(i))return!1;n.add(i);let s=(a=bv(o=bE(i,t.sourceCode.getScope(e.typeName))))?{type:"alias",node:a}:o?.type==="ClassName"||o?.type==="Type"&&"TSInterfaceDeclaration"===o.node.type?{type:"object"}:void 0,l=!1;return s?.type==="alias"?l=bR(s.node,t,r,n):s?.type==="object"&&(l="truthy"!==r),n.delete(i),l})(e,t,r,n)},bP=(e,t)=>e.isTypeParameter?.()?e.getConstraint()??t.getBaseConstraintOfType(e):e,bL=(e,t,r)=>{if(r0.has(e.intrinsicName))return!1;let n=bP(e,t);return n&&n!==e?bL(n,t,r):!e.isTypeParameter?.()&&(e.isUnion()||e.isIntersection()?e.types.every(e=>bL(e,t,r)):!r.has(e.intrinsicName))},bN=(e,t,r)=>{if(r0.has(e.intrinsicName)||r1.has(e.intrinsicName))return!1;let n=bP(e,t);if(n&&n!==e)return bN(n,t,r);if(e.isUnion()||e.isIntersection())return e.types.every(e=>bN(e,t,r));if(bp.has(e.intrinsicName))return!1;if("true"===e.intrinsicName||"symbol"===e.intrinsicName)return!0;if(e.isStringLiteral?.())return e.value.length>0;if(e.isNumberLiteral?.())return 0!==e.value;if(e.isBigIntLiteral?.())return e.value.negative||"0"!==e.value.base10Value;let o=t.typeToString(e);return/^-?\d+n$/u.test(o)?!/^-?0n$/u.test(o):"object"===t.typeToString(e)||bs.has(bk(e,r))||e.getCallSignatures().length>0||e.getConstructSignatures().length>0},b$=(e,t,r)=>{if(!tf(e)||"Identifier"!==e.callee.type||!ba.has(e.callee.name)||!bC(e.callee,t))return;if(0===e.arguments.length)return!0;if(1!==e.arguments.length)return;let[n]=e.arguments;if("ArrayExpression"===n.type)return n.elements.every(e=>{var n;let o;return e?.type==="ArrayExpression"&&e.elements.length>=2&&e.elements[1]&&"SpreadElement"!==e.elements[1].type&&(n=e.elements[1],(o=e$(n,t.sourceCode.getScope(n)))?bB(o.value,r):!tP(n)&&bg.has(n.type))})},bM=(e,t,r)=>{let n=b$(bh(e),t,r);if(void 0!==n)return n;let o=bj(e,t)?.valueType;if(o){let{program:e}=t.sourceCode.parserServices,n=e.getTypeChecker();if("truthy"===r?bN(o,n,e):"not-undefined"===r?bL(o,n,new i(["undefined","void"])):bL(o,n,new i(["undefined","void","null"])))return!0}return function e(t,r,n,o={}){let a,s=o.visitedVariables??new i,l=o.checkConstructorValues??!0,u=bA(t,r);if(u?.kind==="map")return!!u.valueType&&bR(u.valueType,r,n);let p=((e,t,r,n)=>{if(!tf(e)||"Identifier"!==e.callee.type||!ba.has(e.callee.name)||!bC(e.callee,t))return;if(n){let n=b$(e,t,r);if(void 0!==n)return n}let o=bb(e).at(-1);return!!o&&bR(o,t,r)})(t=bh(t),r,n,l);if(void 0!==p)return p;let c=((e,t,r)=>{if("Identifier"!==e.type)return;let n=ey(t.sourceCode.getScope(e),e);if(!(!n||r.has(n))&&1===n.defs.length)return n})(t,r,s);if(!c)return!1;s.add(c);let[d]=c.defs,m=(a=bT(d.name?.typeAnnotation,r.sourceCode.getScope(d.name)),a?.kind==="map"?!!a.valueType&&bR(a.valueType,r,n):"Variable"===d.type&&"const"===d.parent.kind&&d.node.id===d.name&&!!d.node.init&&e(d.node.init,r,n,{visitedVariables:s,checkConstructorValues:!1}));return s.delete(c),m}(e,t,r)},bO="logical",bU="ternary",bq="consistent-conditional-object-spread",bV=new i(["==","==="]),bW=new i(["!=","!=="]),b_=e=>tx(e)||tP(e)||ti(e),bz=e=>"SpreadElement"===e.parent.type&&e.parent.argument===e&&"ObjectExpression"===e.parent.parent.type&&e.parent.parent.properties.includes(e.parent);function bK(e,t,r){if(rC(e,t))return!0;if(e.type!==t.type)return!1;switch(e.type){case"AwaitExpression":return bK(e.argument,t.argument,r);case"LogicalExpression":return e.operator===t.operator&&bK(e.left,t.left,r)&&bK(e.right,t.right,r);case"UnaryExpression":return e.operator===t.operator&&e.prefix===t.prefix&&bK(e.argument,t.argument,r);case"UpdateExpression":return!1}return r.getText(e)===r.getText(t)}function bG(e){return ti(e)?"null":tP(e)?"undefined":void 0}function bJ(e){if("BinaryExpression"!==e.type||!bV.has(e.operator)&&!bW.has(e.operator))return;let t=bG(e.left),r=bG(e.right);if(!!t!=!!r)return{reference:t?e.right:e.left,kind:2===e.operator.length?"nullish":t??r,isTrueWhenNullish:bV.has(e.operator)}}let bX=(e,t)=>"null"===e.kind&&"undefined"===t.kind||"undefined"===e.kind&&"null"===t.kind;function bY(e,t){let r=bJ(e);if(r?.kind==="nullish")return r;if("LogicalExpression"!==e.type)return;let n=bJ(e.left),o=bJ(e.right);if(n&&o&&bK(n.reference,o.reference,t)){if("||"===e.operator&&n.isTrueWhenNullish&&o.isTrueWhenNullish&&bX(n,o))return{reference:n.reference,isTrueWhenNullish:!0};if("&&"===e.operator&&!n.isTrueWhenNullish&&!o.isTrueWhenNullish&&bX(n,o))return{reference:n.reference,isTrueWhenNullish:!1}}}function bH(e,t,r){let n=e4(e,r);return!e7(e,r)&&o3(e,{operator:"&&",property:t})&&(n=`(${n})`),n}function bQ(e,t){let r=e4(e,t);return!e7(e,t)&&oY(e)&&(r=`(${r})`),r}let bZ="default-export-style/inline",b0="default-export-style/separate",b1="default-export-style/suggestion-inline",b2="default-export-style/suggestion-separate",b3="inline",b8="separate",b6="ignore",b9="class",b5="function",b4=()=>({enum:[b3,b8,b6]}),b7=(e,t)=>e?.type==="ExportDefaultDeclaration"&&"Identifier"===e.declaration.type&&e.declaration.name===t,Ee=e=>e.id?.name,Et=e=>{switch(e.type){case"ClassDeclaration":return b9;case"FunctionDeclaration":return b5}},Er=e=>e===b9?"classes":"functions",En=(e,t)=>{let[,r]=e.sourceCode.getRange(t),n=e.sourceCode.getLoc(t).end.line;return rB(e).some(t=>e.sourceCode.getRange(t)[0]>=r&&e.sourceCode.getLoc(t).start.line===n)},Eo=(e,t)=>ey(e,t)?.references.some(e=>!e.init&&e.isWrite())??!1,Ea=e=>!!e&&!!(e.type.startsWith("TS")||e.typeAnnotation||e.typeParameters||e.returnType||e.implements?.length>0||e.superTypeArguments||e.accessibility||e.readonly||e.override||e.definite||e.optional&&"MemberExpression"!==e.type&&"CallExpression"!==e.type||e.abstract||e.declare||e.decorators?.length>0),Ei=(e,t)=>{if(Ea(e))return!0;for(let r of t[e.type]??[]){let n=e[r];if(Array.isArray(n)){if(n.some(e=>e?.type&&Ei(e,t)))return!0;continue}if(n?.type&&Ei(n,t))return!0}return!1},Es=(e,t)=>e.params.every(e=>!rX(e,t.sourceCode.visitorKeys)),El=(e,t,r)=>ey(e,t)?.references.some(e=>!e.init&&e.identifier!==r)??!1,Eu=(e,t)=>{let r=Ee(e);if(r){let t=Et(e);return t&&{kind:t,name:r,declaration:e}}let n=((e,t)=>{if("VariableDeclaration"!==e.type||"const"!==e.kind||1!==e.declarations.length)return;let[r]=e.declarations;if(!("Identifier"!==r.id.type||Ea(r.id)||r.init?.type!=="ArrowFunctionExpression"||Ei(r.init,t.sourceCode.visitorKeys)))return r})(e,t);if(n)return{kind:b5,name:n.id.name,declaration:e,functionNode:n.init}},Ep=(e,t)=>e.params.map(e=>t.getText(e)).join(", "),Ec=({context:e,declaration:t,exportDeclaration:r,name:n,scope:o,rangeStartNode:a=t})=>{if(!(e.sourceCode.getCommentsInside(r).length>e.sourceCode.getCommentsInside(t).length||El(o,t.id,"Identifier"===r.declaration.type?r.declaration:void 0))&&"FunctionDeclaration"===t.type&&!t.generator&&!Ei(t,e.sourceCode.visitorKeys)&&0===e.sourceCode.getCommentsInside(t).length&&Es(t,e)&&!rX(t.body,e.sourceCode.visitorKeys))return[{messageId:b2,fix:o=>o.replaceTextRange([e.sourceCode.getRange(a)[0],e.sourceCode.getRange(r)[1]],`const ${n} = ${t.async?"async ":""}(${Ep(t,e.sourceCode)}) => ${e.sourceCode.getText(t.body)};
|
|
44
|
+
export default ${n};`)}]},Ed=({context:e,declaration:t,exportDeclaration:r,expectedStyle:n,kind:o,name:a,scope:i})=>{if(!(n===b6||((e,t,r)=>{let[,n]=e.sourceCode.getRange(t),[o]=e.sourceCode.getRange(r);return rB(e).some(t=>{let[r,a]=e.sourceCode.getRange(t);return r>=n&&a<=o})})(e,t,r)||Eo(i,r.declaration))&&(o!==b5||"FunctionDeclaration"!==t.type||!t.generator)&&!(o===b5&&"FunctionDeclaration"===t.type&&Ei(t,e.sourceCode.visitorKeys))){if(n===b3)return"VariableDeclaration"===t.type?{node:r,messageId:bZ,data:{kind:o},suggest:(({context:e,declaration:t,exportDeclaration:r,name:n,scope:o})=>{let[{id:a,init:i}]=t.declarations;if(!(e.sourceCode.getCommentsInside(r).length>0||En(e,r)||e.sourceCode.getCommentsInside(t).length>e.sourceCode.getCommentsInside(i).length||El(o,a,r.declaration))&&"ArrowFunctionExpression"===i.type&&!Ei(i,e.sourceCode.visitorKeys)&&0===e.sourceCode.getCommentsInside(i).length&&Es(i,e)&&!rX(i.body,e.sourceCode.visitorKeys))return[{messageId:b1,data:{kind:b5},fix:o=>o.replaceTextRange([e.sourceCode.getRange(t)[0],e.sourceCode.getRange(r)[1]],`export default ${i.async?"async ":""}function ${n}(${Ep(i,e.sourceCode)}) ${"BlockStatement"===i.body.type?e.sourceCode.getText(i.body):`{ return ${e4(i.body,e)}; }`}`)}]})({context:e,declaration:t,exportDeclaration:r,name:a,scope:i})}:o===b9&&Ei(t,e.sourceCode.visitorKeys)?void 0:e.sourceCode.getCommentsInside(r).length>0||En(e,r)?{node:r,messageId:bZ,data:{kind:o}}:{node:r,messageId:bZ,data:{kind:o},fix:function*(n){yield n.insertTextBefore(t,"export default "),yield n.removeRange([e.sourceCode.getRange(t)[1],e.sourceCode.getRange(r)[1]])}};if(n===b8&&o===b5&&"FunctionDeclaration"===t.type)return{node:r,messageId:b0,data:{kind:o,style:"const arrow function"},suggest:Ec({context:e,declaration:t,exportDeclaration:r,name:a,scope:i})}}},Em=({context:e,exportDeclaration:t,expectedStyle:r,kind:n})=>{let{declaration:o}=t,a=Ee(o),i=e.sourceCode.getScope(t);if(!(!a||r===b6||r===b3||Eo(i,a)||n===b5&&(o.generator||Ei(o,e.sourceCode.visitorKeys)))){if(n===b5)return{node:t,messageId:b0,data:{kind:n,style:"const arrow function"},suggest:Ec({context:e,declaration:o,exportDeclaration:t,name:a,scope:i,rangeStartNode:t})};if(!(n===b9&&Ei(o,e.sourceCode.visitorKeys)))return e.sourceCode.getCommentsInside(t).length>e.sourceCode.getCommentsInside(o).length?{node:t,messageId:b0,data:{kind:n,style:"class declaration"}}:{node:t,messageId:b0,data:{kind:n,style:"class declaration"},fix:r=>{let{declaration:n}=t;return r.replaceText(t,`${e.sourceCode.getText(n)}
|
|
45
|
+
export default ${n.id.name};`)}}}},Ef={create:e=>{let t=e.options[0];e.on("Program",r=>{for(let[n,o]of r.body.entries()){if("ExportDefaultDeclaration"===o.type){let{declaration:r}=o,n=Et(r),a=Ee(r);if(!n||!a)continue;let i=Em({context:e,exportDeclaration:o,expectedStyle:t[Er(n)],kind:n});if(i)return i;continue}let a=r.body[n+1],i=Eu(o,e);if(!i||!b7(a,i.name))continue;let s=Ed({context:e,exportDeclaration:a,expectedStyle:t[Er(i.kind)],scope:e.sourceCode.getScope(a),...i});if(s)return s}})},meta:{type:"suggestion",docs:{description:"Enforce consistent default export declarations.",recommended:!0},fixable:"code",hasSuggestions:!0,schema:[{type:"object",properties:{functions:b4(),classes:b4()},additionalProperties:!1}],defaultOptions:[{functions:b3,classes:b3}],messages:{[bZ]:"Prefer declaring this default-exported {{kind}} inline.",[b0]:"Prefer declaring this default-exported {{kind}} as a separate {{style}}.",[b1]:"Use an inline default {{kind}} declaration.",[b2]:"Use a separate const arrow function default export."},languages:["js/js"]}};function Eg(e){for(;;){let t=rj(e);if(t!==e){e=t;continue}if(e?.type!=="ParenthesizedExpression")return e;e=e.expression}}function Ey(e,t){return ey(t.sourceCode.getScope(e),e)}let Eh="no-array-concat-in-loop",Ex="no-array-front-mutation",Eb=["stream.unshift","this.unshift","this.stream.unshift","process.stdin.unshift","process.stdout.unshift","process.stderr.unshift"],EE="no-array-sort-for-min-max/error",Ev="no-array-sort-for-min-max/suggestion",EC=e=>to(e)&&0===e.value,ED=(e,t)=>{if(!tw(e,{methods:["sort","toSorted"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||nv(e.callee.object,t)||rY(e.callee.object))return;let[r]=e.arguments,n=(e=>{if(!tv(e)||e.async||e.generator||2!==e.params.length||e.params.some(e=>"Identifier"!==e.type))return;let t=rj((e=>{if("BlockStatement"!==e.body.type)return e.body;if(1!==e.body.body.length)return;let[t]=e.body.body;if("ReturnStatement"===t.type)return t.argument})(e));if(t?.type!=="BinaryExpression"||"-"!==t.operator)return;let[r,n]=e.params;if(r.name!==n.name){if(rC(t.left,r)&&rC(t.right,n))return"ascending";if(rC(t.left,n)&&rC(t.right,r))return"descending"}})(r);if(n)return{direction:n,node:e.callee.object}},ES=(e,t,r,n)=>{var o,a,i;let s=(o=t.direction,"first"===r?"ascending"===o?"min":"max":"ascending"===o?"max":"min"),l={node:e,messageId:EE,data:{method:s,extreme:"min"===s?"minimum":"maximum"}};if("Super"!==t.node.type&&0===n.sourceCode.getCommentsInside(e).length){let r,o=(a=t.node,i=n.sourceCode,r=ox(a)?i.getText(a):`(${i.getText(a)})`,`Math.${s}(...${r})`);l.suggest=[{messageId:Ev,data:{replacement:o},fix:t=>t.replaceText(e,o)}]}return l},ET="no-boolean-sort-comparator",EA="no-boolean-sort-comparator/suggestion",Ew=new i(["sort","toSorted"]),Ek=new i([">",">=","<","<="]),EI=(e,t,r,n)=>(e=rj(e),t=rj(t),"Identifier"===e.type&&"Identifier"===t.type)?e.name===r.name&&t.name===n.name||e.name===n.name&&t.name===r.name:"MemberExpression"===e.type&&"MemberExpression"===t.type&&e.computed===t.computed&&(e.computed?!!rC(e.property,t.property):e.property.name===t.property.name)&&EI(e.object,t.object,r,n),Ej=(e,t)=>{for(;rI(e);){if(e.typeAnnotation&&n1(e.typeAnnotation,t,t.sourceCode.getScope(e)))return!0;e=e.expression}return!1},EF="no-chained-comparison/error",EB="no-chained-comparison/suggestion",ER=new i(["<",">","<=",">="]),EP=new i(["===","!==","==","!="]),EL=ER.union(EP),EN=e=>"BinaryExpression"===e.type&&EL.has(e.operator),E$="no-constant-zero-expression/error",EM="no-constant-zero-expression/suggestion",EO="no-duplicate-logical-operands",EU="no-duplicate-logical-operands/suggestion",Eq=new i(["Identifier","ThisExpression","Literal"]),EV=new i(["Identifier","ThisExpression"]),EW=e=>{if(uE(e=rj(e)))return!1;switch(e.type){case"Identifier":case"Super":case"ThisExpression":return!0;case"MemberExpression":var t;return EW(e.object)&&(!e.computed||(t=rj(t=e.property),Eq.has(t.type)));default:return!1}},E_="no-impossible-length-comparison",Ez={"<":">","<=":">=",">":"<",">=":"<=","===":"===","!==":"!==","==":"==","!=":"!="},EK="no-invalid-character-comparison",EG=new i(["==","===","!=","!=="]),EJ=(e,t)=>!!(tw(e,{method:"charAt",maximumArguments:1,optionalCall:!1,optionalMember:!1})&&on(e.callee.object,t)||tw(e,{method:"at",maximumArguments:1,optionalCall:!1,optionalMember:!1})&&on(e.callee.object,t))||"MemberExpression"===e.type&&e.computed&&!e.optional&&(e=>{if(to(e))return!0;if(!tt(e))return!1;let t=Number(e.value);return Number.isSafeInteger(t)&&t>=0&&String(t)===e.value})(e.property)&&on(e.object,t),EX="no-loop-iterable-mutation",EY=["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"],EH=["add","clear","delete"],EQ=["clear","delete","set"],EZ={array:new i(EY),set:new i(EH),map:new i(EQ),unknown:new i([...EY,...EH,...EQ])},E0=new i(["entries","keys","values"]),E1=new i(["ArrowFunctionExpression","ClassDeclaration","ClassExpression","FunctionDeclaration","FunctionExpression"]);function E2(e,t){return nE(e,t)?"array":nk(e,t)?"set":nI(e,t)?"map":void 0}function E3(e){return"VariableDeclaration"===e.left.type?e.left.declarations[0].id:e.left}function E8(e){return"Identifier"===(e=rj(e)).type?e:void 0}function E6(e){if("ArrayPattern"!==(e=rj(e)).type)return;let[t]=e.elements;return t&&E8(t)}function E9(e,t){if(uE(e=rj(e)))return;if(ub(e))return{collectionKind:E2(e,t),reference:e,method:"direct"};if("CallExpression"!==e.type||"MemberExpression"!==e.callee.type||e.arguments.length>0)return;let r=eO(e.callee,t.sourceCode.getScope(e.callee));if(!(!E0.has(r)||uE(e.callee.object))&&ub(e.callee.object))return{collectionKind:E2(e.callee.object,t),reference:e.callee.object,method:r}}function E5(e,t){let r=E3(e);return"keys"===t.method?E8(r):"entries"===t.method||"direct"===t.method&&"set"!==t.collectionKind?E6(r):void 0}function E4(e,t){let r,n;if("VariableDeclaration"!==e.left.type||"const"!==e.left.kind)return{collectionKind:t.collectionKind,iterable:t.reference,loopBody:e.body};let o=(r=E3(e),"entries"===t.method?E6(r):"direct"!==t.method||"map"!==t.collectionKind?E8(r):void 0),a=E5(e,t),i=(n=E3(e),"set"===t.collectionKind&&("direct"===t.method||"values"===t.method)?E8(n):"direct"===t.method&&"map"!==t.collectionKind?E8(n)??E6(n):E5(e,t));return{addArgumentIdentifier:o,collectionKind:t.collectionKind,deleteArgumentIdentifier:i,iterable:t.reference,loopBody:e.body,setKeyIdentifier:a}}function*E7(e){"Identifier"===(e=rj(e)).type?yield e:"MemberExpression"===e.type&&(yield*E7(e.object),e.computed&&(yield*E7(e.property)))}function ve(e,t,r){if(!ux(e,t))return!1;let n=[...E7(e)],o=[...E7(t)];return n.length!==o.length||0===n.length?n.length===o.length:n.every((e,t)=>{var n;let a,i;return n=o[t],a=ey(r.sourceCode.getScope(e),e),i=ey(r.sourceCode.getScope(n),n),a||i?a===i:e.name===n.name})}function vt(e,t,r){let[n]=e.arguments;return!!(t&&n&&ve(n,t,r))}function vr(e,t,r,n){return"add"===r&&vt(e,t.addArgumentIdentifier,n)||"set"===r&&vt(e,t.setKeyIdentifier,n)}let vn="no-selector-as-dom-name",vo=["add","remove","contains","toggle","replace"],va=/^[#.]-?[A-Z_a-z][\w-]*$/u,vi=new i([".","#"]),vs=e=>vi.has(e?.[0]),vl=e=>tn(e)??("TemplateLiteral"===e.type&&e.quasis[0].value.cooked),vu=(e,t,r,n)=>({node:e,messageId:vn,fix:((e,t,r,n)=>{let o=((e,t)=>{let[r]=t.getRange(e);return[r+1,r+2]})(e,n);if(t.startsWith(r)&&n.text[o[0]]===r){if("TemplateLiteral"===e.type&&e.expressions.length>0){if(1!==e.expressions.length||e.quasis[0].value.cooked!==r||""!==e.quasis[1].value.cooked)return;return e=>e.removeRange(o)}if(va.test(t))return e=>e.removeRange(o)}})(e,t,r,n)}),vp=(e,t)=>e.map(e=>({node:e,expectedPrefix:t})),vc="no-useless-compound-assignment/error",vd="no-useless-compound-assignment/remove",vm="no-useless-compound-assignment/replace",vf=new o([["+=",0],["-=",0],["*=",1],["/=",1],["**=",1]]),vg="no-useless-delete-check",vy="removeCheck",vh={considerGetters:!0},vx=new i(["Map","Set","WeakMap","WeakSet"]),vb=new i(["ArrayExpression","ArrowFunctionExpression","ClassExpression","FunctionExpression","ObjectExpression"]),vE=new i(["ClassName","FunctionName"]),vv=new i(["TSConstructorType","TSFunctionType","TSObjectKeyword"]),vC=e=>null!==e&&("object"==typeof e||"function"==typeof e),vD=e=>!!vv.has(e?.type)||e?.type==="TSUnionType"&&e.types.every(e=>vD(e)),vS=(e,t)=>{if("Identifier"!==e.type)return!1;let r=ey(t.sourceCode.getScope(e),e);return r?.defs.some(e=>vE.has(e.type))??!1},vT=(e,t)=>{let r=e$(e,t.sourceCode.getScope(e));return r&&"symbol"!=typeof r.value&&!vC(r.value)?String(r.value):void 0},vA=(e,t)=>{let r=e$(e,t.sourceCode.getScope(e));if(r)return vC(r.value);let n=rq(rj(e),t);if(n){let e=rj(n),r=e$(e,t.sourceCode.getScope(e));if(r)return vC(r.value);if(vb.has(e.type))return!0}return!vS(rj(e),t)&&vD(((e,t)=>{if("Identifier"!==(e=rj(e)).type)return;let r=ey(t.sourceCode.getScope(e),e);return r?.defs[0]?.name?.typeAnnotation?.typeAnnotation??e.typeAnnotation?.typeAnnotation})(e,t))},vw=(e,t)=>!ez(e,t.sourceCode,vh),vk=(e,t)=>tw(e,{method:t,argumentsLength:1,computed:!1,optionalCall:!1,optionalMember:!1,allowSpreadElement:!1}),vI=(e,t,r)=>n=>{if(r$(r,r.sourceCode.getRange(e)))return;let o=r.sourceCode.getText(t.parent);return o.trimEnd().endsWith(";")||(o+=";"),oD(r.sourceCode.getTokenBefore(e),r,o)&&(o=`;${o}`),n.replaceText(e,o)},vj="no-useless-logical-operand",vF=new o([["&&",!0],["||",!1]]),vB=new o([["&&",!1],["||",!0]]),vR=new i(["FunctionExpression","ClassExpression","ObjectExpression"]),vP="prefer-boolean-return",vL=new i(["==","!=","===","!==","<","<=",">",">=","in","instanceof"]);function vN(e){if(e){if("BlockStatement"===e.type){let t=e.body.filter(({type:e})=>"EmptyStatement"!==e);if(1===t.length)return vN(t[0])}return e}}let v$=e=>{if(e?.type==="ReturnStatement"&&e.argument?.type==="Literal"&&"boolean"==typeof e.argument.value)return e.argument.value};function vM(e,t){switch(e.type){case"Literal":return"boolean"==typeof e.value;case"UnaryExpression":return["!","delete"].includes(e.operator);case"BinaryExpression":return vL.has(e.operator);case"LogicalExpression":return vM(e.left,t)&&vM(e.right,t);case"CallExpression":return tU(e,t)||"CallExpression"===e.type&&!e.optional&&"MemberExpression"===e.callee.type&&!e.callee.optional&&!e.callee.computed&&"Identifier"===e.callee.object.type&&"Array"===e.callee.object.name&&t.sourceCode.isGlobalReference(e.callee.object)&&"Identifier"===e.callee.property.type&&"isArray"===e.callee.property.name;default:return!1}}let vO="prefer-flat-math-min-max",vU=["min","max"],vq=(e,t)=>tw(e,{object:"Math",method:t,optionalCall:!1,optionalMember:!1}),vV=(e,t)=>{let r=[];for(let n of e.arguments){if(vq(n,t)){r.push(...vV(n,t));continue}r.push(n)}return r},vW="prefer-hoisting-branch-code/start",v_="prefer-hoisting-branch-code/end",vz="prefer-hoisting-branch-code/suggestion",vK=new i(["await using","using"]),vG=(e,t)=>ez(e,t)||function e(t,r){if("TaggedTemplateExpression"===t.type)return!0;for(let n of r.visitorKeys[t.type]??[]){let o=t[n];if(Array.isArray(o)){for(let t of o)if(t&&e(t,r))return!0;continue}if(o&&e(o,r))return!0}return!1}(e,t),vJ=(e,t)=>{let r=t.getTokens(e),n=r.at(-1);return n?.type==="Punctuator"&&";"===n.value?r.slice(0,-1):r},vX=(e,t,r)=>{let n=vJ(e,r),o=vJ(t,r);return 0!==n.length&&n.length===o.length&&n.every((e,t)=>e.type===o[t].type&&e.value===o[t].value)};function vY(e,{leading:t,trailing:r,isStart:n},o){let{sourceCode:a}=o,{body:i}=e;if(n){let[e]=a.getRange(i[0]),[r]=a.getRange(i[t]);return[e,r]}let[,s]=a.getRange(i[i.length-r-1]),[,l]=a.getRange(i.at(-1));return[s,l]}function vH({ifStatement:e,blocks:t,leading:r,trailing:n,isStart:o},a){var i;let{sourceCode:s}=a,l=t[0].body,u=o?l.slice(0,r):l.slice(l.length-n),p=u.every(e=>!rU(e))&&function(e){let{parent:t}=e;return["Program","BlockStatement","StaticBlock","SwitchCase"].includes(t.type)}(e)&&!((i={leading:r,trailing:n,isStart:o}).isStart&&((e,t)=>{let{sourceCode:r}=t,[n]=r.getRange(e),o=r.getTokenBefore(e);return r$(t,[o?r.getRange(o)[1]:0,n])})(e,a)||!i.isStart&&((e,t)=>{let{sourceCode:r}=t,n=r.getCommentsAfter(e)[0];return!!(n&&r.getLoc(n).start.line===r.getLoc(e).end.line)})(e,a)||t.some(e=>{let{sourceCode:t}=a,[r]=t.getRange(e),[n]=t.getRange(e.body[0]);if(i.isStart&&r$(a,[r+1,n]))return!0;if(!i.isStart){let[,r]=t.getRange(e.body.at(-1)),[,n]=t.getRange(e);if(r$(a,[r,n-1]))return!0}return r$(a,vY(e,i,a))}))&&(o||t.every(e=>!function(e,t,r){let{sourceCode:n}=r,{body:o}=e,[a]=n.getRange(o[o.length-t]),[i,s]=n.getRange(e);for(let t of n.getScope(e).variables){let[e]=t.defs;if(!e||e.parent?.type==="VariableDeclaration"&&"var"===e.parent.kind)continue;let[r]=n.getRange(e.name);if(!(r<=i)&&!(r>=a)){if(e.parent?.type==="VariableDeclaration"&&vK.has(e.parent.kind))return!0;for(let e of t.references){let[t]=n.getRange(e.identifier);if(t>=a&&t<=s)return!0}}}return!1}(e,n,a))),c={loc:{start:s.getLoc(u[0]).start,end:s.getLoc(u.at(-1)).end},messageId:o?vW:v_};if(p){let i=function({ifStatement:e,blocks:t,leading:r,trailing:n,isStart:o},a){let{sourceCode:i}=a,s=rw(e,a),l=o?r:n,u=t[0].body,p=o?u.slice(0,l):u.slice(u.length-l),c=function(e,t,r){let{sourceCode:n}=r,[o]=n.getRange(e[0]),[,a]=n.getRange(e.at(-1)),i=n.text.slice(o,a),s=rw(e[0],r);return s===t?i:i.split("\n").map((e,r)=>0===r?e:e.startsWith(s)?`${t}${e.slice(s.length)}`:e).join("\n")}(p,s,a);return function*(l){if(o){let t=i.getTokenBefore(e),r=t&&oD(t,a,c)?";":"";yield l.insertTextBefore(e,`${r}${c}
|
|
46
|
+
${s}`)}else{let t=i.getLastToken(p.at(-1)),r=i.getTokenAfter(e),n=r&&oD(t,a,r.value)?";":"";yield l.insertTextAfter(e,`
|
|
47
|
+
${s}${c}${n}`)}for(let e of t)yield l.removeRange(vY(e,{leading:r,trailing:n,isStart:o},a))}}({ifStatement:e,blocks:t,leading:r,trailing:n,isStart:o},a);!o||function(e,t){for(let r=e;r?.type==="IfStatement";r=r.alternate)if(vG(r.test,t))return!1;return!0}(e,s)&&u.every(e=>"ExpressionStatement"===e.type&&!vG(e,s))?c.fix=i:c.suggest=[{messageId:vz,fix:i}]}return c}let{parse:vQ}=sf,vZ="prefer-single-replace",v0=new i(["g","m","s"]),v1=new o([["\\",String.raw`\\`],["]",String.raw`\]`],["\n",String.raw`\n`],["\r",String.raw`\r`],[" ",String.raw`\t`],["\f",String.raw`\f`],["\v",String.raw`\v`],["\u2028",String.raw`\u2028`],["\u2029",String.raw`\u2029`]]);function v2(e){if(!tw(e,{methods:["replace","replaceAll"],argumentsLength:2,optionalCall:!1,optionalMember:!1,computed:!1}))return;let[t]=e.arguments;if(tt(t)){if("replaceAll"!==e.callee.property.name)return;return 1===t.value.length?t.value:void 0}if(ta(t))return function({pattern:e,flags:t}){let r;if(t.includes("g")){for(let e of t)if(!v0.has(e))return;try{r=vQ(e,t,{namedGroups:!0,lookbehind:!0})}catch{return}return function e(t){return"value"===t.type?String.fromCodePoint(t.codePoint):("alternative"!==t.type||1!==t.body.length)&&("characterClass"!==t.type||t.negative||1!==t.body.length)?void 0:e(t.body[0])}(r)}}(t.regex)}let v3="consistent-tuple-labels",v8="no-invalid-well-known-symbol-methods/async-dispose",v6="no-invalid-well-known-symbol-methods/dispose-generator",v9="no-invalid-well-known-symbol-methods/sync-iterator",v5="no-invalid-well-known-symbol-methods/async-iterator",v4="no-invalid-well-known-symbol-methods/suggestion",v7=new i(["Promise","PromiseLike"]),Ce=new i(["dispose","iterator","asyncIterator"]);function Ct(e){return"TSTypeReference"===e.type&&"Identifier"===e.typeName.type&&v7.has(e.typeName.name)}function Cr(e,t){let r,n=function(e){if(e.computed&&"MemberExpression"===e.key.type&&!e.key.computed&&"Identifier"===e.key.object.type&&"Symbol"===e.key.object.name&&"Identifier"===e.key.property.type)return e.key.property.name}(e);if(!Ce.has(n))return;let o=function(e){if("get"!==e.kind&&"set"!==e.kind&&("MethodDefinition"===e.type||"PropertyDefinition"===e.type||"Property"===e.type))return e.value}(e);if(o?.type!=="FunctionExpression"&&o?.type!=="ArrowFunctionExpression")return;if("dispose"===n&&o.generator)return{node:e.key,messageId:v6};let a=!o.async&&(!!(r=o.returnType?.typeAnnotation)&&("TSTypeReference"===r.type?Ct(r):"TSUnionType"===r.type&&r.types.some(e=>Ct(e)))||function(e,t){let{parserServices:r}=t.sourceCode;if(!r?.program)return!1;try{let t=r.program.getTypeChecker(),n=r.esTreeNodeToTSNodeMap.get(e),o=t.getSignatureFromDeclaration(n);if(o)return!0===oc(t.getReturnTypeOfSignature(o),t);return r.getTypeAtLocation(e).getCallSignatures().some(e=>!0===oc(t.getReturnTypeOfSignature(e),t))}catch{return!1}}(o,t));if("dispose"===n&&(o.async||a))return{node:e.key,messageId:v8,fix:t=>t.replaceText(e.key.property,"asyncDispose")};if("iterator"===n&&(o.async||a)){let t={node:e.key,messageId:v9};return o.generator&&(t.suggest=[{messageId:v4,data:{replacement:"asyncIterator"},fix:t=>t.replaceText(e.key.property,"asyncIterator")}]),t}if("asyncIterator"===n&&!o.generator&&(o.async||a))return{node:e.key,messageId:v5}}let Cn="after-suspension",Co="in-generator",Ca="in-nested-function",Ci=["preventDefault","stopImmediatePropagation","stopPropagation"],Cs="prefer-abort-signal-timeout",Cl="prefer-abort-signal-timeout/suggestion",Cu=new i(["reason","throwIfAborted"]),Cp=(e,t)=>{let r,{parent:n}=e;if(!(!tT(n,{property:"signal",computed:!1,optional:!1})||n.object!==e||nL(n)||("ForInStatement"===n.parent.type||"ForOfStatement"===n.parent.type)&&n.parent.left===n||tT(n.parent)&&n.parent.object===n&&(r=n.parent,Cu.has(eO(r,t.sourceCode.getScope(r))))||(e=>{let{expression:t,parent:r}=(e=>{let t=e,{parent:r}=e;for(;rI(r);)t=r,r=r.parent;return{expression:t,parent:r}})(e);return"VariableDeclarator"===r.type&&r.init===t||"AssignmentExpression"===r.type&&r.right===t})(n)||r$(t,t.sourceCode.getRange(n))))return n},Cc=(e,t,r,n)=>{let o=ey(n.sourceCode.getScope(r),e);return o&&o!==t},Cd="prefer-aggregate-error",Cm=/[Ee]rrors$|[Ee]rror(?:List|Array|Collection)$/u,Cf=new i(s4);function Cg(e){for(;e?.type==="ParenthesizedExpression";)e=e.expression;return rj(e)}function Cy(e){if("Identifier"===e.type)return e.name;if("TSQualifiedName"===e.type){let t=Cy(e.left);return t?`${t}.${e.right.name}`:void 0}}function Ch(e){return e=e?.type==="TSTypeAnnotation"?e.typeAnnotation:e,e?.type==="TSTypeOperator"&&"readonly"===e.operator&&(e=e.typeAnnotation),e?.type==="TSParenthesizedType"?Ch(e.typeAnnotation):e}function Cx(e,t,r,n=new i){switch(e=Ch(e),e?.type){case"TSTypeReference":{let o=Cy(e.typeName);if(!o)return!1;let a=oA(o,t);if(Cf.has(o)&&!((a?.defs.length??0)>0))return!0;if(n.has(o))return!1;n.add(o);let[i]=a?.defs??[],s=i?r.sourceCode.getScope(i.name):t,l=i?.type==="Type"&&"TSTypeAliasDeclaration"===i.node.type&&Cx(i.node.typeAnnotation,s,r,n);return n.delete(o),l}case"TSUnionType":return e.types.every(e=>Cx(e,t,r,n));case"TSIntersectionType":return e.types.some(e=>Cx(e,t,r,n));default:return!1}}function Cb(e,t){let r;if(tT(e=Cg(e),{property:"length",optional:!1})&&"Identifier"===e.object.type&&(r=e.object.name,Cm.test(r))&&nE(e.object,t)&&function(e,t){let r=oA(e.name,t.sourceCode.getScope(e)),[n]=r?.defs??[],o=n?t.sourceCode.getScope(n.name):t.sourceCode.getScope(e);return function e(t,r,n,o=new i){switch(t=Ch(t),t?.type){case"TSArrayType":return Cx(t.elementType,r,n,o);case"TSTupleType":return t.elementTypes.length>0&&t.elementTypes.every(e=>Cx("TSNamedTupleMember"===e.type?e.elementType:"TSRestType"===e.type?e.typeAnnotation:e,r,n,o));case"TSTypeReference":return function(t,r,n,o){let a=Cy(t.typeName),i=t.typeArguments?.params??t.typeParameters?.params;if(("Array"===a||"ReadonlyArray"===a)&&i?.length===1)return Cx(i[0],r,n,o);if(!a||o.has(a))return!1;o.add(a);let s=oA(a,r),[l]=s?.defs??[],u=l?n.sourceCode.getScope(l.name):r,p=l?.type==="Type"&&"TSTypeAliasDeclaration"===l.node.type&&e(l.node.typeAnnotation,u,n,o);return o.delete(a),p}(t,r,n,o);case"TSUnionType":return t.types.every(t=>e(t,r,n,o));case"TSIntersectionType":return t.types.some(t=>e(t,r,n,o));default:return!1}}(n?.name?.typeAnnotation,o,t)||function(e,t){let{parserServices:r}=t.sourceCode;if(!r?.program)return!1;try{let{program:t}=r;return function e(t,r,n,o=new i){if(!t||o.has(t))return!1;if(o.add(t),t.isUnion())return t.types.every(t=>e(t,r,n,o));if(t.isIntersection())return t.types.some(t=>e(t,r,n,o));let a=r.getBaseConstraintOfType(t);if(a&&a!==t)return e(a,r,n,o);if(!(r.isArrayType(t)||r.isTupleType(t)))return!1;let s=r.getTypeArguments(t);return s.length>0&&s.every(e=>(function e(t,r,n,o=new i){if(!t||o.has(t))return!1;if(o.add(t),t.isUnion())return t.types.every(t=>e(t,r,n,o));if(t.isIntersection())return t.types.some(t=>e(t,r,n,o));let a=r.getBaseConstraintOfType(t);if(a&&a!==t)return e(a,r,n,o);let s=r2(t);return!!(Cf.has(s?.getName())&&r3(s,n))||r8(t,r).some(t=>e(t,r,n,o))})(e,r,n))}(r.getTypeAtLocation(e),t.getTypeChecker(),t)}catch{return!1}}(e,t)}(e.object,t))return e.object}let CE=(e,t,r)=>{var n;if(("!=="===e||"!="===e)&&te(Cg(t),0))return!0;let o=(n=Cg(n=t),n?.type==="Literal"&&"number"==typeof n.value?n.value:void 0);return void 0!==o&&(r?">"===e&&o>=0||">="===e&&o>=1:"<"===e&&o>=0||"<="===e&&o>=1)},Cv=e=>"LogicalExpression"!==(e=Cg(e)).type||"&&"!==e.operator?[e]:[...Cv(e.left),...Cv(e.right)],CC={resize:"Prefer ResizeObserver over a resize listener with layout reads.",scroll:"Prefer IntersectionObserver over a scroll listener with layout reads."},CD=new i(Object.keys(CC)),CS=new i(["globalThis","self","window"]),CT=new i(["getBoundingClientRect","getClientRects"]),CA=new i(["clientHeight","clientLeft","clientTop","clientWidth","offsetHeight","offsetLeft","offsetParent","offsetTop","offsetWidth","scrollHeight","scrollWidth"]),Cw=new i(["innerHeight","innerWidth"]),Ck=new i(["height","width"]),CI=new i(["Window"]),Cj=new i(["VisualViewport"]),CF=new i(["Document","Element","HTMLElement","Node","SVGElement","VisualViewport","Window"]),CB=(e,t,r)=>{let n;if(r0.has(e.intrinsicName))return!1;if(r1.has(e.intrinsicName)||e.intrinsicName)return!0;if(e.isUnion()||e.isIntersection())return e.types.every(e=>CB(e,t,r));let o=t.getBaseConstraintOfType(e);if(o&&o!==e)return CB(o,t,r);let a=r2(e);return!(!a||r8(e,t).some(e=>!CB(e,t,r)))&&(!r3(a,r)||(n=a.getName(),!(CF.has(n)||/^HTML\w*Element$/.test(n)||/^SVG\w*Element$/.test(n))))},CR=(e,t,r,n)=>{if(r0.has(e.intrinsicName)||r1.has(e.intrinsicName))return!1;if(e.isUnion()){let o=e.types.filter(e=>!r1.has(e.intrinsicName));return o.length>0&&o.every(e=>CR(e,t,r,n))}if(e.isIntersection())return e.types.some(e=>CR(e,t,r,n));let o=t.getBaseConstraintOfType(e);if(o&&o!==e)return CR(o,t,r,n);let a=r2(e);return!!(a&&r3(a,r)&&n.has(a.getName()))||r8(e,t).some(e=>CR(e,t,r,n))},CP=(e,t,r)=>{let{parserServices:n}=t.sourceCode;if(!n?.program)return!1;try{let{program:t}=n,o=t.getTypeChecker();return CR(n.getTypeAtLocation(e),o,t,r)}catch{return!1}},CL=(e,t)=>{let{parserServices:r}=t.sourceCode;if(!r?.program)return!1;try{let{program:t}=r,n=t.getTypeChecker();return CB(r.getTypeAtLocation(e),n,t)}catch{return!1}},CN=e=>e.computed||"Identifier"!==e.property.type?tn(rj(e.property)):e.property.name,C$=(e,t)=>e.properties.some(e=>t.has((e=>{if("Property"===e.type)return e.computed||"Identifier"!==e.key.type?tn(rj(e.key)):e.key.name})(e))),CM=(e,t)=>"Identifier"===e.type&&CS.has(e.name)&&of(e,t),CO=e=>nL(e)&&"UpdateExpression"!==e.parent.type&&("AssignmentExpression"!==e.parent.type||e.parent.left!==e||"="===e.parent.operator),CU=(e,t)=>"Identifier"===(e=rj(e)).type?"visualViewport"===e.name&&of(e,t):"MemberExpression"===e.type&&"visualViewport"===CN(e)&&CM(rj(e.object),t),Cq=(e,t)=>{var r;return CM(e=rj(e),t)||("Identifier"===(r=rj(r=e)).type?"document"===r.name&&of(r,t):"MemberExpression"===r.type&&"document"===CN(r)&&CM(rj(r.object),t))||CU(e,t)},CV=(e,t,r)=>{let n=rj(t);return C$(e,Cw)&&(CM(n,r)||CP(t,r,CI))||C$(e,Ck)&&(CU(n,r)||CP(t,r,Cj))||C$(e,CA)&&!Cq(n,r)&&!CL(t,r)},CW=(e,t,r=e)=>{let n,o,a,i;if(!e||e!==r&&tv(e))return!1;if(a=e,i=t,tm(a,void 0,tp)&&"MemberExpression"===a.callee.type&&CT.has(CN(a.callee))&&!Cq(a.callee.object,i)&&!CL(a.callee.object,i)||tI(e)&&Cw.has(e.name)&&!CO(e)&&of(e,t)||"MemberExpression"===e.type&&!CO(e)&&(n=CN(e),o=rj(e.object),Cw.has(n)&&(CM(o,t)||CP(e.object,t,CI))||Ck.has(n)&&(CU(o,t)||CP(e.object,t,Cj))||CA.has(CN(e))&&!Cq(e.object,t)&&!CL(e.object,t))||("VariableDeclarator"===e.type&&"ObjectPattern"===e.id.type&&e.init?CV(e.id,e.init,t):"AssignmentExpression"===e.type&&"ObjectPattern"===e.left.type&&CV(e.left,e.right,t)))return!0;for(let n of t.sourceCode.visitorKeys[e.type]??[]){let o=e[n];if(Array.isArray(o)){if(o.some(e=>CW(e,t,r)))return!0;continue}if(CW(o,t,r))return!0}return!1},C_="prefer-set-methods/union",Cz="prefer-set-methods/intersection",CK="prefer-set-methods/intersection-suggestion",CG="prefer-set-methods/difference",CJ="prefer-set-methods/difference-suggestion",CX=(e,t)=>tf(e,{name:"Set",argumentsLength:1})&&of(e.callee,t),CY=(e,t)=>{let r=e4(e,t);return oZ(e,t)&&!e7(e,t)?`(${r})`:r},CH=(e,t,r)=>((e,t)=>{let r=e;for(;r.parent;){if("ExpressionStatement"===r.parent.type)return t.sourceCode.getRange(t.sourceCode.getFirstToken(r.parent.expression))[0]===t.sourceCode.getRange(t.sourceCode.getFirstToken(e))[0];r=r.parent}return!1})(e,r)&&oD(r.sourceCode.getTokenBefore(e),r,t)?`;${t}`:t,CQ=(e,t)=>("ParenthesizedExpression"===e.type||rI(e))&&e.expression===t,CZ=e=>{for(;e.parent;){let{parent:t}=e;if(CQ(t,e)){e=t;continue}break}return e},C0=(e,t)=>e?.type==="SpreadElement"&&"Set"===oM(e.argument,t),C1=(e,t,r)=>{if(!(!tw(e,{method:"has",argumentsLength:1,optionalCall:!1,optionalMember:!1})||!rC(e.arguments[0],t)||rC(e.callee.object,t))&&"Set"===oM(e.callee.object,r))return e.callee.object},C2=(e,t,r)=>{var n;if(r.sourceCode.getCommentsInside(t).length>0||(n=CZ(n=e),n.parent?.type==="MemberExpression"&&n.parent.object===n)||e===t&&rI(e.parent))return;let o=((e,t)=>{if(!tw(e,{method:"filter",argumentsLength:1,optionalCall:!1,optionalMember:!1})||t.sourceCode.getCommentsInside(e).length>0)return;let r=((e,t)=>{if("ArrayExpression"===e.type&&1===e.elements.length&&C0(e.elements[0],t))return e.elements[0].argument})(e.callee.object,t);if(!r)return;let[n]=e.arguments;if("ArrowFunctionExpression"!==n.type||n.async||1!==n.params.length||"Identifier"!==n.params[0].type)return;let o=((e,t,r)=>{let n=C1(e,t,r);if(n)return{method:"intersection",messageId:Cz,suggestionMessageId:CK,otherSet:n};if("UnaryExpression"!==e.type||"!"!==e.operator||!e.prefix)return;let o=C1(e.argument,t,r);if(o)return{method:"difference",messageId:CG,suggestionMessageId:CJ,otherSet:o}})(n.body,n.params[0],t);if(!(!o||ez(o.otherSet,t.sourceCode,{considerGetters:!0})))return{messageId:o.messageId,suggestionMessageId:o.suggestionMessageId,replacement:`${CY(r,t)}.${o.method}(${e4(o.otherSet,t)})`}})(e,r);if(o)return{node:t,messageId:o.messageId,suggest:[{messageId:o.suggestionMessageId,fix:e=>e.replaceText(t,CH(t,o.replacement,r))}]}},C3="prefer-toggle-attribute/error",C8="prefer-toggle-attribute/suggestion",C6=(e,t,r)=>{let n=e4(e,t);return r?"UnaryExpression"===e.type&&"!"===e.operator&&e.prefix&&t.sourceCode.getCommentsInside(e).length===t.sourceCode.getCommentsInside(e.argument).length?C6(e.argument,t,!1):(!e7(e,t.sourceCode)&&o2(e,"!")&&(n=`(${n})`),`!${n}`):e7(e,t.sourceCode)||"SequenceExpression"!==e.type?n:`(${n})`},C9=(e,t,r)=>tw(e,{methods:t,argumentsLength:r,optionalCall:!1,computed:!1});function C5(e){if(e?.type==="ChainExpression"&&(e=e.expression),C9(e,["removeAttribute","hasAttribute"],1)||C9(e,["setAttribute"],2)){let{callee:t}=e,[r,n]=e.arguments;if(tn(r)?.toLowerCase().startsWith("data-"))return;let o=t.property.name;return{node:e,method:o,receiver:t.object,attributeName:r,attributeValue:n,isOptional:!!t.optional,hasEmptyAttributeValue:"setAttribute"!==o||te(n,"")}}}function C4(e){if(e){if("BlockStatement"===e.type){if(1!==e.body.length)return;e=e.body[0]}return"ExpressionStatement"===e.type&&(e=e.expression),C5(e)}}let C7=(e,t)=>e.isOptional===t.isOptional&&rC(e.receiver,t.receiver)&&rC(e.attributeName,t.attributeName),De=(e,t)=>oa(e.receiver)||nR(e.receiver,t),Dt="prefer-url-search-parameters/error",Dr="prefer-url-search-parameters/suggestion",Dn=new i(["node:url","url"]),Do=e=>"Type"===e.type||"ImportBinding"===e.type&&oS(e.node),Da=(e,t,r)=>{let n=ey(r.sourceCode.getScope(t),e);return!n||n.defs.every(e=>Do(e))},Di=(e,t)=>tn(rj(e))===t,Ds=(e,t)=>{let r=t.sourceCode.getText(e);return"SequenceExpression"===e.type?`(${r})`:r},Dl=(e,t)=>{if(!tw(e=rj(e),{method:"map",argumentsLength:1,computed:!1,optionalCall:!1,optionalMember:!1})||e.typeArguments||e.typeParameters)return;let r=((e,t)=>{var r;let n;if(tw(e=rj(e),{method:"split",argumentsLength:1,computed:!1,optionalCall:!1,optionalMember:!1})&&!(!Di(e.arguments[0],"&")||or(e.callee.object,t)||(n=e$(r=e.callee.object,t.sourceCode.getScope(r)))&&"string"!=typeof n.value))return e})(e.callee.object,t);if(!r)return;let[n]=e.arguments,o="ArrowFunctionExpression"!==n.type&&"FunctionExpression"!==n.type||n.async||n.generator||1!==n.params.length||"Identifier"!==n.params[0].type?void 0:"BlockStatement"!==n.body.type?{parameter:n.params[0],returnExpression:n.body}:1===n.body.body.length&&"ReturnStatement"===n.body.body[0].type&&n.body.body[0].argument?{parameter:n.params[0],returnExpression:n.body.body[0].argument}:void 0;if(o&&((e,t,r)=>{let n;return!!tw(e=rj(e),{method:"split",minimumArguments:1,maximumArguments:2,computed:!1,optionalCall:!1,optionalMember:!1})&&!!om(rj(e.callee.object),t)&&!!Di(e.arguments[0],"=")&&(1===e.arguments.length||2===(n=e.arguments[1],e$(n,r.sourceCode.getScope(n))?.value))})(o.returnExpression,o.parameter,t))return{node:e,query:r.callee.object}},Du=(e,t)=>`new URLSearchParams(${Ds(e,t)})`,Dp=(e,t,r,n)=>{let{sourceCode:o}=n,[a,i]=o.getRange(e),[s,l]=e5(t,n);return o.text.slice(a,s)+r+o.text.slice(l,i)},Dc=(e,t,r)=>{let[n,o]=r.sourceCode.getRange(e),[a,i]=e5(t,r);return[[n,a],[i,o]]},Dd=({node:e,query:t,replacement:r,preservedNodes:n=[t]},o)=>{let a=(({node:e,replacement:t,preservedNodes:r},n)=>{let o;if(!(!(!(o=ey(n.sourceCode.getScope(e),"URLSearchParams"))||o.defs.every(e=>Do(e))||o.defs.some(e=>(e=>{if("ImportBinding"!==e.type)return!1;let{node:t,parent:r}=e;return Dn.has(r.source.value)&&"type"!==r.importKind&&"ImportSpecifier"===t.type&&"type"!==t.importKind&&"Identifier"===t.imported.type&&"URLSearchParams"===t.imported.name})(e)))||rL(n,e,r)))return[{messageId:Dr,data:{replacement:t},fix:r=>r.replaceText(e,t)}]})({node:e,replacement:r,preservedNodes:n},o);if(a)return{node:e,messageId:Dt,suggest:a}},Dm="no-unsafe-promise-all-settled-values",Df=new i(["PromiseSettledResult","PromiseRejectedResult"]),Dg=new i(["PromiseFulfilledResult"]),Dy=new i(["ChainExpression","ParenthesizedExpression","TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion"]),Dh=e=>e?.type==="ArrowFunctionExpression"||e?.type==="FunctionExpression"||e?.type==="FunctionDeclaration",Dx=e=>{for(;e&&Dy.has(e.type);)e=e.expression;return e},Db=e=>tw(Dx(e),{object:"Promise",method:"allSettled",argumentsLength:1,optionalCall:!1,optionalMember:!1}),DE=e=>e?.parent.type==="ReturnStatement"&&e.parent.argument===e,Dv=e=>tw(Dx(e),{method:"filter",minimumArguments:1,maximumArguments:2,optionalCall:!1,optionalMember:!1});function DC(e){return"Identifier"===e.type?e.name:"TSQualifiedName"===e.type?DC(e.right):void 0}function DD(e){for(e=e?.type==="TSTypeAnnotation"?e.typeAnnotation:e;e?.type==="TSParenthesizedType"||e?.type==="TSTypeOperator";)e=e.typeAnnotation;return e?.type==="TSArrayType"?e.elementType:e?.type==="TSTypeReference"&&"Identifier"===e.typeName.type&&("Array"===e.typeName.name||"ReadonlyArray"===e.typeName.name)?e.typeArguments?.params[0]??e.typeParameters?.params[0]:void 0}function DS(e){return function e(t){if(t?.type==="TSTypeReference"){let e=DC(t.typeName);return Df.has(e)}return t?.type==="TSUnionType"&&t.types.some(t=>e(t))}(DD(e))}function DT(e){return function e(t){if(t?.type==="TSTypeReference"){let e=DC(t.typeName);return Dg.has(e)}return t?.type==="TSUnionType"&&t.types.every(t=>e(t))}(DD(e))}function DA(e){if(e.isUnion())return e.types.every(e=>DA(e));let t=e.aliasSymbol??e.getSymbol();return Dg.has(t?.getName())}function Dw(e,t){if((e=t.getNonNullableType(e)).isUnion()){let r=e.types.map(e=>Dw(e,t));return r.every(Boolean)?t.getUnionType(r):void 0}if(t.isArrayType(e)||t.isTupleType(e))return t.getTypeArguments(e)[0]}function Dk(e,t){let{parserServices:r}=t.sourceCode;if(r?.program)try{return{checker:r.program.getTypeChecker(),type:r.getTypeAtLocation(e)}}catch{}}let DI=e=>e?.type==="TSAsExpression"||e?.type==="TSTypeAssertion";function Dj(e,t,r=new i){var n;let o;return!!(DI(o=e)&&DS(o.typeAnnotation))||!!(e=Dx(e))&&(n=Dx(n=e),!!(n?.type==="AwaitExpression"&&Db(n.argument)||DS(e.typeAnnotation)||function(e,t){let r=Dk(e,t);if(!r)return!1;let{type:n,checker:o}=r,a=Dw(n,o);return!!(a&&function e(t){if(t.isUnion())return t.types.some(t=>e(t));let r=t.aliasSymbol??t.getSymbol();return Df.has(r?.getName())}(a))}(e,t))||(Dv(e)?Dj(e.callee.object,t,r):"Identifier"===e.type&&function(e,t,r){let n=ey(t.sourceCode.getScope(e),e);if(!n||r.has(n)||1!==n.defs.length)return!1;r.add(n);let[o]=n.defs,a=!!(DS(o.name?.typeAnnotation)||"Variable"===o.type&&"const"===o.parent.kind&&o.node.id===o.name&&o.node.init&&Dj(o.node.init,t,r));return r.delete(n),a}(e,t,r)))}let DF=e=>(e=Dx(e),e?.type==="Identifier"?e.name:void 0),DB=e=>{if(e=Dx(e),e?.type==="ObjectPattern"){for(let t of e.properties)if("Property"===t.type&&!t.computed&&"status"===eO(t)&&"Identifier"===t.value.type)return t.value}},DR=e=>{if(e?.type==="Literal"&&("fulfilled"===e.value||"rejected"===e.value))return e.value};function DP(e,t){return e=Dx(e),!!(t.statusVariable&&D_(e,t.statusVariable,t.context)||!t.statusVariable&&t.statusName&&e?.type==="Identifier"&&e.name===t.statusName||t.entryVariable&&e?.type==="MemberExpression"&&D_(e.object,t.entryVariable,t.context)&&"status"===eO(e))||!!(!t.entryVariable&&t.entryName&&e?.type==="MemberExpression"&&DF(e.object)===t.entryName&&"status"===eO(e))}function DL(e,t){if(e=Dx(e),e?.type!=="BinaryExpression"||!["===","==","!==","!="].includes(e.operator))return;let r=DP(e.left,t)?DR(e.right):DP(e.right,t)?DR(e.left):void 0;if(!r)return;let n="==="===e.operator||"=="===e.operator;return n&&"fulfilled"===r||!n&&"rejected"===r?"fulfilled":"unfulfilled"}function DN(e,t){return"fulfilled"===DL(e=Dx(e),t)||e?.type==="LogicalExpression"&&"&&"===e.operator&&(DN(e.left,t)||DN(e.right,t))}function D$(e,t){return"unfulfilled"===DL(e=Dx(e),t)||e?.type==="LogicalExpression"&&"||"===e.operator&&(D$(e.left,t)||D$(e.right,t))}let DM=(e,t,r)=>"ConditionalExpression"===e.type&&(e.consequent===t&&DN(e.test,r)||e.alternate===t&&D$(e.test,r)),DO=(e,t,r)=>"LogicalExpression"===e.type&&("&&"===e.operator&&e.right===t&&DN(e.left,r)||"||"===e.operator&&e.right===t&&D$(e.left,r)),DU=(e,t,r)=>"IfStatement"===e.type&&(e.consequent===t&&DN(e.test,r)||e.alternate===t&&D$(e.test,r)),Dq=e=>{let t;if(!Dh(e)||0===e.params.length)return!1;let r={entryName:DF(e.params[0]),statusName:(t=e.params[0],DB(t)?.name)},n=Dx(e.body);if(n?.type==="BlockStatement"){let[e]=n.body;return 1===n.body.length&&"ReturnStatement"===e.type&&e.argument&&DN(e.argument,r)}return DN(n,r)};function DV(e){if(e=Dx(e),e?.type==="ObjectPattern"){for(let t of e.properties)if("Property"===t.type&&!t.computed&&"value"===eO(t))return t}}let DW=(e,t)=>"MemberExpression"===e.type&&"property"===t&&!e.computed||["Property","PropertyDefinition","MethodDefinition"].includes(e.type)&&"key"===t&&!e.computed;function D_(e,t,r){return e=Dx(e),e?.type==="Identifier"&&t&&ey(r.sourceCode.getScope(e),e)===t}function Dz(e){for(e=Dx(e);Dv(e);){if(Dq(e.arguments[0]))return!0;e=Dx(e.callee.object)}return!1}function DK(e,t,{knownPromiseSettledResultArray:r=!1}={}){let n,o;if(!tw(e,{method:"map",minimumArguments:1,maximumArguments:2,optionalCall:!1,optionalMember:!1})||!r&&!Dj(e.callee.object,t)||function e(t,r,n=new i){return!!(DI(t)&&DT(t.typeAnnotation)||function(e,t){let r=Dk(e,t);if(!r)return!1;let{type:n,checker:o}=r,a=Dw(n,o);return!!(a&&DA(a))}(t=Dx(t),r))||("Identifier"===t.type?function(t,r,n){let o=ey(r.sourceCode.getScope(t),t);if(!o||n.has(o)||1!==o.defs.length)return!1;n.add(o);let[a]=o.defs,i=!!(DT(a.name?.typeAnnotation)||"Variable"===a.type&&"const"===a.parent.kind&&a.node.id===a.name&&a.node.init&&e(a.node.init,r,n));return n.delete(o),i}(t,r,n):Dv(t)&&Dz(t)&&Dj(t,r))}(e.callee.object,t))return;let[a]=e.arguments;if(!Dh(a)||0===a.params.length)return;let[s]=a.params;if(function(e,t){let r=Dk(e,t);if(!r)return!1;let{type:n}=r;return DA(n)}(s,t))return;let l=DV(s);if(l&&"Identifier"!==l.value.type)return{node:l.key,messageId:Dm};let u=DF(s),p=u&&ey(t.sourceCode.getScope(s),s),c=(n=DV(s),o=n?.value,o?.type==="Identifier"?o:o?.type==="AssignmentPattern"&&"Identifier"===o.left.type?o.left:void 0),d=c&&ey(t.sourceCode.getScope(c),c),m=DB(s),f=m?.name,g=m&&ey(t.sourceCode.getScope(m),m),y=function e(t,r){var n;if(n=t=Dx(t),n=Dx(n),(n?.type==="MemberExpression"&&D_(n.object,r.entryVariable,r.context)&&"value"===eO(n)||n?.type==="Identifier"&&D_(n,r.valueVariable,r.context))&&!function(e,t){for(let r=e,n=e.parent;n&&"ArrowFunctionExpression"!==n.type&&"FunctionExpression"!==n.type;r=n,n=n.parent){if(DM(n,r,t)||DO(n,r,t)||DU(n,r,t)||function(e,t){let r=e.parent?.body;if(!Array.isArray(r))return!1;let n=r.indexOf(e),o=r[n-1];return o?.type==="IfStatement"&&!o.alternate&&D$(o.test,t)&&function e(t){return t=Dx(t),t?.type==="ReturnStatement"||t?.type==="ThrowStatement"||t?.type==="BlockStatement"&&t.body.length>0&&e(t.body.at(-1))}(o.consequent)}(n,t))return!0;if(DE(n))break}return!1}(t,r))return t;for(let[n,o]of Object.entries(t)){if("parent"===n||DW(t,n)||!o||"object"!=typeof o)continue;let a=function(t,r){for(let n of t){if(!n?.type||Dh(n)||"ClassExpression"===n.type||"ClassDeclaration"===n.type)continue;let t=e(n,r);if(t)return t}}(Array.isArray(o)?o:[o],r);if(a)return a}}(a.body,{entryName:u,entryVariable:p,statusName:f,statusVariable:g,valueVariable:d,context:t});if(y)return{node:y,messageId:Dm}}let DG="prefer-abort-signal-any",DJ="prefer-abort-signal-any/suggestion",DX=new i(["reason","throwIfAborted"]),DY=new i(["capture","once","passive"]),DH=new i(["TSAsExpression","TSTypeAssertion","TSSatisfiesExpression"]),DQ=e=>{let t=Array.isArray(e.parent.body)?e.parent.body:Array.isArray(e.parent.consequent)?e.parent.consequent:void 0;if(t)return t[t.indexOf(e)+1]},DZ=(e,t,r)=>{let{sourceCode:n}=e,[,o]=n.getRange(t),[a]=n.getRange(r);return n.getAllComments().some(e=>{let[t,r]=n.getRange(e);return t>=o&&r<=a})},D0=e=>{let t=e,{parent:r}=e;for(;rI(r);)t=r,r=r.parent;return{expression:t,parent:r}},D1=(e,t)=>{let{parent:r}=e;if(!(!tT(r,{property:"signal",computed:!1,optional:!1})||r.object!==e||nL(r)||("ForInStatement"===r.parent.type||"ForOfStatement"===r.parent.type)&&r.parent.left===r||((e,t)=>{let{expression:r,parent:n}=D0(e);return tT(n)&&n.object===r&&DX.has(eO(n,t.sourceCode.getScope(n)))})(r,t)||(e=>{let{expression:t,parent:r}=D0(e);return"VariableDeclarator"===r.type&&r.init===t||"AssignmentExpression"===r.type&&r.right===t})(r)||r$(t,t.sourceCode.getRange(r))))return r},D2=(e,t,r)=>{if(r0.has(e.intrinsicName))return;if(r1.has(e.intrinsicName))return!1;if(e.isUnion()){let n=e.types.filter(e=>!r1.has(e.intrinsicName));if(0===n.length)return!1;let o=n.map(e=>D2(e,t,r));return!!o.every(Boolean)||!o.every(e=>!1===e)&&void 0}if(e.isIntersection()){let n=e.types.map(e=>D2(e,t,r));return!!n.some(Boolean)||!n.every(e=>!1===e)&&void 0}let n=t.getBaseConstraintOfType(e);if(n&&n!==e)return D2(n,t,r);let o=r2(e);if(o&&r3(o,r))return"AbortSignal"===o.getName();let a=r8(e,t).map(e=>D2(e,t,r));return!!a.some(Boolean)||!(a.length>0&&a.every(e=>!1===e))&&void 0},D3=(e,t)=>tm(e,{optional:!1},tp)&&tT(e.callee,{object:"AbortSignal",properties:t,computed:!1,optional:!1}),D8=e=>D3(e,["any","timeout"]),D6=e=>D3(e,["any"]),D9=(e,t)=>{if("Identifier"!==(e=rj(e)).type)return;let r=ey(t.sourceCode.getScope(e),e),n=r?.defs[0];if(r&&1===r.defs.length&&"Variable"===n.type&&"const"===n.parent.kind)return n.node.init},D5=(e,t)=>{if("Identifier"!==(e=rj(e)).type)return!1;let r=ey(t.sourceCode.getScope(e),e),n=r?.defs[0];if(!r||1!==r.defs.length||"Variable"!==n.type||"const"!==n.parent.kind||!n.node.init)return!1;let[,o]=t.sourceCode.getRange(n.node.init),[a]=t.sourceCode.getRange(e);return r.references.some(r=>{if(r.init||r.identifier===e)return!1;let[n]=t.sourceCode.getRange(r.identifier);return n>o&&n<a})},D4=(e,t,r)=>tm(e,{optional:!1},tp)&&tT(e.callee,{object:"Array",property:t,computed:!1,optional:!1})&&of(e.callee.object,r),D7=(e,t)=>(tm(e,{name:"Array",optional:!1},tp)||tf(e,{name:"Array"}))&&of(e.callee,t),Se=(e,t,r=new i)=>{if(e=rj(e),r.has(e))return!1;if(r.add(e),"SpreadElement"===e.type)return!0;if("ArrayExpression"===e.type)return e.elements.some(e=>e&&Se(e,t,r));if(D4(e,"of",t)||D7(e,t))return e.arguments.some(e=>Se(e,t,r));if(D4(e,"from",t)){if(1!==e.arguments.length)return!0;let[n]=e.arguments;if("SpreadElement"===n.type)return!0;let o=D9(n,t);if(o)return!!(!nE(o,t)||D5(n,t))||Se(o,t,r);let a=rj(n);return"ArrayExpression"!==a.type||Se(a,t,r)}if(D6(e))return e.arguments[0]&&Se(e.arguments[0],t,r);let n=D9(e,t);return n?!!(nE(n,t)&&D5(e,t))||Se(n,t,r):D3(rj(e),["abort"])},St=(e,t,r,n=new i)=>{var o;if(e=rj(e),n.has(e))return!1;if(n.add(e),"SpreadElement"===e.type)return!0;if("ArrayExpression"===e.type)return e.elements.some(e=>e&&St(e,t,r,n));if(D4(e,"of",r)||D7(e,r))return e.arguments.some(e=>St(e,t,r,n));if(D4(e,"from",r)){if(1!==e.arguments.length)return!0;let[o]=e.arguments;if("SpreadElement"===o.type)return!0;let a=D9(o,r);if(a)return!!(!nE(a,r)||D5(o,r))||St(a,t,r,n);let i=rj(o);return"ArrayExpression"!==i.type||St(i,t,r,n)}if(D6(e))return e.arguments[0]&&St(e.arguments[0],t,r,n);let a=D9(e,r);return a?!!(nE(a,r)&&D5(e,r))||St(a,t,r,n):tT(o=rj(o=e),{property:"signal",computed:!1,optional:!1})&&"Identifier"===o.object.type&&o.object.name===t},Sr=(e,t)=>{let r=((e,t)=>{let{parserServices:r}=t.sourceCode;if(r?.program)try{let{program:t}=r;return D2(r.getTypeAtLocation(e),t.getTypeChecker(),t)}catch{}})(e=rj(e),t);if(!0===r)return!0;if(!1===r||t.sourceCode.parserServices?.program)return!1;if("Identifier"===e.type){let t;return"signal"===(t=e.name)||t.endsWith("Signal")}return D8(e)},Sn=(e,t)=>"Identifier"===(e=rj(e)).type?Sr(e,t):D8(e)&&e.arguments.every(e=>"SpreadElement"!==e.type&&!ez(e,t.sourceCode)),So=(e,t)=>{if(!D4(e,"from",t)||1!==e.arguments.length)return;let[r]=e.arguments;if("SpreadElement"===r.type)return;let n=rj(r);if("ArrayExpression"===n.type)return n;let o=D9(r,t);if(o&&nE(o,t)&&!D5(r,t))return o},Sa=(e,t,r=new i)=>{if(e=rj(e),r.has(e))return;if(r.add(e),"ArrayExpression"===e.type)return e.elements.every(e=>e&&"SpreadElement"!==e.type)?e.elements:void 0;if(D4(e,"of",t)||D7(e,t))return e.arguments.every(e=>"SpreadElement"!==e.type)?e.arguments:void 0;let n=So(e,t);if(n)return Sa(n,t,r);let o=D9(e,t);if(o&&nE(o,t)&&!D5(e,t))return Sa(o,t,r)},Si=(e,t,r=new i)=>{if(e=rj(e),r.has(e))return!1;if(r.add(e),"Identifier"===e.type||"ArrayExpression"===e.type||D4(e,"of",t)||D7(e,t))return!0;let n=So(e,t);return!!n&&Si(n,t,r)},Ss=e=>"Identifier"===e.type?e.name:"TSQualifiedName"===e.type?Ss(e.right):void 0,Sl=(e,t,r=new i)=>{if(e?.type==="TSTypeAnnotation"&&(e=e.typeAnnotation),e?.type==="TSParenthesizedType")return Sl(e.typeAnnotation,t,r);if(e?.type!=="TSTypeReference")return!1;var n=e;let o=Ss(n.typeName);if("AbortSignal"===o)return!0;if(!o||"Identifier"!==n.typeName.type||r.has(n.typeName.name))return!1;r.add(n.typeName.name);let a=ey(t.sourceCode.getScope(n),n.typeName),s=a?.defs[0],l=s?.type==="Type"&&"TSTypeAliasDeclaration"===s.node.type&&Sl(s.node.typeAnnotation,t,r);return r.delete(n.typeName.name),l},Su=(e,t,r=new i)=>(e?.type==="TSTypeAnnotation"&&(e=e.typeAnnotation),e?.type==="TSParenthesizedType")?Su(e.typeAnnotation,t,r):e?.type==="TSTypeOperator"?"readonly"===e.operator?Su(e.typeAnnotation,t,r):void 0:e?.type==="TSArrayType"?Sl(e.elementType,t,r):e?.type==="TSTupleType"?e.elementTypes.length>0&&e.elementTypes.every(e=>Sl("TSNamedTupleMember"===e.type?e.elementType:e,t,r)):e?.type==="TSTypeReference"?((e,t,r)=>{let n,o=Ss(e.typeName),a=e.typeArguments?.params??e.typeParameters?.params;if(("Array"===o||"ReadonlyArray"===o)&&a?.length===1)return Sl(a[0],t,r);if(!o||"Identifier"!==e.typeName.type||r.has(e.typeName.name))return!1;r.add(e.typeName.name);let i=ey(t.sourceCode.getScope(e),e.typeName),s=i?.defs[0];return s?.type==="Type"&&"TSTypeAliasDeclaration"===s.node.type&&(n=Su(s.node.typeAnnotation,t,r)),r.delete(e.typeName.name),n})(e,t,r):void 0,Sp=(e,t,r=new i)=>{if(e?.type==="TSTypeAnnotation"&&(e=e.typeAnnotation),e?.type==="TSParenthesizedType")return Sp(e.typeAnnotation,t,r);if(e?.type==="TSTypeOperator")return"readonly"===e.operator&&("TSArrayType"===e.typeAnnotation.type||"TSTupleType"===e.typeAnnotation.type);if(e?.type!=="TSTypeReference")return!1;if("ReadonlyArray"===Ss(e.typeName))return!0;if("Identifier"!==e.typeName.type||r.has(e.typeName.name))return!1;r.add(e.typeName.name);let n=ey(t.sourceCode.getScope(e),e.typeName),o=n?.defs[0];return o?.type==="Type"&&"TSTypeAliasDeclaration"===o.node.type&&Sp(o.node.typeAnnotation,t,r)},Sc=(e,t,r,n=new i)=>{if(!e||r0.has(e.intrinsicName)||r1.has(e.intrinsicName)||n.has(e))return!1;if(n.add(e),e.isUnion()||e.isIntersection())return e.types.some(e=>Sc(e,t,r,n));let o=t.getBaseConstraintOfType(e);if(o&&o!==e)return Sc(o,t,r,n);let a=r2(e);if(a&&r3(a,r)&&"ReadonlyArray"===a.getName())return!0;let s=t.typeToString(e);return!!(s.startsWith("readonly ")||s.startsWith("ReadonlyArray<"))||r8(e,t).some(e=>Sc(e,t,r,n))},Sd=(e,t)=>{if(DH.has(e.type)){let r;return r=e.typeAnnotation,r?.type==="TSTypeReference"&&"const"===Ss(r.typeName)||Sp(e.typeAnnotation,t)||Sd(e.expression,t)}if("Identifier"!==(e=rj(e)).type)return!1;let r=ey(t.sourceCode.getScope(e),e),n=r?.defs[0];return!!(n?.name?.typeAnnotation&&Sp(n.name.typeAnnotation,t)||n?.type==="Variable"&&n.node.init&&Sd(n.node.init,t)||((e,t)=>{let{parserServices:r}=t.sourceCode;if(!r?.program)return!1;try{let{program:t}=r;return Sc(r.getTypeAtLocation(e),t.getTypeChecker(),t)}catch{return!1}})(e,t))},Sm=(e,t,r=new i)=>{if(r.has(e))return!1;if(r.add(e),DH.has(e.type))return Su(e.typeAnnotation,t)??Sm(e.expression,t,r);if("Identifier"===(e=rj(e)).type){let n=ey(t.sourceCode.getScope(e),e),o=n?.defs[0];if(o?.name?.typeAnnotation){let e=Su(o.name.typeAnnotation,t);if(void 0!==e)return e}if(o?.type==="Variable"&&o.node.init&&Sm(o.node.init,t,r))return!0}return nE(e,t)},Sf=(e,t,r,n)=>{var o,a;let i,s=!e||"ArrowFunctionExpression"!==e.type&&"FunctionExpression"!==e.type||e.async||e.generator||e.params.length>0?void 0:"BlockStatement"!==e.body.type?e.body:1===e.body.body.length&&"ExpressionStatement"===e.body.body[0].type?e.body.body[0].expression:void 0;if(tm(s,{optional:!1},tp)&&tT(s.callee,{property:"abort",computed:!1,optional:!1})&&"Identifier"===s.callee.object.type&&s.callee.object.name===t&&(0===s.arguments.length||1===s.arguments.length&&(i=s.arguments[0],tT(i,{property:"reason",computed:!1,optional:!1})&&(o=i.object,a=r,o=rj(o),a=rj(a),"Identifier"===o.type&&"Identifier"===a.type&&o.name===a.name&&ey(n.sourceCode.getScope(o),o)===ey(n.sourceCode.getScope(a),a)))))return s.callee.object},Sg=e=>{var t;if(e?.type!=="ExpressionStatement")return;let{expression:r}=e;if(tm(r,{minimumArguments:2,maximumArguments:3,optional:!1},tp)&&tT(r.callee,{property:"addEventListener",computed:!1,optional:!1})&&"abort"===tn(rj(r.arguments[0]))&&(!(t=r.arguments[2])||"Literal"===(t=rj(t)).type&&"boolean"==typeof t.value||"ObjectExpression"===t.type&&t.properties.every(e=>{if("Property"!==e.type||e.computed||"init"!==e.kind||e.method||e.shorthand||"Literal"!==e.value.type||"boolean"!=typeof e.value.value)return!1;let t="Identifier"===e.key.type?e.key.name:e.key.value;return DY.has(t)})))return{call:r,sourceSignal:r.callee.object}},Sy=(e,t)=>!r$(t,t.sourceCode.getRange(e))&&!rN(t,e),Sh=(e,t,r,n)=>{let o=ey(n.sourceCode.getScope(r),e);return o&&o!==t},Sx="prefer-block-statement-over-iife",Sb=e=>"ThisExpression"===e.type||"MetaProperty"===e.type&&"new"===e.meta.name&&"target"===e.property.name||"Identifier"===e.type&&"arguments"===e.name,SE=(e,t)=>e!==t&&tv(e),Sv=(e,t)=>SE(e,t)&&"ArrowFunctionExpression"!==e.type;function SC(e,t,r,n=SE){return function o(a){if(r(a))return!0;if(n(a,e))return!1;for(let e of t[a.type]??[]){let t=a[e];for(let e of Array.isArray(t)?t:[t])if(e?.type&&o(e))return!0}return!1}(e)}let SD=(e,t)=>{let[r,n]=t.getRange(e),o=t.getLastToken(e);return[r,eE(o)?t.getRange(o)[1]:n]},SS="no-multiple-promise-resolver-calls",ST=e=>rI(e)||e?.type==="TSInstantiationExpression";function SA(e){for(;ST(e.parent)&&e.parent.expression===e;)e=e.parent;return e}function Sw(e){for(;ST(e);)e=e.expression;return e}let Sk=(e,t)=>{if(!(("FunctionExpression"===e.type||"ArrowFunctionExpression"===e.type)&&!e.generator))return!1;let r=SA(e);return tf(r.parent,{name:"Promise",argumentsLength:1})&&r.parent.arguments[0]===r&&of(r.parent.callee,t)},SI=e=>e.references.some(e=>e.isWrite()),Sj=({resolverUncalled:e=!1,resolverCalled:t=!1,catchClausesAfterResolverCall:r=new i,pendingFinallyBlocksByCatchClause:n=new o}={})=>({resolverUncalled:e,resolverCalled:t,catchClausesAfterResolverCall:r,pendingFinallyBlocksByCatchClause:n}),SF=e=>Sj({resolverUncalled:e.resolverUncalled,resolverCalled:e.resolverCalled,catchClausesAfterResolverCall:new i(e.catchClausesAfterResolverCall),pendingFinallyBlocksByCatchClause:function(e){let t=new o;for(let[r,n]of e)t.set(r,new i(n));return t}(e.pendingFinallyBlocksByCatchClause)}),SB=(e,t,r)=>{if(t.executor===r){let r=SF(e);for(let[e,n]of r.pendingFinallyBlocksByCatchClause)t.finallyBlocks.some(e=>n.has(e))&&r.catchClausesAfterResolverCall.add(e);return r.resolverCalled=e.resolverUncalled||e.resolverCalled,r.resolverUncalled=!1,r}if(t.executor)return e;let n=SF(e);if(t.catchClause){if(e.resolverUncalled){let e=n.pendingFinallyBlocksByCatchClause.get(t.catchClause);for(let r of(e||(e=new i,n.pendingFinallyBlocksByCatchClause.set(t.catchClause,e)),t.finallyBlocks))e.add(r)}e.resolverCalled&&n.catchClausesAfterResolverCall.add(t.catchClause)}return n};function SR(e,t){if(e.size!==t.size)return!1;for(let r of e)if(!t.has(r))return!1;return!0}let SP=(e,t)=>void 0!==t&&e.resolverUncalled===t.resolverUncalled&&e.resolverCalled===t.resolverCalled&&SR(e.catchClausesAfterResolverCall,t.catchClausesAfterResolverCall)&&function(e,t){if(e.size!==t.size)return!1;for(let[r,n]of e){let e=t.get(r);if(!e||!SR(n,e))return!1}return!0}(e.pendingFinallyBlocksByCatchClause,t.pendingFinallyBlocksByCatchClause);function SL(e,t,r){let n=Sj({resolverUncalled:e===r.codePath.initialSegment});for(let o of e.prevSegments){let a=function(e,t,r,n){if(!t.reachable||n.ignoredLoopEdges.some(e=>e.previousSegment===t&&e.segment===r))return Sj();let o=n.catchClausesBySegment.get(r);return o?Sj({resolverUncalled:e.pendingFinallyBlocksByCatchClause.has(o),resolverCalled:e.catchClausesAfterResolverCall.has(o)}):e}(t.get(o)??Sj(),o,e,r);for(let e of(n.resolverUncalled||=a.resolverUncalled,n.resolverCalled||=a.resolverCalled,a.catchClausesAfterResolverCall))n.catchClausesAfterResolverCall.add(e);for(let[e,t]of a.pendingFinallyBlocksByCatchClause){let r=n.pendingFinallyBlocksByCatchClause.get(e);for(let o of(r||(r=new i,n.pendingFinallyBlocksByCatchClause.set(e,r)),t))r.add(o)}}return n}let SN=e=>{let t=Sw(e.test);return t?.type==="Literal"&&!t.value},S$=e=>{let t=SA(e);return t.parent?.type==="AwaitExpression"&&t.parent.argument===t},SM="no-unnecessary-string-trim",SO=["startsWith","endsWith"],SU=new i(["bigint","boolean","number","string","undefined"]),Sq=new i(["ArrayExpression","ArrowFunctionExpression","ClassExpression","FunctionExpression","ObjectExpression"]),SV=(e,t)=>e$(e=rj(e),t.sourceCode.getScope(e)),SW="no-useless-re-export",S_=e=>"Identifier"===e.type?e.name:e.value;function Sz(e,t){let r=e.attributes??[];return`${e.source.value}\u0000${r.map(e=>t.getText(e)).join("\0")}`}let SK={configs:{node:{name:"@eslint-sukka/eslint-plugin-sukka-full node preset",plugins:{get sukka(){return SK}},rules:{"sukka/unicorn/prefer-node-protocol":"error","sukka/unicorn/prefer-import-meta-properties":"error","no-process-exit":"off","sukka/unicorn/no-process-exit":"warn","no-buffer-constructor":"off","sukka/unicorn/no-new-buffer":"error"}},comment:{name:"@eslint-sukka/eslint-plugin-sukka-full comments preset",plugins:{get sukka(){return SK}},rules:{"sukka/ban-eslint-disable":["error","allow-with-description"]}},recommended:{...c.eslint_plugin_sukka.configs.recommended,plugins:{get sukka(){return SK}},rules:Object.assign({"sukka/prefer-single-boolean-return":"off","sukka/array/no-unneeded-flat-map":"error","sukka/browser/prefer-location-assign":"warn","sukka/jsx/no-template-literal":"error","sukka/jsx/no-unneeded-nested":"error","sukka/string/no-locale-case":"warn","sukka/string/no-simple-template-literal":"error","sukka/unicode/no-bidi":"warn","sukka/unicode/no-invisible":"warn","sukka/no-redundant-variable":"error","sukka/no-single-return":"warn","sukka/prefer-early-return":["error",{maximumStatements:16}],"sukka/prefer-fetch":"error","sukka/prefer-timer-id":"warn"},d.collectRules(c.eslint_plugin_sukka.configs.recommended))},recommended_unicorn:{name:"@eslint-sukka/eslint-plugin-sukka-full recommended unicorn preset",plugins:{get sukka(){return SK}},rules:{"sukka/unicorn/no-lonely-if":"error","sukka/unicorn/no-negated-condition":"warn","sukka/unicorn/catch-error-name":["error",{ignore:[/^(?:e|err|error|\w+Err|\w+Error)[\d_]?$/]}],"sukka/unicorn/custom-error-definition":"error","sukka/unicorn/require-array-join-separator":"warn","sukka/unicorn/no-thenable":"error","sukka/unicorn/no-invalid-remove-event-listener":"error","sukka/unicorn/consistent-function-scoping":"warn","sukka/unicorn/prefer-event-target":"warn","sukka/unicorn/prefer-keyboard-event-key":"warn","sukka/unicorn/prefer-text-content":"warn","sukka/unicorn/no-console-spaces":"warn","sukka/unicorn/no-empty-file":"warn","sukka/unicorn/no-useless-fallback-in-spread":"warn","sukka/unicorn/no-useless-length-check":"warn","sukka/unicorn/no-useless-promise-resolve-reject":"warn","sukka/unicorn/no-zero-fractions":"warn","sukka/unicorn/prefer-export-from":["warn",{checkUsedVariables:!1}],"sukka/unicorn/prefer-native-coercion-functions":"warn","sukka/unicorn/prefer-negative-index":"warn","sukka/unicorn/no-document-cookie":"error","sukka/unicorn/prefer-add-event-listener":"warn","sukka/unicorn/prefer-array-index-of":"warn","sukka/unicorn/prefer-blob-reading-methods":"warn","sukka/unicorn/prefer-date-now":"warn","sukka/unicorn/dom-node-dataset":"warn","sukka/unicorn/prefer-modern-math-apis":"warn","sukka/unicorn/number-literal-case":"error","sukka/unicorn/prefer-number-properties":["warn",{checkInfinity:!1}],"sukka/unicorn/prefer-reflect-apply":"warn","sukka/unicorn/prefer-set-size":"warn","sukka/unicorn/prefer-string-replace-all":"warn","sukka/unicorn/prefer-string-slice":"warn","sukka/unicorn/prefer-string-trim-start-end":"warn","sukka/unicorn/no-unreadable-iife":"warn","sukka/unicorn/throw-new-error":"warn","sukka/unicorn/escape-case":"warn","sukka/unicorn/prefer-unicode-code-point-escapes":"warn","sukka/unicorn/prefer-prototype-methods":"warn","sukka/unicorn/error-message":"error","sukka/unicorn/no-instanceof-builtins":["error",{strategy:"loose"}],"sukka/unicorn/prefer-type-error":"error","sukka/unicorn/consistent-destructuring":"warn","sukka/unicorn/new-for-builtins":"warn","sukka/unicorn/prefer-single-call":"warn","sukka/unicorn/no-static-only-class":"warn","sukka/unicorn/no-unreadable-array-destructuring":"error","sukka/unicorn/no-useless-spread":"error","sukka/unicorn/no-useless-switch-case":"warn","sukka/unicorn/no-useless-undefined":["error",{checkArguments:!1}],"sukka/unicorn/numeric-separators-style":["warn",{onlyIfContainsSeparator:!1,number:{minimumDigits:7,groupLength:3},binary:{minimumDigits:9,groupLength:4},octal:{minimumDigits:9,groupLength:4},hexadecimal:{minimumDigits:5,groupLength:2}}],"sukka/unicorn/prefer-array-find":"warn","sukka/unicorn/prefer-array-flat-map":"warn","sukka/unicorn/prefer-array-flat":"warn","sukka/unicorn/prefer-array-some":"warn","sukka/unicorn/prefer-code-point":"warn","sukka/unicorn/prefer-default-parameters":"warn","sukka/unicorn/prefer-logical-operator-over-ternary":"warn","sukka/unicorn/prefer-optional-catch-binding":"error","sukka/unicorn/prefer-regexp-test":"warn","sukka/unicorn/prefer-set-has":"error","sukka/unicorn/prefer-switch":"warn","sukka/unicorn/require-number-to-fixed-digits-argument":"warn","sukka/unicorn/prefer-string-raw":"warn","sukka/unicorn/no-single-promise-in-promise-methods":"error","sukka/unicorn/no-await-in-promise-methods":"error","sukka/unicorn/no-magic-array-flat-depth":"error","sukka/unicorn/no-object-as-default-parameter":"error","sukka/unicorn/template-indent":["warn",{tags:["outdent","dedent","gql","sql","html","styled","css"],functions:["dedent","stripIndent","strip_indent","stripTags","striptags","strip_tags","stripHtml","stripHTML","strip_html"],selectors:[],comments:["HTML","html","CSS","css","indent"]}],"sukka/unicorn/no-negation-in-equality-check":"error","sukka/unicorn/no-unnecessary-slice-end":"error","sukka/unicorn/consistent-date-clone":"error","sukka/unicorn/no-accessor-recursion":"error","sukka/unicorn/no-unnecessary-array-flat-depth":"error","sukka/unicorn/no-unnecessary-array-splice-count":"error","sukka/unicorn/no-useless-error-capture-stack-trace":"error","sukka/unicorn/prefer-class-fields":"error","sukka/unicorn/prefer-bigint-literals":"error","sukka/unicorn/prefer-classlist-toggle":"warn","sukka/unicorn/require-module-attributes":"error","sukka/unicorn/no-immediate-mutation":"error","sukka/unicorn/no-useless-collection-argument":"error","sukka/unicorn/prefer-response-static-json":"error","sukka/unicorn/consistent-template-literal-escape":"error","sukka/unicorn/no-useless-iterator-to-array":"error","sukka/unicorn/prefer-simple-condition-first":"error","sukka/unicorn/switch-case-break-position":"error","sukka/unicorn/better-dom-traversing":"warn","sukka/unicorn/no-blob-to-file":"error","sukka/unicorn/no-canvas-to-image":"warn","sukka/unicorn/no-confusing-array-splice":"error","sukka/unicorn/no-duplicate-set-values":"error","sukka/unicorn/no-incorrect-query-selector":"error","sukka/unicorn/no-invalid-file-input-accept":"error","sukka/unicorn/no-late-current-target-access":"error","sukka/unicorn/no-unused-array-method-return":"error","sukka/unicorn/prefer-array-last-methods":"warn","sukka/unicorn/prefer-math-abs":"warn","sukka/unicorn/prefer-split-limit":"error","sukka/unicorn/prefer-queue-microtask":"warn","sukka/unicorn/prefer-string-pad-start-end":"warn","sukka/unicorn/require-css-escape":"warn","sukka/unicorn/require-passive-events":"warn","sukka/unicorn/class-reference-in-static-methods":["warn",{preferThis:!1,preferSuper:!1}],"sukka/unicorn/consistent-optional-chaining":"error","sukka/unicorn/explicit-timer-delay":"error","sukka/unicorn/no-confusing-array-with":"error","sukka/unicorn/no-duplicate-loops":"warn","sukka/unicorn/no-declarations-before-early-exit":"error","sukka/unicorn/no-optional-chaining-on-undeclared-variable":"error","sukka/unicorn/no-object-methods-with-collections":"error","sukka/unicorn/no-subtraction-comparison":"warn","sukka/unicorn/no-unnecessary-global-this":"warn","sukka/unicorn/no-useless-else":"error","sukka/unicorn/no-useless-recursion":"error","sukka/unicorn/prefer-add-event-listener-options":"warn","sukka/unicorn/prefer-direct-iteration":"warn","sukka/unicorn/prefer-number-is-safe-integer":"warn","sukka/unicorn/prefer-object-define-properties":"error","sukka/unicorn/prefer-object-destructuring-defaults":"warn","sukka/unicorn/prefer-single-object-destructuring":"warn","sukka/unicorn/prefer-smaller-scope":"warn","sukka/unicorn/prefer-single-array-predicate":"warn","sukka/unicorn/prefer-url-href":"error","sukka/unicorn/require-proxy-trap-boolean-return":"error","sukka/unicorn/logical-assignment-operators":"error","sukka/unicorn/no-useless-coercion":"error","sukka/unicorn/no-useless-boolean-cast":"warn","sukka/unicorn/no-useless-continue":"error","sukka/unicorn/no-useless-override":"error","sukka/unicorn/prefer-has-check":"warn","sukka/unicorn/consistent-conditional-object-spread":"error","sukka/unicorn/no-boolean-sort-comparator":"error","sukka/unicorn/no-chained-comparison":"error","sukka/unicorn/no-constant-zero-expression":"error","sukka/unicorn/no-duplicate-logical-operands":"error","sukka/unicorn/no-impossible-length-comparison":"error","sukka/unicorn/no-invalid-character-comparison":"error","sukka/unicorn/no-loop-iterable-mutation":"error","sukka/unicorn/no-selector-as-dom-name":"error","sukka/unicorn/no-array-concat-in-loop":"error","sukka/unicorn/no-array-front-mutation":"warn","sukka/unicorn/no-array-sort-for-min-max":"error","sukka/unicorn/no-useless-compound-assignment":"warn","sukka/unicorn/no-useless-delete-check":"warn","sukka/unicorn/no-useless-logical-operand":"error","sukka/unicorn/prefer-boolean-return":"warn","sukka/unicorn/prefer-flat-math-min-max":"warn","sukka/unicorn/prefer-hoisting-branch-code":"warn","sukka/unicorn/prefer-single-replace":"warn","sukka/unicorn/no-invalid-well-known-symbol-methods":"error","sukka/unicorn/no-late-event-control":"error","sukka/unicorn/prefer-abort-signal-timeout":"warn","sukka/unicorn/prefer-aggregate-error":"warn","sukka/unicorn/prefer-observer-apis":"warn","sukka/unicorn/prefer-set-methods":"warn","sukka/unicorn/prefer-toggle-attribute":"warn","sukka/unicorn/prefer-url-search-parameters":"warn","sukka/unicorn/no-unsafe-promise-all-settled-values":"error","sukka/unicorn/prefer-abort-signal-any":"warn","sukka/unicorn/prefer-block-statement-over-iife":"warn","sukka/unicorn/no-multiple-promise-resolver-calls":"error","sukka/unicorn/no-unnecessary-string-trim":"error","sukka/unicorn/no-useless-re-export":"warn"}},stylistic_unicorn:{name:"@eslint-sukka/eslint-plugin-sukka-full stylistic unicorn preset",plugins:{get sukka(){return SK}},rules:{"sukka/unicorn/no-nested-ternary":"warn","sukka/unicorn/filename-case":["error",{cases:{kebabCase:!0,snakeCase:!0},ignore:[/fixtures/i,/^_/,/^\./,/rc$/i,/\.(md|json|yaml|toml|yml|ini|conf|jsonc|json5)$/i]}],"sukka/unicorn/no-unnecessary-nested-ternary":"error","sukka/unicorn/no-unreadable-object-destructuring":"error","sukka/unicorn/consistent-compound-words":"warn","sukka/unicorn/default-export-style":"warn"}},recommended_extra_with_typed_lint:{...c.eslint_plugin_sukka.configs.recommended_extra_with_typed_lint,plugins:{get sukka(){return SK}},rules:Object.assign({"sukka/string/no-unneeded-to-string":"error","sukka/type/no-force-cast-via-top-type":"error","sukka/type/no-wrapper-type-reference":"error","sukka/no-default-error":"off","sukka/unicorn/consistent-tuple-labels":"warn"},d.collectRules(c.eslint_plugin_sukka.configs.recommended_extra_with_typed_lint))},recommended_react:{...c.eslint_plugin_sukka.configs.recommended_react,plugins:{get sukka(){return SK}}}},rules:Object.assign(c.eslint_plugin_sukka.rules,{"array/no-unneeded-flat-map":L,"browser/prefer-location-assign":$,"jsx/no-template-literal":O,"jsx/no-unneeded-nested":U,"string/no-locale-case":V,"string/no-simple-template-literal":W,"unicode/no-bidi":Y,"unicode/no-invisible":Q,"no-redundant-variable":Z,"no-single-return":et,"prefer-early-return":en,"prefer-fetch":eo,"prefer-timer-id":es,"string/no-unneeded-to-string":el,"type/no-force-cast-via-top-type":eu,"type/no-wrapper-type-reference":ec,"no-default-error":ed},Object.fromEntries(Object.entries({"unicorn/catch-error-name":cz,"unicorn/custom-error-definition":{create:e=>{e.on("ClassDeclaration",t=>dn(e,t)),e.on("AssignmentExpression",t=>{if("ClassExpression"===t.right.type)return dn(e,t.right)}),e.on("AssignmentExpression",e=>{if("MemberExpression"===e.left.type&&"Identifier"===e.left.object.type&&"exports"===e.left.object.name){let t=e.right;if("ClassExpression"!==t.type||!c1(t)||!t.id)return;let r=t.id.name;return e.left.property.name!==r?{node:e.left.property,messageId:cK,fix:t=>t.replaceText(e.left.property,r)}:void 0}})},meta:{type:"problem",docs:{description:"Enforce correct `Error` subclassing.",recommended:!1},fixable:"code",messages:{[cK]:"Exported error name should match error class",[cG]:"Do not pass the error message to `super()` when the class defines a `message` accessor.",[cJ]:"Do not assign to `this.message` when the class defines a `message` getter without a setter.",[cX]:"Error constructors should accept `options` as the second parameter.",[cY]:"Error constructors should use `options` as the second parameter.",[cH]:"Pass the error message to `super()` as the first argument.",[cQ]:"Pass `options` to `super()` as the second argument."},languages:["js/js"]}},"unicorn/no-nested-ternary":{create:e=>{e.on("ConditionalExpression",t=>{if([t.test,t.consequent,t.alternate].some(e=>"ConditionalExpression"===e.type))return;let{sourceCode:r}=e,n=r.getAncestors(t).toReversed(),o=n.findIndex(e=>"ConditionalExpression"!==e.type);return 1!==o||e7(t,e)?o>1?{node:o>2?n[o-3]:t,messageId:aa}:void 0:{node:t,messageId:ai,fix:e=>[e.insertTextBefore(t,"("),e.insertTextAfter(t,")")]}})},meta:{type:"suggestion",docs:{description:"Disallow nested ternary expressions.",recommended:!0},fixable:"code",messages:{[aa]:"Do not nest ternary expressions.",[ai]:"Nested ternary expression should be parenthesized."},languages:["js/js"]}},"unicorn/prefer-event-target":{create:e=>{e.on("Identifier",t=>{if("EventEmitter"!==t.name||("ClassDeclaration"!==t.parent.type&&"ClassExpression"!==t.parent.type||t.parent.superClass!==t)&&("NewExpression"!==t.parent.type||t.parent.callee!==t))return;let r=e.sourceCode.getScope(t);if(!function(e){if(!e)return!1;let t=function(e,t){let r=e=>e.type===t;for(;e.parent;e=e.parent)if(r(e))return e}(e,"ImportDeclaration");return!!(al.has(t?.source.value)||"Property"===e.parent.type&&e.parent.value===e&&"Identifier"===e.parent.key.type&&"EventEmitter"===e.parent.key.name&&"ObjectPattern"===e.parent.parent.type&&e.parent.parent.properties.includes(e.parent)&&au(e.parent.parent)&&ap(e.parent.parent.parent.init))||!!(au(e)&&tT(e.parent.init,{property:"EventEmitter",optional:!1,computed:!1})&&ap(e.parent.init.object))}(ey(r,t)?.defs[0]?.name))return{node:t,messageId:as}})},meta:{type:"suggestion",docs:{description:"Prefer `EventTarget` over `EventEmitter`.",recommended:"unopinionated"},messages:{[as]:"Prefer `EventTarget` over `EventEmitter`."},languages:["js/js"]}},"unicorn/prefer-keyboard-event-key":{create:e=>{e.on("Identifier",t=>{if(af.has(t.name)){for(let r of ab(e,t))if(r.references?.some(e=>ax(t,e.identifier)))return aE(t,r)}}),e.on("Property",t=>{let r;if("Identifier"===t.key.type&&af.has(t.key.name)&&"Property"===(r=t.key).parent.type&&r.parent.key===r&&"ObjectPattern"===r.parent.parent.type&&!r.parent.computed){for(let r of ab(e,t))if(aC(t.key,r))return aE(t.key,r);for(let r of ab(e,t))if(av(t.key,r))return aE(t.key,r)}})},meta:{type:"suggestion",docs:{description:"Prefer `KeyboardEvent#key` over deprecated keyboard event properties.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[ad]:"Use `.key` instead of `.{{name}}`.",[am]:"Use `.key` with `{{key}}`."},languages:["js/js"]}},"unicorn/prefer-text-content":{create:e=>{e.on("MemberExpression",t=>{if(!tT(t,{property:"innerText"})||nR(t.object,e))return;let r=t.property;return{node:r,messageId:aD,suggest:[{messageId:aS,fix:e=>e.replaceText(r,"textContent")}]}}),e.on("Identifier",t=>{if("innerText"===t.name&&"Property"===t.parent.type&&t.parent.key===t&&!t.parent.computed&&"init"===t.parent.kind&&"ObjectPattern"===t.parent.parent.type&&t.parent.parent.properties.includes(t.parent)&&!((e,t)=>{if(nR(e,t))return!0;let{parent:r}=e;return"VariableDeclarator"===r.type?r.id===e&&r.init&&nR(r.init,t):"AssignmentExpression"===r.type&&r.left===e&&nR(r.right,t)})(t.parent.parent,e))return{node:t,messageId:aD,suggest:[{messageId:aS,fix:e=>e.replaceText(t,t.parent.shorthand?"textContent: innerText":"textContent")}]}})},meta:{type:"suggestion",docs:{description:"Prefer `.textContent` over `.innerText`.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[aD]:"Prefer `.textContent` over `.innerText`.",[aS]:"Switch to `.textContent`."},languages:["js/js"]}},"unicorn/require-array-join-separator":{create:e=>{e.on("CallExpression",t=>{if(!(tw(t,{method:"join",argumentsLength:0,optionalCall:!1})||tw(t,{method:"call",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&tL(t.callee.object,{property:"join"}))||0===t.arguments.length&&nD(t.callee.object,e))return;let{sourceCode:r}=e,[n,o]=r.getLastTokens(t,2),a=1===t.arguments.length;return{loc:{start:r.getLoc(n)[a?"end":"start"],end:r.getLoc(o).end},messageId:a_,fix:r=>aA(r,t,"','",e)}})},meta:{type:"suggestion",docs:{description:"Enforce using the separator argument with `Array#join()`.",recommended:"unopinionated"},fixable:"code",messages:{[a_]:"Missing the separator argument."},languages:["js/js"]}},"unicorn/no-thenable":{create:e=>{for(let{selector:t,selectors:r,messageId:n,getNodes:o}of aY)e.on(t??r,function*(t){for(let r of o(t,e))yield{node:r,messageId:n}})},meta:{type:"problem",docs:{description:"Disallow `then` property.",recommended:"unopinionated"},messages:{[az]:"Do not add `then` to an object.",[aK]:"Do not export `then`.",[aG]:"Do not add `then` to a class."},languages:["js/js"]}},"unicorn/no-invalid-remove-event-listener":{create:e=>{e.on("CallExpression",t=>{if(!(tw(t,{method:"removeEventListener",minimumArguments:2,optionalCall:!1})&&"SpreadElement"!==t.arguments[0].type&&("FunctionExpression"===t.arguments[1].type||"ArrowFunctionExpression"===t.arguments[1].type||tw(t.arguments[1],{method:"bind",optionalCall:!1,optionalMember:!1}))))return;let[,r]=t.arguments;return["ArrowFunctionExpression","FunctionExpression"].includes(r.type)?{node:r,loc:ew(r,e.sourceCode),messageId:aH}:{node:r.callee.property,messageId:aH}})},meta:{type:"problem",docs:{description:"Prevent calling `EventTarget#removeEventListener()` with the result of an expression.",recommended:"unopinionated"},messages:{[aH]:"The listener argument should be a function reference."},languages:["js/js"]}},"unicorn/consistent-function-scoping":a6,"unicorn/no-new-buffer":{create:e=>{let{sourceCode:t}=e;e.on("NewExpression",r=>{if(!tf(r,{name:"Buffer"}))return;let n=((e,t)=>{if(1!==e.length)return"from";let[r]=e;if("SpreadElement"===r.type)return;if("ArrayExpression"===r.type||"TemplateLiteral"===r.type)return"from";if(n_(r,t))return"alloc";let n=e$(r,t);if(n){let{value:e}=n;if("string"==typeof e||Array.isArray(e))return"from"}})(r.arguments,t.getScope(r));return n?{node:r,messageId:a9,data:{method:n},fix:a7(r,e,n)}:{node:r,messageId:a5,suggest:["from","alloc"].map(t=>({messageId:a4,data:{replacement:t},fix:a7(r,e,t)}))}})},meta:{type:"problem",docs:{description:"Enforce the use of `Buffer.from()` and `Buffer.alloc()` instead of the deprecated `new Buffer()`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[a9]:"`new Buffer()` is deprecated, use `Buffer.{{method}}()` instead.",[a5]:"`new Buffer()` is deprecated, use `Buffer.alloc()` or `Buffer.from()` instead.",[a4]:"Switch to `Buffer.{{replacement}}()`."},languages:["js/js"]}},"unicorn/no-console-spaces":{create:e=>{let{sourceCode:t}=e,r=(r,n,o)=>{let[a,i]=t.getRange(r),s="leading"===o?a+1:i-2,l=[s,s+1];return{loc:o4(l,e),messageId:ie,data:{method:n,position:o},fix:e=>e.removeRange(l)}};e.on("CallExpression",function*(e){if(!tw(e,{object:"console",methods:["log","debug","info","warn","error"],minimumArguments:1,optionalCall:!1,optionalMember:!1}))return;let n=e.callee.property.name,{arguments:o}=e,{length:a}=o;for(let[e,i]of o.entries()){if(!tt(i)&&"TemplateLiteral"!==i.type)continue;let o=t.getText(i).slice(1,-1);0!==e&&it(o)&&(yield r(i,n,"leading")),e!==a-1&&ir(o)&&(yield r(i,n,"trailing"))}})},meta:{type:"suggestion",docs:{description:"Do not use leading/trailing space between `console.log` parameters.",recommended:"unopinionated"},fixable:"code",messages:{[ie]:"Do not use {{position}} space between `console.{{method}}` parameters."},languages:["js/js"]}},"unicorn/no-empty-file":ia,"unicorn/no-useless-fallback-in-spread":{create:e=>{e.on("ObjectExpression",t=>{if(tx(t)&&"LogicalExpression"===t.parent.type&&t.parent.right===t&&("||"===t.parent.operator||"??"===t.parent.operator)&&"SpreadElement"===t.parent.parent.type&&t.parent.parent.argument===t.parent&&"ObjectExpression"===t.parent.parent.parent.type&&t.parent.parent.parent.properties.includes(t.parent.parent))return{node:t,messageId:ii,*fix(r,{abort:n}){let{sourceCode:o}=e,a=t.parent;if(o.getCommentsInside(a).length>0)return n();let{left:i}=a,s=e7(i,e),[,l]=s?e5(i,e):o.getRange(i),[,u]=o.getRange(a);yield r.removeRange([l,u]),(s||"SequenceExpression"!==i.type)&&(yield aT(a,r,e))}}})},meta:{type:"suggestion",docs:{description:"Disallow useless fallback when spreading in object literals.",recommended:"unopinionated"},fixable:"code",messages:{[ii]:"The empty object is useless."},languages:["js/js"]}},"unicorn/no-useless-length-check":{create:e=>{let t=[],r=new i,n=new i,o=new i,a=new i;e.on("BinaryExpression",e=>{if(!("BinaryExpression"===e.type&&"Literal"===e.right.type&&"0"===e.right.raw&&tT(e.left,{property:"length",optional:!1})&&tN(e.parent)))return;let{operator:t}=e;"==="===t?r.add(e):(">"===t||"!=="===t)&&n.add(e)}),e.on("CallExpression",t=>{tw(t,{optionalCall:!1,optionalMember:!1,computed:!1})&&"Identifier"===t.callee.property.type&&!nv(t.callee.object,e)&&("some"===t.callee.property.name?o.add(t):"every"===t.callee.property.name&&a.add(t))}),e.on("LogicalExpression",e=>{tN(e)&&t.push(e)}),e.on("Program:exit",function*(){let s=new i(t.flatMap(e=>(function(e){let{operator:t}=e;return(function e(t){return[t.left,t.right].flatMap(r=>"LogicalExpression"===r.type&&r.operator===t.operator?e(r):[r])})(e).filter((e,i,s)=>(function({node:e,operator:t,siblings:i}){return"||"===t&&r.has(e)&&i.some(t=>a.has(t)&&rC(e.left.object,t.callee.object))||"&&"===t&&n.has(e)&&i.some(t=>o.has(t)&&rC(e.left.object,t.callee.object))})({node:e,operator:t,siblings:[s[i-1],s[i+1]].filter(Boolean)}))})(e))),{sourceCode:l}=e;for(let t of s)yield{loc:{start:l.getLoc(t.left.property).start,end:l.getLoc(t).end},messageId:r.has(t)?"zero":"non-zero",fix(r){let{left:n,right:o}=t.parent,a=e5(n,e),i=e5(o,e),s=[];return n===t?(s[0]=a[0],s[1]=i[0]):(s[0]=a[1],s[1]=i[1]),r.removeRange(s)}}})},meta:{type:"suggestion",docs:{description:"Disallow useless array length check.",recommended:"unopinionated"},fixable:"code",messages:{"non-zero":"The non-empty check is useless as `Array#some()` returns `false` for an empty array.",zero:"The empty check is useless as `Array#every()` returns `true` for an empty array."},languages:["js/js"]}},"unicorn/no-useless-promise-resolve-reject":{create:e=>{e.on("CallExpression",t=>{let{expression:r,parent:n}=is(t);if(!(tw(t,{object:"Promise",methods:["resolve","reject"],optionalCall:!1,optionalMember:!1})&&("ArrowFunctionExpression"===n.type&&n.body===r||"ReturnStatement"===n.type&&n.argument===r||"YieldExpression"===n.type&&!n.delegate&&n.argument===r)))return;let{functionNode:o,isInTryStatement:a}=function(e){let t,r=!1;for(;e;e=e.parent){if(tv(e)){t=e;break}"TryStatement"===e.type&&(r=!0)}return{functionNode:t,isInTryStatement:r}}(t);if(o&&(o.async||function(e){if("CallExpression"===e.parent.type&&"MemberExpression"===e.parent.callee.type&&!e.parent.callee.computed&&"Identifier"===e.parent.callee.property.type){let{callee:{property:t},arguments:r}=e.parent;if(1===r.length&&["then","catch","finally"].includes(t.name)&&r[0]===e||2===r.length&&"then"===t.name&&(r[0]===e||"SpreadElement"!==r[0].type&&r[1]===e))return!0}return!1}(o)))return function(e,t){let{callee:r}=e,n=r.property.name,{parent:o}=is(e);return{node:r,messageId:n,data:{type:"YieldExpression"===o.type?"yield":"return"},fix:t}}(t,function(e,t,r){if(e.arguments.length>1)return;let{callee:n,arguments:o}=e,{expression:a,parent:i,isAwaited:s}=is(e),[l]=o;if(l?.type==="SpreadElement")return;let u="reject"===n.property.name,p="YieldExpression"===i.type;if(u&&(t||p&&"ExpressionStatement"!==i.parent.type))return;let c=function({callExpression:e,parent:t,expression:r,isAwaited:n,isReject:o,context:a}){return n&&!o?e5(e,a):o&&"YieldExpression"===t.type?e5(t,a):"ArrowFunctionExpression"===t.type?o?e5(r,a):e:t}({callExpression:e,parent:i,expression:a,isAwaited:s,isReject:u,context:r});if(!rL(r,c,l?[l]:[]))return function(t){let n="ArrowFunctionExpression"===i.type,o=il(l,r);if(u){if(o||="undefined",o=`throw ${o}`,p)return t.replaceTextRange(e5(i,r),o);if(o+=";",n)return o=`{ ${o} }`,t.replaceTextRange(e5(a,r),o)}else{if(s){var c;let n;return t.replaceTextRange(e5(e,r),(n=il(c=l,r)||"undefined",c&&"SequenceExpression"!==c.type&&16>oX(c)?`(${n})`:n))}p?o=`yield${o?" ":""}${o}`:"ReturnStatement"===i.type?o=`return${o?" ":""}${o};`:(l?.type==="ObjectExpression"&&(o=`(${o})`),o||="{}")}return t.replaceText(n?e:i,o)}}(t,a,e))})},meta:{type:"suggestion",docs:{description:"Disallow returning/yielding `Promise.resolve/reject()` in async functions or promise callbacks",recommended:"unopinionated"},fixable:"code",messages:{resolve:"Prefer `{{type}} value` over `{{type}} Promise.resolve(value)`.",reject:"Prefer `throw error` over `{{type}} Promise.reject(error)`."},languages:["js/js"]}},"unicorn/no-zero-fractions":{create:e=>{e.on("Literal",t=>{if(!to(t))return;let{raw:r}=t,n=r.match(/^(?<before>[\d_]*)(?<dotAndFractions>\.[\d_]*)(?<after>.*)$/);if(!n)return;let{before:o,dotAndFractions:a,after:i}=n.groups,s=(o+a.replaceAll(/[.0_]+$/g,"")||"0")+i;if(s===r)return;let l="."===a,{sourceCode:u}=e,p=u.getRange(t)[0]+o.length+a.length;return{loc:o4([p-(r.length-s.length),p],e),messageId:l?ip:iu,*fix(r){let n=s;"MemberExpression"===t.parent.type&&t.parent.object===t&&oH.test(s)&&!e7(t,e)&&(n=`(${n})`,oD(u.getTokenBefore(t),e,n)&&(n=`;${n}`)),yield r.replaceText(t,n),yield aP(r,t,e)}}})},meta:{type:"suggestion",docs:{description:"Disallow number literals with zero fractions or dangling dots.",recommended:"unopinionated"},fixable:"code",messages:{[iu]:"Don't use a zero fraction in the number.",[ip]:"Don't use a dangling dot in the number."},languages:["js/js"]}},"unicorn/prefer-export-from":iE,"unicorn/prefer-native-coercion-functions":{create:e=>{e.on(tE,t=>{if(t.async||t.generator||t.returnType?.type==="TSTypeAnnotation"&&"TSTypePredicate"===t.returnType.typeAnnotation.type||0===t.params.length||"Identifier"!==t.params[0].type||("MethodDefinition"===t.parent.type&&("constructor"===t.parent.kind||"set"===t.parent.kind)||"Property"===t.parent.type&&"set"===t.parent.kind)&&t.parent.value===t)return;let r=function(e){if(("ArrowFunctionExpression"===e.type&&"Identifier"===e.body.type&&e.body.name===e.params[0].name||"BlockStatement"===e.body.type&&1===e.body.body.length&&"ReturnStatement"===e.body.body[0].type&&e.body.body[0].argument?.type==="Identifier"&&e.body.body[0].argument.name===e.params[0].name)&&"CallExpression"===e.parent.type&&!e.parent.optional&&e.parent.arguments[0]===e&&"MemberExpression"===e.parent.callee.type&&!e.parent.callee.computed&&!e.parent.callee.optional&&"Identifier"===e.parent.callee.property.type&&iD.has(e.parent.callee.property.name))return{replacementFunction:"Boolean",fix:t=>t.replaceText(e,"Boolean")}}(t)||function(e){let t,r=(t=e.params[0].name,"ArrowFunctionExpression"===e.type&&iS(e.body,t)?e.body:"BlockStatement"===e.body.type&&1===e.body.body.length&&"ReturnStatement"===e.body.body[0].type&&iS(e.body.body[0].argument,t)?e.body.body[0].argument:void 0);if(!r)return;let{name:n}=r.callee,o={replacementFunction:n};return"FunctionDeclaration"===e.type||1!==r.arguments.length||(o.fix=t=>{let r=n;return"Property"===e.parent.type&&e.parent.method&&e.parent.value===e?r=`: ${r}`:"MethodDefinition"===e.parent.type&&(r=` = ${r};`),t.replaceText(e,r)}),o}(t);if(!r)return;let{sourceCode:n}=e,{replacementFunction:o,fix:a}=r;return r={node:t,loc:ew(t,n),messageId:iv,data:{functionNameWithKind:eU(t,n),replacementFunction:o}},!a||1!==t.params.length||n.getCommentsInside(t).length>0||(r.fix=a),r})},meta:{type:"suggestion",docs:{description:"Prefer using `String`, `Number`, `BigInt`, `Boolean`, and `Symbol` directly.",recommended:"unopinionated"},fixable:"code",messages:{[iv]:"{{functionNameWithKind}} is equivalent to `{{replacementFunction}}`. Use `{{replacementFunction}}` directly."},languages:["js/js"]}},"unicorn/no-document-cookie":{create(e){iI.listen({context:e})},meta:{type:"problem",docs:{description:"Do not use `document.cookie` directly.",recommended:"unopinionated"},messages:{[ik]:"Do not use `document.cookie` directly."},languages:["js/js"]}},"unicorn/prefer-add-event-listener":iR,"unicorn/prefer-array-index-of":iU,"unicorn/prefer-blob-reading-methods":{create:e=>{e.on("CallExpression",e=>{if(!tw(e,{methods:["readAsText","readAsArrayBuffer"],argumentsLength:1,optionalCall:!1,optionalMember:!1}))return;let t=e.callee.property,r=t.name;return{node:t,messageId:iq,data:{method:r,replacement:"readAsArrayBuffer"===r?"arrayBuffer":"text"}}})},meta:{type:"suggestion",docs:{description:"Prefer `Blob#arrayBuffer()` over `FileReader#readAsArrayBuffer(…)` and `Blob#text()` over `FileReader#readAsText(…)`.",recommended:"unopinionated"},messages:{[iq]:"Prefer `Blob#{{replacement}}()` over `FileReader#{{method}}(blob)`."},languages:["js/js"]}},"unicorn/prefer-date-now":{create:e=>{e.on("CallExpression",e=>{if(tw(e,{methods:["getTime","valueOf"],argumentsLength:0,optionalCall:!1,optionalMember:!1})&&iz(e.callee.object)){let t=e.callee.property;return iK(e,{node:t,messageId:iW,data:{method:t.name}})}if(tm(e,{names:["Number","BigInt"],argumentsLength:1,optional:!1},tp)&&iz(e.arguments[0])){let{name:t}=e.callee;return"Number"===t?iK(e,{messageId:i_}):iK(e.arguments[0])}}),e.on("UnaryExpression",t=>{if(("+"===t.operator||"-"===t.operator)&&iz(t.argument))return iK("-"===t.operator?t.argument:t,{},e)}),e.on("AssignmentExpression",e=>{if(("-="===e.operator||"*="===e.operator||"/="===e.operator||"%="===e.operator||"**="===e.operator)&&iz(e.right))return iK(e.right)}),e.on("BinaryExpression",function*(e){if("-"===e.operator||"*"===e.operator||"/"===e.operator||"%"===e.operator||"**"===e.operator)for(let t of[e.left,e.right])iz(t)&&(yield iK(t))})},meta:{type:"suggestion",docs:{description:"Prefer `Date.now()` to get the number of milliseconds since the Unix Epoch.",recommended:"unopinionated"},fixable:"code",messages:{[iV]:"Prefer `Date.now()` over `new Date()`.",[iW]:"Prefer `Date.now()` over `Date#{{method}}()`.",[i_]:"Prefer `Date.now()` over `Number(new Date())`."},languages:["js/js"]}},"unicorn/dom-node-dataset":i2,"unicorn/prefer-modern-math-apis":{create:e=>{let t=[];e.on("CallExpression",t=>{if(!tw(t,{object:"Math",method:"sqrt",argumentsLength:1,optionalCall:!1,optionalMember:!1}))return;let r=i7(t.arguments[0]);if(r.some(e=>!("BinaryExpression"===e.type&&("*"===e.operator&&rC(e.left,e.right)||"**"===e.operator&&te(e.right,2)))))return;let n=1===r.length?"abs":"hypot",o=new i(1===r.length?[]:r.map(e=>e.parent));return{node:t.callee.property,messageId:i3,data:{replacement:`Math.${n}(…)`,description:"Math.sqrt(…)"},*fix(a){let{sourceCode:i}=e;for(let r of(yield a.replaceText(t.callee.property,n),o)){let t=i.getTokenAfter(r.left,e=>"Punctuator"===e.type&&"+"===e.value);yield aW(t,",",a,e),yield aT(r,a,e)}for(let t of r)yield a.removeRange([e5(t.left,e)[1],i.getRange(t)[1]])}}}),e.on("BinaryExpression",e=>{t.push(e)}),e.on("Program:exit",function*(){for(let r of t)for(let t of i4){let n=t(r,e);n&&(yield n)}})},meta:{type:"suggestion",docs:{description:"Prefer modern `Math` APIs over legacy patterns.",recommended:"unopinionated"},fixable:"code",messages:{[i3]:"Prefer `{{replacement}}` over `{{description}}`."},languages:["js/js"]}},"unicorn/number-literal-case":sr,"unicorn/prefer-number-properties":sl,"unicorn/prefer-reflect-apply":{create:e=>{e.on("CallExpression",t=>{if(!tw(t,{optionalCall:!1,optionalMember:!1})||"Literal"===t.callee.object.type||"ArrayExpression"===t.callee.object.type||"ObjectExpression"===t.callee.object.type)return;let{sourceCode:r}=e,n=((e,t)=>{if("apply"===eO(e.callee)&&2===e.arguments.length&&sp(e.arguments[0],e.arguments[1]))return r=>r.replaceText(e,sc(t,e.callee.object,e.arguments[0],e.arguments[1]))})(t,r)||((e,t)=>{if("call"===eO(e.callee)&&"apply"===eO(e.callee.object)&&"prototype"===eO(e.callee.object.object)&&e.callee.object.object.object?.type==="Identifier"&&"Function"===e.callee.object.object.object.name&&3===e.arguments.length&&sp(e.arguments[1],e.arguments[2]))return r=>r.replaceText(e,sc(t,e.arguments[0],e.arguments[1],e.arguments[2]))})(t,r);if(n)return{node:t,messageId:su,fix:n}})},meta:{type:"suggestion",docs:{description:"Prefer `Reflect.apply()` over `Function#apply()`.",recommended:"unopinionated"},fixable:"code",messages:{[su]:"Prefer `Reflect.apply()` over `Function#apply()`."},languages:["js/js"]}},"unicorn/prefer-set-size":{create:e=>{e.on("MemberExpression",t=>{var r;if(!tT(t,{property:"length",optional:!1}))return;let n="ArrayExpression"===(r=t.object).type&&1===r.elements.length&&r.elements[0]?.type==="SpreadElement"?r.elements[0].argument:tw(r,{object:"Array",method:"from",argumentsLength:1,optionalCall:!1,optionalMember:!1})?r.arguments[0]:void 0;if(n&&nk(n,e))return{node:t.property,messageId:sd,fix:function(e,t,r){let{sourceCode:n}=e,{object:o,property:a}=t;if(!(n.getCommentsInside(o).length>n.getCommentsInside(r).length))return function*(i){yield i.replaceText(a,"size");let s=n.getText(r);oZ(r,e)&&(s=`(${s})`),yield i.replaceText(o,s),"ArrayExpression"===o.type&&(yield aP(i,t,e))}}(e,t,n)}})},meta:{type:"suggestion",docs:{description:"Prefer using `Set#size` instead of `Array#length`.",recommended:"unopinionated"},fixable:"code",messages:{[sd]:"Prefer using `Set#size` instead of `Array#length`."},languages:["js/js"]}},"unicorn/prefer-string-replace-all":{create:e=>{e.on("CallExpression",t=>{let r,n,o=((e,t)=>{let r;if(!tw(e,{method:"join",argumentsLength:1,optionalCall:!1,optionalMember:!1})||!tw(e.callee.object,{method:"split",argumentsLength:1,optionalCall:!1,optionalMember:!1})||t.sourceCode.getCommentsInside(e).length>0)return;let n=e.callee.object;if(or(n.callee.object,t))return;let[o]=n.arguments,[a]=e.arguments,i=tn(o);if("string"==typeof i){if(0===i.length)return;r=tK(i)}else if(!(r=(e=>{if(!ta(e)||e.regex.flags.includes("y"))return;let t=sw(e);if(!t||sj(t)||0===sI(t))return;let{pattern:r,flags:n}=e.regex;return`/${r}/${n.includes("g")?n:`g${n}`}`})(o)))return;let s=tn(a);if("string"==typeof s)return`${e4(n.callee.object,t)}.replaceAll(${r}, ${tK(s.replaceAll("$","$$$$"))})`})(t,e);if(o)return{node:t.callee.property,messageId:sE,fix:e=>e.replaceText(t,o)};if(!tw(t,{methods:["replace","replaceAll"],argumentsLength:2,optionalCall:!1})||tw(t,{method:"replace",argumentsLength:2,optionalCall:!1,optionalMember:!1})&&ta(r=t.arguments[0])&&r.regex.flags.includes("g")&&!r.regex.flags.includes("y")&&(e=>{if(!e.startsWith("[")||!e.endsWith("]")||e.startsWith("[^"))return;let t=new i,r=e.slice(1,-1);for(let e=0;e<r.length;e++){let n=r[e],o=!1;if("\\"===n&&(n=r[++e],o=!0,!n)||"-"===n&&!o&&0!==e&&e!==r.length-1||"]"===n&&!o&&0!==e||!sy.has(n))return;t.add(n)}return t})(r.regex.pattern)?.size>=8&&tt(n=t.arguments[1])&&n.value===sg)return;let{arguments:a,callee:{property:s}}=t;if(or(t.callee.object,e))return;let[l]=a;if(!((e,t)=>{if(ta(e))return e.regex.flags.includes("g");if(tf(e,{name:"RegExp"})&&e.arguments[0]?.type!=="SpreadElement"&&e.arguments[1]?.type==="Literal"&&"string"==typeof e.arguments[1].value)return e.arguments[1].value.includes("g");let r=e$(e,t);if(!r)return!1;let{value:n}=r;return"[object RegExp]"===Object.prototype.toString.call(n)&&n.global})(l,e.sourceCode.getScope(l)))return;let u=s.name,p=function(e){if(!ta(e))return;let t=sw(e);if(!t)return;let{flags:r}=e.regex;if(!function(e){if(!e.includes("g"))return!1;for(let t of e)if(sv.has(t))return!1;return!0}(r))return;let n="alternative"===t.type?sA(t.body):sT(t);if(n)return"'"+n+"'"}(l);if("replaceAll"===u){if(!p)return;return{node:l,messageId:sb,data:{replacement:p.length<20?p:"a string literal"},fix:e=>e.replaceText(l,p)}}return{node:s,messageId:sx,*fix(e){yield e.insertTextAfter(s,"All"),p&&(yield e.replaceText(l,p))}}})},meta:{type:"suggestion",docs:{description:"Prefer `String#replaceAll()` over regex searches with the global flag and `String#split().join()`.",recommended:"unopinionated"},fixable:"code",messages:{[sx]:"Prefer `String#replaceAll()` over `String#replace()`.",[sb]:"This pattern can be replaced with {{replacement}}.",[sE]:"Prefer `String#replaceAll()` over `String#split().join()`."},languages:["js/js"]}},"unicorn/prefer-string-slice":{create:e=>{e.on("CallExpression",t=>{if(!tw(t,{methods:["substr","substring"]})||or(t.callee.object,e))return;let r=t.callee.property.name;if(!("substring"===r&&(e=>{if(!tw(e,{method:"substring",argumentsLength:2}))return;let[t,r]=e.arguments;if(sF(t)&&sF(r)&&1===Math.abs(t.value-r.value))return t.value<r.value?t:r;let n=(e=>{if("BinaryExpression"===e.type&&"-"===e.operator&&te(e.right,1))return e.left})(t);return sB(r,t)??(sB(t,r)?r:void 0)??(n&&rC(n,r)?t:void 0)})(t)))return{node:t,messageId:r,*fix(n,{abort:o}){if(yield n.replaceText(t.callee.property,"slice"),0!==t.arguments.length){if(t.arguments.length>2||t.arguments.some(e=>"SpreadElement"===e.type))return o();yield("substr"===r?function*({node:e,fixer:t,context:r,abort:n}){let o=e.arguments,[a,i]=o;if(!i)return;let{sourceCode:s}=r,l=e$(a,s.getScope(e)),u=e5(i,r);if(l?.value===0){let n=((e,t,r)=>{let n,o,{sourceCode:a}=r;if(!("BinaryExpression"!==e.type||"-"!==e.operator||!(to(n=e.right)&&Number.isSafeInteger(n.value)&&n.value>0)||!sP(e.left)||!("Identifier"===t.type||tt(t))||!rC(e.left.object,t)||(o=((e,t)=>{let[r,n]=e5(e,t),o=t.sourceCode.getTokenByRangeStart(r),a=t.sourceCode.getTokenBefore(o);return[t.sourceCode.getRange(a)[1],n]})(e,r),a.getAllComments().some(e=>{let t=a.getRange(e);return t[0]>=o[0]&&t[1]<=o[1]}))))return`-${e.right.raw}`})(i,e.callee.object,r);if(n)return void(yield ak(t,i,n,r));if(to(i)||sP(i))return;let o=sR(i);return"number"==typeof o?void(yield ak(t,i,String(Math.max(0,o)),r)):(yield t.insertTextBeforeRange(u,"Math.max(0, "),void(yield t.insertTextAfterRange(u,")")))}if(o.every(e=>to(e))){let e;return void(yield(e=String(a.value+i.value),ak(t,i,e,r)))}return n()}:function*({node:e,fixer:t,context:r,abort:n}){let[o,a]=e.arguments,i=o?sR(o):void 0;if(!a){if(sP(o))return;if(void 0!==i)return void(yield ak(t,o,String(Math.max(0,i)),r));let e=e5(o,r);return yield t.insertTextBeforeRange(e,"Math.max(0, "),void(yield t.insertTextAfterRange(e,")"))}let s=sR(a);if(void 0!==i&&void 0!==s){let e=[Math.max(0,i),Math.max(0,s)];i>s&&e.reverse(),e[0]!==i&&(yield ak(t,o,String(e[0]),r)),e[1]!==s&&(yield ak(t,a,String(e[1]),r));return}if(0===i||0===s){let e=e4(o,r),n=e4(a,r);yield ak(t,o,"0",r),yield ak(t,a,`Math.max(0, ${0===i?n:e})`,r);return}return n()})({node:t,fixer:n,context:e,abort:o})}}}})},meta:{type:"suggestion",docs:{description:"Prefer `String#slice()` over `String#substr()` and `String#substring()`.",recommended:"unopinionated"},fixable:"code",messages:{substr:"Prefer `String#slice()` over `String#substr()`.",substring:"Prefer `String#slice()` over `String#substring()`."},languages:["js/js"]}},"unicorn/prefer-string-trim-start-end":{create:e=>{e.on("CallExpression",t=>{if(!tw(t,{methods:["trimLeft","trimRight"],argumentsLength:0,optionalCall:!1})||or(t.callee.object,e))return;let r=t.callee.property,n=r.name,o="trimLeft"===n?"trimStart":"trimEnd";return{node:r,messageId:sL,data:{method:n,replacement:o},fix:e=>e.replaceText(r,o)}})},meta:{type:"suggestion",docs:{description:"Prefer `String#trimStart()` / `String#trimEnd()` over `String#trimLeft()` / `String#trimRight()`.",recommended:"unopinionated"},fixable:"code",messages:{[sL]:"Prefer `String#{{replacement}}()` over `String#{{method}}()`."},languages:["js/js"]}},"unicorn/no-unreadable-iife":{create:e=>{e.on("CallExpression",t=>{if("ArrowFunctionExpression"!==t.callee.type||"BlockStatement"===t.callee.body.type||!e7(t.callee.body,e))return;let{body:r}=t.callee,n={node:t,loc:o4(e5(r,e),e),messageId:sN};return!function(e,t){let{sourceCode:r}=t,[n,o]=e5(e,t),[a,i]=r.getRange(e);return r.getCommentsInside(e.parent).some(e=>{let[t,s]=r.getRange(e);return t>=n&&s<=o&&(t<a||s>i)})}(r,e)&&(n.suggest=[{messageId:s$,fix:t=>t.replaceTextRange(e5(r,e),`{ return ${e.sourceCode.getText(r)}; }`)}]),n})},meta:{type:"suggestion",docs:{description:"Disallow unreadable IIFEs.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[sN]:"IIFE with parenthesized arrow function body is considered unreadable.",[s$]:"Use a block statement body."},languages:["js/js"]}},"unicorn/throw-new-error":{create:e=>{e.on("CallExpression",t=>{if("Decorator"===t.parent.type)return;let{callee:r}=t;if(!(t.optional||rY(r))&&("Identifier"===r.type&&sO.test(r.name)||"MemberExpression"===r.type&&!r.computed&&"Identifier"===r.property.type&&sO.test(r.property.name))&&!tT(r,{object:"Data",property:"TaggedError",computed:!1}))return{node:t,messageId:sM,fix:r=>aL(t,e,r)}})},meta:{type:"suggestion",docs:{description:"Require `new` when creating an error.",recommended:"unopinionated"},fixable:"code",messages:{[sM]:"Use `new` when creating an error."},languages:["js/js"]}},"unicorn/escape-case":{create:e=>{let t="lowercase"===e.options[0];e.on("Literal",e=>{if(tt(e))return s_({node:e,original:e.raw,lowercase:t})}),e.on("Literal",e=>{if(ta(e))return s_({node:e,original:e.raw,regex:sW,lowercase:t})}),e.on("TemplateElement",r=>{if(!tR(r.parent))return s_({node:r,original:r.value.raw,lowercase:t,fix:(t,n)=>aV(r,n,e,t)})})},meta:{type:"suggestion",docs:{description:"Require escape sequences to use uppercase or lowercase values.",recommended:"unopinionated"},fixable:"code",schema:[{enum:["uppercase","lowercase"],description:"The case style for escape sequences."}],defaultOptions:["uppercase"],messages:{[sU]:"Use uppercase characters for the value of the escape sequence.",[sq]:"Use lowercase characters for the value of the escape sequence."},languages:["js/js"]}},"unicorn/prefer-unicode-code-point-escapes":{create:e=>{e.on("Literal",e=>tt(e)?s6(e,e.raw):ta(e)?function(e){let t,{raw:r}=e,{pattern:n,flags:o}=(t=r.lastIndexOf("/"),{pattern:r.slice(1,t),flags:r.slice(t+1)}),{fixed:i,hasReplacement:s}=s8(n,{isRegex:!0,supportsNestedCharacterClasses:o.includes("v")}),l=o.includes("u")||o.includes("v"),u=function(e){for(let t=0;t<e.length;t++)if(void 0!==function(e,t){var r;if(!e.startsWith(sG,t))return;let n=t+sG.length;for(;r=e[n],sJ.test(r);)n++;if(n===t+sG.length||"}"!==e[n])return;let o=Number.parseInt(e.slice(t+sG.length,n),16);if(!(o>1114111))return o}(e,t)&&sQ(e,t))return!0;return!1}(n);if(!s&&(l||!u))return;let p=`/${s?i:n}/${s9(o)}`;return l?{node:e,messageId:sz,fix:t=>t.replaceText(e,p)}:!function(e,t){try{return new a(e,t),!0}catch{return!1}}(s?i:n,s9(o))?{node:e,messageId:sz}:{node:e,messageId:sz,suggest:[{messageId:sK,fix:t=>t.replaceText(e,p)}]}}(e):void 0),e.on("TemplateElement",t=>{if(!tR(t.parent))return s6(t,t.value.raw,(r,n)=>aV(t,n,e,r))})},meta:{type:"suggestion",docs:{description:"Prefer Unicode code point escapes over legacy escape sequences.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[sz]:"Prefer Unicode code point escapes.",[sK]:"Use Unicode code point escapes and add the `u` flag."},languages:["js/js"]}},"unicorn/prefer-prototype-methods":{create:function(e){let{sourceCode:t}=e,r=[];e.on("CallExpression",e=>{r.push(e)}),e.onExit("Program",function*(n){let o=new s;for(let{node:e,path:r}of new e1(t.getScope(n)).iterateGlobalReferences(Object.fromEntries(s5.map(e=>[e,{[e1.READ]:!0}]))))o.set(e,r);for(let t of r)yield function(e,{context:t,globalReferences:r}){let n;tw(e,{object:"Reflect",method:"apply",minimumArguments:1,optionalCall:!1,optionalMember:!1})?n=e.arguments[0]:tw(e,{methods:["apply","bind","call"],optionalCall:!1,optionalMember:!1})&&(n=e.callee.object);let{isGlobalReference:o,constructorName:a,methodName:i}=function(e,{context:t,globalReferences:r}){if(!e)return;if(r.has(e))return{isGlobalReference:!0,constructorName:"Object",methodName:r.get(e).at(-1)};if(!tT(e,{optional:!1}))return;let n=e.object;if(th(n)||tx(n))return{constructorName:"ArrayExpression"===n.type?"Array":"Object",methodName:eO(e,t.sourceCode.getScope(e))}}(n,{context:t,globalReferences:r})??{};if(a)return{node:n,messageId:i?"known-method":"unknown-method",data:{constructorName:a,methodName:i},*fix(r){if(o)return void(yield r.replaceText(n,`${a}.prototype.${i}`));if(tT(n)){let o=n.object;yield r.replaceText(o,`${a}.prototype`),("ArrayExpression"===o.type||"ObjectExpression"===o.type)&&(yield aP(r,e,t))}}}}(t,{context:e,globalReferences:o})})},meta:{type:"suggestion",docs:{description:"Prefer borrowing methods from the prototype instead of the instance.",recommended:"unopinionated"},fixable:"code",messages:{"known-method":"Prefer using `{{constructorName}}.prototype.{{methodName}}`.","unknown-method":"Prefer using method from `{{constructorName}}.prototype`."},languages:["js/js"]}},"unicorn/error-message":{create:e=>{e.on(["CallExpression","NewExpression"],t=>{if(!(tm(t,{names:s4,optional:!1},td)&&e.sourceCode.isGlobalReference(t.callee)))return;let r=t.callee.name,n=lr.has(r)?lr.get(r):0,o=t.arguments;if(o.some((e,t)=>t<=n&&"SpreadElement"===e.type))return;let a=o[n];if(!a)return{node:t,messageId:s7,data:{constructorName:r}};if("ArrayExpression"===a.type||"ObjectExpression"===a.type)return{node:a,messageId:lt};let i=e$(a,e.sourceCode.getScope(a));if(!i)return;let{value:s}=i;return"string"!=typeof s?{node:a,messageId:lt}:""===s?{node:a,messageId:le}:void 0})},meta:{type:"problem",docs:{description:"Enforce passing a `message` value when creating a built-in error.",recommended:"unopinionated"},messages:{[s7]:"Pass a message to the `{{constructorName}}` constructor.",[le]:"Error message should not be an empty string.",[lt]:"Error message should be a string."},languages:["js/js"]}},"unicorn/no-instanceof-builtins":lc,"unicorn/prefer-type-error":{create:e=>{e.on("ThrowStatement",e=>{let t;if(!(tf(e.argument,{name:"Error"})&&e.parent&&e.parent.body&&1===e.parent.body.length&&e.parent.parent&&"IfStatement"===(t=e.parent.parent).type&&lb(t.test)))return;let r=e.argument.callee;return{node:r,messageId:ld,fix:e=>e.insertTextBefore(r,"Type")}})},meta:{type:"suggestion",docs:{description:"Enforce throwing `TypeError` in type checking conditions.",recommended:"unopinionated"},fixable:"code",messages:{[ld]:"`new Error()` is too unspecific for a type check. Use `new TypeError()` instead."},languages:["js/js"]}},"unicorn/consistent-destructuring":{create:e=>{let{sourceCode:t}=e,r=new o,n=[],a=[],i=e=>{let r=rj(e.object);if(e.computed||"Identifier"!==e.property.type||!["Identifier","ThisExpression"].includes(r.type))return;let n=t.getScope(e);a.push({propertyName:e.property.name,rootIdentifierName:"Identifier"===r.type?r.name:void 0,rootVariable:"Identifier"===r.type?ey(n,r):void 0,thisScopeBoundary:"ThisExpression"===r.type?lD(r):void 0,start:t.getRange(e)[0],scope:n})},s=e=>{switch(e.type){case"MemberExpression":i(e);break;case"AssignmentPattern":s(e.left);break;case"RestElement":s(e.argument);break;case"ObjectPattern":for(let t of e.properties)s("Property"===t.type?t.value:t.argument);break;case"ArrayPattern":for(let t of e.elements)t&&s(t)}};e.on("AssignmentExpression",e=>{s(e.left)}),e.on(["ForInStatement","ForOfStatement"],e=>{"VariableDeclaration"!==e.left.type&&s(e.left)}),e.on("UpdateExpression",e=>{"MemberExpression"===e.argument.type&&i(e.argument)}),e.on("UnaryExpression",e=>{"delete"===e.operator&&"MemberExpression"===e.argument.type&&i(e.argument)}),e.on("VariableDeclarator",e=>{let n;if(!("ObjectPattern"===e.id.type&&"const"===e.parent.kind&&e.init&&("Identifier"===(n=e.init).type||"ThisExpression"===n.type)))return;let o="Identifier"===e.init.type?e.init:void 0,a={scope:t.getScope(e),object:e.init,rootIdentifierName:o?.name,rootVariable:o&&ey(t.getScope(e),o),thisScopeBoundary:"ThisExpression"===e.init.type?lD(e.init):void 0,objectPattern:e.id},i=t.getText(e.init);r.set(i,[...r.get(i)??[],a])});let l=e=>{let n,o;if((o=e).computed||tm(o.parent,void 0,td)&&o.parent.callee===o||"TaggedTemplateExpression"===o.parent.type&&o.parent.tag===o||nL(o))return;let i=rj(e.object),s=r.get(t.getText(i));if(!s)return;let l=t.getScope(e),u="Identifier"===i.type?i:void 0,p=u&&ey(l,u),c="ThisExpression"===i.type?lD(i):void 0,d=t.getText(e.property);for(let r of s.toReversed())if(lA({declaration:r,memberExpressionNode:e,memberScope:l,memberRootIdentifier:u,memberRootVariable:p,memberThisScopeBoundary:c,memberExpressionWrites:a,sourceCode:t})&&(n=lT(r.objectPattern.properties.filter(e=>lS(e)&&"Identifier"===e.value.type),d,l,t)))break;if(!n||((e,t)=>{let r=e,{parent:n}=e;for(;n&&!lI(n);){if(lk(n,r,e,t))return!0;r=n,n=n.parent}return!1})(e,t))return;if("MemberExpression"===e.parent.type)return{node:e,messageId:lE};let m=t.getText(e),f=n.value.name;return{node:e,messageId:lE,suggest:[{messageId:lv,data:{expression:m,property:f},fix:t=>t.replaceText(e,f)}]}};e.on("MemberExpression",e=>{n.push(e)}),e.onExit("Program",function*(){for(let e of n){let t=l(e);t&&(yield t)}})},meta:{type:"suggestion",docs:{description:"Use destructured variables over properties.",recommended:!1},hasSuggestions:!0,messages:{[lE]:"Use destructured variables over properties.",[lv]:"Replace `{{expression}}` with destructured property `{{property}}`."},languages:["js/js"]}},"unicorn/new-for-builtins":{create:e=>{lL.listen({context:e}),lN.listen({context:e}),l$.listen({context:e}),lM.listen({context:e})},meta:{type:"suggestion",docs:{description:"Enforce correct use of `new` for builtin constructors.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{enforce:"Use `new {{name}}()` instead of `{{name}}()`.",disallow:"Use `{{name}}()` instead of `new {{name}}()`.",disallowCallOrNew:"`{{name}}` is not a function or constructor.",[lB]:"Use `String(new Date())` instead of `Date()`.",[lR]:"Switch to `String(new Date())`."},languages:["js/js"]}},"unicorn/prefer-single-call":l_,"unicorn/no-process-exit":{create:e=>{if(0===e.sourceCode.lines[0].indexOf("#!"))return;let t=0,r=!1,n=[],o=e=>tw(e,{object:"process",methods:["on","once"],minimumArguments:1,optionalCall:!1,optionalMember:!1});e.on("CallExpression",e=>{tj(e)&&lK(e.arguments[0])&&(r=!0)}),e.on("ImportDeclaration",e=>{"Literal"===e.source.type&&lK(e.source)&&(r=!0)}),e.on("CallExpression",e=>{o(e)&&t++}),e.onExit("CallExpression",e=>{o(e)&&t--}),e.on("CallExpression",e=>{0===t&&tw(e,{object:"process",method:"exit",optionalCall:!1,optionalMember:!1})&&n.push(e)}),e.onExit("Program",function*(){if(!r)for(let e of n)yield{node:e,messageId:lz}})},meta:{type:"suggestion",docs:{description:"Disallow `process.exit()`.",recommended:"unopinionated"},messages:{[lz]:"Only use `process.exit()` in CLI apps. Throw an error instead."},languages:["js/js"]}},"unicorn/no-static-only-class":{create:function(e){e.on(["ClassDeclaration","ClassExpression"],t=>{if(!(t.superClass||t.decorators&&t.decorators.length>0||"ClassBody"!==t.body.type||0===t.body.body.length||t.body.body.some(e=>!function(e){let{private:t,static:r,declare:n,readonly:o,accessibility:a,decorators:i,key:s}=e;return(!!l2(e)||"MethodDefinition"===e.type)&&!!r&&!t&&"PrivateIdentifier"!==s.type&&!(n||o||void 0!==a||Array.isArray(i)&&i.length>0)}(e))))return{node:t,loc:function(e,t){let{sourceCode:r}=t,{body:n}=e,o=r.getTokenBefore(n),{start:a}=r.getLoc(e),{end:i}=r.getLoc(o);return{start:a,end:i}}(t,e),messageId:l0,fix:function(e,t){let{type:r,id:n,body:o,declare:a,abstract:i,implements:s,parent:l}=e;if(a||i||Array.isArray(s)&&s.length>0||"ClassExpression"===r&&n)return;let u="ClassDeclaration"===e.type&&"ExportDefaultDeclaration"===e.parent.type&&e.parent.declaration===e;if(u&&n)return;let{sourceCode:p}=t;for(let e of o.body)if(l2(e)&&(e.typeAnnotation||e.value&&p.getText(e.value).includes("this")))return;return function*(n){let a=p.getFirstToken(e);if(tW(a,{expected:{type:"Keyword",value:"class"},ruleId:"no-static-only-class"}),u||"ClassExpression"===r)if("ClassExpression"===r&&"ReturnStatement"===l.type&&p.getLoc(o).start.line!==p.getLoc(l).start.line&&p.text.slice(p.getRange(a)[1],p.getRange(o)[0]).trim()){yield n.replaceText(a,"{");let e=p.getFirstToken(o);yield n.remove(e)}else yield n.replaceText(a,""),yield aF(a,t,n);else yield n.replaceText(a,"const"),yield n.insertTextBefore(o,"= "),yield n.insertTextAfter(o,";");for(let e of o.body)yield function*(e,t,r){let{sourceCode:n}=t,o=n.getFirstToken(e);tW(o,{expected:{type:"Keyword",value:"static"},ruleId:"no-static-only-class"}),yield r.remove(o),yield aF(o,t,r);let a=l2(e)?n.getLastToken(e):n.getTokenAfter(e),i=eE(a);if(l2(e)){let{key:t,value:o}=e;if(o){let e=n.getTokenAfter(t,l1);yield r.replaceText(e,":")}else i?yield r.insertTextBefore(a,": undefined"):yield r.insertTextAfter(e,": undefined")}yield i?r.replaceText(a,","):r.insertTextAfter(e,",")}(e,t,n)}}(t,e)}})},meta:{type:"suggestion",docs:{description:"Disallow classes that only have static members.",recommended:"unopinionated"},fixable:"code",messages:{[l0]:"Use an object instead of a class with only static members."},languages:["js/js"]}},"unicorn/no-unreadable-array-destructuring":l6,"unicorn/no-useless-spread":{create:e=>{let{sourceCode:t}=e;e.on(["ArrayExpression","ObjectExpression"],r=>{if(!("SpreadElement"===r.parent.type&&r.parent.argument===r&&("ObjectExpression"===r.type&&"ObjectExpression"===r.parent.parent.type&&r.parent.parent.properties.includes(r.parent)||"ArrayExpression"===r.type&&("ArrayExpression"===r.parent.parent.type&&r.parent.parent.elements.includes(r.parent)||tm(r.parent.parent,void 0,td)&&r.parent.parent.arguments.includes(r.parent)))))return;let n=r.parent,o=t.getFirstToken(n),a=n.parent.type,i={node:o,messageId:l9,data:{argumentType:"ArrayExpression"===r.type?"array":"object",parentDescription:ul[a]}};return"NewExpression"===a&&us(r)&&tf(n.parent,{names:uo,argumentsLength:1,allowSpreadElement:!0})?i:{...i,*fix(i){let s;yield i.remove(o),yield aT(r,i,e);let l=t.getFirstToken(r);yield i.remove(l);let[u,p]=t.getLastTokens(r,2);if(yield i.remove(p),eb(u)&&(yield i.remove(u)),th(r)||tx(r)){let e=t.getTokenAfter(n);eb(e)&&(yield i.remove(e))}if("CallExpression"===a||"NewExpression"===a)for(let[e,n]of(s=t.getFirstToken(r),r.elements.map((e,n,o)=>{if(n===o.length-1){let e=t.getLastToken(r,{skip:1});return eb(e)?e:void 0}let a=t.getTokenAfter(e||s,eb);return s=a,a})).entries())null===r.elements[e]&&(yield i.insertTextBefore(n,"undefined"))}}}),e.on("ObjectExpression",r=>{if(!("ObjectExpression"===r.type&&r.properties.length>0&&r.properties.every(e=>"SpreadElement"===e.type&&"ObjectExpression"!==e.argument.type)))return;let n=r.parent;if(!tw(n,{object:"Object",method:"assign",minimumArguments:2,optionalMember:!1,optionalCall:!1}))return;let o=n.arguments.indexOf(r),a=n.arguments.slice(0,o).some(e=>"SpreadElement"!==e.type);if(o<=0||!a)return;let i={node:t.getFirstToken(r.properties[0]),messageId:ut};return t.getCommentsInside(r).length>0?i:{...i,suggest:[{messageId:un,fix:t=>t.replaceText(r,r.properties.map(t=>e4(t.argument,e)).join(", "))}]}}),e.on("NewExpression",e=>{if(tf(e,{names:uo,argumentsLength:1,allowSpreadElement:!0})&&"SpreadElement"===e.arguments[0].type&&"ArrayExpression"!==e.arguments[0].argument.type)return{node:e.arguments[0],messageId:ue,data:{constructorName:`new ${e.callee.name}(…)`}}}),e.on("ArrayExpression",t=>{if(!us(t))return;let{parent:r}=t;if(!("ForOfStatement"===r.type&&r.right===t||"YieldExpression"===r.type&&r.delegate&&r.argument===t||(tf(r,{names:uo,argumentsLength:1})||tf(r,{names:rZ,minimumArguments:1})||tw(r,{object:"Promise",methods:["all","allSettled","any","race"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||tw(r,{objects:["Array",...rZ],method:"from",argumentsLength:1,optionalCall:!1,optionalMember:!1})||tw(r,{object:"Object",method:"fromEntries",argumentsLength:1,optionalCall:!1,optionalMember:!1}))&&r.arguments[0]===t))return;let n="",o=l5;switch(r.type){case"ForOfStatement":o=l4;break;case"YieldExpression":o=l7;break;case"NewExpression":n=`new ${r.callee.name}(…)`;break;case"CallExpression":n=`${r.callee.object.name}.${r.callee.property.name}(…)`}return{node:t,messageId:o,data:{parentDescription:n},fix:r=>uu(r,t,e)}}),e.on("ArrayExpression",t=>{if(!us(t))return;let r=t.elements[0].argument,n=!!tw(r,{methods:ui,optionalCall:!1,optionalMember:!1})&&nE(r.callee.object,e)&&nE(r,e);if(!n&&!(!nv(r,e)&&(tw(r,{methods:ua,optionalCall:!1,optionalMember:!1})?!up(r,e):tw(r,{method:"concat",optionalCall:!1,optionalMember:!1})?!("Identifier"===r.callee.object.type&&"Iterator"===r.callee.object.name||up(r,e)):tw(r,{method:"split",optionalCall:!1,optionalMember:!1})||tw(r,{object:"Object",methods:["keys","values"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||"AwaitExpression"===r.type&&tw(r.argument,{object:"Promise",methods:["all","allSettled"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||tw(r,{object:"Array",methods:["from","of"],optionalCall:!1,optionalMember:!1})||tf(r,{name:"Array"}))))return;let o={node:t,messageId:ur};return tf(r,{name:"Array"})||tw(r,{method:"slice",optionalCall:!1,optionalMember:!1})&&!n?o:Object.assign(o,{fix:r=>uu(r,t,e)})})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary spread.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[l9]:"Spread an {{argumentType}} literal in {{parentDescription}} is unnecessary.",[l5]:"`{{parentDescription}}` accepts an iterable as an argument, it's unnecessary to convert to an array.",[l4]:"`for…of` can iterate over an iterable, it's unnecessary to convert to an array.",[l7]:"`yield*` can delegate to an iterable, it's unnecessary to convert to an array.",[ue]:"`{{constructorName}}` accepts a single iterable argument, spreading is misleading.",[ut]:"`Object.assign(…)` source object with only spread properties is unnecessary.",[ur]:"Unnecessarily cloning an array.",[un]:"Remove the object literal wrapper."},languages:["js/js"]}},"unicorn/no-useless-switch-case":{create:e=>{let t=rz(e.physicalFilename);e.on("SwitchStatement",function*(r){let{cases:n}=r;if(!(n.length<2)&&null===n.at(-1).test)for(let r=n.length-2;r>=0;r--){let o=n[r];if(!um(o))break;t&&uf(o)||(yield{node:o,loc:function(e,t){let{sourceCode:r}=t,n=e.test||r.getFirstToken(e),o=r.getTokenAfter(n,ev);return{start:r.getLoc(e).start,end:r.getLoc(o).end}}(o,e),messageId:uc,suggest:[{messageId:ud,fix:e=>e.remove(o)}]})}})},meta:{type:"suggestion",docs:{description:"Disallow useless case in switch statements.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[uc]:"Useless case in switch statement.",[ud]:"Remove this case."},languages:["js/js"]}},"unicorn/no-useless-undefined":uP,"unicorn/numeric-separators-style":uM,"unicorn/prefer-array-find":u6,"unicorn/prefer-array-flat-map":{create:e=>{e.on("CallExpression",t=>{if(!(tw(t,{method:"flat",optionalCall:!1,optionalMember:!1})&&(0===t.arguments.length||1===t.arguments.length&&"Literal"===t.arguments[0].type&&"1"===t.arguments[0].raw)&&tw(t.callee.object,{method:"map",optionalCall:!1})))return;let r=t.callee.object;if(tB(r.callee.object,u7)||nD(r.callee.object,e))return;let{sourceCode:n}=e,o=r.callee.property,a=rL(e,t,[r])||t.typeArguments||t.typeParameters||r.typeArguments||r.typeParameters?void 0:function*(r){yield aM(r,t,e),yield r.replaceText(o,"flatMap")};return{node:t,loc:{start:n.getLoc(o).start,end:n.getLoc(t).end},messageId:u9,fix:a}}),e.on("CallExpression",t=>{let r;if(!tw(t,{method:"flatMap",argumentsLength:1,optionalCall:!1,optionalMember:!1,computed:!1})||t.typeArguments||t.typeParameters)return;let n=t.callee.object;if(!tw(n,{method:"filter",argumentsLength:1,optionalCall:!1,optionalMember:!1,computed:!1})||n.typeArguments||n.typeParameters||rY(n.callee.object)||nv(n.callee.object,e))return;let{sourceCode:o}=e;if(o.getCommentsInside(t).length>0)return;let[a]=n.arguments,[i]=t.arguments;if(!pt(a)||!pt(i)||!("ArrayExpression"===(r=i.body).type&&r.elements.length>1))return;let[s]=a.params,[l]=i.params;if(!om(s,l))return;let u=function(e,t){if(e7(e,t))return e4(e,t);let r=t.sourceCode.getText(e);return oZ(e,t)?`(${r})`:r}(n.callee.object,e),p=o.getText(s),c=function(e,t){if(e7(e,t))return e4(e,t);let r=t.sourceCode.getText(e);return pe.has(e.type)?`(${r})`:r}(a.body,e),d=o.getText(i.body);return{node:t.callee.property,messageId:u5,suggest:[{messageId:u4,fix:e=>e.replaceText(t,`${u}.flatMap(${p} => ${c} ? ${d} : [])`)}]}})},meta:{type:"suggestion",docs:{description:"Prefer `.flatMap(…)` over `.map(…).flat()` and `.filter(…).flatMap(…)`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[u9]:"Prefer `.flatMap(…)` over `.map(…).flat()`.",[u5]:"Prefer a single `.flatMap(…)` over `.filter(…).flatMap(…)`.",[u4]:"Replace `.filter(…).flatMap(…)` with a single `.flatMap(…)`."},languages:["js/js"]}},"unicorn/prefer-array-flat":pp,"unicorn/prefer-array-some":pf,"unicorn/prefer-code-point":{create:e=>{e.on("CallExpression",e=>{if(tw(e,{method:"charCodeAt",optionalCall:!1}))return pg(e.callee.property,"codePointAt",!(e=>{let t=(e=>{let t=e;for(;;){let{parent:e}=t;if("ChainExpression"===e.type||"LogicalExpression"===e.type||"ConditionalExpression"===e.type&&(e.consequent===t||e.alternate===t)){t=e;continue}return t}})(e),{parent:r}=t;switch(r.type){case"BinaryExpression":return py.has(r.operator);case"UnaryExpression":return ph.has(r.operator);case"AssignmentExpression":return r.right===t&&py.has(r.operator.slice(0,-1));default:return!1}})(e))}),e.on("MemberExpression",e=>{if(tT(e,{object:"String",property:"fromCharCode",optional:!1}))return pg(e.property,"fromCodePoint")})},meta:{type:"suggestion",docs:{description:"Prefer `String#codePointAt(…)` over `String#charCodeAt(…)` and `String.fromCodePoint(…)` over `String.fromCharCode(…)`.",recommended:"unopinionated"},hasSuggestions:!0,messages:{"error/charCodeAt":"Prefer `String#codePointAt()` over `String#charCodeAt()`.","error/fromCharCode":"Prefer `String.fromCodePoint()` over `String.fromCharCode()`.","suggestion/codePointAt":"Use `String#codePointAt()`.","suggestion/fromCodePoint":"Use `String.fromCodePoint()`."},languages:["js/js"]}},"unicorn/prefer-default-parameters":{create:e=>{let{sourceCode:t}=e,r=[],n=(e,n,o,a)=>{let i,s=r.at(-1);if(!s||!n||!o||"Identifier"!==n.type||"LogicalExpression"!==o.type||"||"!==o.operator&&"??"!==o.operator||"Identifier"!==o.left.type||"Literal"!==o.right.type)return;let{name:l}=n,{left:{name:u},right:{raw:p}}=o;if(a&&l!==u)return;let c=ey(t.getScope(e),u);if(!c)return;let{references:d}=c,{params:m}=s,f=m.find(e=>"Identifier"===e.type&&e.name===u);if(((e,t,r)=>{for(let n of t.body.body){if(n===r)break;if(pv(e,n))return!0}return!1})(t,s,e)||a&&d[0].identifier!==n||!a&&d.length>1||(i=m.at(-1),!f||f!==i))return;let g=((e,t)=>{if("ArrowFunctionExpression"!==t.type||t.params.length>1)return!1;let[r]=t.params,n=e.getTokenBefore(r),o=e.getTokenAfter(r);return!o||!n||"("!==n.value||")"!==o.value})(t,s)?`(${l} = ${p})`:`${l} = ${p}`;return{node:e,messageId:px,suggest:[{messageId:pb,fix:r=>[r.replaceText(f,g),((e,t,r)=>{let{line:n}=t.getLoc(r).start,{column:o}=t.getLoc(r).end,a=t.getText(r),i=t.lines[n-1];if(i.trim()===a)return e.removeRange([t.getIndexFromLoc({line:n,column:0}),t.getIndexFromLoc({line:n+1,column:0})]);if(" "===i[o]){let[n,o]=t.getRange(r);return e.removeRange([n,o+1])}return e.remove(r)})(r,t,e)]}]}};e.on(tE,e=>{r.push(e)}),e.onExit(tE,()=>{r.pop()}),e.on("AssignmentExpression",e=>{if("ExpressionStatement"===e.parent.type&&e.parent.expression===e)return n(e.parent,e.left,e.right,!0)}),e.on("VariableDeclarator",e=>{if("VariableDeclaration"===e.parent.type&&e.parent.declarations[0]===e)return n(e.parent,e.id,e.init,!1)})},meta:{type:"suggestion",docs:{description:"Prefer default parameters over reassignment.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[px]:"Prefer default parameters over reassignment.",[pb]:"Replace reassignment with default parameter."},languages:["js/js"]}},"unicorn/prefer-logical-operator-over-ternary":{create:e=>{let{sourceCode:t}=e;e.on("ConditionalExpression",r=>{let{test:n,consequent:o,alternate:a}=r,i=function(e,t){let{test:r,consequent:n,alternate:o}=e,a=function(e,t){let r=pF(e);if(r?.kind==="nullish")return r;if("LogicalExpression"!==e.type)return;let n=pF(e.left),o=pF(e.right);if(n&&o&&pk(n.reference,o.reference,t)){if("||"===e.operator&&n.isTrueWhenNullish&&o.isTrueWhenNullish&&pB(n,o))return{reference:n.reference,isTrueWhenNullish:!0};if("&&"===e.operator&&!n.isTrueWhenNullish&&!o.isTrueWhenNullish&&pB(n,o))return{reference:n.reference,isTrueWhenNullish:!1}}}(r,t.sourceCode);if(!a||t.sourceCode.getCommentsInside(e).length>0)return;let{reference:i}=a;if(a.isTrueWhenNullish&&pk(i,o,t.sourceCode))return pI({context:t,conditionalExpression:e,left:o,right:n,operators:["??"]});if(!a.isTrueWhenNullish&&pk(i,n,t.sourceCode))return pI({context:t,conditionalExpression:e,left:n,right:o,operators:["??"]});let s=a.isTrueWhenNullish?n:o,l=a.isTrueWhenNullish?o:n;if(!tP(s)||!tT(l)||l.optional||!rC(rj(i),rj(l.object))||function(e){let t=e,{parent:r}=t;for(;rI(r)&&r.expression===t;)r=(t=r).parent;return"UnaryExpression"===r.type&&"delete"===r.operator&&r.argument===t||"CallExpression"===r.type&&r.callee===t||"TaggedTemplateExpression"===r.type&&r.tag===t}(e))return;let u=function(e,t){let{sourceCode:r}=t,n=rV(e,t);if(r$(t,n))return;let[o,a]=r.getRange(e),[i,s]=n;return r.text.slice(o,i)+(e.computed?"?.[":"?.")+r.text.slice(s,a)}(l,t);if(u)return{node:e,messageId:pD,suggest:[{messageId:pT,fix(r){let n=u;return oD(t.sourceCode.getTokenBefore(e),t,n)&&(n=`;${n}`),r.replaceText(e,n)}}]}}(r,e);return i||(pk(n,o,t)?pI({context:e,conditionalExpression:r,left:n,right:a}):"UnaryExpression"===n.type&&"!"===n.operator&&n.prefix&&pk(n.argument,a,t)?pI({context:e,conditionalExpression:r,left:n.argument,right:o}):void 0)})},meta:{type:"suggestion",docs:{description:"Prefer using a logical operator over a ternary.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[pC]:"Prefer using a logical operator over a ternary.",[pD]:"Prefer using optional chaining over a ternary.",[pS]:"Switch to `{{operator}}` operator.",[pT]:"Switch to optional chaining."},languages:["js/js"]}},"unicorn/prefer-optional-catch-binding":{create:e=>{e.on("CatchClause",t=>{let r=t.param;if(!r)return;let{sourceCode:n}=e;if(n.getDeclaredVariables(r.parent).some(e=>e.references.length>0))return;let{type:o,name:a,parent:i}=r,s=n.getCommentsInside(r).length>0;return{node:r,messageId:"Identifier"===o?pR:pP,data:{name:a},fix:s?void 0:function*(e){let t=n.getTokenBefore(r);tW(t,{test:eC,expected:"(",ruleId:"prefer-optional-catch-binding"});let o=n.getTokenAfter(r);tW(o,{test:eD,expected:")",ruleId:"prefer-optional-catch-binding"}),yield e.remove(t),yield e.remove(r),yield e.remove(o);let[,a]=n.getRange(o),[s]=n.getRange(i.body),l=n.text.slice(a,s),u=l.length-l.trimStart().length;0!==u&&(yield e.removeRange([a,a+u]))}}})},meta:{type:"suggestion",docs:{description:"Prefer omitting the `catch` binding parameter.",recommended:"unopinionated"},fixable:"code",messages:{[pR]:"Remove unused catch binding `{{name}}`.",[pP]:"Remove unused catch binding."},languages:["js/js"]}},"unicorn/prefer-regexp-test":ce,"unicorn/prefer-set-has":cf,"unicorn/prefer-string-raw":{create:e=>{e.on("Literal",t=>{if(!tt(t)||function(e){let{parent:t}=e,{type:r}=t;return tg(t)||["Property","PropertyDefinition","MethodDefinition","AccessorProperty"].includes(r)&&!t.computed&&t.key===e||["TSAbstractPropertyDefinition","TSAbstractMethodDefinition","TSAbstractAccessorProperty","TSPropertySignature"].includes(r)&&t.key===e||["ImportDeclaration","ExportNamedDeclaration","ExportAllDeclaration"].includes(r)&&t.source===e||"ImportAttribute"===r&&(t.key===e||t.value===e)||"ImportSpecifier"===r&&t.imported===e||"ExportSpecifier"===r&&(t.local===e||t.exported===e)||"ExportAllDeclaration"===r&&t.exported===e||"JSXAttribute"===r&&t.value===e||"TSEnumMember"===r&&(t.initializer===e||t.id===e)||"TSModuleDeclaration"===r&&t.id===e||"TSExternalModuleReference"===r&&t.expression===e||"TSLiteralType"===r&&t.literal===e||"TSImportType"===r&&t.source===e}(t)||cg(t))return;let{sourceCode:r}=e,{raw:n}=t;if("\\"===n.at(-2)||!n.includes("\\\\")||n.includes("`")||n.includes("${")||r.getLoc(t).start.line!==r.getLoc(t).end.line)return;let o=cx(n.slice(1,-1),n.charAt(0));if(o===t.value)return{node:t,messageId:cy,*fix(r){yield aP(r,t,e),yield r.replaceText(t,`String.raw\`${o}\``)}}}),e.on("TemplateLiteral",t=>{if(!("TaggedTemplateExpression"===t.parent.type&&t.parent.quasi===t||t.quasis.every(({value:{cooked:e,raw:t}})=>e===t)||t.quasis.some(({value:{cooked:e,raw:t}})=>"\\"===e.at(-1)||cx(t)!==e)||cg(t)))return{node:t,messageId:cy,*fix(r){for(let n of(yield aP(r,t,e),yield r.insertTextBefore(t,"String.raw"),t.quasis)){let{cooked:t,raw:o}=n.value;t!==o&&(yield aV(n,t,e,r))}}}}),e.on("TaggedTemplateExpression",t=>{let{quasi:r,tag:n,parent:o}=t,{sourceCode:a}=e;if(!tT(n,{object:"String",property:"raw",optional:!1})||!a.isGlobalReference(n.object)||r.quasis.some(e=>e.value.raw.includes("\\")))return;let i=a.getText(r),s=r.expressions.length>0||/\r?\n/.test(i)?i:`'${i.slice(1,-1).replaceAll("'",()=>String.raw`\'`)}'`;return{node:n,messageId:ch,*fix(r){let n=a.getTokenBefore(t);oD(n,e,s)&&(yield r.insertTextBefore(t,";")),"ReturnStatement"!==o.type&&"ThrowStatement"!==o.type||op(n,t.quasi,e)||e7(t,e)||(yield aj(r,o,e)),"YieldExpression"!==o.type||o.delegate||o.argument!==t||op(n,t.quasi,e)||e7(t,e)||(yield r.insertTextBefore(t,"("),yield r.insertTextAfter(t,")")),yield r.replaceText(t.quasi,s),yield aT(t.tag,r,e),yield r.remove(t.tag)}}})},meta:{type:"suggestion",docs:{description:"Prefer using the `String.raw` tag to avoid escaping `\\`.",recommended:"unopinionated"},fixable:"code",messages:{[cy]:"`String.raw` should be used to avoid escaping `\\`.",[ch]:"Using `String.raw` is unnecessary as the string does not contain any `\\`."},languages:["js/js"]}},"unicorn/prefer-switch":cT,"unicorn/require-number-to-fixed-digits-argument":{create:e=>{e.on("CallExpression",t=>{if(!tw(t,{method:"toFixed",argumentsLength:0,optionalCall:!1})||"NewExpression"===t.callee.object.type)return;let{sourceCode:r}=e,[n,o]=r.getLastTokens(t,2);return{loc:{start:r.getLoc(n).start,end:r.getLoc(o).end},messageId:cA,fix:r=>aA(r,t,"0",e)}})},meta:{type:"suggestion",docs:{description:"Enforce using the digits argument with `Number#toFixed()`.",recommended:"unopinionated"},fixable:"code",messages:{[cA]:"Missing the digits argument."},languages:["js/js"]}},"unicorn/template-indent":{create:e=>{let{sourceCode:t}=e,r={...e.options[0]},n=(e=>{let t=new i,r=[e.ast];for(;r.length>0;){let n=r.pop();if(n){if("TemplateLiteral"===n.type){let{start:{line:r},end:{line:o}}=e.getLoc(n);for(let e=r+1;e<=o;e++)t.add(e)}for(let t of e.visitorKeys[n.type]??[]){let e=n[t];Array.isArray(e)?r.push(...e):r.push(e)}}}return t})(t);r.comments=r.comments.map(e=>e.toLowerCase());let o=new l,a=a=>{let i;if("TemplateLiteral"!==a.type||o.has(a))return;o.add(a);let s="__PLACEHOLDER__"+Math.random(),l=a.quasis.map(e=>t.getText(e).slice(1,e.tail?-1:-2)).join(s),u=l.match(/\r?\n/);if(!u)return;let p=u[0],c=t.getLoc(a),d=t.lines[c.start.line-1].match(/^(\s*)\S/),m=d?d[1]:"";i="string"==typeof r.indent?r.indent:"number"==typeof r.indent?" ".repeat(r.indent):((e,t,r,n)=>{if(""===r){let r;return cF(cR(e.lines,t)).indent||cF(cw(r=cR(n.split(/\r?\n/)))).indent||cF(r).indent||" "}return r.startsWith(" ")?" ":" "})(t,n,m,l);let f=cw(l).replaceAll(RegExp(`^${p}|${p}[ ]*$`,"g"),""),g=p+function(e,t=1,r={}){let{indent:n=" ",includeEmptyLines:o=!1}=r;if("string"!=typeof e)throw TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof e}\``);if("number"!=typeof t)throw TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof t}\``);if(t<0)throw RangeError(`Expected \`count\` to be at least 0, got \`${t}\``);if("string"!=typeof n)throw TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof n}\``);return 0===t?e:e.replace(o?/^/gm:/^(?!\s*$)/gm,n.repeat(t))}(f,1,{indent:m+i})+p+m;if(g!==l)return{node:a,messageId:cB,fix:t=>g.split(s).map((r,n)=>aV(a.quasis[n],r,e,t))}};e.on("TemplateLiteral",e=>{if((e=>{if(r.comments.length>0){let n=t.getTokenBefore(e,{includeComments:!0});if(n?.type==="Block"&&r.comments.includes(n.value.trim().toLowerCase()))return!0}return!!(cg(e)||r.tags.length>0&&tR(e,r.tags))||!!(r.functions.length>0&&"CallExpression"===e.parent.type&&e.parent.arguments.includes(e)&&tB(e.parent.callee,r.functions))})(e))return a(e)}),e.on(r.selectors,e=>a(e))},meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation.",recommended:!0},fixable:"code",schema:cP,defaultOptions:[{tags:["outdent","dedent","gql","sql","html","styled"],functions:["dedent","stripIndent"],selectors:[],comments:["HTML","indent"]}],messages:{[cB]:"Templates should be properly indented."},languages:["js/js"]}},"unicorn/no-single-promise-in-promise-methods":{create:e=>{e.on("CallExpression",t=>{if(!(tw(t,{object:"Promise",methods:lY,optionalMember:!1,optionalCall:!1,argumentsLength:1})&&"ArrayExpression"===t.arguments[0].type&&1===t.arguments[0].elements.length&&t.arguments[0].elements[0]&&"SpreadElement"!==t.arguments[0].elements[0].type))return;let r=t.callee.property.name,n={node:t.arguments[0],messageId:lG,data:{method:r}},{sourceCode:o}=e;if("AwaitExpression"===t.parent.type&&t.parent.argument===t&&("all"!==r||tb(t.parent.parent)))return n.fix=r=>r.replaceText(t,lH(t,e)),n;return"all"===r?(n.fix=((e,t)=>{let{sourceCode:r}=t;if(lQ(r,e))return;let n=e.parent;if("AwaitExpression"!==n.type||n.argument!==e)return;let o=(e=>{let{parent:t}=e;return"VariableDeclarator"===t.type&&t.init===e&&lZ(t.id)?t.id:"AssignmentExpression"===t.type&&t.right===e&&lZ(t.left)&&tb(t.parent)?t.left:void 0})(n);if(o){if(lQ(r,o))return;return function*(n){yield n.replaceText(o,r.getText(o.elements[0])),yield n.replaceText(e,lH(e,t))}}let a=n.parent;if("MemberExpression"===a.type&&a.computed&&te(a.property,0)&&a.object===n&&("VariableDeclarator"===a.parent.type&&a.parent.init===a||"AssignmentExpression"===a.parent.type&&a.parent.right===a)&&!lQ(r,a))return r=>r.replaceText(a,`await ${lH(e,t)}`)})(t,e),n):(n.suggest=[{messageId:lJ,fix:r=>{let[n]=t.arguments[0].elements,o=e4(n,e);return e7(n,e)||"Identifier"===n.type||"MemberExpression"===n.type||(o=`(${o})`),oD(e.sourceCode.getTokenBefore(t),e,o)&&(o=`;${o}`),r.replaceText(t,o)}},{messageId:lX,fix:function*(e){let r=t.callee.property;yield e.replaceText(r,"resolve");let[n]=t.arguments,a=o.getFirstToken(n),[i,s]=o.getLastTokens(n,2);yield e.remove(a),yield e.remove(s),eb(i)&&(yield e.remove(i))}}],n)})},meta:{type:"suggestion",docs:{description:"Disallow passing single-element arrays to `Promise` methods.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[lG]:"Wrapping single-element array with `Promise.{{method}}()` is unnecessary.",[lJ]:"Use the value directly.",[lX]:"Switch to `Promise.resolve(…)`."},languages:["js/js"]}},"unicorn/no-await-in-promise-methods":{create:e=>{e.on("CallExpression",function*(t){if(tw(t,{object:"Promise",methods:c$,optionalMember:!1,optionalCall:!1,argumentsLength:1})&&"ArrayExpression"===t.arguments[0].type)for(let r of t.arguments[0].elements)r?.type==="AwaitExpression"&&(yield{node:r,messageId:cL,data:{method:t.callee.property.name},suggest:[{messageId:cN,*fix(t){let n=e.sourceCode.getFirstToken(r);yield t.remove(n),yield aF(n,e,t)}}]})})},meta:{type:"suggestion",docs:{description:"Disallow using `await` in `Promise` method parameters.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[cL]:"Promise in `Promise.{{method}}()` should not be awaited.",[cN]:"Remove `await`."},languages:["js/js"]}},"unicorn/no-negation-in-equality-check":{create:e=>{e.on("BinaryExpression",t=>{let{operator:r,left:n}=t;if(!("BinaryExpression"===t.type&&cU.has(t.operator)&&cq(n))||cq(n.argument))return;let{sourceCode:o}=e,a=o.getFirstToken(n),i=`${r.startsWith("!")?"=":"!"}${r.slice(1)}`;return{node:a,messageId:cM,suggest:[{messageId:cO,data:{operator:i},*fix(s){yield aP(s,t,e);let l=o.getTokenAfter(a),{parent:u}=t;("ReturnStatement"===u.type||"ThrowStatement"===u.type)&&!e7(t,e)&&(op(o.getFirstToken(u),l,e)||(yield aj(s,u,e))),yield s.remove(a),oD(o.getTokenBefore(a),e,l.value)&&(yield s.insertTextAfter(a,";"));let p=o.getTokenAfter(n,e=>"Punctuator"===e.type&&e.value===r);yield s.replaceText(p,i)}}]}})},meta:{type:"problem",docs:{description:"Disallow negated expression in equality check.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[cM]:"Negated expression is not allowed in equality check.",[cO]:"Switch to '{{operator}}' check."},languages:["js/js"]}},"unicorn/no-unnecessary-slice-end":{create(e){cV(e,{methods:["slice"],messageId:cW})},meta:{type:"suggestion",docs:{description:"Disallow using `.length` or `Infinity` as the `end` argument of `{Array,String,TypedArray}#slice()`.",recommended:"unopinionated"},fixable:"code",messages:{[cW]:"Passing `{{description}}` as the `end` argument is unnecessary."},languages:["js/js"]}},"unicorn/no-lonely-if":{create:e=>{e.on("IfStatement",t=>{if(di(t)&&("BlockStatement"===t.parent.type&&1===t.parent.body.length&&t.parent.body[0]===t&&di(t.parent.parent)&&t.parent.parent.consequent===t.parent||di(t.parent)&&t.parent.consequent===t))return{node:t,messageId:da,fix:function(e,t){let{sourceCode:r}=t;return n=>{var o,a;let i=("BlockStatement"===e.parent.type?e.parent:e).parent,s={...i,...ds(i,r)},l={...e,...ds(e,r)},u=dc(s,r),p=dd(s,t,r),c=dp(du(dc(l,r)),dd(l,t,r)),d=function(e,t,r,n){let o=[...n.getRange(e)];if("BlockStatement"===t.type)return o;let a=n.getLastToken(t);if(eA(a)){let t=n.getTokenAfter(e);t&&oD(a,r,t.value)&&(o[1]=n.getRange(t)[0])}return o}(i,l.consequent,t,r),m={outerConditionGap:s.openingBraceToken?du(dl(s.closingParenthesisToken,s.openingBraceToken,r)):"",outerLeadingContent:s.openingBraceToken?du(dl(s.openingBraceToken,l.ifToken,r)):du(dl(s.closingParenthesisToken,l.ifToken,r)),outerTrailingContent:s.openingBraceToken?du(dl(l,s.closingBraceToken,r)):""},f=(o=m.outerConditionGap,a=m.outerLeadingContent,o.trimStart().startsWith("//")?{leadingStatementText:du(a).trimStart(),conditionSuffixText:o}:{leadingStatementText:du(dp(o,a)).trimStart(),conditionSuffixText:""}),{leadingStatementText:g}=f,y=function({outerIfStatement:e,inner:t,replacementRange:r,sourceCode:n,consequentTextPieces:o,outerConditionGapTextPieces:a}){let{outerTrailingContent:i}=o,{conditionSuffixText:s}=a;if("BlockStatement"===t.consequent.type){let e=dl(t.closingParenthesisToken,t.openingBraceToken,n),r=dl(t.openingBraceToken,t.closingBraceToken,n);return`${s}${e}{${r}${i}}`}let l=dl(t.closingParenthesisToken,t.consequent,n),u=`${s}${l}${((e,t)=>{let[r,n]=t.getRange(e);return t.text.slice(r,n)})(t.consequent,n)}${i}`;return`${u}${((e,t,r)=>{let[,n]=r.getRange(e);if(t[1]===n)return"";let o=r.text.slice(n,t[1]);return""===o.trim()?o.includes("\n")?`;${o}`:";":`;${o}`})(e,r,n)}`}({outerIfStatement:i,inner:l,replacementRange:d,sourceCode:r,consequentTextPieces:m,outerConditionGapTextPieces:f});return n.replaceTextRange(d,`${g}if${u}(${p} && ${c})${y}`)}}(t,e)}})},meta:{type:"suggestion",docs:{description:"Disallow `if` statements as the only statement in `if` blocks without `else`.",recommended:"unopinionated"},fixable:"code",messages:{[da]:"Unexpected `if` as the only statement in a `if` block without `else`."},languages:["js/js"]}},"unicorn/no-magic-array-flat-depth":{create:e=>{e.on("CallExpression",t=>{if(!tw(t,{method:"flat",argumentsLength:1,optionalCall:!1}))return;let[r]=t.arguments;if(!to(r)||1===r.value)return;let{sourceCode:n}=e,{openingParenthesisToken:o,closingParenthesisToken:a}=rx(t,e);if(!n.commentsExistBetween(o,a))return{node:r,messageId:dm}})},meta:{type:"suggestion",docs:{description:"Disallow a magic number as the `depth` argument in `Array#flat(…).`",recommended:"unopinionated"},messages:{[dm]:"Magic number as depth is not allowed."},languages:["js/js"]}},"unicorn/no-negated-condition":{create:e=>{e.on(["IfStatement","ConditionalExpression"],t=>{if("IfStatement"===t.type&&(!t.alternate||"IfStatement"===t.alternate.type))return;let{test:r}=t;if("UnaryExpression"===r.type&&"!"===r.operator||"BinaryExpression"===r.type&&("!="===r.operator||"!=="===r.operator))return{node:r,messageId:df,*fix(n){if(yield function*(e,t,r){let{sourceCode:n}=r,{test:o}=t;if("UnaryExpression"===o.type){let a=n.getFirstToken(o);"IfStatement"===t.type&&(yield aT(o.argument,e,r)),yield e.remove(a);return}let a=n.getTokenAfter(o.left,e=>"Punctuator"===e.type&&e.value===o.operator);yield e.replaceText(a,"="+a.value.slice(1))}(n,t,e),yield function*(e,t,r){let n="IfStatement"===t.type,[o,a]=[t.consequent,t.alternate].map(e=>{let t=e5(e,r),o=r.sourceCode.text.slice(...t);return n&&"BlockStatement"!==e.type&&(o=`{${o}}`),{range:t,text:o}});if(o.text===a.text)return;let{sourceCode:i}=r;yield e.replaceTextRange(i.getRange(o),a.text),yield e.replaceTextRange(i.getRange(a),o.text)}(n,t,e),"ConditionalExpression"!==t.type||"UnaryExpression"!==r.type)return;yield aP(n,t,e);let{sourceCode:o}=e,{parent:a}=t,[i,s]=o.getFirstTokens(r,2);"ReturnStatement"!==a.type&&"ThrowStatement"!==a.type||a.argument!==t||op(i,s,e)||e7(t,e)||e7(r,e)?oD(o.getTokenBefore(t),e,s.value)&&(yield n.insertTextBefore(t,";")):yield aj(n,a,e)}}})},meta:{type:"suggestion",docs:{description:"Disallow negated conditions.",recommended:"unopinionated"},fixable:"code",messages:{[df]:"Unexpected negated condition."},languages:["js/js"]}},"unicorn/no-object-as-default-parameter":{create:e=>{e.on("AssignmentPattern",e=>{if(!("ObjectExpression"===e.right.type&&e.right.properties.length>0&&tv(e.parent)&&e.parent.params.includes(e)))return;let{left:t,right:r}=e;return"Identifier"===t.type?{node:t,messageId:dg,data:{parameter:t.name}}:{node:r,messageId:dy}})},meta:{type:"problem",docs:{description:"Disallow the use of objects as default parameters.",recommended:"unopinionated"},messages:{[dg]:"Do not use an object literal as default for parameter `{{parameter}}`.",[dy]:"Do not use an object literal as default."},languages:["js/js"]}},"unicorn/prefer-negative-index":{create:e=>{e.on("CallExpression",t=>{if("MemberExpression"!==t.callee.type)return;let r=function(e){let{callee:t,arguments:r}=e,n=t.property.name,o=t.object,a=r;if(dx.has(n))return{method:n,target:o,argumentsNodes:a};if("call"!==n&&"apply"!==n||(n=db(t.object),!dx.has(n)))return;let i="apply"===t.property.name,{supportObjects:s}=dx.get(n),l=t.object.object;if(th(l)||"slice"===n&&te(l,"")||"prototype"===db(l)&&"Identifier"===l.object.type&&s.has(l.object.name)){if([o]=r,i){let[,e]=r;if(!e||"ArrayExpression"!==e.type)return;a=e.elements}else a=r.slice(1);return{method:n,target:o,argumentsNodes:a}}}(t);if(!r)return;let{method:n,target:o,argumentsNodes:a}=r,{argumentsIndexes:i}=dx.get(n),s=i.map(e=>(function e(t,r){let n;if(!t)return;let{type:o,operator:a,left:i,right:s}=t=rj(t);if("BinaryExpression"!==o||"-"!==a||!(to(n=rj(s))&&n.value>0))return;let l=rj(i);return"MemberExpression"===l.type&&!l.computed&&!l.optional&&"Identifier"===l.property.type&&"length"===l.property.name&&ux(l.object,r)?i:e(i,r)})(a[e],o)).filter(Boolean);if(0!==s.length)return{node:t,messageId:dh,data:{method:n},*fix(t){for(let r of s)yield function(e,t,r){let[n,o]=e5(e,r);return t.removeRange([n,o+r.sourceCode.text.slice(o).match(/\S|$/).index])}(r,t,e)}}})},meta:{type:"suggestion",docs:{description:"Prefer negative index over `.length - index` when possible.",recommended:"unopinionated"},fixable:"code",messages:{[dh]:"Prefer negative index over length minus index for `{{method}}`."},languages:["js/js"]}},"unicorn/prefer-node-protocol":{create:e=>{e.on("Literal",t=>{if(!(["ImportDeclaration","ExportNamedDeclaration","ExportAllDeclaration","ImportExpression","TSImportType"].includes(t.parent.type)&&t.parent.source===t||(tw(t.parent,{object:"process",method:"getBuiltinModule",argumentsLength:1,optionalCall:!1,optionalMember:!1})||tj(t.parent))&&t.parent.arguments[0]===t))return;let{value:r}=t;if(!("string"==typeof r&&!r.startsWith(dD)&&dv(r)&&dv(`${dD}${r}`)))return;let n=e.sourceCode.getRange(t)[0]+1;return{node:t,messageId:dC,data:{moduleName:r},fix:e=>e.insertTextAfterRange([n,n],dD)}})},meta:{type:"suggestion",docs:{description:"Prefer using the `node:` protocol when importing Node.js builtin modules.",recommended:"unopinionated"},fixable:"code",messages:{[dC]:"Prefer `node:{{moduleName}}` over `{{moduleName}}`."},languages:["js/js"]}},"unicorn/consistent-date-clone":{create:e=>{e.on("NewExpression",t=>{if(!tf(t,{name:"Date",argumentsLength:1}))return;let[r]=t.arguments;if(!tw(r,{method:"getTime",argumentsLength:0,optionalCall:!1,optionalMember:!1}))return;let{sourceCode:n}=e;return{node:r,loc:{start:n.getLoc(r.callee.property).start,end:n.getLoc(r).end},messageId:dS,fix:t=>aM(t,r,e)}})},meta:{type:"suggestion",docs:{description:"Prefer passing `Date` directly to the constructor when cloning.",recommended:"unopinionated"},fixable:"code",messages:{[dS]:"Unnecessary `.getTime()` call."},languages:["js/js"]}},"unicorn/no-accessor-recursion":{create:e=>{let{sourceCode:t}=e;e.on("ThisExpression",e=>{let r=((e,t)=>{for(let r=e.getScope(t);r;r=r.upper){if("class"===r.type)return;if("function"===r.type&&"ArrowFunctionExpression"!==r.block.type)return r}})(t,e);if(!r)return;let n=r.block.parent;if(["Property","MethodDefinition"].includes(n?.type)&&!n.computed&&["set","get"].includes(n.kind)&&dA(n.key)&&("get"===n.kind&&(dk(e,n)||"VariableDeclarator"===e.parent.type&&e.parent.init===e&&"ObjectPattern"===e.parent.id.type&&e.parent.id.properties.some(e=>"Property"===e.type&&!e.computed&&dw(e.key,n.key)))||"set"===n.kind&&((e,t)=>{if(!dk(e,t))return!1;let r=e.parent,{parent:n}=r;return("AssignmentExpression"===n.type||"AssignmentPattern"===n.type)&&n.left===r||"UpdateExpression"===n.type&&n.argument===r||"ArrayPattern"===n.type&&n.elements.includes(r)||"RestElement"===n.type&&n.argument===r||("ForOfStatement"===n.type||"ForInStatement"===n.type)&&n.left===r||"Property"===n.type&&n.value===r&&"ObjectPattern"===n.parent.type&&n.parent.properties.includes(r.parent)})(e,n)))return{node:e.parent,messageId:dT,data:{kind:n.kind}}})},meta:{type:"problem",docs:{description:"Disallow recursive access to `this` within getters and setters.",recommended:"unopinionated"},defaultOptions:[],messages:{[dT]:"Disallow recursive access to `this` within {{kind}}ters."},languages:["js/js"]}},"unicorn/prefer-import-meta-properties":{create:function(e){let{sourceCode:t}=e;e.on("MetaProperty",function*(e){if("MetaProperty"!==e.type||"import"!==e.meta.name||"meta"!==e.property.name)return;let r=e.parent;if(!tT(r,{properties:["url","filename"],computed:!1,optional:!1}))return;let n=r.property.name;if("url"===n){if(dB(r.parent,t)&&r.parent.arguments[0]===r)return void(yield a(r.parent,{reportFilenameNode:!0}));if(tf(r.parent,{name:"URL",minimumArguments:1,maximumArguments:2})){var o;let e=r.parent,n=e.parent;if(1===e.arguments.length&&e.arguments[0]===r&&dB(n,t)&&n.arguments[0]===e)return void(yield a(n,{reportFilenameNode:!0}));2===e.arguments.length&&(o=e.arguments[0],o?.type==="Literal"&&("."===o.value||"./"===o.value))&&e.arguments[1]===r&&dB(n,t)&&n.arguments[0]===e&&(yield i(n,"dirname"))}return}function*a(e,{reportFilenameNode:r=!1}={}){let{parent:n}=e;if(dR(n,t)&&n.arguments[0]===e)return void(yield i(n,"dirname"));if(r&&(yield i(e,"filename")),"VariableDeclarator"!==n.type||n.init!==e||"Identifier"!==n.id.type||"VariableDeclaration"!==n.parent.type||"const"!==n.parent.kind)return;let o=ey(t.getScope(n.id),n.id);if(o)for(let e of o.references){if(!e.isReadOnly())continue;let{parent:r}=e.identifier;dR(r,t)&&r.arguments[0]===e.identifier&&(yield i(r,"dirname"))}}function i(e,t){return{node:e,messageId:"dirname"===t?dI:dj,fix:r=>r.replaceText(e,`import.meta.${t}`)}}"filename"===n&&(yield a(r))})},meta:{type:"suggestion",docs:{description:"Prefer `import.meta.{dirname,filename}` over legacy techniques for getting file paths.",recommended:!1},fixable:"code",messages:{[dI]:"Do not construct dirname.",[dj]:"Do not construct filename using `fileURLToPath()`."},languages:["js/js"]}},"unicorn/no-unnecessary-array-flat-depth":{create:e=>{e.on("CallExpression",t=>{if(!(tw(t,{method:"flat",argumentsLength:1,optionalCall:!1})&&te(t.arguments[0],1)))return;let[r]=t.arguments;return{node:r,messageId:dP,fix:t=>aw(t,r,e)}})},meta:{type:"suggestion",docs:{description:"Disallow using `1` as the `depth` argument of `Array#flat()`.",recommended:"unopinionated"},fixable:"code",messages:{[dP]:"Passing `1` as the `depth` argument is unnecessary."},languages:["js/js"]}},"unicorn/no-unnecessary-array-splice-count":{create(e){cV(e,{methods:["splice","toSpliced"],messageId:dL})},meta:{type:"suggestion",docs:{description:"Disallow using `.length` or `Infinity` as the `deleteCount` or `skipCount` argument of `Array#{splice,toSpliced}()`.",recommended:"unopinionated"},fixable:"code",messages:{[dL]:"Passing `{{description}}` as the `{{argumentName}}` argument is unnecessary."},languages:["js/js"]}},"unicorn/no-useless-error-capture-stack-trace":{create:e=>{let t=[],r=[];e.on(["ClassDeclaration","ClassExpression"],e=>{t.push(e),r.push(e)}),e.onExit(["ClassDeclaration","ClassExpression"],()=>{t.pop(),r.pop()}),e.on(["FunctionDeclaration","FunctionExpression"],e=>{r.push(e)}),e.onExit(["FunctionDeclaration","FunctionExpression"],()=>{r.pop()}),e.on("CallExpression",n=>{let o,a=t.at(-1);if(!(a?.superClass&&"Identifier"===a.superClass.type&&s4.includes(a.superClass.name)&&e.sourceCode.isGlobalReference(a.superClass)&&(o=r.at(-1),o&&"MethodDefinition"===o.parent.type&&"constructor"===o.parent.kind&&o.parent.value===o&&a.body.body.includes(o.parent))&&tw(n,{object:"Error",method:"captureStackTrace",argumentsLength:2,optionalMember:!1})&&e.sourceCode.isGlobalReference(n.callee.object)))return;let[i,s]=n.arguments;if("ThisExpression"!==i.type||!((e,t,r)=>{if("MetaProperty"===e.type&&"Identifier"===e.meta.type&&"new"===e.meta.name&&"Identifier"===e.property.type&&"target"===e.property.name||tT(e,{property:"constructor",computed:!1,optional:!1})&&"ThisExpression"===e.object.type)return!0;if("Identifier"!==e.type||!t.id)return!1;let n=ey(r.sourceCode.getScope(e),e);return n&&1===n.defs.length&&"ClassName"===n.defs[0].type&&n.defs[0].node===t})(s,a,e))return;let l={node:n,messageId:dN},u="ChainExpression"===n.parent.type?n.parent.parent:n.parent;return"ExpressionStatement"===u.type&&"BlockStatement"===u.parent.type&&(l.fix=e=>e.remove(u)),l})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary `Error.captureStackTrace(…)`.",recommended:"unopinionated"},fixable:"code",messages:{[dN]:"Unnecessary `Error.captureStackTrace(…)` call."},languages:["js/js"]}},"unicorn/prefer-class-fields":{create:e=>{let{sourceCode:t}=e;e.on("ClassBody",r=>{let n=r.body.find(e=>"constructor"===e.kind&&!e.computed&&!e.static&&"MethodDefinition"===e.type&&"FunctionExpression"===e.value.type);if(!n)return;let o=n.value.body.body.find(e=>"EmptyStatement"!==e.type);if(!(o?.type==="ExpressionStatement"&&"AssignmentExpression"===o.expression.type&&"="===o.expression.operator&&"MemberExpression"===o.expression.left.type&&"ThisExpression"===o.expression.left.object.type&&!o.expression.left.computed&&["Identifier","PrivateIdentifier"].includes(o.expression.left.property.type)&&"Literal"===o.expression.right.type))return;let a=o.expression.left.property.name,i=o.expression.right.raw,s=o.expression.left.property.type,l=r.body.find(e=>"PropertyDefinition"===e.type&&!e.computed&&!e.static&&e.key.type===s&&e.key.name===a),u={node:o,messageId:d$};function*p(s){if(yield((e,t,r)=>{let{line:n}=t.getLoc(e).start,o=t.getText(e);return t.lines[n-1].trim()===o?r.removeRange([t.getIndexFromLoc({line:n,column:0}),t.getIndexFromLoc({line:n+1,column:0})]):r.remove(e)})(o,t,s),l){if(l.value)return void(yield s.replaceText(l.value,i));let e=` = ${i}`,r=t.getLastToken(l);return eE(r)?void(yield s.insertTextBefore(r,e)):void(yield s.insertTextAfter(l,`${e};`))}let u=t.getLastToken(r),p=rw(n,e),c=`${p}${a} = ${i};
|
|
48
48
|
`;"\n"!==t.getText()[t.getRange(u)[0]-1]&&(c=`
|
|
49
|
-
${c}`);let d=r.body.at(-1);"PropertyDefinition"===d.type&&";"!==t.getLastToken(d).value&&(c=`;${c}`),yield s.insertTextBefore(u,c)}return l?.value?u.suggest=[{messageId:d$,fix:p}]:u.fix=p,u})},meta:{type:"suggestion",docs:{description:"Prefer class field declarations over `this` assignments in constructors.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[dN]:"Prefer class field declaration over `this` assignment in constructor for static values.",[d$]:"Encountered same-named class field declaration and `this` assignment in constructor. Replace the class field declaration with the value from `this` assignment."},languages:["js/js"]}},"unicorn/prefer-bigint-literals":{create:e=>{e.on("CallExpression",t=>{if(!td(t,{name:"BigInt",argumentsLength:1,optional:!1},tu))return;let[r]=t.arguments,n=function(e){let t,r;if(te(e)){let t,r=e.raw.slice(1,-1);try{t=BigInt(r)}catch{return}let n=0n===t?"0":r.trim();return n.startsWith("+")&&(n=n.slice(1).trim()),{shouldUseSuggestion:r.includes("+"),text:`${n}n`,bigint:t}}let n=!1,o=!1;for(;"UnaryExpression"===e.type&&e.prefix;)if("+"===e.operator)n=!0,e=e.argument;else{if("-"!==e.operator)return;o=!o,e=e.argument}let{value:a,raw:i}=e;if(Number.isInteger(a)){try{t=BigInt(a)}catch{return}return(e=>{let t=e.raw.replaceAll("_","").toLowerCase();if(t.includes("."))return!1;let{value:r}=e;for(let{prefix:e,base:n}of[{prefix:"0b",base:2},{prefix:"0o",base:8},{prefix:"0x",base:16}])if(t.startsWith(e))return t.slice(2)===r.toString(n);return!t.includes("e")&&t===String(r)})(e)?r=`${i}n`:(r=`${t}n`,n=!0),o&&0n!==t&&(r=`-${r}`,t=-t),{shouldUseSuggestion:n,text:r,bigint:t}}}(r);if(!n)return;let o={node:t,messageId:dM},{shouldUseSuggestion:a,text:i,bigint:s}=n,l=r=>{let n=i;return!e4(t,e)&&s<0n&&(n=`(${n})`,oC(e.sourceCode.getTokenBefore(t),e,n)&&(n=`;${n}`)),r.replaceText(t,n)};return a||e.sourceCode.getCommentsInside(t).length>0?o.suggest=[{messageId:dO,data:{replacement:i.length<20?`\`${i}\``:"a bigint literal"},fix:l}]:o.fix=l,o})},meta:{type:"suggestion",docs:{description:"Prefer `BigInt` literals over the constructor.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[dM]:"Prefer using bigint literal over `BigInt(…)`.",[dO]:"Replace with {{replacement}}."},languages:["js/js"]}},"unicorn/prefer-classlist-toggle":{create:e=>{let{sourceCode:t}=e;e.on(["IfStatement","ConditionalExpression"],r=>{let n=[r.consequent,r.alternate].map(e=>{if(e)return"BlockStatement"===e.type&&1===e.body.length&&(e=e.body[0]),"ExpressionStatement"===e.type&&(e=e.expression),"ChainExpression"===e.type&&(e=e.expression),e});if(n.some(e=>!dz(e,["add","remove"])))return;let[o,a]=n;if(o.callee.property.name!==a.callee.property.name&&dK(o,a))return dW(r,function*(n){let i=e5(o.callee.object.object,e),s=e5(o.arguments[0],e),l="ConditionalExpression"===r.type,u="remove"===o.callee.property.name,p=r.test,c=dG(p,u,o),d=c?"":d_(p,e,u),m=o.callee.object.optional||a.callee.object.optional||c?.callee.object.optional,f=`${i}${m?"?":""}.classList.toggle(${s}${d?`, ${d}`:""})`;l||(f+=";"),oC(t.getTokenBefore(r),e,f)&&(f=`;${f}`),yield n.replaceText(r,f),l&&(yield aR(n,r,e))})}),e.on("ConditionalExpression",t=>{let r=[t.consequent,t.alternate];if(!(r.every(e=>te(e)&&("add"===e.value||"remove"===e.value))&&r[0].value!==r[1].value&&"MemberExpression"===t.parent.type&&t.parent.computed&&!t.parent.optional&&t.parent.property===t&&dV(t.parent.object)&&td(t.parent.parent,{optional:!1,argumentsLength:1},tu)&&t.parent.parent.callee===t.parent))return;let n=t.parent,o=n.parent;return dW(o,function*(r){let a="remove"===t.consequent.value,i=t.test,s=dG(i,a,o)?"":d_(i,e,a);s&&(yield r.insertTextAfter(o.arguments[0],`, ${s}`)),yield aL(r,n,e,".toggle")},t)})},meta:{type:"suggestion",docs:{description:"Prefer using `Element#classList.toggle()` to toggle class names.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[dU]:"Prefer using `Element#classList.toggle()` to toggle class names.",[dq]:"Replace with `Element#classList.toggle()`."},languages:["js/js"]}},"unicorn/require-module-attributes":{create:e=>{let{sourceCode:t}=e;e.on(["ImportDeclaration","ExportNamedDeclaration","ExportAllDeclaration"],e=>{let{source:r,attributes:n}=e;if(!r||Array.isArray(n)&&n.length>0)return;let o=t.getTokenAfter(r);if(o?.type!=="Keyword"||"with"!==o.value)return;let a=t.getTokenAfter(o),i=t.getTokenAfter(a);return{node:e,loc:{start:t.getLoc(a).start,end:t.getLoc(i).end},messageId:dJ,data:{type:"ImportDeclaration"===e.type?"import statement":"export statement"},fix:e=>[o,i,a].map(t=>e.remove(t))}}),e.on("ImportExpression",r=>{let{options:n}=r;if(n?.type!=="ObjectExpression")return;let o=n.properties.find(e=>"Property"===e.type&&!e.method&&!e.shorthand&&!e.computed&&"init"===e.kind&&("Identifier"===e.key.type&&"with"===e.key.name||"Literal"===e.key.type&&"with"===e.key.value)&&th(e.value)),a=0===n.properties.length||o&&1===n.properties.length?n:o;if(!a)return;let i="Property"===a.type;return{node:o?.value??a,messageId:dJ,data:{type:"import expression"},fix:r=>i?function*(e,t,r){let{sourceCode:n}=r;for(let r of n.getTokens(t))yield e.remove(r);let o=n.getTokenAfter(t);if(ex(o))yield e.remove(o);else{let{properties:r}=t.parent;if(r.length>1&&r.at(-1)===t){let r=n.getTokenBefore(t);yield e.remove(r)}}}(r,a,e):[t.getTokenBefore(a,ex),...t.getTokens(a),...e6(a,e)].map(e=>r.remove(e))}})},meta:{type:"suggestion",docs:{description:"Require non-empty module attributes for imports and exports",recommended:"unopinionated"},fixable:"code",messages:{[dJ]:"{{type}} with empty attribute list is not allowed."},languages:["js/js"]}},"unicorn/no-immediate-mutation":{create:e=>{for(let t of d9)e.on(["VariableDeclarator","AssignmentExpression"],r=>(function(e,t,{testValue:r,getProblematicNode:n,getProblem:o,getFix:a}){let i,s="AssignmentExpression"===t.type,[l,u]=(s?["left","right"]:["id","init"]).map(e=>t[e]);if(!("Identifier"===l.type&&r(u)))return;let p=t.parent;if(!(s&&"="===t.operator&&"ExpressionStatement"===p.type&&p.expression===t||!s&&"VariableDeclaration"===(i=t.parent).type&&i.declarations.at(-1)===t))return;let c=at(p,e);if(c?.type!=="ExpressionStatement")return;let d="VariableDeclarator"===t.type?e.sourceCode.getDeclaredVariables(t).find(e=>1===e.defs.length&&e.defs[0].name===t.id):eg(e.sourceCode.getScope(t),t.left.name);if(!d)return;let m={context:e,variable:d,variableNode:l,valueNode:u,statement:p,nextExpressionStatement:c,assignType:s?"assignment":"declaration",getFix:a},f=n(m);if(f)return o(f,m)})(e,r,t))},meta:{type:"suggestion",docs:{description:"Disallow immediate mutation after variable assignment.",recommended:!0},fixable:"code",hasSuggestions:!0,messages:{[dX]:"Immediate mutation on {{objectType}} is not allowed.",[dY]:"{{operation}} the elements to the {{assignType}}.",[dH]:"Move this property to the {{assignType}}.",[dQ]:"{{description}} the {{assignType}}.",[dZ]:"Move the element to the {{assignType}}.",[d0]:"Move the entry to the {{assignType}}."},languages:["js/js"]}},"unicorn/no-useless-collection-argument":{create:e=>{e.on("NewExpression",t=>{var r;let n;if(!tm(t,{names:["Set","Map","WeakSet","WeakMap"],argumentsLength:1}))return;let[o]=t.arguments,a="LogicalExpression"===o.type&&"??"===o.operator,i=a?o.right:o,s=ty(r=i)?"empty array":e7(r,"")?"empty string":ta(r)?"`null`":tR(r)?"`undefined`":void 0;if(!s)return;let l=!1;if(a)n=function*(t){let{sourceCode:r}=e,n=i.parent,{left:o}=n,a=e4(o,e),[,s]=a?e9(o,e):r.getRange(o),[,l]=r.getRange(n);yield t.removeRange([s,l]),(a||"SequenceExpression"!==o.type)&&(yield aS(n,t,e))};else e.sourceCode.getCommentsInside(i).length>0&&(l=!0),n=t=>aA(t,i,e);let u={node:i,messageId:d5,data:{description:s}};return l?u.suggest=[{messageId:d4,fix:n}]:u.fix=n,u})},meta:{type:"suggestion",docs:{description:"Disallow useless values or fallbacks in `Set`, `Map`, `WeakSet`, or `WeakMap`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[d5]:"The {{description}} is useless.",[d4]:"Remove the {{description}}"},languages:["js/js"]}},"unicorn/prefer-response-static-json":{create:e=>{e.on("NewExpression",t=>{if(!tm(t,{name:"Response",minimumArguments:1}))return;let[r]=t.arguments;if(tA(r,{object:"JSON",method:"stringify",argumentsLength:1,optionalCall:!1,optionalMember:!1}))return{node:r.callee,messageId:d7,*fix(n){yield n.insertTextAfter(t.callee,".json"),yield aF(t,e,n);let[o]=r.arguments,a=e9(r,e),i=e9(o,e);yield n.removeRange([a[0],i[0]]),yield n.removeRange([i[1],a[1]]),!e4(t,e)&&e4(t.callee,e)&&oC(e.sourceCode.getTokenBefore(t),e,"(")&&(yield n.insertTextBefore(t,";"))}}})},meta:{type:"suggestion",docs:{description:"Prefer `Response.json()` over `new Response(JSON.stringify())`.",recommended:"unopinionated"},fixable:"code",messages:{[d7]:"Prefer using `Response.json(…)` over `JSON.stringify()`."},languages:["js/js"]}},"unicorn/filename-case":{create:e=>{let t=e.physicalFilename;if("<input>"===t||"<text>"===t)return;let r=e.options[0]||{},n=function(e){if(e.case)return[e.case];if(e.cases){let t=Object.keys(e.cases).filter(t=>e.cases[t]);return t.length>0?t:["kebabCase"]}return["kebabCase"]}(r),o=(r.ignore||[]).map(e=>b.isRegExp(e)?e:RegExp(e,"u")),a=!1!==r.multipleFileExtensions,i=!1!==r.checkDirectories,s=n.map(e=>mT[e].fn);e.on(rz,r=>{if("Document"!==r.type||r.parent?.type!=="Program")return(()=>{var r;let l,u,p=(r=e.cwd,""===(l=E.relative(r,E.resolve(r,t)))||".."===l||l.startsWith(`..${E.sep}`)||E.isAbsolute(l)?[E.basename(t)]:l.split(E.sep).filter(e=>"."!==e)),{basename:c,filename:d,middle:m,extension:f}=function(e,{multipleFileExtensions:t}){let r=E.extname(e),n=E.basename(e,r),o={basename:n+r,filename:n,middle:"",extension:r};if(t){let[e]=n.split(".",1);Object.assign(o,{filename:e,middle:n.slice(e.length)})}return o}(p.at(-1),{multipleFileExtensions:a});if(p.some(e=>o.some(t=>t.test(e))))return;if(i)for(let e of p.slice(0,-1)){let t=function(e,t,r){let n,{leading:o,words:a}=mI(e);if(e.startsWith("$")||mA(a,r))return;let i=mw(a,r,{leading:o,trailing:""});return{loc:{column:0,line:1},messageId:mg,data:{directory:e,chosenCases:mj(t),renamedDirectories:(n=i.map(e=>`\`${e}\``),mb.format(n))}}}(e,n,s);if(t)return t}if(mx.has(c))return;let{leading:g,words:y}=mI(d);if(d.startsWith("$")||mA(y,s))return f!==f.toLowerCase()?{loc:{column:0,line:1},messageId:my,data:{filename:d+m+f.toLowerCase(),extension:f}}:void 0;let h=mw(y,s,{leading:g,trailing:m+f.toLowerCase()});return{loc:{column:0,line:1},messageId:mf,data:{chosenCases:mj(n),renamedFilenames:(u=h.map(e=>`\`${e}\``),mb.format(u))}}})()})},meta:{type:"suggestion",docs:{description:"Enforce a case style for filenames and directory names.",recommended:!0},schema:mF,defaultOptions:[],messages:{[mf]:"Filename is not in {{chosenCases}}. Rename it to {{renamedFilenames}}.",[mg]:"Directory name `{{directory}}` is not in {{chosenCases}}. Rename it to {{renamedDirectories}}.",[my]:"File extension `{{extension}}` is not in lowercase. Rename it to `{{filename}}`."},languages:["*"]}},"unicorn/consistent-template-literal-escape":{create:e=>{e.on("TemplateElement",t=>{if(tB(t.parent))return;let{raw:r}=t.value,n=r.replaceAll(/(?<=(?:^|[^\\])(?:\\\\)*)\\?\$\\{/g,"\\${");if(r!==n)return{node:t,messageId:mB,fix:r=>aq(t,n,e,r)}})},meta:{type:"suggestion",docs:{description:"Enforce consistent style for escaping `${` in template literals.",recommended:!0},fixable:"code",messages:{[mB]:"Use `\\${` instead of `$\\{` to escape in template literals."},languages:["js/js"]}},"unicorn/no-useless-iterator-to-array":{create:e=>{e.on("NewExpression",t=>{if(!(tm(t,{names:["Map","WeakMap","Set","WeakSet"],argumentsLength:1})||tm(t,{names:rQ,minimumArguments:1}))||!mJ(t.arguments[0]))return;let r=t.arguments[0],n=1===t.arguments.length?mX(r,e):void 0,o=t.arguments.length>1?mY(r,e,m_):void 0;return{node:r.callee.property,messageId:mO,data:{description:`new ${t.callee.name}(…)`},...n&&{fix:n},...o&&{suggest:[o]}}}),e.on("CallExpression",t=>((e,t)=>{if(!tA(e,{objects:["Array",...rQ],method:"from",minimumArguments:1,optionalCall:!1,optionalMember:!1})||!mJ(e.arguments[0]))return;let r=e.arguments[0],n=1===e.arguments.length?mX(r,t):void 0,o=e.arguments.length>1?mY(r,t,m_):void 0;return{node:r.callee.property,messageId:mO,data:{description:`${e.callee.object.name}.${e.callee.property.name}(…)`},...n&&{fix:n},...o&&{suggest:[o]}}})(t,e)??((e,t)=>{if(!tA(e,{object:"Object",method:"fromEntries",minimumArguments:1,optionalCall:!1,optionalMember:!1})||!mJ(e.arguments[0]))return;let r=e.arguments[0],n=1===e.arguments.length?mX(r,t):void 0,o=e.arguments.length>1?mY(r,t,m_):void 0;return{node:r.callee.property,messageId:mO,data:{description:`${e.callee.object.name}.${e.callee.property.name}(…)`},...n&&{fix:n},...o&&{suggest:[o]}}})(t,e)??((e,t)=>{if(!tA(e,{object:"Promise",methods:["all","allSettled","any","race"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||!mJ(e.arguments[0]))return;let r=e.arguments[0],n=mY(r,t,m_);return{node:r.callee.property,messageId:mO,data:{description:`${e.callee.object.name}.${e.callee.property.name}(…)`},...n&&{suggest:[n]}}})(t,e)??((e,t)=>{var r,n;if(!(tA(e,{methods:mK,maximumArguments:1,optionalCall:!1,optionalMember:!1})||tA(e,{method:mG,minimumArguments:1,maximumArguments:2,optionalCall:!1,optionalMember:!1}))||!mJ(e.callee.object))return;let o=e.arguments[0],a=e.callee.property.name,i=a===mG;if(r=o,n=i?3:2,r&&("ArrowFunctionExpression"===(r=mM(r)).type||"FunctionExpression"===r.type)&&(r.params.length>n||r.params.at(-1)?.type==="RestElement"||"FunctionExpression"===r.type&&t.sourceCode.getTokens(r).some(e=>"Identifier"===e.type&&"arguments"===e.value)))return;let s=e.callee.object,l=mY(s,t,mz,{method:a});return{node:s.callee.property,messageId:mW,data:{method:a},...l&&{suggest:[l]}}})(t,e)),e.on("ForOfStatement",t=>{if(!mJ(t.right))return;let r=mX(t.right,e);return{node:t.right.callee.property,messageId:mU,...r&&{fix:r}}}),e.on("YieldExpression",t=>{if(!t.delegate||!mJ(t.argument))return;let r=mX(t.argument,e);return{node:t.argument.callee.property,messageId:mq,...r&&{fix:r}}}),e.on("SpreadElement",t=>{if(!mJ(t.argument))return;let{parent:r}=t;if("ArrayExpression"!==r.type&&"CallExpression"!==r.type&&"NewExpression"!==r.type)return;let n=mX(t.argument,e);return{node:t.argument.callee.property,messageId:mV,...n&&{fix:n}}})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary `.toArray()` on iterators.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[mO]:"`{{description}}` accepts an iterable, `.toArray()` is unnecessary.",[mU]:"`for…of`/`for await…of` can iterate over an iterable, `.toArray()` is unnecessary.",[mq]:"`yield*` can delegate to an iterable, `.toArray()` is unnecessary.",[mV]:"Spread works on iterables, `.toArray()` is unnecessary.",[mW]:"`Iterator` has a `.{{method}}()` method, `.toArray()` is unnecessary.",[m_]:"Remove `.toArray()`.",[mz]:"Remove `.toArray()` and use `Iterator#{{method}}()`."},languages:["js/js"]}},"unicorn/prefer-simple-condition-first":{create:e=>{let{sourceCode:t}=e;e.on("LogicalExpression",r=>{if("&&"!==r.operator&&"||"!==r.operator||function(e){let{operator:t}=e,{parent:r}=e;for(;rk(r)&&r.expression===e;)r=(e=r).parent;return r?.type==="LogicalExpression"&&r.operator===t}(r)||!function e(t,r){if(tU(t,r)||tq(t))return!0;let{parent:n}=t;return rk(n)&&n.expression===t&&e(n,r)}(r,e))return;let n=function e(t,r,n=[]){let o=rI(t);return"LogicalExpression"!==o.type||o.operator!==r?n.push(t):(e(o.left,r,n),e(o.right,r,n)),n}(r,r.operator),o=n.map(e=>({operand:e,isSimple:m1(e)})),a=o.findIndex(({isSimple:e})=>!e),i=o.findIndex(({isSimple:e},t)=>e&&t>a);if(-1===a||-1===i)return;let s=[...o.filter(({isSimple:e})=>e),...o.filter(({isSimple:e})=>!e)].map(({operand:e})=>e),l=o.findLastIndex(({isSimple:e})=>e),u=o.every(({operand:e,isSimple:t},r)=>{var n;return t||r>l||m1(n=e)||function e(t){let r=rI(t);return"ConditionalExpression"===r.type&&[r.test,r.consequent,r.alternate].every(t=>m1(t)||m0(t)||e(t))}(n)}),p=u&&!function e(t,r){if(rk(t)){let e=rI(t);return"LogicalExpression"===e.type&&e.operator===r}return"LogicalExpression"===t.type&&t.operator===r&&(e(t.left,r)||e(t.right,r))}(r,r.operator)&&!function(e,t,r){let{sourceCode:n}=r;if(n.getCommentsInside(e).length>0)return!0;let[o]=t,a=t.at(-1),[i]=e9(o,r),[,s]=e9(a,r),l={range:[i,s]};return eS(n.getTokenBefore(l,{includeComments:!0}))||eS(n.getTokenAfter(l,{includeComments:!0}))}(r,n,e)?n=>n.replaceTextRange(t.getRange(r),s.map((t,n)=>(function(e,t,{operator:r,property:n}){let o=e4(e,t),a=o?e5(e,t):t.sourceCode.getText(e);return!o&&o2(e,{operator:r,property:n})&&(a=`(${a})`),a})(t,e,{operator:r.operator,property:0===n?"left":"right"})).join(` ${r.operator} `)):void 0;return{node:r,loc:t.getLoc(n[i]),messageId:u?mH:mQ,data:{operator:r.operator},...p&&{fix:p}}})},meta:{type:"suggestion",docs:{description:"Prefer simple conditions first in logical expressions.",recommended:!0},fixable:"code",messages:{[mH]:"Prefer this simple condition first in the `{{operator}}` expression.",[mQ]:"Consider moving this simple condition first after verifying short-circuit behavior."},languages:["js/js"]}},"unicorn/switch-case-break-position":{create:e=>{let{sourceCode:t}=e;e.on("SwitchCase",r=>{let{consequent:n}=r;if(n.length<2)return;let o=n.at(-1);if(!m3.has(o.type))return;let a=n.slice(0,-1);if(1!==a.length||"BlockStatement"!==a[0].type)return;let i=a[0];if(0===i.body.length)return;let s=function(e){switch(e.type){case"BreakStatement":return"break";case"ReturnStatement":return"return";case"ContinueStatement":return"continue";case"ThrowStatement":return"throw"}}(o);return{node:o,loc:t.getLoc(o),messageId:m2,data:{keyword:s},..."ReturnStatement"!==o.type&&"ThrowStatement"!==o.type&&{*fix(r){let n=t.getLastToken(i);if(t.getTokensBetween(n,o,{includeComments:!0}).some(e=>eS(e)))return;let a=t.getLoc(i);if(a.start.line===a.end.line||rL(e,o))return;let s=i.body.at(-1),l=t.getText(o),u=rA(s,e),p=t.getTokenBefore(n,{includeComments:!0});yield r.insertTextAfter(p,`
|
|
50
|
-
${u}${l}`);let c=t.getRange(n)[1],d=t.getRange(o)[1];yield r.removeRange([c,d])}}}})},meta:{type:"layout",docs:{description:"Enforce consistent `break`/`return`/`continue`/`throw` position in `case` clauses.",recommended:!0},fixable:"code",messages:{[m2]:"Move `{{keyword}}` inside the block statement."},languages:["js/js"]}},"unicorn/better-dom-traversing":{create:e=>{e.on("MemberExpression",t=>{let r,n=(e=>{if(fo(e)){if(fn(e.object,"childNodes"))return"childNodes";if(fn(e.object,"children"))return"children"}})(t);if(!n||oo(t.object.object)||"children"===n&&fn(r=t.object,"children")&&("Identifier"===r.object.type&&"props"===r.object.name||tS(r.object,{property:"props",optional:!1,computed:!1}))||t.parent?.type==="MemberExpression"&&t.parent.object===t&&fn(t.parent,"children")&&fo(t.parent.parent))return;let o=t.property.value;return"childNodes"===n&&0===o?{node:t,messageId:m8,suggest:fi(t,"firstChild",m7,e)}:"children"===n&&0===o?{node:t,messageId:m6,suggest:fi(t,"firstElementChild",fe,e)}:"children"===n?{node:t,messageId:m9}:void 0}),e.on("MemberExpression",e=>{if(!(!fs(e)||!fs(e.object)||!(!fs(e.parent)||e.parent.object!==e)||oo((e=>{for(;fs(e);)e=e.object;return e})(e))))return{node:e,messageId:m5}}),e.on("CallExpression",t=>{if(!fu(t)||t.parent?.type==="MemberExpression"&&t.parent.object===t&&t.parent.parent?.callee===t.parent&&fu(t.parent.parent)&&fl(t.parent.parent.arguments[0])||(e=>{for(;e.parent?.type==="MemberExpression"&&e.parent.object===e||e.parent?.type==="CallExpression"&&e.parent.callee===e;)e=e.parent;return e.parent?.type==="ChainExpression"})(t))return;let r=(e=>{let t=[];for(;fu(e);){let[r]=e.arguments;if(!fl(r))break;t.push(e),e=e.callee.object}if(t.length<2||"ChainExpression"===e.type||oo(e))return;let r=[];for(let e of t)r.unshift(tr(e.arguments[0]));return{root:e,selectors:r,quoteNode:t.at(-1).arguments[0]}})(t);if(r)return{node:t,messageId:m4,suggest:((e,t,r)=>{let n,o,{sourceCode:a}=r;if(fa(e,a)||!t.selectors.every(e=>!e.includes(",")&&!e.includes(":scope")))return;let i=e5(t.root,r),s=`${"Identifier"===(n=t.root).type&&"document"===n.name||"MemberExpression"===n.type&&!n.computed&&"Identifier"===n.object.type&&["globalThis","window"].includes(n.object.name)&&"Identifier"===n.property.type&&"document"===n.property.name?"":":scope "}${t.selectors.join(" ")}`,l=`${i}.querySelector(${tz(s,"Literal"===(o=t.quoteNode).type&&o.raw.startsWith('"')?'"':"'")})`;return[{messageId:ft,fix:t=>t.replaceText(e,l)}]})(t,r,e)}})},meta:{type:"suggestion",docs:{description:"Prefer better DOM traversal APIs.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[m8]:"Prefer `.firstChild` over `.childNodes[0]`.",[m6]:"Prefer `.firstElementChild` over `.children[0]`.",[m9]:"Consider `.querySelector()` over positional child traversal.",[m5]:"Consider `.closest()` over chaining `.parentElement`.",[m4]:"Consider merging chained `.querySelector()` calls.",[m7]:"Switch to `.firstChild`.",[fe]:"Switch to `.firstElementChild`.",[ft]:"Merge the `.querySelector()` calls."},languages:["js/js"]}},"unicorn/consistent-compound-words":{create:e=>{let t=(({checkProperties:e=!1,checkVariables:t=!0,checkDefaultAndNamespaceImports:r="internal",checkShorthandImports:n="internal",checkShorthandProperties:a=!1,extendDefaultReplacements:s=!0,replacements:l={},allowList:u={}}={})=>{let p=new o(Object.entries(s?{...fg,...l}:l).filter(([,e])=>!1!==e));return{checkProperties:e,checkVariables:t,checkDefaultAndNamespaceImports:r,checkShorthandImports:n,checkShorthandProperties:a,replacements:p,replacementRegExp:p.size>0?(e=>{let t=[],r=[];for(let n of e.keys())t.push(fh(n)),r.push(fh(ar(n)));return RegExp(`(?:^(?:${t.join("|")})|(?:${r.join("|")}))${fx}`,"gv")})(p):void 0,allowList:new i(Object.keys(u))}})(e.options[0]),r=new s,n=new s,a=(e,t)=>t.every(t=>{let r=n.get(t);return!r||!r.has(e)}),l=e=>{if((e=>{if(1!==e.defs.length)return!1;let[t]=e.defs;return"ClassName"===t.type})(e)){if("class"===e.scope.type){let[t]=e.defs,n=r.get(t.name);return n?u({name:e.name,scope:e.scope,defs:e.defs,identifiers:e.identifiers,references:[...e.references,...n.references]}):u(e)}let[t]=e.defs;return void r.set(t.name,e)}return u(e)},u=r=>{var o;if(0===r.defs.length)return;let s=fb(r.name,t);if(!s)return;let[l]=r.defs;if(!(!("ImportDefaultSpecifier"===(o=l.name).parent.type&&o.parent.local===o||"ImportNamespaceSpecifier"===o.parent.type&&o.parent.local===o||"ImportSpecifier"===o.parent.type&&o.parent.local===o&&"Identifier"===o.parent.imported.type&&"default"===o.parent.imported.name||"VariableDeclarator"===o.parent.type&&o.parent.id===o&&tI(o.parent.init))||t.checkDefaultAndNamespaceImports&&("internal"!==t.checkDefaultAndNamespaceImports||fd(l)))||!(!og(l.name,e)||t.checkShorthandImports&&("internal"!==t.checkShorthandImports||fd(l)))||!t.checkShorthandProperties&&ox(l.name))return;let u=[...r.references.map(e=>e.from),r.scope],p=rj(s)?rg(s,u,a):void 0,c=fE(l.name,p??s);if(p&&rG(r).every(e=>!("VariableDeclarator"===e.parent.type&&e.parent.id===e?"VariableDeclaration"===e.parent.parent.type&&"ExportNamedDeclaration"===e.parent.parent.parent.type:!!fp.has(e.parent.type)&&e.parent.id===e&&"ExportNamedDeclaration"===e.parent.parent.type)&&"JSXIdentifier"!==e.type)&&r.references.every(e=>!e.vueUsedInTemplate)){for(let e of u)n.has(e)||n.set(e,new i),n.get(e).add(p);c.suggest=[{messageId:ff,data:{replacement:p},fix:t=>aU(r,p,e,t)}]}e.report(c)},p=e=>{for(let t of e.variables)l(t)},c=r=>{if(!t.checkProperties||"__proto__"===r.name)return;let n=fb(r.name,t);if(!n||"ExportSpecifier"===r.parent.type||(t.checkVariables||("TSParameterProperty"===r.parent.type?r.parent.parameter!==r:"AssignmentPattern"!==r.parent.type||r.parent.left!==r||"TSParameterProperty"!==r.parent.parent.type||r.parent.parent.parameter!==r.parent))&&!("MemberExpression"===r.parent.type&&r.parent.property===r&&!r.parent.computed&&("AssignmentExpression"===r.parent.parent.type&&r.parent.parent.left===r.parent||"UpdateExpression"===r.parent.parent.type&&r.parent.parent.argument===r.parent)||"Property"===r.parent.type&&r.parent.key===r&&!r.parent.computed&&!r.parent.shorthand&&"ObjectExpression"===r.parent.parent.type||"ExportSpecifier"===r.parent.type&&r.parent.exported===r&&r.parent.local!==r||fc.has(r.parent.type)&&r.parent.key===r&&!r.parent.computed))return;let o=fE(r,n);e.report(o)};e.on("Identifier",c),e.on("PrivateIdentifier",c),e.on("Program:exit",r=>{if(t.checkVariables)for(let t of ru(e.sourceCode.getScope(r)))p(t)})},meta:{type:"suggestion",docs:{description:"Enforce consistent spelling of compound words in identifiers.",recommended:"unopinionated"},hasSuggestions:!0,schema:fv,defaultOptions:[{}],messages:{[fm]:"Prefer `{{replacement}}` over `{{name}}`.",[ff]:"Rename to `{{replacement}}`."},languages:["js/js"]}},"unicorn/no-blob-to-file":{create:e=>{e.on("VariableDeclarator",t=>(function(e,t){let{sourceCode:r}=t,{id:n,init:o}=e;if("Identifier"!==n.type||"VariableDeclaration"!==e.parent.type||"const"!==e.parent.kind||1!==e.parent.declarations.length||"Program"!==e.parent.parent.type&&"BlockStatement"!==e.parent.parent.type)return;let a=function(e,t){if(!tm(e,{name:"File",minimumArguments:2,maximumArguments:2})||!fS(e.callee,t))return;let[r]=e.arguments,[,n]=e.arguments;if("ArrayExpression"!==r.type||1!==r.elements.length||r.elements[0]?.type==="SpreadElement"||void 0===tr(n))return;let[o]=r.elements;if(function(e,t,r){let n=fT(e,r);if(!n||r.sourceCode.getRange(n)[0]>r.sourceCode.getRange(t)[0])return!1;let o=n.init;return(tm(o,{name:"Blob",maximumArguments:1})||tm(o,{name:"File",minimumArguments:2,maximumArguments:2}))&&fS(o.callee,r)}(o,e,t))return o}(o,t);if(!a)return;let i=eg(r.getScope(n),n);if(!i)return;let s=rG(i).filter(e=>e!==n);if(1!==s.length)return;let[l]=s,u=function(e,t){let r,{parent:n}=e;return tA(n,{object:"URL",method:"createObjectURL",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&n.arguments[0]===e&&fS(n.callee.object,t)?{call:n,kind:"blobArgument"}:tA(n,{methods:["append","set"],minimumArguments:2,maximumArguments:3,optionalCall:!1,optionalMember:!1})&&n.arguments[1]===e&&(r=fT(n.callee.object,t)?.init,tm(r,{name:"FormData",argumentsLength:0})&&fS(r.callee,t))?{call:n,kind:"formData"}:void 0}(l,t);if(!u)return;let p=function(e){let[,t]=e.arguments;return t}(o);if(!(!function(e,t,r){if("Identifier"!==e.type)return!0;let{sourceCode:n}=r;return eg(n.getScope(e),e)===eg(n.getScope(t),e)}(a,l,t)||function(e,t){let{sourceCode:r}=t;return r.getCommentsInside(e).length>0||r.getCommentsBefore(e).some(t=>r.getLoc(t).end.line===r.getLoc(e).start.line||r.getLoc(t).end.line===r.getLoc(e).start.line-1)||rL(t,e)}(e.parent,t))&&("formData"!==u.kind||2!==u.call.arguments.length||p))return{node:o,messageId:fC,suggest:[{messageId:fD,*fix(n){yield aM(e.parent,t,n),yield n.replaceText(l,r.getText(a)),"formData"===u.kind&&2===u.call.arguments.length&&(yield n.insertTextAfter(l,`, ${r.getText(p)}`))}}]}})(t,e))},meta:{type:"suggestion",docs:{description:"Disallow unnecessary `Blob` to `File` conversion.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[fC]:"Use the original `Blob` instead of converting it to a `File`.",[fD]:"Replace the `File` with the original `Blob`."},languages:["js/js"]}},"unicorn/no-canvas-to-image":{create:e=>{let{sourceCode:t}=e;e.on("CallExpression",e=>{var r,n,o;if(!tA(e,{method:"drawImage",minimumArguments:1,optionalCall:!1,optionalMember:!1}))return;let[a]=e.arguments;if("SpreadElement"!==a.type&&(r=fk(a,t),r?.type==="CallExpression"&&!r.optional&&"Identifier"===r.callee.type&&"loadImage"===r.callee.name&&r.arguments.length>0&&"SpreadElement"!==r.arguments[0].type&&tA(n=r.arguments[0],{method:"toDataURL",optionalCall:!1,optionalMember:!1})&&("Identifier"===(o=n.callee.object).type?fI(o.name):"MemberExpression"===o.type&&!o.computed&&"Identifier"===o.property.type&&fI(o.property.name))))return{node:a,messageId:fA}}),e.on("CallExpression",e=>{if(!tA(e,{method:"putImageData",minimumArguments:1,optionalCall:!1,optionalMember:!1}))return;let[r]=e.arguments;if("SpreadElement"!==r.type&&tA(fk(r,t),{method:"getImageData",optionalCall:!1,optionalMember:!1}))return{node:r,messageId:fA}})},meta:{type:"suggestion",docs:{description:"Prefer drawing canvases directly instead of converting them to images.",recommended:"unopinionated"},messages:{[fA]:"Prefer drawing the canvas directly with `drawImage()`."},languages:["js/js"]}},"unicorn/no-confusing-array-splice":{create:e=>{e.on("CallExpression",t=>{if(!tA(t,{methods:["splice","toSpliced"],argumentsLength:3,optionalCall:!1,optionalMember:!1}))return;let r=function([e,t]){let r=function(e){let t=oH(e);if("number"==typeof t)return Math.max(Math.trunc(t),0)}(t);return 1===r?fj:-1===Math.trunc(oH(e))&&0===r?fF:void 0}(t.arguments);if(!r)return;let n={node:t.callee.property,messageId:r,data:{method:t.callee.property.name}},o=function(e,t,r){let{sourceCode:n}=r,{object:o,property:a}=e.callee,[i,,s]=e.arguments,l=a.name,u=e5(o,r),p=n.getText(i),c=n.getText(s);if(t===fj){if(fL(e,n))return;if("toSpliced"===l){var d,m;if(0>Math.trunc(oH(i))||(d=i,m=o,d=rI(d),m=rI(m),"MemberExpression"===d.type&&!d.optional&&!d.computed&&"Identifier"===d.property.type&&"length"===d.property.name&&uh(d.object,m)))return;return{messageId:fB,fix:t=>t.replaceText(e,`${u}.with(${p}, ${c})`)}}return"ExpressionStatement"===e.parent.type&&fP(o)&&(oH(i)??0)>=0?{messageId:fB,fix:t=>t.replaceText(e,`${u}[${p}] = ${c}`)}:void 0}if(t===fF&&fP(o)&&!fL(i,n))return{messageId:fR,fix:e=>e.replaceText(i,`Math.max(${u}.length - 1, 0)`)}}(t,r,e);return o&&(n.suggest=[o]),n})},meta:{type:"suggestion",docs:{description:"Disallow confusing uses of `Array#{splice,toSpliced}()`.",recommended:!0},hasSuggestions:!0,messages:{[fj]:"Prefer a direct element replacement instead of `{{method}}()`.",[fF]:"Avoid using `{{method}}()` to insert at `-1`.",[fB]:"Use direct element replacement.",[fR]:"Resolve the insertion index explicitly."},languages:["js/js"]}},"unicorn/no-duplicate-set-values":{create:e=>{let{sourceCode:t}=e;e.on("NewExpression",r=>{if(!tm(r,{name:"Set",argumentsLength:1}))return;let[n]=r.arguments;if("ArrayExpression"===n.type)return rT(n.elements,e).map(e=>({node:e??n,messageId:fN,data:{value:e?t.getText(e):"undefined"}}))})},meta:{type:"suggestion",docs:{description:"Disallow duplicate values in `Set` constructor array literals.",recommended:!0},messages:{[fN]:"Remove duplicate value `{{value}}` from the Set."},languages:["js/js"]}},"unicorn/no-incorrect-query-selector":{create:e=>{let{sourceCode:t}=e;e.on("MemberExpression",r=>{if(!f_(r)||fK(r))return;let n=r.object;if(!fG(r,n,t,e))return fY(r,n,e)}),e.on("CallExpression",r=>{let n;if(fz(r)){if(fK(r))return;let n=r.callee.object;if(fG(r,n,t,e))return;return fY(r,n,e)}let o=fX(r,e);if(o)return o;if(fW(r)&&!(f_(n=r.parent)||fz(n)||"MemberExpression"===r.parent.type&&r.parent.object===r&&fz(r.parent.parent))){let e;if(e=tr(r.arguments[0]),/^#[\-A-Z_a-z][\w\-]*$/v.test(e))return{node:r.callee.property,messageId:fM}}}),e.on("BinaryExpression",r=>((e,t)=>{let{sourceCode:r}=t;if(fQ(e,fW,r))return{node:e,messageId:fU}})(r,e)??((e,t)=>{let r=fQ(e,fV,t);if(r&&("==="===e.operator||"!=="===e.operator)&&tR(r.value))return{node:e,messageId:fq}})(r,t)),e.on("Identifier",t=>fX(t,e))},meta:{type:"suggestion",docs:{description:"Disallow incorrect `querySelector()` and `querySelectorAll()` usage.",recommended:!0},fixable:"code",schema:[],messages:{[f$]:"Prefer `.querySelector()` when only the first match is used.",[fM]:"Prefer `.querySelector()` for a simple ID selector.",[fO]:"Check `.length` instead of the `NodeList` object itself.",[fU]:"Check `.length` instead of comparing the `NodeList` object with `null` or `undefined`.",[fq]:"Compare the result of `.querySelector()` with `null` instead of `undefined`."},languages:["js/js"]}},"unicorn/no-invalid-file-input-accept":{create:e=>{e.on("JSXOpeningElement",t=>{if("input"!==f5(t.name))return;let r=((e,t)=>{if(t?.value){if(te(t.value))return t.value.value;if("JSXExpressionContainer"===t.value.type)return f7(e,t.value.expression)}})(e,f4(t,"type"));if(r?.toLowerCase()!=="file")return;let n=f4(t,"accept");if(!n)return;let o=((e,t)=>{if(!t.value)return{node:t,missing:!0};if(te(t.value))return{node:t.value,value:t.value.value,fixable:!0};if("JSXExpressionContainer"!==t.value.type)return{node:t.value,dynamic:!0};let r=f7(e,t.value.expression);return void 0===r?{node:t.value,dynamic:!0}:{node:t.value,value:r,fixable:!1}})(e,n);return gi({valueInfo:o,fix:t=>r=>{let n;return n=o.node,r.replaceTextRange([e.sourceCode.getRange(n)[0]+1,e.sourceCode.getRange(n)[1]-1],t)}})}),e.on("Tag",t=>{if("input"!==t.name.toLowerCase())return;let r=ga(e,t,"type")?.value;if(r?.toLowerCase()!=="file")return;let n=((e,t,r)=>{let n=ga(e,t,r);if(!n)return;let o=t.attributes.find(e=>"Attribute"===e.type&&e.key?.value?.toLowerCase()===r);return n.missing?{node:o??t,missing:!0}:o?.value?.parts?.length>0?{node:o.value,dynamic:!0}:f8.test(n.value)?void 0:{node:o?.value??t,value:n.value,fixable:!0,valueRange:n.valueRange,isReplacementFixable:e=>n.isQuoted||!/\s/v.test(e)}})(e,t,"accept");if(n)return gi({valueInfo:n,fix:e=>t=>t.replaceTextRange(n.valueRange,e)})})},meta:{type:"problem",docs:{description:"Disallow invalid `accept` values on file inputs.",recommended:!1},fixable:"code",messages:{[fZ]:"Invalid file input `accept` value: {{reason}}",[f0]:"The file input `accept` value must be static.",[f1]:"Prefer `{{replacement}}` as the file input `accept` value."},languages:["js/js","html/html"]}},"unicorn/no-late-current-target-access":{create:e=>{let{sourceCode:t}=e,r=gp(e);e.on("MemberExpression",e=>{if("Identifier"!==e.object.type||!tS(e,{property:"currentTarget"})||!gs.test(e.object.name))return;let n=eg(t.getScope(e.object),e.object),o=n?.defs.find(({type:e})=>"Parameter"===e);if(!o)return;let a=o.node,i=gl(e)!==a;if(i||r.isFunctionSuspended(a)||r.isInsideSuspendingLoop(e,a))return{node:e,messageId:i?gd:gc,data:{name:e.object.name}}})},meta:{type:"problem",docs:{description:"Disallow accessing `event.currentTarget` after the synchronous event dispatch has finished.",recommended:!0},messages:{[gc]:"`{{name}}.currentTarget` is `null` after the handler suspends. It is only set during synchronous event dispatch; save it to a variable beforehand.",[gd]:"`{{name}}.currentTarget` is `null` inside this nested function. It is only set during synchronous event dispatch; save it to a variable in the outer function."},languages:["js/js"]}},"unicorn/no-unnecessary-nested-ternary":{create:e=>{let{sourceCode:t}=e;e.on("ConditionalExpression",r=>{let{test:n,consequent:o,alternate:a}=r;return"ConditionalExpression"===o.type&&gf(o.alternate,a,t)?gh(e,r,{left:n,operator:"&&",right:o.test,consequent:o.consequent,alternate:o.alternate}):"ConditionalExpression"===a.type&&gf(o,a.consequent,t)?gh(e,r,{left:n,operator:"||",right:a.test,consequent:o,alternate:a.alternate}):void 0})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary nested ternary expressions.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[gm]:"Do not use unnecessary nested ternary expressions."},languages:["js/js"]}},"unicorn/no-unused-array-method-return":{create:e=>{e.on("CallExpression",t=>{let r="MemberExpression"===t.callee.type?eM(t.callee,e.sourceCode.getScope(t.callee)):void 0;if(!(!gb.has(r)||!(e=>{for(;;){if(ob(e))return!0;let{parent:t}=e;if("ForStatement"===t.type&&(t.init===e||t.update===e))return!0;if("ChainExpression"!==t.type&&"AwaitExpression"!==t.type&&"TSAsExpression"!==t.type&&"TSTypeAssertion"!==t.type&&"TSNonNullExpression"!==t.type&&"TSSatisfiesExpression"!==t.type)return!1;e=t}})(t)||((e,t,r)=>{let n,o=function e(t,r,n=new i){if(!t||t===gv||n.has(t))return t;if(n.add(t),"Identifier"===t.type){let o=function(e,t){let r=eg(t.sourceCode.getScope(e),e);if(!r||0===r.defs.length)return;if(1!==r.defs.length||function(e,t,r){let[n]=r.sourceCode.getRange(t);return e.references.some(e=>!e.init&&e.isWrite()&&r.sourceCode.getRange(e.identifier)[0]<n)}(r,e,t))return gv;let[n]=r.defs;if("Parameter"===n.type&&n.node.params?.includes(n.name))return n.name.typeAnnotation&&!nb(n.name.typeAnnotation,t)?gv:void 0;if("Variable"===n.type&&"VariableDeclarator"===n.node.type&&"Identifier"===n.node.id.type&&n.node.id.name===e.name&&"VariableDeclaration"===n.parent.type){let{typeAnnotation:e}=n.node.id;return e?nb(e,t)?void 0:gv:n.node.init??gv}return gv}(t,r);return o===gv?o:void 0===o?t:e(o,r,n)}return["ChainExpression","TSNonNullExpression","TSSatisfiesExpression"].includes(t.type)?e(t.expression,r,n):"MemberExpression"===t.type?gv:"TSAsExpression"===t.type||"TSTypeAssertion"===t.type?nb(t,r)?t:gv:t}(e,r);return!!(td(n=o,"expect",tu)||tA(n,{object:"expect",methods:["element","poll","soft"]}))||("values"===t?o===gv||!nb(o,r):o===gv||((e,t)=>{let r,n;return gD(e,"undefined",t)||"ObjectExpression"===e.type||"Literal"===e.type||"BinaryExpression"===e.type||"TemplateLiteral"===e.type||"ArrowFunctionExpression"===e.type||"FunctionExpression"===e.type||"ClassExpression"===e.type||"NewExpression"===e.type&&!gD(e.callee,"Array",t)||(r=e,n=t,td(r,gC,tu)&&n.sourceCode.isGlobalReference(r.callee))})(o,r)||"Identifier"===o.type&&gE.test(o.name)&&!nb(o,r))})(t.callee.object,r,e)))return{node:t.callee.property,messageId:gx,data:{method:r}}})},meta:{type:"suggestion",docs:{description:"Disallow ignoring the return value of selected array methods.",recommended:"unopinionated"},messages:{[gx]:"Do not ignore the return value of `.{{method}}(…)`."},languages:["js/js"]}},"unicorn/prefer-array-last-methods":{create:e=>{let{sourceCode:t}=e;e.on("CallExpression",r=>{if(!tA(r,{methods:gA.keys().toArray(),optionalCall:!1,optionalMember:!1}))return;let n=r.callee.object;if(!tA(n,{methods:gw,argumentsLength:0,optionalCall:!1,optionalMember:!1}))return;let o=r.callee.property.name,a=gA.get(o),i={method:o,replacement:a,reversingMethod:n.callee.property.name},s={node:r.callee.property,messageId:gS,data:i};return 0===t.getCommentsInside(r).length&&(s.suggest=[{messageId:gT,data:i,*fix(t){yield t.replaceText(r.callee.property,a),yield a$(t,n,e)}}]),s})},meta:{type:"suggestion",docs:{description:"Prefer last-oriented array methods over `Array#reverse()` or `Array#toReversed()` followed by a method.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[gS]:"Prefer `Array#{{replacement}}()` over `Array#{{reversingMethod}}().{{method}}()`.",[gT]:"Replace `.{{reversingMethod}}().{{method}}()` with `.{{replacement}}()`."},languages:["js/js"]}},"unicorn/prefer-math-abs":{create:e=>{e.on("ConditionalExpression",t=>{let r=function(e,t){let r=function(e,t){if(!("BinaryExpression"!==e.type||!gI.has(e.operator)||gL(e.left,t)||gL(e.right,t))){if(e7(e.right,0))return{value:e.left,operator:e.operator};if(e7(e.left,0))return{value:e.right,operator:gj[e.operator]}}}(e.test,t);if(!r)return;let{value:n,operator:o}=r,{consequent:a,alternate:i}=e;if(("<"===o||"<="===o)&&gN(a,n)&&rv(i,n)||(">"===o||">="===o)&&rv(a,n)&&gN(i,n))return n}(t,e);if(!r)return;let n=gq(r)?function*(n){yield aR(n,t,e),yield n.replaceText(t,`Math.abs(${gO(r,e)})`)}:void 0;return gU(t,e,n)}),e.on("LogicalExpression",t=>{let r=function(e,t){if("||"!==e.operator)return;let r=g$(e.left,t),n=gM(e.right,t);if(r&&n&&rv(r.value,n.value)&&gF[r.operator]===n.operator&&gN(n.negativeThreshold,r.threshold))return{value:r.value,threshold:r.threshold,operator:r.operator};let o=g$(e.right,t),a=gM(e.left,t);if(o&&a&&rv(o.value,a.value)&&gF[o.operator]===a.operator&&gN(a.negativeThreshold,o.threshold))return{value:o.value,threshold:o.threshold,operator:o.operator}}(t,e);if(!r)return;let{value:n,threshold:o,operator:a}=r,i=gq(n)&&gq(o)?function*(r){yield aR(r,t,e),yield r.replaceText(t,`Math.abs(${gO(n,e)}) ${a} ${e5(o,e)}`)}:void 0;return gU(t,e,i)})},meta:{type:"suggestion",docs:{description:"Prefer `Math.abs()` over manual absolute value expressions and symmetric range checks.",recommended:"unopinionated"},fixable:"code",messages:{[gk]:"Prefer `Math.abs()` to simplify this expression."},languages:["js/js"]}},"unicorn/prefer-split-limit":{create:e=>{let{sourceCode:t}=e;e.on("MemberExpression",r=>{if(!r.computed||nP(r))return;let n=g_(r.object);if(!n)return;let o=gW(r.property,t);if(void 0!==o)return gz(r,n,o+1,e)}),e.on("CallExpression",r=>{if(!tA(r,{method:"at",argumentsLength:1}))return;let n=g_(r.callee.object);if(!n)return;let o=gW(r.arguments[0],t);if(void 0!==o)return gz(r,n,o+1,e)}),e.on("VariableDeclarator",t=>{if("ArrayPattern"===t.id.type)return gK(t.id,t.init,e)}),e.on("AssignmentExpression",t=>{if("ArrayPattern"===t.left.type&&ob(t))return gK(t.left,t.right,e)})},meta:{type:"suggestion",docs:{description:"Prefer `String#split()` with a limit.",recommended:"unopinionated"},fixable:"code",messages:{[gV]:"Prefer `String#split()` with a limit."},languages:["js/js"]}},"unicorn/prefer-queue-microtask":gJ,"unicorn/prefer-string-pad-start-end":{create:e=>{e.on("BinaryExpression",t=>((e,t)=>{if("+"!==e.operator)return;let r=g3(e.left,t);if(r&&rv(e.right,r.targetNode)&&!gQ(e.right,t)){let n=g1({targetNode:e.right,targetLengthNode:r.targetLengthNode,paddingNode:r.paddingNode});return g6({node:e,method:"padStart",replacement:n&&g8({method:"padStart",targetNode:e.right,...r},t),context:t,canFix:n})}let n=g3(e.right,t);if(n&&rv(e.left,n.targetNode)&&!gQ(e.left,t)){let r=g1({targetNode:e.left,targetLengthNode:n.targetLengthNode,paddingNode:n.paddingNode});return g6({node:e,method:"padEnd",replacement:r&&g8({method:"padEnd",targetNode:e.left,...n},t),context:t,canFix:r})}})(t,e)),e.on("CallExpression",t=>((e,t)=>{if(!tA(e,{method:"slice",minimumArguments:1,maximumArguments:2,optionalCall:!1,optionalMember:!1})||"BinaryExpression"!==e.callee.object.type||"+"!==e.callee.object.operator)return;let{object:r}=e.callee,[n,o]=e.arguments,a=g2(r.left,t),i=(e=>{if(e?.type==="UnaryExpression"&&"-"===e.operator)return e.argument})(n);if(1===e.arguments.length&&a&&i&&tn(a.widthNode)&&rv(a.widthNode,i)&&"Identifier"===r.right.type&&!gQ(r.right,t)){let n=g0(a.paddingNode);return g9({node:e,method:"padStart",replacement:g8({method:"padStart",targetNode:r.right,targetLengthNode:a.widthNode,...a},t),context:t,canSuggest:n})}let s=g2(r.right,t);if(2===e.arguments.length&&s&&tn(n)&&0===n.value&&tn(s.widthNode)&&rv(s.widthNode,o)&&"Identifier"===r.left.type&&!gQ(r.left,t)){let n=g0(s.paddingNode);return g9({node:e,method:"padEnd",replacement:g8({method:"padEnd",targetNode:r.left,targetLengthNode:s.widthNode,...s},t),context:t,canSuggest:n})}})(t,e))},meta:{type:"suggestion",docs:{description:"Prefer `String#padStart()` and `String#padEnd()` over manual string padding.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[gX]:"Prefer `String#{{method}}()` over manual string padding.",[gY]:"Replace with `String#{{method}}()`."},languages:["js/js"]}},"unicorn/require-css-escape":yn,"unicorn/require-passive-events":{create:e=>{e.on("CallExpression",t=>{if(!tA(t,{method:"addEventListener",minimumArguments:2,maximumArguments:3,optionalCall:!1,optionalMember:!1}))return;let[r,n,o]=t.arguments;if(!te(r)||!ya.has(r.value)||"ArrowFunctionExpression"!==n.type&&"FunctionExpression"!==n.type||!((e,t)=>{let r;if(r=t.sourceCode,"FunctionExpression"===e.type&&ru(r.getScope(e)).some(t=>((e,t)=>{let r=e.block;for(;r&&r!==t;){if("FunctionDeclaration"===r.type||"FunctionExpression"===r.type)return!1;r=r.parent}return r===t})(t,e)&&t.references.some(({identifier:e})=>"arguments"===e.name)))return!1;let[n]=e.params;if(!n)return!0;if("Identifier"!==n.type)return!1;let o=t.sourceCode.getDeclaredVariables(e).find(e=>e.defs[0]?.name===n);if(!o)return!1;for(let{identifier:e}of o.references)if(ys(e)||!yl(e))return!1;return!0})(n,e))return;let a=((e,t,r)=>{if(!r){let r;return{fix:(r=t.arguments[1],t=>t.insertTextAfterRange(e9(r,e),", {passive: true}"))}}if(tt(r,!0)||tt(r,!1))return{fix:e=>e.replaceText(r,tt(r,!0)?"{capture: true, passive: true}":"{passive: true}")};if("ObjectExpression"!==r.type||r.properties.some(e=>"SpreadElement"===e.type||e.computed))return;let n=r.properties.findLast(e=>"Property"===e.type&&"passive"===(e=>{if(!e.computed){if("Identifier"===e.key.type)return e.key.name;if(te(e.key))return e.key.value}})(e));if(!n)return{fix:((e,t)=>{let r=e.properties.at(-1);if(!r)return!1;let n=t.getLastToken(e);return t.getTokensBetween(r,n,{includeComments:!0}).some(e=>"Block"===e.type||"Line"===e.type)})(r,e.sourceCode)?void 0:t=>{let{sourceCode:n}=e;if(0===r.properties.length)return t.replaceText(r,"{passive: true}");let o=r.properties.at(-1);if(n.getLoc(r).start.line===n.getLoc(r).end.line)return t.insertTextAfter(o,", passive: true");let a=n.getTokenAfter(o),i=rA(o,e);return","===a.value?t.insertTextAfter(a,`
|
|
49
|
+
${c}`);let d=r.body.at(-1);"PropertyDefinition"===d.type&&";"!==t.getLastToken(d).value&&(c=`;${c}`),yield s.insertTextBefore(u,c)}return l?.value?u.suggest=[{messageId:dM,fix:p}]:u.fix=p,u})},meta:{type:"suggestion",docs:{description:"Prefer class field declarations over `this` assignments in constructors.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[d$]:"Prefer class field declaration over `this` assignment in constructor for static values.",[dM]:"Encountered same-named class field declaration and `this` assignment in constructor. Replace the class field declaration with the value from `this` assignment."},languages:["js/js"]}},"unicorn/prefer-bigint-literals":{create:e=>{e.on("CallExpression",t=>{if(!tm(t,{name:"BigInt",argumentsLength:1,optional:!1},tp))return;let[r]=t.arguments,n=function(e){let t,r;if(tt(e)){let t,r=e.raw.slice(1,-1);try{t=BigInt(r)}catch{return}let n=0n===t?"0":r.trim();return n.startsWith("+")&&(n=n.slice(1).trim()),{shouldUseSuggestion:r.includes("+"),text:`${n}n`,bigint:t}}let n=!1,o=!1;for(;"UnaryExpression"===e.type&&e.prefix;)if("+"===e.operator)n=!0,e=e.argument;else{if("-"!==e.operator)return;o=!o,e=e.argument}let{value:a,raw:i}=e;if(Number.isInteger(a)){try{t=BigInt(a)}catch{return}return(e=>{let t=e.raw.replaceAll("_","").toLowerCase();if(t.includes("."))return!1;let{value:r}=e;for(let{prefix:e,base:n}of[{prefix:"0b",base:2},{prefix:"0o",base:8},{prefix:"0x",base:16}])if(t.startsWith(e))return t.slice(2)===r.toString(n);return!t.includes("e")&&t===String(r)})(e)?r=`${i}n`:(r=`${t}n`,n=!0),o&&0n!==t&&(r=`-${r}`,t=-t),{shouldUseSuggestion:n,text:r,bigint:t}}}(r);if(!n)return;let o={node:t,messageId:dO},{shouldUseSuggestion:a,text:i,bigint:s}=n,l=r=>{let n=i;return!e7(t,e)&&s<0n&&(n=`(${n})`,oD(e.sourceCode.getTokenBefore(t),e,n)&&(n=`;${n}`)),r.replaceText(t,n)};return a||e.sourceCode.getCommentsInside(t).length>0?o.suggest=[{messageId:dU,data:{replacement:i.length<20?`\`${i}\``:"a bigint literal"},fix:l}]:o.fix=l,o})},meta:{type:"suggestion",docs:{description:"Prefer `BigInt` literals over the constructor.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[dO]:"Prefer using bigint literal over `BigInt(…)`.",[dU]:"Replace with {{replacement}}."},languages:["js/js"]}},"unicorn/prefer-classlist-toggle":{create:e=>{let{sourceCode:t}=e;e.on(["IfStatement","ConditionalExpression"],r=>{let n=[r.consequent,r.alternate].map(e=>{if(e)return"BlockStatement"===e.type&&1===e.body.length&&(e=e.body[0]),"ExpressionStatement"===e.type&&(e=e.expression),"ChainExpression"===e.type&&(e=e.expression),e});if(n.some(e=>!dK(e,["add","remove"])))return;let[o,a]=n;if(o.callee.property.name!==a.callee.property.name&&dG(o,a))return d_(r,function*(n){let i=e4(o.callee.object.object,e),s=e4(o.arguments[0],e),l="ConditionalExpression"===r.type,u="remove"===o.callee.property.name,p=r.test,c=dJ(p,u,o),d=c?"":dz(p,e,u),m=o.callee.object.optional||a.callee.object.optional||c?.callee.object.optional,f=`${i}${m?"?":""}.classList.toggle(${s}${d?`, ${d}`:""})`;l||(f+=";"),oD(t.getTokenBefore(r),e,f)&&(f=`;${f}`),yield n.replaceText(r,f),l&&(yield aP(n,r,e))})}),e.on("ConditionalExpression",t=>{let r=[t.consequent,t.alternate];if(!(r.every(e=>tt(e)&&("add"===e.value||"remove"===e.value))&&r[0].value!==r[1].value&&"MemberExpression"===t.parent.type&&t.parent.computed&&!t.parent.optional&&t.parent.property===t&&dW(t.parent.object)&&tm(t.parent.parent,{optional:!1,argumentsLength:1},tp)&&t.parent.parent.callee===t.parent))return;let n=t.parent,o=n.parent;return d_(o,function*(r){let a="remove"===t.consequent.value,i=t.test,s=dJ(i,a,o)?"":dz(i,e,a);s&&(yield r.insertTextAfter(o.arguments[0],`, ${s}`)),yield aN(r,n,e,".toggle")},t)})},meta:{type:"suggestion",docs:{description:"Prefer using `Element#classList.toggle()` to toggle class names.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[dq]:"Prefer using `Element#classList.toggle()` to toggle class names.",[dV]:"Replace with `Element#classList.toggle()`."},languages:["js/js"]}},"unicorn/require-module-attributes":{create:e=>{let{sourceCode:t}=e;e.on(["ImportDeclaration","ExportNamedDeclaration","ExportAllDeclaration"],e=>{let{source:r,attributes:n}=e;if(!r||Array.isArray(n)&&n.length>0)return;let o=t.getTokenAfter(r);if(o?.type!=="Keyword"||"with"!==o.value)return;let a=t.getTokenAfter(o),i=t.getTokenAfter(a);return{node:e,loc:{start:t.getLoc(a).start,end:t.getLoc(i).end},messageId:dX,data:{type:"ImportDeclaration"===e.type?"import statement":"export statement"},fix:e=>[o,i,a].map(t=>e.remove(t))}}),e.on("ImportExpression",r=>{let{options:n}=r;if(n?.type!=="ObjectExpression")return;let o=n.properties.find(e=>"Property"===e.type&&!e.method&&!e.shorthand&&!e.computed&&"init"===e.kind&&("Identifier"===e.key.type&&"with"===e.key.name||"Literal"===e.key.type&&"with"===e.key.value)&&tx(e.value)),a=0===n.properties.length||o&&1===n.properties.length?n:o;if(!a)return;let i="Property"===a.type;return{node:o?.value??a,messageId:dX,data:{type:"import expression"},fix:r=>i?function*(e,t,r){let{sourceCode:n}=r;for(let r of n.getTokens(t))yield e.remove(r);let o=n.getTokenAfter(t);if(eb(o))yield e.remove(o);else{let{properties:r}=t.parent;if(r.length>1&&r.at(-1)===t){let r=n.getTokenBefore(t);yield e.remove(r)}}}(r,a,e):[t.getTokenBefore(a,eb),...t.getTokens(a),...e9(a,e)].map(e=>r.remove(e))}})},meta:{type:"suggestion",docs:{description:"Require non-empty module attributes for imports and exports",recommended:"unopinionated"},fixable:"code",messages:{[dX]:"{{type}} with empty attribute list is not allowed."},languages:["js/js"]}},"unicorn/no-immediate-mutation":{create:e=>{for(let t of d5)e.on(["VariableDeclarator","AssignmentExpression"],r=>(function(e,t,{testValue:r,getProblematicNode:n,getProblem:o,getFix:a}){let i,s="AssignmentExpression"===t.type,[l,u]=(s?["left","right"]:["id","init"]).map(e=>t[e]);if(!("Identifier"===l.type&&r(u)))return;let p=t.parent;if(!(s&&"="===t.operator&&"ExpressionStatement"===p.type&&p.expression===t||!s&&"VariableDeclaration"===(i=t.parent).type&&i.declarations.at(-1)===t))return;let c=ar(p,e);if(c?.type!=="ExpressionStatement")return;let d="VariableDeclarator"===t.type?e.sourceCode.getDeclaredVariables(t).find(e=>1===e.defs.length&&e.defs[0].name===t.id):ey(e.sourceCode.getScope(t),t.left.name);if(!d)return;let m={context:e,variable:d,variableNode:l,valueNode:u,statement:p,nextExpressionStatement:c,assignType:s?"assignment":"declaration",getFix:a},f=n(m);if(f)return o(f,m)})(e,r,t))},meta:{type:"suggestion",docs:{description:"Disallow immediate mutation after variable assignment.",recommended:!0},fixable:"code",hasSuggestions:!0,messages:{[dY]:"Immediate mutation on {{objectType}} is not allowed.",[dH]:"{{operation}} the elements to the {{assignType}}.",[dQ]:"Move this property to the {{assignType}}.",[dZ]:"{{description}} the {{assignType}}.",[d0]:"Move the element to the {{assignType}}.",[d1]:"Move the entry to the {{assignType}}."},languages:["js/js"]}},"unicorn/no-useless-collection-argument":{create:e=>{e.on("NewExpression",t=>{var r;let n;if(!tf(t,{names:["Set","Map","WeakSet","WeakMap"],argumentsLength:1}))return;let[o]=t.arguments,a="LogicalExpression"===o.type&&"??"===o.operator,i=a?o.right:o,s=th(r=i)?"empty array":te(r,"")?"empty string":ti(r)?"`null`":tP(r)?"`undefined`":void 0;if(!s)return;let l=!1;if(a)n=function*(t){let{sourceCode:r}=e,n=i.parent,{left:o}=n,a=e7(o,e),[,s]=a?e5(o,e):r.getRange(o),[,l]=r.getRange(n);yield t.removeRange([s,l]),(a||"SequenceExpression"!==o.type)&&(yield aT(n,t,e))};else e.sourceCode.getCommentsInside(i).length>0&&(l=!0),n=t=>aw(t,i,e);let u={node:i,messageId:d4,data:{description:s}};return l?u.suggest=[{messageId:d7,fix:n}]:u.fix=n,u})},meta:{type:"suggestion",docs:{description:"Disallow useless values or fallbacks in `Set`, `Map`, `WeakSet`, or `WeakMap`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[d4]:"The {{description}} is useless.",[d7]:"Remove the {{description}}"},languages:["js/js"]}},"unicorn/prefer-response-static-json":{create:e=>{e.on("NewExpression",t=>{if(!tf(t,{name:"Response",minimumArguments:1}))return;let[r]=t.arguments;if(tw(r,{object:"JSON",method:"stringify",argumentsLength:1,optionalCall:!1,optionalMember:!1}))return{node:r.callee,messageId:me,*fix(n){yield n.insertTextAfter(t.callee,".json"),yield aB(t,e,n);let[o]=r.arguments,a=e5(r,e),i=e5(o,e);yield n.removeRange([a[0],i[0]]),yield n.removeRange([i[1],a[1]]),!e7(t,e)&&e7(t.callee,e)&&oD(e.sourceCode.getTokenBefore(t),e,"(")&&(yield n.insertTextBefore(t,";"))}}})},meta:{type:"suggestion",docs:{description:"Prefer `Response.json()` over `new Response(JSON.stringify())`.",recommended:"unopinionated"},fixable:"code",messages:{[me]:"Prefer using `Response.json(…)` over `JSON.stringify()`."},languages:["js/js"]}},"unicorn/filename-case":{create:e=>{let t=e.physicalFilename;if("<input>"===t||"<text>"===t)return;let r=e.options[0]||{},n=function(e){if(e.case)return[e.case];if(e.cases){let t=Object.keys(e.cases).filter(t=>e.cases[t]);return t.length>0?t:["kebabCase"]}return["kebabCase"]}(r),o=(r.ignore||[]).map(e=>E.isRegExp(e)?e:RegExp(e,"u")),a=!1!==r.multipleFileExtensions,i=!1!==r.checkDirectories,s=n.map(e=>mA[e].fn);e.on(rK,r=>{if("Document"!==r.type||r.parent?.type!=="Program")return(()=>{var r;let l,u,p=(r=e.cwd,""===(l=v.relative(r,v.resolve(r,t)))||".."===l||l.startsWith(`..${v.sep}`)||v.isAbsolute(l)?[v.basename(t)]:l.split(v.sep).filter(e=>"."!==e)),{basename:c,filename:d,middle:m,extension:f}=function(e,{multipleFileExtensions:t}){let r=v.extname(e),n=v.basename(e,r),o={basename:n+r,filename:n,middle:"",extension:r};if(t){let[e]=n.split(".",1);Object.assign(o,{filename:e,middle:n.slice(e.length)})}return o}(p.at(-1),{multipleFileExtensions:a});if(p.some(e=>o.some(t=>t.test(e))))return;if(i)for(let e of p.slice(0,-1)){let t=function(e,t,r){let n,{leading:o,words:a}=mj(e);if(e.startsWith("$")||mw(a,r))return;let i=mk(a,r,{leading:o,trailing:""});return{loc:{column:0,line:1},messageId:my,data:{directory:e,chosenCases:mF(t),renamedDirectories:(n=i.map(e=>`\`${e}\``),mE.format(n))}}}(e,n,s);if(t)return t}if(mb.has(c))return;let{leading:g,words:y}=mj(d);if(d.startsWith("$")||mw(y,s))return f!==f.toLowerCase()?{loc:{column:0,line:1},messageId:mh,data:{filename:d+m+f.toLowerCase(),extension:f}}:void 0;let h=mk(y,s,{leading:g,trailing:m+f.toLowerCase()});return{loc:{column:0,line:1},messageId:mg,data:{chosenCases:mF(n),renamedFilenames:(u=h.map(e=>`\`${e}\``),mE.format(u))}}})()})},meta:{type:"suggestion",docs:{description:"Enforce a case style for filenames and directory names.",recommended:!0},schema:mB,defaultOptions:[],messages:{[mg]:"Filename is not in {{chosenCases}}. Rename it to {{renamedFilenames}}.",[my]:"Directory name `{{directory}}` is not in {{chosenCases}}. Rename it to {{renamedDirectories}}.",[mh]:"File extension `{{extension}}` is not in lowercase. Rename it to `{{filename}}`."},languages:["*"]}},"unicorn/consistent-template-literal-escape":{create:e=>{e.on("TemplateElement",t=>{if(tR(t.parent))return;let{raw:r}=t.value,n=r.replaceAll(/(?<=(?:^|[^\\])(?:\\\\)*)\\?\$\\{/g,"\\${");if(r!==n)return{node:t,messageId:mR,fix:r=>aV(t,n,e,r)}})},meta:{type:"suggestion",docs:{description:"Enforce consistent style for escaping `${` in template literals.",recommended:!0},fixable:"code",messages:{[mR]:"Use `\\${` instead of `$\\{` to escape in template literals."},languages:["js/js"]}},"unicorn/no-useless-iterator-to-array":{create:e=>{e.on("NewExpression",t=>{if(!(tf(t,{names:["Map","WeakMap","Set","WeakSet"],argumentsLength:1})||tf(t,{names:rZ,minimumArguments:1}))||!mX(t.arguments[0]))return;let r=t.arguments[0],n=1===t.arguments.length?mY(r,e):void 0,o=t.arguments.length>1?mH(r,e,mz):void 0;return{node:r.callee.property,messageId:mU,data:{description:`new ${t.callee.name}(…)`},...n&&{fix:n},...o&&{suggest:[o]}}}),e.on("CallExpression",t=>((e,t)=>{if(!tw(e,{objects:["Array",...rZ],method:"from",minimumArguments:1,optionalCall:!1,optionalMember:!1})||!mX(e.arguments[0]))return;let r=e.arguments[0],n=1===e.arguments.length?mY(r,t):void 0,o=e.arguments.length>1?mH(r,t,mz):void 0;return{node:r.callee.property,messageId:mU,data:{description:`${e.callee.object.name}.${e.callee.property.name}(…)`},...n&&{fix:n},...o&&{suggest:[o]}}})(t,e)??((e,t)=>{if(!tw(e,{object:"Object",method:"fromEntries",minimumArguments:1,optionalCall:!1,optionalMember:!1})||!mX(e.arguments[0]))return;let r=e.arguments[0],n=1===e.arguments.length?mY(r,t):void 0,o=e.arguments.length>1?mH(r,t,mz):void 0;return{node:r.callee.property,messageId:mU,data:{description:`${e.callee.object.name}.${e.callee.property.name}(…)`},...n&&{fix:n},...o&&{suggest:[o]}}})(t,e)??((e,t)=>{if(!tw(e,{object:"Promise",methods:["all","allSettled","any","race"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||!mX(e.arguments[0]))return;let r=e.arguments[0],n=mH(r,t,mz);return{node:r.callee.property,messageId:mU,data:{description:`${e.callee.object.name}.${e.callee.property.name}(…)`},...n&&{suggest:[n]}}})(t,e)??((e,t)=>{var r,n;if(!(tw(e,{methods:mG,maximumArguments:1,optionalCall:!1,optionalMember:!1})||tw(e,{method:mJ,minimumArguments:1,maximumArguments:2,optionalCall:!1,optionalMember:!1}))||!mX(e.callee.object))return;let o=e.arguments[0],a=e.callee.property.name,i=a===mJ;if(r=o,n=i?3:2,r&&("ArrowFunctionExpression"===(r=mO(r)).type||"FunctionExpression"===r.type)&&(r.params.length>n||r.params.at(-1)?.type==="RestElement"||"FunctionExpression"===r.type&&t.sourceCode.getTokens(r).some(e=>"Identifier"===e.type&&"arguments"===e.value)))return;let s=e.callee.object,l=mH(s,t,mK,{method:a});return{node:s.callee.property,messageId:m_,data:{method:a},...l&&{suggest:[l]}}})(t,e)),e.on("ForOfStatement",t=>{if(!mX(t.right))return;let r=mY(t.right,e);return{node:t.right.callee.property,messageId:mq,...r&&{fix:r}}}),e.on("YieldExpression",t=>{if(!t.delegate||!mX(t.argument))return;let r=mY(t.argument,e);return{node:t.argument.callee.property,messageId:mV,...r&&{fix:r}}}),e.on("SpreadElement",t=>{if(!mX(t.argument))return;let{parent:r}=t;if("ArrayExpression"!==r.type&&"CallExpression"!==r.type&&"NewExpression"!==r.type)return;let n=mY(t.argument,e);return{node:t.argument.callee.property,messageId:mW,...n&&{fix:n}}})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary `.toArray()` on iterators.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[mU]:"`{{description}}` accepts an iterable, `.toArray()` is unnecessary.",[mq]:"`for…of`/`for await…of` can iterate over an iterable, `.toArray()` is unnecessary.",[mV]:"`yield*` can delegate to an iterable, `.toArray()` is unnecessary.",[mW]:"Spread works on iterables, `.toArray()` is unnecessary.",[m_]:"`Iterator` has a `.{{method}}()` method, `.toArray()` is unnecessary.",[mz]:"Remove `.toArray()`.",[mK]:"Remove `.toArray()` and use `Iterator#{{method}}()`."},languages:["js/js"]}},"unicorn/prefer-simple-condition-first":{create:e=>{let{sourceCode:t}=e;e.on("LogicalExpression",r=>{if("&&"!==r.operator&&"||"!==r.operator||function(e){let{operator:t}=e,{parent:r}=e;for(;rI(r)&&r.expression===e;)r=(e=r).parent;return r?.type==="LogicalExpression"&&r.operator===t}(r)||!function e(t,r){if(tq(t,r)||tV(t))return!0;let{parent:n}=t;return rI(n)&&n.expression===t&&e(n,r)}(r,e))return;let n=function e(t,r,n=[]){let o=rj(t);return"LogicalExpression"!==o.type||o.operator!==r?n.push(t):(e(o.left,r,n),e(o.right,r,n)),n}(r,r.operator),o=n.map(e=>({operand:e,isSimple:m2(e)})),a=o.findIndex(({isSimple:e})=>!e),i=o.findIndex(({isSimple:e},t)=>e&&t>a);if(-1===a||-1===i)return;let s=[...o.filter(({isSimple:e})=>e),...o.filter(({isSimple:e})=>!e)].map(({operand:e})=>e),l=o.findLastIndex(({isSimple:e})=>e),u=o.every(({operand:e,isSimple:t},r)=>{var n;return t||r>l||m2(n=e)||function e(t){let r=rj(t);return"ConditionalExpression"===r.type&&[r.test,r.consequent,r.alternate].every(t=>m2(t)||m1(t)||e(t))}(n)}),p=u&&!function e(t,r){if(rI(t)){let e=rj(t);return"LogicalExpression"===e.type&&e.operator===r}return"LogicalExpression"===t.type&&t.operator===r&&(e(t.left,r)||e(t.right,r))}(r,r.operator)&&!function(e,t,r){let{sourceCode:n}=r;if(n.getCommentsInside(e).length>0)return!0;let[o]=t,a=t.at(-1),[i]=e5(o,r),[,s]=e5(a,r),l={range:[i,s]};return eT(n.getTokenBefore(l,{includeComments:!0}))||eT(n.getTokenAfter(l,{includeComments:!0}))}(r,n,e)?n=>n.replaceTextRange(t.getRange(r),s.map((t,n)=>(function(e,t,{operator:r,property:n}){let o=e7(e,t),a=o?e4(e,t):t.sourceCode.getText(e);return!o&&o3(e,{operator:r,property:n})&&(a=`(${a})`),a})(t,e,{operator:r.operator,property:0===n?"left":"right"})).join(` ${r.operator} `)):void 0;return{node:r,loc:t.getLoc(n[i]),messageId:u?mQ:mZ,data:{operator:r.operator},...p&&{fix:p}}})},meta:{type:"suggestion",docs:{description:"Prefer simple conditions first in logical expressions.",recommended:!0},fixable:"code",messages:{[mQ]:"Prefer this simple condition first in the `{{operator}}` expression.",[mZ]:"Consider moving this simple condition first after verifying short-circuit behavior."},languages:["js/js"]}},"unicorn/switch-case-break-position":{create:e=>{let{sourceCode:t}=e;e.on("SwitchCase",r=>{let{consequent:n}=r;if(n.length<2)return;let o=n.at(-1);if(!m8.has(o.type))return;let a=n.slice(0,-1);if(1!==a.length||"BlockStatement"!==a[0].type)return;let i=a[0];if(0===i.body.length)return;let s=function(e){switch(e.type){case"BreakStatement":return"break";case"ReturnStatement":return"return";case"ContinueStatement":return"continue";case"ThrowStatement":return"throw"}}(o);return{node:o,loc:t.getLoc(o),messageId:m3,data:{keyword:s},..."ReturnStatement"!==o.type&&"ThrowStatement"!==o.type&&{*fix(r){let n=t.getLastToken(i);if(t.getTokensBetween(n,o,{includeComments:!0}).some(e=>eT(e)))return;let a=t.getLoc(i);if(a.start.line===a.end.line||rN(e,o))return;let s=i.body.at(-1),l=t.getText(o),u=rw(s,e),p=t.getTokenBefore(n,{includeComments:!0});yield r.insertTextAfter(p,`
|
|
50
|
+
${u}${l}`);let c=t.getRange(n)[1],d=t.getRange(o)[1];yield r.removeRange([c,d])}}}})},meta:{type:"layout",docs:{description:"Enforce consistent `break`/`return`/`continue`/`throw` position in `case` clauses.",recommended:!0},fixable:"code",messages:{[m3]:"Move `{{keyword}}` inside the block statement."},languages:["js/js"]}},"unicorn/better-dom-traversing":{create:e=>{e.on("MemberExpression",t=>{let r,n=(e=>{if(fa(e)){if(fo(e.object,"childNodes"))return"childNodes";if(fo(e.object,"children"))return"children"}})(t);if(!n||oa(t.object.object)||"children"===n&&fo(r=t.object,"children")&&("Identifier"===r.object.type&&"props"===r.object.name||tT(r.object,{property:"props",optional:!1,computed:!1}))||t.parent?.type==="MemberExpression"&&t.parent.object===t&&fo(t.parent,"children")&&fa(t.parent.parent))return;let o=t.property.value;return"childNodes"===n&&0===o?{node:t,messageId:m6,suggest:fs(t,"firstChild",fe,e)}:"children"===n&&0===o?{node:t,messageId:m9,suggest:fs(t,"firstElementChild",ft,e)}:"children"===n?{node:t,messageId:m5}:void 0}),e.on("MemberExpression",e=>{if(!(!fl(e)||!fl(e.object)||!(!fl(e.parent)||e.parent.object!==e)||oa((e=>{for(;fl(e);)e=e.object;return e})(e))))return{node:e,messageId:m4}}),e.on("CallExpression",t=>{if(!fp(t)||t.parent?.type==="MemberExpression"&&t.parent.object===t&&t.parent.parent?.callee===t.parent&&fp(t.parent.parent)&&fu(t.parent.parent.arguments[0])||(e=>{for(;e.parent?.type==="MemberExpression"&&e.parent.object===e||e.parent?.type==="CallExpression"&&e.parent.callee===e;)e=e.parent;return e.parent?.type==="ChainExpression"})(t))return;let r=(e=>{let t=[];for(;fp(e);){let[r]=e.arguments;if(!fu(r))break;t.push(e),e=e.callee.object}if(t.length<2||"ChainExpression"===e.type||oa(e))return;let r=[];for(let e of t)r.unshift(tn(e.arguments[0]));return{root:e,selectors:r,quoteNode:t.at(-1).arguments[0]}})(t);if(r)return{node:t,messageId:m7,suggest:((e,t,r)=>{let n,o,{sourceCode:a}=r;if(fi(e,a)||!t.selectors.every(e=>!e.includes(",")&&!e.includes(":scope")))return;let i=e4(t.root,r),s=`${"Identifier"===(n=t.root).type&&"document"===n.name||"MemberExpression"===n.type&&!n.computed&&"Identifier"===n.object.type&&["globalThis","window"].includes(n.object.name)&&"Identifier"===n.property.type&&"document"===n.property.name?"":":scope "}${t.selectors.join(" ")}`,l=`${i}.querySelector(${tK(s,"Literal"===(o=t.quoteNode).type&&o.raw.startsWith('"')?'"':"'")})`;return[{messageId:fr,fix:t=>t.replaceText(e,l)}]})(t,r,e)}})},meta:{type:"suggestion",docs:{description:"Prefer better DOM traversal APIs.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[m6]:"Prefer `.firstChild` over `.childNodes[0]`.",[m9]:"Prefer `.firstElementChild` over `.children[0]`.",[m5]:"Consider `.querySelector()` over positional child traversal.",[m4]:"Consider `.closest()` over chaining `.parentElement`.",[m7]:"Consider merging chained `.querySelector()` calls.",[fe]:"Switch to `.firstChild`.",[ft]:"Switch to `.firstElementChild`.",[fr]:"Merge the `.querySelector()` calls."},languages:["js/js"]}},"unicorn/consistent-compound-words":{create:e=>{let t=(({checkProperties:e=!1,checkVariables:t=!0,checkDefaultAndNamespaceImports:r="internal",checkShorthandImports:n="internal",checkShorthandProperties:a=!1,extendDefaultReplacements:s=!0,replacements:l={},allowList:u={}}={})=>{let p=new o(Object.entries(s?{...fy,...l}:l).filter(([,e])=>!1!==e));return{checkProperties:e,checkVariables:t,checkDefaultAndNamespaceImports:r,checkShorthandImports:n,checkShorthandProperties:a,replacements:p,replacementRegExp:p.size>0?(e=>{let t=[],r=[];for(let n of e.keys())t.push(fx(n)),r.push(fx(an(n)));return RegExp(`(?:^(?:${t.join("|")})|(?:${r.join("|")}))${fb}`,"gv")})(p):void 0,allowList:new i(Object.keys(u))}})(e.options[0]),r=new s,n=new s,a=(e,t)=>t.every(t=>{let r=n.get(t);return!r||!r.has(e)}),l=e=>{if((e=>{if(1!==e.defs.length)return!1;let[t]=e.defs;return"ClassName"===t.type})(e)){if("class"===e.scope.type){let[t]=e.defs,n=r.get(t.name);return n?u({name:e.name,scope:e.scope,defs:e.defs,identifiers:e.identifiers,references:[...e.references,...n.references]}):u(e)}let[t]=e.defs;return void r.set(t.name,e)}return u(e)},u=r=>{var o;if(0===r.defs.length)return;let s=fE(r.name,t);if(!s)return;let[l]=r.defs;if(!(!("ImportDefaultSpecifier"===(o=l.name).parent.type&&o.parent.local===o||"ImportNamespaceSpecifier"===o.parent.type&&o.parent.local===o||"ImportSpecifier"===o.parent.type&&o.parent.local===o&&"Identifier"===o.parent.imported.type&&"default"===o.parent.imported.name||"VariableDeclarator"===o.parent.type&&o.parent.id===o&&tj(o.parent.init))||t.checkDefaultAndNamespaceImports&&("internal"!==t.checkDefaultAndNamespaceImports||fm(l)))||!(!oy(l.name,e)||t.checkShorthandImports&&("internal"!==t.checkShorthandImports||fm(l)))||!t.checkShorthandProperties&&ob(l.name))return;let u=[...r.references.map(e=>e.from),r.scope],p=rF(s)?ry(s,u,a):void 0,c=fv(l.name,p??s);if(p&&rJ(r).every(e=>!("VariableDeclarator"===e.parent.type&&e.parent.id===e?"VariableDeclaration"===e.parent.parent.type&&"ExportNamedDeclaration"===e.parent.parent.parent.type:!!fc.has(e.parent.type)&&e.parent.id===e&&"ExportNamedDeclaration"===e.parent.parent.type)&&"JSXIdentifier"!==e.type)&&r.references.every(e=>!e.vueUsedInTemplate)){for(let e of u)n.has(e)||n.set(e,new i),n.get(e).add(p);c.suggest=[{messageId:fg,data:{replacement:p},fix:t=>aq(r,p,e,t)}]}e.report(c)},p=e=>{for(let t of e.variables)l(t)},c=r=>{if(!t.checkProperties||"__proto__"===r.name)return;let n=fE(r.name,t);if(!n||"ExportSpecifier"===r.parent.type||(t.checkVariables||("TSParameterProperty"===r.parent.type?r.parent.parameter!==r:"AssignmentPattern"!==r.parent.type||r.parent.left!==r||"TSParameterProperty"!==r.parent.parent.type||r.parent.parent.parameter!==r.parent))&&!("MemberExpression"===r.parent.type&&r.parent.property===r&&!r.parent.computed&&("AssignmentExpression"===r.parent.parent.type&&r.parent.parent.left===r.parent||"UpdateExpression"===r.parent.parent.type&&r.parent.parent.argument===r.parent)||"Property"===r.parent.type&&r.parent.key===r&&!r.parent.computed&&!r.parent.shorthand&&"ObjectExpression"===r.parent.parent.type||"ExportSpecifier"===r.parent.type&&r.parent.exported===r&&r.parent.local!==r||fd.has(r.parent.type)&&r.parent.key===r&&!r.parent.computed))return;let o=fv(r,n);e.report(o)};e.on("Identifier",c),e.on("PrivateIdentifier",c),e.on("Program:exit",r=>{if(t.checkVariables)for(let t of rp(e.sourceCode.getScope(r)))p(t)})},meta:{type:"suggestion",docs:{description:"Enforce consistent spelling of compound words in identifiers.",recommended:"unopinionated"},hasSuggestions:!0,schema:fC,defaultOptions:[{}],messages:{[ff]:"Prefer `{{replacement}}` over `{{name}}`.",[fg]:"Rename to `{{replacement}}`."},languages:["js/js"]}},"unicorn/no-blob-to-file":{create:e=>{e.on("VariableDeclarator",t=>(function(e,t){let{sourceCode:r}=t,{id:n,init:o}=e;if("Identifier"!==n.type||"VariableDeclaration"!==e.parent.type||"const"!==e.parent.kind||1!==e.parent.declarations.length||"Program"!==e.parent.parent.type&&"BlockStatement"!==e.parent.parent.type)return;let a=function(e,t){if(!tf(e,{name:"File",minimumArguments:2,maximumArguments:2})||!fT(e.callee,t))return;let[r]=e.arguments,[,n]=e.arguments;if("ArrayExpression"!==r.type||1!==r.elements.length||r.elements[0]?.type==="SpreadElement"||void 0===tn(n))return;let[o]=r.elements;if(function(e,t,r){let n=fA(e,r);if(!n||r.sourceCode.getRange(n)[0]>r.sourceCode.getRange(t)[0])return!1;let o=n.init;return(tf(o,{name:"Blob",maximumArguments:1})||tf(o,{name:"File",minimumArguments:2,maximumArguments:2}))&&fT(o.callee,r)}(o,e,t))return o}(o,t);if(!a)return;let i=ey(r.getScope(n),n);if(!i)return;let s=rJ(i).filter(e=>e!==n);if(1!==s.length)return;let[l]=s,u=function(e,t){let r,{parent:n}=e;return tw(n,{object:"URL",method:"createObjectURL",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&n.arguments[0]===e&&fT(n.callee.object,t)?{call:n,kind:"blobArgument"}:tw(n,{methods:["append","set"],minimumArguments:2,maximumArguments:3,optionalCall:!1,optionalMember:!1})&&n.arguments[1]===e&&(r=fA(n.callee.object,t)?.init,tf(r,{name:"FormData",argumentsLength:0})&&fT(r.callee,t))?{call:n,kind:"formData"}:void 0}(l,t);if(!u)return;let p=function(e){let[,t]=e.arguments;return t}(o);if(!(!function(e,t,r){if("Identifier"!==e.type)return!0;let{sourceCode:n}=r;return ey(n.getScope(e),e)===ey(n.getScope(t),e)}(a,l,t)||function(e,t){let{sourceCode:r}=t;return r.getCommentsInside(e).length>0||r.getCommentsBefore(e).some(t=>r.getLoc(t).end.line===r.getLoc(e).start.line||r.getLoc(t).end.line===r.getLoc(e).start.line-1)||rN(t,e)}(e.parent,t))&&("formData"!==u.kind||2!==u.call.arguments.length||p))return{node:o,messageId:fD,suggest:[{messageId:fS,*fix(n){yield aO(e.parent,t,n),yield n.replaceText(l,r.getText(a)),"formData"===u.kind&&2===u.call.arguments.length&&(yield n.insertTextAfter(l,`, ${r.getText(p)}`))}}]}})(t,e))},meta:{type:"suggestion",docs:{description:"Disallow unnecessary `Blob` to `File` conversion.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[fD]:"Use the original `Blob` instead of converting it to a `File`.",[fS]:"Replace the `File` with the original `Blob`."},languages:["js/js"]}},"unicorn/no-canvas-to-image":{create:e=>{let{sourceCode:t}=e;e.on("CallExpression",e=>{var r,n,o;if(!tw(e,{method:"drawImage",minimumArguments:1,optionalCall:!1,optionalMember:!1}))return;let[a]=e.arguments;if("SpreadElement"!==a.type&&(r=fI(a,t),r?.type==="CallExpression"&&!r.optional&&"Identifier"===r.callee.type&&"loadImage"===r.callee.name&&r.arguments.length>0&&"SpreadElement"!==r.arguments[0].type&&tw(n=r.arguments[0],{method:"toDataURL",optionalCall:!1,optionalMember:!1})&&("Identifier"===(o=n.callee.object).type?fj(o.name):"MemberExpression"===o.type&&!o.computed&&"Identifier"===o.property.type&&fj(o.property.name))))return{node:a,messageId:fw}}),e.on("CallExpression",e=>{if(!tw(e,{method:"putImageData",minimumArguments:1,optionalCall:!1,optionalMember:!1}))return;let[r]=e.arguments;if("SpreadElement"!==r.type&&tw(fI(r,t),{method:"getImageData",optionalCall:!1,optionalMember:!1}))return{node:r,messageId:fw}})},meta:{type:"suggestion",docs:{description:"Prefer drawing canvases directly instead of converting them to images.",recommended:"unopinionated"},messages:{[fw]:"Prefer drawing the canvas directly with `drawImage()`."},languages:["js/js"]}},"unicorn/no-confusing-array-splice":{create:e=>{e.on("CallExpression",t=>{if(!tw(t,{methods:["splice","toSpliced"],argumentsLength:3,optionalCall:!1,optionalMember:!1}))return;let r=function([e,t]){let r=function(e){let t=oQ(e);if("number"==typeof t)return Math.max(Math.trunc(t),0)}(t);return 1===r?fF:-1===Math.trunc(oQ(e))&&0===r?fB:void 0}(t.arguments);if(!r)return;let n={node:t.callee.property,messageId:r,data:{method:t.callee.property.name}},o=function(e,t,r){let{sourceCode:n}=r,{object:o,property:a}=e.callee,[i,,s]=e.arguments,l=a.name,u=e4(o,r),p=n.getText(i),c=n.getText(s);if(t===fF){if(fN(e,n))return;if("toSpliced"===l){var d,m;if(0>Math.trunc(oQ(i))||(d=i,m=o,d=rj(d),m=rj(m),"MemberExpression"===d.type&&!d.optional&&!d.computed&&"Identifier"===d.property.type&&"length"===d.property.name&&ux(d.object,m)))return;return{messageId:fR,fix:t=>t.replaceText(e,`${u}.with(${p}, ${c})`)}}return"ExpressionStatement"===e.parent.type&&fL(o)&&(oQ(i)??0)>=0?{messageId:fR,fix:t=>t.replaceText(e,`${u}[${p}] = ${c}`)}:void 0}if(t===fB&&fL(o)&&!fN(i,n))return{messageId:fP,fix:e=>e.replaceText(i,`Math.max(${u}.length - 1, 0)`)}}(t,r,e);return o&&(n.suggest=[o]),n})},meta:{type:"suggestion",docs:{description:"Disallow confusing uses of `Array#{splice,toSpliced}()`.",recommended:!0},hasSuggestions:!0,messages:{[fF]:"Prefer a direct element replacement instead of `{{method}}()`.",[fB]:"Avoid using `{{method}}()` to insert at `-1`.",[fR]:"Use direct element replacement.",[fP]:"Resolve the insertion index explicitly."},languages:["js/js"]}},"unicorn/no-duplicate-set-values":{create:e=>{let{sourceCode:t}=e;e.on("NewExpression",r=>{if(!tf(r,{name:"Set",argumentsLength:1}))return;let[n]=r.arguments;if("ArrayExpression"===n.type)return rA(n.elements,e).map(e=>({node:e??n,messageId:f$,data:{value:e?t.getText(e):"undefined"}}))})},meta:{type:"suggestion",docs:{description:"Disallow duplicate values in `Set` constructor array literals.",recommended:!0},messages:{[f$]:"Remove duplicate value `{{value}}` from the Set."},languages:["js/js"]}},"unicorn/no-incorrect-query-selector":{create:e=>{let{sourceCode:t}=e;e.on("MemberExpression",r=>{if(!fz(r)||fG(r))return;let n=r.object;if(!fJ(r,n,t,e))return fH(r,n,e)}),e.on("CallExpression",r=>{let n;if(fK(r)){if(fG(r))return;let n=r.callee.object;if(fJ(r,n,t,e))return;return fH(r,n,e)}let o=fY(r,e);if(o)return o;if(f_(r)&&!(fz(n=r.parent)||fK(n)||"MemberExpression"===r.parent.type&&r.parent.object===r&&fK(r.parent.parent))){let e;if(e=tn(r.arguments[0]),/^#[\-A-Z_a-z][\w\-]*$/v.test(e))return{node:r.callee.property,messageId:fO}}}),e.on("BinaryExpression",r=>((e,t)=>{let{sourceCode:r}=t;if(fZ(e,f_,r))return{node:e,messageId:fq}})(r,e)??((e,t)=>{let r=fZ(e,fW,t);if(r&&("==="===e.operator||"!=="===e.operator)&&tP(r.value))return{node:e,messageId:fV}})(r,t)),e.on("Identifier",t=>fY(t,e))},meta:{type:"suggestion",docs:{description:"Disallow incorrect `querySelector()` and `querySelectorAll()` usage.",recommended:!0},fixable:"code",schema:[],messages:{[fM]:"Prefer `.querySelector()` when only the first match is used.",[fO]:"Prefer `.querySelector()` for a simple ID selector.",[fU]:"Check `.length` instead of the `NodeList` object itself.",[fq]:"Check `.length` instead of comparing the `NodeList` object with `null` or `undefined`.",[fV]:"Compare the result of `.querySelector()` with `null` instead of `undefined`."},languages:["js/js"]}},"unicorn/no-invalid-file-input-accept":{create:e=>{e.on("JSXOpeningElement",t=>{if("input"!==f4(t.name))return;let r=((e,t)=>{if(t?.value){if(tt(t.value))return t.value.value;if("JSXExpressionContainer"===t.value.type)return ge(e,t.value.expression)}})(e,f7(t,"type"));if(r?.toLowerCase()!=="file")return;let n=f7(t,"accept");if(!n)return;let o=((e,t)=>{if(!t.value)return{node:t,missing:!0};if(tt(t.value))return{node:t.value,value:t.value.value,fixable:!0};if("JSXExpressionContainer"!==t.value.type)return{node:t.value,dynamic:!0};let r=ge(e,t.value.expression);return void 0===r?{node:t.value,dynamic:!0}:{node:t.value,value:r,fixable:!1}})(e,n);return gs({valueInfo:o,fix:t=>r=>{let n;return n=o.node,r.replaceTextRange([e.sourceCode.getRange(n)[0]+1,e.sourceCode.getRange(n)[1]-1],t)}})}),e.on("Tag",t=>{if("input"!==t.name.toLowerCase())return;let r=gi(e,t,"type")?.value;if(r?.toLowerCase()!=="file")return;let n=((e,t,r)=>{let n=gi(e,t,r);if(!n)return;let o=t.attributes.find(e=>"Attribute"===e.type&&e.key?.value?.toLowerCase()===r);return n.missing?{node:o??t,missing:!0}:o?.value?.parts?.length>0?{node:o.value,dynamic:!0}:f6.test(n.value)?void 0:{node:o?.value??t,value:n.value,fixable:!0,valueRange:n.valueRange,isReplacementFixable:e=>n.isQuoted||!/\s/v.test(e)}})(e,t,"accept");if(n)return gs({valueInfo:n,fix:e=>t=>t.replaceTextRange(n.valueRange,e)})})},meta:{type:"problem",docs:{description:"Disallow invalid `accept` values on file inputs.",recommended:!1},fixable:"code",messages:{[f0]:"Invalid file input `accept` value: {{reason}}",[f1]:"The file input `accept` value must be static.",[f2]:"Prefer `{{replacement}}` as the file input `accept` value."},languages:["js/js","html/html"]}},"unicorn/no-late-current-target-access":{create:e=>{let{sourceCode:t}=e,r=gc(e);e.on("MemberExpression",e=>{if("Identifier"!==e.object.type||!tT(e,{property:"currentTarget"})||!gl.test(e.object.name))return;let n=ey(t.getScope(e.object),e.object),o=n?.defs.find(({type:e})=>"Parameter"===e);if(!o)return;let a=o.node,i=gu(e)!==a;if(i||r.isFunctionSuspended(a)||r.isInsideSuspendingLoop(e,a))return{node:e,messageId:i?gm:gd,data:{name:e.object.name}}})},meta:{type:"problem",docs:{description:"Disallow accessing `event.currentTarget` after the synchronous event dispatch has finished.",recommended:!0},messages:{[gd]:"`{{name}}.currentTarget` is `null` after the handler suspends. It is only set during synchronous event dispatch; save it to a variable beforehand.",[gm]:"`{{name}}.currentTarget` is `null` inside this nested function. It is only set during synchronous event dispatch; save it to a variable in the outer function."},languages:["js/js"]}},"unicorn/no-unnecessary-nested-ternary":{create:e=>{let{sourceCode:t}=e;e.on("ConditionalExpression",r=>{let{test:n,consequent:o,alternate:a}=r;return"ConditionalExpression"===o.type&&gg(o.alternate,a,t)?gx(e,r,{left:n,operator:"&&",right:o.test,consequent:o.consequent,alternate:o.alternate}):"ConditionalExpression"===a.type&&gg(o,a.consequent,t)?gx(e,r,{left:n,operator:"||",right:a.test,consequent:o,alternate:a.alternate}):void 0})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary nested ternary expressions.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[gf]:"Do not use unnecessary nested ternary expressions."},languages:["js/js"]}},"unicorn/no-unused-array-method-return":{create:e=>{e.on("CallExpression",t=>{let r="MemberExpression"===t.callee.type?eO(t.callee,e.sourceCode.getScope(t.callee)):void 0;if(!(!gE.has(r)||!(e=>{for(;;){if(oE(e))return!0;let{parent:t}=e;if("ForStatement"===t.type&&(t.init===e||t.update===e))return!0;if("ChainExpression"!==t.type&&"AwaitExpression"!==t.type&&"TSAsExpression"!==t.type&&"TSTypeAssertion"!==t.type&&"TSNonNullExpression"!==t.type&&"TSSatisfiesExpression"!==t.type)return!1;e=t}})(t)||((e,t,r)=>{let n,o=function e(t,r,n=new i){if(!t||t===gC||n.has(t))return t;if(n.add(t),"Identifier"===t.type){let o=function(e,t){let r=ey(t.sourceCode.getScope(e),e);if(!r||0===r.defs.length)return;if(1!==r.defs.length||function(e,t,r){let[n]=r.sourceCode.getRange(t);return e.references.some(e=>!e.init&&e.isWrite()&&r.sourceCode.getRange(e.identifier)[0]<n)}(r,e,t))return gC;let[n]=r.defs;if("Parameter"===n.type&&n.node.params?.includes(n.name))return n.name.typeAnnotation&&!nE(n.name.typeAnnotation,t)?gC:void 0;if("Variable"===n.type&&"VariableDeclarator"===n.node.type&&"Identifier"===n.node.id.type&&n.node.id.name===e.name&&"VariableDeclaration"===n.parent.type){let{typeAnnotation:e}=n.node.id;return e?nE(e,t)?void 0:gC:n.node.init??gC}return gC}(t,r);return o===gC?o:void 0===o?t:e(o,r,n)}return["ChainExpression","TSNonNullExpression","TSSatisfiesExpression"].includes(t.type)?e(t.expression,r,n):"MemberExpression"===t.type?gC:"TSAsExpression"===t.type||"TSTypeAssertion"===t.type?nE(t,r)?t:gC:t}(e,r);return!!(tm(n=o,"expect",tp)||tw(n,{object:"expect",methods:["element","poll","soft"]}))||("values"===t?o===gC||!nE(o,r):o===gC||((e,t)=>{let r,n;return gS(e,"undefined",t)||"ObjectExpression"===e.type||"Literal"===e.type||"BinaryExpression"===e.type||"TemplateLiteral"===e.type||"ArrowFunctionExpression"===e.type||"FunctionExpression"===e.type||"ClassExpression"===e.type||"NewExpression"===e.type&&!gS(e.callee,"Array",t)||(r=e,n=t,tm(r,gD,tp)&&n.sourceCode.isGlobalReference(r.callee))})(o,r)||"Identifier"===o.type&&gv.test(o.name)&&!nE(o,r))})(t.callee.object,r,e)))return{node:t.callee.property,messageId:gb,data:{method:r}}})},meta:{type:"suggestion",docs:{description:"Disallow ignoring the return value of selected array methods.",recommended:"unopinionated"},messages:{[gb]:"Do not ignore the return value of `.{{method}}(…)`."},languages:["js/js"]}},"unicorn/prefer-array-last-methods":{create:e=>{let{sourceCode:t}=e;e.on("CallExpression",r=>{if(!tw(r,{methods:gw.keys().toArray(),optionalCall:!1,optionalMember:!1}))return;let n=r.callee.object;if(!tw(n,{methods:gk,argumentsLength:0,optionalCall:!1,optionalMember:!1}))return;let o=r.callee.property.name,a=gw.get(o),i={method:o,replacement:a,reversingMethod:n.callee.property.name},s={node:r.callee.property,messageId:gT,data:i};return 0===t.getCommentsInside(r).length&&(s.suggest=[{messageId:gA,data:i,*fix(t){yield t.replaceText(r.callee.property,a),yield aM(t,n,e)}}]),s})},meta:{type:"suggestion",docs:{description:"Prefer last-oriented array methods over `Array#reverse()` or `Array#toReversed()` followed by a method.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[gT]:"Prefer `Array#{{replacement}}()` over `Array#{{reversingMethod}}().{{method}}()`.",[gA]:"Replace `.{{reversingMethod}}().{{method}}()` with `.{{replacement}}()`."},languages:["js/js"]}},"unicorn/prefer-math-abs":{create:e=>{e.on("ConditionalExpression",t=>{let r=function(e,t){let r=function(e,t){if(!("BinaryExpression"!==e.type||!gj.has(e.operator)||gN(e.left,t)||gN(e.right,t))){if(te(e.right,0))return{value:e.left,operator:e.operator};if(te(e.left,0))return{value:e.right,operator:gF[e.operator]}}}(e.test,t);if(!r)return;let{value:n,operator:o}=r,{consequent:a,alternate:i}=e;if(("<"===o||"<="===o)&&g$(a,n)&&rC(i,n)||(">"===o||">="===o)&&rC(a,n)&&g$(i,n))return n}(t,e);if(!r)return;let n=gV(r)?function*(n){yield aP(n,t,e),yield n.replaceText(t,`Math.abs(${gU(r,e)})`)}:void 0;return gq(t,e,n)}),e.on("LogicalExpression",t=>{let r=function(e,t){if("||"!==e.operator)return;let r=gM(e.left,t),n=gO(e.right,t);if(r&&n&&rC(r.value,n.value)&&gB[r.operator]===n.operator&&g$(n.negativeThreshold,r.threshold))return{value:r.value,threshold:r.threshold,operator:r.operator};let o=gM(e.right,t),a=gO(e.left,t);if(o&&a&&rC(o.value,a.value)&&gB[o.operator]===a.operator&&g$(a.negativeThreshold,o.threshold))return{value:o.value,threshold:o.threshold,operator:o.operator}}(t,e);if(!r)return;let{value:n,threshold:o,operator:a}=r,i=gV(n)&&gV(o)?function*(r){yield aP(r,t,e),yield r.replaceText(t,`Math.abs(${gU(n,e)}) ${a} ${e4(o,e)}`)}:void 0;return gq(t,e,i)})},meta:{type:"suggestion",docs:{description:"Prefer `Math.abs()` over manual absolute value expressions and symmetric range checks.",recommended:"unopinionated"},fixable:"code",messages:{[gI]:"Prefer `Math.abs()` to simplify this expression."},languages:["js/js"]}},"unicorn/prefer-split-limit":{create:e=>{let{sourceCode:t}=e;e.on("MemberExpression",r=>{if(!r.computed||nL(r))return;let n=gz(r.object);if(!n)return;let o=g_(r.property,t);if(void 0!==o)return gK(r,n,o+1,e)}),e.on("CallExpression",r=>{if(!tw(r,{method:"at",argumentsLength:1}))return;let n=gz(r.callee.object);if(!n)return;let o=g_(r.arguments[0],t);if(void 0!==o)return gK(r,n,o+1,e)}),e.on("VariableDeclarator",t=>{if("ArrayPattern"===t.id.type)return gG(t.id,t.init,e)}),e.on("AssignmentExpression",t=>{if("ArrayPattern"===t.left.type&&oE(t))return gG(t.left,t.right,e)})},meta:{type:"suggestion",docs:{description:"Prefer `String#split()` with a limit.",recommended:"unopinionated"},fixable:"code",messages:{[gW]:"Prefer `String#split()` with a limit."},languages:["js/js"]}},"unicorn/prefer-queue-microtask":gX,"unicorn/prefer-string-pad-start-end":{create:e=>{e.on("BinaryExpression",t=>((e,t)=>{if("+"!==e.operator)return;let r=g8(e.left,t);if(r&&rC(e.right,r.targetNode)&&!gZ(e.right,t)){let n=g2({targetNode:e.right,targetLengthNode:r.targetLengthNode,paddingNode:r.paddingNode});return g9({node:e,method:"padStart",replacement:n&&g6({method:"padStart",targetNode:e.right,...r},t),context:t,canFix:n})}let n=g8(e.right,t);if(n&&rC(e.left,n.targetNode)&&!gZ(e.left,t)){let r=g2({targetNode:e.left,targetLengthNode:n.targetLengthNode,paddingNode:n.paddingNode});return g9({node:e,method:"padEnd",replacement:r&&g6({method:"padEnd",targetNode:e.left,...n},t),context:t,canFix:r})}})(t,e)),e.on("CallExpression",t=>((e,t)=>{if(!tw(e,{method:"slice",minimumArguments:1,maximumArguments:2,optionalCall:!1,optionalMember:!1})||"BinaryExpression"!==e.callee.object.type||"+"!==e.callee.object.operator)return;let{object:r}=e.callee,[n,o]=e.arguments,a=g3(r.left,t),i=(e=>{if(e?.type==="UnaryExpression"&&"-"===e.operator)return e.argument})(n);if(1===e.arguments.length&&a&&i&&to(a.widthNode)&&rC(a.widthNode,i)&&"Identifier"===r.right.type&&!gZ(r.right,t)){let n=g1(a.paddingNode);return g5({node:e,method:"padStart",replacement:g6({method:"padStart",targetNode:r.right,targetLengthNode:a.widthNode,...a},t),context:t,canSuggest:n})}let s=g3(r.right,t);if(2===e.arguments.length&&s&&to(n)&&0===n.value&&to(s.widthNode)&&rC(s.widthNode,o)&&"Identifier"===r.left.type&&!gZ(r.left,t)){let n=g1(s.paddingNode);return g5({node:e,method:"padEnd",replacement:g6({method:"padEnd",targetNode:r.left,targetLengthNode:s.widthNode,...s},t),context:t,canSuggest:n})}})(t,e))},meta:{type:"suggestion",docs:{description:"Prefer `String#padStart()` and `String#padEnd()` over manual string padding.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[gY]:"Prefer `String#{{method}}()` over manual string padding.",[gH]:"Replace with `String#{{method}}()`."},languages:["js/js"]}},"unicorn/require-css-escape":yo,"unicorn/require-passive-events":{create:e=>{e.on("CallExpression",t=>{if(!tw(t,{method:"addEventListener",minimumArguments:2,maximumArguments:3,optionalCall:!1,optionalMember:!1}))return;let[r,n,o]=t.arguments;if(!tt(r)||!yi.has(r.value)||"ArrowFunctionExpression"!==n.type&&"FunctionExpression"!==n.type||!((e,t)=>{let r;if(r=t.sourceCode,"FunctionExpression"===e.type&&rp(r.getScope(e)).some(t=>((e,t)=>{let r=e.block;for(;r&&r!==t;){if("FunctionDeclaration"===r.type||"FunctionExpression"===r.type)return!1;r=r.parent}return r===t})(t,e)&&t.references.some(({identifier:e})=>"arguments"===e.name)))return!1;let[n]=e.params;if(!n)return!0;if("Identifier"!==n.type)return!1;let o=t.sourceCode.getDeclaredVariables(e).find(e=>e.defs[0]?.name===n);if(!o)return!1;for(let{identifier:e}of o.references)if(yl(e)||!yu(e))return!1;return!0})(n,e))return;let a=((e,t,r)=>{if(!r){let r;return{fix:(r=t.arguments[1],t=>t.insertTextAfterRange(e5(r,e),", {passive: true}"))}}if(tr(r,!0)||tr(r,!1))return{fix:e=>e.replaceText(r,tr(r,!0)?"{capture: true, passive: true}":"{passive: true}")};if("ObjectExpression"!==r.type||r.properties.some(e=>"SpreadElement"===e.type||e.computed))return;let n=r.properties.findLast(e=>"Property"===e.type&&"passive"===(e=>{if(!e.computed){if("Identifier"===e.key.type)return e.key.name;if(tt(e.key))return e.key.value}})(e));if(!n)return{fix:((e,t)=>{let r=e.properties.at(-1);if(!r)return!1;let n=t.getLastToken(e);return t.getTokensBetween(r,n,{includeComments:!0}).some(e=>"Block"===e.type||"Line"===e.type)})(r,e.sourceCode)?void 0:t=>{let{sourceCode:n}=e;if(0===r.properties.length)return t.replaceText(r,"{passive: true}");let o=r.properties.at(-1);if(n.getLoc(r).start.line===n.getLoc(r).end.line)return t.insertTextAfter(o,", passive: true");let a=n.getTokenAfter(o),i=rw(o,e);return","===a.value?t.insertTextAfter(a,`
|
|
51
51
|
${i}passive: true,`):t.insertTextAfter(o,`,
|
|
52
|
-
${i}passive: true`)}};if(tt(n.value,!1))return{fix:e=>e.replaceText(n.value,"true")}})(e,t,o);if(a)return{node:r,messageId:yo,...a}})},meta:{type:"suggestion",docs:{description:"Require passive event listeners for high-frequency events.",recommended:"unopinionated"},fixable:"code",messages:{[yo]:"Use `{passive: true}` for this high-frequency event listener."},languages:["js/js"]}},"unicorn/class-reference-in-static-methods":yN,"unicorn/consistent-optional-chaining":{create:e=>{e.on("LogicalExpression",t=>(function(e,t){let{left:r,operator:n,right:o}=e,a=yW(r),i=yW(o);if(!a||!i)return;let s=yV(a.object),l=yV(i.object);if(y_(s)&&y_(l)&&rv(s,l)){if("&&"===n&&i.optional)return{node:i,messageId:y$,...yz(i,t)&&{suggest:[{messageId:yO,fix:e=>yG(i,t,e)}]}};if("||"===n&&a.optional!==i.optional)return i.optional?{node:i,messageId:y$,...yz(i,t)&&{suggest:[{messageId:yO,fix:e=>yG(i,t,e)}]}}:{node:i,messageId:yM,...yz(i,t)&&{suggest:[{messageId:yU,fix:e=>yK({memberExpression:i,context:t,fixer:e,replacement:i.computed?"?.[":"?."})}]}}}})(t,e))},meta:{type:"suggestion",docs:{description:"Enforce consistent optional chaining for same-base member access.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[y$]:"Remove unnecessary optional chaining.",[yM]:"Use optional chaining consistently.",[yO]:"Remove optional chaining.",[yU]:"Use optional chaining."},languages:["js/js"]}},"unicorn/explicit-timer-delay":{create:e=>{let t=e.options[0],{sourceCode:r}=e;e.on("CallExpression",n=>{if(n.optional)return;let{isTimer:o,name:a}=((e,t)=>{let{callee:r}=e;if("Identifier"===r.type&&yQ.has(r.name)&&t.isGlobalReference(r))return{isTimer:!0,name:r.name};if("MemberExpression"===r.type&&!r.computed&&"Identifier"===r.property.type&&yQ.has(r.property.name)){let{object:e}=r;if("Identifier"===e.type&&yZ.has(e.name)&&t.isGlobalReference(e))return{isTimer:!0,name:r.property.name}}return{isTimer:!1}})(n,r);if(!o)return;let{arguments:i}=n,s=i.length>=2;if(t===yJ&&!s){if(0===i.length)return;let[t]=i;if(1===i.length&&t?.type==="SpreadElement")return;return{node:n,messageId:yY,data:{name:a},fix:r=>r.insertTextAfterRange(e9(t,e),", 0")}}if(t===yX&&2===i.length){let t=i[1];if(y0(t))return{node:t,messageId:yH,data:{name:a},fix(r){let[n]=i,[,o]=e9(n,e),[,a]=e9(t,e);return r.removeRange([o,a])}}}})},meta:{type:"suggestion",docs:{description:"Enforce or disallow explicit `delay` argument for `setTimeout()` and `setInterval()`.",recommended:"unopinionated"},fixable:"code",schema:[{enum:[yJ,yX],description:"Whether to always require an explicit `delay` argument, or disallow an explicit `0` delay."}],defaultOptions:[yJ],messages:{[yY]:"`{{name}}` should have an explicit delay argument.",[yH]:"`{{name}}` should not have an explicit delay of `0`."},languages:["js/js"]}},"unicorn/no-confusing-array-with":{create:e=>{e.on("CallExpression",e=>{var t,r,n,o;if(!tA(e,{method:"with",minimumArguments:1,optionalCall:!1,optionalMember:!1}))return;let{object:a}=e.callee,[i]=e.arguments,s=(t=i,r=a,0>Math.trunc(oH(t))?y1:(n=t,o=r,n=rI(n),o=rI(o),"MemberExpression"===n.type&&!n.optional&&!n.computed&&"Identifier"===n.property.type&&"length"===n.property.name&&uh(n.object,o))?y2:void 0);if(s)return{node:e.callee.property,messageId:s}})},meta:{type:"suggestion",docs:{description:"Disallow confusing uses of `Array#with()`.",recommended:!0},schema:[],messages:{[y1]:"Avoid using a negative index with `Array#with()`.",[y2]:"Avoid using `.length` as the index in `Array#with()`."},languages:["js/js"]}},"unicorn/no-duplicate-loops":{create:e=>{e.on("ForOfStatement",t=>{let r=mM(t.right);if(tA(r,{methods:y8,minimumArguments:1,optionalCall:!1,optionalMember:!1,computed:!1})&&!function e(t,r){let n,o,a,i;return n=t=mM(t),tA(n,{methods:mL,optionalCall:!1,optionalMember:!1,computed:!1})&&((e,t)=>{if("Identifier"===(e=mM(e)).type)return"Iterator"===e.name&&t.sourceCode.isGlobalReference(e);if("MemberExpression"!==e.type||e.optional||e.computed||"Identifier"!==e.property.type||"Iterator"!==e.property.name)return!1;let r=mM(e.object);return"Identifier"===r.type&&"globalThis"===r.name&&t.sourceCode.isGlobalReference(r)})(n.callee.object,r)||tA(o=t,{methods:mR,argumentsLength:0,optionalCall:!1,optionalMember:!1,computed:!1})||tA(o,{method:"matchAll",argumentsLength:1,optionalCall:!1,optionalMember:!1,computed:!1})||tA(a=t,{methods:mP,minimumArguments:1,optionalCall:!1,optionalMember:!1,computed:!1})&&e(a.callee.object,r)||!((e,t)=>{for(let r=t.sourceCode.getScope(e);r;r=r.upper)for(let e of mN)if(r.set.get(e)?.defs.length>0)return!0;return!1})(i=t,r)&&!nb(i,r)&&m$(i,r)}(r.callee.object,e))return{node:r.callee.property,messageId:y3,data:{loopKind:t.await?"for await…of":"for…of",method:r.callee.property.name}}})},meta:{type:"suggestion",docs:{description:"Disallow `.map()` and `.filter()` in `for…of` and `for await…of` loop headers.",recommended:!0},messages:{[y3]:"Do not use `.{{method}}()` directly in a `{{loopKind}}` loop header. It creates an intermediate array before the loop."},languages:["js/js"]}},"unicorn/no-declarations-before-early-exit":{create:e=>{let{sourceCode:t}=e,r=o4(e);e.onExit("Program",e=>he(t,e.body,r)),e.onExit("BlockStatement",e=>he(t,e.body,r))},meta:{type:"suggestion",docs:{description:"Disallow declarations before conditional early exits when they are only used after the exit.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[y6]:"Move this declaration after the early exit."},languages:["js/js"]}},"unicorn/no-optional-chaining-on-undeclared-variable":{create:e=>{let t=new l;e.on("ChainExpression",r=>{let n=function(e,t){let r=function e(t){return"MemberExpression"===(t=hn(t)).type?e(t.object)??(t.optional?t.object:void 0):"CallExpression"===t.type?e(t.callee)??(t.optional?t.callee:void 0):void 0}(e.expression);if(!r)return;let n=function(e){for(e=hn(e);"MemberExpression"===e.type;)e=hn(e.object);return"Identifier"===e.type?e:void 0}(r);if(n&&function(e,t){let r=t.sourceCode.getScope(e);for(;r;){let t=r.set.get(e.name);if(t&&(0===t.defs.length||t.defs.some(e=>!hr(e))))return!1;r=r.upper}return!0}(n,t))return n}(r,e);if(!(!n||t.has(n)))return t.add(n),{node:n,messageId:ht,data:{name:n.name}}})},meta:{type:"problem",docs:{description:"Disallow optional chaining on undeclared variables.",recommended:!0},schema:[],messages:{[ht]:"Optional chaining on undeclared variable `{{name}}` throws a ReferenceError."},languages:["js/js"]}},"unicorn/no-object-methods-with-collections":{create:e=>{e.on("CallExpression",t=>((e,t)=>{let r,{callee:n}=e;if(1!==e.arguments.length||e.optional||"MemberExpression"!==n.type||n.optional||n.computed||"Identifier"!==n.object.type||"Object"!==n.object.name||!om(n.object,t)||"Identifier"!==n.property.type||!hi.has(n.property.name))return;let[o]=e.arguments,a=o$(o,t);if(!a)return;let i=n.property.name,s=`${(r=e5(o,t),oQ(o,t)?`(${r})`:r)}.${i}()`,l={node:n.property,messageId:ho,data:{method:i,type:a}};return 0===t.sourceCode.getCommentsInside(e).length&&(l.suggest=[{messageId:ha,data:{replacement:s},fix:t=>t.replaceText(e,`Array.from(${s})`)}]),l})(t,e))},meta:{type:"problem",docs:{description:"Disallow `Object` methods with `Map` or `Set`.",recommended:!0},hasSuggestions:!0,messages:{[ho]:"`Object.{{method}}()` does not return {{type}} contents.",[ha]:"Use `Array.from({{replacement}})`."},languages:["js/js"]}},"unicorn/no-subtraction-comparison":{create:e=>{let{sourceCode:t}=e;e.on("BinaryExpression",r=>{let n,o;if(!hp.has(r.operator))return;if(e7(r.right,0)&&hd(r.left))n=r.left,o=r.operator;else{if(!(e7(r.left,0)&&hd(r.right)))return;n=r.right,o=hu[r.operator]}let a={node:r,messageId:hs};if(t.getCommentsInside(r).length>0)return a;let{left:i,right:s}=n,l=`${e5(i,e)} ${o} ${e5(s,e)}`,u=e=>e.replaceText(r,l),p=t.getScope(r);return(hc.has(o)?nW(i,p)&&nW(s,p):hm(i,p)&&hm(s,p))?a.fix=u:a.suggest=[{messageId:hl,data:{replacement:l},fix:u}],a})},meta:{type:"suggestion",docs:{description:"Prefer comparing values directly over subtracting and comparing to `0`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[hs]:"Prefer comparing the values directly over comparing the difference with `0`.",[hl]:"Replace with `{{replacement}}`."},languages:["js/js"]}},"unicorn/no-unnecessary-global-this":{create:e=>{e.on("MemberExpression",t=>{var r,n,o,a;let i,s,l=hy(t.object),u=hh(t);if("Identifier"!==l.type||"globalThis"!==l.name||!om(l,e)||nP(r=u)||("ForInStatement"===(i=r).parent.type||"ForOfStatement"===i.parent.type)&&i.parent.left===i||rX(n=t)||("MemberExpression"===(n=hh(n)).parent.type||"CallExpression"===n.parent.type)&&n.parent.optional&&(n.parent.object===n||n.parent.callee===n)||"LogicalExpression"===(o=hh(o=t)).parent.type||function(e){let{parent:t}=e;if("BinaryExpression"!==t.type||!hE.has(t.operator))return!1;let r=hy(t.left===e?t.right:t.left);return"Literal"===r.type&&null===r.value||"Identifier"===r.type&&"undefined"===r.name}(o)||tq(o)||tU(o,e))return;let p=t.computed?te(t.property)?t.property.value:"TemplateLiteral"===t.property.type&&0===t.property.expressions.length?t.property.quasis[0].value.cooked:void 0:t.property.name;if("string"!=typeof p||!(rj(p)&&(!hx.has(p)||"eval"===p||"arguments"===p))||"eval"===p&&hb(t)||(s=eg(e.sourceCode.getScope(t),p),s?.scope.type!=="global"||0!==s.defs.length))return;let c={node:t,messageId:hf,data:{name:p}};return hb(t)||"TaggedTemplateExpression"===(a=hh(a=t)).parent.type&&a.parent.tag===a||0!==e.sourceCode.getCommentsInside(t).length||(c.fix=e=>e.replaceText(t,p)),c})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary `globalThis` references.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[hf]:"Use `{{name}}` directly instead of `globalThis.{{name}}`."},languages:["js/js"]}},"unicorn/no-unreadable-object-destructuring":{create:e=>{e.on("Property",t=>{if("ObjectPattern"===t.parent.type&&t.computed&&!(null===eN(t.key,e.sourceCode.getScope(t.key))&&t.parent.properties.some(e=>"RestElement"===e.type)))return{node:t,messageId:hv}}),e.on("ArrayPattern",e=>{if(0!==hA(e))return{node:e,messageId:hC}}),e.on("ObjectPattern",e=>{if(3===hA(e))return{node:e,messageId:hD}}),e.on("MemberExpression",e=>{if(hT(e)?.type==="ObjectPattern")return{node:e,messageId:hS}})},meta:{type:"suggestion",docs:{description:"Disallow unreadable object destructuring.",recommended:"unopinionated"},schema:[],messages:{[hv]:"Do not use computed keys in object destructuring.",[hC]:"Do not use array destructuring inside object destructuring.",[hD]:"Do not use object destructuring deeper than two levels.",[hS]:"Do not assign destructured values to object properties."},languages:["js/js"]}},"unicorn/no-useless-else":{create:e=>{let{sourceCode:t}=e,r=o4(e,t=>(function e(t,r,n){let o;if(n(t)||"ExpressionStatement"===t.type&&(o=t.expression,tA(o,{object:"process",method:"exit",optionalCall:!1,optionalMember:!1})&&om(o.callee.object,r)))return!0;if("BlockStatement"===t.type){let o=t.body.at(-1);return!!(o&&e(o,r,n))}return"IfStatement"===t.type&&t.alternate&&e(t.consequent,r,n)&&e(t.alternate,r,n)})(t,e,r));e.onExit("IfStatement",n=>{if(!(n.alternate&&hk.has(n.parent.type)&&r(n.consequent)))return;let o=t.getTokenBefore(n.alternate);return{node:n.alternate,loc:t.getLoc(o),messageId:hw,fix:t=>{let{sourceCode:r}=e,{alternate:o,consequent:a}=n;if(rO(o)||"BlockStatement"===o.type&&((e,t)=>{let{sourceCode:r}=t;return r.getTokens(e).some(e=>("JSXText"!==e.type||"JSXText"!==r.getNodeByRangeIndex(r.getRange(e)[0]).type)&&r.getLoc(e).start.line!==r.getLoc(e).end.line)})(o,e)||!((e,t)=>{let{sourceCode:r}=t,{alternate:n,consequent:o}=e,a="BlockStatement"===n.type?r.getTokenAfter(r.getFirstToken(n)):r.getFirstToken(n);if(!a)return!0;let i=r.getLastToken(o);if("BlockStatement"!==o.type&&";"!==i.value&&(oC(i,t,a.value)||hF(a))||((e,t)=>{let r=t.getTokenAfter(e);if(r&&t.getLoc(e).end.line===t.getLoc(r).start.line)return!0;let n=t.getCommentsAfter(e)[0];return!!(n&&t.getLoc(e).end.line===t.getLoc(n).start.line)})(n,r))return!1;let s="BlockStatement"===n.type?r.getTokenBefore(r.getLastToken(n)):r.getLastToken(n),l=r.getTokenAfter(n);return!(s&&";"!==s.value&&l&&(oC(s,t,l.value)||hF(l)))})(n,e))return;let i=[r.getRange(a)[1],r.getRange(o)[1]];if(!rN(e,[i[0],r.getRange(o)[0]]))return t.replaceTextRange(i,((e,t)=>{let{alternate:r}=e;if("BlockStatement"===r.type)return((e,t,r)=>{let n=r.getFirstToken(e),o=r.getLastToken(e),a=r.text.slice(r.getRange(n)[1],r.getRange(o)[0]);if(!a.includes("\n")){let e=a.trim();return e?`
|
|
53
|
-
${
|
|
54
|
-
${i.map(e=>""===e.trim()?"":e.startsWith(u)?`${l}${e.slice(u.length)}`:`${l}${e.trimStart()}`).join("\n")}`})(r,e,t);let n=
|
|
55
|
-
${n}${t.getText(r)}`})(n,r))}}})},meta:{type:"suggestion",docs:{description:"Disallow `else` after a statement that exits.",recommended:!0},fixable:"code",messages:{[
|
|
52
|
+
${i}passive: true`)}};if(tr(n.value,!1))return{fix:e=>e.replaceText(n.value,"true")}})(e,t,o);if(a)return{node:r,messageId:ya,...a}})},meta:{type:"suggestion",docs:{description:"Require passive event listeners for high-frequency events.",recommended:"unopinionated"},fixable:"code",messages:{[ya]:"Use `{passive: true}` for this high-frequency event listener."},languages:["js/js"]}},"unicorn/class-reference-in-static-methods":y$,"unicorn/consistent-optional-chaining":{create:e=>{e.on("LogicalExpression",t=>(function(e,t){let{left:r,operator:n,right:o}=e,a=y_(r),i=y_(o);if(!a||!i)return;let s=yW(a.object),l=yW(i.object);if(yz(s)&&yz(l)&&rC(s,l)){if("&&"===n&&i.optional)return{node:i,messageId:yM,...yK(i,t)&&{suggest:[{messageId:yU,fix:e=>yJ(i,t,e)}]}};if("||"===n&&a.optional!==i.optional)return i.optional?{node:i,messageId:yM,...yK(i,t)&&{suggest:[{messageId:yU,fix:e=>yJ(i,t,e)}]}}:{node:i,messageId:yO,...yK(i,t)&&{suggest:[{messageId:yq,fix:e=>yG({memberExpression:i,context:t,fixer:e,replacement:i.computed?"?.[":"?."})}]}}}})(t,e))},meta:{type:"suggestion",docs:{description:"Enforce consistent optional chaining for same-base member access.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[yM]:"Remove unnecessary optional chaining.",[yO]:"Use optional chaining consistently.",[yU]:"Remove optional chaining.",[yq]:"Use optional chaining."},languages:["js/js"]}},"unicorn/explicit-timer-delay":{create:e=>{let t=e.options[0],{sourceCode:r}=e;e.on("CallExpression",n=>{if(n.optional)return;let{isTimer:o,name:a}=((e,t)=>{let{callee:r}=e;if("Identifier"===r.type&&yZ.has(r.name)&&t.isGlobalReference(r))return{isTimer:!0,name:r.name};if("MemberExpression"===r.type&&!r.computed&&"Identifier"===r.property.type&&yZ.has(r.property.name)){let{object:e}=r;if("Identifier"===e.type&&y0.has(e.name)&&t.isGlobalReference(e))return{isTimer:!0,name:r.property.name}}return{isTimer:!1}})(n,r);if(!o)return;let{arguments:i}=n,s=i.length>=2;if(t===yX&&!s){if(0===i.length)return;let[t]=i;if(1===i.length&&t?.type==="SpreadElement")return;return{node:n,messageId:yH,data:{name:a},fix:r=>r.insertTextAfterRange(e5(t,e),", 0")}}if(t===yY&&2===i.length){let t=i[1];if(y1(t))return{node:t,messageId:yQ,data:{name:a},fix(r){let[n]=i,[,o]=e5(n,e),[,a]=e5(t,e);return r.removeRange([o,a])}}}})},meta:{type:"suggestion",docs:{description:"Enforce or disallow explicit `delay` argument for `setTimeout()` and `setInterval()`.",recommended:"unopinionated"},fixable:"code",schema:[{enum:[yX,yY],description:"Whether to always require an explicit `delay` argument, or disallow an explicit `0` delay."}],defaultOptions:[yX],messages:{[yH]:"`{{name}}` should have an explicit delay argument.",[yQ]:"`{{name}}` should not have an explicit delay of `0`."},languages:["js/js"]}},"unicorn/no-confusing-array-with":{create:e=>{e.on("CallExpression",e=>{var t,r,n,o;if(!tw(e,{method:"with",minimumArguments:1,optionalCall:!1,optionalMember:!1}))return;let{object:a}=e.callee,[i]=e.arguments,s=(t=i,r=a,0>Math.trunc(oQ(t))?y2:(n=t,o=r,n=rj(n),o=rj(o),"MemberExpression"===n.type&&!n.optional&&!n.computed&&"Identifier"===n.property.type&&"length"===n.property.name&&ux(n.object,o))?y3:void 0);if(s)return{node:e.callee.property,messageId:s}})},meta:{type:"suggestion",docs:{description:"Disallow confusing uses of `Array#with()`.",recommended:!0},schema:[],messages:{[y2]:"Avoid using a negative index with `Array#with()`.",[y3]:"Avoid using `.length` as the index in `Array#with()`."},languages:["js/js"]}},"unicorn/no-duplicate-loops":{create:e=>{e.on("ForOfStatement",t=>{let r=mO(t.right);if(tw(r,{methods:y6,minimumArguments:1,optionalCall:!1,optionalMember:!1,computed:!1})&&!function e(t,r){let n,o,a,i;return n=t=mO(t),tw(n,{methods:mN,optionalCall:!1,optionalMember:!1,computed:!1})&&((e,t)=>{if("Identifier"===(e=mO(e)).type)return"Iterator"===e.name&&t.sourceCode.isGlobalReference(e);if("MemberExpression"!==e.type||e.optional||e.computed||"Identifier"!==e.property.type||"Iterator"!==e.property.name)return!1;let r=mO(e.object);return"Identifier"===r.type&&"globalThis"===r.name&&t.sourceCode.isGlobalReference(r)})(n.callee.object,r)||tw(o=t,{methods:mP,argumentsLength:0,optionalCall:!1,optionalMember:!1,computed:!1})||tw(o,{method:"matchAll",argumentsLength:1,optionalCall:!1,optionalMember:!1,computed:!1})||tw(a=t,{methods:mL,minimumArguments:1,optionalCall:!1,optionalMember:!1,computed:!1})&&e(a.callee.object,r)||!((e,t)=>{for(let r=t.sourceCode.getScope(e);r;r=r.upper)for(let e of m$)if(r.set.get(e)?.defs.length>0)return!0;return!1})(i=t,r)&&!nE(i,r)&&mM(i,r)}(r.callee.object,e))return{node:r.callee.property,messageId:y8,data:{loopKind:t.await?"for await…of":"for…of",method:r.callee.property.name}}})},meta:{type:"suggestion",docs:{description:"Disallow `.map()` and `.filter()` in `for…of` and `for await…of` loop headers.",recommended:!0},messages:{[y8]:"Do not use `.{{method}}()` directly in a `{{loopKind}}` loop header. It creates an intermediate array before the loop."},languages:["js/js"]}},"unicorn/no-declarations-before-early-exit":{create:e=>{let{sourceCode:t}=e,r=o7(e);e.onExit("Program",e=>ht(t,e.body,r)),e.onExit("BlockStatement",e=>ht(t,e.body,r))},meta:{type:"suggestion",docs:{description:"Disallow declarations before conditional early exits when they are only used after the exit.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[y9]:"Move this declaration after the early exit."},languages:["js/js"]}},"unicorn/no-optional-chaining-on-undeclared-variable":{create:e=>{let t=new l;e.on("ChainExpression",r=>{let n=function(e,t){let r=function e(t){return"MemberExpression"===(t=ho(t)).type?e(t.object)??(t.optional?t.object:void 0):"CallExpression"===t.type?e(t.callee)??(t.optional?t.callee:void 0):void 0}(e.expression);if(!r)return;let n=function(e){for(e=ho(e);"MemberExpression"===e.type;)e=ho(e.object);return"Identifier"===e.type?e:void 0}(r);if(n&&function(e,t){let r=t.sourceCode.getScope(e);for(;r;){let t=r.set.get(e.name);if(t&&(0===t.defs.length||t.defs.some(e=>!hn(e))))return!1;r=r.upper}return!0}(n,t))return n}(r,e);if(!(!n||t.has(n)))return t.add(n),{node:n,messageId:hr,data:{name:n.name}}})},meta:{type:"problem",docs:{description:"Disallow optional chaining on undeclared variables.",recommended:!0},schema:[],messages:{[hr]:"Optional chaining on undeclared variable `{{name}}` throws a ReferenceError."},languages:["js/js"]}},"unicorn/no-object-methods-with-collections":{create:e=>{e.on("CallExpression",t=>((e,t)=>{let r,{callee:n}=e;if(1!==e.arguments.length||e.optional||"MemberExpression"!==n.type||n.optional||n.computed||"Identifier"!==n.object.type||"Object"!==n.object.name||!of(n.object,t)||"Identifier"!==n.property.type||!hs.has(n.property.name))return;let[o]=e.arguments,a=oM(o,t);if(!a)return;let i=n.property.name,s=`${(r=e4(o,t),oZ(o,t)?`(${r})`:r)}.${i}()`,l={node:n.property,messageId:ha,data:{method:i,type:a}};return 0===t.sourceCode.getCommentsInside(e).length&&(l.suggest=[{messageId:hi,data:{replacement:s},fix:t=>t.replaceText(e,`Array.from(${s})`)}]),l})(t,e))},meta:{type:"problem",docs:{description:"Disallow `Object` methods with `Map` or `Set`.",recommended:!0},hasSuggestions:!0,messages:{[ha]:"`Object.{{method}}()` does not return {{type}} contents.",[hi]:"Use `Array.from({{replacement}})`."},languages:["js/js"]}},"unicorn/no-subtraction-comparison":{create:e=>{let{sourceCode:t}=e;e.on("BinaryExpression",r=>{let n,o;if(!hc.has(r.operator))return;if(te(r.right,0)&&hm(r.left))n=r.left,o=r.operator;else{if(!(te(r.left,0)&&hm(r.right)))return;n=r.right,o=hp[r.operator]}let a={node:r,messageId:hl};if(t.getCommentsInside(r).length>0)return a;let{left:i,right:s}=n,l=`${e4(i,e)} ${o} ${e4(s,e)}`,u=e=>e.replaceText(r,l),p=t.getScope(r);return(hd.has(o)?n_(i,p)&&n_(s,p):hf(i,p)&&hf(s,p))?a.fix=u:a.suggest=[{messageId:hu,data:{replacement:l},fix:u}],a})},meta:{type:"suggestion",docs:{description:"Prefer comparing values directly over subtracting and comparing to `0`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[hl]:"Prefer comparing the values directly over comparing the difference with `0`.",[hu]:"Replace with `{{replacement}}`."},languages:["js/js"]}},"unicorn/no-unnecessary-global-this":{create:e=>{e.on("MemberExpression",t=>{var r,n,o,a;let i,s,l=hh(t.object),u=hx(t);if("Identifier"!==l.type||"globalThis"!==l.name||!of(l,e)||nL(r=u)||("ForInStatement"===(i=r).parent.type||"ForOfStatement"===i.parent.type)&&i.parent.left===i||rY(n=t)||("MemberExpression"===(n=hx(n)).parent.type||"CallExpression"===n.parent.type)&&n.parent.optional&&(n.parent.object===n||n.parent.callee===n)||"LogicalExpression"===(o=hx(o=t)).parent.type||function(e){let{parent:t}=e;if("BinaryExpression"!==t.type||!hv.has(t.operator))return!1;let r=hh(t.left===e?t.right:t.left);return"Literal"===r.type&&null===r.value||"Identifier"===r.type&&"undefined"===r.name}(o)||tV(o)||tq(o,e))return;let p=t.computed?tt(t.property)?t.property.value:"TemplateLiteral"===t.property.type&&0===t.property.expressions.length?t.property.quasis[0].value.cooked:void 0:t.property.name;if("string"!=typeof p||!(rF(p)&&(!hb.has(p)||"eval"===p||"arguments"===p))||"eval"===p&&hE(t)||(s=ey(e.sourceCode.getScope(t),p),s?.scope.type!=="global"||0!==s.defs.length))return;let c={node:t,messageId:hg,data:{name:p}};return hE(t)||"TaggedTemplateExpression"===(a=hx(a=t)).parent.type&&a.parent.tag===a||0!==e.sourceCode.getCommentsInside(t).length||(c.fix=e=>e.replaceText(t,p)),c})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary `globalThis` references.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[hg]:"Use `{{name}}` directly instead of `globalThis.{{name}}`."},languages:["js/js"]}},"unicorn/no-unreadable-object-destructuring":{create:e=>{e.on("Property",t=>{if("ObjectPattern"===t.parent.type&&t.computed&&!(null===e$(t.key,e.sourceCode.getScope(t.key))&&t.parent.properties.some(e=>"RestElement"===e.type)))return{node:t,messageId:hC}}),e.on("ArrayPattern",e=>{if(0!==hw(e))return{node:e,messageId:hD}}),e.on("ObjectPattern",e=>{if(3===hw(e))return{node:e,messageId:hS}}),e.on("MemberExpression",e=>{if(hA(e)?.type==="ObjectPattern")return{node:e,messageId:hT}})},meta:{type:"suggestion",docs:{description:"Disallow unreadable object destructuring.",recommended:"unopinionated"},schema:[],messages:{[hC]:"Do not use computed keys in object destructuring.",[hD]:"Do not use array destructuring inside object destructuring.",[hS]:"Do not use object destructuring deeper than two levels.",[hT]:"Do not assign destructured values to object properties."},languages:["js/js"]}},"unicorn/no-useless-else":{create:e=>{let{sourceCode:t}=e,r=o7(e,t=>(function e(t,r,n){let o;if(n(t)||"ExpressionStatement"===t.type&&(o=t.expression,tw(o,{object:"process",method:"exit",optionalCall:!1,optionalMember:!1})&&of(o.callee.object,r)))return!0;if("BlockStatement"===t.type){let o=t.body.at(-1);return!!(o&&e(o,r,n))}return"IfStatement"===t.type&&t.alternate&&e(t.consequent,r,n)&&e(t.alternate,r,n)})(t,e,r));e.onExit("IfStatement",n=>{if(!(n.alternate&&hI.has(n.parent.type)&&r(n.consequent)))return;let o=t.getTokenBefore(n.alternate);return{node:n.alternate,loc:t.getLoc(o),messageId:hk,fix:t=>{let{sourceCode:r}=e,{alternate:o,consequent:a}=n;if(rU(o)||"BlockStatement"===o.type&&((e,t)=>{let{sourceCode:r}=t;return r.getTokens(e).some(e=>("JSXText"!==e.type||"JSXText"!==r.getNodeByRangeIndex(r.getRange(e)[0]).type)&&r.getLoc(e).start.line!==r.getLoc(e).end.line)})(o,e)||!((e,t)=>{let{sourceCode:r}=t,{alternate:n,consequent:o}=e,a="BlockStatement"===n.type?r.getTokenAfter(r.getFirstToken(n)):r.getFirstToken(n);if(!a)return!0;let i=r.getLastToken(o);if("BlockStatement"!==o.type&&";"!==i.value&&(oD(i,t,a.value)||hB(a))||((e,t)=>{let r=t.getTokenAfter(e);if(r&&t.getLoc(e).end.line===t.getLoc(r).start.line)return!0;let n=t.getCommentsAfter(e)[0];return!!(n&&t.getLoc(e).end.line===t.getLoc(n).start.line)})(n,r))return!1;let s="BlockStatement"===n.type?r.getTokenBefore(r.getLastToken(n)):r.getLastToken(n),l=r.getTokenAfter(n);return!(s&&";"!==s.value&&l&&(oD(s,t,l.value)||hB(l)))})(n,e))return;let i=[r.getRange(a)[1],r.getRange(o)[1]];if(!r$(e,[i[0],r.getRange(o)[0]]))return t.replaceTextRange(i,((e,t)=>{let{alternate:r}=e;if("BlockStatement"===r.type)return((e,t,r)=>{let n=r.getFirstToken(e),o=r.getLastToken(e),a=r.text.slice(r.getRange(n)[1],r.getRange(o)[0]);if(!a.includes("\n")){let e=a.trim();return e?`
|
|
53
|
+
${hF(r,r.getRange(t)[0])}${e}`:""}let i=a.split("\n");if(i[0]?.trim()===""&&i.shift(),i.at(-1)?.trim()===""&&i.pop(),0===i.length)return"";let s=r.getTokenAfter(n,{includeComments:!0}),l=hF(r,r.getRange(t)[0]),u=s&&s!==o?hF(r,r.getRange(s)[0]):l;return`
|
|
54
|
+
${i.map(e=>""===e.trim()?"":e.startsWith(u)?`${l}${e.slice(u.length)}`:`${l}${e.trimStart()}`).join("\n")}`})(r,e,t);let n=hF(t,t.getRange(e)[0]);return`
|
|
55
|
+
${n}${t.getText(r)}`})(n,r))}}})},meta:{type:"suggestion",docs:{description:"Disallow `else` after a statement that exits.",recommended:!0},fixable:"code",messages:{[hk]:"Unexpected `else` after a statement that exits."},languages:["js/js"]}},"unicorn/no-useless-recursion":{create:e=>{let{sourceCode:t}=e;e.on("ReturnStatement",e=>{if(((e,t)=>{var r;let n,{argument:o}=e;if(o?.type!=="CallExpression"||o.optional||"Identifier"!==o.callee.type)return!1;let a=(e=>{for(;e;e=e.parent)if(tv(e))return e})(e);return!!(a?.id&&!a.generator&&!((e,t)=>{for(;e&&e!==t;e=e.parent)if("TryStatement"===e.type)return!0;return!1})(e,a)&&!((e,t)=>{for(;e&&e!==t;e=e.parent){if(hN(e))return!0;if(e.parent?.type!=="BlockStatement")continue;let t=e.parent.body.indexOf(e);if(e.parent.body.slice(0,t).some(e=>hL(e)))return!0}return!1})(e,a)&&o.callee.name===a.id.name&&(r=o.callee,n=ey(t.getScope(r),r),n?.identifiers.includes(a.id)))})(e,t))return{node:e.argument.callee,messageId:hR}})},meta:{type:"suggestion",docs:{description:"Disallow simple recursive function calls that can be replaced with a loop.",recommended:!0},messages:{[hR]:"Use a loop instead of this recursive function call."},languages:["js/js"]}},"unicorn/prefer-add-event-listener-options":{create:e=>{e.on("CallExpression",e=>{if(!tw(e,{method:"addEventListener",argumentsLength:3,optionalCall:!1,optionalMember:!1}))return;let t=e.arguments[2];if(!tr(t))return;let r=`{capture: ${t.value}}`;return{node:t,messageId:h$,data:{value:String(t.value),replacement:r},fix:e=>e.replaceText(t,r)}})},meta:{type:"suggestion",docs:{description:"Prefer an options object over a boolean in `.addEventListener()`.",recommended:"unopinionated"},fixable:"code",messages:{[h$]:"Prefer `{{replacement}}` over `{{value}}`."},languages:["js/js"]}},"unicorn/prefer-direct-iteration":{create:e=>{e.on("CallExpression",t=>{if(!tw(t,{methods:["entries","keys","values"],argumentsLength:0,optionalCall:!1,optionalMember:!1})||!(e=>{let{parent:t}=e;if("ForOfStatement"===t.type&&t.right===e||"YieldExpression"===t.type&&t.delegate&&t.argument===e||"SpreadElement"===t.type&&t.argument===e&&(e=>{let{parent:t}=e;return hG.has(t.type)})(t))return!0;if("NewExpression"===t.type)return 1===t.arguments.length&&t.arguments[0]===e&&(tf(t,{names:hz,argumentsLength:1})||tf(t,{names:rZ,argumentsLength:1}));if("CallExpression"===t.type)return t.arguments[0]===e&&(tw(t,{object:"Array",method:"from",minimumArguments:1,optionalCall:!1,optionalMember:!1})||hX(t,["from"])||tw(t,{object:"Object",method:"fromEntries",minimumArguments:1,optionalCall:!1,optionalMember:!1})||tw(t,{object:"Promise",methods:hK,argumentsLength:1,optionalCall:!1,optionalMember:!1}));return!1})(t))return;let r=t.callee.property.name;if(((e,t)=>{if(!t?.size)return!1;for(let r of t){let t=h_.get(r);if(!t?.includes(e))return!1}return!0})(r,h0(t.callee.object,e)))return{node:t.callee.property,messageId:hM,data:{method:r},fix:((e,t)=>{if(!(t.sourceCode.getCommentsInside(e).length>0))return r=>aM(r,e,t)})(t,e)}})},meta:{type:"suggestion",docs:{description:"Prefer direct iteration over default iterator method calls.",recommended:"unopinionated"},fixable:"code",messages:{[hM]:"Prefer direct iteration instead of `.{{method}}()`."},languages:["js/js"]}},"unicorn/prefer-number-is-safe-integer":{create:e=>{let{sourceCode:t}=e,r=(e,r)=>{let n,o={node:e,messageId:h3};return n=t.getRange(r),t.getCommentsInside(e).some(e=>{let r=t.getRange(e);return r[0]<n[0]||r[1]>n[1]})||(o.suggest=[{messageId:h8,fix:n=>{let o;return n.replaceText(e,`Number.isSafeInteger(${(o=t.getText(r),"SequenceExpression"===r.type?`(${o})`:o)})`)}}]),o};e.on("CallExpression",e=>{if(tw(e,{object:"Number",method:"isInteger",optionalCall:!1,optionalMember:!1,computed:!1})&&t.isGlobalReference(e.callee.object))return{node:e.callee.property,messageId:h1,suggest:[{messageId:h2,fix:t=>t.replaceText(e.callee.property,"isSafeInteger")}]};let n=(e=>{if(tw(e,{objects:h6,methods:["isInteger","isSafeInteger"],argumentsLength:1,optionalCall:!1,optionalMember:!1,computed:!1}))return e.arguments[0]})(e);if(n&&h5(e,t))return r(e,n)}),e.on("BinaryExpression",e=>{let n=(e=>{if("==="===e.operator){if(te(e.right,0))return h4(e.left);if(te(e.left,0))return h4(e.right)}})(e)??((e,t)=>{if("==="!==e.operator)return;let r=h7(e.left,t);if(r&&rC(r,e.right))return r;let n=h7(e.right,t);if(n&&rC(n,e.left))return n})(e,t);if(n&&h5(e,t))return r(e,n)})},meta:{type:"suggestion",docs:{description:"Prefer `Number.isSafeInteger()` over integer checks.",recommended:!0},hasSuggestions:!0,messages:{[h1]:"Prefer `Number.isSafeInteger()` over `Number.isInteger()`.",[h2]:"Replace `Number.isInteger()` with `Number.isSafeInteger()`.",[h3]:"Prefer `Number.isSafeInteger()` over this integer check.",[h8]:"Replace this integer check with `Number.isSafeInteger()`."},languages:["js/js"]}},"unicorn/prefer-object-define-properties":{create:e=>{let{sourceCode:t}=e;e.on("ExpressionStatement",r=>{let n=xt(r);if(!n)return;let o=xt(at(r,e));if(o&&rC(o.arguments[0],n.arguments[0]))return;let a=[r],s=[n],l=ar(r,e);for(;;){let t=xt(l);if(!t||!rC(n.arguments[0],t.arguments[0]))break;a.push(l),s.push(t),l=ar(l,e)}if(s.length<2)return;let u={node:n.callee.property,messageId:xe},p=[t.getRange(a[0])[0],t.getRange(a.at(-1))[1]];return function(e,t){let r=new i,n=[];for(let o of e){let e=o.arguments[1],a=function(e,t){let r=e$(e,t.getScope(e));if(r)return"symbol"==typeof r.value?r.value:String(r.value)}(e,t);if(void 0===a){if(n.some(t=>rC(t,e)))return!0;n.push(e);continue}if(r.has(a))return!0;r.add(a)}return!1}(s,t)||t.getAllComments().some(e=>{let[r,n]=t.getRange(e);return r>=p[0]&&n<=p[1]})||(u.fix=function(e,t,r){let{sourceCode:n}=r,o=e[0],a=e.at(-1),i=rw(o,r),s=`${i} `,l=n.getText(t[0].arguments[0]),u=t.map(e=>{let t=function(e,t){let r=t.getText(e);if("Literal"===e.type){if("string"==typeof e.value)return"__proto__"===e.value?`[${r}]`:rF(e.value)?e.value:r;if("number"==typeof e.value)return r}return`[${r}]`}(e.arguments[1],n),r=n.getText(e.arguments[2]).replaceAll("\n","\n ");return`${s}${t}: ${r},`}).join("\n");return e=>e.replaceTextRange([n.getRange(o)[0],n.getRange(a)[1]],`Object.defineProperties(${l}, {
|
|
56
56
|
${u}
|
|
57
|
-
${i}});`)}(a,s,e)),u})},meta:{type:"suggestion",docs:{description:"Prefer `Object.defineProperties()` over multiple `Object.defineProperty()` calls.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[h7]:"Prefer `Object.defineProperties()` over multiple `Object.defineProperty()` calls."},languages:["js/js"]}},"unicorn/prefer-object-destructuring-defaults":{create:e=>{e.on("VariableDeclarator",t=>{let{id:r,init:n}=t;if("ObjectPattern"!==r.type||n?.type!=="ObjectExpression"||0!==e.sourceCode.getCommentsInside(t).length)return;let a=((e,t)=>{if(e.typeAnnotation)return;let r=[];for(let n of e.properties){if(!(xa(n)&&"Identifier"===n.value.type))return;let e=eM(n,t.sourceCode.getScope(n));if(null===e||xn.has(e))return;r.push({node:n,name:e})}return r})(r,e),s=((e,t)=>{let{properties:r}=e,n=r.at(-1);if(n?.type!=="SpreadElement"||e_(n.argument,t.sourceCode,xo))return;let a=new o;for(let e of r.slice(0,-1)){if(!xa(e)||e_(e.value,t.sourceCode,xo))return;let r=eM(e,t.sourceCode.getScope(e));if(null===r||a.has(r))return;a.set(r,e)}return{defaultProperties:a,spreadElement:n}})(n,e);if(!a||0===a.length||!s)return;let{defaultProperties:l,spreadElement:u}=s;if(a.length!==l.size)return;let p=new i(a.map(e=>e.node.value.name)),c=[];for(let t of a){let r=l.get(t.name);if(!r||xi(r.value,p,e))return;c.push(xs(t,r,e))}return{node:t,messageId:xt,suggest:[{messageId:xr,fix:r=>r.replaceText(t,`{${c.join(", ")}} = {${e.sourceCode.getText(u)}}`)}]}})},meta:{type:"suggestion",docs:{description:"Prefer object destructuring defaults over default object literals with spread.",recommended:!0},hasSuggestions:!0,schema:[],messages:{[xt]:"Prefer object destructuring defaults over default object literals with spread.",[xr]:"Use object destructuring defaults."},languages:["js/js"]}},"unicorn/prefer-single-object-destructuring":{create:e=>{let{sourceCode:t}=e;e.on("Program",e=>xc(t,e.body)),e.on(["BlockStatement","StaticBlock"],e=>xc(t,e.body)),e.on("SwitchCase",e=>xc(t,e.consequent))},meta:{type:"suggestion",docs:{description:"Prefer a single object destructuring declaration per local const source.",recommended:!0},fixable:"code",schema:[],messages:{[xl]:"Prefer a single object destructuring declaration from `{{source}}`."},languages:["js/js"]}},"unicorn/prefer-smaller-scope":{create:e=>{let{sourceCode:t}=e;e.on("VariableDeclaration",e=>(function(e,t){if(!(e.parent&&("Program"===e.parent.type||"BlockStatement"===e.parent.type)&&"let"===e.kind&&1===e.declarations.length&&"Identifier"===e.declarations[0].id.type&&!e.declarations[0].init))return;let[r]=e.declarations,[n]=t.getDeclaredVariables(r),o=n.references.filter(e=>!e.init),a=o.filter(e=>e.isWrite());if(1!==a.length||o.every(e=>!e.isRead()))return;let i=function(e){let{identifier:t}=e,r=t.parent;if("AssignmentExpression"!==r.type||"="!==r.operator||r.left!==t||"ExpressionStatement"!==r.parent.type)return;let n=r.parent,o=n.parent;if("BlockStatement"===o.type)return{assignmentExpression:r,assignmentStatement:n,block:o}}(a[0]);if(!i)return;let{assignmentExpression:s,assignmentStatement:l,block:u}=i,[,p]=t.getRange(e),[c,d]=t.getRange(l);if(!xf(u,e.parent)||function e(t,r){if("WithStatement"===t.type||"CallExpression"===t.type&&"Identifier"===t.callee.type&&"eval"===t.callee.name)return!0;for(let n of r[t.type]??[]){let o=t[n];if(Array.isArray(o)){if(o.some(t=>t&&e(t,r)))return!0}else if(o&&e(o,r))return!0}return!1}(e.parent,t.visitorKeys)||c<p||o.some(e=>!xf(e.identifier,u))||o.some(e=>e.isRead()&&t.getRange(e.identifier)[0]<d))return;let m={node:r.id,messageId:xd,data:{name:r.id.name}};return r.id.typeAnnotation||xy(t,s)&&"SequenceExpression"===s.right.type||t.getCommentsInside(e).length>0||t.getCommentsInside(l).length>0||xg(t,e,"before")||xg(t,e,"after")||xg(t,l,"before")||xg(t,l,"after")||(m.fix=function({sourceCode:e,declaration:t,assignmentExpression:r,assignmentStatement:n,name:o}){return function*(a){yield aM(t,{sourceCode:e},a);let i=`const ${o} = `;if(xy(e,r))return void(yield a.replaceText(n,`${i}${e.getText(r.right)};`));let[s]=e.getRange(r),[l]=e.getRange(r.right);yield a.replaceTextRange([s,l],i)}}({sourceCode:t,declaration:e,assignmentExpression:s,assignmentStatement:l,name:r.id.name})),m})(e,t))},meta:{type:"suggestion",docs:{description:"Prefer declaring variables in the smallest possible scope.",recommended:!0},fixable:"code",schema:[],messages:{[xd]:"Move `{{name}}` into the block where it is used."},languages:["js/js"]}},"unicorn/prefer-single-array-predicate":{create:e=>{e.on("LogicalExpression",t=>{if("LogicalExpression"===t.parent.type&&t.parent.operator===t.operator)return;let r=xb.get(t.operator);if(!r||e.sourceCode.getCommentsInside(t).length>0)return;let n=(function e(t,r){return"LogicalExpression"!==t.type||t.operator!==r?[t]:[...e(t.left,r),...e(t.right,r)]})(t,t.operator).map(t=>(function(e,t,r){if(!tA(e,{method:t,argumentsLength:1,optionalCall:!1,optionalMember:!1})||e.typeArguments||e.typeParameters)return;let{object:n}=e.callee;if(nE(n,r))return;let o=function(e){if("ArrowFunctionExpression"===e.type&&!e.async&&!e.returnType&&!e.typeParameters&&1===e.params.length&&"Identifier"===e.params[0].type&&"BlockStatement"!==e.body.type)return{parameter:e.params[0],body:e.body}}(e.arguments[0]);if(o){var a;let t;return{node:e,object:n,callback:{...o,parameterText:(a=o.parameter,t=r.sourceCode.getText(a),a.typeAnnotation||a.optional?`(${t})`:t)}}}})(t,r,e));if(!(n.length<2||n.includes(void 0)||n.some(e=>{let t;return t=n[0],!rv(t.object,e.object)||t.callback.parameterText!==e.callback.parameterText})))return{node:t,messageId:xh,data:{method:r},suggest:[{messageId:xx,data:{method:r},fix:r=>r.replaceText(t,function(e,t,r){let{sourceCode:n}=r,[o]=e,{callback:a}=o,i=e.map(({callback:e})=>(function(e,t,r){var n,o;if(e4(e,r))return e5(e,r);let a=r.sourceCode.getText(e);return(n=e,o=t,"LogicalExpression"===n.type?n.operator!==o&&("||"!==o||"&&"!==n.operator):xE.has(n.type))?`(${a})`:a})(e.body,t,r)).join(` ${t} `);return`${n.getText(o.node.callee)}(${a.parameterText} => ${i})`}(n,t.operator,e))}]}})},meta:{type:"suggestion",docs:{description:"Prefer a single `Array#some()` or `Array#every()` with a combined predicate.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[xh]:"Prefer a single `Array#{{method}}()` with a combined predicate.",[xx]:"Merge predicates into one `Array#{{method}}()` call."},languages:["js/js"]}},"unicorn/prefer-url-href":{create:e=>{e.on("CallExpression",t=>{if(tA(t,{method:"toString",argumentsLength:0,optionalCall:!1,optionalMember:!1,computed:!1})&&"url"===xO(t.callee.object,e)){let r={node:t.callee.property,messageId:xv};return xq(t,e)&&!e4(t.callee,e)&&xU(t.callee.object,e)&&(r.fix=r=>r.replaceTextRange([e.sourceCode.getRange(t.callee.property)[0],e.sourceCode.getRange(t)[1]],"href")),r}if(!(td(t,{name:"String",argumentsLength:1,optional:!1},tu)&&om(t.callee,e)))return;let[r]=t.arguments;if("url"!==xO(r,e))return;let n={node:t.callee,messageId:xv};return xq(t,e)&&xU(r,e)&&(n.fix=n=>{let o,a,i;return n.replaceText(t,(o=e5(r,e),a=!e4(r,e)&&oQ(r,e)?`(${o})`:o,i=`${a}.href`,(oC(e.sourceCode.getTokenBefore(r.parent),e,i)?";":"")+i))}),n})},meta:{type:"suggestion",docs:{description:"Prefer `URL#href` over stringifying a `URL`.",recommended:"unopinionated"},fixable:"code",messages:{[xv]:"Prefer `URL#href` over stringifying a `URL`."},languages:["js/js"]}},"unicorn/require-proxy-trap-boolean-return":{create:e=>{let{sourceCode:t}=e,r=new s,n=[];function*o(e){let n;if(!(tm(n=e,{name:"Proxy",argumentsLength:2})||tA(n,{object:"Proxy",method:"revocable",argumentsLength:2,optionalCall:!1,optionalMember:!1,computed:!1})))return;let o=e.arguments[1];if("ObjectExpression"===o.type)for(let e of o.properties){let n=xY(e,t);if(!n)continue;let o=xH(n,t,r);o&&(yield o)}}e.on("onCodePathStart",()=>{n.push(new i)}),e.on("onCodePathEnd",()=>{n.pop()}),e.on("onCodePathSegmentStart",e=>{n.at(-1).add(e)}),e.on("onCodePathSegmentEnd",e=>{n.at(-1).delete(e)}),e.on("onUnreachableCodePathSegmentStart",e=>{n.at(-1).add(e)}),e.on("onUnreachableCodePathSegmentEnd",e=>{n.at(-1).delete(e)}),e.onExit("BlockStatement",e=>{if(!(x_.has(e.parent?.type)&&e.parent.body===e))return;let t=[...n.at(-1)].every(e=>!e.reachable);r.set(e.parent,t)}),e.onExit("CallExpression",o),e.onExit("NewExpression",o)},meta:{type:"problem",docs:{description:"Require boolean-returning Proxy traps to return booleans.",recommended:"unopinionated"},fixable:"code",messages:{[xV]:"Proxy trap `{{name}}` should return a boolean."},languages:["js/js"]}},"unicorn/logical-assignment-operators":x3,"unicorn/no-useless-coercion":{create:e=>{let{sourceCode:t}=e,r=(r,n,o,a)=>({node:r,messageId:x8,data:{description:o,type:a},*fix(o,{abort:a}){if(t.getCommentsInside(r).length>0)return a();yield ak(o,r,n,e)}});e.on("CallExpression",t=>{if(t.optional||"Identifier"!==t.callee.type||1!==t.arguments.length||"SpreadElement"===t.arguments[0].type)return;let{name:n}=t.callee,o=x6.get(n);if(!o||!om(t.callee,e))return;let[a]=t.arguments;if(o.isType(a,e))return r(t,a,`\`${n}()\``,o.type)}),e.on("UnaryExpression",e=>{if("+"===e.operator&&nW(e.argument,t.getScope(e.argument)))return r(e,e.argument,"`+`","number")}),e.on("BinaryExpression",t=>{let n;if("+"!==t.operator)return;let{left:o,right:a}=t;if(e7(a,"")&&or(o,e))n=o;else{if(!(e7(o,"")&&or(a,e)))return;n=a}return r(t,n,"Concatenation with `''`","string")}),e.on("CallExpression",t=>{let{callee:n}=t;if(!t.optional&&!(t.arguments.length>0)&&"MemberExpression"===n.type&&!n.optional&&!n.computed&&"Identifier"===n.property.type&&"toString"===n.property.name&&or(n.object,e))return r(t,n.object,"`.toString()`","string")})},meta:{type:"suggestion",docs:{description:"Disallow useless type coercions of values that are already of the target type.",recommended:"unopinionated"},fixable:"code",messages:{[x8]:"{{description}} is unnecessary because the value is already a {{type}}."},languages:["js/js"]}},"unicorn/no-useless-boolean-cast":{create:e=>{let{sourceCode:t}=e;e.on("CallExpression",r=>{if(!tA(r,{methods:x5,minimumArguments:1,maximumArguments:2,optionalCall:!1,optionalMember:!1}))return;let[n]=r.arguments;if(!tE(n))return;let o=function(e){if(!e.async&&!e.generator&&!e.returnType){if("ArrowFunctionExpression"===e.type&&"BlockStatement"!==e.body.type)return e.body;if("BlockStatement"===e.body.type&&1===e.body.body.length&&"ReturnStatement"===e.body.body[0].type)return e.body.body[0].argument}}(n);if(!tO(o,e)||t.getCommentsInside(o).length>0)return;let[a]=o.arguments;if(!(n.params[0]?.type==="Identifier"&&od(n.params[0],a))&&!(function e(t){return(t=rI(t),t?.type==="ChainExpression")?rX(t):t?.type==="LogicalExpression"?"&&"===t.operator&&e(t.left)||e(t.right):t?.type==="ConditionalExpression"?e(t.consequent)||e(t.alternate):t?.type==="SequenceExpression"&&e(t.expressions.at(-1))}(a)||function(e,t){let{parserServices:r}=t.sourceCode;if(!r?.program)return!1;try{let t=r.getTypeAtLocation(e);return(t.isUnion()?t.types:[t]).some(e=>"void"===e.intrinsicName||r0.has(e.intrinsicName))}catch{return!1}}(a,e)))return{node:o,messageId:x9,data:{method:r.callee.property.name},fix(e){let r,i=t.getText(a);return"ArrowFunctionExpression"===n.type&&n.body===o&&(r=i,"SequenceExpression"===a.type||r.trimStart().startsWith("{"))&&(i=`(${i})`),e.replaceText(o,i)}}})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary `Boolean()` casts in array predicate callbacks.",recommended:"unopinionated"},fixable:"code",messages:{[x9]:"`Boolean()` is unnecessary in `Array#{{method}}()` callbacks."},languages:["js/js"]}},"unicorn/no-useless-continue":{create:e=>{e.on("ContinueStatement",t=>{if(!t.label&&(e=>{if("BlockStatement"!==e.parent.type)return!1;let t=e;for(;;){let{parent:e}=t;if("BlockStatement"===e.type){if(e.body.at(-1)!==t)return!1;t=e;continue}if("IfStatement"===e.type&&(e.consequent===t||e.alternate===t)){t=e;continue}return tC(e)&&e.body===t}})(t))return{node:t,messageId:x4,fix:r=>aM(t,e,r)}})},meta:{type:"suggestion",docs:{description:"Disallow useless `continue` statements.",recommended:"unopinionated"},fixable:"code",messages:{[x4]:"Unnecessary `continue` statement."},languages:["js/js"]}},"unicorn/no-useless-override":{create:e=>{let{sourceCode:t}=e;e.on("MethodDefinition",r=>{let n;if("method"!==r.kind||r.accessibility||r.optional||r.decorators?.length>0||r.value.params.some(e=>e.decorators?.length>0))return;let{value:o}=r;if("FunctionExpression"!==o.type||!o.body||o.generator||!r.parent.parent.superClass)return;let a=function(e,t){let r,n,o,{value:a}=e;if(1!==a.body.body.length)return;let[i]=a.body.body;if("ReturnStatement"===i.type?r=i.argument:"ExpressionStatement"===i.type&&(r=i.expression),r?.type!=="CallExpression"||r.optional)return;let{callee:s}=r;if("MemberExpression"!==s.type||s.optional||"Super"!==s.object.type)return;let l=t.getScope(r),u=eM(e,l);if("string"==typeof u&&eM(s,l)===u&&(n=r.arguments,o=a.params,n.length===o.length&&o.every((e,t)=>{let r=n[t];return"Identifier"===e.type?"Identifier"===r.type&&r.name===e.name:"RestElement"===e.type&&"Identifier"===e.argument.type&&"SpreadElement"===r.type&&"Identifier"===r.argument.type&&r.argument.name===e.argument.name})))return{callExpression:r,name:u,isReturned:"ReturnStatement"===i.type}}(r,t);if(!a)return;let{callExpression:i,name:s,isReturned:l}=a;if(n=t.getScope(r),!r.parent.body.some(e=>e!==r&&"MethodDefinition"===e.type&&"method"===e.kind&&e.static===r.static&&null===e.value.body&&eM(e,n)===s)){if(l){let t;if(o.async&&(void 0===(t=bt(i,e))||!0!==op(t.type,t.checker)))return}else{let t;if(o.async||!(void 0!==(t=bt(i,e))&&be(t.type)))return}return{node:r.key,messageId:x7,data:{superCall:t.getText(i.callee)},*fix(n,{abort:o}){if(t.getCommentsInside(r).length>0)return o();yield aV(r,"",n,e)}}}})},meta:{type:"suggestion",docs:{description:"Disallow useless overrides of class methods.",recommended:"unopinionated"},fixable:"code",messages:{[x7]:"Useless override; this method only forwards to `{{superCall}}(…)`."},languages:["js/js"]}},"unicorn/prefer-has-check":{create:e=>{e.on("CallExpression",t=>((e,t)=>{if(!tA(e,{method:"get",argumentsLength:1,computed:!1,optionalCall:!1,optionalMember:!1,allowSpreadElement:!1}))return;let r=(e=>{let t=(e=>{for(;bg.has(e.parent?.type)&&e.parent.expression===e;)e=e.parent;return e})(e),{parent:r}=t;if(r?.type==="BinaryExpression"&&["!==","===","!=","=="].includes(r.operator)){if(r.left===t)return{node:r,operator:r.operator,value:r.right};if(r.right===t)return{node:r,operator:r.operator,value:r.left}}})(e);if(r){let n,o;if(t.sourceCode.getCommentsInside(e).length>0)return;let a=((e,t,r)=>{let n=bj(e.callee.object,r);if(!n)return;let o="!="===t.operator||"=="===t.operator;if("null-sentinel"===n.kind)return o&&bC(t.value,r)?{missingType:"undefined"}:{missingType:"null"};if("map"===n.kind){if(bC(t.value,r)&&b$(e.callee.object,r,o?"not-nullish":"not-undefined"))return{missingType:"undefined"};if(ta(t.value)&&o&&b$(e.callee.object,r,"not-nullish"))return{missingType:"nullish"}}})(e,r,t);if(!a||(n=r.value,o=a.missingType,"undefined"===o?!bC(n,t):!ta(n)))return;return{node:e.callee.property,messageId:br,fix:((e,t,r)=>{var n;let o;if(r.sourceCode.getCommentsInside(t.node).length>r.sourceCode.getCommentsInside(e).length)return;let a=`${(({operator:e})=>"!=="===e||"!="===e)(t)?"":"!"}${(o=e5(n=e.callee.object,r),!e4(n,r)&&oQ(n,r)?`(${o})`:o)}.has(${((e,t)=>{let[r]=e.arguments;return t.sourceCode.getText(r)})(e,r)})`;return e=>e.replaceText(t.node,a)})(e,r,t)}}if((tU(e,t)||tq(e))&&bj(e.callee.object,t)?.kind==="map"&&b$(e.callee.object,t,"truthy")){if(t.sourceCode.getCommentsInside(e).length>0)return;return{node:e.callee.property,messageId:br,fix:t=>t.replaceText(e.callee.property,"has")}}})(t,e))},meta:{type:"suggestion",docs:{description:"Prefer `.has()` when checking existence.",recommended:"unopinionated"},fixable:"code",messages:{[br]:"Prefer `.has(…)` when checking existence."},languages:["js/js"]}},"unicorn/consistent-conditional-object-spread":{create:e=>{e.options[0]===bO?e.on("LogicalExpression",t=>{if(b_(t)){if("&&"!==t.operator||bW(t.right)||bz(t.left,t.right,e.sourceCode))return;let r=bX(t.left,e.sourceCode);if(r&&!r.isTrueWhenNullish&&bz(r.reference,t.right,e.sourceCode))return;let n=bH(t.left,e),o=bH(t.right,e);return{node:t,messageId:bU,data:{expectedStyle:"ternary"},*fix(r,{abort:a}){if(e.sourceCode.getCommentsInside(t).length>0)return a();yield r.replaceText(t,`${n} ? ${o} : {}`)}}}}):e.on("ConditionalExpression",t=>{if(b_(t))return function(e,t){let{test:r,consequent:n,alternate:o}=e,a=bW(o);if(a===bW(n))return;let i=a?n:o,s=bX(r,t.sourceCode),l=t.sourceCode.getCommentsInside(e).length>0;if((a?bz(r,i,t.sourceCode):"UnaryExpression"===r.type&&"!"===r.operator&&r.prefix&&bz(r.argument,i,t.sourceCode))||s&&!l&&(s.isTrueWhenNullish?!a:a)&&bz(s.reference,i,t.sourceCode))return;let u=a?bY(r,"left",t):function(e,t){if("UnaryExpression"===e.type&&"!"===e.operator&&e.prefix)return bY(e.argument,"left",t);let r=e5(e,t);return!e4(e,t)&&o1(e,"!")&&(r=`(${r})`),`!${r}`}(r,t),p=bY(i,"right",t);return{node:e,messageId:bU,data:{expectedStyle:"logical"},*fix(t,{abort:r}){if(l)return r();yield t.replaceText(e,`${u} && ${p}`)}}}(t,e)})},meta:{type:"suggestion",docs:{description:"Enforce consistent conditional object spread style.",recommended:!0},fixable:"code",schema:[{description:"The conditional object spread style to enforce.",enum:[bM,bO]}],defaultOptions:[bM],messages:{[bU]:"Prefer {{expectedStyle}} conditional object spreads."},languages:["js/js"]}},"unicorn/default-export-style":Em,"unicorn/no-array-concat-in-loop":{create:e=>{e.on("AssignmentExpression",t=>{let r=function(e,t){var r;if("="!==e.operator)return;let n="Identifier"===e.left.type?e.left:void 0,o=Ef(e.right);if(!n||!tA(o,{method:"concat",minimumArguments:1,optionalCall:!1,optionalMember:!1,computed:!1}))return;let a=(r=Ef(r=o.callee.object),r?.type==="Identifier"?r:void 0),i=Eg(n,t);if(!a||!i||i!==Eg(a,t)||!function(e){let[t]=e?.defs??[];if(!t||1!==e.defs.length||"global"===e.scope.type||"Variable"!==t.type||"Identifier"!==t.node.id.type||"let"!==t.parent.kind&&"var"!==t.parent.kind)return!1;let r=t.node.init&&Ef(t.node.init);return!!(r&&ty(r))}(i))return;let s=function(e,t){for(let r of t.sourceCode.getAncestors(e).toReversed()){if(tE(r))return;if(tC(r))return r}}(e,t),[l]=i.defs;if(!(!s||function(e,t,r){let[n,o]=r.sourceCode.getRange(e),[a,i]=r.sourceCode.getRange(t);return n>=a&&o<=i}(l.node,s.body,t)))return{callExpression:o,property:o.callee.property}}(t,e);if(r)return{node:r.property,messageId:Ey}})},meta:{type:"suggestion",docs:{description:"Disallow array accumulation with `Array#concat()` in loops.",recommended:!0},schema:[],messages:{[Ey]:"Do not use `Array#concat()` to accumulate an array in a loop."},languages:["js/js"]}},"unicorn/no-array-front-mutation":{create:e=>{e.on("CallExpression",t=>{if(!tA(t,{methods:["shift","unshift"],optionalCall:!1,computed:!1}))return;let{object:r,property:n}=t.callee,{name:o}=n;if(!("unshift"===o&&tF(t.callee,Ex)||nC(r,e)))return{node:n,messageId:Eh,data:{method:o}}})},meta:{type:"suggestion",docs:{description:"Disallow front-of-array mutation.",recommended:!1},schema:[],messages:{[Eh]:"Avoid front-of-array mutation with `Array#{{method}}()`."},languages:["js/js"]}},"unicorn/no-array-sort-for-min-max":{create:e=>{e.on("MemberExpression",t=>{if(!t.computed||t.optional||!Ev(t.property)||nP(t)||("ForInStatement"===t.parent.type||"ForOfStatement"===t.parent.type)&&t.parent.left===t)return;let r=EC(t.object,e);if(r)return ED(t,r,"first",e)}),e.on("CallExpression",t=>{let r;if(!tA(t,{method:"at",argumentsLength:1,optionalCall:!1,optionalMember:!1}))return;let[n]=t.arguments;if(Ev(n)?r="first":tw(n)&&(r="last"),!r||nP(t))return;let o=EC(t.callee.object,e);if(o)return ED(t,o,r,e)})},meta:{type:"suggestion",docs:{description:"Disallow sorting arrays to get the minimum or maximum value.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[Eb]:"Use `Math.{{method}}()` instead of sorting to get the {{extreme}} value.",[EE]:"Replace with `{{replacement}}`."},languages:["js/js"]}},"unicorn/no-boolean-sort-comparator":{create:e=>{e.on("CallExpression",t=>{let r,n;if(r=t,n=e,!(td(r,{minimumArguments:1},tu)&&"MemberExpression"===r.callee.type&&EA.has(eM(r.callee,n.sourceCode.getScope(r.callee))))||nE(t.callee.object,e))return;let[o]=t.arguments;if("SpreadElement"!==o.type){let t=rI(o);if(tE(t)){let r=(e=>{if("BlockStatement"!==e.body.type)return e.body;if(1!==e.body.body.length)return;let[t]=e.body.body;if("ReturnStatement"===t.type)return t.argument})(t);if(!n1(t,e)&&!EI(o,e))return;return{node:o,messageId:ES,suggest:o===t?((e,t,r)=>{var n;if(!t||2!==e.params.length||e.params.some(e=>"Identifier"!==e.type)||e.params.some(e=>e.typeAnnotation)||e.params.some(e=>e.optional)||e.typeParameters||e.returnType||r.sourceCode.getCommentsInside(e).length>0)return;let[o,a]=e.params;if(o.name===a.name)return;let i="BinaryExpression"===(n=rI(n=t)).type&&Ew.has(n.operator)?n:void 0;if(!i||rk(i.left)||rk(i.right)||!Ek(i.left,i.right,o,a))return;let[s,l]=">"===i.operator||">="===i.operator?[i.left,i.right]:[i.right,i.left],u=`(${o.name}, ${a.name}) => ${r.sourceCode.getText(s)} - ${r.sourceCode.getText(l)}`;return[{messageId:ET,data:{replacement:u},fix:t=>t.replaceText(e,u)}]})(t,r,e):void 0}}return n2(t,e)||function(e,t){if("Identifier"===e.type)return("Boolean"===e.name||nK.has(e.name))&&t.sourceCode.isGlobalReference(e);if("MemberExpression"!==e.type||e.optional||"Identifier"!==e.object.type||!t.sourceCode.isGlobalReference(e.object))return!1;let r=nG.get(e.object.name),n=eM(e,t.sourceCode.getScope(e));return!!r?.has(n)}(t,e)||EI(o,e)?{node:o,messageId:ES}:void 0}})},meta:{type:"problem",docs:{description:"Disallow boolean-returning sort comparators.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[ES]:"Do not return a boolean from a sort comparator.",[ET]:"Replace with `{{replacement}}`."},languages:["js/js"]}},"unicorn/no-chained-comparison":{create:e=>{let{sourceCode:t}=e;e.on("BinaryExpression",r=>{if(!EP.has(r.operator))return;let n=EL(r.left)?r.left:r.right;if(!EL(n))return;let o=n===r.left,a=o?r.right:r.left;if(ER.has(r.operator)&&n8(a,e))return;let i={node:r,messageId:Ej},s=EB.has(n.operator)===EB.has(r.operator)&&!tt(r.right);if(o&&s&&!EL(r.right)&&!EL(n.left)&&((e,t)=>{if(e4(e,t))return!0;let{parent:r}=e;return"BinaryExpression"!==r.type&&("LogicalExpression"!==r.type||"??"!==r.operator)})(r,e)&&!e_(n.right,t)&&0===t.getCommentsInside(r).length){let o=`${t.getText(r.left)} && ${e5(n.right,e)} ${r.operator} ${e5(r.right,e)}`;i.suggest=[{messageId:EF,data:{replacement:o},fix:e=>e.replaceText(r,o)}]}return i})},meta:{type:"problem",docs:{description:"Disallow chained comparisons such as `a < b < c`.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[Ej]:"Comparison operators cannot be chained. The inner comparison evaluates to a boolean, which is then compared instead of the operands.",[EF]:"Replace with `{{replacement}}`."},languages:["js/js"]}},"unicorn/no-constant-zero-expression":{create:e=>{let{sourceCode:t}=e;e.on("BinaryExpression",e=>{if(!(e=>{switch(e.operator){case"*":case"&":return e7(e.left,0)||e7(e.right,0);case"/":return e7(e.left,0);default:return!1}})(e))return;let r={node:e,messageId:EN},n=eN(e,t.getScope(e));return n&&Object.is(n.value,0)&&0===t.getCommentsInside(e).length&&(r.suggest=[{messageId:E$,fix:t=>t.replaceText(e,"0")}]),r})},meta:{type:"problem",docs:{description:"Disallow arithmetic and bitwise operations that always evaluate to `0`.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[EN]:"This operation always evaluates to `0` (or `-0`/`NaN`), which is likely a mistake.",[E$]:"Replace this expression with `0`."},languages:["js/js"]}},"unicorn/no-duplicate-logical-operands":{create:e=>{e.on("LogicalExpression",t=>{let r,n;if("&&"!==t.operator&&"||"!==t.operator)return;let o="LogicalExpression"===t.left.type&&t.left.operator===t.operator?t.left.right:t.left;if((e=>{for(let t=e.parent;t;t=t.parent)if("WithStatement"===t.type)return!0;return!1})(t)||!EV(o)||!EV(t.right)||!uh(o,t.right))return;let a={node:t.right,messageId:EM};if(r=t.left,!e.sourceCode.getCommentsInside(t).every(t=>((e,t,r)=>{let[n,o]=r.sourceCode.getRange(e),[a,i]=e9(t,r);return n>=a&&o<=i})(t,r,e)))return a;let i=e5(t.left,e),s=e=>e.replaceText(t,i);return Eq.has(o.type)&&(n=t.right,Eq.has(n.type))?{...a,fix:s}:{...a,suggest:[{messageId:EO,fix:s}]}})},meta:{type:"problem",docs:{description:"Disallow adjacent duplicate operands in logical expressions.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,schema:[],messages:{[EM]:"This operand duplicates the left operand.",[EO]:"Remove the duplicate operand."},languages:["js/js"]}},"unicorn/no-impossible-length-comparison":{create:e=>{e.on("BinaryExpression",t=>{let r,n,o,a;if(!Object.hasOwn(E_,t.operator))return;let i=(r=rI(t.left),n=rI(t.right),rW(r)?{memberExpression:r,operator:t.operator,value:eN(n,e.sourceCode.getScope(n))?.value}:rW(n)?{memberExpression:n,operator:E_[t.operator],value:eN(r,e.sourceCode.getScope(r))?.value}:void 0);if(!i)return;let{memberExpression:s}=i;if("ThisExpression"===(o=rI(s.object)).type||"Super"===o.type||function e(t){return!!("ChainExpression"===(t=rI(t)).type||rX(t))||("MemberExpression"===t.type?e(t.object):"CallExpression"===t.type&&e(t.callee))}(s.object)||(a=eN(s,e.sourceCode.getScope(s)))&&(!Number.isSafeInteger(a.value)||a.value<0)||function({node:e,lengthOrSizeNode:t}){let r=function(e){for(;tL(e.parent)&&"&&"===e.parent.operator;)e=e.parent;return e}(e);return"LogicalExpression"===r.type&&"&&"===r.operator&&(function e(t){return[t.left,t.right].flatMap(r=>"LogicalExpression"===r.type&&r.operator===t.operator?e(r):[r])})(r).some(r=>r!==e&&tS(r,{computed:!1,optional:!1})&&"Identifier"===r.property.type&&rV.has(r.property.name)&&rv(r.object,t.object))}({node:t,lengthOrSizeNode:s}))return;let l=function({operator:e,value:t}){if("number"==typeof t&&Number.isFinite(t))switch(e){case"<":return!(t<=0)&&void 0;case"<=":case"===":case"==":return!(t<0)&&void 0;case">":case"!==":case"!=":return t<0||void 0;case">=":return t<=0||void 0}}(i);if(void 0!==l)return{node:t,messageId:EW,data:{property:s.property.name,result:String(l)}}})},meta:{type:"problem",docs:{description:"Disallow impossible comparisons against `.length` or `.size`.",recommended:"unopinionated"},messages:{[EW]:"This comparison is always {{result}} because `.{{property}}` is always a non-negative integer."},languages:["js/js"]}},"unicorn/no-invalid-character-comparison":{create:e=>{e.on("BinaryExpression",t=>{if(EK.has(t.operator))for(let[r,n]of[[t.left,t.right],[t.right,t.left]]){let o=tr(n);if(void 0!==o&&o.length>1&&EG(r,e)){let e="!=="===t.operator||"!="===t.operator;return{node:t,messageId:Ez,data:{string:o,result:e?"true":"false"}}}}})},meta:{type:"problem",docs:{description:"Disallow comparing a single character from a string to a multi-character string.",recommended:"unopinionated"},schema:[],messages:{[Ez]:"A single character can never equal the multi-character string `{{string}}`, so this comparison is always {{result}}."},languages:["js/js"]}},"unicorn/no-loop-iterable-mutation":{create:e=>{let t=new l,r=o4(e);e.onExit("ForOfStatement",n=>{if(n.await)return;let o=E6(n.right,e);if(o)return function* e(t,r,n,o){if(E0.has(t.type))return;let a=n;if("ForOfStatement"===t.type&&!t.await){let e=E6(t.right,o);e&&E7(e.reference,r.iterable,o)&&(a=E5(t,e))}if("CallExpression"===t.type){let e=function(e,t,r,n){if("MemberExpression"!==e.callee.type)return;let{addArgumentIdentifier:o,deleteArgumentIdentifier:a,iterable:i,reportedCallExpressions:s,setKeyIdentifier:l}=t,{object:u,property:p}=e.callee,c=eM(e.callee,n.sourceCode.getScope(e.callee));if(!(!EQ[t.collectionKind??"unknown"].has(c)||!E7(u,i,n)||"delete"===c&&ve(e,a,n)||vt(e,{addArgumentIdentifier:o,setKeyIdentifier:l},c,n)&&!function e(t,r,n){let o=function(e){let t=e;for(;t.parent&&"BlockStatement"!==t.parent.type&&"SwitchCase"!==t.parent.type;)t=t.parent;if(t.parent)return{parent:t.parent,statement:t,statements:"SwitchCase"===t.parent.type?t.parent.consequent:t.parent.body}}(t);if(!o)return!1;let{statement:a,statements:i}=o,s=i.indexOf(a);return!!i.slice(0,s).some(e=>(function e(t,r,n){let o=function(e){if("ExpressionStatement"!==e.type)return;let t=rI(e.expression);return"CallExpression"===t.type?t:void 0}(t);if(o)return"MemberExpression"===o.callee.type&&"delete"===eM(o.callee,n.sourceCode.getScope(o.callee))&&E7(o.callee.object,r.iterable,n)&&ve(o,r.deleteArgumentIdentifier,n);return"BlockStatement"===t.type?t.body.some(t=>e(t,r,n)):"IfStatement"===t.type&&(!r.branchAlwaysExits(t.consequent)&&e(t.consequent,r,n)||t.alternate&&!r.branchAlwaysExits(t.alternate)&&e(t.alternate,r,n))})(e,r,n))||o.parent!==r.loopBody&&e(o.parent,r,n)}(e,t,n)||r&&vt(e,r,c,n))&&!s.has(e))return s.add(e),{node:p,messageId:EJ,data:{iterable:n.sourceCode.getText(i)}}}(t,r,n,o);e&&(yield e)}for(let n of o.sourceCode.visitorKeys[t.type]??[]){let i=t[n];if(Array.isArray(i)){for(let t of i)t&&(yield*e(t,r,a,o));continue}i&&(yield*e(i,r,a,o))}}(n.body,{branchAlwaysExits:r,...E5(n,o),reportedCallExpressions:t},void 0,e)})},meta:{type:"problem",docs:{description:"Disallow mutating a loop iterable during iteration.",recommended:!0},schema:[],messages:{[EJ]:"Do not mutate `{{iterable}}` while iterating over it."},languages:["js/js"]}},"unicorn/no-selector-as-dom-name":{create:e=>{let{sourceCode:t}=e;e.on("CallExpression",function*(e){for(let{node:r,expectedPrefix:n}of(e=>{if(tA(e,{methods:vn})&&tS(e.callee.object,{property:"classList",computed:!1})&&!oo(rI(e.callee.object.object))){let t=e.callee.property.name;return"add"===t||"remove"===t?vu(e.arguments,"."):"replace"===t?e.arguments[0]?.type==="SpreadElement"?[]:vu(e.arguments.slice(0,2),"."):vu(e.arguments.slice(0,1),".")}if(tA(e,{methods:["getElementById","getElementsByClassName"],argumentsLength:1})&&!oo(rI(e.callee.object))){let t="getElementById"===e.callee.property.name?"#":".";return vu(e.arguments,t)}return[]})(e)){if("SpreadElement"===r.type)continue;let e=rI(r),o=vs(e);vi(o)&&(yield vl(e,o,n,t))}})},meta:{type:"problem",docs:{description:"Disallow selector syntax in DOM names.",recommended:!0},fixable:"code",messages:{[vr]:"Do not use selector syntax in DOM names."},languages:["js/js"]}},"unicorn/no-useless-compound-assignment":{create:e=>{let{sourceCode:t}=e;e.on("AssignmentExpression",r=>{if(!vm.has(r.operator)||!tn(r.right)||r.right.value!==vm.get(r.operator))return;let n={operator:r.operator,value:r.right.raw};if(t.getCommentsInside(r).length>0)return{node:r,messageId:vp,data:n};let{parent:o}=r;if("ExpressionStatement"===o.type&&["Program","BlockStatement","StaticBlock","SwitchCase"].includes(o.parent.type))return{node:r,messageId:vp,data:n,suggest:[{messageId:vc,fix:t=>aM(o,e,t)}]};let a=t.getText(r.left);return{node:r,messageId:vp,data:n,suggest:[{messageId:vd,data:{left:a},fix:e=>e.replaceText(r,a)}]}})},meta:{type:"suggestion",docs:{description:"Disallow useless compound assignments such as `x += 0`.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[vp]:"This compound assignment is useless as `{{operator}} {{value}}` does not change the value.",[vc]:"Remove the useless assignment.",[vd]:"Replace the useless assignment with `{{left}}`."},languages:["js/js"]}},"unicorn/no-useless-delete-check":{create:e=>{e.on("IfStatement",t=>{let r=function(e,t){if(e.alternate||"IfStatement"===e.parent.type&&e.parent.alternate===e)return;let r=(e=>{if("BlockStatement"===e.type){if(1!==e.body.length)return;e=e.body[0]}return"ExpressionStatement"===e.type?e.expression:void 0})(e.consequent);if(r)return"UnaryExpression"===r.type&&"delete"===r.operator?function(e,t,r){let n,{test:o}=e,{argument:a}=t;if("BinaryExpression"===o.type&&"in"===o.operator&&"MemberExpression"===a.type&&!a.optional&&rv(o.right,a.object)&&vT(o.right,r)&&vA(o.left,r)&&vA(o.right,r)&&(!a.computed||vA(a.property,r))){if(a.computed)n=((e,t,r)=>{if(rv(e,t))return!((e,t)=>{var r;let n;if(vT(e,t)||vD(rI(e),t))return!0;let o=rU(rI(e),t);if(!o)return!1;let a=rI(o);return"NewExpression"===a.type||"CallExpression"===(r="ChainExpression"===(n=r=a).type?n.expression:n).type&&void 0===vS(r,t)})(e,r);let n=vS(e,r),o=vS(t,r);return void 0!==n&&n===o})(o.left,a.property,r);else{let e=eM(a,r.sourceCode.getScope(a));n=null!==e&&e===vS(o.left,r)}return n?{suggest:[{messageId:vg,fix:vk(e,t,r)}]}:void 0}}(e,r,t):function(e,t,r){let{test:n}=e;if(vw(n,"has")&&vw(t,"delete")&&((e,t)=>{let r;if("Identifier"!==(e=rI(e)).type)return!1;let n=rU(e,t);if(!n)return!1;let o=rI(n);return"NewExpression"===o.type&&(r=o.callee,"Identifier"===r.type&&vh.has(r.name)&&t.sourceCode.isGlobalReference(r))})(n.callee.object,r)&&rv(n.callee.object,t.callee.object)&&rv(n.arguments[0],t.arguments[0])&&vA(n.arguments[0],r))return{fix:vk(e,t,r)}}(e,r,t)}(t,e);if(r)return{node:t.test,messageId:vf,fix:r.fix,suggest:r.suggest}})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary existence checks before deletion.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,schema:[],messages:{[vf]:"The existence check before deletion is unnecessary.",[vg]:"Remove the existence check."},languages:["js/js"]}},"unicorn/no-useless-logical-operand":{create:e=>{e.on("LogicalExpression",t=>{if(!vj.has(t.operator)||"LogicalExpression"===t.parent.type&&t.parent.operator===t.operator)return;let r=function(e,t){let r,n,{operator:o}=e,a=function e(t,r){return"LogicalExpression"===t.type&&t.operator===r?[...e(t.left,r),...e(t.right,r)]:[t]}(e,o),i=(r=vF.get(o),tt(a[0],r)?a[0]:void 0);if(i)return{target:i,replacementOperands:[i]};let s=(n=vj.get(o),a.filter((e,r)=>tt(e,n)&&function(e,t,r){var n;if(t<e.length-1)return!0;let o=e.slice(0,-1);return tU(n=e[t].parent,r)||tq(n)||o.every(e=>n8(e,r))}(a,r,t)));if(0===s.length)return;let l=a.filter(e=>!s.includes(e));return{target:s[0],replacementOperands:0===l.length?[s.at(-1)]:l}}(t,e);if(!r)return;let{target:n,replacementOperands:o}=r;if(1===o.length&&te(rI(o[0]))&&function(e){let{parent:t}=e;if("ExpressionStatement"!==t.type||t.expression!==e)return!1;let r=t.parent,n=r.parent;if("Program"!==r.type&&!("BlockStatement"===r.type&&tE(n)))return!1;let o=r.body.indexOf(t);return r.body.slice(0,o).every(e=>"string"==typeof e.directive)}(t))return;let a={node:n,messageId:vI,data:{operator:t.operator}};return e.sourceCode.getCommentsInside(t).length>0||(1===o.length?a.fix=r=>ak(r,t,o[0],e):a.fix=r=>{var n;let a;return r.replaceText(t,(n=t.operator,a=o.map((t,r)=>{let o,a;return o=e4(t,e),a=e5(t,e),!o&&o2(t,{operator:n,property:0===r?"left":"right"})&&(a=`(${a})`),0===r&&!o&&vB.has(rI(t).type)&&(a=`(${a})`),a}).join(` ${n} `),oC(e.sourceCode.getTokenBefore(t),e,a)?`;${a}`:a))}),a})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary operands in logical expressions involving boolean literals.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[vI]:"Simplify this `{{operator}}` expression."},languages:["js/js"]}},"unicorn/prefer-boolean-return":{create:e=>{let{sourceCode:t}=e;function r(n,o,a,i=t.getRange(n)){let s;if(!o||!a||"ConditionalExpression"===n.test.type)return;let l=vN(o),u=vN(a);if(void 0===l||void 0===u||l===u)return;let p={node:n,messageId:vR},c=!l,d=t.getCommentsInside(n).length>0||t.getCommentsInside(a).length>0||rL(e,a),m=!c&&!v$(n.test,e)&&!!(s=eg(t.getScope(n),"Boolean"))&&0!==s.defs.length;return d||m?p:{...p,fix:t=>t.replaceTextRange(i,`return ${function(t,r){let n=e5(t,e);if(r)return o1(t,"!")?`!(${n})`:`!${n}`;if(v$(t,e))return n;let o="SequenceExpression"===t.type?`(${n})`:n;return`Boolean(${o})`}(n.test,c)};`)}}e.on("IfStatement",n=>n.alternate?r(n,vL(n.consequent),vL(n.alternate)):function(n){let o,a=at(n,e);if(!a||"ReturnStatement"!==a.type)return;let i=vL(n.consequent),s=vN(i);if(void 0!==s&&(o=ae(n,e),o?.type==="IfStatement"&&!o.alternate&&vN(vL(o.consequent))===s))return;let l=r(n,i,a,[t.getRange(n)[0],t.getRange(a)[1]]);return l?.fix&&t.getTokensBetween(n,a,{includeComments:!0}).some(e=>"Block"===e.type||"Line"===e.type)?{node:n,messageId:vR}:l}(n))},meta:{type:"suggestion",docs:{description:"Prefer directly returning boolean expressions over `if` statements.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[vR]:"Return the boolean expression directly."},languages:["js/js"]}},"unicorn/prefer-flat-math-min-max":{create:e=>{let{sourceCode:t}=e;e.on("CallExpression",e=>{let r=(e=>{for(let t of vO)if(vU(e,t))return t})(e);if(!(!r||!e.arguments.some(e=>vU(e,r))||((e,t)=>{let{parent:r}=e;return vU(r,t)&&r.arguments.includes(e)})(e,r)))return{node:e,messageId:vM,data:{method:r},*fix(n,{abort:o}){if(t.getCommentsInside(e).length>0)return o();let a=t.getText(e.callee),i=vq(e,r).map(e=>t.getText(e)).join(", ");yield n.replaceText(e,`${a}(${i})`)}}})},meta:{type:"suggestion",docs:{description:"Prefer flat `Math.min()` and `Math.max()` calls over nested calls.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[vM]:"Prefer a flat `Math.{{method}}()` call instead of nested calls."},languages:["js/js"]}},"unicorn/prefer-hoisting-branch-code":{create:e=>{e.on("IfStatement",t=>(function*(e,t){if("IfStatement"===e.parent.type&&e.parent.alternate===e)return;let r=function(e){let t=[],r=e;for(;r?.type==="IfStatement";r=r.alternate)t.push(r.consequent);if(r)return t.push(r),t}(e);if(!r||r.some(e=>"BlockStatement"!==e.type))return;let{sourceCode:n}=t,{leading:o,trailing:a,minLength:i}=function(e,t){let r=Math.min(...e.map(e=>e.length)),n=0;for(;n<r&&e.every(r=>vJ(r[n],e[0][n],t));)n++;let o=0;for(;n+o<r&&e.every(r=>vJ(r.at(-1-o),e[0].at(-1-o),t));)o++;return{leading:n,trailing:o,minLength:r}}(r.map(e=>e.body),n);0===o&&0===a||!(o+a>=i)&&(o>0&&(yield vY({ifStatement:e,blocks:r,leading:o,trailing:a,isStart:!0},t)),a>0&&(yield vY({ifStatement:e,blocks:r,leading:o,trailing:a,isStart:!1},t)))})(t,e))},meta:{type:"suggestion",docs:{description:"Prefer moving code shared by all branches of an `if` statement out of the branches.",recommended:!0},fixable:"code",hasSuggestions:!0,messages:{[vV]:"These branches start with the same code. Move it before the `if` statement.",[vW]:"These branches end with the same code. Move it after the `if` statement.",[v_]:"Move the shared code out of the branches."},languages:["js/js"]}},"unicorn/prefer-single-replace":{create:e=>{let{sourceCode:t}=e;e.on("CallExpression",r=>{if(void 0===v1(r))return;let n=r.arguments[1];if(!te(n))return;let o=n.value;if(o.includes("$`")||o.includes("$'"))return;let a=e=>void 0!==v1(e)&&te(e.arguments[1])&&e.arguments[1].value===o,{parent:s}=r;if("MemberExpression"===s.type&&s.object===r&&"CallExpression"===s.parent.type&&s.parent.callee===s&&a(s.parent))return;let l=[],u=r;for(;a(u);)l.push(v1(u)),u=u.callee.object;if(l.length<2)return;let p=u;l.reverse();let c=[...new i(l)];if(c.some(e=>o.includes(e)))return;let d={node:r,messageId:vQ};if(0===t.getCommentsInside(r).length){let t=c.map((e,t)=>(function(e,t,r){if(v0.has(e))return v0.get(e);if("^"===e)return t?String.raw`\^`:"^";if("-"===e)return t||r?"-":String.raw`\-`;let n=e.codePointAt(0);return n<32||127===n?String.raw`\x${n.toString(16).toUpperCase().padStart(2,"0")}`:e})(e,0===t,t===c.length-1)).join(""),o=e5(p,e),a=e5(n,e);d.fix=e=>e.replaceText(r,`${o}.replaceAll(/[${t}]/g, ${a})`)}return d})},meta:{type:"suggestion",docs:{description:"Enforce combining multiple single-character replacements into a single `String#replaceAll()` with a regular expression.",recommended:"unopinionated"},fixable:"code",messages:{[vQ]:"Combine these single-character replacements into a single `replaceAll()` with a regular expression."},languages:["js/js"]}},"unicorn/consistent-tuple-labels":{create:e=>{e.on("TSTupleType",e=>{let t=e.elementTypes;if(t.length<2)return;let r=t.filter(e=>"TSNamedTupleMember"!==e.type&&("TSRestType"!==e.type||"TSNamedTupleMember"!==e.typeAnnotation.type));if(0!==r.length&&r.length!==t.length)return r.map(e=>({node:e,messageId:v2}))})},meta:{type:"suggestion",docs:{description:"Enforce consistent labels on tuple type elements.",recommended:!0},messages:{[v2]:"This tuple element should have a label, just like the other elements."},languages:["js/js"]}},"unicorn/no-invalid-well-known-symbol-methods":{create:e=>{e.on("MethodDefinition",t=>Ct(t,e)),e.on("Property",t=>Ct(t,e)),e.on("PropertyDefinition",t=>Ct(t,e))},meta:{type:"problem",docs:{description:"Disallow invalid implementations of well-known symbol methods.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[v3]:"`Symbol.dispose` must not return a Promise. Use `Symbol.asyncDispose` instead.",[v8]:"`Symbol.dispose` must not be a generator. Use a normal method for synchronous disposal or `Symbol.asyncDispose` for asynchronous disposal.",[v6]:"`Symbol.iterator` must return a sync iterator. Use `Symbol.asyncIterator` for async iterators.",[v9]:"`Symbol.asyncIterator` must return an async iterator directly. Use an async generator or return the iterator synchronously.",[v5]:"Use `Symbol.{{replacement}}` instead."},languages:["js/js"]}},"unicorn/no-late-event-control":{create:e=>{let{sourceCode:t}=e,r=gp(e);e.onExit("CallExpression",n=>{var o;let a=(e=>{if(!tA(e,{methods:Ca,computed:!1}))return;let{callee:t}=e,r=rI(t.object);if("Identifier"===r.type)return{event:r,method:t.property.name}})(n);if(!a)return;let{event:i,method:s}=a,l=eg(t.getScope(i),i),u=l?.defs.find(({type:e})=>"Parameter"===e);if(!u)return;let p=u.node;if(!(!nA(o=u.name,e)&&(gs.test(o.name)||nT(o,e))))return;let c=gl(n)!==p,d=p.generator;if(!c&&!d&&!r.isFunctionSuspended(p)&&!r.isInsideSuspendingLoop(n,p))return;let m=Cr;return c?m=Co:d&&(m=Cn),{node:n,messageId:m,data:{name:i.name,method:s}}})},meta:{type:"problem",docs:{description:"Disallow event-control method calls after the synchronous event dispatch has finished.",recommended:!0},schema:[],messages:{[Cr]:"`{{name}}.{{method}}()` has no effect after the handler suspends. Call it before `await` or `yield` while the event is still being dispatched.",[Cn]:"`{{name}}.{{method}}()` is not called during event dispatch inside a generator function. Use a normal function handler instead.",[Co]:"`{{name}}.{{method}}()` may run after synchronous event dispatch has finished. Call it in the outer handler before deferring work."},languages:["js/js"]}},"unicorn/prefer-abort-signal-timeout":{create:e=>{e.on("VariableDeclarator",t=>((e,t)=>{var r;let n,o,{sourceCode:a}=t,i=e.parent,{id:s,init:l}=e;if("VariableDeclaration"!==i.type||"const"!==i.kind||1!==i.declarations.length||"Identifier"!==s.type||!(tm(l,{name:"AbortController",argumentsLength:0})&&om(l.callee,t))||(n=eg(t.sourceCode.getScope(s),"AbortSignal"))&&0!==n.defs.length||rN(t,a.getRange(l))||s.typeAnnotation&&rN(t,a.getRange(s.typeAnnotation)))return;let u=(e=>{let t=Array.isArray(e.parent.body)?e.parent.body:Array.isArray(e.parent.consequent)?e.parent.consequent:void 0;if(t)return t[t.indexOf(e)+1]})(i),p=((e,t)=>{if(e?.type==="ExpressionStatement"&&td(e.expression,{name:"setTimeout",argumentsLength:2,optional:!1},tu)&&om(e.expression.callee,t))return e.expression})(u,t);if(!p||((e,t,r)=>{let{sourceCode:n}=e,[,o]=n.getRange(t),[a]=n.getRange(r);return n.getAllComments().some(e=>{let[t,r]=n.getRange(e);return t>=o&&r<=a})})(t,i,u)||rN(t,a.getRange(u))||rL(t,u))return;let c=((e,t)=>{let[r]=e.arguments,n=!r||"ArrowFunctionExpression"!==r.type&&"FunctionExpression"!==r.type||r.async||r.generator||r.params.length>0?void 0:"BlockStatement"!==r.body.type?r.body:1===r.body.body.length&&"ExpressionStatement"===r.body.body[0].type?r.body.body[0].expression:void 0;if(td(n,{argumentsLength:0,optional:!1},tu)&&tS(n.callee,{property:"abort",computed:!1,optional:!1})&&"Identifier"===n.callee.object.type&&n.callee.object.name===t)return n.callee.object})(p,s.name);if(!c)return;let d=eg(a.getScope(s),s);if(!d||eg(a.getScope(c),c)!==d)return;let m=((e,t,r)=>{let n=[];for(let o of e.references){let{identifier:e}=o;if(e===t||o.init)continue;if(o.isWrite())return;let a=Cu(e,r);if(!a)return;n.push(a)}return n.length>0?n:void 0})(d,c,t);if(!m)return;let f=a.getRange(u),[,g]=p.arguments;if("SequenceExpression"===g.type||!((e,t)=>{let r=eN(e,t.sourceCode.getScope(e));if(!r)return!0;let{value:n}=r;return"number"==typeof n&&Number.isSafeInteger(n)&&n>=0&&n<=0x7fffffff})(g,t)||m.some(e=>{let r;return(r=t.sourceCode.getRange(e))[0]>=f[0]&&r[1]<=f[1]}))return;let y=(r=s.name,o=r,("abortController"===r?o="abortSignal":"controller"===r&&(o="signal"),o===r||Cp(o,d,d.identifiers[0],t)||m.some(e=>Cp(o,d,e,t)))?r:o),h=`AbortSignal.timeout(${a.getText(g)})`;return{node:s,messageId:Ci,suggest:[{messageId:Cs,*fix(e){if(yield e.replaceText(l,h),s.typeAnnotation&&(yield e.replaceText(s.typeAnnotation,": AbortSignal")),y!==s.name){let[t]=a.getRange(s);yield e.replaceTextRange([t,t+s.name.length],y)}for(let t of m)yield e.replaceText(t,y);yield aM(u,t,e)}}]}})(t,e))},meta:{type:"suggestion",docs:{description:"Prefer `AbortSignal.timeout()` over manually aborting an `AbortController` with `setTimeout()`.",recommended:!0},hasSuggestions:!0,schema:[],messages:{[Ci]:"Prefer `AbortSignal.timeout()` over manually aborting an `AbortController` with `setTimeout()`.",[Cs]:"Replace with `AbortSignal.timeout()`."},languages:["js/js"]}},"unicorn/prefer-aggregate-error":{create:e=>{e.on("IfStatement",t=>{var r;let n,o="ThrowStatement"===(r=t.consequent).type?r:"BlockStatement"===r.type&&1===r.body.length&&"ThrowStatement"===r.body[0].type?r.body[0]:void 0;if(!o)return;let a=function(e,t){let r=e.argument;if(tm(r,{name:"Error",maximumArguments:2})&&om(r.callee,t))return r}(o,e);if(!a)return;let i=function(e,t){let r=CE(e.test).map(e=>(function(e,t){let r=Cx(e=Cf(e),t);if(r)return r;if("BinaryExpression"!==e.type)return;let n=Cx(e.left,t);if(n&&Cb(e.operator,e.right,!0))return n;let o=Cx(e.right,t);if(o&&Cb(e.operator,e.left,!1))return o})(e,t)).filter(Boolean);if(1===r.length)return r[0]}(t,e);if(!i||(n=oT("AggregateError",e.sourceCode.getScope(a)))&&0!==n.defs.length)return;let{sourceCode:s}=e;return{node:a.callee,messageId:Cc,fix:e.sourceCode.getCommentsInside(a).length>0?void 0:e=>{let t=[s.getText(i),...a.arguments.map(e=>s.getText(e))].join(", ");return e.replaceText(a,`new AggregateError(${t})`)}}})},meta:{type:"suggestion",docs:{description:"Prefer `AggregateError` when throwing collected errors.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[Cc]:"Use `AggregateError` when throwing collected errors."},languages:["js/js"]}},"unicorn/prefer-observer-apis":{create:e=>{e.on("CallExpression",t=>{var r,n;let o;if(r=t,n=e,tA(r,{method:"addEventListener",minimumArguments:2,maximumArguments:3,optionalCall:!1,optionalMember:!1})?!!CP(r.callee.object,n):!(td(r,{name:"addEventListener",minimumArguments:2,maximumArguments:3,optional:!1},tu)&&om(r.callee,n)))return;let[a,i]=t.arguments,s=tr(o=rI(a))??((e,t)=>{let{parserServices:r}=t.sourceCode;if(r?.program)try{var n=r.getTypeAtLocation(e);if(n.isStringLiteral?.())return n.value;return}catch{}})(o,e);if(!CC.has(s))return;let l=((e,t)=>{if(tE(e=rI(e)))return e;if("Identifier"!==e.type)return;let r=eg(t.sourceCode.getScope(e),e);if(!r||1!==r.defs.length)return;let[n]=r.defs;if("FunctionName"===n.type)return n.node;let o=n.node.init&&rI(n.node.init);if("Variable"===n.type&&"const"===n.parent.kind&&o&&tE(o))return o})(i,e);if(l&&CV(l.body,e))return{node:a,messageId:s}})},meta:{type:"suggestion",docs:{description:"Prefer observer APIs over resize and scroll listeners with layout reads.",recommended:!0},schema:[],messages:Cv,languages:["js/js"]}},"unicorn/prefer-set-methods":{create:e=>{e.on("NewExpression",t=>{let r=((e,t)=>{if(!CJ(e,t)||t.sourceCode.getCommentsInside(e).length>0)return;let[r]=e.arguments;if("ArrayExpression"===r.type&&r.elements.length>=2&&r.elements.every(e=>{let r;return CZ(e,t)&&(r=e.argument,tm(r,{name:"Set",argumentsLength:0})&&om(r.callee,t)||!e_(r,t.sourceCode,{considerGetters:!0}))}))return{node:e,messageId:CW,fix:n=>n.replaceText(e,CY(e,((e,t)=>{let[r,...n]=e.elements.map(e=>e.argument),o=CX(r,t);for(let e of n)o+=`.union(${e5(e,t)})`;return o})(r,t),t))}})(t,e);if(r)return r;if(!CJ(t,e))return;let[n]=t.arguments;return C1((e=>{for(;e?.type==="ParenthesizedExpression"||rk(e);)e=e.expression;return e})(n),t,e)}),e.on("CallExpression",t=>{if(!(e=>{let{parent:t}=e=CQ(e);return(t?.type==="CallExpression"||t?.type==="NewExpression")&&(t.callee===e||t.arguments.includes(e))})(t))return C1(t,t,e)})},meta:{type:"suggestion",docs:{description:"Prefer `Set` methods for Set operations.",recommended:!0},fixable:"code",hasSuggestions:!0,messages:{[CW]:"Use `Set#union()` instead of spreading Sets into a new Set.",[C_]:"Use `Set#intersection()` instead of filtering by `Set#has()`.",[Cz]:"Use `Set#intersection()`.",[CK]:"Use `Set#difference()` instead of filtering by `Set#has()`.",[CG]:"Use `Set#difference()`."},languages:["js/js"]}},"unicorn/prefer-toggle-attribute":{create:e=>{let{sourceCode:t}=e;e.on(["IfStatement","ConditionalExpression"],r=>{let n=C5(r.consequent),o=C5(r.alternate);if(!((e,t,r)=>!!(e&&t&&("setAttribute"===e.method&&"removeAttribute"===t.method||"removeAttribute"===e.method&&"setAttribute"===t.method)&&C4(e,t)&&!rX(e.receiver)&&!rX(t.receiver)&&!C7(e,r)&&!C7(t,r)))(n,o,e))return;let a="setAttribute"===n.method?n:o,i=n===a,s=function e(t,r,n,o=!1){if("ChainExpression"===t.type)return e(t.expression,r,n,o);if("UnaryExpression"===t.type&&"!"===t.operator&&t.prefix)return e(t.argument,r,n,!o);let a=C9(t);if(a?.method==="hasAttribute"&&C4(a,r)&&!rX(a.receiver))return{isNegative:o,isKnownNonDom:C7(a,n)}}(r.test,a,e);if(s?.isKnownNonDom)return;let l=s&&i===s.isNegative?"":C8(r.test,e,!i),u=a.hasEmptyAttributeValue||void 0!==tr(a.attributeValue),p=!!l&&a.isOptional||!u,c=[a.receiver,a.attributeName];l&&c.push(r.test);let d=p||rP(e,r,c)?void 0:function*(n){var o;let i,s=(i=e5(o=a.receiver,e),!e4(o,e.sourceCode)&&oQ(o,e)?`(${i})`:i),u=e5(a.attributeName,e),p=a.isOptional?"?":"",c="ConditionalExpression"===r.type,d=`${s}${p}.toggleAttribute(${u}${l?`, ${l}`:""})`;c||(d+=";"),oC(t.getTokenBefore(r),e,d)&&(d=`;${d}`),yield n.replaceText(r,d),c&&(yield aR(n,r,e))};return((e,t,{forceSuggestion:r=!1}={})=>{let n={node:e,messageId:C2};if(!t)return n;let o="IfStatement"!==e.type&&!(tx(e)||tx(e.parent));return r||o?n.suggest=[{messageId:C3,fix:t}]:n.fix=t,n})(r,d,{forceSuggestion:!!l||!a.hasEmptyAttributeValue})})},meta:{type:"suggestion",docs:{description:"Prefer using `Element#toggleAttribute()` to toggle attributes.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[C2]:"Prefer using `Element#toggleAttribute()` to toggle attributes.",[C3]:"Replace with `Element#toggleAttribute()`."},languages:["js/js"]}},"unicorn/prefer-url-search-parameters":{create:e=>{e.on("CallExpression",t=>{let r,n=((e,t)=>{if(!(tA(e,{object:"Object",method:"fromEntries",argumentsLength:1,computed:!1,optionalCall:!1,optionalMember:!1})&&Do("Object",e,t)))return;let[r]=e.arguments,n=Ds(r,t);if(!n)return;let o=Du(e,r,Dl(n.query,t),t);return Dc({node:e,query:n.query,replacement:o,preservedNodes:[...Dp(e,r,t),n.query]},t)})(t,e);if(n)return n;if((r=(e=>{let t=e,{parent:r}=e;for(;rk(r)&&r.expression===t;)t=r,r=r.parent;return r?.arguments?.[0]===t?r:void 0})(t))&&("CallExpression"===r.type&&1===r.arguments.length&&"MemberExpression"===r.callee.type&&"Identifier"===r.callee.object.type&&"Object"===r.callee.object.name&&((e,t,{computed:r})=>r?tr(e)===t:"Identifier"===e.type&&e.name===t)(r.callee.property,"fromEntries",{computed:r.callee.computed})||tm(r,{names:["Map","URLSearchParams"],argumentsLength:1})))return;let o=Ds(t,e);if(o)return Dc({node:t,query:o.query,replacement:Dl(o.query,e)},e)}),e.on("NewExpression",t=>((e,t)=>{let r=tm(e,{name:"Map",argumentsLength:1})&&Do("Map",e,t);if(!r&&!tm(e,{name:"URLSearchParams",argumentsLength:1}))return;let[n]=e.arguments,o=Ds(n,t);if(!o)return;let a=Di(o.query,t),i=Dl(o.query,t),s=Du(e,n,r?i:a,t);return Dc({node:e,query:o.query,replacement:s,preservedNodes:[...Dp(e,n,t),o.query]},t)})(t,e))},meta:{type:"suggestion",docs:{description:"Prefer `URLSearchParams` over manually splitting query strings.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[De]:"Prefer `URLSearchParams` over manually splitting query strings.",[Dt]:"Use `{{replacement}}`."},languages:["js/js"]}},"unicorn/no-unsafe-promise-all-settled-values":{create:e=>{e.on("CallExpression",t=>(function(e,t){if(!tA(e,{method:"then",minimumArguments:1,optionalCall:!1,optionalMember:!1})||!Dx(e.callee.object))return;let[r]=e.arguments;if(!Dy(r)||0===r.params.length)return;let[n]=r.params,o=Dj(n)&&eg(t.sourceCode.getScope(n),n);if(o)return function e(t,r,n){if(t=Dh(t),!(!t?.type||Dy(t))&&"ClassExpression"!==t.type&&"ClassDeclaration"!==t.type){if(tA(t,{method:"map",minimumArguments:1,maximumArguments:2,optionalCall:!1,optionalMember:!1})&&function e(t,r,n){return!!DW(t=Dh(t),r,n)||DE(t)&&e(t.callee.object,r,n)}(t.callee.object,r,n)&&!D_(t.callee.object)){let e=Dz(t,n,{knownPromiseSettledResultArray:!0});if(e)return e}for(let[o,a]of Object.entries(t))if(!("parent"===o||DV(t,o))&&a&&"object"==typeof a)for(let t of Array.isArray(a)?a:[a]){let o=e(t,r,n);if(o)return o}}}(r.body,o,t)})(t,e)??Dz(t,e))},meta:{type:"problem",docs:{description:"Disallow reading `.value` from `Promise.allSettled()` results without a fulfilled status guard.",recommended:"unopinionated"},schema:[],messages:{[Dd]:"Do not read `.value` from `Promise.allSettled()` results without checking that the result is fulfilled."},languages:["js/js"]}},"unicorn/prefer-abort-signal-any":{create:e=>{e.on("VariableDeclarator",t=>((e,t)=>{var r;let n,o,{sourceCode:a}=t,s=e.parent,{id:l,init:u}=e;if("VariableDeclaration"!==s.type||"const"!==s.kind||1!==s.declarations.length||"Identifier"!==l.type||!(tm(u,{name:"AbortController",argumentsLength:0})&&om(u.callee,t))||(n=eg(t.sourceCode.getScope(l),"AbortSignal"))&&0!==n.defs.length||rN(t,a.getRange(u))||l.typeAnnotation&&rN(t,a.getRange(l.typeAnnotation)))return;let p=((e,t,r)=>{var n;let o,a=DH(e);if(a?.type!=="ForOfStatement"||a.await||!Sg(a,r)||DQ(r,e,a)||!Sa(a.right,r)||D9(a.right,r)||Se(a.right,t,r)||D7(a.right,r)||!Sd(a.right,r)||!(!(o=So(a.right,r))||o.length>1&&o.every(e=>Sr(e,r))))return;let s=(e=>{if("VariableDeclaration"!==e.type||"const"!==e.kind||1!==e.declarations.length)return;let[t]=e.declarations;if("Identifier"===t.id.type&&!t.init)return t.id})(a.left);if(!s||!St(s,r))return;let l=Sf("ExpressionStatement"===(n=a.body).type?n:"BlockStatement"===n.type&&1===n.body.length&&"ExpressionStatement"===n.body[0].type?n.body[0]:void 0);if(!l||!rv(rI(l.sourceSignal),s))return;let u=Sm(l.call.arguments[1],t,s,r);if(u)return{abortReferences:new i([u]),replacement:`AbortSignal.any(${((e,t)=>{let r=t.sourceCode.getText(e);if(!Sc(e,t))return r;let n=rI(e);if("ArrayExpression"===n.type)return t.sourceCode.getText(n);let o=n===e?r:`(${r})`;return`[...${o}]`})(a.right,r)})`,statements:[a]}})(s,l.name,t)??((e,t,r)=>{let n=[],o=[],a=new i,s=e,l=DH(e);for(;l;){let e=Sf(l);if(!e||!Sg(l,r)||DQ(r,s,l)||Se(e.sourceSignal,t,r)||D7(e.sourceSignal,r)||!Sr(e.sourceSignal,r))break;let i=Sm(e.call.arguments[1],t,e.sourceSignal,r);if(!i)break;n.push(l),o.push(e.sourceSignal),a.add(i),s=l,l=DH(l)}if(!(n.length<2))return{abortReferences:a,replacement:`AbortSignal.any([${o.map(e=>r.sourceCode.getText(e)).join(", ")}])`,statements:n}})(s,l.name,t);if(!p)return;let c=eg(a.getScope(l),l);if(!c)return;for(let e of p.abortReferences)if(eg(a.getScope(e),e)!==c)return;let d=((e,t,r)=>{let n=[];for(let o of e.references){let{identifier:e}=o;if(t.has(e)||o.init)continue;if(o.isWrite())return;let a=D0(e,r);if(!a)return;n.push(a)}return n.length>0?n:void 0})(c,p.abortReferences,t);if(!d)return;let m=(r=l.name,o=r,("abortController"===r?o="abortSignal":"controller"===r&&(o="signal"),o===r||Sy(o,c,c.identifiers[0],t)||d.some(e=>Sy(o,c,e,t)))?r:o);return{node:l,messageId:DK,suggest:[{messageId:DG,*fix(e){if(yield e.replaceText(u,p.replacement),l.typeAnnotation&&(yield e.replaceText(l.typeAnnotation,": AbortSignal")),m!==l.name){let[t]=a.getRange(l);yield e.replaceTextRange([t,t+l.name.length],m)}for(let t of d)yield e.replaceText(t,m);yield((e,t,r)=>{if(1===e.length)return aM(e[0],t,r);let{sourceCode:n}=t,{lines:o}=n,a=e[0],i=e.at(-1),s=n.getLoc(a).start,l=n.getLoc(i).end,u=o[s.line-1].slice(0,s.column),p=o[l.line-1].slice(l.column),{text:c}=n,[d]=n.getRange(a),[,m]=n.getRange(i);return/^\s*$/.test(u)&&/^\s*$/.test(p)&&(m+=p.length,0===d?"\r"===c[m]&&"\n"===c[m+1]?m+=2:("\n"===c[m]||"\r"===c[m])&&m++:"\r"===c[(d-=u.length)-2]&&"\n"===c[d-1]?d-=2:("\n"===c[d-1]||"\r"===c[d-1])&&d--),r.removeRange([d,m])})(p.statements,t,e)}}]}})(t,e))},meta:{type:"suggestion",docs:{description:"Prefer `AbortSignal.any()` over manually forwarding abort events between signals.",recommended:!0},hasSuggestions:!0,schema:[],messages:{[DK]:"Prefer `AbortSignal.any()` over manually forwarding abort events between signals.",[DG]:"Replace with `AbortSignal.any()`."},languages:["js/js"]}},"unicorn/prefer-block-statement-over-iife":{create:e=>{let{sourceCode:t}=e,{visitorKeys:r}=t;e.on("ExpressionStatement",n=>{let o,a,{expression:i}=n;if("CallExpression"!==i.type||i.optional||i.arguments.length>0)return;let{callee:s}=i;if(!("FunctionExpression"!==s.type&&"ArrowFunctionExpression"!==s.type||s.id||s.async||s.generator||s.params.length>0||"BlockStatement"!==s.body.type||s.body.body.some(e=>tf(e))||Sv(s.body,r,e=>"ReturnStatement"===e.type||"VariableDeclaration"===e.type&&"var"===e.kind||"CallExpression"===e.type&&"Identifier"===e.callee.type&&"eval"===e.callee.name)||(o=s.body,"script"===t.ast.sourceType&&Sv(o,t.visitorKeys,e=>"FunctionDeclaration"===e.type))||(a=s.body,rP(e,SC(n,e.sourceCode),[a]))||"FunctionExpression"===s.type&&Sv(s.body,r,Sx,SE))){let t;return{node:i,messageId:Sh,fix:(t=s.body,r=>r.replaceTextRange(SC(n,e.sourceCode),e.sourceCode.getText(t)))}}})},meta:{type:"suggestion",docs:{description:"Prefer block statements over IIFEs used only for scoping.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[Sh]:"Prefer a block statement over an IIFE used only for scoping."},languages:["js/js"]}},"unicorn/no-multiple-promise-resolver-calls":{create:e=>{let t,{sourceCode:r}=e,n=new s,a=(e,r)=>{var n;t.currentSegments.add(e),n=t,"CatchClause"===r.type&&n.catchClausesBySegment.set(e,r)},u=e=>{t.currentSegments.delete(e)};e.on("onCodePathStart",(a,s)=>{let l=t;t={upper:l,codePath:a,currentSegments:new i,eventsBySegment:new o,executors:new i,catchClausesBySegment:new o,ignoredLoopEdges:[],hasResolverReferences:l?.hasResolverReferences??!1},Sw(s,e)&&function(e,t,r){let n=!1;for(let o of e.params.slice(0,2)){if("Identifier"!==o.type)continue;let a=eg(r.getScope(o),o);if(!(!a||Sk(a)))for(let r of a.references)t.set(r.identifier,e),n=!0}return n}(s,n,r)&&(t.hasResolverReferences=!0)}),e.on("onCodePathEnd",()=>{!function(e,t){var r;let n;if(0===e.executors.size)return;let a=(r=e.codePath,n=[],r.traverseSegments(e=>{e.reachable&&n.push(e)}),n),i=new l;for(let r of e.executors){let n=function(e,t,r){let n,a=new o;do for(let o of(n=!1,r)){let r=function(e,t,r){for(let n of t)e=SF(e,n,r);return e}(SP(o,a,e),e.eventsBySegment.get(o)??[],t);SR(r,a.get(o))||(a.set(o,r),n=!0)}while(n);return a}(e,r,a);for(let o of a){let a=SP(o,n,e);for(let n of e.eventsBySegment.get(o)??[])n.executor===r&&a.resolverCalled&&!i.has(n.node)&&(i.add(n.node),t.report({node:n.node,messageId:SD})),a=SF(a,n,r)}}}(t,e),t=t.upper}),e.on("onCodePathSegmentStart",a),e.on("onUnreachableCodePathSegmentStart",a),e.on("onCodePathSegmentEnd",u),e.on("onUnreachableCodePathSegmentEnd",u),e.on("onCodePathSegmentLoop",(e,r,n)=>{(SL(n)||function(e){if("ContinueStatement"!==e.type)return!1;let t=e.label?.name,r=!1,n=e,{parent:o}=e;for(;o&&!tE(o);){if("TryStatement"===o.type&&o.finalizer&&(o.block===n||o.handler===n)&&(r=!0),t&&"LabeledStatement"===o.type&&o.label.name===t||!t&&tC(o))return r;n=o,{parent:o}=o}return!1}(n))&&t.ignoredLoopEdges.push({previousSegment:e,segment:r})}),e.onExit(["Identifier","CallExpression","ImportExpression","MemberExpression","NewExpression","ThrowStatement","YieldExpression"],r=>{if(!t.hasResolverReferences||"Identifier"===r.type&&(n.has(r)||!SN(r))||"ImportExpression"===r.type&&!SN(r))return;let o=((e,t)=>{if("CallExpression"!==e.type)return;let r=SA(e.callee);return"Identifier"===r.type?t.get(r):void 0})(r,n),{catchClause:a,finallyBlocks:i}=o?{catchClause:void 0,finallyBlocks:function(e){let t=[],r=e,{parent:n}=e;for(;n&&!tE(n);)"TryStatement"===n.type&&n.finalizer===r&&t.push(n.finalizer),r=n,{parent:n}=n;return t}(r)}:function(e){let t=[],r=e,{parent:n}=e;for(;n&&!tE(n);){if("TryStatement"===n.type){if(n.block===r&&n.handler)return{catchClause:n.handler,finallyBlocks:t};n.finalizer&&(n.block===r||n.handler===r)&&t.push(n.finalizer)}r=n,{parent:n}=n}return{catchClause:void 0,finallyBlocks:t}}(r);if((o||a)&&!(function(e){let t=e,{parent:r}=e;for(;r;){if(SL(r)&&("WhileStatement"===r.type&&r.body===t||"ForStatement"===r.type&&(r.body===t||r.update===t)))return!0;t=r,{parent:r}=r}return!1}(r)||o&&function(e,t){let r=e,{parent:n}=e;for(;n;){if("AssignmentPattern"===n.type&&n.right===r&&Sw(n.parent,t)&&n.parent.params.slice(0,2).includes(n))return!0;r=n,{parent:n}=n}return!1}(r,e))){var s=t,l={catchClause:a,finallyBlocks:i,node:r,executor:o};for(let e of s.currentSegments){if(!e.reachable)continue;let t=s.eventsBySegment.get(e);t||(t=[],s.eventsBySegment.set(e,t)),t.push(l)}o&&t.executors.add(o)}})},meta:{type:"problem",docs:{description:"Disallow calling Promise executor resolver functions more than once on the same execution path.",recommended:"unopinionated"},messages:{[SD]:"Promise executor resolver functions may be called multiple times on the same execution path."},languages:["js/js"]}},"unicorn/no-unnecessary-string-trim":{create:e=>{e.on("CallExpression",t=>{if(!tA(t,{methods:SM,maximumArguments:1,optionalCall:!1,optionalMember:!1}))return;let r=t.callee.object;if(!tA(r,{method:"trim",argumentsLength:0,optionalCall:!1,optionalMember:!1})||rX(t))return;let n=r.callee.object;if(((e,t)=>{if(e=rI(e),e=rI(rU(e,t)??e),SU.has(e.type))return!0;let r=Sq(e,t);return!!r&&"string"!=typeof r.value})(n,e)||ot(n,e))return;let{property:o}=t.callee,{property:a}=r.callee,i=o.name,[s]=t.arguments;if(s){let t=((e,t)=>{let r=Sq(e,t);if(!r)return;let{value:n}=r;return null===n||SO.has(typeof n)?String(n):void 0})(s,e);if(void 0===t||("startsWith"===i?t!==t.trimEnd():t!==t.trimStart()))return}let l="startsWith"===i?"trimStart":"trimEnd";return{node:a,messageId:S$,data:{method:i,replacement:l},fix:e=>e.replaceText(a,l)}})},meta:{type:"suggestion",docs:{description:"Disallow `String#trim()` before `String#startsWith()` or `String#endsWith()`.",recommended:"unopinionated"},fixable:"code",messages:{[S$]:"Prefer `String#{{replacement}}()` before `String#{{method}}()`."},languages:["js/js"]}},"unicorn/no-useless-re-export":{create:e=>{let{sourceCode:t}=e,r=[],n=[];e.on("ExportAllDeclaration",e=>{e.exported||r.push({node:e,request:S_(e,t)})}),e.on("ExportNamedDeclaration",e=>{e.source&&n.push(e)});let o=(e,n)=>{let o=SW(n.exported);if("default"===o)return;let a=SW(n.local),[i]=t.getRange(n.local),[s]=t.getRange(n.exported);if(a===o&&i!==s)return;let l="type"===n.exportKind||"type"===e.exportKind,u=S_(e,t);if(a===o&&r.some(e=>e.request===u&&"default"!==o&&("type"!==e.node.exportKind||l)))return{node:n,messageId:SV}};e.on("Program:exit",function*(){if(1===new i(r.map(e=>e.request)).size)for(let e of n)for(let t of e.specifiers){let r=o(e,t);r&&(yield r)}})},meta:{type:"suggestion",docs:{description:"Disallow redundant re-exports.",recommended:"unopinionated"},schema:[],messages:{[SV]:"This export is redundant because the same module is already exported with `export *`."},languages:["js/js"]}}}).map(([e,t])=>{let r;return[e,{meta:{schema:[],...t.meta,docs:{...t.meta.docs,url:(r=E.basename(e,".js"),`https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v72.0.0/docs/rules/${r}.md`)}},create:o_(t.create)}]})))};module.exports=Sz;
|
|
57
|
+
${i}});`)}(a,s,e)),u})},meta:{type:"suggestion",docs:{description:"Prefer `Object.defineProperties()` over multiple `Object.defineProperty()` calls.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[xe]:"Prefer `Object.defineProperties()` over multiple `Object.defineProperty()` calls."},languages:["js/js"]}},"unicorn/prefer-object-destructuring-defaults":{create:e=>{e.on("VariableDeclarator",t=>{let{id:r,init:n}=t;if("ObjectPattern"!==r.type||n?.type!=="ObjectExpression"||0!==e.sourceCode.getCommentsInside(t).length)return;let a=((e,t)=>{if(e.typeAnnotation)return;let r=[];for(let n of e.properties){if(!(xi(n)&&"Identifier"===n.value.type))return;let e=eO(n,t.sourceCode.getScope(n));if(null===e||xo.has(e))return;r.push({node:n,name:e})}return r})(r,e),s=((e,t)=>{let{properties:r}=e,n=r.at(-1);if(n?.type!=="SpreadElement"||ez(n.argument,t.sourceCode,xa))return;let a=new o;for(let e of r.slice(0,-1)){if(!xi(e)||ez(e.value,t.sourceCode,xa))return;let r=eO(e,t.sourceCode.getScope(e));if(null===r||a.has(r))return;a.set(r,e)}return{defaultProperties:a,spreadElement:n}})(n,e);if(!a||0===a.length||!s)return;let{defaultProperties:l,spreadElement:u}=s;if(a.length!==l.size)return;let p=new i(a.map(e=>e.node.value.name)),c=[];for(let t of a){let r=l.get(t.name);if(!r||xs(r.value,p,e))return;c.push(xl(t,r,e))}return{node:t,messageId:xr,suggest:[{messageId:xn,fix:r=>r.replaceText(t,`{${c.join(", ")}} = {${e.sourceCode.getText(u)}}`)}]}})},meta:{type:"suggestion",docs:{description:"Prefer object destructuring defaults over default object literals with spread.",recommended:!0},hasSuggestions:!0,schema:[],messages:{[xr]:"Prefer object destructuring defaults over default object literals with spread.",[xn]:"Use object destructuring defaults."},languages:["js/js"]}},"unicorn/prefer-single-object-destructuring":{create:e=>{let{sourceCode:t}=e;e.on("Program",e=>xd(t,e.body)),e.on(["BlockStatement","StaticBlock"],e=>xd(t,e.body)),e.on("SwitchCase",e=>xd(t,e.consequent))},meta:{type:"suggestion",docs:{description:"Prefer a single object destructuring declaration per local const source.",recommended:!0},fixable:"code",schema:[],messages:{[xu]:"Prefer a single object destructuring declaration from `{{source}}`."},languages:["js/js"]}},"unicorn/prefer-smaller-scope":{create:e=>{let{sourceCode:t}=e;e.on("VariableDeclaration",e=>(function(e,t){if(!(e.parent&&("Program"===e.parent.type||"BlockStatement"===e.parent.type)&&"let"===e.kind&&1===e.declarations.length&&"Identifier"===e.declarations[0].id.type&&!e.declarations[0].init))return;let[r]=e.declarations,[n]=t.getDeclaredVariables(r),o=n.references.filter(e=>!e.init),a=o.filter(e=>e.isWrite());if(1!==a.length||o.every(e=>!e.isRead()))return;let i=function(e){let{identifier:t}=e,r=t.parent;if("AssignmentExpression"!==r.type||"="!==r.operator||r.left!==t||"ExpressionStatement"!==r.parent.type)return;let n=r.parent,o=n.parent;if("BlockStatement"===o.type)return{assignmentExpression:r,assignmentStatement:n,block:o}}(a[0]);if(!i)return;let{assignmentExpression:s,assignmentStatement:l,block:u}=i,[,p]=t.getRange(e),[c,d]=t.getRange(l);if(!xg(u,e.parent)||function e(t,r){if("WithStatement"===t.type||"CallExpression"===t.type&&"Identifier"===t.callee.type&&"eval"===t.callee.name)return!0;for(let n of r[t.type]??[]){let o=t[n];if(Array.isArray(o)){if(o.some(t=>t&&e(t,r)))return!0}else if(o&&e(o,r))return!0}return!1}(e.parent,t.visitorKeys)||c<p||o.some(e=>!xg(e.identifier,u))||o.some(e=>e.isRead()&&t.getRange(e.identifier)[0]<d))return;let m={node:r.id,messageId:xm,data:{name:r.id.name}};return r.id.typeAnnotation||xh(t,s)&&"SequenceExpression"===s.right.type||t.getCommentsInside(e).length>0||t.getCommentsInside(l).length>0||xy(t,e,"before")||xy(t,e,"after")||xy(t,l,"before")||xy(t,l,"after")||(m.fix=function({sourceCode:e,declaration:t,assignmentExpression:r,assignmentStatement:n,name:o}){return function*(a){yield aO(t,{sourceCode:e},a);let i=`const ${o} = `;if(xh(e,r))return void(yield a.replaceText(n,`${i}${e.getText(r.right)};`));let[s]=e.getRange(r),[l]=e.getRange(r.right);yield a.replaceTextRange([s,l],i)}}({sourceCode:t,declaration:e,assignmentExpression:s,assignmentStatement:l,name:r.id.name})),m})(e,t))},meta:{type:"suggestion",docs:{description:"Prefer declaring variables in the smallest possible scope.",recommended:!0},fixable:"code",schema:[],messages:{[xm]:"Move `{{name}}` into the block where it is used."},languages:["js/js"]}},"unicorn/prefer-single-array-predicate":{create:e=>{e.on("LogicalExpression",t=>{if("LogicalExpression"===t.parent.type&&t.parent.operator===t.operator)return;let r=xE.get(t.operator);if(!r||e.sourceCode.getCommentsInside(t).length>0)return;let n=(function e(t,r){return"LogicalExpression"!==t.type||t.operator!==r?[t]:[...e(t.left,r),...e(t.right,r)]})(t,t.operator).map(t=>(function(e,t,r){if(!tw(e,{method:t,argumentsLength:1,optionalCall:!1,optionalMember:!1})||e.typeArguments||e.typeParameters)return;let{object:n}=e.callee;if(nv(n,r))return;let o=function(e){if("ArrowFunctionExpression"===e.type&&!e.async&&!e.returnType&&!e.typeParameters&&1===e.params.length&&"Identifier"===e.params[0].type&&"BlockStatement"!==e.body.type)return{parameter:e.params[0],body:e.body}}(e.arguments[0]);if(o){var a;let t;return{node:e,object:n,callback:{...o,parameterText:(a=o.parameter,t=r.sourceCode.getText(a),a.typeAnnotation||a.optional?`(${t})`:t)}}}})(t,r,e));if(!(n.length<2||n.includes(void 0)||n.some(e=>{let t;return t=n[0],!rC(t.object,e.object)||t.callback.parameterText!==e.callback.parameterText})))return{node:t,messageId:xx,data:{method:r},suggest:[{messageId:xb,data:{method:r},fix:r=>r.replaceText(t,function(e,t,r){let{sourceCode:n}=r,[o]=e,{callback:a}=o,i=e.map(({callback:e})=>(function(e,t,r){var n,o;if(e7(e,r))return e4(e,r);let a=r.sourceCode.getText(e);return(n=e,o=t,"LogicalExpression"===n.type?n.operator!==o&&("||"!==o||"&&"!==n.operator):xv.has(n.type))?`(${a})`:a})(e.body,t,r)).join(` ${t} `);return`${n.getText(o.node.callee)}(${a.parameterText} => ${i})`}(n,t.operator,e))}]}})},meta:{type:"suggestion",docs:{description:"Prefer a single `Array#some()` or `Array#every()` with a combined predicate.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[xx]:"Prefer a single `Array#{{method}}()` with a combined predicate.",[xb]:"Merge predicates into one `Array#{{method}}()` call."},languages:["js/js"]}},"unicorn/prefer-url-href":{create:e=>{e.on("CallExpression",t=>{if(tw(t,{method:"toString",argumentsLength:0,optionalCall:!1,optionalMember:!1,computed:!1})&&"url"===xU(t.callee.object,e)){let r={node:t.callee.property,messageId:xC};return xV(t,e)&&!e7(t.callee,e)&&xq(t.callee.object,e)&&(r.fix=r=>r.replaceTextRange([e.sourceCode.getRange(t.callee.property)[0],e.sourceCode.getRange(t)[1]],"href")),r}if(!(tm(t,{name:"String",argumentsLength:1,optional:!1},tp)&&of(t.callee,e)))return;let[r]=t.arguments;if("url"!==xU(r,e))return;let n={node:t.callee,messageId:xC};return xV(t,e)&&xq(r,e)&&(n.fix=n=>{let o,a,i;return n.replaceText(t,(o=e4(r,e),a=!e7(r,e)&&oZ(r,e)?`(${o})`:o,i=`${a}.href`,(oD(e.sourceCode.getTokenBefore(r.parent),e,i)?";":"")+i))}),n})},meta:{type:"suggestion",docs:{description:"Prefer `URL#href` over stringifying a `URL`.",recommended:"unopinionated"},fixable:"code",messages:{[xC]:"Prefer `URL#href` over stringifying a `URL`."},languages:["js/js"]}},"unicorn/require-proxy-trap-boolean-return":{create:e=>{let{sourceCode:t}=e,r=new s,n=[];function*o(e){let n;if(!(tf(n=e,{name:"Proxy",argumentsLength:2})||tw(n,{object:"Proxy",method:"revocable",argumentsLength:2,optionalCall:!1,optionalMember:!1,computed:!1})))return;let o=e.arguments[1];if("ObjectExpression"===o.type)for(let e of o.properties){let n=xH(e,t);if(!n)continue;let o=xQ(n,t,r);o&&(yield o)}}e.on("onCodePathStart",()=>{n.push(new i)}),e.on("onCodePathEnd",()=>{n.pop()}),e.on("onCodePathSegmentStart",e=>{n.at(-1).add(e)}),e.on("onCodePathSegmentEnd",e=>{n.at(-1).delete(e)}),e.on("onUnreachableCodePathSegmentStart",e=>{n.at(-1).add(e)}),e.on("onUnreachableCodePathSegmentEnd",e=>{n.at(-1).delete(e)}),e.onExit("BlockStatement",e=>{if(!(xz.has(e.parent?.type)&&e.parent.body===e))return;let t=[...n.at(-1)].every(e=>!e.reachable);r.set(e.parent,t)}),e.onExit("CallExpression",o),e.onExit("NewExpression",o)},meta:{type:"problem",docs:{description:"Require boolean-returning Proxy traps to return booleans.",recommended:"unopinionated"},fixable:"code",messages:{[xW]:"Proxy trap `{{name}}` should return a boolean."},languages:["js/js"]}},"unicorn/logical-assignment-operators":x8,"unicorn/no-useless-coercion":{create:e=>{let{sourceCode:t}=e,r=(r,n,o,a)=>({node:r,messageId:x6,data:{description:o,type:a},*fix(o,{abort:a}){if(t.getCommentsInside(r).length>0)return a();yield aI(o,r,n,e)}});e.on("CallExpression",t=>{if(t.optional||"Identifier"!==t.callee.type||1!==t.arguments.length||"SpreadElement"===t.arguments[0].type)return;let{name:n}=t.callee,o=x9.get(n);if(!o||!of(t.callee,e))return;let[a]=t.arguments;if(o.isType(a,e))return r(t,a,`\`${n}()\``,o.type)}),e.on("UnaryExpression",e=>{if("+"===e.operator&&n_(e.argument,t.getScope(e.argument)))return r(e,e.argument,"`+`","number")}),e.on("BinaryExpression",t=>{let n;if("+"!==t.operator)return;let{left:o,right:a}=t;if(te(a,"")&&on(o,e))n=o;else{if(!(te(o,"")&&on(a,e)))return;n=a}return r(t,n,"Concatenation with `''`","string")}),e.on("CallExpression",t=>{let{callee:n}=t;if(!t.optional&&!(t.arguments.length>0)&&"MemberExpression"===n.type&&!n.optional&&!n.computed&&"Identifier"===n.property.type&&"toString"===n.property.name&&on(n.object,e))return r(t,n.object,"`.toString()`","string")})},meta:{type:"suggestion",docs:{description:"Disallow useless type coercions of values that are already of the target type.",recommended:"unopinionated"},fixable:"code",messages:{[x6]:"{{description}} is unnecessary because the value is already a {{type}}."},languages:["js/js"]}},"unicorn/no-useless-boolean-cast":{create:e=>{let{sourceCode:t}=e;e.on("CallExpression",r=>{if(!tw(r,{methods:x4,minimumArguments:1,maximumArguments:2,optionalCall:!1,optionalMember:!1}))return;let[n]=r.arguments;if(!tv(n))return;let o=function(e){if(!e.async&&!e.generator&&!e.returnType){if("ArrowFunctionExpression"===e.type&&"BlockStatement"!==e.body.type)return e.body;if("BlockStatement"===e.body.type&&1===e.body.body.length&&"ReturnStatement"===e.body.body[0].type)return e.body.body[0].argument}}(n);if(!tU(o,e)||t.getCommentsInside(o).length>0)return;let[a]=o.arguments;if(!(n.params[0]?.type==="Identifier"&&om(n.params[0],a))&&!(function e(t){return(t=rj(t),t?.type==="ChainExpression")?rY(t):t?.type==="LogicalExpression"?"&&"===t.operator&&e(t.left)||e(t.right):t?.type==="ConditionalExpression"?e(t.consequent)||e(t.alternate):t?.type==="SequenceExpression"&&e(t.expressions.at(-1))}(a)||function(e,t){let{parserServices:r}=t.sourceCode;if(!r?.program)return!1;try{let t=r.getTypeAtLocation(e);return(t.isUnion()?t.types:[t]).some(e=>"void"===e.intrinsicName||r1.has(e.intrinsicName))}catch{return!1}}(a,e)))return{node:o,messageId:x5,data:{method:r.callee.property.name},fix(e){let r,i=t.getText(a);return"ArrowFunctionExpression"===n.type&&n.body===o&&(r=i,"SequenceExpression"===a.type||r.trimStart().startsWith("{"))&&(i=`(${i})`),e.replaceText(o,i)}}})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary `Boolean()` casts in array predicate callbacks.",recommended:"unopinionated"},fixable:"code",messages:{[x5]:"`Boolean()` is unnecessary in `Array#{{method}}()` callbacks."},languages:["js/js"]}},"unicorn/no-useless-continue":{create:e=>{e.on("ContinueStatement",t=>{if(!t.label&&(e=>{if("BlockStatement"!==e.parent.type)return!1;let t=e;for(;;){let{parent:e}=t;if("BlockStatement"===e.type){if(e.body.at(-1)!==t)return!1;t=e;continue}if("IfStatement"===e.type&&(e.consequent===t||e.alternate===t)){t=e;continue}return tD(e)&&e.body===t}})(t))return{node:t,messageId:x7,fix:r=>aO(t,e,r)}})},meta:{type:"suggestion",docs:{description:"Disallow useless `continue` statements.",recommended:"unopinionated"},fixable:"code",messages:{[x7]:"Unnecessary `continue` statement."},languages:["js/js"]}},"unicorn/no-useless-override":{create:e=>{let{sourceCode:t}=e;e.on("MethodDefinition",r=>{let n;if("method"!==r.kind||r.accessibility||r.optional||r.decorators?.length>0||r.value.params.some(e=>e.decorators?.length>0))return;let{value:o}=r;if("FunctionExpression"!==o.type||!o.body||o.generator||!r.parent.parent.superClass)return;let a=function(e,t){let r,n,o,{value:a}=e;if(1!==a.body.body.length)return;let[i]=a.body.body;if("ReturnStatement"===i.type?r=i.argument:"ExpressionStatement"===i.type&&(r=i.expression),r?.type!=="CallExpression"||r.optional)return;let{callee:s}=r;if("MemberExpression"!==s.type||s.optional||"Super"!==s.object.type)return;let l=t.getScope(r),u=eO(e,l);if("string"==typeof u&&eO(s,l)===u&&(n=r.arguments,o=a.params,n.length===o.length&&o.every((e,t)=>{let r=n[t];return"Identifier"===e.type?"Identifier"===r.type&&r.name===e.name:"RestElement"===e.type&&"Identifier"===e.argument.type&&"SpreadElement"===r.type&&"Identifier"===r.argument.type&&r.argument.name===e.argument.name})))return{callExpression:r,name:u,isReturned:"ReturnStatement"===i.type}}(r,t);if(!a)return;let{callExpression:i,name:s,isReturned:l}=a;if(n=t.getScope(r),!r.parent.body.some(e=>e!==r&&"MethodDefinition"===e.type&&"method"===e.kind&&e.static===r.static&&null===e.value.body&&eO(e,n)===s)){if(l){let t;if(o.async&&(void 0===(t=br(i,e))||!0!==oc(t.type,t.checker)))return}else{let t;if(o.async||!(void 0!==(t=br(i,e))&&bt(t.type)))return}return{node:r.key,messageId:be,data:{superCall:t.getText(i.callee)},*fix(n,{abort:o}){if(t.getCommentsInside(r).length>0)return o();yield aW(r,"",n,e)}}}})},meta:{type:"suggestion",docs:{description:"Disallow useless overrides of class methods.",recommended:"unopinionated"},fixable:"code",messages:{[be]:"Useless override; this method only forwards to `{{superCall}}(…)`."},languages:["js/js"]}},"unicorn/prefer-has-check":{create:e=>{e.on("CallExpression",t=>((e,t)=>{if(!tw(e,{method:"get",argumentsLength:1,computed:!1,optionalCall:!1,optionalMember:!1,allowSpreadElement:!1}))return;let r=(e=>{let t=(e=>{for(;by.has(e.parent?.type)&&e.parent.expression===e;)e=e.parent;return e})(e),{parent:r}=t;if(r?.type==="BinaryExpression"&&["!==","===","!=","=="].includes(r.operator)){if(r.left===t)return{node:r,operator:r.operator,value:r.right};if(r.right===t)return{node:r,operator:r.operator,value:r.left}}})(e);if(r){let n,o;if(t.sourceCode.getCommentsInside(e).length>0)return;let a=((e,t,r)=>{let n=bF(e.callee.object,r);if(!n)return;let o="!="===t.operator||"=="===t.operator;if("null-sentinel"===n.kind)return o&&bD(t.value,r)?{missingType:"undefined"}:{missingType:"null"};if("map"===n.kind){if(bD(t.value,r)&&bM(e.callee.object,r,o?"not-nullish":"not-undefined"))return{missingType:"undefined"};if(ti(t.value)&&o&&bM(e.callee.object,r,"not-nullish"))return{missingType:"nullish"}}})(e,r,t);if(!a||(n=r.value,o=a.missingType,"undefined"===o?!bD(n,t):!ti(n)))return;return{node:e.callee.property,messageId:bn,fix:((e,t,r)=>{var n;let o;if(r.sourceCode.getCommentsInside(t.node).length>r.sourceCode.getCommentsInside(e).length)return;let a=`${(({operator:e})=>"!=="===e||"!="===e)(t)?"":"!"}${(o=e4(n=e.callee.object,r),!e7(n,r)&&oZ(n,r)?`(${o})`:o)}.has(${((e,t)=>{let[r]=e.arguments;return t.sourceCode.getText(r)})(e,r)})`;return e=>e.replaceText(t.node,a)})(e,r,t)}}if((tq(e,t)||tV(e))&&bF(e.callee.object,t)?.kind==="map"&&bM(e.callee.object,t,"truthy")){if(t.sourceCode.getCommentsInside(e).length>0)return;return{node:e.callee.property,messageId:bn,fix:t=>t.replaceText(e.callee.property,"has")}}})(t,e))},meta:{type:"suggestion",docs:{description:"Prefer `.has()` when checking existence.",recommended:"unopinionated"},fixable:"code",messages:{[bn]:"Prefer `.has(…)` when checking existence."},languages:["js/js"]}},"unicorn/consistent-conditional-object-spread":{create:e=>{e.options[0]===bU?e.on("LogicalExpression",t=>{if(bz(t)){if("&&"!==t.operator||b_(t.right)||bK(t.left,t.right,e.sourceCode))return;let r=bY(t.left,e.sourceCode);if(r&&!r.isTrueWhenNullish&&bK(r.reference,t.right,e.sourceCode))return;let n=bQ(t.left,e),o=bQ(t.right,e);return{node:t,messageId:bq,data:{expectedStyle:"ternary"},*fix(r,{abort:a}){if(e.sourceCode.getCommentsInside(t).length>0)return a();yield r.replaceText(t,`${n} ? ${o} : {}`)}}}}):e.on("ConditionalExpression",t=>{if(bz(t))return function(e,t){let{test:r,consequent:n,alternate:o}=e,a=b_(o);if(a===b_(n))return;let i=a?n:o,s=bY(r,t.sourceCode),l=t.sourceCode.getCommentsInside(e).length>0;if((a?bK(r,i,t.sourceCode):"UnaryExpression"===r.type&&"!"===r.operator&&r.prefix&&bK(r.argument,i,t.sourceCode))||s&&!l&&(s.isTrueWhenNullish?!a:a)&&bK(s.reference,i,t.sourceCode))return;let u=a?bH(r,"left",t):function(e,t){if("UnaryExpression"===e.type&&"!"===e.operator&&e.prefix)return bH(e.argument,"left",t);let r=e4(e,t);return!e7(e,t)&&o2(e,"!")&&(r=`(${r})`),`!${r}`}(r,t),p=bH(i,"right",t);return{node:e,messageId:bq,data:{expectedStyle:"logical"},*fix(t,{abort:r}){if(l)return r();yield t.replaceText(e,`${u} && ${p}`)}}}(t,e)})},meta:{type:"suggestion",docs:{description:"Enforce consistent conditional object spread style.",recommended:!0},fixable:"code",schema:[{description:"The conditional object spread style to enforce.",enum:[bO,bU]}],defaultOptions:[bO],messages:{[bq]:"Prefer {{expectedStyle}} conditional object spreads."},languages:["js/js"]}},"unicorn/default-export-style":Ef,"unicorn/no-array-concat-in-loop":{create:e=>{e.on("AssignmentExpression",t=>{let r=function(e,t){var r;if("="!==e.operator)return;let n="Identifier"===e.left.type?e.left:void 0,o=Eg(e.right);if(!n||!tw(o,{method:"concat",minimumArguments:1,optionalCall:!1,optionalMember:!1,computed:!1}))return;let a=(r=Eg(r=o.callee.object),r?.type==="Identifier"?r:void 0),i=Ey(n,t);if(!a||!i||i!==Ey(a,t)||!function(e){let[t]=e?.defs??[];if(!t||1!==e.defs.length||"global"===e.scope.type||"Variable"!==t.type||"Identifier"!==t.node.id.type||"let"!==t.parent.kind&&"var"!==t.parent.kind)return!1;let r=t.node.init&&Eg(t.node.init);return!!(r&&th(r))}(i))return;let s=function(e,t){for(let r of t.sourceCode.getAncestors(e).toReversed()){if(tv(r))return;if(tD(r))return r}}(e,t),[l]=i.defs;if(!(!s||function(e,t,r){let[n,o]=r.sourceCode.getRange(e),[a,i]=r.sourceCode.getRange(t);return n>=a&&o<=i}(l.node,s.body,t)))return{callExpression:o,property:o.callee.property}}(t,e);if(r)return{node:r.property,messageId:Eh}})},meta:{type:"suggestion",docs:{description:"Disallow array accumulation with `Array#concat()` in loops.",recommended:!0},schema:[],messages:{[Eh]:"Do not use `Array#concat()` to accumulate an array in a loop."},languages:["js/js"]}},"unicorn/no-array-front-mutation":{create:e=>{e.on("CallExpression",t=>{if(!tw(t,{methods:["shift","unshift"],optionalCall:!1,computed:!1}))return;let{object:r,property:n}=t.callee,{name:o}=n;if(!("unshift"===o&&tB(t.callee,Eb)||nD(r,e)))return{node:n,messageId:Ex,data:{method:o}}})},meta:{type:"suggestion",docs:{description:"Disallow front-of-array mutation.",recommended:!1},schema:[],messages:{[Ex]:"Avoid front-of-array mutation with `Array#{{method}}()`."},languages:["js/js"]}},"unicorn/no-array-sort-for-min-max":{create:e=>{e.on("MemberExpression",t=>{if(!t.computed||t.optional||!EC(t.property)||nL(t)||("ForInStatement"===t.parent.type||"ForOfStatement"===t.parent.type)&&t.parent.left===t)return;let r=ED(t.object,e);if(r)return ES(t,r,"first",e)}),e.on("CallExpression",t=>{let r;if(!tw(t,{method:"at",argumentsLength:1,optionalCall:!1,optionalMember:!1}))return;let[n]=t.arguments;if(EC(n)?r="first":tk(n)&&(r="last"),!r||nL(t))return;let o=ED(t.callee.object,e);if(o)return ES(t,o,r,e)})},meta:{type:"suggestion",docs:{description:"Disallow sorting arrays to get the minimum or maximum value.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[EE]:"Use `Math.{{method}}()` instead of sorting to get the {{extreme}} value.",[Ev]:"Replace with `{{replacement}}`."},languages:["js/js"]}},"unicorn/no-boolean-sort-comparator":{create:e=>{e.on("CallExpression",t=>{let r,n;if(r=t,n=e,!(tm(r,{minimumArguments:1},tp)&&"MemberExpression"===r.callee.type&&Ew.has(eO(r.callee,n.sourceCode.getScope(r.callee))))||nv(t.callee.object,e))return;let[o]=t.arguments;if("SpreadElement"!==o.type){let t=rj(o);if(tv(t)){let r=(e=>{if("BlockStatement"!==e.body.type)return e.body;if(1!==e.body.body.length)return;let[t]=e.body.body;if("ReturnStatement"===t.type)return t.argument})(t);if(!n2(t,e)&&!Ej(o,e))return;return{node:o,messageId:ET,suggest:o===t?((e,t,r)=>{var n;if(!t||2!==e.params.length||e.params.some(e=>"Identifier"!==e.type)||e.params.some(e=>e.typeAnnotation)||e.params.some(e=>e.optional)||e.typeParameters||e.returnType||r.sourceCode.getCommentsInside(e).length>0)return;let[o,a]=e.params;if(o.name===a.name)return;let i="BinaryExpression"===(n=rj(n=t)).type&&Ek.has(n.operator)?n:void 0;if(!i||rI(i.left)||rI(i.right)||!EI(i.left,i.right,o,a))return;let[s,l]=">"===i.operator||">="===i.operator?[i.left,i.right]:[i.right,i.left],u=`(${o.name}, ${a.name}) => ${r.sourceCode.getText(s)} - ${r.sourceCode.getText(l)}`;return[{messageId:EA,data:{replacement:u},fix:t=>t.replaceText(e,u)}]})(t,r,e):void 0}}return n3(t,e)||function(e,t){if("Identifier"===e.type)return("Boolean"===e.name||nG.has(e.name))&&t.sourceCode.isGlobalReference(e);if("MemberExpression"!==e.type||e.optional||"Identifier"!==e.object.type||!t.sourceCode.isGlobalReference(e.object))return!1;let r=nJ.get(e.object.name),n=eO(e,t.sourceCode.getScope(e));return!!r?.has(n)}(t,e)||Ej(o,e)?{node:o,messageId:ET}:void 0}})},meta:{type:"problem",docs:{description:"Disallow boolean-returning sort comparators.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[ET]:"Do not return a boolean from a sort comparator.",[EA]:"Replace with `{{replacement}}`."},languages:["js/js"]}},"unicorn/no-chained-comparison":{create:e=>{let{sourceCode:t}=e;e.on("BinaryExpression",r=>{if(!EL.has(r.operator))return;let n=EN(r.left)?r.left:r.right;if(!EN(n))return;let o=n===r.left,a=o?r.right:r.left;if(EP.has(r.operator)&&n6(a,e))return;let i={node:r,messageId:EF},s=ER.has(n.operator)===ER.has(r.operator)&&!tr(r.right);if(o&&s&&!EN(r.right)&&!EN(n.left)&&((e,t)=>{if(e7(e,t))return!0;let{parent:r}=e;return"BinaryExpression"!==r.type&&("LogicalExpression"!==r.type||"??"!==r.operator)})(r,e)&&!ez(n.right,t)&&0===t.getCommentsInside(r).length){let o=`${t.getText(r.left)} && ${e4(n.right,e)} ${r.operator} ${e4(r.right,e)}`;i.suggest=[{messageId:EB,data:{replacement:o},fix:e=>e.replaceText(r,o)}]}return i})},meta:{type:"problem",docs:{description:"Disallow chained comparisons such as `a < b < c`.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[EF]:"Comparison operators cannot be chained. The inner comparison evaluates to a boolean, which is then compared instead of the operands.",[EB]:"Replace with `{{replacement}}`."},languages:["js/js"]}},"unicorn/no-constant-zero-expression":{create:e=>{let{sourceCode:t}=e;e.on("BinaryExpression",e=>{if(!(e=>{switch(e.operator){case"*":case"&":return te(e.left,0)||te(e.right,0);case"/":return te(e.left,0);default:return!1}})(e))return;let r={node:e,messageId:E$},n=e$(e,t.getScope(e));return n&&Object.is(n.value,0)&&0===t.getCommentsInside(e).length&&(r.suggest=[{messageId:EM,fix:t=>t.replaceText(e,"0")}]),r})},meta:{type:"problem",docs:{description:"Disallow arithmetic and bitwise operations that always evaluate to `0`.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[E$]:"This operation always evaluates to `0` (or `-0`/`NaN`), which is likely a mistake.",[EM]:"Replace this expression with `0`."},languages:["js/js"]}},"unicorn/no-duplicate-logical-operands":{create:e=>{e.on("LogicalExpression",t=>{let r,n;if("&&"!==t.operator&&"||"!==t.operator)return;let o="LogicalExpression"===t.left.type&&t.left.operator===t.operator?t.left.right:t.left;if((e=>{for(let t=e.parent;t;t=t.parent)if("WithStatement"===t.type)return!0;return!1})(t)||!EW(o)||!EW(t.right)||!ux(o,t.right))return;let a={node:t.right,messageId:EO};if(r=t.left,!e.sourceCode.getCommentsInside(t).every(t=>((e,t,r)=>{let[n,o]=r.sourceCode.getRange(e),[a,i]=e5(t,r);return n>=a&&o<=i})(t,r,e)))return a;let i=e4(t.left,e),s=e=>e.replaceText(t,i);return EV.has(o.type)&&(n=t.right,EV.has(n.type))?{...a,fix:s}:{...a,suggest:[{messageId:EU,fix:s}]}})},meta:{type:"problem",docs:{description:"Disallow adjacent duplicate operands in logical expressions.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,schema:[],messages:{[EO]:"This operand duplicates the left operand.",[EU]:"Remove the duplicate operand."},languages:["js/js"]}},"unicorn/no-impossible-length-comparison":{create:e=>{e.on("BinaryExpression",t=>{let r,n,o,a;if(!Object.hasOwn(Ez,t.operator))return;let i=(r=rj(t.left),n=rj(t.right),r_(r)?{memberExpression:r,operator:t.operator,value:e$(n,e.sourceCode.getScope(n))?.value}:r_(n)?{memberExpression:n,operator:Ez[t.operator],value:e$(r,e.sourceCode.getScope(r))?.value}:void 0);if(!i)return;let{memberExpression:s}=i;if("ThisExpression"===(o=rj(s.object)).type||"Super"===o.type||function e(t){return!!("ChainExpression"===(t=rj(t)).type||rY(t))||("MemberExpression"===t.type?e(t.object):"CallExpression"===t.type&&e(t.callee))}(s.object)||(a=e$(s,e.sourceCode.getScope(s)))&&(!Number.isSafeInteger(a.value)||a.value<0)||function({node:e,lengthOrSizeNode:t}){let r=function(e){for(;tN(e.parent)&&"&&"===e.parent.operator;)e=e.parent;return e}(e);return"LogicalExpression"===r.type&&"&&"===r.operator&&(function e(t){return[t.left,t.right].flatMap(r=>"LogicalExpression"===r.type&&r.operator===t.operator?e(r):[r])})(r).some(r=>r!==e&&tT(r,{computed:!1,optional:!1})&&"Identifier"===r.property.type&&rW.has(r.property.name)&&rC(r.object,t.object))}({node:t,lengthOrSizeNode:s}))return;let l=function({operator:e,value:t}){if("number"==typeof t&&Number.isFinite(t))switch(e){case"<":return!(t<=0)&&void 0;case"<=":case"===":case"==":return!(t<0)&&void 0;case">":case"!==":case"!=":return t<0||void 0;case">=":return t<=0||void 0}}(i);if(void 0!==l)return{node:t,messageId:E_,data:{property:s.property.name,result:String(l)}}})},meta:{type:"problem",docs:{description:"Disallow impossible comparisons against `.length` or `.size`.",recommended:"unopinionated"},messages:{[E_]:"This comparison is always {{result}} because `.{{property}}` is always a non-negative integer."},languages:["js/js"]}},"unicorn/no-invalid-character-comparison":{create:e=>{e.on("BinaryExpression",t=>{if(EG.has(t.operator))for(let[r,n]of[[t.left,t.right],[t.right,t.left]]){let o=tn(n);if(void 0!==o&&o.length>1&&EJ(r,e)){let e="!=="===t.operator||"!="===t.operator;return{node:t,messageId:EK,data:{string:o,result:e?"true":"false"}}}}})},meta:{type:"problem",docs:{description:"Disallow comparing a single character from a string to a multi-character string.",recommended:"unopinionated"},schema:[],messages:{[EK]:"A single character can never equal the multi-character string `{{string}}`, so this comparison is always {{result}}."},languages:["js/js"]}},"unicorn/no-loop-iterable-mutation":{create:e=>{let t=new l,r=o7(e);e.onExit("ForOfStatement",n=>{if(n.await)return;let o=E9(n.right,e);if(o)return function* e(t,r,n,o){if(E1.has(t.type))return;let a=n;if("ForOfStatement"===t.type&&!t.await){let e=E9(t.right,o);e&&ve(e.reference,r.iterable,o)&&(a=E4(t,e))}if("CallExpression"===t.type){let e=function(e,t,r,n){if("MemberExpression"!==e.callee.type)return;let{addArgumentIdentifier:o,deleteArgumentIdentifier:a,iterable:i,reportedCallExpressions:s,setKeyIdentifier:l}=t,{object:u,property:p}=e.callee,c=eO(e.callee,n.sourceCode.getScope(e.callee));if(!(!EZ[t.collectionKind??"unknown"].has(c)||!ve(u,i,n)||"delete"===c&&vt(e,a,n)||vr(e,{addArgumentIdentifier:o,setKeyIdentifier:l},c,n)&&!function e(t,r,n){let o=function(e){let t=e;for(;t.parent&&"BlockStatement"!==t.parent.type&&"SwitchCase"!==t.parent.type;)t=t.parent;if(t.parent)return{parent:t.parent,statement:t,statements:"SwitchCase"===t.parent.type?t.parent.consequent:t.parent.body}}(t);if(!o)return!1;let{statement:a,statements:i}=o,s=i.indexOf(a);return!!i.slice(0,s).some(e=>(function e(t,r,n){let o=function(e){if("ExpressionStatement"!==e.type)return;let t=rj(e.expression);return"CallExpression"===t.type?t:void 0}(t);if(o)return"MemberExpression"===o.callee.type&&"delete"===eO(o.callee,n.sourceCode.getScope(o.callee))&&ve(o.callee.object,r.iterable,n)&&vt(o,r.deleteArgumentIdentifier,n);return"BlockStatement"===t.type?t.body.some(t=>e(t,r,n)):"IfStatement"===t.type&&(!r.branchAlwaysExits(t.consequent)&&e(t.consequent,r,n)||t.alternate&&!r.branchAlwaysExits(t.alternate)&&e(t.alternate,r,n))})(e,r,n))||o.parent!==r.loopBody&&e(o.parent,r,n)}(e,t,n)||r&&vr(e,r,c,n))&&!s.has(e))return s.add(e),{node:p,messageId:EX,data:{iterable:n.sourceCode.getText(i)}}}(t,r,n,o);e&&(yield e)}for(let n of o.sourceCode.visitorKeys[t.type]??[]){let i=t[n];if(Array.isArray(i)){for(let t of i)t&&(yield*e(t,r,a,o));continue}i&&(yield*e(i,r,a,o))}}(n.body,{branchAlwaysExits:r,...E4(n,o),reportedCallExpressions:t},void 0,e)})},meta:{type:"problem",docs:{description:"Disallow mutating a loop iterable during iteration.",recommended:!0},schema:[],messages:{[EX]:"Do not mutate `{{iterable}}` while iterating over it."},languages:["js/js"]}},"unicorn/no-selector-as-dom-name":{create:e=>{let{sourceCode:t}=e;e.on("CallExpression",function*(e){for(let{node:r,expectedPrefix:n}of(e=>{if(tw(e,{methods:vo})&&tT(e.callee.object,{property:"classList",computed:!1})&&!oa(rj(e.callee.object.object))){let t=e.callee.property.name;return"add"===t||"remove"===t?vp(e.arguments,"."):"replace"===t?e.arguments[0]?.type==="SpreadElement"?[]:vp(e.arguments.slice(0,2),"."):vp(e.arguments.slice(0,1),".")}if(tw(e,{methods:["getElementById","getElementsByClassName"],argumentsLength:1})&&!oa(rj(e.callee.object))){let t="getElementById"===e.callee.property.name?"#":".";return vp(e.arguments,t)}return[]})(e)){if("SpreadElement"===r.type)continue;let e=rj(r),o=vl(e);vs(o)&&(yield vu(e,o,n,t))}})},meta:{type:"problem",docs:{description:"Disallow selector syntax in DOM names.",recommended:!0},fixable:"code",messages:{[vn]:"Do not use selector syntax in DOM names."},languages:["js/js"]}},"unicorn/no-useless-compound-assignment":{create:e=>{let{sourceCode:t}=e;e.on("AssignmentExpression",r=>{if(!vf.has(r.operator)||!to(r.right)||r.right.value!==vf.get(r.operator))return;let n={operator:r.operator,value:r.right.raw};if(t.getCommentsInside(r).length>0)return{node:r,messageId:vc,data:n};let{parent:o}=r;if("ExpressionStatement"===o.type&&["Program","BlockStatement","StaticBlock","SwitchCase"].includes(o.parent.type))return{node:r,messageId:vc,data:n,suggest:[{messageId:vd,fix:t=>aO(o,e,t)}]};let a=t.getText(r.left);return{node:r,messageId:vc,data:n,suggest:[{messageId:vm,data:{left:a},fix:e=>e.replaceText(r,a)}]}})},meta:{type:"suggestion",docs:{description:"Disallow useless compound assignments such as `x += 0`.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[vc]:"This compound assignment is useless as `{{operator}} {{value}}` does not change the value.",[vd]:"Remove the useless assignment.",[vm]:"Replace the useless assignment with `{{left}}`."},languages:["js/js"]}},"unicorn/no-useless-delete-check":{create:e=>{e.on("IfStatement",t=>{let r=function(e,t){if(e.alternate||"IfStatement"===e.parent.type&&e.parent.alternate===e)return;let r=(e=>{if("BlockStatement"===e.type){if(1!==e.body.length)return;e=e.body[0]}return"ExpressionStatement"===e.type?e.expression:void 0})(e.consequent);if(r)return"UnaryExpression"===r.type&&"delete"===r.operator?function(e,t,r){let n,{test:o}=e,{argument:a}=t;if("BinaryExpression"===o.type&&"in"===o.operator&&"MemberExpression"===a.type&&!a.optional&&rC(o.right,a.object)&&vA(o.right,r)&&vw(o.left,r)&&vw(o.right,r)&&(!a.computed||vw(a.property,r))){if(a.computed)n=((e,t,r)=>{if(rC(e,t))return!((e,t)=>{var r;let n;if(vA(e,t)||vS(rj(e),t))return!0;let o=rq(rj(e),t);if(!o)return!1;let a=rj(o);return"NewExpression"===a.type||"CallExpression"===(r="ChainExpression"===(n=r=a).type?n.expression:n).type&&void 0===vT(r,t)})(e,r);let n=vT(e,r),o=vT(t,r);return void 0!==n&&n===o})(o.left,a.property,r);else{let e=eO(a,r.sourceCode.getScope(a));n=null!==e&&e===vT(o.left,r)}return n?{suggest:[{messageId:vy,fix:vI(e,t,r)}]}:void 0}}(e,r,t):function(e,t,r){let{test:n}=e;if(vk(n,"has")&&vk(t,"delete")&&((e,t)=>{let r;if("Identifier"!==(e=rj(e)).type)return!1;let n=rq(e,t);if(!n)return!1;let o=rj(n);return"NewExpression"===o.type&&(r=o.callee,"Identifier"===r.type&&vx.has(r.name)&&t.sourceCode.isGlobalReference(r))})(n.callee.object,r)&&rC(n.callee.object,t.callee.object)&&rC(n.arguments[0],t.arguments[0])&&vw(n.arguments[0],r))return{fix:vI(e,t,r)}}(e,r,t)}(t,e);if(r)return{node:t.test,messageId:vg,fix:r.fix,suggest:r.suggest}})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary existence checks before deletion.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,schema:[],messages:{[vg]:"The existence check before deletion is unnecessary.",[vy]:"Remove the existence check."},languages:["js/js"]}},"unicorn/no-useless-logical-operand":{create:e=>{e.on("LogicalExpression",t=>{if(!vF.has(t.operator)||"LogicalExpression"===t.parent.type&&t.parent.operator===t.operator)return;let r=function(e,t){let r,n,{operator:o}=e,a=function e(t,r){return"LogicalExpression"===t.type&&t.operator===r?[...e(t.left,r),...e(t.right,r)]:[t]}(e,o),i=(r=vB.get(o),tr(a[0],r)?a[0]:void 0);if(i)return{target:i,replacementOperands:[i]};let s=(n=vF.get(o),a.filter((e,r)=>tr(e,n)&&function(e,t,r){var n;if(t<e.length-1)return!0;let o=e.slice(0,-1);return tq(n=e[t].parent,r)||tV(n)||o.every(e=>n6(e,r))}(a,r,t)));if(0===s.length)return;let l=a.filter(e=>!s.includes(e));return{target:s[0],replacementOperands:0===l.length?[s.at(-1)]:l}}(t,e);if(!r)return;let{target:n,replacementOperands:o}=r;if(1===o.length&&tt(rj(o[0]))&&function(e){let{parent:t}=e;if("ExpressionStatement"!==t.type||t.expression!==e)return!1;let r=t.parent,n=r.parent;if("Program"!==r.type&&!("BlockStatement"===r.type&&tv(n)))return!1;let o=r.body.indexOf(t);return r.body.slice(0,o).every(e=>"string"==typeof e.directive)}(t))return;let a={node:n,messageId:vj,data:{operator:t.operator}};return e.sourceCode.getCommentsInside(t).length>0||(1===o.length?a.fix=r=>aI(r,t,o[0],e):a.fix=r=>{var n;let a;return r.replaceText(t,(n=t.operator,a=o.map((t,r)=>{let o,a;return o=e7(t,e),a=e4(t,e),!o&&o3(t,{operator:n,property:0===r?"left":"right"})&&(a=`(${a})`),0===r&&!o&&vR.has(rj(t).type)&&(a=`(${a})`),a}).join(` ${n} `),oD(e.sourceCode.getTokenBefore(t),e,a)?`;${a}`:a))}),a})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary operands in logical expressions involving boolean literals.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[vj]:"Simplify this `{{operator}}` expression."},languages:["js/js"]}},"unicorn/prefer-boolean-return":{create:e=>{let{sourceCode:t}=e;function r(n,o,a,i=t.getRange(n)){let s;if(!o||!a||"ConditionalExpression"===n.test.type)return;let l=v$(o),u=v$(a);if(void 0===l||void 0===u||l===u)return;let p={node:n,messageId:vP},c=!l,d=t.getCommentsInside(n).length>0||t.getCommentsInside(a).length>0||rN(e,a),m=!c&&!vM(n.test,e)&&!!(s=ey(t.getScope(n),"Boolean"))&&0!==s.defs.length;return d||m?p:{...p,fix:t=>t.replaceTextRange(i,`return ${function(t,r){let n=e4(t,e);if(r)return o2(t,"!")?`!(${n})`:`!${n}`;if(vM(t,e))return n;let o="SequenceExpression"===t.type?`(${n})`:n;return`Boolean(${o})`}(n.test,c)};`)}}e.on("IfStatement",n=>n.alternate?r(n,vN(n.consequent),vN(n.alternate)):function(n){let o,a=ar(n,e);if(!a||"ReturnStatement"!==a.type)return;let i=vN(n.consequent),s=v$(i);if(void 0!==s&&(o=at(n,e),o?.type==="IfStatement"&&!o.alternate&&v$(vN(o.consequent))===s))return;let l=r(n,i,a,[t.getRange(n)[0],t.getRange(a)[1]]);return l?.fix&&t.getTokensBetween(n,a,{includeComments:!0}).some(e=>"Block"===e.type||"Line"===e.type)?{node:n,messageId:vP}:l}(n))},meta:{type:"suggestion",docs:{description:"Prefer directly returning boolean expressions over `if` statements.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[vP]:"Return the boolean expression directly."},languages:["js/js"]}},"unicorn/prefer-flat-math-min-max":{create:e=>{let{sourceCode:t}=e;e.on("CallExpression",e=>{let r=(e=>{for(let t of vU)if(vq(e,t))return t})(e);if(!(!r||!e.arguments.some(e=>vq(e,r))||((e,t)=>{let{parent:r}=e;return vq(r,t)&&r.arguments.includes(e)})(e,r)))return{node:e,messageId:vO,data:{method:r},*fix(n,{abort:o}){if(t.getCommentsInside(e).length>0)return o();let a=t.getText(e.callee),i=vV(e,r).map(e=>t.getText(e)).join(", ");yield n.replaceText(e,`${a}(${i})`)}}})},meta:{type:"suggestion",docs:{description:"Prefer flat `Math.min()` and `Math.max()` calls over nested calls.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[vO]:"Prefer a flat `Math.{{method}}()` call instead of nested calls."},languages:["js/js"]}},"unicorn/prefer-hoisting-branch-code":{create:e=>{e.on("IfStatement",t=>(function*(e,t){if("IfStatement"===e.parent.type&&e.parent.alternate===e)return;let r=function(e){let t=[],r=e;for(;r?.type==="IfStatement";r=r.alternate)t.push(r.consequent);if(r)return t.push(r),t}(e);if(!r||r.some(e=>"BlockStatement"!==e.type))return;let{sourceCode:n}=t,{leading:o,trailing:a,minLength:i}=function(e,t){let r=Math.min(...e.map(e=>e.length)),n=0;for(;n<r&&e.every(r=>vX(r[n],e[0][n],t));)n++;let o=0;for(;n+o<r&&e.every(r=>vX(r.at(-1-o),e[0].at(-1-o),t));)o++;return{leading:n,trailing:o,minLength:r}}(r.map(e=>e.body),n);0===o&&0===a||!(o+a>=i)&&(o>0&&(yield vH({ifStatement:e,blocks:r,leading:o,trailing:a,isStart:!0},t)),a>0&&(yield vH({ifStatement:e,blocks:r,leading:o,trailing:a,isStart:!1},t)))})(t,e))},meta:{type:"suggestion",docs:{description:"Prefer moving code shared by all branches of an `if` statement out of the branches.",recommended:!0},fixable:"code",hasSuggestions:!0,messages:{[vW]:"These branches start with the same code. Move it before the `if` statement.",[v_]:"These branches end with the same code. Move it after the `if` statement.",[vz]:"Move the shared code out of the branches."},languages:["js/js"]}},"unicorn/prefer-single-replace":{create:e=>{let{sourceCode:t}=e;e.on("CallExpression",r=>{if(void 0===v2(r))return;let n=r.arguments[1];if(!tt(n))return;let o=n.value;if(o.includes("$`")||o.includes("$'"))return;let a=e=>void 0!==v2(e)&&tt(e.arguments[1])&&e.arguments[1].value===o,{parent:s}=r;if("MemberExpression"===s.type&&s.object===r&&"CallExpression"===s.parent.type&&s.parent.callee===s&&a(s.parent))return;let l=[],u=r;for(;a(u);)l.push(v2(u)),u=u.callee.object;if(l.length<2)return;let p=u;l.reverse();let c=[...new i(l)];if(c.some(e=>o.includes(e)))return;let d={node:r,messageId:vZ};if(0===t.getCommentsInside(r).length){let t=c.map((e,t)=>(function(e,t,r){if(v1.has(e))return v1.get(e);if("^"===e)return t?String.raw`\^`:"^";if("-"===e)return t||r?"-":String.raw`\-`;let n=e.codePointAt(0);return n<32||127===n?String.raw`\x${n.toString(16).toUpperCase().padStart(2,"0")}`:e})(e,0===t,t===c.length-1)).join(""),o=e4(p,e),a=e4(n,e);d.fix=e=>e.replaceText(r,`${o}.replaceAll(/[${t}]/g, ${a})`)}return d})},meta:{type:"suggestion",docs:{description:"Enforce combining multiple single-character replacements into a single `String#replaceAll()` with a regular expression.",recommended:"unopinionated"},fixable:"code",messages:{[vZ]:"Combine these single-character replacements into a single `replaceAll()` with a regular expression."},languages:["js/js"]}},"unicorn/consistent-tuple-labels":{create:e=>{e.on("TSTupleType",e=>{let t=e.elementTypes;if(t.length<2)return;let r=t.filter(e=>"TSNamedTupleMember"!==e.type&&("TSRestType"!==e.type||"TSNamedTupleMember"!==e.typeAnnotation.type));if(0!==r.length&&r.length!==t.length)return r.map(e=>({node:e,messageId:v3}))})},meta:{type:"suggestion",docs:{description:"Enforce consistent labels on tuple type elements.",recommended:!0},messages:{[v3]:"This tuple element should have a label, just like the other elements."},languages:["js/js"]}},"unicorn/no-invalid-well-known-symbol-methods":{create:e=>{e.on("MethodDefinition",t=>Cr(t,e)),e.on("Property",t=>Cr(t,e)),e.on("PropertyDefinition",t=>Cr(t,e))},meta:{type:"problem",docs:{description:"Disallow invalid implementations of well-known symbol methods.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[v8]:"`Symbol.dispose` must not return a Promise. Use `Symbol.asyncDispose` instead.",[v6]:"`Symbol.dispose` must not be a generator. Use a normal method for synchronous disposal or `Symbol.asyncDispose` for asynchronous disposal.",[v9]:"`Symbol.iterator` must return a sync iterator. Use `Symbol.asyncIterator` for async iterators.",[v5]:"`Symbol.asyncIterator` must return an async iterator directly. Use an async generator or return the iterator synchronously.",[v4]:"Use `Symbol.{{replacement}}` instead."},languages:["js/js"]}},"unicorn/no-late-event-control":{create:e=>{let{sourceCode:t}=e,r=gc(e);e.onExit("CallExpression",n=>{var o;let a=(e=>{if(!tw(e,{methods:Ci,computed:!1}))return;let{callee:t}=e,r=rj(t.object);if("Identifier"===r.type)return{event:r,method:t.property.name}})(n);if(!a)return;let{event:i,method:s}=a,l=ey(t.getScope(i),i),u=l?.defs.find(({type:e})=>"Parameter"===e);if(!u)return;let p=u.node;if(!(!nw(o=u.name,e)&&(gl.test(o.name)||nA(o,e))))return;let c=gu(n)!==p,d=p.generator;if(!c&&!d&&!r.isFunctionSuspended(p)&&!r.isInsideSuspendingLoop(n,p))return;let m=Cn;return c?m=Ca:d&&(m=Co),{node:n,messageId:m,data:{name:i.name,method:s}}})},meta:{type:"problem",docs:{description:"Disallow event-control method calls after the synchronous event dispatch has finished.",recommended:!0},schema:[],messages:{[Cn]:"`{{name}}.{{method}}()` has no effect after the handler suspends. Call it before `await` or `yield` while the event is still being dispatched.",[Co]:"`{{name}}.{{method}}()` is not called during event dispatch inside a generator function. Use a normal function handler instead.",[Ca]:"`{{name}}.{{method}}()` may run after synchronous event dispatch has finished. Call it in the outer handler before deferring work."},languages:["js/js"]}},"unicorn/prefer-abort-signal-timeout":{create:e=>{e.on("VariableDeclarator",t=>((e,t)=>{var r;let n,o,{sourceCode:a}=t,i=e.parent,{id:s,init:l}=e;if("VariableDeclaration"!==i.type||"const"!==i.kind||1!==i.declarations.length||"Identifier"!==s.type||!(tf(l,{name:"AbortController",argumentsLength:0})&&of(l.callee,t))||(n=ey(t.sourceCode.getScope(s),"AbortSignal"))&&0!==n.defs.length||r$(t,a.getRange(l))||s.typeAnnotation&&r$(t,a.getRange(s.typeAnnotation)))return;let u=(e=>{let t=Array.isArray(e.parent.body)?e.parent.body:Array.isArray(e.parent.consequent)?e.parent.consequent:void 0;if(t)return t[t.indexOf(e)+1]})(i),p=((e,t)=>{if(e?.type==="ExpressionStatement"&&tm(e.expression,{name:"setTimeout",argumentsLength:2,optional:!1},tp)&&of(e.expression.callee,t))return e.expression})(u,t);if(!p||((e,t,r)=>{let{sourceCode:n}=e,[,o]=n.getRange(t),[a]=n.getRange(r);return n.getAllComments().some(e=>{let[t,r]=n.getRange(e);return t>=o&&r<=a})})(t,i,u)||r$(t,a.getRange(u))||rN(t,u))return;let c=((e,t)=>{let[r]=e.arguments,n=!r||"ArrowFunctionExpression"!==r.type&&"FunctionExpression"!==r.type||r.async||r.generator||r.params.length>0?void 0:"BlockStatement"!==r.body.type?r.body:1===r.body.body.length&&"ExpressionStatement"===r.body.body[0].type?r.body.body[0].expression:void 0;if(tm(n,{argumentsLength:0,optional:!1},tp)&&tT(n.callee,{property:"abort",computed:!1,optional:!1})&&"Identifier"===n.callee.object.type&&n.callee.object.name===t)return n.callee.object})(p,s.name);if(!c)return;let d=ey(a.getScope(s),s);if(!d||ey(a.getScope(c),c)!==d)return;let m=((e,t,r)=>{let n=[];for(let o of e.references){let{identifier:e}=o;if(e===t||o.init)continue;if(o.isWrite())return;let a=Cp(e,r);if(!a)return;n.push(a)}return n.length>0?n:void 0})(d,c,t);if(!m)return;let f=a.getRange(u),[,g]=p.arguments;if("SequenceExpression"===g.type||!((e,t)=>{let r=e$(e,t.sourceCode.getScope(e));if(!r)return!0;let{value:n}=r;return"number"==typeof n&&Number.isSafeInteger(n)&&n>=0&&n<=0x7fffffff})(g,t)||m.some(e=>{let r;return(r=t.sourceCode.getRange(e))[0]>=f[0]&&r[1]<=f[1]}))return;let y=(r=s.name,o=r,("abortController"===r?o="abortSignal":"controller"===r&&(o="signal"),o===r||Cc(o,d,d.identifiers[0],t)||m.some(e=>Cc(o,d,e,t)))?r:o),h=`AbortSignal.timeout(${a.getText(g)})`;return{node:s,messageId:Cs,suggest:[{messageId:Cl,*fix(e){if(yield e.replaceText(l,h),s.typeAnnotation&&(yield e.replaceText(s.typeAnnotation,": AbortSignal")),y!==s.name){let[t]=a.getRange(s);yield e.replaceTextRange([t,t+s.name.length],y)}for(let t of m)yield e.replaceText(t,y);yield aO(u,t,e)}}]}})(t,e))},meta:{type:"suggestion",docs:{description:"Prefer `AbortSignal.timeout()` over manually aborting an `AbortController` with `setTimeout()`.",recommended:!0},hasSuggestions:!0,schema:[],messages:{[Cs]:"Prefer `AbortSignal.timeout()` over manually aborting an `AbortController` with `setTimeout()`.",[Cl]:"Replace with `AbortSignal.timeout()`."},languages:["js/js"]}},"unicorn/prefer-aggregate-error":{create:e=>{e.on("IfStatement",t=>{var r;let n,o="ThrowStatement"===(r=t.consequent).type?r:"BlockStatement"===r.type&&1===r.body.length&&"ThrowStatement"===r.body[0].type?r.body[0]:void 0;if(!o)return;let a=function(e,t){let r=e.argument;if(tf(r,{name:"Error",maximumArguments:2})&&of(r.callee,t))return r}(o,e);if(!a)return;let i=function(e,t){let r=Cv(e.test).map(e=>(function(e,t){let r=Cb(e=Cg(e),t);if(r)return r;if("BinaryExpression"!==e.type)return;let n=Cb(e.left,t);if(n&&CE(e.operator,e.right,!0))return n;let o=Cb(e.right,t);if(o&&CE(e.operator,e.left,!1))return o})(e,t)).filter(Boolean);if(1===r.length)return r[0]}(t,e);if(!i||(n=oA("AggregateError",e.sourceCode.getScope(a)))&&0!==n.defs.length)return;let{sourceCode:s}=e;return{node:a.callee,messageId:Cd,fix:e.sourceCode.getCommentsInside(a).length>0?void 0:e=>{let t=[s.getText(i),...a.arguments.map(e=>s.getText(e))].join(", ");return e.replaceText(a,`new AggregateError(${t})`)}}})},meta:{type:"suggestion",docs:{description:"Prefer `AggregateError` when throwing collected errors.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[Cd]:"Use `AggregateError` when throwing collected errors."},languages:["js/js"]}},"unicorn/prefer-observer-apis":{create:e=>{e.on("CallExpression",t=>{var r,n;let o;if(r=t,n=e,tw(r,{method:"addEventListener",minimumArguments:2,maximumArguments:3,optionalCall:!1,optionalMember:!1})?!!CL(r.callee.object,n):!(tm(r,{name:"addEventListener",minimumArguments:2,maximumArguments:3,optional:!1},tp)&&of(r.callee,n)))return;let[a,i]=t.arguments,s=tn(o=rj(a))??((e,t)=>{let{parserServices:r}=t.sourceCode;if(r?.program)try{var n=r.getTypeAtLocation(e);if(n.isStringLiteral?.())return n.value;return}catch{}})(o,e);if(!CD.has(s))return;let l=((e,t)=>{if(tv(e=rj(e)))return e;if("Identifier"!==e.type)return;let r=ey(t.sourceCode.getScope(e),e);if(!r||1!==r.defs.length)return;let[n]=r.defs;if("FunctionName"===n.type)return n.node;let o=n.node.init&&rj(n.node.init);if("Variable"===n.type&&"const"===n.parent.kind&&o&&tv(o))return o})(i,e);if(l&&CW(l.body,e))return{node:a,messageId:s}})},meta:{type:"suggestion",docs:{description:"Prefer observer APIs over resize and scroll listeners with layout reads.",recommended:!0},schema:[],messages:CC,languages:["js/js"]}},"unicorn/prefer-set-methods":{create:e=>{e.on("NewExpression",t=>{let r=((e,t)=>{if(!CX(e,t)||t.sourceCode.getCommentsInside(e).length>0)return;let[r]=e.arguments;if("ArrayExpression"===r.type&&r.elements.length>=2&&r.elements.every(e=>{let r;return C0(e,t)&&(r=e.argument,tf(r,{name:"Set",argumentsLength:0})&&of(r.callee,t)||!ez(r,t.sourceCode,{considerGetters:!0}))}))return{node:e,messageId:C_,fix:n=>n.replaceText(e,CH(e,((e,t)=>{let[r,...n]=e.elements.map(e=>e.argument),o=CY(r,t);for(let e of n)o+=`.union(${e4(e,t)})`;return o})(r,t),t))}})(t,e);if(r)return r;if(!CX(t,e))return;let[n]=t.arguments;return C2((e=>{for(;e?.type==="ParenthesizedExpression"||rI(e);)e=e.expression;return e})(n),t,e)}),e.on("CallExpression",t=>{if(!(e=>{let{parent:t}=e=CZ(e);return(t?.type==="CallExpression"||t?.type==="NewExpression")&&(t.callee===e||t.arguments.includes(e))})(t))return C2(t,t,e)})},meta:{type:"suggestion",docs:{description:"Prefer `Set` methods for Set operations.",recommended:!0},fixable:"code",hasSuggestions:!0,messages:{[C_]:"Use `Set#union()` instead of spreading Sets into a new Set.",[Cz]:"Use `Set#intersection()` instead of filtering by `Set#has()`.",[CK]:"Use `Set#intersection()`.",[CG]:"Use `Set#difference()` instead of filtering by `Set#has()`.",[CJ]:"Use `Set#difference()`."},languages:["js/js"]}},"unicorn/prefer-toggle-attribute":{create:e=>{let{sourceCode:t}=e;e.on(["IfStatement","ConditionalExpression"],r=>{let n=C4(r.consequent),o=C4(r.alternate);if(!((e,t,r)=>!!(e&&t&&("setAttribute"===e.method&&"removeAttribute"===t.method||"removeAttribute"===e.method&&"setAttribute"===t.method)&&C7(e,t)&&!rY(e.receiver)&&!rY(t.receiver)&&!De(e,r)&&!De(t,r)))(n,o,e))return;let a="setAttribute"===n.method?n:o,i=n===a,s=function e(t,r,n,o=!1){if("ChainExpression"===t.type)return e(t.expression,r,n,o);if("UnaryExpression"===t.type&&"!"===t.operator&&t.prefix)return e(t.argument,r,n,!o);let a=C5(t);if(a?.method==="hasAttribute"&&C7(a,r)&&!rY(a.receiver))return{isNegative:o,isKnownNonDom:De(a,n)}}(r.test,a,e);if(s?.isKnownNonDom)return;let l=s&&i===s.isNegative?"":C6(r.test,e,!i),u=a.hasEmptyAttributeValue||void 0!==tn(a.attributeValue),p=!!l&&a.isOptional||!u,c=[a.receiver,a.attributeName];l&&c.push(r.test);let d=p||rL(e,r,c)?void 0:function*(n){var o;let i,s=(i=e4(o=a.receiver,e),!e7(o,e.sourceCode)&&oZ(o,e)?`(${i})`:i),u=e4(a.attributeName,e),p=a.isOptional?"?":"",c="ConditionalExpression"===r.type,d=`${s}${p}.toggleAttribute(${u}${l?`, ${l}`:""})`;c||(d+=";"),oD(t.getTokenBefore(r),e,d)&&(d=`;${d}`),yield n.replaceText(r,d),c&&(yield aP(n,r,e))};return((e,t,{forceSuggestion:r=!1}={})=>{let n={node:e,messageId:C3};if(!t)return n;let o="IfStatement"!==e.type&&!(tb(e)||tb(e.parent));return r||o?n.suggest=[{messageId:C8,fix:t}]:n.fix=t,n})(r,d,{forceSuggestion:!!l||!a.hasEmptyAttributeValue})})},meta:{type:"suggestion",docs:{description:"Prefer using `Element#toggleAttribute()` to toggle attributes.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[C3]:"Prefer using `Element#toggleAttribute()` to toggle attributes.",[C8]:"Replace with `Element#toggleAttribute()`."},languages:["js/js"]}},"unicorn/prefer-url-search-parameters":{create:e=>{e.on("CallExpression",t=>{let r,n=((e,t)=>{if(!(tw(e,{object:"Object",method:"fromEntries",argumentsLength:1,computed:!1,optionalCall:!1,optionalMember:!1})&&Da("Object",e,t)))return;let[r]=e.arguments,n=Dl(r,t);if(!n)return;let o=Dp(e,r,Du(n.query,t),t);return Dd({node:e,query:n.query,replacement:o,preservedNodes:[...Dc(e,r,t),n.query]},t)})(t,e);if(n)return n;if((r=(e=>{let t=e,{parent:r}=e;for(;rI(r)&&r.expression===t;)t=r,r=r.parent;return r?.arguments?.[0]===t?r:void 0})(t))&&("CallExpression"===r.type&&1===r.arguments.length&&"MemberExpression"===r.callee.type&&"Identifier"===r.callee.object.type&&"Object"===r.callee.object.name&&((e,t,{computed:r})=>r?tn(e)===t:"Identifier"===e.type&&e.name===t)(r.callee.property,"fromEntries",{computed:r.callee.computed})||tf(r,{names:["Map","URLSearchParams"],argumentsLength:1})))return;let o=Dl(t,e);if(o)return Dd({node:t,query:o.query,replacement:Du(o.query,e)},e)}),e.on("NewExpression",t=>((e,t)=>{let r=tf(e,{name:"Map",argumentsLength:1})&&Da("Map",e,t);if(!r&&!tf(e,{name:"URLSearchParams",argumentsLength:1}))return;let[n]=e.arguments,o=Dl(n,t);if(!o)return;let a=Ds(o.query,t),i=Du(o.query,t),s=Dp(e,n,r?i:a,t);return Dd({node:e,query:o.query,replacement:s,preservedNodes:[...Dc(e,n,t),o.query]},t)})(t,e))},meta:{type:"suggestion",docs:{description:"Prefer `URLSearchParams` over manually splitting query strings.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[Dt]:"Prefer `URLSearchParams` over manually splitting query strings.",[Dr]:"Use `{{replacement}}`."},languages:["js/js"]}},"unicorn/no-unsafe-promise-all-settled-values":{create:e=>{e.on("CallExpression",t=>(function(e,t){if(!tw(e,{method:"then",minimumArguments:1,optionalCall:!1,optionalMember:!1})||!Db(e.callee.object))return;let[r]=e.arguments;if(!Dh(r)||0===r.params.length)return;let[n]=r.params,o=DF(n)&&ey(t.sourceCode.getScope(n),n);if(o)return function e(t,r,n){if(t=Dx(t),!(!t?.type||Dh(t))&&"ClassExpression"!==t.type&&"ClassDeclaration"!==t.type){if(tw(t,{method:"map",minimumArguments:1,maximumArguments:2,optionalCall:!1,optionalMember:!1})&&function e(t,r,n){return!!D_(t=Dx(t),r,n)||Dv(t)&&e(t.callee.object,r,n)}(t.callee.object,r,n)&&!Dz(t.callee.object)){let e=DK(t,n,{knownPromiseSettledResultArray:!0});if(e)return e}for(let[o,a]of Object.entries(t))if(!("parent"===o||DW(t,o))&&a&&"object"==typeof a)for(let t of Array.isArray(a)?a:[a]){let o=e(t,r,n);if(o)return o}}}(r.body,o,t)})(t,e)??DK(t,e))},meta:{type:"problem",docs:{description:"Disallow reading `.value` from `Promise.allSettled()` results without a fulfilled status guard.",recommended:"unopinionated"},schema:[],messages:{[Dm]:"Do not read `.value` from `Promise.allSettled()` results without checking that the result is fulfilled."},languages:["js/js"]}},"unicorn/prefer-abort-signal-any":{create:e=>{e.on("VariableDeclarator",t=>((e,t)=>{var r;let n,o,{sourceCode:a}=t,s=e.parent,{id:l,init:u}=e;if("VariableDeclaration"!==s.type||"const"!==s.kind||1!==s.declarations.length||"Identifier"!==l.type||!(tf(u,{name:"AbortController",argumentsLength:0})&&of(u.callee,t))||(n=ey(t.sourceCode.getScope(l),"AbortSignal"))&&0!==n.defs.length||r$(t,a.getRange(u))||l.typeAnnotation&&r$(t,a.getRange(l.typeAnnotation)))return;let p=((e,t,r)=>{var n;let o,a=DQ(e);if(a?.type!=="ForOfStatement"||a.await||!Sy(a,r)||DZ(r,e,a)||!Si(a.right,r)||D5(a.right,r)||St(a.right,t,r)||Se(a.right,r)||!Sm(a.right,r)||!(!(o=Sa(a.right,r))||o.length>1&&o.every(e=>Sn(e,r))))return;let s=(e=>{if("VariableDeclaration"!==e.type||"const"!==e.kind||1!==e.declarations.length)return;let[t]=e.declarations;if("Identifier"===t.id.type&&!t.init)return t.id})(a.left);if(!s||!Sr(s,r))return;let l=Sg("ExpressionStatement"===(n=a.body).type?n:"BlockStatement"===n.type&&1===n.body.length&&"ExpressionStatement"===n.body[0].type?n.body[0]:void 0);if(!l||!rC(rj(l.sourceSignal),s))return;let u=Sf(l.call.arguments[1],t,s,r);if(u)return{abortReferences:new i([u]),replacement:`AbortSignal.any(${((e,t)=>{let r=t.sourceCode.getText(e);if(!Sd(e,t))return r;let n=rj(e);if("ArrayExpression"===n.type)return t.sourceCode.getText(n);let o=n===e?r:`(${r})`;return`[...${o}]`})(a.right,r)})`,statements:[a]}})(s,l.name,t)??((e,t,r)=>{let n=[],o=[],a=new i,s=e,l=DQ(e);for(;l;){let e=Sg(l);if(!e||!Sy(l,r)||DZ(r,s,l)||St(e.sourceSignal,t,r)||Se(e.sourceSignal,r)||!Sn(e.sourceSignal,r))break;let i=Sf(e.call.arguments[1],t,e.sourceSignal,r);if(!i)break;n.push(l),o.push(e.sourceSignal),a.add(i),s=l,l=DQ(l)}if(!(n.length<2))return{abortReferences:a,replacement:`AbortSignal.any([${o.map(e=>r.sourceCode.getText(e)).join(", ")}])`,statements:n}})(s,l.name,t);if(!p)return;let c=ey(a.getScope(l),l);if(!c)return;for(let e of p.abortReferences)if(ey(a.getScope(e),e)!==c)return;let d=((e,t,r)=>{let n=[];for(let o of e.references){let{identifier:e}=o;if(t.has(e)||o.init)continue;if(o.isWrite())return;let a=D1(e,r);if(!a)return;n.push(a)}return n.length>0?n:void 0})(c,p.abortReferences,t);if(!d)return;let m=(r=l.name,o=r,("abortController"===r?o="abortSignal":"controller"===r&&(o="signal"),o===r||Sh(o,c,c.identifiers[0],t)||d.some(e=>Sh(o,c,e,t)))?r:o);return{node:l,messageId:DG,suggest:[{messageId:DJ,*fix(e){if(yield e.replaceText(u,p.replacement),l.typeAnnotation&&(yield e.replaceText(l.typeAnnotation,": AbortSignal")),m!==l.name){let[t]=a.getRange(l);yield e.replaceTextRange([t,t+l.name.length],m)}for(let t of d)yield e.replaceText(t,m);yield((e,t,r)=>{if(1===e.length)return aO(e[0],t,r);let{sourceCode:n}=t,{lines:o}=n,a=e[0],i=e.at(-1),s=n.getLoc(a).start,l=n.getLoc(i).end,u=o[s.line-1].slice(0,s.column),p=o[l.line-1].slice(l.column),{text:c}=n,[d]=n.getRange(a),[,m]=n.getRange(i);return/^\s*$/.test(u)&&/^\s*$/.test(p)&&(m+=p.length,0===d?"\r"===c[m]&&"\n"===c[m+1]?m+=2:("\n"===c[m]||"\r"===c[m])&&m++:"\r"===c[(d-=u.length)-2]&&"\n"===c[d-1]?d-=2:("\n"===c[d-1]||"\r"===c[d-1])&&d--),r.removeRange([d,m])})(p.statements,t,e)}}]}})(t,e))},meta:{type:"suggestion",docs:{description:"Prefer `AbortSignal.any()` over manually forwarding abort events between signals.",recommended:!0},hasSuggestions:!0,schema:[],messages:{[DG]:"Prefer `AbortSignal.any()` over manually forwarding abort events between signals.",[DJ]:"Replace with `AbortSignal.any()`."},languages:["js/js"]}},"unicorn/prefer-block-statement-over-iife":{create:e=>{let{sourceCode:t}=e,{visitorKeys:r}=t;e.on("ExpressionStatement",n=>{let o,a,{expression:i}=n;if("CallExpression"!==i.type||i.optional||i.arguments.length>0)return;let{callee:s}=i;if(!("FunctionExpression"!==s.type&&"ArrowFunctionExpression"!==s.type||s.id||s.async||s.generator||s.params.length>0||"BlockStatement"!==s.body.type||s.body.body.some(e=>tg(e))||SC(s.body,r,e=>"ReturnStatement"===e.type||"VariableDeclaration"===e.type&&"var"===e.kind||"CallExpression"===e.type&&"Identifier"===e.callee.type&&"eval"===e.callee.name)||(o=s.body,"script"===t.ast.sourceType&&SC(o,t.visitorKeys,e=>"FunctionDeclaration"===e.type))||(a=s.body,rL(e,SD(n,e.sourceCode),[a]))||"FunctionExpression"===s.type&&SC(s.body,r,Sb,Sv))){let t;return{node:i,messageId:Sx,fix:(t=s.body,r=>r.replaceTextRange(SD(n,e.sourceCode),e.sourceCode.getText(t)))}}})},meta:{type:"suggestion",docs:{description:"Prefer block statements over IIFEs used only for scoping.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[Sx]:"Prefer a block statement over an IIFE used only for scoping."},languages:["js/js"]}},"unicorn/no-multiple-promise-resolver-calls":{create:e=>{let t,{sourceCode:r}=e,n=new s,a=(e,r)=>{var n;t.currentSegments.add(e),n=t,"CatchClause"===r.type&&n.catchClausesBySegment.set(e,r)},u=e=>{t.currentSegments.delete(e)};e.on("onCodePathStart",(a,s)=>{let l=t;t={upper:l,codePath:a,currentSegments:new i,eventsBySegment:new o,executors:new i,catchClausesBySegment:new o,ignoredLoopEdges:[],hasResolverReferences:l?.hasResolverReferences??!1},Sk(s,e)&&function(e,t,r){let n=!1;for(let o of e.params.slice(0,2)){if("Identifier"!==o.type)continue;let a=ey(r.getScope(o),o);if(!(!a||SI(a)))for(let r of a.references)t.set(r.identifier,e),n=!0}return n}(s,n,r)&&(t.hasResolverReferences=!0)}),e.on("onCodePathEnd",()=>{!function(e,t){var r;let n;if(0===e.executors.size)return;let a=(r=e.codePath,n=[],r.traverseSegments(e=>{e.reachable&&n.push(e)}),n),i=new l;for(let r of e.executors){let n=function(e,t,r){let n,a=new o;do for(let o of(n=!1,r)){let r=function(e,t,r){for(let n of t)e=SB(e,n,r);return e}(SL(o,a,e),e.eventsBySegment.get(o)??[],t);SP(r,a.get(o))||(a.set(o,r),n=!0)}while(n);return a}(e,r,a);for(let o of a){let a=SL(o,n,e);for(let n of e.eventsBySegment.get(o)??[])n.executor===r&&a.resolverCalled&&!i.has(n.node)&&(i.add(n.node),t.report({node:n.node,messageId:SS})),a=SB(a,n,r)}}}(t,e),t=t.upper}),e.on("onCodePathSegmentStart",a),e.on("onUnreachableCodePathSegmentStart",a),e.on("onCodePathSegmentEnd",u),e.on("onUnreachableCodePathSegmentEnd",u),e.on("onCodePathSegmentLoop",(e,r,n)=>{(SN(n)||function(e){if("ContinueStatement"!==e.type)return!1;let t=e.label?.name,r=!1,n=e,{parent:o}=e;for(;o&&!tv(o);){if("TryStatement"===o.type&&o.finalizer&&(o.block===n||o.handler===n)&&(r=!0),t&&"LabeledStatement"===o.type&&o.label.name===t||!t&&tD(o))return r;n=o,{parent:o}=o}return!1}(n))&&t.ignoredLoopEdges.push({previousSegment:e,segment:r})}),e.onExit(["Identifier","CallExpression","ImportExpression","MemberExpression","NewExpression","ThrowStatement","YieldExpression"],r=>{if(!t.hasResolverReferences||"Identifier"===r.type&&(n.has(r)||!S$(r))||"ImportExpression"===r.type&&!S$(r))return;let o=((e,t)=>{if("CallExpression"!==e.type)return;let r=Sw(e.callee);return"Identifier"===r.type?t.get(r):void 0})(r,n),{catchClause:a,finallyBlocks:i}=o?{catchClause:void 0,finallyBlocks:function(e){let t=[],r=e,{parent:n}=e;for(;n&&!tv(n);)"TryStatement"===n.type&&n.finalizer===r&&t.push(n.finalizer),r=n,{parent:n}=n;return t}(r)}:function(e){let t=[],r=e,{parent:n}=e;for(;n&&!tv(n);){if("TryStatement"===n.type){if(n.block===r&&n.handler)return{catchClause:n.handler,finallyBlocks:t};n.finalizer&&(n.block===r||n.handler===r)&&t.push(n.finalizer)}r=n,{parent:n}=n}return{catchClause:void 0,finallyBlocks:t}}(r);if((o||a)&&!(function(e){let t=e,{parent:r}=e;for(;r;){if(SN(r)&&("WhileStatement"===r.type&&r.body===t||"ForStatement"===r.type&&(r.body===t||r.update===t)))return!0;t=r,{parent:r}=r}return!1}(r)||o&&function(e,t){let r=e,{parent:n}=e;for(;n;){if("AssignmentPattern"===n.type&&n.right===r&&Sk(n.parent,t)&&n.parent.params.slice(0,2).includes(n))return!0;r=n,{parent:n}=n}return!1}(r,e))){var s=t,l={catchClause:a,finallyBlocks:i,node:r,executor:o};for(let e of s.currentSegments){if(!e.reachable)continue;let t=s.eventsBySegment.get(e);t||(t=[],s.eventsBySegment.set(e,t)),t.push(l)}o&&t.executors.add(o)}})},meta:{type:"problem",docs:{description:"Disallow calling Promise executor resolver functions more than once on the same execution path.",recommended:"unopinionated"},messages:{[SS]:"Promise executor resolver functions may be called multiple times on the same execution path."},languages:["js/js"]}},"unicorn/no-unnecessary-string-trim":{create:e=>{e.on("CallExpression",t=>{if(!tw(t,{methods:SO,maximumArguments:1,optionalCall:!1,optionalMember:!1}))return;let r=t.callee.object;if(!tw(r,{method:"trim",argumentsLength:0,optionalCall:!1,optionalMember:!1})||rY(t))return;let n=r.callee.object;if(((e,t)=>{if(e=rj(e),e=rj(rq(e,t)??e),Sq.has(e.type))return!0;let r=SV(e,t);return!!r&&"string"!=typeof r.value})(n,e)||or(n,e))return;let{property:o}=t.callee,{property:a}=r.callee,i=o.name,[s]=t.arguments;if(s){let t=((e,t)=>{let r=SV(e,t);if(!r)return;let{value:n}=r;return null===n||SU.has(typeof n)?String(n):void 0})(s,e);if(void 0===t||("startsWith"===i?t!==t.trimEnd():t!==t.trimStart()))return}let l="startsWith"===i?"trimStart":"trimEnd";return{node:a,messageId:SM,data:{method:i,replacement:l},fix:e=>e.replaceText(a,l)}})},meta:{type:"suggestion",docs:{description:"Disallow `String#trim()` before `String#startsWith()` or `String#endsWith()`.",recommended:"unopinionated"},fixable:"code",messages:{[SM]:"Prefer `String#{{replacement}}()` before `String#{{method}}()`."},languages:["js/js"]}},"unicorn/no-useless-re-export":{create:e=>{let{sourceCode:t}=e,r=[],n=[];e.on("ExportAllDeclaration",e=>{e.exported||r.push({node:e,request:Sz(e,t)})}),e.on("ExportNamedDeclaration",e=>{e.source&&n.push(e)});let o=(e,n)=>{let o=S_(n.exported);if("default"===o)return;let a=S_(n.local),[i]=t.getRange(n.local),[s]=t.getRange(n.exported);if(a===o&&i!==s)return;let l="type"===n.exportKind||"type"===e.exportKind,u=Sz(e,t);if(a===o&&r.some(e=>e.request===u&&"default"!==o&&("type"!==e.node.exportKind||l)))return{node:n,messageId:SW}};e.on("Program:exit",function*(){if(1===new i(r.map(e=>e.request)).size)for(let e of n)for(let t of e.specifiers){let r=o(e,t);r&&(yield r)}})},meta:{type:"suggestion",docs:{description:"Disallow redundant re-exports.",recommended:"unopinionated"},schema:[],messages:{[SW]:"This export is redundant because the same module is already exported with `export *`."},languages:["js/js"]}}}).map(([e,t])=>{let r;return[e,{meta:{schema:[],...t.meta,docs:{...t.meta.docs,url:(r=v.basename(e,".js"),`https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v72.0.0/docs/rules/${r}.md`)}},create:oz(t.create)}]})))};module.exports=SK;
|