'use strict';
import { isProperty, isObjectExpression, isCallExpression, isIdentifier, isFunction, nodeTypes } from '@flint/infra/analysis';
import { flintRuleIdentifiers } from '@flint/infra/constants/shared-string-identifiers';

var __defProp=Object['defineProperty'],__name=(_0x3d1edc,_0x3724d9)=>__defProp(_0x3d1edc,'name',{'value':_0x3724d9,'configurable':!![]});function findEslintDisableComment(_0x27117c,_0xa47a24,_0x3496d8,_0x384981,_0x34ed01,_0x933c4){for(let _0x1c74fc=0x13b7*0x1+-0xc4f+-0x4f*0x18;_0x1c74fc<_0x27117c['length'];_0x1c74fc++){const _0x3b2d60=_0x27117c[_0x1c74fc];isEslintDisableComment(_0x3b2d60,_0x3496d8)&&!hasApprovedForDisableComment(_0x27117c,_0x1c74fc,_0x3496d8,_0x384981)&&_0xa47a24['report']({'loc':_0x3b2d60['loc'],'messageId':_0x34ed01,'data':{'message':_0x933c4}});}}__name(findEslintDisableComment,'findEslintDisableComment');function isEslintVisitorFunction(_0x1c13e4){const _0x33d79e=_0x1c13e4['parent'];if(!_0x33d79e||!isProperty(_0x33d79e))return ![];return isObjectExpression(_0x33d79e['parent'])&&isEslintRuleCreateFunction(_0x33d79e['parent']['parent']['parent']?.['parent']);}__name(isEslintVisitorFunction,'isEslintVisitorFunction');function isEslintRuleCreatorCall(_0x4f9f07){const _0x2f62e5=[flintRuleIdentifiers['eslintRuleCreatorName'],'createEslintRule'];return !!_0x4f9f07&&isCallExpression(_0x4f9f07)&&isIdentifier(_0x4f9f07['callee'])&&_0x2f62e5['includes'](_0x4f9f07['callee']['name']);}__name(isEslintRuleCreatorCall,'isEslintRuleCreatorCall');function isEslintRuleCreateFunction(_0x2d3efd){if(!isFunction(_0x2d3efd))return ![];const _0x3e12ec=_0x2d3efd['parent'];return isEslintRuleCreatorCall(_0x3e12ec)||_0x3e12ec&&isProperty(_0x3e12ec)&&isObjectExpression(_0x3e12ec['parent'])&&isEslintRuleCreatorCall(_0x3e12ec['parent']['parent']);}__name(isEslintRuleCreateFunction,'isEslintRuleCreateFunction');function hasApprovedForDisableComment(_0x894402,_0x128a2f,_0x43b540,_0x5247cc){let _0x19a47f=_0x128a2f;for(let _0x51d9b1=_0x128a2f;_0x51d9b1>-0x4b2+0x16*0xc2+-0xdb*0xe;_0x51d9b1--){const _0x2af698=_0x894402[_0x51d9b1],_0x49e6f9=_0x894402[_0x51d9b1-(-0x1*-0xd3b+-0x189e*-0x1+-0x25d8)];if(!isEslintDisableComment(_0x2af698,_0x43b540)||!isEslintDisableComment(_0x49e6f9,_0x43b540)||!areCommentsAdjacent(_0x49e6f9,_0x2af698))break;_0x19a47f=_0x51d9b1-(0xe*-0x1cf+0x1*-0x2a7+0xdfd*0x2);}const _0x3d09b8=_0x894402[_0x19a47f-(0x427*-0x1+0x20ec+-0xe62*0x2)],_0x42238c=_0x894402[_0x19a47f];return _0x3d09b8?.['type']===nodeTypes['Line']&&_0x3d09b8['value']['trim']()['startsWith'](_0x5247cc)&&areCommentsAdjacent(_0x3d09b8,_0x42238c);}__name(hasApprovedForDisableComment,'hasApprovedForDisableComment');function isEslintDisableComment(_0x2f1000,_0x4dc0d7){return _0x2f1000['value']['trim']()['startsWith'](_0x4dc0d7)&&(_0x2f1000['type']===nodeTypes['Line']||_0x2f1000['type']===nodeTypes['Block']);}__name(isEslintDisableComment,'isEslintDisableComment');function areCommentsAdjacent(_0x3bcc76,_0x3dfa08){return _0x3dfa08['loc']['start']['line']-_0x3bcc76['loc']['end']['line']===0x8*-0x3da+0x13da+0x191*0x7;}__name(areCommentsAdjacent,'areCommentsAdjacent');

export { findEslintDisableComment, isEslintVisitorFunction };
