'use strict';
import { createEslintRule } from '@flint/infra/create-eslint-rule';
import { getParentFunction, getPropertySignatureCount, getExportedLocalNames, nodeTypes, isTopLevelNode, isIdentifier } from '@flint/infra/analysis';
import { anyFunction } from '@flint/infra/constants/ast-selectors';

var __defProp=Object['defineProperty'],__name=(_0x15ea0c,_0x2772e2)=>__defProp(_0x15ea0c,'name',{'value':_0x2772e2,'configurable':!![]});const ruleName='must-not-use-inline-object-type-parameters';const ruleContent='\x0a###\x20**Must\x20not**\x20use\x20inline\x20object\x20type\x20parameters\x20with\x20more\x20than\x20two\x20properties\x20in\x20exported\x20functions.\x0a\x0a####\x20Wrong\x0a\x0aexport\x20function\x20foo(bar:\x20{\x20baz:\x20string,\x20qux:\x20number,\x20quux:\x20boolean\x20})\x20{}\x0a\x0a####\x20Correct\x0a\x0afunction\x20foo(bar:\x20{\x20baz:\x20string,\x20qux:\x20number,\x20quux:\x20boolean\x20})\x20{}\x0a\x0aexport\x20function\x20foo(bar:\x20{\x20baz:\x20string,\x20qux:\x20number\x20})\x20{}\x0a\x0aexport\x20function\x20foo(bar:\x20Baz)\x20{}\x0a\x0a####\x20Why\x0a\x0aLarge\x20inline\x20object\x20types\x20in\x20exported\x20function\x20parameters\x20make\x20public\x20APIs\x20harder\x20to\x20read\x20and\x20reuse,\x20while\x20small\x20anonymous\x20shapes\x20remain\x20practical\x20for\x20localized\x20contracts.';var mustNotUseInlineObjectTypeParameters = createEslintRule(ruleName,ruleContent,__name(function create(_0x1681c0){const _0x2d78fb=':matches(Identifier,\x20AssignmentPattern,\x20ObjectPattern,\x20ArrayPattern)',_0x1079b5=anyFunction+'\x20>\x20'+_0x2d78fb+'.params',_0x38d6e7=_0x1079b5+'\x20TSTypeAnnotation\x20>\x20TSTypeLiteral',_0xe8c104=new Set();return {'Program'({body:_0x5c0399}){for(const _0x3aacd1 of _0x5c0399){for(const _0x3df2f3 of getExportedLocalNames(_0x3aacd1)){_0xe8c104['add'](_0x3df2f3);}}},[_0x38d6e7](_0x905538){const _0x11ca1d=getParentFunction(_0x905538);if(!_0x11ca1d||!isExportedFunction(_0x11ca1d,_0xe8c104)||getPropertySignatureCount(_0x905538['members'])<=-0x3b*-0x75+0x1b58+-0x364d)return;_0x1681c0['report']({'node':_0x905538,'messageId':ruleName});}};},'create'));function isExportedFunction(_0xbe4b5a,_0x56a252){return isDirectlyExportedFunction(_0xbe4b5a)||isTopLevelExportedFunctionDeclaration(_0xbe4b5a,_0x56a252)||isTopLevelExportedFunctionVariable(_0xbe4b5a,_0x56a252);}__name(isExportedFunction,'isExportedFunction');function isDirectlyExportedFunction(_0x2dad58){const _0x7eac6e=_0x2dad58['parent'];return !!_0x7eac6e&&(_0x7eac6e['type']===nodeTypes['exportNamedDeclaration']||_0x7eac6e['type']===nodeTypes['exportDefaultDeclaration']);}__name(isDirectlyExportedFunction,'isDirectlyExportedFunction');function isTopLevelExportedFunctionDeclaration(_0xc498d2,_0x3d69f8){return _0xc498d2['type']===nodeTypes['functionDeclaration']&&isTopLevelNode(_0xc498d2)&&!!_0xc498d2['id']&&isIdentifier(_0xc498d2['id'])&&_0x3d69f8['has'](_0xc498d2['id']['name']);}__name(isTopLevelExportedFunctionDeclaration,'isTopLevelExportedFunctionDeclaration');function isTopLevelExportedFunctionVariable(_0x1ef4d7,_0x4d4a66){const _0x2b9ab9=_0x1ef4d7['parent'];let _0x185a55=![];if(_0x2b9ab9&&_0x2b9ab9['type']===nodeTypes['variableDeclarator']&&isIdentifier(_0x2b9ab9['id'])){const _0x36a756=_0x2b9ab9['parent'],_0x524857=_0x36a756?.['parent'],_0xf34c5e=!!_0x36a756&&_0x36a756['type']===nodeTypes['variableDeclaration']&&(isTopLevelNode(_0x36a756)||!!_0x524857&&_0x524857['type']===nodeTypes['exportNamedDeclaration']);_0x185a55=!!_0xf34c5e&&_0x4d4a66['has'](_0x2b9ab9['id']['name']);}return _0x185a55;}__name(isTopLevelExportedFunctionVariable,'isTopLevelExportedFunctionVariable');

export { mustNotUseInlineObjectTypeParameters as default, ruleName };
