'use strict';
import { ESLintUtils } from '@typescript-eslint/utils';
import { ruleTypes, url } from '@flint/infra/constants/rules-meta';
import { eslintFixTypeNames } from '../../../base-repo/constants/internal-common-strings.js';
import { folders } from '../../../base-repo/app-constants/project-paths.js';
import { externalPackageNames } from '../../../base-repo/app-constants/command-names.js';
import { first } from '../../../fd-toolbox/server/collections/single-funcs.js';

var __defProp=Object['defineProperty'],__name=(_0x52e64c,_0x52dbf3)=>__defProp(_0x52e64c,'name',{'value':_0x52dbf3,'configurable':!![]});const ruleName='must-start-comments-with-uppercase';const constants={'messageIds':{'mustStartCommentsWithUppercase':'mustStartCommentsWithUppercase'},'meta':{'type':ruleTypes['suggestion'],'docs':{'description':'Require\x20comments\x20to\x20start\x20with\x20an\x20uppercase\x20letter.'},'messages':{'mustStartCommentsWithUppercase':'must-start-comments-with-uppercase\x0a\x22{{word}}\x22\x20must\x20start\x20with\x20an\x20uppercase\x20letter.\x0a\x0a###\x20**Must**\x20start\x20comments\x20with\x20uppercase.\x0a\x0a####\x20Wrong\x0a\x0a//\x20approved\x0a\x0a####\x20Correct\x0a\x0a//\x20Approved\x0a\x0a####\x20Why\x0a\x0aUsed\x20to\x20improve\x20readability\x20of\x20comments'},'schema':[],'fixable':eslintFixTypeNames['code']},'regex':/[a-zA-Z]/,'servicePrefixes':[externalPackageNames['eslint'],folders['stringDuplication']]},createRule=ESLintUtils['RuleCreator'](_0x3fea5e=>''+url+_0x3fea5e),mustStartCommentsWithUppercase=createRule({'name':ruleName,'meta':constants['meta'],'defaultOptions':[],'create'(_0x3fb378){const _0xa8b57=_0x3fb378['sourceCode'];return {'Program'(){const _0x14b7ec=_0xa8b57['getAllComments']();for(const _0x50d607 of _0x14b7ec){const _0x2fe7ec=_0x50d607['value']['trim']();if(!shouldReport(_0x2fe7ec))return;const _0x4f14e8=first(_0x2fe7ec['split'](/\s+/));_0x3fb378['report']({'loc':_0x50d607['loc'],'messageId':constants['messageIds']['mustStartCommentsWithUppercase'],'data':{'word':_0x4f14e8},'fix':__name(_0x2b95d9=>createFixes(_0x50d607,_0xa8b57,_0x2b95d9),'fix')});}}};}});function shouldReport(_0x2e7b53){const _0xa12b34=_0x2e7b53['search'](constants['regex']);return !!_0x2e7b53&&!constants['servicePrefixes']['some'](_0x177154=>_0x2e7b53['toLowerCase']()['startsWith'](_0x177154))&&_0xa12b34===0xf6b+-0x243+-0xd28&&_0x2e7b53[_0xa12b34]===_0x2e7b53[_0xa12b34]['toLowerCase']();}__name(shouldReport,'shouldReport');function createFixes(_0x150f54,_0x9f9d17,_0x1ec89c){const _0xa588a5=_0x9f9d17['getText'](_0x150f54);let _0xb20210=-0x2303+0x2*-0x5f2+0x2ee7;while(_0xb20210<_0xa588a5['length']&&!constants['regex']['test'](_0xa588a5[_0xb20210]??'')){_0xb20210++;}const _0x16c996=_0xa588a5[_0xb20210];if(!_0x16c996)return [];const _0x3154d5=first(_0x150f54['range'])+_0xb20210;return [_0x1ec89c['replaceTextRange']([_0x3154d5,_0x3154d5+(-0x39*0x47+-0x5*0x487+0x2673)],_0x16c996['toUpperCase']())];}__name(createFixes,'createFixes');

export { mustStartCommentsWithUppercase as default, ruleName };
