'use strict';
import { ESLintUtils } from '@typescript-eslint/utils';
import { nodeTypes, isNameMatch } from '@flint/infra/analysis';
import { ruleTypes, url } from '@flint/infra/constants/rules-meta';
import { htmlAtributes } from '../../../base-repo/constants/html-element-names.js';
import { flintRuleIdentifiers } from '@flint/infra/constants/shared-string-identifiers';

var __defProp=Object['defineProperty'],__name=(_0x6df38b,_0x4dd35a)=>__defProp(_0x6df38b,'name',{'value':_0x4dd35a,'configurable':!![]});const ruleName='must-not-use-location-href';const constants={'messageIds':{'mustNotUseLocationHref':'mustNotUseLocationHref'},'meta':{'type':ruleTypes['problem'],'docs':{'description':'Must\x20not\x20use\x20location.href\x20directly'},'messages':{'mustNotUseLocationHref':'must-not-use-location-href\x0a###\x20**Must\x20not**\x20use\x20location.href.\x0a\x0a####\x20Wrong\x0a\x0awindow.location.href\x20=\x20getFooUrl();\x0a\x0a####\x20Correct\x0a\x0anavigate(routes.foo);\x0a\x0a####\x20Why\x0a\x0aWe\x20standardize\x20on\x20using\x20navigation\x20functions,\x20not\x20location.href.'},'schema':[]}},createRule=ESLintUtils['RuleCreator'](_0x36f080=>''+url+_0x36f080),mustNotUseLocationHref=createRule({'name':ruleName,'meta':constants['meta'],'defaultOptions':[],'create'(_0x136db7){return {'MemberExpression'(_0x1d01ea){isLocationHref(_0x1d01ea)&&reportLocationHref(_0x1d01ea,_0x136db7);}};}});function reportLocationHref(_0x2f8eca,_0x2fa7f6){_0x2fa7f6['report']({'node':_0x2f8eca,'messageId':constants['messageIds']['mustNotUseLocationHref']});}__name(reportLocationHref,'reportLocationHref');function isLocationHref(_0x55146f){return _0x55146f['property']['type']===nodeTypes['identifier']&&isNameMatch(_0x55146f['property'],htmlAtributes['href'])&&(_0x55146f['object']['type']===nodeTypes['identifier']&&isNameMatch(_0x55146f['object'],flintRuleIdentifiers['location'])||_0x55146f['object']['type']===nodeTypes['memberExpression']&&_0x55146f['object']['object']['type']===nodeTypes['identifier']&&isNameMatch(_0x55146f['object']['object'],flintRuleIdentifiers['window'])&&_0x55146f['object']['property']['type']===nodeTypes['identifier']&&isNameMatch(_0x55146f['object']['property'],flintRuleIdentifiers['location']));}__name(isLocationHref,'isLocationHref');

export { mustNotUseLocationHref as default, ruleName };
