diff --git a/CHANGELOG.md b/CHANGELOG.md index 17345d6d..609e2f7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ Change Log === v0.13.0 --- +* **Breaking change:** `mangle` option was removed. +* **New option:** `identifierNamesGenerator` allows to set identifier names generator (`hexadecimal` or `mangled`). * **Breaking change:** all CLI options were renamed to `kebab-case` format (`--disableConsoleOutout` -> `--disable-console-output`) * Implemented custom `mangle` option algorithm without `esmangle`; fixed https://github.com/javascript-obfuscator/javascript-obfuscator/issues/110 diff --git a/README.md b/README.md index 2fed223c..c149366c 100644 --- a/README.md +++ b/README.md @@ -256,8 +256,8 @@ Following options are available for the JS Obfuscator: debugProtectionInterval: false, disableConsoleOutput: false, domainLock: [], + identifierNamesGenerator: 'hexadecimal', log: false, - mangle: false, renameGlobals: false, reservedNames: [], rotateStringArray: true, @@ -292,8 +292,8 @@ Following options are available for the JS Obfuscator: --debug-protection-interval --disable-console-output --domain-lock '' (comma separated) + --identifier-names-generator [hexadecimal, mangled] --log - --mangle --rename-globals --reserved-names '' (comma separated) --rotate-string-array @@ -539,16 +539,20 @@ Locks the obfuscated source code so it only runs on specific domains and/or sub- ##### Multiple domains and sub-domains It's possible to lock your code to more than one domain or sub-domain. For instance, to lock it so the code only runs on **www.example.com** add `www.example.com`, to make it work on any sub-domain from example.com, use `.example.com`. +### `identifierNamesGenerator` +Type: `string` Default: `hexadecimal` + +Sets identifier names generator. + +Available values: +* `hexadecimal`: identifier names like `_0xabc123` +* `mangled`: short identifier names like `a`, `b`, `c` + ### `log` Type: `boolean` Default: `false` Enables logging of the information to the console. -### `mangle` -Type: `boolean` Default: `false` - -Enables mangling of variable names. - ### `renameGlobals` Type: `boolean` Default: `false` @@ -649,7 +653,7 @@ Type: `boolean|string` Default: `false` ##### :warning: `stringArray` option must be enabled -This option can slightly slow down your script. +This option can slow down your script. Encode all string literals of the [`stringArray`](#stringarray) using `base64` or `rc4` and inserts a special code that used to decode it back at runtime. @@ -697,23 +701,23 @@ Performance will 50-100% slower than without obfuscation ```javascript { - compact: true, - controlFlowFlattening: true, - controlFlowFlatteningThreshold: 1, - deadCodeInjection: true, - deadCodeInjectionThreshold: 1, - debugProtection: true, - debugProtectionInterval: true, - disableConsoleOutput: true, - log: false, - mangle: false, - renameGlobals: false, - rotateStringArray: true, - selfDefending: true, - stringArray: true, - stringArrayEncoding: 'rc4', - stringArrayThreshold: 1, - unicodeEscapeSequence: false + compact: true, + controlFlowFlattening: true, + controlFlowFlatteningThreshold: 1, + deadCodeInjection: true, + deadCodeInjectionThreshold: 1, + debugProtection: true, + debugProtectionInterval: true, + disableConsoleOutput: true, + identifierNamesGenerator: 'hexadecimal', + log: false, + renameGlobals: false, + rotateStringArray: true, + selfDefending: true, + stringArray: true, + stringArrayEncoding: 'rc4', + stringArrayThreshold: 1, + unicodeEscapeSequence: false } ``` @@ -723,23 +727,23 @@ Performance will 30-35% slower than without obfuscation ```javascript { - compact: true, - controlFlowFlattening: true, - controlFlowFlatteningThreshold: 0.75, - deadCodeInjection: true, - deadCodeInjectionThreshold: 0.4, - debugProtection: false, - debugProtectionInterval: false, - disableConsoleOutput: true, - log: false, - mangle: false, - renameGlobals: false, - rotateStringArray: true, - selfDefending: true, - stringArray: true, - stringArrayEncoding: 'base64', - stringArrayThreshold: 0.75, - unicodeEscapeSequence: false + compact: true, + controlFlowFlattening: true, + controlFlowFlatteningThreshold: 0.75, + deadCodeInjection: true, + deadCodeInjectionThreshold: 0.4, + debugProtection: false, + debugProtectionInterval: false, + disableConsoleOutput: true, + identifierNamesGenerator: 'hexadecimal', + log: false, + renameGlobals: false, + rotateStringArray: true, + selfDefending: true, + stringArray: true, + stringArrayEncoding: 'base64', + stringArrayThreshold: 0.75, + unicodeEscapeSequence: false } ``` @@ -749,21 +753,21 @@ Performance will slightly slower than without obfuscation ```javascript { - compact: true, - controlFlowFlattening: false, - deadCodeInjection: false, - debugProtection: false, - debugProtectionInterval: false, - disableConsoleOutput: true, - log: false, - mangle: true, - renameGlobals: false, - rotateStringArray: true, - selfDefending: true, - stringArray: true, - stringArrayEncoding: false, - stringArrayThreshold: 0.75, - unicodeEscapeSequence: false + compact: true, + controlFlowFlattening: false, + deadCodeInjection: false, + debugProtection: false, + debugProtectionInterval: false, + disableConsoleOutput: true, + identifierNamesGenerator: 'hexadecimal', + log: false, + renameGlobals: false, + rotateStringArray: true, + selfDefending: true, + stringArray: true, + stringArrayEncoding: false, + stringArrayThreshold: 0.75, + unicodeEscapeSequence: false } ``` diff --git a/dist/index.js b/dist/index.js index 716af8a0..5894e2a7 100644 --- a/dist/index.js +++ b/dist/index.js @@ -21,5 +21,5 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -require("source-map-support").install(),module.exports=function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=46)}([function(e,t){e.exports=require("inversify")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e.Factory__ICalleeDataExtractor="Factory",e.Factory__IControlFlowCustomNode="Factory",e.Factory__IControlFlowReplacer="Factory",e.Factory__ICustomNode="Factory",e.Factory__ICustomNodeGroup="Factory",e.Factory__IIdentifierNameGenerator="Factory",e.Factory__IIdentifierObfuscatingReplacer="Factory",e.Factory__INodeGuard="Factory",e.Factory__INodeTransformer="Factory",e.Factory__IObfuscationResult="Factory",e.Factory__IObfuscatingReplacer="Factory",e.Factory__TControlFlowStorage="Factory",e.IArrayUtils="IArrayUtils",e.ICalleeDataExtractor="ICalleeDataExtractor",e.ICryptUtils="ICryptUtils",e.ICustomNode="ICustomNode",e.ICustomNodeGroup="ICustomNodeGroup",e.IControlFlowReplacer="IControlFlowReplacer",e.IEscapeSequenceEncoder="IEscapeSequenceEncoder",e.IIdentifierNameGenerator="IIdentifierNameGenerator",e.IIdentifierObfuscatingReplacer="IIdentifierObfuscatingReplacer",e.IJavaScriptObfuscator="IJavaScriptObfuscator",e.ILogger="ILogger",e.INodeGuard="INodeGuard",e.INodeTransformer="INodeTransformer",e.IObfuscationEventEmitter="IObfuscationEventEmitter",e.IObfuscationResult="IObfuscationResult",e.IOptions="IOptions",e.IObfuscatingReplacer="IObfuscatingReplacer",e.IRandomGenerator="IRandomGenerator",e.ISourceCode="ISourceCode",e.ISourceMapCorrector="ISourceMapCorrector",e.IStackTraceAnalyzer="IStackTraceAnalyzer",e.ITransformersRunner="ITransformersRunner",e.Newable__ICustomNode="Newable",e.Newable__TControlFlowStorage="Newable",e.TCustomNodeGroupStorage="TCustomNodeGroupStorage",e.TStringArrayStorage="TStringArrayStorage"}(t.ServiceIdentifiers||(t.ServiceIdentifiers={}))},function(e,t){e.exports=require("tslib")},function(e,t,r){"use strict";function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"initialize",t=Object.keys(this)[0];return function(r,n){var o={configurable:!0,enumerable:!0},a=r[e];if(!a||"function"!=typeof a)throw new Error("`"+e+"` method with initialization logic not found. `@"+t+"` decorator requires `"+e+"` method");var i="_"+n,c=Object.getOwnPropertyDescriptor(r,i)||o,s=Object.getOwnPropertyDescriptor(r,e)||o,u=s.value;return Object.defineProperty(r,n,Object.assign({},c,{get:function(){if(void 0===this[i])throw new Error("Property `"+n+"` is not initialized! Initialize it first!");return this[i]},set:function(e){this[i]=e}})),Object.defineProperty(r,e,Object.assign({},s,{value:function(){u.apply(this,arguments),this[n]}})),c}}Object.defineProperty(t,"__esModule",{value:!0}),t.initializable=n},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=function(){function e(e,t){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:0;if(l.NodeGuards.isNodeHasBlockStatement(e)){if(void 0===e.body[t])throw new ReferenceError("Wrong index `"+t+"`. Block-statement body length is `"+e.body.length+"`");return e.body[t]}throw new TypeError("The specified node have no a block-statement")}},{key:"getBlockScopesOfNode",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=t.parentNode;if(!n)throw new ReferenceError("`parentNode` property of given node is `undefined`");if(l.NodeGuards.isBlockStatementNode(n)){if(!n.parentNode)throw new ReferenceError("`parentNode` property of `parentNode` of given node is `undefined`");-1!==e.nodesWithBlockScope.indexOf(n.parentNode.type)&&r.push(n)}return t!==n?e.getBlockScopesOfNode(n,r):(l.NodeGuards.isNodeHasBlockStatement(n)&&r.push(n),r)}},{key:"getNodeBlockScopeDepth",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=t.parentNode;if(!n)throw new ReferenceError("`parentNode` property of given node is `undefined`");return l.NodeGuards.isProgramNode(n)?r:l.NodeGuards.isBlockStatementNode(t)&&-1!==e.nodesWithBlockScope.indexOf(n.type)?e.getNodeBlockScopeDepth(n,++r):e.getNodeBlockScopeDepth(n,r)}},{key:"getUnaryExpressionArgumentNode",value:function(t){return l.NodeGuards.isUnaryExpressionNode(t.argument)?e.getUnaryExpressionArgumentNode(t.argument):t.argument}},{key:"parentize",value:function(t){return s.traverse(t,{enter:e.parentizeNode}),t}},{key:"parentizeNode",value:function(e,t){return e.parentNode=t||e,e.obfuscatedNode=!1,e}}]),e}();f.nodesWithBlockScope=[u.NodeType.ArrowFunctionExpression,u.NodeType.FunctionDeclaration,u.NodeType.FunctionExpression,u.NodeType.MethodDefinition,u.NodeType.Program],t.NodeUtils=f},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:[];return{type:i.NodeType.Program,body:e,sourceType:"script",obfuscatedNode:!1}}},{key:"getArrayExpressionNode",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return{type:i.NodeType.ArrayExpression,elements:e}}},{key:"getAssignmentExpressionNode",value:function(e,t,r){return{type:i.NodeType.AssignmentExpression,operator:e,left:t,right:r,obfuscatedNode:!1}}},{key:"getBinaryExpressionNode",value:function(e,t,r){return{type:i.NodeType.BinaryExpression,operator:e,left:t,right:r,obfuscatedNode:!1}}},{key:"getBlockStatementNode",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return{type:i.NodeType.BlockStatement,body:e,obfuscatedNode:!1}}},{key:"getBreakStatement",value:function(e){var t={type:i.NodeType.BreakStatement,obfuscatedNode:!1};return e&&(t.label=e),t}},{key:"getCatchClauseNode",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return{type:i.NodeType.CatchClause,param:e.getIdentifierNode("err"),body:e.getBlockStatementNode(t),obfuscatedNode:!1}}},{key:"getCallExpressionNode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return{type:i.NodeType.CallExpression,callee:e,arguments:t,obfuscatedNode:!1}}},{key:"getContinueStatement",value:function(e){var t={type:i.NodeType.ContinueStatement,obfuscatedNode:!1};return e&&(t.label=e),t}},{key:"getExpressionStatementNode",value:function(e){return{type:i.NodeType.ExpressionStatement,expression:e,obfuscatedNode:!1}}},{key:"getFunctionDeclarationNode",value:function(t,r,n){return{type:i.NodeType.FunctionDeclaration,id:e.getIdentifierNode(t),params:r,body:n,generator:!1,obfuscatedNode:!1}}},{key:"getFunctionExpressionNode",value:function(e,t){return{type:i.NodeType.FunctionExpression,params:e,body:t,generator:!1,obfuscatedNode:!1}}},{key:"getIfStatementNode",value:function(e,t,r){return Object.assign({type:i.NodeType.IfStatement,test:e,consequent:t},r&&{alternate:r},{obfuscatedNode:!1})}},{key:"getIdentifierNode",value:function(e){return{type:i.NodeType.Identifier,name:e,obfuscatedNode:!1}}},{key:"getLabeledStatement",value:function(e,t){return{type:i.NodeType.LabeledStatement,label:e,body:t,obfuscatedNode:!1}}},{key:"getLiteralNode",value:function(e,t){return t=void 0!==t?t:"'"+e+"'",{type:i.NodeType.Literal,value:e,raw:t,"x-verbatim-property":{content:t,precedence:a.Precedence.Primary},obfuscatedNode:!1}}},{key:"getLogicalExpressionNode",value:function(e,t,r){return{type:i.NodeType.LogicalExpression,operator:e,left:t,right:r,obfuscatedNode:!1}}},{key:"getMemberExpressionNode",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return{type:i.NodeType.MemberExpression,computed:r,object:e,property:t,obfuscatedNode:!1}}},{key:"getObjectExpressionNode",value:function(e){return{type:i.NodeType.ObjectExpression,properties:e,obfuscatedNode:!1}}},{key:"getPropertyNode",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return{type:i.NodeType.Property,key:e,value:t,kind:"init",method:!1,shorthand:!1,computed:r,obfuscatedNode:!1}}},{key:"getUnaryExpressionNode",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return{type:i.NodeType.UnaryExpression,operator:e,argument:t,prefix:r,obfuscatedNode:!1}}},{key:"getReturnStatementNode",value:function(e){return{type:i.NodeType.ReturnStatement,argument:e,obfuscatedNode:!1}}},{key:"getSwitchStatementNode",value:function(e,t){return{type:i.NodeType.SwitchStatement,discriminant:e,cases:t,obfuscatedNode:!1}}},{key:"getSwitchCaseNode",value:function(e,t){return{type:i.NodeType.SwitchCase,test:e,consequent:t,obfuscatedNode:!1}}},{key:"getUpdateExpressionNode",value:function(e,t){return{type:i.NodeType.UpdateExpression,operator:e,argument:t,prefix:!1,obfuscatedNode:!1}}},{key:"getVariableDeclarationNode",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"var";return{type:i.NodeType.VariableDeclaration,declarations:e,kind:t,obfuscatedNode:!1}}},{key:"getVariableDeclaratorNode",value:function(e,t){return{type:i.NodeType.VariableDeclarator,id:e,init:t,obfuscatedNode:!1}}},{key:"getWhileStatementNode",value:function(e,t){return{type:i.NodeType.WhileStatement,test:e,body:t,obfuscatedNode:!1}}}]),e}();t.Nodes=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e.ArrayExpression="ArrayExpression",e.ArrowFunctionExpression="ArrowFunctionExpression",e.AssignmentExpression="AssignmentExpression",e.AssignmentPattern="AssignmentPattern",e.AwaitExpression="AwaitExpression",e.BinaryExpression="BinaryExpression",e.BlockStatement="BlockStatement",e.BreakStatement="BreakStatement",e.CallExpression="CallExpression",e.CatchClause="CatchClause",e.ClassDeclaration="ClassDeclaration",e.ContinueStatement="ContinueStatement",e.ExpressionStatement="ExpressionStatement",e.FunctionDeclaration="FunctionDeclaration",e.FunctionExpression="FunctionExpression",e.Identifier="Identifier",e.IfStatement="IfStatement",e.LabeledStatement="LabeledStatement",e.Literal="Literal",e.LogicalExpression="LogicalExpression",e.MemberExpression="MemberExpression",e.MethodDefinition="MethodDefinition",e.ObjectExpression="ObjectExpression",e.ObjectPattern="ObjectPattern",e.Program="Program",e.Property="Property",e.ReturnStatement="ReturnStatement",e.Super="Super",e.SwitchCase="SwitchCase",e.SwitchStatement="SwitchStatement",e.TemplateLiteral="TemplateLiteral",e.TryStatement="TryStatement",e.UnaryExpression="UnaryExpression",e.UpdateExpression="UpdateExpression",e.VariableDeclaration="VariableDeclaration",e.VariableDeclarator="VariableDeclarator",e.WhileStatement="WhileStatement"}(t.NodeType||(t.NodeType={}))},function(e,t){e.exports=require("string-template")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e[e.BinaryExpressionFunctionNode=0]="BinaryExpressionFunctionNode",e[e.BlockStatementControlFlowFlatteningNode=1]="BlockStatementControlFlowFlatteningNode",e[e.CallExpressionControlFlowStorageCallNode=2]="CallExpressionControlFlowStorageCallNode",e[e.CallExpressionFunctionNode=3]="CallExpressionFunctionNode",e[e.ControlFlowStorageNode=4]="ControlFlowStorageNode",e[e.ExpressionWithOperatorControlFlowStorageCallNode=5]="ExpressionWithOperatorControlFlowStorageCallNode",e[e.LogicalExpressionFunctionNode=6]="LogicalExpressionFunctionNode",e[e.StringLiteralControlFlowStorageCallNode=7]="StringLiteralControlFlowStorageCallNode",e[e.StringLiteralNode=8]="StringLiteralNode"}(t.ControlFlowCustomNode||(t.ControlFlowCustomNode={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e.Browser="browser",e.Extension="extension",e.Node="node"}(t.ObfuscationTarget||(t.ObfuscationTarget={}))},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var r=0;r1?t-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:{},r=new i.InversifyContainerFacade;r.load(e,t);var n=r.get(a.ServiceIdentifiers.IJavaScriptObfuscator),o=n.obfuscate(e);return r.unload(),o}},{key:"runCLI",value:function(e){var t=new c.JavaScriptObfuscatorCLI(e);t.initialize(),t.run()}}]),e}();t.JavaScriptObfuscator=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e[e.BlockStatementControlFlowTransformer=0]="BlockStatementControlFlowTransformer",e[e.ClassDeclarationTransformer=1]="ClassDeclarationTransformer",e[e.DeadCodeInjectionTransformer=2]="DeadCodeInjectionTransformer",e[e.FunctionControlFlowTransformer=3]="FunctionControlFlowTransformer",e[e.CatchClauseTransformer=4]="CatchClauseTransformer",e[e.FunctionDeclarationTransformer=5]="FunctionDeclarationTransformer",e[e.FunctionTransformer=6]="FunctionTransformer",e[e.LabeledStatementTransformer=7]="LabeledStatementTransformer",e[e.LiteralTransformer=8]="LiteralTransformer",e[e.MemberExpressionTransformer=9]="MemberExpressionTransformer",e[e.MethodDefinitionTransformer=10]="MethodDefinitionTransformer",e[e.ObfuscatingGuardsTransformer=11]="ObfuscatingGuardsTransformer",e[e.ObjectExpressionTransformer=12]="ObjectExpressionTransformer",e[e.ParentificationTransformer=13]="ParentificationTransformer",e[e.TemplateLiteralTransformer=14]="TemplateLiteralTransformer",e[e.VariableDeclarationTransformer=15]="VariableDeclarationTransformer"}(t.NodeTransformer||(t.NodeTransformer={}))},function(e,t,r){"use strict";function n(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t3&&void 0!==arguments[3]?arguments[3]:0,a=void 0;a=t.length?e.getOptimalBlockScope(t,o):r,e.prependNode(a,n)}},{key:"getOptimalBlockScope",value:function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1/0,o=t[r];if(n<=0)throw new Error("Invalid `deep` argument value. Value should be bigger then 0.");return n>1&&o.stackTrace.length?e.getOptimalBlockScope(o.stackTrace,0,--n):o.callee}},{key:"insertNodeAtIndex",value:function(t,r,o){e.validateBodyStatements(r)||(r=[]),r=e.parentizeBodyStatementsBeforeAppend(t,r),t.body=[].concat(n(t.body.slice(0,o)),n(r),n(t.body.slice(o)))}},{key:"prependNode",value:function(t,r){e.validateBodyStatements(r)||(r=[]),r=e.parentizeBodyStatementsBeforeAppend(t,r),t.body=[].concat(n(r),n(t.body))}},{key:"parentizeBodyStatementsBeforeAppend",value:function(e,t){return t.forEach(function(t){t.parentNode=e}),t}},{key:"validateBodyStatements",value:function(e){return e.every(function(e){return!!e&&e.hasOwnProperty("type")})}}]),e}();t.NodeAppender=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e[e.ConsoleOutputDisableExpressionNode=0]="ConsoleOutputDisableExpressionNode",e[e.DebugProtectionFunctionCallNode=1]="DebugProtectionFunctionCallNode",e[e.DebugProtectionFunctionIntervalNode=2]="DebugProtectionFunctionIntervalNode",e[e.DebugProtectionFunctionNode=3]="DebugProtectionFunctionNode",e[e.DomainLockNode=4]="DomainLockNode",e[e.NodeCallsControllerFunctionNode=5]="NodeCallsControllerFunctionNode",e[e.SelfDefendingUnicodeNode=6]="SelfDefendingUnicodeNode",e[e.StringArrayCallsWrapper=7]="StringArrayCallsWrapper",e[e.StringArrayNode=8]="StringArrayNode",e[e.StringArrayRotateFunctionNode=9]="StringArrayRotateFunctionNode"}(t.CustomNode||(t.CustomNode={}))},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var r=0;r-1||0===e.indexOf("//")?e.split("/")[2]:e.split("/")[0],t=t.split(":")[0]}},{key:"isCeilNumber",value:function(e){return e%1==0}},{key:"stringRotate",value:function(e,t){if(!e)throw new ReferenceError("Cannot rotate empty string.");for(var r=0;r [options]").version(c.version,"-v, --version").option("-o, --output ","Output path for obfuscated code").option("--compact ","Disable one line output code compacting",d.BooleanSanitizer).option("--config ","Name of js / json config file").option("--control-flow-flattening ","Enables control flow flattening",d.BooleanSanitizer).option("--control-flow-flattening-threshold ","The probability that the control flow flattening transformation will be applied to the node",parseFloat).option("--dead-code-injection ","Enables dead code injection",d.BooleanSanitizer).option("--dead-code-injection-threshold ","The probability that the dead code injection transformation will be applied to the node",parseFloat).option("--debug-protection ","Disable browser Debug panel (can cause DevTools enabled browser freeze)",d.BooleanSanitizer).option("--debug-protection-interval ","Disable browser Debug panel even after page was loaded (can cause DevTools enabled browser freeze)",d.BooleanSanitizer).option("--disable-console-output ","Allow console.log, console.info, console.error and console.warn messages output into browser console",d.BooleanSanitizer).option("--domain-lock (comma separated, without whitespaces)","Blocks the execution of the code in domains that do not match the passed RegExp patterns (comma separated)",f.ArraySanitizer).option("--log ","Enables logging of the information to the console",d.BooleanSanitizer).option("--mangle ","Enables mangling of variable names",d.BooleanSanitizer).option("--reserved-names (comma separated, without whitespaces)","Disable obfuscation of variable names, function names and names of function parameters that match the passed RegExp patterns (comma separated)",f.ArraySanitizer).option("--rename-globals ","Allows to enable obfuscation of global variable and function names with declaration.",d.BooleanSanitizer).option("--rotate-string-array ","Disable rotation of unicode array values during obfuscation",d.BooleanSanitizer).option("--seed ","Sets seed for random generator. This is useful for creating repeatable results.",parseFloat).option("--self-defending ","Disables self-defending for obfuscated code",d.BooleanSanitizer).option("--source-map ","Enables source map generation",d.BooleanSanitizer).option("--source-map-base-url ","Sets base url to the source map import url when `--source-map-mode=separate`").option("--source-map-file-name ","Sets file name for output source map when `--source-map-mode=separate`").option("--source-map-mode [inline, separate]","Specify source map output mode",y.SourceMapModeSanitizer).option("--string-array ","Disables gathering of all literal strings into an array and replacing every literal string with an array call",d.BooleanSanitizer).option("--string-array-encoding [true, false, base64, rc4]","Encodes all strings in strings array using base64 or rc4 (this option can slow down your code speed",m.StringArrayEncodingSanitizer).option("--string-array-threshold ","The probability that the literal string will be inserted into stringArray (Default: 0.8, Min: 0, Max: 1)",parseFloat).option("--target ","Allows to set target environment for obfuscated code.",p.ObfuscationTargetSanitizer).option("--unicode-escape-sequence ","Allows to enable/disable string conversion to unicode escape sequence",d.BooleanSanitizer).parse(this.rawArguments)}},{key:"configureHelp",value:function(){this.commands.on("--help",function(){console.log(" Examples:\n"),console.log(" %> javascript-obfuscator input_file_name.js --compact true --self-defending false"),console.log(" %> javascript-obfuscator input_file_name.js --output output_file_name.js --compact true --self-defending false"),console.log(" %> javascript-obfuscator input_directory_name --compact true --self-defending false"),console.log("")})}},{key:"processSourceCodeData",value:function(e){var t=this;if(Array.isArray(e))e.forEach(function(e){var r=e.filePath,n=e.content,o=b.CLIUtils.getOutputCodePath(r);t.processSourceCode(n,o)});else{var r=this.inputCLIOptions.output||b.CLIUtils.getOutputCodePath(this.inputPath);this.processSourceCode(e,r)}}},{key:"processSourceCode",value:function(t,r){var n=this.buildOptions();n.sourceMap?e.processSourceCodeWithSourceMap(t,r,n):e.processSourceCodeWithoutSourceMap(t,r,n)}}],[{key:"filterOptions",value:function(e){var t={};for(var r in e)e.hasOwnProperty(r)&&void 0!==e[r]&&(t[r]=e[r]);return t}},{key:"processSourceCodeWithoutSourceMap",value:function(e,t,r){var n=g.JavaScriptObfuscator.obfuscate(e,r).getObfuscatedCode();b.CLIUtils.writeFile(t,n)}},{key:"processSourceCodeWithSourceMap",value:function(e,t,r){var n=b.CLIUtils.getOutputSourceMapPath(t,r.sourceMapFileName||"");r=Object.assign({},r,{sourceMapFileName:s.basename(n)});var o=g.JavaScriptObfuscator.obfuscate(e,r);b.CLIUtils.writeFile(t,o.getObfuscatedCode()),"separate"===r.sourceMapMode&&o.getSourceMap()&&b.CLIUtils.writeFile(n,o.getSourceMap())}}]),e}();h.availableInputExtensions=[".js"],h.encoding="utf8",h.obfuscatedFilePrefix="-obfuscated",a.__decorate([u.initializable(),a.__metadata("design:type",Object)],h.prototype,"commands",void 0),a.__decorate([u.initializable(),a.__metadata("design:type",Object)],h.prototype,"inputCLIOptions",void 0),a.__decorate([u.initializable(),a.__metadata("design:type",String)],h.prototype,"inputPath",void 0),t.JavaScriptObfuscatorCLI=h},function(e,t){e.exports=require("path")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e[e.FunctionDeclarationCalleeDataExtractor=0]="FunctionDeclarationCalleeDataExtractor",e[e.FunctionExpressionCalleeDataExtractor=1]="FunctionExpressionCalleeDataExtractor",e[e.ObjectExpressionCalleeDataExtractor=2]="ObjectExpressionCalleeDataExtractor"}(t.CalleeDataExtractor||(t.CalleeDataExtractor={}))},function(e,t){e.exports=require("esprima")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e[e.BinaryExpressionControlFlowReplacer=0]="BinaryExpressionControlFlowReplacer",e[e.CallExpressionControlFlowReplacer=1]="CallExpressionControlFlowReplacer",e[e.LogicalExpressionControlFlowReplacer=2]="LogicalExpressionControlFlowReplacer",e[e.StringLiteralControlFlowReplacer=3]="StringLiteralControlFlowReplacer"}(t.ControlFlowReplacer||(t.ControlFlowReplacer={}))},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;r1&&void 0!==arguments[1]&&arguments[1];this.storage=new Map([].concat(n(this.storage),n(e.getStorage()))),t&&(this.storageId=e.getStorageId())}},{key:"set",value:function(e,t){this.storage.set(e,t)}}]),e}();c.__decorate([l.initializable(),c.__metadata("design:type",String)],f.prototype,"storageId",void 0),c.__decorate([l.initializable(),c.__metadata("design:type",Map)],f.prototype,"storage",void 0),c.__decorate([s.postConstruct(),c.__metadata("design:type",Function),c.__metadata("design:paramtypes",[]),c.__metadata("design:returntype",void 0)],f.prototype,"initialize",null),f=c.__decorate([s.injectable(),c.__param(0,s.inject(u.ServiceIdentifiers.IRandomGenerator)),c.__param(1,s.inject(u.ServiceIdentifiers.IOptions)),c.__metadata("design:paramtypes",[Object,Object])],f),t.MapStorage=f},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:d.randomGeneratorPool;return this.getRandomGenerator().string({length:e,pool:t})}},{key:"getSeed",value:function(){return this.seed}}]),e}();f.randomGeneratorPool="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",f.randomGeneratorPoolNumbers="0123456789",f.randomGeneratorPoolHexadecimal="abcdef"+d.randomGeneratorPoolNumbers,a.__decorate([l.initializable(),a.__metadata("design:type",Object)],f.prototype,"randomGenerator",void 0),a.__decorate([l.initializable(),a.__metadata("design:type",Number)],f.prototype,"seed",void 0),a.__decorate([i.postConstruct(),a.__metadata("design:type",Function),a.__metadata("design:paramtypes",[]),a.__metadata("design:returntype",void 0)],f.prototype,"initialize",null),f=d=a.__decorate([i.injectable(),a.__param(0,i.inject(c.ServiceIdentifiers.ISourceCode)),a.__param(1,i.inject(c.ServiceIdentifiers.IOptions)),a.__metadata("design:paramtypes",[Object,Object])],f),t.RandomGenerator=f;var d},function(e,t){e.exports=require("pjson")},function(e,t){e.exports=require("fs")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(17);e.exports=n.JavaScriptObfuscator},function(e,t){e.exports=require("reflect-metadata")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(14),o=r(0),a=r(1),i=r(34),c=r(49),s=r(50),u=r(51),l=r(52);t.analyzersModule=new o.ContainerModule(function(e){e(a.ServiceIdentifiers.IStackTraceAnalyzer).to(l.StackTraceAnalyzer).inSingletonScope(),e(a.ServiceIdentifiers.ICalleeDataExtractor).to(c.FunctionDeclarationCalleeDataExtractor).whenTargetNamed(i.CalleeDataExtractor.FunctionDeclarationCalleeDataExtractor),e(a.ServiceIdentifiers.ICalleeDataExtractor).to(s.FunctionExpressionCalleeDataExtractor).whenTargetNamed(i.CalleeDataExtractor.FunctionExpressionCalleeDataExtractor),e(a.ServiceIdentifiers.ICalleeDataExtractor).to(u.ObjectExpressionCalleeDataExtractor).whenTargetNamed(i.CalleeDataExtractor.ObjectExpressionCalleeDataExtractor),e(a.ServiceIdentifiers.Factory__ICalleeDataExtractor).toFactory(n.InversifyContainerFacade.getCacheFactory(a.ServiceIdentifiers.ICalleeDataExtractor))})},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;rr)return"break";var a=e[o];s.traverse(a,{enter:function(r){if(l.NodeGuards.isCallExpressionNode(r))return a.parentNode!==f.NodeUtils.getBlockScopesOfNode(r)[0]?s.VisitorOption.Skip:void t.analyzeCallExpressionNode(n,e,r)}})}(a))break}return n}},{key:"analyzeCallExpressionNode",value:function(e,t,r){var n=this;p.calleeDataExtractorsList.forEach(function(o){var a=n.calleeDataExtractorFactory(o).extract(t,r.callee);a&&e.push(Object.assign({},a,{stackTrace:n.analyzeRecursive(a.callee.body)}))})}}],[{key:"getLimitIndex",value:function(e){var t=e-1,r=p.limitThresholdActivationLength-1,n=t;return t>r&&(n=Math.round(r+t*p.limitThreshold))>t&&(n=t),n}}]),e}();d.calleeDataExtractorsList=[u.CalleeDataExtractor.FunctionDeclarationCalleeDataExtractor,u.CalleeDataExtractor.FunctionExpressionCalleeDataExtractor,u.CalleeDataExtractor.ObjectExpressionCalleeDataExtractor],d.limitThresholdActivationLength=25,d.limitThreshold=.002,d=p=a.__decorate([i.injectable(),a.__param(0,i.inject(c.ServiceIdentifiers.Factory__ICalleeDataExtractor)),a.__metadata("design:paramtypes",[Function])],d),t.StackTraceAnalyzer=d;var p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(14),o=r(0),a=r(1),i=r(36),c=r(18),s=r(54),u=r(55),l=r(56),f=r(57),d=r(58),p=r(59),y=r(60);t.controlFlowTransformersModule=new o.ContainerModule(function(e){e(a.ServiceIdentifiers.INodeTransformer).to(u.BlockStatementControlFlowTransformer).whenTargetNamed(c.NodeTransformer.BlockStatementControlFlowTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(f.DeadCodeInjectionTransformer).whenTargetNamed(c.NodeTransformer.DeadCodeInjectionTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(d.FunctionControlFlowTransformer).whenTargetNamed(c.NodeTransformer.FunctionControlFlowTransformer),e(a.ServiceIdentifiers.IControlFlowReplacer).to(s.BinaryExpressionControlFlowReplacer).whenTargetNamed(i.ControlFlowReplacer.BinaryExpressionControlFlowReplacer),e(a.ServiceIdentifiers.IControlFlowReplacer).to(l.CallExpressionControlFlowReplacer).whenTargetNamed(i.ControlFlowReplacer.CallExpressionControlFlowReplacer),e(a.ServiceIdentifiers.IControlFlowReplacer).to(p.LogicalExpressionControlFlowReplacer).whenTargetNamed(i.ControlFlowReplacer.LogicalExpressionControlFlowReplacer),e(a.ServiceIdentifiers.IControlFlowReplacer).to(y.StringLiteralControlFlowReplacer).whenTargetNamed(i.ControlFlowReplacer.StringLiteralControlFlowReplacer),e(a.ServiceIdentifiers.Factory__IControlFlowReplacer).toFactory(n.InversifyContainerFacade.getCacheFactory(a.ServiceIdentifiers.IControlFlowReplacer))})},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;rthis.options.controlFlowFlatteningThreshold||!m.canTransformBlockStatementNode(e))return e;var r=e.body,n=this.arrayUtils.arrayRange(r.length),o=this.arrayUtils.arrayShuffle(n),a=n.map(function(e){return o.indexOf(e)}),i=this.controlFlowCustomNodeFactory(f.ControlFlowCustomNode.BlockStatementControlFlowFlatteningNode);return i.initialize(r,o,a),i.getNode()[0]}}],[{key:"blockStatementHasProhibitedStatements",value:function(e){return e.body.some(function(e){var t=p.NodeGuards.isBreakStatementNode(e)||p.NodeGuards.isContinueStatementNode(e),r=p.NodeGuards.isVariableDeclarationNode(e)&&("const"===e.kind||"let"===e.kind);return p.NodeGuards.isFunctionDeclarationNode(e)||t||r})}},{key:"canTransformBlockStatementNode",value:function(e){var t=!0;return l.traverse(e,{enter:function(e){if(p.NodeGuards.isWhileStatementNode(e))return l.VisitorOption.Skip;p.NodeGuards.isBlockStatementNode(e)&&m.blockStatementHasProhibitedStatements(e)&&(t=!1)}}),e.body.length<=4&&(t=!1),t}}]),t}(d.AbstractNodeTransformer);y=m=c.__decorate([s.injectable(),c.__param(0,s.inject(u.ServiceIdentifiers.Factory__IControlFlowCustomNode)),c.__param(1,s.inject(u.ServiceIdentifiers.IArrayUtils)),c.__param(2,s.inject(u.ServiceIdentifiers.IRandomGenerator)),c.__param(3,s.inject(u.ServiceIdentifiers.IOptions)),c.__metadata("design:paramtypes",[Function,Object,Object,Object])],y),t.BlockStatementControlFlowTransformer=y;var m},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;rthis.options.deadCodeInjectionThreshold)return e;if(g.NodeUtils.getBlockScopesOfNode(e)[0].type===p.NodeType.Program)return e;var r=this.collectedBlockStatements.length-1,n=this.randomGenerator.getRandomInteger(0,r),o=this.collectedBlockStatements.splice(n,1)[0];return o===e?e:this.replaceBlockStatementNode(e,o)}},{key:"collectBlockStatementNodes",value:function(e,t){var r=g.NodeUtils.clone(e),n=0,o=!0;f.replace(r,{enter:function(e,t){return m.NodeGuards.isBlockStatementNode(e)&&n++,n>h.maxNestedBlockStatementsCount||!h.isValidBlockStatementNode(e)?(o=!1,f.VisitorOption.Break):e}}),o&&(r=this.transformersRunner.transform(r,h.transformersToRenameBlockScopeIdentifiers),t.push(r))}},{key:"replaceBlockStatementNode",value:function(e,t){var r=this.randomGenerator.getMathRandom()>.5,n=this.randomGenerator.getMathRandom()>.5,o=r?"===":"!==",a=this.randomGenerator.getRandomString(3),c=n?a:this.randomGenerator.getRandomString(3),s=r===n?[e,t]:[t,e],u=i(s,2),l=u[0],f=u[1],d=b.Nodes.getBlockStatementNode([b.Nodes.getIfStatementNode(b.Nodes.getBinaryExpressionNode(o,b.Nodes.getLiteralNode(a),b.Nodes.getLiteralNode(c)),l,f)]);return d=g.NodeUtils.parentize(d)}}],[{key:"isValidBlockStatementNode",value:function(e){return!(m.NodeGuards.isBreakStatementNode(e)||m.NodeGuards.isContinueStatementNode(e)||m.NodeGuards.isAwaitExpressionNode(e)||m.NodeGuards.isSuperNode(e))}}]),t}(y.AbstractNodeTransformer);v.maxNestedBlockStatementsCount=4,v.minCollectedBlockStatementsCount=5,v.transformersToRenameBlockScopeIdentifiers=[d.NodeTransformer.CatchClauseTransformer,d.NodeTransformer.ClassDeclarationTransformer,d.NodeTransformer.FunctionDeclarationTransformer,d.NodeTransformer.FunctionTransformer,d.NodeTransformer.LabeledStatementTransformer,d.NodeTransformer.VariableDeclarationTransformer],v=h=s.__decorate([u.injectable(),s.__param(0,u.inject(l.ServiceIdentifiers.ITransformersRunner)),s.__param(1,u.inject(l.ServiceIdentifiers.IRandomGenerator)),s.__param(2,u.inject(l.ServiceIdentifiers.IOptions)),s.__metadata("design:paramtypes",[Object,Object,Object])],v),t.DeadCodeInjectionTransformer=v;var h},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;rh.hostNodeSearchMinDepth&&t.splice(0,h.hostNodeSearchMinDepth),t.length>h.hostNodeSearchMaxDepth&&(t.length=h.hostNodeSearchMaxDepth),this.randomGenerator.getRandomGenerator().pickone(t))}},{key:"isVisitedFunctionNode",value:function(e){return(m.NodeGuards.isFunctionDeclarationNode(e)||m.NodeGuards.isFunctionExpressionNode(e)||m.NodeGuards.isArrowFunctionExpressionNode(e))&&this.visitedFunctionNodes.has(e)}},{key:"transformFunctionBody",value:function(e,t){var r=this;l.replace(e,{enter:function(e,n){if(r.isVisitedFunctionNode(e)||!n)return l.VisitorOption.Skip;if(!h.controlFlowReplacersMap.has(e.type))return e;if(r.randomGenerator.getMathRandom()>r.options.controlFlowFlatteningThreshold)return e;var o=h.controlFlowReplacersMap.get(e.type);return void 0===o?e:Object.assign({},r.controlFlowReplacerFactory(o).replace(e,n,t),{parentNode:n})}})}}]),t}(y.AbstractNodeTransformer);v.controlFlowReplacersMap=new Map([[p.NodeType.BinaryExpression,d.ControlFlowReplacer.BinaryExpressionControlFlowReplacer],[p.NodeType.CallExpression,d.ControlFlowReplacer.CallExpressionControlFlowReplacer],[p.NodeType.LogicalExpression,d.ControlFlowReplacer.LogicalExpressionControlFlowReplacer],[p.NodeType.Literal,d.ControlFlowReplacer.StringLiteralControlFlowReplacer]]),v.hostNodeSearchMinDepth=0,v.hostNodeSearchMaxDepth=2,v=h=c.__decorate([s.injectable(),c.__param(0,s.inject(u.ServiceIdentifiers.Factory__TControlFlowStorage)),c.__param(1,s.inject(u.ServiceIdentifiers.Factory__IControlFlowReplacer)),c.__param(2,s.inject(u.ServiceIdentifiers.Factory__IControlFlowCustomNode)),c.__param(3,s.inject(u.ServiceIdentifiers.IRandomGenerator)),c.__param(4,s.inject(u.ServiceIdentifiers.IOptions)),c.__metadata("design:paramtypes",[Function,Function,Function,Object,Object])],v),t.FunctionControlFlowTransformer=v;var h},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;r1){var o=d.Nodes.getBinaryExpressionNode("+",n.shift(),n.shift());return n.forEach(function(e){o=d.Nodes.getBinaryExpressionNode("+",o,e)}),o}return n[0]}}],[{key:"isLiteralNodeWithStringValue",value:function(e){return e&&f.NodeGuards.isLiteralNode(e)&&"string"==typeof e.value}}]),t}(l.AbstractNodeTransformer);p=y=c.__decorate([s.injectable(),c.__param(0,s.inject(u.ServiceIdentifiers.IRandomGenerator)),c.__param(1,s.inject(u.ServiceIdentifiers.IOptions)),c.__metadata("design:paramtypes",[Object,Object])],p),t.TemplateLiteralTransformer=p;var y},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(14),o=r(0),a=r(1),i=r(12),c=r(20),s=r(38),u=r(66),l=r(67),f=r(68),d=r(69),p=r(70),y=r(71),m=r(74),b=r(75),g=r(76),v=r(77),h=r(78),_=r(80),N=r(82),O=r(84),S=r(88),C=r(90),j=r(91),w=r(92),I=r(94),F=r(96),T=r(103),E=r(105),k=r(109),P=r(110);t.customNodesModule=new o.ContainerModule(function(e){e(a.ServiceIdentifiers.ICustomNode).to(h.ConsoleOutputDisableExpressionNode).whenTargetNamed(c.CustomNode.ConsoleOutputDisableExpressionNode),e(a.ServiceIdentifiers.ICustomNode).to(_.DebugProtectionFunctionCallNode).whenTargetNamed(c.CustomNode.DebugProtectionFunctionCallNode),e(a.ServiceIdentifiers.ICustomNode).to(N.DebugProtectionFunctionIntervalNode).whenTargetNamed(c.CustomNode.DebugProtectionFunctionIntervalNode),e(a.ServiceIdentifiers.ICustomNode).to(O.DebugProtectionFunctionNode).whenTargetNamed(c.CustomNode.DebugProtectionFunctionNode),e(a.ServiceIdentifiers.ICustomNode).to(S.DomainLockNode).whenTargetNamed(c.CustomNode.DomainLockNode),e(a.ServiceIdentifiers.ICustomNode).to(w.NodeCallsControllerFunctionNode).whenTargetNamed(c.CustomNode.NodeCallsControllerFunctionNode),e(a.ServiceIdentifiers.ICustomNode).to(I.SelfDefendingUnicodeNode).whenTargetNamed(c.CustomNode.SelfDefendingUnicodeNode),e(a.ServiceIdentifiers.ICustomNode).to(F.StringArrayCallsWrapper).whenTargetNamed(c.CustomNode.StringArrayCallsWrapper),e(a.ServiceIdentifiers.ICustomNode).to(T.StringArrayNode).whenTargetNamed(c.CustomNode.StringArrayNode),e(a.ServiceIdentifiers.ICustomNode).to(E.StringArrayRotateFunctionNode).whenTargetNamed(c.CustomNode.StringArrayRotateFunctionNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(y.BinaryExpressionFunctionNode).whenTargetNamed(i.ControlFlowCustomNode.BinaryExpressionFunctionNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(m.BlockStatementControlFlowFlatteningNode).whenTargetNamed(i.ControlFlowCustomNode.BlockStatementControlFlowFlatteningNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(b.CallExpressionControlFlowStorageCallNode).whenTargetNamed(i.ControlFlowCustomNode.CallExpressionControlFlowStorageCallNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(g.CallExpressionFunctionNode).whenTargetNamed(i.ControlFlowCustomNode.CallExpressionFunctionNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(v.ControlFlowStorageNode).whenTargetNamed(i.ControlFlowCustomNode.ControlFlowStorageNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(C.ExpressionWithOperatorControlFlowStorageCallNode).whenTargetNamed(i.ControlFlowCustomNode.ExpressionWithOperatorControlFlowStorageCallNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(j.LogicalExpressionFunctionNode).whenTargetNamed(i.ControlFlowCustomNode.LogicalExpressionFunctionNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(P.StringLiteralNode).whenTargetNamed(i.ControlFlowCustomNode.StringLiteralNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(k.StringLiteralControlFlowStorageCallNode).whenTargetNamed(i.ControlFlowCustomNode.StringLiteralControlFlowStorageCallNode),e(a.ServiceIdentifiers.ICustomNodeGroup).to(u.ConsoleOutputCustomNodeGroup).whenTargetNamed(s.CustomNodeGroup.ConsoleOutputCustomNodeGroup),e(a.ServiceIdentifiers.ICustomNodeGroup).to(l.DebugProtectionCustomNodeGroup).whenTargetNamed(s.CustomNodeGroup.DebugProtectionCustomNodeGroup),e(a.ServiceIdentifiers.ICustomNodeGroup).to(f.DomainLockCustomNodeGroup).whenTargetNamed(s.CustomNodeGroup.DomainLockCustomNodeGroup),e(a.ServiceIdentifiers.ICustomNodeGroup).to(d.SelfDefendingCustomNodeGroup).whenTargetNamed(s.CustomNodeGroup.SelfDefendingCustomNodeGroup),e(a.ServiceIdentifiers.ICustomNodeGroup).to(p.StringArrayCustomNodeGroup).whenTargetNamed(s.CustomNodeGroup.StringArrayCustomNodeGroup),e(a.ServiceIdentifiers.Factory__ICustomNode).toFactory(n.InversifyContainerFacade.getFactory(a.ServiceIdentifiers.ICustomNode)),e(a.ServiceIdentifiers.Factory__IControlFlowCustomNode).toFactory(n.InversifyContainerFacade.getConstructorFactory(a.ServiceIdentifiers.Newable__ICustomNode,a.ServiceIdentifiers.Factory__IIdentifierNameGenerator,a.ServiceIdentifiers.IRandomGenerator,a.ServiceIdentifiers.IOptions)),e(a.ServiceIdentifiers.Factory__ICustomNodeGroup).toFactory(n.InversifyContainerFacade.getFactory(a.ServiceIdentifiers.ICustomNodeGroup))})},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;r 0;\n \n switch (isPositive) {\n case true:\n return this.item + \'_\' + this.value + \'_\' + i;\n default:\n this.item + \'_\' + this.value;\n }\n }\n }()\n };\n };\n \n var regExp = new RegExp("[{diff}]", "g");\n var domains = "{domains}".replace(regExp, "").split(";");\n var document;\n var domain;\n \n for (var d in that) {\n if (d.length == 8 && d.charCodeAt(7) == 116 && d.charCodeAt(5) == 101 && d.charCodeAt(3) == 117 && d.charCodeAt(0) == 100) {\n document = d;\n \n break;\n }\n }\n\n for (var d1 in that[document]) {\n if (d1.length == 6 && d1.charCodeAt(5) == 110 && d1.charCodeAt(0) == 100) {\n domain = d1;\n \n break;\n }\n }\n \n if ((!document && !domain) || (!that[document] && !that[document][domain])) {\n return;\n }\n \n var currentDomain = that[document][domain];\n\n var ok = false;\n \n for (var i = 0; i < domains.length; i++) {\n var domain = domains[i];\n var position = currentDomain.length - domain.length;\n var lastIndex = currentDomain.indexOf(domain, position);\n var endsWith = lastIndex !== -1 && lastIndex === position;\n \n if (endsWith) {\n if (currentDomain.length == domain.length || domain.indexOf(".") === 0) {\n ok = true;\n }\n \n break;\n }\n }\n \n if (!ok) {\n data;\n } else {\n return;\n }\n \n func();\n });\n\n {domainLockFunctionName}();\n '}Object.defineProperty(t,"__esModule",{value:!0}),t.DomainLockNodeTemplate=n},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;r> 1 + 255 % 0;\n \n if (string.indexOf('i' === i)) {\n recursiveFunc2(string)\n }\n };\n \n var recursiveFunc2 = function (string) {\n var i = ~-4 >> 1 + 255 % 0;\n \n if (string.indexOf((true+\"\")[3]) !== i) {\n recursiveFunc1(string)\n }\n };\n \n if (!test1()) {\n if (!test2()) {\n recursiveFunc1('indеxOf');\n } else {\n recursiveFunc1('indexOf');\n }\n } else {\n recursiveFunc1('indеxOf');\n }\n })\n \n {selfDefendingFunctionName}();\n "}Object.defineProperty(t,"__esModule",{value:!0}),t.SelfDefendingTemplate=n},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;r> (-2 * bc & 6)) : 0\n ) {\n buffer = chars.indexOf(buffer);\n }\n return output;\n });\n })();\n "}Object.defineProperty(t,"__esModule",{value:!0}),t.AtobTemplate=n},function(e,t,r){"use strict";function n(){return"\n var rc4 = function (str, key) {\n var s = [], j = 0, x, res = '', newStr = '';\n \n str = atob(str);\n \n for (var k = 0, length = str.length; k < length; k++) {\n newStr += '%' + ('00' + str.charCodeAt(k).toString(16)).slice(-2);\n }\n \n str = decodeURIComponent(newStr);\n \t \n\t for (var i = 0; i < 256; i++) {\n s[i] = i;\n }\n \n for (i = 0; i < 256; i++) {\n j = (j + s[i] + key.charCodeAt(i % key.length)) % 256;\n x = s[i];\n s[i] = s[j];\n s[j] = x;\n }\n \n i = 0;\n j = 0;\n \n for (var y = 0; y < str.length; y++) {\n i = (i + 1) % 256;\n j = (j + s[i]) % 256;\n x = s[i];\n s[i] = s[j];\n s[j] = x;\n res += String.fromCharCode(str.charCodeAt(y) ^ s[(s[i] + s[j]) % 256]);\n }\n \n return res;\n }\n "}Object.defineProperty(t,"__esModule",{value:!0}),t.Rc4Template=n},function(e,t,r){"use strict";function n(e){return"\n var StatesClass = function (rc4Bytes) {\n this.rc4Bytes = rc4Bytes;\n this.states = [1, 0, 0];\n this.newState = function(){return 'newState';};\n this.firstState = '"+e.encode("\\w+ *\\(\\) *{\\w+ *",!0)+"';\n this.secondState = '"+e.encode("['|\"].+['|\"];? *}",!0)+"';\n };\n \n StatesClass.prototype.checkState = function () {\n var regExp = new RegExp(this.firstState + this.secondState);\n\n return this.runState(regExp.test(this.newState.toString()) ? --this.states[1] : --this.states[0]);\n };\n \n StatesClass.prototype.runState = function (stateResult) {\n if (!Boolean(~stateResult)) {\n return stateResult;\n }\n \n return this.getState(this.rc4Bytes);\n };\n\n StatesClass.prototype.getState = function (rc4Bytes) {\n for (var i = 0, len = this.states.length; i < len; i++) {\n this.states.push(Math.round(Math.random()));\n len = this.states.length;\n }\n \n return rc4Bytes(this.states[0]);\n };\n\n new StatesClass({stringArrayCallsWrapperName}).checkState();\n "}Object.defineProperty(t,"__esModule",{value:!0}),t.SelfDefendingTemplate=n},function(e,t,r){"use strict";function n(){return"\n if ({stringArrayCallsWrapperName}.initialized === undefined) {\n {atobPolyfill}\n \n {stringArrayCallsWrapperName}.base64DecodeUnicode = function (str) {\n var string = atob(str);\n var newStringChars = [];\n \n for (var i = 0, length = string.length; i < length; i++) {\n newStringChars += '%' + ('00' + string.charCodeAt(i).toString(16)).slice(-2);\n }\n \n return decodeURIComponent(newStringChars);\n };\n \n {stringArrayCallsWrapperName}.data = {};\n \n {stringArrayCallsWrapperName}.initialized = true;\n }\n \n var cachedValue = {stringArrayCallsWrapperName}.data[index];\n \n if (cachedValue === undefined) {\n {selfDefendingCode}\n \n value = {stringArrayCallsWrapperName}.base64DecodeUnicode(value);\n {stringArrayCallsWrapperName}.data[index] = value;\n } else {\n value = cachedValue;\n }\n "}Object.defineProperty(t,"__esModule",{value:!0}),t.StringArrayBase64DecodeNodeTemplate=n},function(e,t,r){"use strict";function n(){return"\n var {stringArrayCallsWrapperName} = function (index, key) {\n index = index - 0;\n \n var value = {stringArrayName}[index];\n \n {decodeNodeTemplate}\n \n return value;\n };\n "}Object.defineProperty(t,"__esModule",{value:!0}),t.StringArrayCallsWrapperTemplate=n},function(e,t,r){"use strict";function n(){return"\n if ({stringArrayCallsWrapperName}.initialized === undefined) {\n {atobPolyfill}\n \n {rc4Polyfill}\n {stringArrayCallsWrapperName}.rc4 = rc4;\n \n {stringArrayCallsWrapperName}.data = {};\n \n {stringArrayCallsWrapperName}.initialized = true;\n }\n \n var cachedValue = {stringArrayCallsWrapperName}.data[index];\n\n if (cachedValue === undefined) {\n if ({stringArrayCallsWrapperName}.once === undefined) {\n {selfDefendingCode}\n \n {stringArrayCallsWrapperName}.once = true;\n }\n \n value = {stringArrayCallsWrapperName}.rc4(value, key);\n {stringArrayCallsWrapperName}.data[index] = value;\n } else {\n value = cachedValue;\n }\n "}Object.defineProperty(t,"__esModule",{value:!0}),t.StringArrayRc4DecodeNodeTemplate=n},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;r=0);return"a"+n(e.length)}(e);return d.validateMangledName(t)||(t=d.generateNewMangledName(t)),t}},{key:"validateMangledName",value:function(e){return!(-1!==d.reservedNames.indexOf(e))}}]),t}(l.AbstractIdentifierNameGenerator);f.initMangledNameCharacter="9",f.nameSequence="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),f.reservedNames=["byte","case","char","do","else","enum","eval","for","goto","if","in","int","let","long","new","null","this","true","try","var","void","with"],f=d=c.__decorate([s.injectable(),c.__param(0,s.inject(u.ServiceIdentifiers.IRandomGenerator)),c.__param(1,s.inject(u.ServiceIdentifiers.IOptions)),c.__metadata("design:paramtypes",[Object,Object])],f),t.MangledIdentifierNameGenerator=f;var d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(14),o=r(0),a=r(1);t.nodeTransformersModule=new o.ContainerModule(function(e){e(a.ServiceIdentifiers.Factory__INodeTransformer).toFactory(n.InversifyContainerFacade.getCacheFactory(a.ServiceIdentifiers.INodeTransformer))})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(14),o=r(0),a=r(1),i=r(16),c=r(40),s=r(18),u=r(117),l=r(118),f=r(119),d=r(120),p=r(121),y=r(122),m=r(123),b=r(124),g=r(125),v=r(126),h=r(127),_=r(128);t.obfuscatingTransformersModule=new o.ContainerModule(function(e){e(a.ServiceIdentifiers.INodeTransformer).to(f.CatchClauseTransformer).whenTargetNamed(s.NodeTransformer.CatchClauseTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(d.ClassDeclarationTransformer).whenTargetNamed(s.NodeTransformer.ClassDeclarationTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(p.FunctionDeclarationTransformer).whenTargetNamed(s.NodeTransformer.FunctionDeclarationTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(y.FunctionTransformer).whenTargetNamed(s.NodeTransformer.FunctionTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(m.LabeledStatementTransformer).whenTargetNamed(s.NodeTransformer.LabeledStatementTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(b.LiteralTransformer).whenTargetNamed(s.NodeTransformer.LiteralTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(v.ObjectExpressionTransformer).whenTargetNamed(s.NodeTransformer.ObjectExpressionTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(_.VariableDeclarationTransformer).whenTargetNamed(s.NodeTransformer.VariableDeclarationTransformer),e(a.ServiceIdentifiers.IObfuscatingReplacer).to(l.BooleanLiteralObfuscatingReplacer).whenTargetNamed(c.LiteralObfuscatingReplacer.BooleanLiteralObfuscatingReplacer),e(a.ServiceIdentifiers.IObfuscatingReplacer).to(g.NumberLiteralObfuscatingReplacer).whenTargetNamed(c.LiteralObfuscatingReplacer.NumberLiteralObfuscatingReplacer),e(a.ServiceIdentifiers.IObfuscatingReplacer).to(h.StringLiteralObfuscatingReplacer).whenTargetNamed(c.LiteralObfuscatingReplacer.StringLiteralObfuscatingReplacer),e(a.ServiceIdentifiers.IIdentifierObfuscatingReplacer).to(u.BaseIdentifierObfuscatingReplacer).whenTargetNamed(i.IdentifierObfuscatingReplacer.BaseIdentifierObfuscatingReplacer),e(a.ServiceIdentifiers.Factory__IObfuscatingReplacer).toFactory(n.InversifyContainerFacade.getCacheFactory(a.ServiceIdentifiers.IObfuscatingReplacer)),e(a.ServiceIdentifiers.Factory__IIdentifierObfuscatingReplacer).toFactory(n.InversifyContainerFacade.getCacheFactory(a.ServiceIdentifiers.IIdentifierObfuscatingReplacer))})},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;r=m.minimumLengthForStringArray&&this.randomGenerator.getMathRandom()<=this.options.stringArrayThreshold}},{key:"getStringArrayHexadecimalIndex",value:function(e,t){if(this.stringLiteralHexadecimalIndexCache.has(e))return{fromCache:!0,index:this.stringLiteralHexadecimalIndexCache.get(e)};var r=p.Utils.decToHex(t),n=""+p.Utils.hexadecimalPrefix+r;return this.stringLiteralHexadecimalIndexCache.set(e,n),{fromCache:!1,index:n}}},{key:"getEncodedValue",value:function(e){var t=void 0,r=null;switch(this.options.stringArrayEncoding){case l.StringArrayEncoding.Rc4:r=this.randomGenerator.getRandomGenerator().pickone(this.rc4Keys),t=this.cryptUtils.btoa(this.cryptUtils.rc4(e,r));break;case l.StringArrayEncoding.Base64:t=this.cryptUtils.btoa(e);break;default:t=e}return{encodedValue:t,key:r}}},{key:"replaceWithLiteralNode",value:function(e){return d.Nodes.getLiteralNode(this.escapeSequenceEncoder.encode(e,this.options.unicodeEscapeSequence))}},{key:"replaceWithStringArrayCallNode",value:function(e){var t=this.getEncodedValue(e),r=t.encodedValue,n=t.key,o=this.escapeSequenceEncoder.encode(r,this.options.unicodeEscapeSequence),a=this.stringArrayStorage.getLength(),i=this.stringArrayStorage.getStorageId().split("|")[1],c=this.getStringArrayHexadecimalIndex(o,a),s=c.fromCache,u=c.index;s||this.stringArrayStorage.set(a,o);var l=[m.getHexadecimalLiteralNode(u)];return n&&l.push(m.getRc4KeyLiteralNode(this.escapeSequenceEncoder.encode(n,this.options.unicodeEscapeSequence))),d.Nodes.getCallExpressionNode(d.Nodes.getIdentifierNode(i),l)}}],[{key:"getHexadecimalLiteralNode",value:function(e){var t=d.Nodes.getLiteralNode(e);return t.obfuscatedNode=!0,t}},{key:"getRc4KeyLiteralNode",value:function(e){var t=d.Nodes.getLiteralNode(e);return t.obfuscatedNode=!0,t}}]),t}(f.AbstractObfuscatingReplacer);y.minimumLengthForStringArray=3,y.rc4KeyLength=4,y.rc4KeysCount=50,y=m=c.__decorate([s.injectable(),c.__param(0,s.inject(u.ServiceIdentifiers.TStringArrayStorage)),c.__param(1,s.inject(u.ServiceIdentifiers.IEscapeSequenceEncoder)),c.__param(2,s.inject(u.ServiceIdentifiers.IRandomGenerator)),c.__param(3,s.inject(u.ServiceIdentifiers.ICryptUtils)),c.__param(4,s.inject(u.ServiceIdentifiers.IOptions)),c.__metadata("design:paramtypes",[Object,Object,Object,Object,Object])],y),t.StringLiteralObfuscatingReplacer=y;var m},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;r=0?t:null}},{key:"getLength",value:function(){return this.storageLength}},{key:"getStorage",value:function(){return this.storage}},{key:"getStorageId",value:function(){return this.storageId}},{key:"mergeWith",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.storage=[].concat(n(this.storage),n(e.getStorage())),t&&(this.storageId=e.getStorageId())}},{key:"set",value:function(e,t){e===this.storageLength?this.storage.push(t):this.storage.splice(e,0,t),this.storageLength++}}]),e}();i.__decorate([u.initializable(),i.__metadata("design:type",Array)],l.prototype,"storage",void 0),i.__decorate([u.initializable(),i.__metadata("design:type",String)],l.prototype,"storageId",void 0),i.__decorate([c.postConstruct(),i.__metadata("design:type",Function),i.__metadata("design:paramtypes",[]),i.__metadata("design:returntype",void 0)],l.prototype,"initialize",null),l=i.__decorate([c.injectable(),i.__param(0,c.inject(s.ServiceIdentifiers.IRandomGenerator)),i.__param(1,c.inject(s.ServiceIdentifiers.IOptions)),i.__metadata("design:paramtypes",[Object,Object])],l),t.ArrayStorage=l},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(1),a=r(140),i=r(141),c=r(144),s=r(43);t.utilsModule=new n.ContainerModule(function(e){e(o.ServiceIdentifiers.IArrayUtils).to(a.ArrayUtils).inSingletonScope(),e(o.ServiceIdentifiers.IRandomGenerator).to(s.RandomGenerator).inSingletonScope(),e(o.ServiceIdentifiers.ICryptUtils).to(i.CryptUtils).inSingletonScope(),e(o.ServiceIdentifiers.IEscapeSequenceEncoder).to(c.EscapeSequenceEncoder).inSingletonScope()})},function(e,t,r){"use strict";function n(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t>8-o%1*8)){if((n=e.charCodeAt(o+=.75))>255)throw new Error("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");r=r<<8|n}return t}},{key:"hideString",value:function(e,t){var r=this,n=this.randomGenerator.getRandomGenerator().string({length:t,pool:s.RandomGenerator.randomGeneratorPool}),o=n.replace(new RegExp("["+function(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}(e)+"]","g"),""),a=o.split("");return this.randomGenerator.getRandomGenerator().shuffle(a),o=a.join(""),[function(e,t){for(var n=-1,o=-1,a="";n values should be wrapped inside quotes: --optionName 'value1, value2'");return e.split(",").map(function(e){return e.trim()})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BooleanSanitizer=function(e){return"true"===e||"1"===e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(13);t.ObfuscationTargetSanitizer=function(e){if(!Object.keys(n.ObfuscationTarget).some(function(t){return n.ObfuscationTarget[t]===e}))throw new ReferenceError("Invalid value of `--target` option");return e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(23);t.SourceMapModeSanitizer=function(e){if(!Object.keys(n.SourceMapMode).some(function(t){return n.SourceMapMode[t]===e}))throw new ReferenceError("Invalid value of `--sourceMapMode` option");return e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(24);t.StringArrayEncodingSanitizer=function(e){switch(e){case"true":case"1":case n.StringArrayEncoding.Base64:return!0;case n.StringArrayEncoding.Rc4:return n.StringArrayEncoding.Rc4;default:return!1}}},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:"";return t&&(e=e.substring(0,e.lastIndexOf("/"))+"/"+t),/\.js\.map$/.test(e)?/\.js$/.test(e)&&(e+=".map"):e=e.split(".")[0]+".js.map",e}},{key:"getUserConfig",value:function(e){var t=void 0;try{t=!function(){var e=new Error('Cannot find module "."');throw e.code="MODULE_NOT_FOUND",e}()}catch(r){try{t=require(e)}catch(e){throw new ReferenceError("Given config path must be a valid file path")}}return t}},{key:"writeFile",value:function(e,t){i.sync(c.dirname(e)),a.writeFileSync(e,t,{encoding:s.JavaScriptObfuscatorCLI.encoding})}}]),e}();t.CLIUtils=u},function(e,t){e.exports=require("mkdirp")},function(e,t){function r(e){throw new Error("Cannot find module '"+e+"'.")}r.keys=function(){return[]},r.resolve=r,e.exports=r,r.id=178},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:"initialize",t=Object.keys(this)[0];return function(r,n){var o={configurable:!0,enumerable:!0},a=r[e];if(!a||"function"!=typeof a)throw new Error("`"+e+"` method with initialization logic not found. `@"+t+"` decorator requires `"+e+"` method");var i="_"+n,c=Object.getOwnPropertyDescriptor(r,i)||o,s=Object.getOwnPropertyDescriptor(r,e)||o,u=s.value;return Object.defineProperty(r,n,Object.assign({},c,{get:function(){if(void 0===this[i])throw new Error("Property `"+n+"` is not initialized! Initialize it first!");return this[i]},set:function(e){this[i]=e}})),Object.defineProperty(r,e,Object.assign({},s,{value:function(){u.apply(this,arguments),this[n]}})),c}}Object.defineProperty(t,"__esModule",{value:!0}),t.initializable=n},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=function(){function e(e,t){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:0;if(l.NodeGuards.isNodeHasBlockStatement(e)){if(void 0===e.body[t])throw new ReferenceError("Wrong index `"+t+"`. Block-statement body length is `"+e.body.length+"`");return e.body[t]}throw new TypeError("The specified node have no a block-statement")}},{key:"getBlockScopesOfNode",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=t.parentNode;if(!n)throw new ReferenceError("`parentNode` property of given node is `undefined`");if(l.NodeGuards.isBlockStatementNode(n)){if(!n.parentNode)throw new ReferenceError("`parentNode` property of `parentNode` of given node is `undefined`");-1!==e.nodesWithBlockScope.indexOf(n.parentNode.type)&&r.push(n)}return t!==n?e.getBlockScopesOfNode(n,r):(l.NodeGuards.isNodeHasBlockStatement(n)&&r.push(n),r)}},{key:"getNodeBlockScopeDepth",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=t.parentNode;if(!n)throw new ReferenceError("`parentNode` property of given node is `undefined`");return l.NodeGuards.isProgramNode(n)?r:l.NodeGuards.isBlockStatementNode(t)&&-1!==e.nodesWithBlockScope.indexOf(n.type)?e.getNodeBlockScopeDepth(n,++r):e.getNodeBlockScopeDepth(n,r)}},{key:"getUnaryExpressionArgumentNode",value:function(t){return l.NodeGuards.isUnaryExpressionNode(t.argument)?e.getUnaryExpressionArgumentNode(t.argument):t.argument}},{key:"parentize",value:function(t){return s.traverse(t,{enter:e.parentizeNode}),t}},{key:"parentizeNode",value:function(e,t){return e.parentNode=t||e,e.obfuscatedNode=!1,e}}]),e}();f.nodesWithBlockScope=[u.NodeType.ArrowFunctionExpression,u.NodeType.FunctionDeclaration,u.NodeType.FunctionExpression,u.NodeType.MethodDefinition,u.NodeType.Program],t.NodeUtils=f},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:[];return{type:i.NodeType.Program,body:e,sourceType:"script",obfuscatedNode:!1}}},{key:"getArrayExpressionNode",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return{type:i.NodeType.ArrayExpression,elements:e}}},{key:"getAssignmentExpressionNode",value:function(e,t,r){return{type:i.NodeType.AssignmentExpression,operator:e,left:t,right:r,obfuscatedNode:!1}}},{key:"getBinaryExpressionNode",value:function(e,t,r){return{type:i.NodeType.BinaryExpression,operator:e,left:t,right:r,obfuscatedNode:!1}}},{key:"getBlockStatementNode",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return{type:i.NodeType.BlockStatement,body:e,obfuscatedNode:!1}}},{key:"getBreakStatement",value:function(e){var t={type:i.NodeType.BreakStatement,obfuscatedNode:!1};return e&&(t.label=e),t}},{key:"getCatchClauseNode",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return{type:i.NodeType.CatchClause,param:e.getIdentifierNode("err"),body:e.getBlockStatementNode(t),obfuscatedNode:!1}}},{key:"getCallExpressionNode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return{type:i.NodeType.CallExpression,callee:e,arguments:t,obfuscatedNode:!1}}},{key:"getContinueStatement",value:function(e){var t={type:i.NodeType.ContinueStatement,obfuscatedNode:!1};return e&&(t.label=e),t}},{key:"getExpressionStatementNode",value:function(e){return{type:i.NodeType.ExpressionStatement,expression:e,obfuscatedNode:!1}}},{key:"getFunctionDeclarationNode",value:function(t,r,n){return{type:i.NodeType.FunctionDeclaration,id:e.getIdentifierNode(t),params:r,body:n,generator:!1,obfuscatedNode:!1}}},{key:"getFunctionExpressionNode",value:function(e,t){return{type:i.NodeType.FunctionExpression,params:e,body:t,generator:!1,obfuscatedNode:!1}}},{key:"getIfStatementNode",value:function(e,t,r){return Object.assign({type:i.NodeType.IfStatement,test:e,consequent:t},r&&{alternate:r},{obfuscatedNode:!1})}},{key:"getIdentifierNode",value:function(e){return{type:i.NodeType.Identifier,name:e,obfuscatedNode:!1}}},{key:"getLabeledStatement",value:function(e,t){return{type:i.NodeType.LabeledStatement,label:e,body:t,obfuscatedNode:!1}}},{key:"getLiteralNode",value:function(e,t){return t=void 0!==t?t:"'"+e+"'",{type:i.NodeType.Literal,value:e,raw:t,"x-verbatim-property":{content:t,precedence:a.Precedence.Primary},obfuscatedNode:!1}}},{key:"getLogicalExpressionNode",value:function(e,t,r){return{type:i.NodeType.LogicalExpression,operator:e,left:t,right:r,obfuscatedNode:!1}}},{key:"getMemberExpressionNode",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return{type:i.NodeType.MemberExpression,computed:r,object:e,property:t,obfuscatedNode:!1}}},{key:"getObjectExpressionNode",value:function(e){return{type:i.NodeType.ObjectExpression,properties:e,obfuscatedNode:!1}}},{key:"getPropertyNode",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return{type:i.NodeType.Property,key:e,value:t,kind:"init",method:!1,shorthand:!1,computed:r,obfuscatedNode:!1}}},{key:"getUnaryExpressionNode",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return{type:i.NodeType.UnaryExpression,operator:e,argument:t,prefix:r,obfuscatedNode:!1}}},{key:"getReturnStatementNode",value:function(e){return{type:i.NodeType.ReturnStatement,argument:e,obfuscatedNode:!1}}},{key:"getSwitchStatementNode",value:function(e,t){return{type:i.NodeType.SwitchStatement,discriminant:e,cases:t,obfuscatedNode:!1}}},{key:"getSwitchCaseNode",value:function(e,t){return{type:i.NodeType.SwitchCase,test:e,consequent:t,obfuscatedNode:!1}}},{key:"getUpdateExpressionNode",value:function(e,t){return{type:i.NodeType.UpdateExpression,operator:e,argument:t,prefix:!1,obfuscatedNode:!1}}},{key:"getVariableDeclarationNode",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"var";return{type:i.NodeType.VariableDeclaration,declarations:e,kind:t,obfuscatedNode:!1}}},{key:"getVariableDeclaratorNode",value:function(e,t){return{type:i.NodeType.VariableDeclarator,id:e,init:t,obfuscatedNode:!1}}},{key:"getWhileStatementNode",value:function(e,t){return{type:i.NodeType.WhileStatement,test:e,body:t,obfuscatedNode:!1}}}]),e}();t.Nodes=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e.ArrayExpression="ArrayExpression",e.ArrowFunctionExpression="ArrowFunctionExpression",e.AssignmentExpression="AssignmentExpression",e.AssignmentPattern="AssignmentPattern",e.AwaitExpression="AwaitExpression",e.BinaryExpression="BinaryExpression",e.BlockStatement="BlockStatement",e.BreakStatement="BreakStatement",e.CallExpression="CallExpression",e.CatchClause="CatchClause",e.ClassDeclaration="ClassDeclaration",e.ContinueStatement="ContinueStatement",e.ExpressionStatement="ExpressionStatement",e.FunctionDeclaration="FunctionDeclaration",e.FunctionExpression="FunctionExpression",e.Identifier="Identifier",e.IfStatement="IfStatement",e.LabeledStatement="LabeledStatement",e.Literal="Literal",e.LogicalExpression="LogicalExpression",e.MemberExpression="MemberExpression",e.MethodDefinition="MethodDefinition",e.ObjectExpression="ObjectExpression",e.ObjectPattern="ObjectPattern",e.Program="Program",e.Property="Property",e.ReturnStatement="ReturnStatement",e.Super="Super",e.SwitchCase="SwitchCase",e.SwitchStatement="SwitchStatement",e.TemplateLiteral="TemplateLiteral",e.TryStatement="TryStatement",e.UnaryExpression="UnaryExpression",e.UpdateExpression="UpdateExpression",e.VariableDeclaration="VariableDeclaration",e.VariableDeclarator="VariableDeclarator",e.WhileStatement="WhileStatement"}(t.NodeType||(t.NodeType={}))},function(e,t){e.exports=require("string-template")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e[e.BinaryExpressionFunctionNode=0]="BinaryExpressionFunctionNode",e[e.BlockStatementControlFlowFlatteningNode=1]="BlockStatementControlFlowFlatteningNode",e[e.CallExpressionControlFlowStorageCallNode=2]="CallExpressionControlFlowStorageCallNode",e[e.CallExpressionFunctionNode=3]="CallExpressionFunctionNode",e[e.ControlFlowStorageNode=4]="ControlFlowStorageNode",e[e.ExpressionWithOperatorControlFlowStorageCallNode=5]="ExpressionWithOperatorControlFlowStorageCallNode",e[e.LogicalExpressionFunctionNode=6]="LogicalExpressionFunctionNode",e[e.StringLiteralControlFlowStorageCallNode=7]="StringLiteralControlFlowStorageCallNode",e[e.StringLiteralNode=8]="StringLiteralNode"}(t.ControlFlowCustomNode||(t.ControlFlowCustomNode={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e.Browser="browser",e.Extension="extension",e.Node="node"}(t.ObfuscationTarget||(t.ObfuscationTarget={}))},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var r=0;r1?t-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:{},r=new i.InversifyContainerFacade;r.load(e,t);var n=r.get(a.ServiceIdentifiers.IJavaScriptObfuscator),o=n.obfuscate(e);return r.unload(),o}},{key:"runCLI",value:function(e){var t=new c.JavaScriptObfuscatorCLI(e);t.initialize(),t.run()}}]),e}();t.JavaScriptObfuscator=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e[e.BlockStatementControlFlowTransformer=0]="BlockStatementControlFlowTransformer",e[e.ClassDeclarationTransformer=1]="ClassDeclarationTransformer",e[e.DeadCodeInjectionTransformer=2]="DeadCodeInjectionTransformer",e[e.FunctionControlFlowTransformer=3]="FunctionControlFlowTransformer",e[e.CatchClauseTransformer=4]="CatchClauseTransformer",e[e.FunctionDeclarationTransformer=5]="FunctionDeclarationTransformer",e[e.FunctionTransformer=6]="FunctionTransformer",e[e.LabeledStatementTransformer=7]="LabeledStatementTransformer",e[e.LiteralTransformer=8]="LiteralTransformer",e[e.MemberExpressionTransformer=9]="MemberExpressionTransformer",e[e.MethodDefinitionTransformer=10]="MethodDefinitionTransformer",e[e.ObfuscatingGuardsTransformer=11]="ObfuscatingGuardsTransformer",e[e.ObjectExpressionTransformer=12]="ObjectExpressionTransformer",e[e.ParentificationTransformer=13]="ParentificationTransformer",e[e.TemplateLiteralTransformer=14]="TemplateLiteralTransformer",e[e.VariableDeclarationTransformer=15]="VariableDeclarationTransformer"}(t.NodeTransformer||(t.NodeTransformer={}))},function(e,t,r){"use strict";function n(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t3&&void 0!==arguments[3]?arguments[3]:0,a=void 0;a=t.length?e.getOptimalBlockScope(t,o):r,e.prependNode(a,n)}},{key:"getOptimalBlockScope",value:function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1/0,o=t[r];if(n<=0)throw new Error("Invalid `deep` argument value. Value should be bigger then 0.");return n>1&&o.stackTrace.length?e.getOptimalBlockScope(o.stackTrace,0,--n):o.callee}},{key:"insertNodeAtIndex",value:function(t,r,o){e.validateBodyStatements(r)||(r=[]),r=e.parentizeBodyStatementsBeforeAppend(t,r),t.body=[].concat(n(t.body.slice(0,o)),n(r),n(t.body.slice(o)))}},{key:"prependNode",value:function(t,r){e.validateBodyStatements(r)||(r=[]),r=e.parentizeBodyStatementsBeforeAppend(t,r),t.body=[].concat(n(r),n(t.body))}},{key:"parentizeBodyStatementsBeforeAppend",value:function(e,t){return t.forEach(function(t){t.parentNode=e}),t}},{key:"validateBodyStatements",value:function(e){return e.every(function(e){return!!e&&e.hasOwnProperty("type")})}}]),e}();t.NodeAppender=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e[e.ConsoleOutputDisableExpressionNode=0]="ConsoleOutputDisableExpressionNode",e[e.DebugProtectionFunctionCallNode=1]="DebugProtectionFunctionCallNode",e[e.DebugProtectionFunctionIntervalNode=2]="DebugProtectionFunctionIntervalNode",e[e.DebugProtectionFunctionNode=3]="DebugProtectionFunctionNode",e[e.DomainLockNode=4]="DomainLockNode",e[e.NodeCallsControllerFunctionNode=5]="NodeCallsControllerFunctionNode",e[e.SelfDefendingUnicodeNode=6]="SelfDefendingUnicodeNode",e[e.StringArrayCallsWrapper=7]="StringArrayCallsWrapper",e[e.StringArrayNode=8]="StringArrayNode",e[e.StringArrayRotateFunctionNode=9]="StringArrayRotateFunctionNode"}(t.CustomNode||(t.CustomNode={}))},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var r=0;r-1||0===e.indexOf("//")?e.split("/")[2]:e.split("/")[0],t=t.split(":")[0]}},{key:"isCeilNumber",value:function(e){return e%1==0}},{key:"stringRotate",value:function(e,t){if(!e)throw new ReferenceError("Cannot rotate empty string.");for(var r=0;r [options]").version(c.version,"-v, --version").option("-o, --output ","Output path for obfuscated code").option("--compact ","Disable one line output code compacting",d.BooleanSanitizer).option("--config ","Name of js / json config file").option("--control-flow-flattening ","Enables control flow flattening",d.BooleanSanitizer).option("--control-flow-flattening-threshold ","The probability that the control flow flattening transformation will be applied to the node",parseFloat).option("--dead-code-injection ","Enables dead code injection",d.BooleanSanitizer).option("--dead-code-injection-threshold ","The probability that the dead code injection transformation will be applied to the node",parseFloat).option("--debug-protection ","Disable browser Debug panel (can cause DevTools enabled browser freeze)",d.BooleanSanitizer).option("--debug-protection-interval ","Disable browser Debug panel even after page was loaded (can cause DevTools enabled browser freeze)",d.BooleanSanitizer).option("--disable-console-output ","Allow console.log, console.info, console.error and console.warn messages output into browser console",d.BooleanSanitizer).option("--domain-lock (comma separated, without whitespaces)","Blocks the execution of the code in domains that do not match the passed RegExp patterns (comma separated)",f.ArraySanitizer).option("--identifier-names-generator [hexadecimal, mangled]","Sets identifier names generator (Default: hexadecimal)",d.BooleanSanitizer).option("--log ","Enables logging of the information to the console",d.BooleanSanitizer).option("--reserved-names (comma separated, without whitespaces)","Disable obfuscation of variable names, function names and names of function parameters that match the passed RegExp patterns (comma separated)",f.ArraySanitizer).option("--rename-globals ","Allows to enable obfuscation of global variable and function names with declaration.",d.BooleanSanitizer).option("--rotate-string-array ","Disable rotation of unicode array values during obfuscation",d.BooleanSanitizer).option("--seed ","Sets seed for random generator. This is useful for creating repeatable results.",parseFloat).option("--self-defending ","Disables self-defending for obfuscated code",d.BooleanSanitizer).option("--source-map ","Enables source map generation",d.BooleanSanitizer).option("--source-map-base-url ","Sets base url to the source map import url when `--source-map-mode=separate`").option("--source-map-file-name ","Sets file name for output source map when `--source-map-mode=separate`").option("--source-map-mode [inline, separate]","Specify source map output mode",y.SourceMapModeSanitizer).option("--string-array ","Disables gathering of all literal strings into an array and replacing every literal string with an array call",d.BooleanSanitizer).option("--string-array-encoding [true, false, base64, rc4]","Encodes all strings in strings array using base64 or rc4 (this option can slow down your code speed",m.StringArrayEncodingSanitizer).option("--string-array-threshold ","The probability that the literal string will be inserted into stringArray (Default: 0.8, Min: 0, Max: 1)",parseFloat).option("--target ","Allows to set target environment for obfuscated code.",p.ObfuscationTargetSanitizer).option("--unicode-escape-sequence ","Allows to enable/disable string conversion to unicode escape sequence",d.BooleanSanitizer).parse(this.rawArguments)}},{key:"configureHelp",value:function(){this.commands.on("--help",function(){console.log(" Examples:\n"),console.log(" %> javascript-obfuscator input_file_name.js --compact true --self-defending false"),console.log(" %> javascript-obfuscator input_file_name.js --output output_file_name.js --compact true --self-defending false"),console.log(" %> javascript-obfuscator input_directory_name --compact true --self-defending false"),console.log("")})}},{key:"processSourceCodeData",value:function(e){var t=this;if(Array.isArray(e))e.forEach(function(e){var r=e.filePath,n=e.content,o=b.CLIUtils.getOutputCodePath(r);t.processSourceCode(n,o)});else{var r=this.inputCLIOptions.output||b.CLIUtils.getOutputCodePath(this.inputPath);this.processSourceCode(e,r)}}},{key:"processSourceCode",value:function(t,r){var n=this.buildOptions();n.sourceMap?e.processSourceCodeWithSourceMap(t,r,n):e.processSourceCodeWithoutSourceMap(t,r,n)}}],[{key:"filterOptions",value:function(e){var t={};for(var r in e)e.hasOwnProperty(r)&&void 0!==e[r]&&(t[r]=e[r]);return t}},{key:"processSourceCodeWithoutSourceMap",value:function(e,t,r){var n=g.JavaScriptObfuscator.obfuscate(e,r).getObfuscatedCode();b.CLIUtils.writeFile(t,n)}},{key:"processSourceCodeWithSourceMap",value:function(e,t,r){var n=b.CLIUtils.getOutputSourceMapPath(t,r.sourceMapFileName||"");r=Object.assign({},r,{sourceMapFileName:s.basename(n)});var o=g.JavaScriptObfuscator.obfuscate(e,r);b.CLIUtils.writeFile(t,o.getObfuscatedCode()),"separate"===r.sourceMapMode&&o.getSourceMap()&&b.CLIUtils.writeFile(n,o.getSourceMap())}}]),e}();h.availableInputExtensions=[".js"],h.encoding="utf8",h.obfuscatedFilePrefix="-obfuscated",a.__decorate([u.initializable(),a.__metadata("design:type",Object)],h.prototype,"commands",void 0),a.__decorate([u.initializable(),a.__metadata("design:type",Object)],h.prototype,"inputCLIOptions",void 0),a.__decorate([u.initializable(),a.__metadata("design:type",String)],h.prototype,"inputPath",void 0),t.JavaScriptObfuscatorCLI=h},function(e,t){e.exports=require("path")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e[e.FunctionDeclarationCalleeDataExtractor=0]="FunctionDeclarationCalleeDataExtractor",e[e.FunctionExpressionCalleeDataExtractor=1]="FunctionExpressionCalleeDataExtractor",e[e.ObjectExpressionCalleeDataExtractor=2]="ObjectExpressionCalleeDataExtractor"}(t.CalleeDataExtractor||(t.CalleeDataExtractor={}))},function(e,t){e.exports=require("esprima")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e[e.BinaryExpressionControlFlowReplacer=0]="BinaryExpressionControlFlowReplacer",e[e.CallExpressionControlFlowReplacer=1]="CallExpressionControlFlowReplacer",e[e.LogicalExpressionControlFlowReplacer=2]="LogicalExpressionControlFlowReplacer",e[e.StringLiteralControlFlowReplacer=3]="StringLiteralControlFlowReplacer"}(t.ControlFlowReplacer||(t.ControlFlowReplacer={}))},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;r1&&void 0!==arguments[1]&&arguments[1];this.storage=new Map([].concat(n(this.storage),n(e.getStorage()))),t&&(this.storageId=e.getStorageId())}},{key:"set",value:function(e,t){this.storage.set(e,t)}}]),e}();c.__decorate([l.initializable(),c.__metadata("design:type",String)],f.prototype,"storageId",void 0),c.__decorate([l.initializable(),c.__metadata("design:type",Map)],f.prototype,"storage",void 0),c.__decorate([s.postConstruct(),c.__metadata("design:type",Function),c.__metadata("design:paramtypes",[]),c.__metadata("design:returntype",void 0)],f.prototype,"initialize",null),f=c.__decorate([s.injectable(),c.__param(0,s.inject(u.ServiceIdentifiers.IRandomGenerator)),c.__param(1,s.inject(u.ServiceIdentifiers.IOptions)),c.__metadata("design:paramtypes",[Object,Object])],f),t.MapStorage=f},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:d.randomGeneratorPool;return this.getRandomGenerator().string({length:e,pool:t})}},{key:"getSeed",value:function(){return this.seed}}]),e}();f.randomGeneratorPool="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",f.randomGeneratorPoolNumbers="0123456789",f.randomGeneratorPoolHexadecimal="abcdef"+d.randomGeneratorPoolNumbers,a.__decorate([l.initializable(),a.__metadata("design:type",Object)],f.prototype,"randomGenerator",void 0),a.__decorate([l.initializable(),a.__metadata("design:type",Number)],f.prototype,"seed",void 0),a.__decorate([i.postConstruct(),a.__metadata("design:type",Function),a.__metadata("design:paramtypes",[]),a.__metadata("design:returntype",void 0)],f.prototype,"initialize",null),f=d=a.__decorate([i.injectable(),a.__param(0,i.inject(c.ServiceIdentifiers.ISourceCode)),a.__param(1,i.inject(c.ServiceIdentifiers.IOptions)),a.__metadata("design:paramtypes",[Object,Object])],f),t.RandomGenerator=f;var d},function(e,t){e.exports=require("pjson")},function(e,t){e.exports=require("fs")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(17);e.exports=n.JavaScriptObfuscator},function(e,t){e.exports=require("reflect-metadata")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(14),o=r(0),a=r(1),i=r(35),c=r(50),s=r(51),u=r(52),l=r(53);t.analyzersModule=new o.ContainerModule(function(e){e(a.ServiceIdentifiers.IStackTraceAnalyzer).to(l.StackTraceAnalyzer).inSingletonScope(),e(a.ServiceIdentifiers.ICalleeDataExtractor).to(c.FunctionDeclarationCalleeDataExtractor).whenTargetNamed(i.CalleeDataExtractor.FunctionDeclarationCalleeDataExtractor),e(a.ServiceIdentifiers.ICalleeDataExtractor).to(s.FunctionExpressionCalleeDataExtractor).whenTargetNamed(i.CalleeDataExtractor.FunctionExpressionCalleeDataExtractor),e(a.ServiceIdentifiers.ICalleeDataExtractor).to(u.ObjectExpressionCalleeDataExtractor).whenTargetNamed(i.CalleeDataExtractor.ObjectExpressionCalleeDataExtractor),e(a.ServiceIdentifiers.Factory__ICalleeDataExtractor).toFactory(n.InversifyContainerFacade.getCacheFactory(a.ServiceIdentifiers.ICalleeDataExtractor))})},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;rr)return"break";var a=e[o];s.traverse(a,{enter:function(r){if(l.NodeGuards.isCallExpressionNode(r))return a.parentNode!==f.NodeUtils.getBlockScopesOfNode(r)[0]?s.VisitorOption.Skip:void t.analyzeCallExpressionNode(n,e,r)}})}(a))break}return n}},{key:"analyzeCallExpressionNode",value:function(e,t,r){var n=this;p.calleeDataExtractorsList.forEach(function(o){var a=n.calleeDataExtractorFactory(o).extract(t,r.callee);a&&e.push(Object.assign({},a,{stackTrace:n.analyzeRecursive(a.callee.body)}))})}}],[{key:"getLimitIndex",value:function(e){var t=e-1,r=p.limitThresholdActivationLength-1,n=t;return t>r&&(n=Math.round(r+t*p.limitThreshold))>t&&(n=t),n}}]),e}();d.calleeDataExtractorsList=[u.CalleeDataExtractor.FunctionDeclarationCalleeDataExtractor,u.CalleeDataExtractor.FunctionExpressionCalleeDataExtractor,u.CalleeDataExtractor.ObjectExpressionCalleeDataExtractor],d.limitThresholdActivationLength=25,d.limitThreshold=.002,d=p=a.__decorate([i.injectable(),a.__param(0,i.inject(c.ServiceIdentifiers.Factory__ICalleeDataExtractor)),a.__metadata("design:paramtypes",[Function])],d),t.StackTraceAnalyzer=d;var p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(14),o=r(0),a=r(1),i=r(37),c=r(18),s=r(55),u=r(56),l=r(57),f=r(58),d=r(59),p=r(60),y=r(61);t.controlFlowTransformersModule=new o.ContainerModule(function(e){e(a.ServiceIdentifiers.INodeTransformer).to(u.BlockStatementControlFlowTransformer).whenTargetNamed(c.NodeTransformer.BlockStatementControlFlowTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(f.DeadCodeInjectionTransformer).whenTargetNamed(c.NodeTransformer.DeadCodeInjectionTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(d.FunctionControlFlowTransformer).whenTargetNamed(c.NodeTransformer.FunctionControlFlowTransformer),e(a.ServiceIdentifiers.IControlFlowReplacer).to(s.BinaryExpressionControlFlowReplacer).whenTargetNamed(i.ControlFlowReplacer.BinaryExpressionControlFlowReplacer),e(a.ServiceIdentifiers.IControlFlowReplacer).to(l.CallExpressionControlFlowReplacer).whenTargetNamed(i.ControlFlowReplacer.CallExpressionControlFlowReplacer),e(a.ServiceIdentifiers.IControlFlowReplacer).to(p.LogicalExpressionControlFlowReplacer).whenTargetNamed(i.ControlFlowReplacer.LogicalExpressionControlFlowReplacer),e(a.ServiceIdentifiers.IControlFlowReplacer).to(y.StringLiteralControlFlowReplacer).whenTargetNamed(i.ControlFlowReplacer.StringLiteralControlFlowReplacer),e(a.ServiceIdentifiers.Factory__IControlFlowReplacer).toFactory(n.InversifyContainerFacade.getCacheFactory(a.ServiceIdentifiers.IControlFlowReplacer))})},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;rthis.options.controlFlowFlatteningThreshold||!m.canTransformBlockStatementNode(e))return e;var r=e.body,n=this.arrayUtils.arrayRange(r.length),o=this.arrayUtils.arrayShuffle(n),a=n.map(function(e){return o.indexOf(e)}),i=this.controlFlowCustomNodeFactory(f.ControlFlowCustomNode.BlockStatementControlFlowFlatteningNode);return i.initialize(r,o,a),i.getNode()[0]}}],[{key:"blockStatementHasProhibitedStatements",value:function(e){return e.body.some(function(e){var t=p.NodeGuards.isBreakStatementNode(e)||p.NodeGuards.isContinueStatementNode(e),r=p.NodeGuards.isVariableDeclarationNode(e)&&("const"===e.kind||"let"===e.kind);return p.NodeGuards.isFunctionDeclarationNode(e)||t||r})}},{key:"canTransformBlockStatementNode",value:function(e){var t=!0;return l.traverse(e,{enter:function(e){if(p.NodeGuards.isWhileStatementNode(e))return l.VisitorOption.Skip;p.NodeGuards.isBlockStatementNode(e)&&m.blockStatementHasProhibitedStatements(e)&&(t=!1)}}),e.body.length<=4&&(t=!1),t}}]),t}(d.AbstractNodeTransformer);y=m=c.__decorate([s.injectable(),c.__param(0,s.inject(u.ServiceIdentifiers.Factory__IControlFlowCustomNode)),c.__param(1,s.inject(u.ServiceIdentifiers.IArrayUtils)),c.__param(2,s.inject(u.ServiceIdentifiers.IRandomGenerator)),c.__param(3,s.inject(u.ServiceIdentifiers.IOptions)),c.__metadata("design:paramtypes",[Function,Object,Object,Object])],y),t.BlockStatementControlFlowTransformer=y;var m},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;rthis.options.deadCodeInjectionThreshold)return e;if(g.NodeUtils.getBlockScopesOfNode(e)[0].type===p.NodeType.Program)return e;var r=this.collectedBlockStatements.length-1,n=this.randomGenerator.getRandomInteger(0,r),o=this.collectedBlockStatements.splice(n,1)[0];return o===e?e:this.replaceBlockStatementNode(e,o)}},{key:"collectBlockStatementNodes",value:function(e,t){var r=g.NodeUtils.clone(e),n=0,o=!0;f.replace(r,{enter:function(e,t){return m.NodeGuards.isBlockStatementNode(e)&&n++,n>h.maxNestedBlockStatementsCount||!h.isValidBlockStatementNode(e)?(o=!1,f.VisitorOption.Break):e}}),o&&(r=this.transformersRunner.transform(r,h.transformersToRenameBlockScopeIdentifiers),t.push(r))}},{key:"replaceBlockStatementNode",value:function(e,t){var r=this.randomGenerator.getMathRandom()>.5,n=this.randomGenerator.getMathRandom()>.5,o=r?"===":"!==",a=this.randomGenerator.getRandomString(3),c=n?a:this.randomGenerator.getRandomString(3),s=r===n?[e,t]:[t,e],u=i(s,2),l=u[0],f=u[1],d=b.Nodes.getBlockStatementNode([b.Nodes.getIfStatementNode(b.Nodes.getBinaryExpressionNode(o,b.Nodes.getLiteralNode(a),b.Nodes.getLiteralNode(c)),l,f)]);return d=g.NodeUtils.parentize(d)}}],[{key:"isValidBlockStatementNode",value:function(e){return!(m.NodeGuards.isBreakStatementNode(e)||m.NodeGuards.isContinueStatementNode(e)||m.NodeGuards.isAwaitExpressionNode(e)||m.NodeGuards.isSuperNode(e))}}]),t}(y.AbstractNodeTransformer);v.maxNestedBlockStatementsCount=4,v.minCollectedBlockStatementsCount=5,v.transformersToRenameBlockScopeIdentifiers=[d.NodeTransformer.CatchClauseTransformer,d.NodeTransformer.ClassDeclarationTransformer,d.NodeTransformer.FunctionDeclarationTransformer,d.NodeTransformer.FunctionTransformer,d.NodeTransformer.LabeledStatementTransformer,d.NodeTransformer.VariableDeclarationTransformer],v=h=s.__decorate([u.injectable(),s.__param(0,u.inject(l.ServiceIdentifiers.ITransformersRunner)),s.__param(1,u.inject(l.ServiceIdentifiers.IRandomGenerator)),s.__param(2,u.inject(l.ServiceIdentifiers.IOptions)),s.__metadata("design:paramtypes",[Object,Object,Object])],v),t.DeadCodeInjectionTransformer=v;var h},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;rh.hostNodeSearchMinDepth&&t.splice(0,h.hostNodeSearchMinDepth),t.length>h.hostNodeSearchMaxDepth&&(t.length=h.hostNodeSearchMaxDepth),this.randomGenerator.getRandomGenerator().pickone(t))}},{key:"isVisitedFunctionNode",value:function(e){return(m.NodeGuards.isFunctionDeclarationNode(e)||m.NodeGuards.isFunctionExpressionNode(e)||m.NodeGuards.isArrowFunctionExpressionNode(e))&&this.visitedFunctionNodes.has(e)}},{key:"transformFunctionBody",value:function(e,t){var r=this;l.replace(e,{enter:function(e,n){if(r.isVisitedFunctionNode(e)||!n)return l.VisitorOption.Skip;if(!h.controlFlowReplacersMap.has(e.type))return e;if(r.randomGenerator.getMathRandom()>r.options.controlFlowFlatteningThreshold)return e;var o=h.controlFlowReplacersMap.get(e.type);return void 0===o?e:Object.assign({},r.controlFlowReplacerFactory(o).replace(e,n,t),{parentNode:n})}})}}]),t}(y.AbstractNodeTransformer);v.controlFlowReplacersMap=new Map([[p.NodeType.BinaryExpression,d.ControlFlowReplacer.BinaryExpressionControlFlowReplacer],[p.NodeType.CallExpression,d.ControlFlowReplacer.CallExpressionControlFlowReplacer],[p.NodeType.LogicalExpression,d.ControlFlowReplacer.LogicalExpressionControlFlowReplacer],[p.NodeType.Literal,d.ControlFlowReplacer.StringLiteralControlFlowReplacer]]),v.hostNodeSearchMinDepth=0,v.hostNodeSearchMaxDepth=2,v=h=c.__decorate([s.injectable(),c.__param(0,s.inject(u.ServiceIdentifiers.Factory__TControlFlowStorage)),c.__param(1,s.inject(u.ServiceIdentifiers.Factory__IControlFlowReplacer)),c.__param(2,s.inject(u.ServiceIdentifiers.Factory__IControlFlowCustomNode)),c.__param(3,s.inject(u.ServiceIdentifiers.IRandomGenerator)),c.__param(4,s.inject(u.ServiceIdentifiers.IOptions)),c.__metadata("design:paramtypes",[Function,Function,Function,Object,Object])],v),t.FunctionControlFlowTransformer=v;var h},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;r1){var o=d.Nodes.getBinaryExpressionNode("+",n.shift(),n.shift());return n.forEach(function(e){o=d.Nodes.getBinaryExpressionNode("+",o,e)}),o}return n[0]}}],[{key:"isLiteralNodeWithStringValue",value:function(e){return e&&f.NodeGuards.isLiteralNode(e)&&"string"==typeof e.value}}]),t}(l.AbstractNodeTransformer);p=y=c.__decorate([s.injectable(),c.__param(0,s.inject(u.ServiceIdentifiers.IRandomGenerator)),c.__param(1,s.inject(u.ServiceIdentifiers.IOptions)),c.__metadata("design:paramtypes",[Object,Object])],p),t.TemplateLiteralTransformer=p;var y},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(14),o=r(0),a=r(1),i=r(12),c=r(20),s=r(39),u=r(67),l=r(68),f=r(69),d=r(70),p=r(71),y=r(72),m=r(75),b=r(76),g=r(77),v=r(78),h=r(79),_=r(81),N=r(83),O=r(85),S=r(89),C=r(91),j=r(92),w=r(93),I=r(95),F=r(97),T=r(104),E=r(106),k=r(110),P=r(111);t.customNodesModule=new o.ContainerModule(function(e){e(a.ServiceIdentifiers.ICustomNode).to(h.ConsoleOutputDisableExpressionNode).whenTargetNamed(c.CustomNode.ConsoleOutputDisableExpressionNode),e(a.ServiceIdentifiers.ICustomNode).to(_.DebugProtectionFunctionCallNode).whenTargetNamed(c.CustomNode.DebugProtectionFunctionCallNode),e(a.ServiceIdentifiers.ICustomNode).to(N.DebugProtectionFunctionIntervalNode).whenTargetNamed(c.CustomNode.DebugProtectionFunctionIntervalNode),e(a.ServiceIdentifiers.ICustomNode).to(O.DebugProtectionFunctionNode).whenTargetNamed(c.CustomNode.DebugProtectionFunctionNode),e(a.ServiceIdentifiers.ICustomNode).to(S.DomainLockNode).whenTargetNamed(c.CustomNode.DomainLockNode),e(a.ServiceIdentifiers.ICustomNode).to(w.NodeCallsControllerFunctionNode).whenTargetNamed(c.CustomNode.NodeCallsControllerFunctionNode),e(a.ServiceIdentifiers.ICustomNode).to(I.SelfDefendingUnicodeNode).whenTargetNamed(c.CustomNode.SelfDefendingUnicodeNode),e(a.ServiceIdentifiers.ICustomNode).to(F.StringArrayCallsWrapper).whenTargetNamed(c.CustomNode.StringArrayCallsWrapper),e(a.ServiceIdentifiers.ICustomNode).to(T.StringArrayNode).whenTargetNamed(c.CustomNode.StringArrayNode),e(a.ServiceIdentifiers.ICustomNode).to(E.StringArrayRotateFunctionNode).whenTargetNamed(c.CustomNode.StringArrayRotateFunctionNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(y.BinaryExpressionFunctionNode).whenTargetNamed(i.ControlFlowCustomNode.BinaryExpressionFunctionNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(m.BlockStatementControlFlowFlatteningNode).whenTargetNamed(i.ControlFlowCustomNode.BlockStatementControlFlowFlatteningNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(b.CallExpressionControlFlowStorageCallNode).whenTargetNamed(i.ControlFlowCustomNode.CallExpressionControlFlowStorageCallNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(g.CallExpressionFunctionNode).whenTargetNamed(i.ControlFlowCustomNode.CallExpressionFunctionNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(v.ControlFlowStorageNode).whenTargetNamed(i.ControlFlowCustomNode.ControlFlowStorageNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(C.ExpressionWithOperatorControlFlowStorageCallNode).whenTargetNamed(i.ControlFlowCustomNode.ExpressionWithOperatorControlFlowStorageCallNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(j.LogicalExpressionFunctionNode).whenTargetNamed(i.ControlFlowCustomNode.LogicalExpressionFunctionNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(P.StringLiteralNode).whenTargetNamed(i.ControlFlowCustomNode.StringLiteralNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(k.StringLiteralControlFlowStorageCallNode).whenTargetNamed(i.ControlFlowCustomNode.StringLiteralControlFlowStorageCallNode),e(a.ServiceIdentifiers.ICustomNodeGroup).to(u.ConsoleOutputCustomNodeGroup).whenTargetNamed(s.CustomNodeGroup.ConsoleOutputCustomNodeGroup),e(a.ServiceIdentifiers.ICustomNodeGroup).to(l.DebugProtectionCustomNodeGroup).whenTargetNamed(s.CustomNodeGroup.DebugProtectionCustomNodeGroup),e(a.ServiceIdentifiers.ICustomNodeGroup).to(f.DomainLockCustomNodeGroup).whenTargetNamed(s.CustomNodeGroup.DomainLockCustomNodeGroup),e(a.ServiceIdentifiers.ICustomNodeGroup).to(d.SelfDefendingCustomNodeGroup).whenTargetNamed(s.CustomNodeGroup.SelfDefendingCustomNodeGroup),e(a.ServiceIdentifiers.ICustomNodeGroup).to(p.StringArrayCustomNodeGroup).whenTargetNamed(s.CustomNodeGroup.StringArrayCustomNodeGroup),e(a.ServiceIdentifiers.Factory__ICustomNode).toFactory(n.InversifyContainerFacade.getFactory(a.ServiceIdentifiers.ICustomNode)),e(a.ServiceIdentifiers.Factory__IControlFlowCustomNode).toFactory(n.InversifyContainerFacade.getConstructorFactory(a.ServiceIdentifiers.Newable__ICustomNode,a.ServiceIdentifiers.Factory__IIdentifierNamesGenerator,a.ServiceIdentifiers.IRandomGenerator,a.ServiceIdentifiers.IOptions)),e(a.ServiceIdentifiers.Factory__ICustomNodeGroup).toFactory(n.InversifyContainerFacade.getFactory(a.ServiceIdentifiers.ICustomNodeGroup))})},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;r 0;\n \n switch (isPositive) {\n case true:\n return this.item + \'_\' + this.value + \'_\' + i;\n default:\n this.item + \'_\' + this.value;\n }\n }\n }()\n };\n };\n \n var regExp = new RegExp("[{diff}]", "g");\n var domains = "{domains}".replace(regExp, "").split(";");\n var document;\n var domain;\n \n for (var d in that) {\n if (d.length == 8 && d.charCodeAt(7) == 116 && d.charCodeAt(5) == 101 && d.charCodeAt(3) == 117 && d.charCodeAt(0) == 100) {\n document = d;\n \n break;\n }\n }\n\n for (var d1 in that[document]) {\n if (d1.length == 6 && d1.charCodeAt(5) == 110 && d1.charCodeAt(0) == 100) {\n domain = d1;\n \n break;\n }\n }\n \n if ((!document && !domain) || (!that[document] && !that[document][domain])) {\n return;\n }\n \n var currentDomain = that[document][domain];\n\n var ok = false;\n \n for (var i = 0; i < domains.length; i++) {\n var domain = domains[i];\n var position = currentDomain.length - domain.length;\n var lastIndex = currentDomain.indexOf(domain, position);\n var endsWith = lastIndex !== -1 && lastIndex === position;\n \n if (endsWith) {\n if (currentDomain.length == domain.length || domain.indexOf(".") === 0) {\n ok = true;\n }\n \n break;\n }\n }\n \n if (!ok) {\n data;\n } else {\n return;\n }\n \n func();\n });\n\n {domainLockFunctionName}();\n '}Object.defineProperty(t,"__esModule",{value:!0}),t.DomainLockNodeTemplate=n},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;r> 1 + 255 % 0;\n \n if (string.indexOf('i' === i)) {\n recursiveFunc2(string)\n }\n };\n \n var recursiveFunc2 = function (string) {\n var i = ~-4 >> 1 + 255 % 0;\n \n if (string.indexOf((true+\"\")[3]) !== i) {\n recursiveFunc1(string)\n }\n };\n \n if (!test1()) {\n if (!test2()) {\n recursiveFunc1('indеxOf');\n } else {\n recursiveFunc1('indexOf');\n }\n } else {\n recursiveFunc1('indеxOf');\n }\n })\n \n {selfDefendingFunctionName}();\n "}Object.defineProperty(t,"__esModule",{value:!0}),t.SelfDefendingTemplate=n},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;r> (-2 * bc & 6)) : 0\n ) {\n buffer = chars.indexOf(buffer);\n }\n return output;\n });\n })();\n "}Object.defineProperty(t,"__esModule",{value:!0}),t.AtobTemplate=n},function(e,t,r){"use strict";function n(){return"\n var rc4 = function (str, key) {\n var s = [], j = 0, x, res = '', newStr = '';\n \n str = atob(str);\n \n for (var k = 0, length = str.length; k < length; k++) {\n newStr += '%' + ('00' + str.charCodeAt(k).toString(16)).slice(-2);\n }\n \n str = decodeURIComponent(newStr);\n \t \n\t for (var i = 0; i < 256; i++) {\n s[i] = i;\n }\n \n for (i = 0; i < 256; i++) {\n j = (j + s[i] + key.charCodeAt(i % key.length)) % 256;\n x = s[i];\n s[i] = s[j];\n s[j] = x;\n }\n \n i = 0;\n j = 0;\n \n for (var y = 0; y < str.length; y++) {\n i = (i + 1) % 256;\n j = (j + s[i]) % 256;\n x = s[i];\n s[i] = s[j];\n s[j] = x;\n res += String.fromCharCode(str.charCodeAt(y) ^ s[(s[i] + s[j]) % 256]);\n }\n \n return res;\n }\n "}Object.defineProperty(t,"__esModule",{value:!0}),t.Rc4Template=n},function(e,t,r){"use strict";function n(e){return"\n var StatesClass = function (rc4Bytes) {\n this.rc4Bytes = rc4Bytes;\n this.states = [1, 0, 0];\n this.newState = function(){return 'newState';};\n this.firstState = '"+e.encode("\\w+ *\\(\\) *{\\w+ *",!0)+"';\n this.secondState = '"+e.encode("['|\"].+['|\"];? *}",!0)+"';\n };\n \n StatesClass.prototype.checkState = function () {\n var regExp = new RegExp(this.firstState + this.secondState);\n\n return this.runState(regExp.test(this.newState.toString()) ? --this.states[1] : --this.states[0]);\n };\n \n StatesClass.prototype.runState = function (stateResult) {\n if (!Boolean(~stateResult)) {\n return stateResult;\n }\n \n return this.getState(this.rc4Bytes);\n };\n\n StatesClass.prototype.getState = function (rc4Bytes) {\n for (var i = 0, len = this.states.length; i < len; i++) {\n this.states.push(Math.round(Math.random()));\n len = this.states.length;\n }\n \n return rc4Bytes(this.states[0]);\n };\n\n new StatesClass({stringArrayCallsWrapperName}).checkState();\n "}Object.defineProperty(t,"__esModule",{value:!0}),t.SelfDefendingTemplate=n},function(e,t,r){"use strict";function n(){return"\n if ({stringArrayCallsWrapperName}.initialized === undefined) {\n {atobPolyfill}\n \n {stringArrayCallsWrapperName}.base64DecodeUnicode = function (str) {\n var string = atob(str);\n var newStringChars = [];\n \n for (var i = 0, length = string.length; i < length; i++) {\n newStringChars += '%' + ('00' + string.charCodeAt(i).toString(16)).slice(-2);\n }\n \n return decodeURIComponent(newStringChars);\n };\n \n {stringArrayCallsWrapperName}.data = {};\n \n {stringArrayCallsWrapperName}.initialized = true;\n }\n \n var cachedValue = {stringArrayCallsWrapperName}.data[index];\n \n if (cachedValue === undefined) {\n {selfDefendingCode}\n \n value = {stringArrayCallsWrapperName}.base64DecodeUnicode(value);\n {stringArrayCallsWrapperName}.data[index] = value;\n } else {\n value = cachedValue;\n }\n "}Object.defineProperty(t,"__esModule",{value:!0}),t.StringArrayBase64DecodeNodeTemplate=n},function(e,t,r){"use strict";function n(){return"\n var {stringArrayCallsWrapperName} = function (index, key) {\n index = index - 0;\n \n var value = {stringArrayName}[index];\n \n {decodeNodeTemplate}\n \n return value;\n };\n "}Object.defineProperty(t,"__esModule",{value:!0}),t.StringArrayCallsWrapperTemplate=n},function(e,t,r){"use strict";function n(){return"\n if ({stringArrayCallsWrapperName}.initialized === undefined) {\n {atobPolyfill}\n \n {rc4Polyfill}\n {stringArrayCallsWrapperName}.rc4 = rc4;\n \n {stringArrayCallsWrapperName}.data = {};\n \n {stringArrayCallsWrapperName}.initialized = true;\n }\n \n var cachedValue = {stringArrayCallsWrapperName}.data[index];\n\n if (cachedValue === undefined) {\n if ({stringArrayCallsWrapperName}.once === undefined) {\n {selfDefendingCode}\n \n {stringArrayCallsWrapperName}.once = true;\n }\n \n value = {stringArrayCallsWrapperName}.rc4(value, key);\n {stringArrayCallsWrapperName}.data[index] = value;\n } else {\n value = cachedValue;\n }\n "}Object.defineProperty(t,"__esModule",{value:!0}),t.StringArrayRc4DecodeNodeTemplate=n},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;r=0);return"a"+n(e.length)}(e);return d.validateMangledName(t)||(t=d.generateNewMangledName(t)),t}},{key:"validateMangledName",value:function(e){return!(-1!==d.reservedNames.indexOf(e))}}]),t}(l.AbstractIdentifierNamesGenerator);f.initMangledNameCharacter="9",f.nameSequence="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),f.reservedNames=["byte","case","char","do","else","enum","eval","for","goto","if","in","int","let","long","new","null","this","true","try","var","void","with"],f=d=c.__decorate([s.injectable(),c.__param(0,s.inject(u.ServiceIdentifiers.IRandomGenerator)),c.__param(1,s.inject(u.ServiceIdentifiers.IOptions)),c.__metadata("design:paramtypes",[Object,Object])],f),t.MangledIdentifierNamesGenerator=f;var d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(14),o=r(0),a=r(1);t.nodeTransformersModule=new o.ContainerModule(function(e){e(a.ServiceIdentifiers.Factory__INodeTransformer).toFactory(n.InversifyContainerFacade.getCacheFactory(a.ServiceIdentifiers.INodeTransformer))})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(14),o=r(0),a=r(1),i=r(16),c=r(41),s=r(18),u=r(117),l=r(118),f=r(119),d=r(120),p=r(121),y=r(122),m=r(123),b=r(124),g=r(125),v=r(126),h=r(127),_=r(128);t.obfuscatingTransformersModule=new o.ContainerModule(function(e){e(a.ServiceIdentifiers.INodeTransformer).to(f.CatchClauseTransformer).whenTargetNamed(s.NodeTransformer.CatchClauseTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(d.ClassDeclarationTransformer).whenTargetNamed(s.NodeTransformer.ClassDeclarationTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(p.FunctionDeclarationTransformer).whenTargetNamed(s.NodeTransformer.FunctionDeclarationTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(y.FunctionTransformer).whenTargetNamed(s.NodeTransformer.FunctionTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(m.LabeledStatementTransformer).whenTargetNamed(s.NodeTransformer.LabeledStatementTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(b.LiteralTransformer).whenTargetNamed(s.NodeTransformer.LiteralTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(v.ObjectExpressionTransformer).whenTargetNamed(s.NodeTransformer.ObjectExpressionTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(_.VariableDeclarationTransformer).whenTargetNamed(s.NodeTransformer.VariableDeclarationTransformer),e(a.ServiceIdentifiers.IObfuscatingReplacer).to(l.BooleanLiteralObfuscatingReplacer).whenTargetNamed(c.LiteralObfuscatingReplacer.BooleanLiteralObfuscatingReplacer),e(a.ServiceIdentifiers.IObfuscatingReplacer).to(g.NumberLiteralObfuscatingReplacer).whenTargetNamed(c.LiteralObfuscatingReplacer.NumberLiteralObfuscatingReplacer),e(a.ServiceIdentifiers.IObfuscatingReplacer).to(h.StringLiteralObfuscatingReplacer).whenTargetNamed(c.LiteralObfuscatingReplacer.StringLiteralObfuscatingReplacer),e(a.ServiceIdentifiers.IIdentifierObfuscatingReplacer).to(u.BaseIdentifierObfuscatingReplacer).whenTargetNamed(i.IdentifierObfuscatingReplacer.BaseIdentifierObfuscatingReplacer),e(a.ServiceIdentifiers.Factory__IObfuscatingReplacer).toFactory(n.InversifyContainerFacade.getCacheFactory(a.ServiceIdentifiers.IObfuscatingReplacer)),e(a.ServiceIdentifiers.Factory__IIdentifierObfuscatingReplacer).toFactory(n.InversifyContainerFacade.getCacheFactory(a.ServiceIdentifiers.IIdentifierObfuscatingReplacer))})},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;r=m.minimumLengthForStringArray&&this.randomGenerator.getMathRandom()<=this.options.stringArrayThreshold}},{key:"getStringArrayHexadecimalIndex",value:function(e,t){if(this.stringLiteralHexadecimalIndexCache.has(e))return{fromCache:!0,index:this.stringLiteralHexadecimalIndexCache.get(e)};var r=p.Utils.decToHex(t),n=""+p.Utils.hexadecimalPrefix+r;return this.stringLiteralHexadecimalIndexCache.set(e,n),{fromCache:!1,index:n}}},{key:"getEncodedValue",value:function(e){var t=void 0,r=null;switch(this.options.stringArrayEncoding){case l.StringArrayEncoding.Rc4:r=this.randomGenerator.getRandomGenerator().pickone(this.rc4Keys),t=this.cryptUtils.btoa(this.cryptUtils.rc4(e,r));break;case l.StringArrayEncoding.Base64:t=this.cryptUtils.btoa(e);break;default:t=e}return{encodedValue:t,key:r}}},{key:"replaceWithLiteralNode",value:function(e){return d.Nodes.getLiteralNode(this.escapeSequenceEncoder.encode(e,this.options.unicodeEscapeSequence))}},{key:"replaceWithStringArrayCallNode",value:function(e){var t=this.getEncodedValue(e),r=t.encodedValue,n=t.key,o=this.escapeSequenceEncoder.encode(r,this.options.unicodeEscapeSequence),a=this.stringArrayStorage.getLength(),i=this.stringArrayStorage.getStorageId().split("|")[1],c=this.getStringArrayHexadecimalIndex(o,a),s=c.fromCache,u=c.index;s||this.stringArrayStorage.set(a,o);var l=[m.getHexadecimalLiteralNode(u)];return n&&l.push(m.getRc4KeyLiteralNode(this.escapeSequenceEncoder.encode(n,this.options.unicodeEscapeSequence))),d.Nodes.getCallExpressionNode(d.Nodes.getIdentifierNode(i),l)}}],[{key:"getHexadecimalLiteralNode",value:function(e){var t=d.Nodes.getLiteralNode(e);return t.obfuscatedNode=!0,t}},{key:"getRc4KeyLiteralNode",value:function(e){var t=d.Nodes.getLiteralNode(e);return t.obfuscatedNode=!0,t}}]),t}(f.AbstractObfuscatingReplacer);y.minimumLengthForStringArray=3,y.rc4KeyLength=4,y.rc4KeysCount=50,y=m=c.__decorate([s.injectable(),c.__param(0,s.inject(u.ServiceIdentifiers.TStringArrayStorage)),c.__param(1,s.inject(u.ServiceIdentifiers.IEscapeSequenceEncoder)),c.__param(2,s.inject(u.ServiceIdentifiers.IRandomGenerator)),c.__param(3,s.inject(u.ServiceIdentifiers.ICryptUtils)),c.__param(4,s.inject(u.ServiceIdentifiers.IOptions)),c.__metadata("design:paramtypes",[Object,Object,Object,Object,Object])],y),t.StringLiteralObfuscatingReplacer=y;var m},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;r=0?t:null}},{key:"getLength",value:function(){return this.storageLength}},{key:"getStorage",value:function(){return this.storage}},{key:"getStorageId",value:function(){return this.storageId}},{key:"mergeWith",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.storage=[].concat(n(this.storage),n(e.getStorage())),t&&(this.storageId=e.getStorageId())}},{key:"set",value:function(e,t){e===this.storageLength?this.storage.push(t):this.storage.splice(e,0,t),this.storageLength++}}]),e}();i.__decorate([u.initializable(),i.__metadata("design:type",Array)],l.prototype,"storage",void 0),i.__decorate([u.initializable(),i.__metadata("design:type",String)],l.prototype,"storageId",void 0),i.__decorate([c.postConstruct(),i.__metadata("design:type",Function),i.__metadata("design:paramtypes",[]),i.__metadata("design:returntype",void 0)],l.prototype,"initialize",null),l=i.__decorate([c.injectable(),i.__param(0,c.inject(s.ServiceIdentifiers.IRandomGenerator)),i.__param(1,c.inject(s.ServiceIdentifiers.IOptions)),i.__metadata("design:paramtypes",[Object,Object])],l),t.ArrayStorage=l},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(1),a=r(140),i=r(141),c=r(144),s=r(44);t.utilsModule=new n.ContainerModule(function(e){e(o.ServiceIdentifiers.IArrayUtils).to(a.ArrayUtils).inSingletonScope(),e(o.ServiceIdentifiers.IRandomGenerator).to(s.RandomGenerator).inSingletonScope(),e(o.ServiceIdentifiers.ICryptUtils).to(i.CryptUtils).inSingletonScope(),e(o.ServiceIdentifiers.IEscapeSequenceEncoder).to(c.EscapeSequenceEncoder).inSingletonScope()})},function(e,t,r){"use strict";function n(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t>8-o%1*8)){if((n=e.charCodeAt(o+=.75))>255)throw new Error("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");r=r<<8|n}return t}},{key:"hideString",value:function(e,t){var r=this,n=this.randomGenerator.getRandomGenerator().string({length:t,pool:s.RandomGenerator.randomGeneratorPool}),o=n.replace(new RegExp("["+function(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}(e)+"]","g"),""),a=o.split("");return this.randomGenerator.getRandomGenerator().shuffle(a),o=a.join(""),[function(e,t){for(var n=-1,o=-1,a="";n values should be wrapped inside quotes: --optionName 'value1, value2'");return e.split(",").map(function(e){return e.trim()})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BooleanSanitizer=function(e){return"true"===e||"1"===e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(13);t.ObfuscationTargetSanitizer=function(e){if(!Object.keys(n.ObfuscationTarget).some(function(t){return n.ObfuscationTarget[t]===e}))throw new ReferenceError("Invalid value of `--target` option");return e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(23);t.SourceMapModeSanitizer=function(e){if(!Object.keys(n.SourceMapMode).some(function(t){return n.SourceMapMode[t]===e}))throw new ReferenceError("Invalid value of `--sourceMapMode` option");return e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(24);t.StringArrayEncodingSanitizer=function(e){switch(e){case"true":case"1":case n.StringArrayEncoding.Base64:return!0;case n.StringArrayEncoding.Rc4:return n.StringArrayEncoding.Rc4;default:return!1}}},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:"";return t&&(e=e.substring(0,e.lastIndexOf("/"))+"/"+t),/\.js\.map$/.test(e)?/\.js$/.test(e)&&(e+=".map"):e=e.split(".")[0]+".js.map",e}},{key:"getUserConfig",value:function(e){var t=void 0;try{t=!function(){var e=new Error('Cannot find module "."');throw e.code="MODULE_NOT_FOUND",e}()}catch(r){try{t=require(e)}catch(e){throw new ReferenceError("Given config path must be a valid file path")}}return t}},{key:"writeFile",value:function(e,t){i.sync(c.dirname(e)),a.writeFileSync(e,t,{encoding:s.JavaScriptObfuscatorCLI.encoding})}}]),e}();t.CLIUtils=u},function(e,t){e.exports=require("mkdirp")},function(e,t){function r(e){throw new Error("Cannot find module '"+e+"'.")}r.keys=function(){return[]},r.resolve=r,e.exports=r,r.id=178},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var r=0;r', 'Enables logging of the information to the console', + '--identifier-names-generator [hexadecimal, mangled]', 'Sets identifier names generator (Default: hexadecimal)', BooleanSanitizer ) .option( - '--mangle ', 'Enables mangling of variable names', + '--log ', 'Enables logging of the information to the console', BooleanSanitizer ) .option( diff --git a/src/container/ServiceIdentifiers.ts b/src/container/ServiceIdentifiers.ts index fe38d6a5..1a6c1bdb 100644 --- a/src/container/ServiceIdentifiers.ts +++ b/src/container/ServiceIdentifiers.ts @@ -4,7 +4,7 @@ export enum ServiceIdentifiers { Factory__IControlFlowReplacer = 'Factory', Factory__ICustomNode = 'Factory', Factory__ICustomNodeGroup = 'Factory', - Factory__IIdentifierNameGenerator = 'Factory', + Factory__IIdentifierNamesGenerator = 'Factory', Factory__IIdentifierObfuscatingReplacer = 'Factory', Factory__INodeGuard = 'Factory', Factory__INodeTransformer = 'Factory', @@ -18,7 +18,7 @@ export enum ServiceIdentifiers { ICustomNodeGroup = 'ICustomNodeGroup', IControlFlowReplacer = 'IControlFlowReplacer', IEscapeSequenceEncoder = 'IEscapeSequenceEncoder', - IIdentifierNameGenerator = 'IIdentifierNameGenerator', + IIdentifierNamesGenerator = 'IIdentifierNamesGenerator', IIdentifierObfuscatingReplacer = 'IIdentifierObfuscatingReplacer', IJavaScriptObfuscator = 'IJavaScriptObfuscator', ILogger = 'ILogger', diff --git a/src/container/modules/custom-nodes/CustomNodesModule.ts b/src/container/modules/custom-nodes/CustomNodesModule.ts index 168005de..ad8d8d27 100644 --- a/src/container/modules/custom-nodes/CustomNodesModule.ts +++ b/src/container/modules/custom-nodes/CustomNodesModule.ts @@ -145,7 +145,7 @@ export const customNodesModule: interfaces.ContainerModule = new ContainerModule .toFactory(InversifyContainerFacade .getConstructorFactory( ServiceIdentifiers.Newable__ICustomNode, - ServiceIdentifiers.Factory__IIdentifierNameGenerator, + ServiceIdentifiers.Factory__IIdentifierNamesGenerator, ServiceIdentifiers.IRandomGenerator, ServiceIdentifiers.IOptions )); diff --git a/src/container/modules/generators/GeneratorsModule.ts b/src/container/modules/generators/GeneratorsModule.ts index 019b07ee..ac194fe0 100644 --- a/src/container/modules/generators/GeneratorsModule.ts +++ b/src/container/modules/generators/GeneratorsModule.ts @@ -1,58 +1,58 @@ import { ContainerModule, interfaces } from 'inversify'; import { ServiceIdentifiers } from '../../ServiceIdentifiers'; -import { IIdentifierNameGenerator } from '../../../interfaces/generators/identifier-name-generators/IIdentifierNameGenerator'; +import { IIdentifierNamesGenerator } from '../../../interfaces/generators/identifier-names-generators/IIdentifierNamesGenerator'; import { IOptions } from '../../../interfaces/options/IOptions'; -import { IdentifierNameGenerator } from '../../../enums/generators/identifier-name-generators/IdentifierNameGenerator'; +import { IdentifierNamesGenerator } from '../../../enums/generators/identifier-names-generators/IdentifierNamesGenerator'; -import { HexadecimalIdentifierNameGenerator } from '../../../generators/identifier-name-generators/HexadecimalIdentifierNameGenerator'; -import { MangledIdentifierNameGenerator } from '../../../generators/identifier-name-generators/MangledIdentifierNameGenerator'; +import { HexadecimalIdentifierNamesGenerator } from '../../../generators/identifier-names-generators/HexadecimalIdentifierNamesGenerator'; +import { MangledIdentifierNamesGenerator } from '../../../generators/identifier-names-generators/MangledIdentifierNamesGenerator'; export const generatorsModule: interfaces.ContainerModule = new ContainerModule((bind: interfaces.Bind) => { // identifier name generators - bind(ServiceIdentifiers.IIdentifierNameGenerator) - .to(HexadecimalIdentifierNameGenerator) + bind(ServiceIdentifiers.IIdentifierNamesGenerator) + .to(HexadecimalIdentifierNamesGenerator) .inSingletonScope() - .whenTargetNamed(IdentifierNameGenerator.HexadecimalIdentifierNameGenerator); + .whenTargetNamed(IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator); - bind(ServiceIdentifiers.IIdentifierNameGenerator) - .to(MangledIdentifierNameGenerator) + bind(ServiceIdentifiers.IIdentifierNamesGenerator) + .to(MangledIdentifierNamesGenerator) .inSingletonScope() - .whenTargetNamed(IdentifierNameGenerator.MangledIdentifierNameGenerator); + .whenTargetNamed(IdentifierNamesGenerator.MangledIdentifierNamesGenerator); // identifier name generator factory - bind(ServiceIdentifiers.Factory__IIdentifierNameGenerator) - .toFactory((context: interfaces.Context): (options: IOptions) => IIdentifierNameGenerator => { - const cache: Map = new Map(); + bind(ServiceIdentifiers.Factory__IIdentifierNamesGenerator) + .toFactory((context: interfaces.Context): (options: IOptions) => IIdentifierNamesGenerator => { + let cachedIdentifierNamesGenerator: IIdentifierNamesGenerator | null = null; return (options: IOptions) => { - if (cache.has(options.mangle)) { - return cache.get(options.mangle); + if (cachedIdentifierNamesGenerator) { + return cachedIdentifierNamesGenerator; } - let identifierNameGenerator: IIdentifierNameGenerator; + let identifierNamesGenerator: IIdentifierNamesGenerator; - switch (options.mangle) { - case true: - identifierNameGenerator = context.container.getNamed( - ServiceIdentifiers.IIdentifierNameGenerator, - IdentifierNameGenerator.MangledIdentifierNameGenerator + switch (options.identifierNamesGenerator) { + case IdentifierNamesGenerator.MangledIdentifierNamesGenerator: + identifierNamesGenerator = context.container.getNamed( + ServiceIdentifiers.IIdentifierNamesGenerator, + IdentifierNamesGenerator.MangledIdentifierNamesGenerator ); break; - case false: + case IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator: default: - identifierNameGenerator = context.container.getNamed( - ServiceIdentifiers.IIdentifierNameGenerator, - IdentifierNameGenerator.HexadecimalIdentifierNameGenerator + identifierNamesGenerator = context.container.getNamed( + ServiceIdentifiers.IIdentifierNamesGenerator, + IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator ); } - cache.set(options.mangle, identifierNameGenerator); + cachedIdentifierNamesGenerator = identifierNamesGenerator; - return identifierNameGenerator; + return identifierNamesGenerator; }; }); }); diff --git a/src/custom-nodes/AbstractCustomNode.ts b/src/custom-nodes/AbstractCustomNode.ts index 72440208..436e946a 100644 --- a/src/custom-nodes/AbstractCustomNode.ts +++ b/src/custom-nodes/AbstractCustomNode.ts @@ -1,11 +1,11 @@ import { inject, injectable } from 'inversify'; import { ServiceIdentifiers } from '../container/ServiceIdentifiers'; -import { TIdentifierNameGeneratorFactory } from '../types/container/generators/TIdentifierNameGeneratorFactory'; +import { TIdentifierNamesGeneratorFactory } from '../types/container/generators/TIdentifierNamesGeneratorFactory'; import { TStatement } from '../types/node/TStatement'; import { ICustomNode } from '../interfaces/custom-nodes/ICustomNode'; -import { IIdentifierNameGenerator } from '../interfaces/generators/identifier-name-generators/IIdentifierNameGenerator'; +import { IIdentifierNamesGenerator } from '../interfaces/generators/identifier-names-generators/IIdentifierNamesGenerator'; import { IOptions } from '../interfaces/options/IOptions'; import { IRandomGenerator } from '../interfaces/utils/IRandomGenerator'; @@ -35,9 +35,9 @@ export abstract class AbstractCustomNode implements ICustomNode { protected cachedNode: TStatement[]; /** - * @type {IIdentifierNameGenerator} + * @type {IIdentifierNamesGenerator} */ - protected readonly identifierNameGenerator: IIdentifierNameGenerator; + protected readonly identifierNamesGenerator: IIdentifierNamesGenerator; /** * @type {IOptions} @@ -50,17 +50,17 @@ export abstract class AbstractCustomNode implements ICustomNode { protected readonly randomGenerator: IRandomGenerator; /** - * @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory + * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory * @param {IRandomGenerator} randomGenerator * @param {IOptions} options */ constructor ( - @inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator) - identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory, + @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator) + identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @inject(ServiceIdentifiers.IOptions) options: IOptions ) { - this.identifierNameGenerator = identifierNameGeneratorFactory(options); + this.identifierNamesGenerator = identifierNamesGeneratorFactory(options); this.randomGenerator = randomGenerator; this.options = options; } diff --git a/src/custom-nodes/AbstractCustomNodeGroup.ts b/src/custom-nodes/AbstractCustomNodeGroup.ts index b3f72995..cca506ae 100644 --- a/src/custom-nodes/AbstractCustomNodeGroup.ts +++ b/src/custom-nodes/AbstractCustomNodeGroup.ts @@ -1,12 +1,12 @@ import { inject, injectable } from 'inversify'; import { ServiceIdentifiers } from '../container/ServiceIdentifiers'; -import { TIdentifierNameGeneratorFactory } from '../types/container/generators/TIdentifierNameGeneratorFactory'; +import { TIdentifierNamesGeneratorFactory } from '../types/container/generators/TIdentifierNamesGeneratorFactory'; import { TNodeWithBlockStatement } from '../types/node/TNodeWithBlockStatement'; import { ICustomNode } from '../interfaces/custom-nodes/ICustomNode'; import { ICustomNodeGroup } from '../interfaces/custom-nodes/ICustomNodeGroup'; -import { IIdentifierNameGenerator } from '../interfaces/generators/identifier-name-generators/IIdentifierNameGenerator'; +import { IIdentifierNamesGenerator } from '../interfaces/generators/identifier-names-generators/IIdentifierNamesGenerator'; import { IOptions } from '../interfaces/options/IOptions'; import { IRandomGenerator } from '../interfaces/utils/IRandomGenerator'; import { IStackTraceData } from '../interfaces/analyzers/stack-trace-analyzer/IStackTraceData'; @@ -27,9 +27,9 @@ export abstract class AbstractCustomNodeGroup implements ICustomNodeGroup { protected abstract customNodes: Map ; /** - * @type {IIdentifierNameGenerator} + * @type {IIdentifierNamesGenerator} */ - protected readonly identifierNameGenerator: IIdentifierNameGenerator; + protected readonly identifierNamesGenerator: IIdentifierNamesGenerator; /** * @type {IOptions} @@ -47,17 +47,17 @@ export abstract class AbstractCustomNodeGroup implements ICustomNodeGroup { protected readonly stackTraceData: IStackTraceData[]; /** - * @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory + * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory * @param {IRandomGenerator} randomGenerator * @param {IOptions} options */ constructor ( - @inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator) - identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory, + @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator) + identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @inject(ServiceIdentifiers.IOptions) options: IOptions ) { - this.identifierNameGenerator = identifierNameGeneratorFactory(options); + this.identifierNamesGenerator = identifierNamesGeneratorFactory(options); this.randomGenerator = randomGenerator; this.options = options; } diff --git a/src/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.ts b/src/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.ts index 494c169f..78351c15 100644 --- a/src/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.ts +++ b/src/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.ts @@ -17,7 +17,7 @@ import { initializable } from '../../decorators/Initializable'; import { AbstractCustomNode } from '../AbstractCustomNode'; import { NodeUtils } from '../../node/NodeUtils'; -import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory'; +import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory'; @injectable() export class ConsoleOutputDisableExpressionNode extends AbstractCustomNode { @@ -28,17 +28,17 @@ export class ConsoleOutputDisableExpressionNode extends AbstractCustomNode { private callsControllerFunctionName: string; /** - * @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory + * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory * @param {IRandomGenerator} randomGenerator * @param {IOptions} options */ constructor ( - @inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator) - identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory, + @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator) + identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @inject(ServiceIdentifiers.IOptions) options: IOptions ) { - super(identifierNameGeneratorFactory, randomGenerator, options); + super(identifierNamesGeneratorFactory, randomGenerator, options); } /** @@ -64,7 +64,7 @@ export class ConsoleOutputDisableExpressionNode extends AbstractCustomNode { : GlobalVariableNoEvalTemplate(); return format(ConsoleOutputDisableExpressionTemplate(), { - consoleLogDisableFunctionName: this.identifierNameGenerator.generate(6), + consoleLogDisableFunctionName: this.identifierNamesGenerator.generate(6), globalVariableTemplate, singleNodeCallControllerFunctionName: this.callsControllerFunctionName }); diff --git a/src/custom-nodes/console-output-nodes/group/ConsoleOutputCustomNodeGroup.ts b/src/custom-nodes/console-output-nodes/group/ConsoleOutputCustomNodeGroup.ts index 008b72ff..4fb495ec 100644 --- a/src/custom-nodes/console-output-nodes/group/ConsoleOutputCustomNodeGroup.ts +++ b/src/custom-nodes/console-output-nodes/group/ConsoleOutputCustomNodeGroup.ts @@ -2,7 +2,7 @@ import { inject, injectable, } from 'inversify'; import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers'; import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory'; -import { TIdentifierNameGeneratorFactory } from '../../../types/container/generators/TIdentifierNameGeneratorFactory'; +import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory'; import { TNodeWithBlockStatement } from '../../../types/node/TNodeWithBlockStatement'; import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode'; @@ -38,18 +38,18 @@ export class ConsoleOutputCustomNodeGroup extends AbstractCustomNodeGroup { /** * @param {TCustomNodeFactory} customNodeFactory - * @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory + * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory * @param {IRandomGenerator} randomGenerator * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory, - @inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator) - identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory, + @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator) + identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @inject(ServiceIdentifiers.IOptions) options: IOptions ) { - super(identifierNameGeneratorFactory, randomGenerator, options); + super(identifierNamesGeneratorFactory, randomGenerator, options); this.customNodeFactory = customNodeFactory; } @@ -92,7 +92,7 @@ export class ConsoleOutputCustomNodeGroup extends AbstractCustomNodeGroup { return; } - const callsControllerFunctionName: string = this.identifierNameGenerator.generate(6); + const callsControllerFunctionName: string = this.identifierNamesGenerator.generate(6); const consoleOutputDisableExpressionNode: ICustomNode = this.customNodeFactory(CustomNode.ConsoleOutputDisableExpressionNode); const nodeCallsControllerFunctionNode: ICustomNode = this.customNodeFactory(CustomNode.NodeCallsControllerFunctionNode); diff --git a/src/custom-nodes/control-flow-flattening-nodes/BinaryExpressionFunctionNode.ts b/src/custom-nodes/control-flow-flattening-nodes/BinaryExpressionFunctionNode.ts index c7130f96..03db8085 100644 --- a/src/custom-nodes/control-flow-flattening-nodes/BinaryExpressionFunctionNode.ts +++ b/src/custom-nodes/control-flow-flattening-nodes/BinaryExpressionFunctionNode.ts @@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import { BinaryOperator } from 'estree'; -import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory'; +import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory'; import { TStatement } from '../../types/node/TStatement'; import { IOptions } from '../../interfaces/options/IOptions'; @@ -24,17 +24,17 @@ export class BinaryExpressionFunctionNode extends AbstractCustomNode { private operator: BinaryOperator; /** - * @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory + * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory * @param {IRandomGenerator} randomGenerator * @param {IOptions} options */ constructor ( - @inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator) - identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory, + @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator) + identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @inject(ServiceIdentifiers.IOptions) options: IOptions ) { - super(identifierNameGeneratorFactory, randomGenerator, options); + super(identifierNamesGeneratorFactory, randomGenerator, options); } /** diff --git a/src/custom-nodes/control-flow-flattening-nodes/BlockStatementControlFlowFlatteningNode.ts b/src/custom-nodes/control-flow-flattening-nodes/BlockStatementControlFlowFlatteningNode.ts index 08a026ad..c3466bd1 100644 --- a/src/custom-nodes/control-flow-flattening-nodes/BlockStatementControlFlowFlatteningNode.ts +++ b/src/custom-nodes/control-flow-flattening-nodes/BlockStatementControlFlowFlatteningNode.ts @@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; -import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory'; +import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory'; import { TStatement } from '../../types/node/TStatement'; import { IOptions } from '../../interfaces/options/IOptions'; @@ -37,17 +37,17 @@ export class BlockStatementControlFlowFlatteningNode extends AbstractCustomNode private shuffledKeys: number[]; /** - * @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory + * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory * @param {IRandomGenerator} randomGenerator * @param {IOptions} options */ constructor ( - @inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator) - identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory, + @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator) + identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @inject(ServiceIdentifiers.IOptions) options: IOptions ) { - super(identifierNameGeneratorFactory, randomGenerator, options); + super(identifierNamesGeneratorFactory, randomGenerator, options); } /** diff --git a/src/custom-nodes/control-flow-flattening-nodes/CallExpressionFunctionNode.ts b/src/custom-nodes/control-flow-flattening-nodes/CallExpressionFunctionNode.ts index 148b602a..c1679e47 100644 --- a/src/custom-nodes/control-flow-flattening-nodes/CallExpressionFunctionNode.ts +++ b/src/custom-nodes/control-flow-flattening-nodes/CallExpressionFunctionNode.ts @@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; -import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory'; +import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory'; import { TStatement } from '../../types/node/TStatement'; import { IOptions } from '../../interfaces/options/IOptions'; @@ -24,17 +24,17 @@ export class CallExpressionFunctionNode extends AbstractCustomNode { private expressionArguments: (ESTree.Expression | ESTree.SpreadElement)[]; /** - * @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory + * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory * @param {IRandomGenerator} randomGenerator * @param {IOptions} options */ constructor ( - @inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator) - identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory, + @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator) + identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @inject(ServiceIdentifiers.IOptions) options: IOptions ) { - super(identifierNameGeneratorFactory, randomGenerator, options); + super(identifierNamesGeneratorFactory, randomGenerator, options); } /** diff --git a/src/custom-nodes/control-flow-flattening-nodes/LogicalExpressionFunctionNode.ts b/src/custom-nodes/control-flow-flattening-nodes/LogicalExpressionFunctionNode.ts index 6b3d13b7..9d0a5b99 100644 --- a/src/custom-nodes/control-flow-flattening-nodes/LogicalExpressionFunctionNode.ts +++ b/src/custom-nodes/control-flow-flattening-nodes/LogicalExpressionFunctionNode.ts @@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import { LogicalOperator } from 'estree'; -import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory'; +import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory'; import { TStatement } from '../../types/node/TStatement'; import { IOptions } from '../../interfaces/options/IOptions'; @@ -24,17 +24,17 @@ export class LogicalExpressionFunctionNode extends AbstractCustomNode { private operator: LogicalOperator; /** - * @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory + * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory * @param {IRandomGenerator} randomGenerator * @param {IOptions} options */ constructor ( - @inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator) - identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory, + @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator) + identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @inject(ServiceIdentifiers.IOptions) options: IOptions ) { - super(identifierNameGeneratorFactory, randomGenerator, options); + super(identifierNamesGeneratorFactory, randomGenerator, options); } /** diff --git a/src/custom-nodes/control-flow-flattening-nodes/StringLiteralNode.ts b/src/custom-nodes/control-flow-flattening-nodes/StringLiteralNode.ts index 24f1cb22..b3d7da55 100644 --- a/src/custom-nodes/control-flow-flattening-nodes/StringLiteralNode.ts +++ b/src/custom-nodes/control-flow-flattening-nodes/StringLiteralNode.ts @@ -1,7 +1,7 @@ import { inject, injectable, } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; -import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory'; +import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory'; import { TStatement } from '../../types/node/TStatement'; import { IOptions } from '../../interfaces/options/IOptions'; @@ -21,17 +21,17 @@ export class StringLiteralNode extends AbstractCustomNode { private literalValue: string; /** - * @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory + * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory * @param {IRandomGenerator} randomGenerator * @param {IOptions} options */ constructor ( - @inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator) - identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory, + @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator) + identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @inject(ServiceIdentifiers.IOptions) options: IOptions ) { - super(identifierNameGeneratorFactory, randomGenerator, options); + super(identifierNamesGeneratorFactory, randomGenerator, options); } /** diff --git a/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/CallExpressionControlFlowStorageCallNode.ts b/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/CallExpressionControlFlowStorageCallNode.ts index d9bb68b1..5da4d0f6 100644 --- a/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/CallExpressionControlFlowStorageCallNode.ts +++ b/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/CallExpressionControlFlowStorageCallNode.ts @@ -4,7 +4,7 @@ import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; import { Expression } from 'estree'; -import { TIdentifierNameGeneratorFactory } from '../../../types/container/generators/TIdentifierNameGeneratorFactory'; +import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory'; import { TStatement } from '../../../types/node/TStatement'; import { IOptions } from '../../../interfaces/options/IOptions'; @@ -43,17 +43,17 @@ export class CallExpressionControlFlowStorageCallNode extends AbstractCustomNode private expressionArguments: (ESTree.Expression | ESTree.SpreadElement)[]; /** - * @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory + * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory * @param {IRandomGenerator} randomGenerator * @param {IOptions} options */ constructor ( - @inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator) - identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory, + @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator) + identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @inject(ServiceIdentifiers.IOptions) options: IOptions ) { - super(identifierNameGeneratorFactory, randomGenerator, options); + super(identifierNamesGeneratorFactory, randomGenerator, options); } /** diff --git a/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ControlFlowStorageNode.ts b/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ControlFlowStorageNode.ts index 8d8555f6..5e26eb74 100644 --- a/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ControlFlowStorageNode.ts +++ b/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ControlFlowStorageNode.ts @@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; -import { TIdentifierNameGeneratorFactory } from '../../../types/container/generators/TIdentifierNameGeneratorFactory'; +import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory'; import { TStatement } from '../../../types/node/TStatement'; import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode'; @@ -26,17 +26,17 @@ export class ControlFlowStorageNode extends AbstractCustomNode { private controlFlowStorage: IStorage ; /** - * @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory + * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory * @param {IRandomGenerator} randomGenerator * @param {IOptions} options */ constructor ( - @inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator) - identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory, + @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator) + identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @inject(ServiceIdentifiers.IOptions) options: IOptions ) { - super(identifierNameGeneratorFactory, randomGenerator, options); + super(identifierNamesGeneratorFactory, randomGenerator, options); } /** diff --git a/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ExpressionWithOperatorControlFlowStorageCallNode.ts b/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ExpressionWithOperatorControlFlowStorageCallNode.ts index 2b7e5d94..98c860e3 100644 --- a/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ExpressionWithOperatorControlFlowStorageCallNode.ts +++ b/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ExpressionWithOperatorControlFlowStorageCallNode.ts @@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers'; import { Expression } from 'estree'; -import { TIdentifierNameGeneratorFactory } from '../../../types/container/generators/TIdentifierNameGeneratorFactory'; +import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory'; import { TStatement } from '../../../types/node/TStatement'; import { IOptions } from '../../../interfaces/options/IOptions'; @@ -42,17 +42,17 @@ export class ExpressionWithOperatorControlFlowStorageCallNode extends AbstractCu private rightValue: Expression; /** - * @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory + * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory * @param {IRandomGenerator} randomGenerator * @param {IOptions} options */ constructor ( - @inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator) - identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory, + @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator) + identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @inject(ServiceIdentifiers.IOptions) options: IOptions ) { - super(identifierNameGeneratorFactory, randomGenerator, options); + super(identifierNamesGeneratorFactory, randomGenerator, options); } /** diff --git a/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/StringLiteralControlFlowStorageCallNode.ts b/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/StringLiteralControlFlowStorageCallNode.ts index 7240134b..2d58f0a9 100644 --- a/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/StringLiteralControlFlowStorageCallNode.ts +++ b/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/StringLiteralControlFlowStorageCallNode.ts @@ -1,7 +1,7 @@ import { inject, injectable, } from 'inversify'; import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers'; -import { TIdentifierNameGeneratorFactory } from '../../../types/container/generators/TIdentifierNameGeneratorFactory'; +import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory'; import { TStatement } from '../../../types/node/TStatement'; import { IOptions } from '../../../interfaces/options/IOptions'; @@ -28,17 +28,17 @@ export class StringLiteralControlFlowStorageCallNode extends AbstractCustomNode private controlFlowStorageName: string; /** - * @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory + * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory * @param {IRandomGenerator} randomGenerator * @param {IOptions} options */ constructor ( - @inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator) - identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory, + @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator) + identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @inject(ServiceIdentifiers.IOptions) options: IOptions ) { - super(identifierNameGeneratorFactory, randomGenerator, options); + super(identifierNamesGeneratorFactory, randomGenerator, options); } /** diff --git a/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionCallNode.ts b/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionCallNode.ts index 7239ee4b..5fd78cb5 100644 --- a/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionCallNode.ts +++ b/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionCallNode.ts @@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as format from 'string-template'; -import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory'; +import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory'; import { TStatement } from '../../types/node/TStatement'; import { IOptions } from '../../interfaces/options/IOptions'; @@ -31,17 +31,17 @@ export class DebugProtectionFunctionCallNode extends AbstractCustomNode { private debugProtectionFunctionName: string; /** - * @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory + * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory * @param {IRandomGenerator} randomGenerator * @param {IOptions} options */ constructor ( - @inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator) - identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory, + @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator) + identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @inject(ServiceIdentifiers.IOptions) options: IOptions ) { - super(identifierNameGeneratorFactory, randomGenerator, options); + super(identifierNamesGeneratorFactory, randomGenerator, options); } /** diff --git a/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionIntervalNode.ts b/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionIntervalNode.ts index 575b8fd5..16b8ea72 100644 --- a/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionIntervalNode.ts +++ b/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionIntervalNode.ts @@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as format from 'string-template'; -import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory'; +import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory'; import { TStatement } from '../../types/node/TStatement'; import { IOptions } from '../../interfaces/options/IOptions'; @@ -25,17 +25,17 @@ export class DebugProtectionFunctionIntervalNode extends AbstractCustomNode { private debugProtectionFunctionName: string; /** - * @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory + * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory * @param {IRandomGenerator} randomGenerator * @param {IOptions} options */ constructor ( - @inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator) - identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory, + @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator) + identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @inject(ServiceIdentifiers.IOptions) options: IOptions ) { - super(identifierNameGeneratorFactory, randomGenerator, options); + super(identifierNamesGeneratorFactory, randomGenerator, options); } /** diff --git a/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode.ts b/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode.ts index 52c04b5e..74475d5f 100644 --- a/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode.ts +++ b/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode.ts @@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as format from 'string-template'; -import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory'; +import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory'; import { TStatement } from '../../types/node/TStatement'; import { IOptions } from '../../interfaces/options/IOptions'; @@ -29,17 +29,17 @@ export class DebugProtectionFunctionNode extends AbstractCustomNode { private debugProtectionFunctionName: string; /** - * @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory + * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory * @param {IRandomGenerator} randomGenerator * @param {IOptions} options */ constructor ( - @inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator) - identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory, + @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator) + identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @inject(ServiceIdentifiers.IOptions) options: IOptions ) { - super(identifierNameGeneratorFactory, randomGenerator, options); + super(identifierNamesGeneratorFactory, randomGenerator, options); } /** diff --git a/src/custom-nodes/debug-protection-nodes/group/DebugProtectionCustomNodeGroup.ts b/src/custom-nodes/debug-protection-nodes/group/DebugProtectionCustomNodeGroup.ts index e2e7a3a3..fb7d3d64 100644 --- a/src/custom-nodes/debug-protection-nodes/group/DebugProtectionCustomNodeGroup.ts +++ b/src/custom-nodes/debug-protection-nodes/group/DebugProtectionCustomNodeGroup.ts @@ -2,7 +2,7 @@ import { inject, injectable, } from 'inversify'; import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers'; import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory'; -import { TIdentifierNameGeneratorFactory } from '../../../types/container/generators/TIdentifierNameGeneratorFactory'; +import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory'; import { TNodeWithBlockStatement } from '../../../types/node/TNodeWithBlockStatement'; import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode'; @@ -38,18 +38,18 @@ export class DebugProtectionCustomNodeGroup extends AbstractCustomNodeGroup { /** * @param {TCustomNodeFactory} customNodeFactory - * @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory + * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory * @param {IRandomGenerator} randomGenerator * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory, - @inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator) - identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory, + @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator) + identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @inject(ServiceIdentifiers.IOptions) options: IOptions ) { - super(identifierNameGeneratorFactory, randomGenerator, options); + super(identifierNamesGeneratorFactory, randomGenerator, options); this.customNodeFactory = customNodeFactory; } @@ -105,8 +105,8 @@ export class DebugProtectionCustomNodeGroup extends AbstractCustomNodeGroup { return; } - const debugProtectionFunctionName: string = this.identifierNameGenerator.generate(6); - const callsControllerFunctionName: string = this.identifierNameGenerator.generate(6); + const debugProtectionFunctionName: string = this.identifierNamesGenerator.generate(6); + const callsControllerFunctionName: string = this.identifierNamesGenerator.generate(6); const debugProtectionFunctionNode: ICustomNode = this.customNodeFactory(CustomNode.DebugProtectionFunctionNode); const debugProtectionFunctionCallNode: ICustomNode = this.customNodeFactory(CustomNode.DebugProtectionFunctionCallNode); diff --git a/src/custom-nodes/domain-lock-nodes/DomainLockNode.ts b/src/custom-nodes/domain-lock-nodes/DomainLockNode.ts index 1614dcd7..efea3434 100644 --- a/src/custom-nodes/domain-lock-nodes/DomainLockNode.ts +++ b/src/custom-nodes/domain-lock-nodes/DomainLockNode.ts @@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as format from 'string-template'; -import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory'; +import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory'; import { TStatement } from '../../types/node/TStatement'; import { ICryptUtils } from '../../interfaces/utils/ICryptUtils'; @@ -34,19 +34,19 @@ export class DomainLockNode extends AbstractCustomNode { private readonly cryptUtils: ICryptUtils; /** - * @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory + * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory * @param {IRandomGenerator} randomGenerator * @param {ICryptUtils} cryptUtils * @param {IOptions} options */ constructor ( - @inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator) - identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory, + @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator) + identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @inject(ServiceIdentifiers.ICryptUtils) cryptUtils: ICryptUtils, @inject(ServiceIdentifiers.IOptions) options: IOptions ) { - super(identifierNameGeneratorFactory, randomGenerator, options); + super(identifierNamesGeneratorFactory, randomGenerator, options); this.cryptUtils = cryptUtils; } @@ -79,7 +79,7 @@ export class DomainLockNode extends AbstractCustomNode { : GlobalVariableNoEvalTemplate(); return format(DomainLockNodeTemplate(), { - domainLockFunctionName: this.identifierNameGenerator.generate(6), + domainLockFunctionName: this.identifierNamesGenerator.generate(6), diff: diff, domains: hiddenDomainsString, globalVariableTemplate, diff --git a/src/custom-nodes/domain-lock-nodes/group/DomainLockCustomNodeGroup.ts b/src/custom-nodes/domain-lock-nodes/group/DomainLockCustomNodeGroup.ts index ba57b7fb..e3874138 100644 --- a/src/custom-nodes/domain-lock-nodes/group/DomainLockCustomNodeGroup.ts +++ b/src/custom-nodes/domain-lock-nodes/group/DomainLockCustomNodeGroup.ts @@ -2,7 +2,7 @@ import { inject, injectable, } from 'inversify'; import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers'; import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory'; -import { TIdentifierNameGeneratorFactory } from '../../../types/container/generators/TIdentifierNameGeneratorFactory'; +import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory'; import { TNodeWithBlockStatement } from '../../../types/node/TNodeWithBlockStatement'; import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode'; @@ -38,18 +38,18 @@ export class DomainLockCustomNodeGroup extends AbstractCustomNodeGroup { /** * @param {TCustomNodeFactory} customNodeFactory - * @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory + * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory * @param {IRandomGenerator} randomGenerator * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory, - @inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator) - identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory, + @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator) + identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @inject(ServiceIdentifiers.IOptions) options: IOptions ) { - super(identifierNameGeneratorFactory, randomGenerator, options); + super(identifierNamesGeneratorFactory, randomGenerator, options); this.customNodeFactory = customNodeFactory; } @@ -92,7 +92,7 @@ export class DomainLockCustomNodeGroup extends AbstractCustomNodeGroup { return; } - const callsControllerFunctionName: string = this.identifierNameGenerator.generate(6); + const callsControllerFunctionName: string = this.identifierNamesGenerator.generate(6); const domainLockNode: ICustomNode = this.customNodeFactory(CustomNode.DomainLockNode); const nodeCallsControllerFunctionNode: ICustomNode = this.customNodeFactory(CustomNode.NodeCallsControllerFunctionNode); diff --git a/src/custom-nodes/node-calls-controller-nodes/NodeCallsControllerFunctionNode.ts b/src/custom-nodes/node-calls-controller-nodes/NodeCallsControllerFunctionNode.ts index 2c8a17a4..31c4dab9 100644 --- a/src/custom-nodes/node-calls-controller-nodes/NodeCallsControllerFunctionNode.ts +++ b/src/custom-nodes/node-calls-controller-nodes/NodeCallsControllerFunctionNode.ts @@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as format from 'string-template'; -import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory'; +import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory'; import { TStatement } from '../../types/node/TStatement'; import { IOptions } from '../../interfaces/options/IOptions'; @@ -36,17 +36,17 @@ export class NodeCallsControllerFunctionNode extends AbstractCustomNode { private appendEvent: ObfuscationEvent; /** - * @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory + * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory * @param {IRandomGenerator} randomGenerator * @param {IOptions} options */ constructor ( - @inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator) - identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory, + @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator) + identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @inject(ServiceIdentifiers.IOptions) options: IOptions ) { - super(identifierNameGeneratorFactory, randomGenerator, options); + super(identifierNamesGeneratorFactory, randomGenerator, options); } /** @@ -76,7 +76,7 @@ export class NodeCallsControllerFunctionNode extends AbstractCustomNode { }), { ...NO_CUSTOM_NODES_PRESET, - mangle: this.options.mangle, + identifierNamesGenerator: this.options.identifierNamesGenerator, seed: this.options.seed } ).getObfuscatedCode(); diff --git a/src/custom-nodes/self-defending-nodes/SelfDefendingUnicodeNode.ts b/src/custom-nodes/self-defending-nodes/SelfDefendingUnicodeNode.ts index 05414d84..f11df688 100644 --- a/src/custom-nodes/self-defending-nodes/SelfDefendingUnicodeNode.ts +++ b/src/custom-nodes/self-defending-nodes/SelfDefendingUnicodeNode.ts @@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as format from 'string-template'; -import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory'; +import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory'; import { TStatement } from '../../types/node/TStatement'; import { IEscapeSequenceEncoder } from '../../interfaces/utils/IEscapeSequenceEncoder'; @@ -34,19 +34,19 @@ export class SelfDefendingUnicodeNode extends AbstractCustomNode { private callsControllerFunctionName: string; /** - * @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory + * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory * @param {IRandomGenerator} randomGenerator * @param {IEscapeSequenceEncoder} escapeSequenceEncoder * @param {IOptions} options */ constructor ( - @inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator) - identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory, + @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator) + identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @inject(ServiceIdentifiers.IEscapeSequenceEncoder) escapeSequenceEncoder: IEscapeSequenceEncoder, @inject(ServiceIdentifiers.IOptions) options: IOptions ) { - super(identifierNameGeneratorFactory, randomGenerator, options); + super(identifierNamesGeneratorFactory, randomGenerator, options); this.escapeSequenceEncoder = escapeSequenceEncoder; } @@ -71,12 +71,12 @@ export class SelfDefendingUnicodeNode extends AbstractCustomNode { protected getTemplate (): string { return JavaScriptObfuscator.obfuscate( format(SelfDefendingTemplate(this.escapeSequenceEncoder), { - selfDefendingFunctionName: this.identifierNameGenerator.generate(6), + selfDefendingFunctionName: this.identifierNamesGenerator.generate(6), singleNodeCallControllerFunctionName: this.callsControllerFunctionName }), { ...NO_CUSTOM_NODES_PRESET, - mangle: this.options.mangle, + identifierNamesGenerator: this.options.identifierNamesGenerator, seed: this.options.seed, unicodeEscapeSequence: true } diff --git a/src/custom-nodes/self-defending-nodes/group/SelfDefendingCustomNodeGroup.ts b/src/custom-nodes/self-defending-nodes/group/SelfDefendingCustomNodeGroup.ts index 90e8e642..07290a0e 100644 --- a/src/custom-nodes/self-defending-nodes/group/SelfDefendingCustomNodeGroup.ts +++ b/src/custom-nodes/self-defending-nodes/group/SelfDefendingCustomNodeGroup.ts @@ -2,7 +2,7 @@ import { inject, injectable, } from 'inversify'; import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers'; import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory'; -import { TIdentifierNameGeneratorFactory } from '../../../types/container/generators/TIdentifierNameGeneratorFactory'; +import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory'; import { TNodeWithBlockStatement } from '../../../types/node/TNodeWithBlockStatement'; import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode'; @@ -38,18 +38,18 @@ export class SelfDefendingCustomNodeGroup extends AbstractCustomNodeGroup { /** * @param {TCustomNodeFactory} customNodeFactory - * @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory + * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory * @param {IRandomGenerator} randomGenerator * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory, - @inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator) - identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory, + @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator) + identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @inject(ServiceIdentifiers.IOptions) options: IOptions ) { - super(identifierNameGeneratorFactory, randomGenerator, options); + super(identifierNamesGeneratorFactory, randomGenerator, options); this.customNodeFactory = customNodeFactory; } @@ -92,7 +92,7 @@ export class SelfDefendingCustomNodeGroup extends AbstractCustomNodeGroup { return; } - const callsControllerFunctionName: string = this.identifierNameGenerator.generate(6); + const callsControllerFunctionName: string = this.identifierNamesGenerator.generate(6); const selfDefendingUnicodeNode: ICustomNode = this.customNodeFactory(CustomNode.SelfDefendingUnicodeNode); const nodeCallsControllerFunctionNode: ICustomNode = this.customNodeFactory(CustomNode.NodeCallsControllerFunctionNode); diff --git a/src/custom-nodes/string-array-nodes/StringArrayCallsWrapper.ts b/src/custom-nodes/string-array-nodes/StringArrayCallsWrapper.ts index cb15116b..25780b99 100644 --- a/src/custom-nodes/string-array-nodes/StringArrayCallsWrapper.ts +++ b/src/custom-nodes/string-array-nodes/StringArrayCallsWrapper.ts @@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as format from 'string-template'; -import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory'; +import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory'; import { TStatement } from '../../types/node/TStatement'; import { IEscapeSequenceEncoder } from '../../interfaces/utils/IEscapeSequenceEncoder'; @@ -49,19 +49,19 @@ export class StringArrayCallsWrapper extends AbstractCustomNode { private stringArrayCallsWrapperName: string; /** - * @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory + * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory * @param {IRandomGenerator} randomGenerator * @param {IEscapeSequenceEncoder} escapeSequenceEncoder * @param {IOptions} options */ constructor ( - @inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator) - identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory, + @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator) + identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @inject(ServiceIdentifiers.IEscapeSequenceEncoder) escapeSequenceEncoder: IEscapeSequenceEncoder, @inject(ServiceIdentifiers.IOptions) options: IOptions ) { - super(identifierNameGeneratorFactory, randomGenerator, options); + super(identifierNamesGeneratorFactory, randomGenerator, options); this.escapeSequenceEncoder = escapeSequenceEncoder; } @@ -99,7 +99,7 @@ export class StringArrayCallsWrapper extends AbstractCustomNode { }), { ...NO_CUSTOM_NODES_PRESET, - mangle: this.options.mangle, + identifierNamesGenerator: this.options.identifierNamesGenerator, seed: this.options.seed } ).getObfuscatedCode(); diff --git a/src/custom-nodes/string-array-nodes/StringArrayNode.ts b/src/custom-nodes/string-array-nodes/StringArrayNode.ts index 4d7983b0..f26813ae 100644 --- a/src/custom-nodes/string-array-nodes/StringArrayNode.ts +++ b/src/custom-nodes/string-array-nodes/StringArrayNode.ts @@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as format from 'string-template'; -import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory'; +import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory'; import { TStatement } from '../../types/node/TStatement'; import { IOptions } from '../../interfaces/options/IOptions'; @@ -39,17 +39,17 @@ export class StringArrayNode extends AbstractCustomNode { private stringArrayRotateValue: number; /** - * @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory + * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory * @param {IRandomGenerator} randomGenerator * @param {IOptions} options */ constructor ( - @inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator) - identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory, + @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator) + identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @inject(ServiceIdentifiers.IOptions) options: IOptions ) { - super(identifierNameGeneratorFactory, randomGenerator, options); + super(identifierNamesGeneratorFactory, randomGenerator, options); } /** diff --git a/src/custom-nodes/string-array-nodes/StringArrayRotateFunctionNode.ts b/src/custom-nodes/string-array-nodes/StringArrayRotateFunctionNode.ts index 1def3eff..4bf087c1 100644 --- a/src/custom-nodes/string-array-nodes/StringArrayRotateFunctionNode.ts +++ b/src/custom-nodes/string-array-nodes/StringArrayRotateFunctionNode.ts @@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as format from 'string-template'; -import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory'; +import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory'; import { TStatement } from '../../types/node/TStatement'; import { IEscapeSequenceEncoder } from '../../interfaces/utils/IEscapeSequenceEncoder'; @@ -42,19 +42,19 @@ export class StringArrayRotateFunctionNode extends AbstractCustomNode { private stringArrayRotateValue: number; /** - * @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory + * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory * @param {IRandomGenerator} randomGenerator * @param {IEscapeSequenceEncoder} escapeSequenceEncoder * @param {IOptions} options */ constructor ( - @inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator) - identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory, + @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator) + identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @inject(ServiceIdentifiers.IEscapeSequenceEncoder) escapeSequenceEncoder: IEscapeSequenceEncoder, @inject(ServiceIdentifiers.IOptions) options: IOptions ) { - super(identifierNameGeneratorFactory, randomGenerator, options); + super(identifierNamesGeneratorFactory, randomGenerator, options); this.escapeSequenceEncoder = escapeSequenceEncoder; } @@ -82,8 +82,8 @@ export class StringArrayRotateFunctionNode extends AbstractCustomNode { * @returns {string} */ protected getTemplate (): string { - const timesName: string = this.identifierNameGenerator.generate(6); - const whileFunctionName: string = this.identifierNameGenerator.generate(6); + const timesName: string = this.identifierNamesGenerator.generate(6); + const whileFunctionName: string = this.identifierNamesGenerator.generate(6); let code: string = ''; @@ -106,7 +106,7 @@ export class StringArrayRotateFunctionNode extends AbstractCustomNode { }), { ...NO_CUSTOM_NODES_PRESET, - mangle: this.options.mangle, + identifierNamesGenerator: this.options.identifierNamesGenerator, seed: this.options.seed } ).getObfuscatedCode(); diff --git a/src/custom-nodes/string-array-nodes/group/StringArrayCustomNodeGroup.ts b/src/custom-nodes/string-array-nodes/group/StringArrayCustomNodeGroup.ts index a70b0bfb..8ecf900d 100644 --- a/src/custom-nodes/string-array-nodes/group/StringArrayCustomNodeGroup.ts +++ b/src/custom-nodes/string-array-nodes/group/StringArrayCustomNodeGroup.ts @@ -2,7 +2,7 @@ import { inject, injectable, } from 'inversify'; import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers'; import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory'; -import { TIdentifierNameGeneratorFactory } from '../../../types/container/generators/TIdentifierNameGeneratorFactory'; +import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory'; import { TNodeWithBlockStatement } from '../../../types/node/TNodeWithBlockStatement'; import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode'; @@ -46,19 +46,19 @@ export class StringArrayCustomNodeGroup extends AbstractCustomNodeGroup { /** * @param {TCustomNodeFactory} customNodeFactory * @param {IStorage} stringArrayStorage - * @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory + * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory * @param {IRandomGenerator} randomGenerator * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory, @inject(ServiceIdentifiers.TStringArrayStorage) stringArrayStorage: IStorage, - @inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator) - identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory, + @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator) + identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @inject(ServiceIdentifiers.IOptions) options: IOptions ) { - super(identifierNameGeneratorFactory, randomGenerator, options); + super(identifierNamesGeneratorFactory, randomGenerator, options); this.customNodeFactory = customNodeFactory; this.stringArrayStorage = stringArrayStorage; diff --git a/src/enums/generators/identifier-name-generators/IdentifierNameGenerator.ts b/src/enums/generators/identifier-name-generators/IdentifierNameGenerator.ts deleted file mode 100644 index d5ec2db4..00000000 --- a/src/enums/generators/identifier-name-generators/IdentifierNameGenerator.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum IdentifierNameGenerator { - HexadecimalIdentifierNameGenerator, - MangledIdentifierNameGenerator -} diff --git a/src/enums/generators/identifier-names-generators/IdentifierNamesGenerator.ts b/src/enums/generators/identifier-names-generators/IdentifierNamesGenerator.ts new file mode 100644 index 00000000..62fa26b1 --- /dev/null +++ b/src/enums/generators/identifier-names-generators/IdentifierNamesGenerator.ts @@ -0,0 +1,4 @@ +export enum IdentifierNamesGenerator { + HexadecimalIdentifierNamesGenerator = 'hexadecimal', + MangledIdentifierNamesGenerator = 'mangled' +} diff --git a/src/generators/identifier-name-generators/AbstractIdentifierNameGenerator.ts b/src/generators/identifier-names-generators/AbstractIdentifierNamesGenerator.ts similarity index 81% rename from src/generators/identifier-name-generators/AbstractIdentifierNameGenerator.ts rename to src/generators/identifier-names-generators/AbstractIdentifierNamesGenerator.ts index 00fb1e34..17e5b999 100644 --- a/src/generators/identifier-name-generators/AbstractIdentifierNameGenerator.ts +++ b/src/generators/identifier-names-generators/AbstractIdentifierNamesGenerator.ts @@ -1,12 +1,12 @@ import { inject, injectable } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; -import { IIdentifierNameGenerator } from '../../interfaces/generators/identifier-name-generators/IIdentifierNameGenerator'; +import { IIdentifierNamesGenerator } from '../../interfaces/generators/identifier-names-generators/IIdentifierNamesGenerator'; import { IOptions } from '../../interfaces/options/IOptions'; import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator'; @injectable() -export abstract class AbstractIdentifierNameGenerator implements IIdentifierNameGenerator { +export abstract class AbstractIdentifierNamesGenerator implements IIdentifierNamesGenerator { /** * @type {IOptions} */ diff --git a/src/generators/identifier-name-generators/HexadecimalIdentifierNameGenerator.ts b/src/generators/identifier-names-generators/HexadecimalIdentifierNamesGenerator.ts similarity index 89% rename from src/generators/identifier-name-generators/HexadecimalIdentifierNameGenerator.ts rename to src/generators/identifier-names-generators/HexadecimalIdentifierNamesGenerator.ts index c63c75ca..caa8d4be 100644 --- a/src/generators/identifier-name-generators/HexadecimalIdentifierNameGenerator.ts +++ b/src/generators/identifier-names-generators/HexadecimalIdentifierNamesGenerator.ts @@ -4,11 +4,11 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import { IOptions } from '../../interfaces/options/IOptions'; import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator'; -import { AbstractIdentifierNameGenerator } from './AbstractIdentifierNameGenerator'; +import { AbstractIdentifierNamesGenerator } from './AbstractIdentifierNamesGenerator'; import { Utils } from '../../utils/Utils'; @injectable() -export class HexadecimalIdentifierNameGenerator extends AbstractIdentifierNameGenerator { +export class HexadecimalIdentifierNamesGenerator extends AbstractIdentifierNamesGenerator { /** * @type {Set} */ diff --git a/src/generators/identifier-name-generators/MangledIdentifierNameGenerator.ts b/src/generators/identifier-names-generators/MangledIdentifierNamesGenerator.ts similarity index 81% rename from src/generators/identifier-name-generators/MangledIdentifierNameGenerator.ts rename to src/generators/identifier-names-generators/MangledIdentifierNamesGenerator.ts index 23206fa9..826d55a9 100644 --- a/src/generators/identifier-name-generators/MangledIdentifierNameGenerator.ts +++ b/src/generators/identifier-names-generators/MangledIdentifierNamesGenerator.ts @@ -4,10 +4,10 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import { IOptions } from '../../interfaces/options/IOptions'; import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator'; -import { AbstractIdentifierNameGenerator } from './AbstractIdentifierNameGenerator'; +import { AbstractIdentifierNamesGenerator } from './AbstractIdentifierNamesGenerator'; @injectable() -export class MangledIdentifierNameGenerator extends AbstractIdentifierNameGenerator { +export class MangledIdentifierNamesGenerator extends AbstractIdentifierNamesGenerator { /** * @type {string} */ @@ -32,7 +32,7 @@ export class MangledIdentifierNameGenerator extends AbstractIdentifierNameGenera /** * @type {string} */ - private previousMangledName: string = MangledIdentifierNameGenerator.initMangledNameCharacter; + private previousMangledName: string = MangledIdentifierNamesGenerator.initMangledNameCharacter; /** * @param {IRandomGenerator} randomGenerator @@ -51,7 +51,7 @@ export class MangledIdentifierNameGenerator extends AbstractIdentifierNameGenera */ private static generateNewMangledName (previousMangledName: string): string { const generateNewMangledName: (name: string) => string = (name: string): string => { - const nameSequence: string[] = MangledIdentifierNameGenerator.nameSequence; + const nameSequence: string[] = MangledIdentifierNamesGenerator.nameSequence; const zeroSequenceCache: string[] = []; const zeroSequence: (num: number) => string = (num: number): string => { @@ -87,8 +87,8 @@ export class MangledIdentifierNameGenerator extends AbstractIdentifierNameGenera let newMangledName: string = generateNewMangledName(previousMangledName); - if (!MangledIdentifierNameGenerator.validateMangledName(newMangledName)) { - newMangledName = MangledIdentifierNameGenerator.generateNewMangledName(newMangledName); + if (!MangledIdentifierNamesGenerator.validateMangledName(newMangledName)) { + newMangledName = MangledIdentifierNamesGenerator.generateNewMangledName(newMangledName); } return newMangledName; @@ -99,7 +99,7 @@ export class MangledIdentifierNameGenerator extends AbstractIdentifierNameGenera * @returns {boolean} */ private static validateMangledName (mangledName: string): boolean { - return !MangledIdentifierNameGenerator.reservedNames.includes(mangledName); + return !MangledIdentifierNamesGenerator.reservedNames.includes(mangledName); } /** @@ -107,7 +107,7 @@ export class MangledIdentifierNameGenerator extends AbstractIdentifierNameGenera * @returns {string} */ public generate (length: number): string { - const newName: string = MangledIdentifierNameGenerator.generateNewMangledName(this.previousMangledName); + const newName: string = MangledIdentifierNamesGenerator.generateNewMangledName(this.previousMangledName); this.previousMangledName = newName; diff --git a/src/interfaces/generators/identifier-name-generators/IIdentifierNameGenerator.d.ts b/src/interfaces/generators/identifier-names-generators/IIdentifierNamesGenerator.d.ts similarity index 71% rename from src/interfaces/generators/identifier-name-generators/IIdentifierNameGenerator.d.ts rename to src/interfaces/generators/identifier-names-generators/IIdentifierNamesGenerator.d.ts index 88c63497..327c5caa 100644 --- a/src/interfaces/generators/identifier-name-generators/IIdentifierNameGenerator.d.ts +++ b/src/interfaces/generators/identifier-names-generators/IIdentifierNamesGenerator.d.ts @@ -1,4 +1,4 @@ -export interface IIdentifierNameGenerator { +export interface IIdentifierNamesGenerator { /** * @param {number} length * @returns {string} diff --git a/src/interfaces/options/IOptions.d.ts b/src/interfaces/options/IOptions.d.ts index 16ef665b..b2cc2635 100644 --- a/src/interfaces/options/IOptions.d.ts +++ b/src/interfaces/options/IOptions.d.ts @@ -1,5 +1,6 @@ import { TStringArrayEncoding } from '../../types/options/TStringArrayEncoding'; +import { IdentifierNamesGenerator } from '../../enums/generators/identifier-names-generators/IdentifierNamesGenerator'; import { ObfuscationTarget } from '../../enums/ObfuscationTarget'; import { SourceMapMode } from '../../enums/source-map/SourceMapMode'; @@ -13,8 +14,8 @@ export interface IOptions { readonly debugProtectionInterval: boolean; readonly disableConsoleOutput: boolean; readonly domainLock: string[]; + readonly identifierNamesGenerator: IdentifierNamesGenerator; readonly log: boolean; - readonly mangle: boolean; readonly renameGlobals: boolean; readonly reservedNames: string[]; readonly rotateStringArray: boolean; diff --git a/src/node-transformers/obfuscating-transformers/obfuscating-replacers/identifier-obfuscating-replacers/BaseIdentifierObfuscatingReplacer.ts b/src/node-transformers/obfuscating-transformers/obfuscating-replacers/identifier-obfuscating-replacers/BaseIdentifierObfuscatingReplacer.ts index 8aaed075..02d3dc78 100644 --- a/src/node-transformers/obfuscating-transformers/obfuscating-replacers/identifier-obfuscating-replacers/BaseIdentifierObfuscatingReplacer.ts +++ b/src/node-transformers/obfuscating-transformers/obfuscating-replacers/identifier-obfuscating-replacers/BaseIdentifierObfuscatingReplacer.ts @@ -3,9 +3,9 @@ import { ServiceIdentifiers } from '../../../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; -import { TIdentifierNameGeneratorFactory } from '../../../../types/container/generators/TIdentifierNameGeneratorFactory'; +import { TIdentifierNamesGeneratorFactory } from '../../../../types/container/generators/TIdentifierNamesGeneratorFactory'; -import { IIdentifierNameGenerator } from '../../../../interfaces/generators/identifier-name-generators/IIdentifierNameGenerator'; +import { IIdentifierNamesGenerator } from '../../../../interfaces/generators/identifier-names-generators/IIdentifierNamesGenerator'; import { IIdentifierObfuscatingReplacer } from '../../../../interfaces/node-transformers/obfuscating-transformers/obfuscating-replacers/IIdentifierObfuscatingReplacer'; import { IOptions } from '../../../../interfaces/options/IOptions'; @@ -15,9 +15,9 @@ import { Nodes } from '../../../../node/Nodes'; @injectable() export class BaseIdentifierObfuscatingReplacer extends AbstractObfuscatingReplacer implements IIdentifierObfuscatingReplacer { /** - * @type {IIdentifierNameGenerator} + * @type {IIdentifierNamesGenerator} */ - private readonly identifierNameGenerator: IIdentifierNameGenerator; + private readonly identifierNamesGenerator: IIdentifierNamesGenerator; /** * @type {Map} @@ -25,17 +25,17 @@ export class BaseIdentifierObfuscatingReplacer extends AbstractObfuscatingReplac private readonly namesMap: Map = new Map(); /** - * @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory + * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory * @param {IOptions} options */ constructor ( - @inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator) - identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory, + @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator) + identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, @inject(ServiceIdentifiers.IOptions) options: IOptions ) { super(options); - this.identifierNameGenerator = identifierNameGeneratorFactory(options); + this.identifierNamesGenerator = identifierNamesGeneratorFactory(options); } /** @@ -65,7 +65,7 @@ export class BaseIdentifierObfuscatingReplacer extends AbstractObfuscatingReplac return; } - this.namesMap.set(`${nodeName}-${String(nodeIdentifier)}`, this.identifierNameGenerator.generate(6)); + this.namesMap.set(`${nodeName}-${String(nodeIdentifier)}`, this.identifierNamesGenerator.generate(6)); } /** diff --git a/src/options/Options.ts b/src/options/Options.ts index 7cb651d0..963c2569 100644 --- a/src/options/Options.ts +++ b/src/options/Options.ts @@ -21,6 +21,7 @@ import { TStringArrayEncoding } from '../types/options/TStringArrayEncoding'; import { IOptions } from '../interfaces/options/IOptions'; +import { IdentifierNamesGenerator } from '../enums/generators/identifier-names-generators/IdentifierNamesGenerator'; import { ObfuscationTarget } from '../enums/ObfuscationTarget'; import { SourceMapMode } from '../enums/source-map/SourceMapMode'; import { StringArrayEncoding } from '../enums/StringArrayEncoding'; @@ -102,16 +103,19 @@ export class Options implements IOptions { public readonly domainLock: string[]; /** - * @type {boolean} + * @type {IdentifierNamesGenerator} */ - @IsBoolean() - public readonly log: boolean; + @IsIn([ + IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator, + IdentifierNamesGenerator.MangledIdentifierNamesGenerator + ]) + public readonly identifierNamesGenerator: IdentifierNamesGenerator; /** * @type {boolean} */ @IsBoolean() - public readonly mangle: boolean; + public readonly log: boolean; /** * @type {boolean} diff --git a/src/options/presets/Default.ts b/src/options/presets/Default.ts index d751bc49..6b2990f0 100644 --- a/src/options/presets/Default.ts +++ b/src/options/presets/Default.ts @@ -1,5 +1,6 @@ import { TInputOptions } from '../../types/options/TInputOptions'; +import { IdentifierNamesGenerator } from '../../enums/generators/identifier-names-generators/IdentifierNamesGenerator'; import { ObfuscationTarget } from '../../enums/ObfuscationTarget'; import { SourceMapMode } from '../../enums/source-map/SourceMapMode'; @@ -14,8 +15,8 @@ export const DEFAULT_PRESET: TInputOptions = Object.freeze({ debugProtectionInterval: false, disableConsoleOutput: false, domainLock: [], + identifierNamesGenerator: IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator, log: false, - mangle: false, renameGlobals: false, reservedNames: [], rotateStringArray: true, diff --git a/src/options/presets/NoCustomNodes.ts b/src/options/presets/NoCustomNodes.ts index 16de718c..d5d6c8b4 100644 --- a/src/options/presets/NoCustomNodes.ts +++ b/src/options/presets/NoCustomNodes.ts @@ -1,5 +1,6 @@ import { TInputOptions } from '../../types/options/TInputOptions'; +import { IdentifierNamesGenerator } from '../../enums/generators/identifier-names-generators/IdentifierNamesGenerator'; import { ObfuscationTarget } from '../../enums/ObfuscationTarget'; import { SourceMapMode } from '../../enums/source-map/SourceMapMode'; @@ -13,8 +14,8 @@ export const NO_CUSTOM_NODES_PRESET: TInputOptions = Object.freeze({ debugProtectionInterval: false, disableConsoleOutput: false, domainLock: [], + identifierNamesGenerator: IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator, log: false, - mangle: false, renameGlobals: false, reservedNames: [], rotateStringArray: false, diff --git a/src/storages/string-array/StringArrayStorage.ts b/src/storages/string-array/StringArrayStorage.ts index 58cbe8c4..45f26bf5 100644 --- a/src/storages/string-array/StringArrayStorage.ts +++ b/src/storages/string-array/StringArrayStorage.ts @@ -4,8 +4,8 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import { IArrayUtils } from '../../interfaces/utils/IArrayUtils'; import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator'; -import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory'; -import { IIdentifierNameGenerator } from '../../interfaces/generators/identifier-name-generators/IIdentifierNameGenerator'; +import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory'; +import { IIdentifierNamesGenerator } from '../../interfaces/generators/identifier-names-generators/IIdentifierNamesGenerator'; import { IOptions } from '../../interfaces/options/IOptions'; import { ArrayStorage } from '../ArrayStorage'; @@ -18,26 +18,26 @@ export class StringArrayStorage extends ArrayStorage { private readonly arrayUtils: IArrayUtils; /** - * @type {IIdentifierNameGenerator} + * @type {IIdentifierNamesGenerator} */ - private readonly identifierNameGenerator: IIdentifierNameGenerator; + private readonly identifierNamesGenerator: IIdentifierNamesGenerator; /** - * @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory + * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory * @param {IArrayUtils} arrayUtils * @param {IRandomGenerator} randomGenerator * @param {IOptions} options */ constructor ( - @inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator) - identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory, + @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator) + identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory, @inject(ServiceIdentifiers.IArrayUtils) arrayUtils: IArrayUtils, @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @inject(ServiceIdentifiers.IOptions) options: IOptions ) { super(randomGenerator, options); - this.identifierNameGenerator = identifierNameGeneratorFactory(options); + this.identifierNamesGenerator = identifierNamesGeneratorFactory(options); this.arrayUtils = arrayUtils; } @@ -45,8 +45,8 @@ export class StringArrayStorage extends ArrayStorage { public initialize (): void { super.initialize(); - const stringArrayName: string = this.identifierNameGenerator.generate(4); - const stringArrayCallsWrapperName: string = this.identifierNameGenerator.generate(4); + const stringArrayName: string = this.identifierNamesGenerator.generate(4); + const stringArrayCallsWrapperName: string = this.identifierNamesGenerator.generate(4); this.storageId = `${stringArrayName}|${stringArrayCallsWrapperName}`; } diff --git a/src/types/container/generators/TIdentifierNameGeneratorFactory.d.ts b/src/types/container/generators/TIdentifierNameGeneratorFactory.d.ts deleted file mode 100644 index f92d023d..00000000 --- a/src/types/container/generators/TIdentifierNameGeneratorFactory.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { IIdentifierNameGenerator } from '../../../interfaces/generators/identifier-name-generators/IIdentifierNameGenerator'; -import { IOptions } from '../../../interfaces/options/IOptions'; - -export type TIdentifierNameGeneratorFactory = (options: IOptions) => IIdentifierNameGenerator; diff --git a/src/types/container/generators/TIdentifierNamesGeneratorFactory.d.ts b/src/types/container/generators/TIdentifierNamesGeneratorFactory.d.ts new file mode 100644 index 00000000..40b723dc --- /dev/null +++ b/src/types/container/generators/TIdentifierNamesGeneratorFactory.d.ts @@ -0,0 +1,4 @@ +import { IIdentifierNamesGenerator } from '../../../interfaces/generators/identifier-names-generators/IIdentifierNamesGenerator'; +import { IOptions } from '../../../interfaces/options/IOptions'; + +export type TIdentifierNamesGeneratorFactory = (options: IOptions) => IIdentifierNamesGenerator; diff --git a/test/dev/dev.ts b/test/dev/dev.ts index c61bf8af..e3556a88 100644 --- a/test/dev/dev.ts +++ b/test/dev/dev.ts @@ -35,7 +35,7 @@ import { NO_CUSTOM_NODES_PRESET } from '../../src/options/presets/NoCustomNodes' { ...NO_CUSTOM_NODES_PRESET, compact: false, - mangle: true + identifierNamesGenerator: 'mangled' } ).getObfuscatedCode(); diff --git a/test/functional-tests/javascript-obfuscator/JavaScriptObfuscator.spec.ts b/test/functional-tests/javascript-obfuscator/JavaScriptObfuscator.spec.ts index 3a54700e..e2edf05e 100644 --- a/test/functional-tests/javascript-obfuscator/JavaScriptObfuscator.spec.ts +++ b/test/functional-tests/javascript-obfuscator/JavaScriptObfuscator.spec.ts @@ -9,6 +9,8 @@ import { JavaScriptObfuscator } from '../../../src/JavaScriptObfuscatorFacade'; import { NO_CUSTOM_NODES_PRESET } from '../../../src/options/presets/NoCustomNodes'; +import { IdentifierNamesGenerator } from '../../../src/enums/generators/identifier-names-generators/IdentifierNamesGenerator'; + import { buildLargeCode } from '../../helpers/buildLargeCode'; import { getRegExpMatch } from '../../helpers/getRegExpMatch'; import { readFileAsString } from '../../helpers/readFileAsString'; @@ -444,7 +446,7 @@ describe('JavaScriptObfuscator', () => { }); }); - describe('mangle', () => { + describe('mangled identifier names generator', () => { const regExp: RegExp = /var *c *= *0x1/; let obfuscatedCode: string; @@ -454,7 +456,7 @@ describe('JavaScriptObfuscator', () => { const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate( code, { - mangle: true + identifierNamesGenerator: IdentifierNamesGenerator.MangledIdentifierNamesGenerator } ); diff --git a/test/index.spec.ts b/test/index.spec.ts index 09672fdc..32b660aa 100644 --- a/test/index.spec.ts +++ b/test/index.spec.ts @@ -14,8 +14,8 @@ import './unit-tests/cli/sanitizers/StringArrayEncodingSanitizer.spec'; import './unit-tests/cli/utils/CLIUtils.spec'; import './unit-tests/cli/utils/SourceCodeReader.spec'; import './unit-tests/decorators/initializable/Initializable.spec'; -import './unit-tests/generators/identifier-name-generators/HexadecimalIdentifierNameGenerator.spec'; -import './unit-tests/generators/identifier-name-generators/MangledlIdentifierNameGenerator.spec'; +import './unit-tests/generators/identifier-names-generators/HexadecimalIdentifierNamesGenerator.spec'; +import './unit-tests/generators/identifier-names-generators/MangledlIdentifierNamesGenerator.spec'; import './unit-tests/javascript-obfuscator/JavaScriptObfuscator.spec'; import './unit-tests/logger/Logger.spec'; import './unit-tests/node/node-appender/NodeAppender.spec'; diff --git a/test/unit-tests/generators/identifier-name-generators/HexadecimalIdentifierNameGenerator.spec.ts b/test/unit-tests/generators/identifier-names-generators/HexadecimalIdentifierNamesGenerator.spec.ts similarity index 62% rename from test/unit-tests/generators/identifier-name-generators/HexadecimalIdentifierNameGenerator.spec.ts rename to test/unit-tests/generators/identifier-names-generators/HexadecimalIdentifierNamesGenerator.spec.ts index 8308177e..1106b1e7 100644 --- a/test/unit-tests/generators/identifier-name-generators/HexadecimalIdentifierNameGenerator.spec.ts +++ b/test/unit-tests/generators/identifier-names-generators/HexadecimalIdentifierNamesGenerator.spec.ts @@ -4,16 +4,16 @@ import { assert } from 'chai'; import { ServiceIdentifiers } from '../../../../src/container/ServiceIdentifiers'; -import { IIdentifierNameGenerator } from '../../../../src/interfaces/generators/identifier-name-generators/IIdentifierNameGenerator'; +import { IIdentifierNamesGenerator } from '../../../../src/interfaces/generators/identifier-names-generators/IIdentifierNamesGenerator'; import { IInversifyContainerFacade } from '../../../../src/interfaces/container/IInversifyContainerFacade'; -import { IdentifierNameGenerator } from '../../../../src/enums/generators/identifier-name-generators/IdentifierNameGenerator'; +import { IdentifierNamesGenerator } from '../../../../src/enums/generators/identifier-names-generators/IdentifierNamesGenerator'; import { InversifyContainerFacade } from '../../../../src/container/InversifyContainerFacade'; -describe('HexadecimalIdentifierNameGenerator', () => { +describe('HexadecimalIdentifierNamesGenerator', () => { describe('generate (length: number): string', () => { - let identifierNameGenerator: IIdentifierNameGenerator, + let identifierNamesGenerator: IIdentifierNamesGenerator, hexadecimalIdentifierName: string, regExp: RegExp; @@ -21,15 +21,15 @@ describe('HexadecimalIdentifierNameGenerator', () => { const inversifyContainerFacade: IInversifyContainerFacade = new InversifyContainerFacade(); inversifyContainerFacade.load('', {}); - identifierNameGenerator = inversifyContainerFacade.getNamed( - ServiceIdentifiers.IIdentifierNameGenerator, - IdentifierNameGenerator.HexadecimalIdentifierNameGenerator + identifierNamesGenerator = inversifyContainerFacade.getNamed( + ServiceIdentifiers.IIdentifierNamesGenerator, + IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator ) }); describe('variant #1: hexadecimal name with length `4`', () => { before(() => { - hexadecimalIdentifierName = identifierNameGenerator.generate(4); + hexadecimalIdentifierName = identifierNamesGenerator.generate(4); regExp = /^_0x(\w){4}$/; }); @@ -40,7 +40,7 @@ describe('HexadecimalIdentifierNameGenerator', () => { describe('variant #2: hexadecimal name with length `6`', () => { before(() => { - hexadecimalIdentifierName = identifierNameGenerator.generate(6); + hexadecimalIdentifierName = identifierNamesGenerator.generate(6); regExp = /^_0x(\w){4,6}$/; }); diff --git a/test/unit-tests/generators/identifier-name-generators/MangledlIdentifierNameGenerator.spec.ts b/test/unit-tests/generators/identifier-names-generators/MangledlIdentifierNamesGenerator.spec.ts similarity index 72% rename from test/unit-tests/generators/identifier-name-generators/MangledlIdentifierNameGenerator.spec.ts rename to test/unit-tests/generators/identifier-names-generators/MangledlIdentifierNamesGenerator.spec.ts index a6352fda..876fed90 100644 --- a/test/unit-tests/generators/identifier-name-generators/MangledlIdentifierNameGenerator.spec.ts +++ b/test/unit-tests/generators/identifier-names-generators/MangledlIdentifierNamesGenerator.spec.ts @@ -4,25 +4,25 @@ import { assert } from 'chai'; import { ServiceIdentifiers } from '../../../../src/container/ServiceIdentifiers'; -import { IIdentifierNameGenerator } from '../../../../src/interfaces/generators/identifier-name-generators/IIdentifierNameGenerator'; +import { IIdentifierNamesGenerator } from '../../../../src/interfaces/generators/identifier-names-generators/IIdentifierNamesGenerator'; import { IInversifyContainerFacade } from '../../../../src/interfaces/container/IInversifyContainerFacade'; -import { IdentifierNameGenerator } from '../../../../src/enums/generators/identifier-name-generators/IdentifierNameGenerator'; +import { IdentifierNamesGenerator } from '../../../../src/enums/generators/identifier-names-generators/IdentifierNamesGenerator'; import { InversifyContainerFacade } from '../../../../src/container/InversifyContainerFacade'; -describe('MangledIdentifierNameGenerator', () => { +describe('MangledIdentifierNamesGenerator', () => { describe('generate (length: number): string', () => { - let identifierNameGenerator: IIdentifierNameGenerator, + let identifierNamesGenerator: IIdentifierNamesGenerator, mangledIdentifierName: string; before(() => { const inversifyContainerFacade: IInversifyContainerFacade = new InversifyContainerFacade(); inversifyContainerFacade.load('', {}); - identifierNameGenerator = inversifyContainerFacade.getNamed( - ServiceIdentifiers.IIdentifierNameGenerator, - IdentifierNameGenerator.MangledIdentifierNameGenerator + identifierNamesGenerator = inversifyContainerFacade.getNamed( + ServiceIdentifiers.IIdentifierNamesGenerator, + IdentifierNamesGenerator.MangledIdentifierNamesGenerator ) }); @@ -30,7 +30,7 @@ describe('MangledIdentifierNameGenerator', () => { const expectedMangledIdentifierName: string = 'a'; before(() => { - mangledIdentifierName = identifierNameGenerator.generate(4); + mangledIdentifierName = identifierNamesGenerator.generate(4); }); it('should return hexadecimal name', () => { @@ -42,7 +42,7 @@ describe('MangledIdentifierNameGenerator', () => { const expectedMangledIdentifierName: string = 'b'; before(() => { - mangledIdentifierName = identifierNameGenerator.generate(6); + mangledIdentifierName = identifierNamesGenerator.generate(6); }); it('should return hexadecimal name', () => { @@ -55,7 +55,7 @@ describe('MangledIdentifierNameGenerator', () => { before(() => { for (let i: number = 0; i <= 49; i++) { - mangledIdentifierName = identifierNameGenerator.generate(6); + mangledIdentifierName = identifierNamesGenerator.generate(6); } }); @@ -69,7 +69,7 @@ describe('MangledIdentifierNameGenerator', () => { before(() => { for (let i: number = 0; i < 1; i++) { - mangledIdentifierName = identifierNameGenerator.generate(6); + mangledIdentifierName = identifierNamesGenerator.generate(6); } }); @@ -83,7 +83,7 @@ describe('MangledIdentifierNameGenerator', () => { before(() => { for (let i: number = 0; i < 10; i++) { - mangledIdentifierName = identifierNameGenerator.generate(6); + mangledIdentifierName = identifierNamesGenerator.generate(6); } }); diff --git a/yarn.lock b/yarn.lock index 27b383cf..0a1275dc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,19 +2,19 @@ # yarn lockfile v1 -"@types/chai@4.0.6": - version "4.0.6" - resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.0.6.tgz#9cb5a7fb7dd83be0cfcaafdbd95a2b5dd351762f" +"@types/chai@4.0.7": + version "4.0.7" + resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.0.7.tgz#cab25b9fcb45903fe6c7fa716dc6394314c13dd8" "@types/chance@0.7.35": version "0.7.35" resolved "https://registry.yarnpkg.com/@types/chance/-/chance-0.7.35.tgz#e76f3441b7763476c58eb7dc32f62da3d8ea547e" -"@types/commander@2.11.0": - version "2.11.0" - resolved "https://registry.yarnpkg.com/@types/commander/-/commander-2.11.0.tgz#7fc765ccad14827e2babd6a99583359ff3e40563" +"@types/commander@2.12.2": + version "2.12.2" + resolved "https://registry.yarnpkg.com/@types/commander/-/commander-2.12.2.tgz#183041a23842d4281478fa5d23c5ca78e6fd08ae" dependencies: - "@types/node" "*" + commander "*" "@types/escodegen@0.0.6": version "0.0.6" @@ -36,15 +36,19 @@ version "0.0.38" resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.38.tgz#c1be40aa933723c608820a99a373a16d215a1ca2" +"@types/events@*": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@types/events/-/events-1.1.0.tgz#93b1be91f63c184450385272c47b6496fd028e02" + "@types/md5@2.1.32": version "2.1.32" resolved "https://registry.yarnpkg.com/@types/md5/-/md5-2.1.32.tgz#93e23437fcd17a7b9ca98d02aa6002e835842fe8" dependencies: "@types/node" "*" -"@types/mkdirp@0.5.1": - version "0.5.1" - resolved "https://registry.yarnpkg.com/@types/mkdirp/-/mkdirp-0.5.1.tgz#ea887cd024f691c1ca67cce20b7606b053e43b0f" +"@types/mkdirp@0.5.2": + version "0.5.2" + resolved "https://registry.yarnpkg.com/@types/mkdirp/-/mkdirp-0.5.2.tgz#503aacfe5cc2703d5484326b1b27efa67a339c1f" dependencies: "@types/node" "*" @@ -52,10 +56,16 @@ version "2.2.44" resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-2.2.44.tgz#1d4a798e53f35212fd5ad4d04050620171cd5b5e" -"@types/node@*", "@types/node@8.0.53": +"@types/node@*": version "8.0.53" resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.53.tgz#396b35af826fa66aad472c8cb7b8d5e277f4e6d8" +"@types/node@8.0.54": + version "8.0.54" + resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.54.tgz#3fd9357db4af388b79e03845340259440edffde6" + dependencies: + "@types/events" "*" + "@types/sinon@4.0.0": version "4.0.0" resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-4.0.0.tgz#9a93ffa4ee1329e85166278a5ed99f81dc4c8362" @@ -1054,14 +1064,14 @@ combined-stream@^1.0.5, combined-stream@~1.0.5: dependencies: delayed-stream "~1.0.0" +commander@*, commander@2.12.2, commander@^2.11.0, commander@^2.9.0: + version "2.12.2" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.12.2.tgz#0f5946c427ed9ec0d91a46bb9def53e54650e555" + commander@2.11.0: version "2.11.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563" -commander@2.12.2, commander@^2.11.0, commander@^2.9.0: - version "2.12.2" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.12.2.tgz#0f5946c427ed9ec0d91a46bb9def53e54650e555" - commondir@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" @@ -3670,9 +3680,9 @@ tslint-eslint-rules@4.1.1: tslib "^1.0.0" tsutils "^1.4.0" -tslint-language-service@0.9.6: - version "0.9.6" - resolved "https://registry.yarnpkg.com/tslint-language-service/-/tslint-language-service-0.9.6.tgz#882bb0704cf8397b332ddc0af7168c7f22f279ea" +tslint-language-service@0.9.7: + version "0.9.7" + resolved "https://registry.yarnpkg.com/tslint-language-service/-/tslint-language-service-0.9.7.tgz#94a35442bc1163e4629df8804e6fa694ced549ff" tslint-webpack-plugin@1.0.0: version "1.0.0" @@ -3872,9 +3882,9 @@ webpack-sources@^1.0.1: source-list-map "^2.0.0" source-map "~0.5.3" -webpack@3.9.1: - version "3.9.1" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-3.9.1.tgz#9a60aa544ed5d4d454c069e3f521aa007e02643c" +webpack@3.10.0: + version "3.10.0" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-3.10.0.tgz#5291b875078cf2abf42bdd23afe3f8f96c17d725" dependencies: acorn "^5.0.0" acorn-dynamic-import "^2.0.0"