'use strict';
import { ESLintUtils } from '@typescript-eslint/utils';
import { nodeTypes } from '@flint/infra/analysis';
import { ruleTypes, url } from '@flint/infra/constants/rules-meta';
import { eslintFixTypeNames } from '../../../base-repo/constants/internal-common-strings.js';

var __defProp=Object['defineProperty'],__name=(_0x44c6cd,_0x328a4e)=>__defProp(_0x44c6cd,'name',{'value':_0x328a4e,'configurable':!![]});const ruleName='must-not-use-emojis';const constants={'emojiRegex':new RegExp('[\x5cp{Emoji_Presentation}\x5cp{Extended_Pictographic}][\x5cu{1F3FB}-\x5cu{1F3FF}]?[\x5cuFE0F\x5cuFE0E]?(?:\x5cu200D[\x5cp{Emoji_Presentation}\x5cp{Extended_Pictographic}][\x5cu{1F3FB}-\x5cu{1F3FF}]?[\x5cuFE0F\x5cuFE0E]?)*','gu'),'messageIds':{'mustNotUseEmojis':'mustNotUseEmojis'},'meta':{'type':ruleTypes['suggestion'],'docs':{'description':'Emoji\x20should\x20not\x20be\x20used.'},'messages':{'mustNotUseEmojis':'must-not-use-emojis\x0a###\x20**Must\x20not**\x20use\x20emojis.\x0a\x0a####\x20Wrong\x0a\x0aconsole.error(\x22✅\x20Error:\x22);\x0a\x0a####\x20Correct\x0a\x0aconsole.error(\x22Error:\x22);\x0a\x0a####\x20Why\x0a\x0aEmojis\x20may\x20not\x20be\x20supported\x20in\x20older\x20versions\x20of\x20consoles\x20or\x20logs.'},'schema':[],'fixable':eslintFixTypeNames['code']}},createRule=ESLintUtils['RuleCreator'](_0x92f08b=>''+url+_0x92f08b),mustNotUseEmojis=createRule({'name':ruleName,'meta':constants['meta'],'defaultOptions':[],'create'(_0x55e42e){const _0x398b20=_0x55e42e['sourceCode'];return {[nodeTypes['literal']](_0x476af6){typeof _0x476af6['value']==='string'&&hasEmoji(_0x476af6['value'])&&_0x55e42e['report']({'node':_0x476af6,'messageId':constants['messageIds']['mustNotUseEmojis'],'fix'(_0x5f082b){return fixLiteralEmojis(_0x476af6,_0x5f082b);}});},[nodeTypes['templateLiteral']](_0x183c56){if(!hasEmojiInQuasis(_0x183c56['quasis']))return;_0x55e42e['report']({'node':_0x183c56,'messageId':constants['messageIds']['mustNotUseEmojis'],'fix'(_0xe6bf9b){return fixTemplateLiteralEmojis(_0x183c56,_0xe6bf9b,_0x398b20);}});},[nodeTypes['program']](){const _0x2ddf4c=_0x398b20['getAllComments']();for(const _0x1e51b0 of _0x2ddf4c){hasEmoji(_0x1e51b0['value'])&&_0x55e42e['report']({'loc':_0x1e51b0['loc'],'messageId':constants['messageIds']['mustNotUseEmojis'],'fix'(_0x4f26fe){return fixCommentEmojis(_0x1e51b0,_0x4f26fe);}});}}};}});function fixTemplateLiteralEmojis(_0x1dd6f4,_0x371e94,_0x50f8a5){const _0x1e97d2=_0x50f8a5['getText'](_0x1dd6f4),_0x2615a4=_0x1e97d2['replace'](constants['emojiRegex'],'');return _0x371e94['replaceText'](_0x1dd6f4,_0x2615a4);}__name(fixTemplateLiteralEmojis,'fixTemplateLiteralEmojis');function fixLiteralEmojis(_0x518032,_0x3cce23){const _0x304847=_0x518032['value']['replace'](constants['emojiRegex'],''),_0x2080f5=JSON['stringify'](_0x304847);return _0x3cce23['replaceText'](_0x518032,_0x2080f5);}__name(fixLiteralEmojis,'fixLiteralEmojis');function fixCommentEmojis(_0x368008,_0x533f39){const _0x3aeccd=_0x368008['value']['replace'](constants['emojiRegex'],'');let _0x8803c;return _0x368008['type']===nodeTypes['Line']?_0x8803c='//'+_0x3aeccd:_0x8803c='/*'+_0x3aeccd+'*/',_0x533f39['replaceText'](_0x368008,_0x8803c);}__name(fixCommentEmojis,'fixCommentEmojis');function hasEmoji(_0x422a67){return constants['emojiRegex']['lastIndex']=0x1d*-0x29+-0x42d+0x8d2,constants['emojiRegex']['test'](_0x422a67);}__name(hasEmoji,'hasEmoji');function hasEmojiInQuasis(_0x311735){return _0x311735['some'](_0x7a042d=>hasEmoji(_0x7a042d['value']['raw']));}__name(hasEmojiInQuasis,'hasEmojiInQuasis');

export { mustNotUseEmojis as default, ruleName };
