From e1964b2ee2c5f4dd7ffdb8b48c08fe7cd16bbce5 Mon Sep 17 00:00:00 2001 From: sanex3339 Date: Fri, 10 Nov 2017 01:41:07 +0300 Subject: [PATCH] 0.12.2 release --- CHANGELOG.md | 4 ++ dist/index.js | 2 +- package.json | 10 +-- src/cli/utils/CLIUtils.ts | 4 +- .../FunctionTransformer.ts | 29 ++++++++- src/node/NodeGuards.ts | 4 +- .../FunctionTransformer.spec.ts | 63 ++++++++++++++----- ...er.js => object-pattern-as-parameter-1.js} | 0 .../fixtures/object-pattern-as-parameter-2.js | 8 +++ yarn.lock | 36 ++++++----- 10 files changed, 117 insertions(+), 43 deletions(-) rename test/functional-tests/node-transformers/obfuscating-transformers/function-transformer/fixtures/{object-pattern-as-parameter.js => object-pattern-as-parameter-1.js} (100%) create mode 100644 test/functional-tests/node-transformers/obfuscating-transformers/function-transformer/fixtures/object-pattern-as-parameter-2.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 28998d41..5cfcbf28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ Change Log === +v0.12.2 +--- +* Fixed https://github.com/javascript-obfuscator/javascript-obfuscator/issues/119 + v0.12.1 --- * Fixed https://github.com/javascript-obfuscator/javascript-obfuscator/issues/117 diff --git a/dist/index.js b/dist/index.js index 0269a524..b5b956ef 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=44)}([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__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.IDeadCodeInjectionReplacer="IDeadCodeInjectionReplacer",e.IEscapeSequenceEncoder="IEscapeSequenceEncoder",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.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.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;n-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;r1&&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";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";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,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]:p.randomGeneratorPool;return this.getRandomGenerator().string({length:e,pool:t})}},{key:"getRandomVariableName",value:function(e){var t="_"+f.Utils.hexadecimalPrefix,r=this.getRandomInteger(1e4,99999999),n=f.Utils.decToHex(r),o=""+t+n.substr(0,e);return this.randomVariableNameSet.has(o)?this.getRandomVariableName(e):(this.randomVariableNameSet.add(o),o)}},{key:"getSeed",value:function(){return this.seed}}]),e}();d.randomGeneratorPool="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",d.randomGeneratorPoolNumbers="0123456789",d.randomGeneratorPoolHexadecimal="abcdef"+p.randomGeneratorPoolNumbers,a.__decorate([l.initializable(),a.__metadata("design:type",Object)],d.prototype,"randomGenerator",void 0),a.__decorate([l.initializable(),a.__metadata("design:type",Number)],d.prototype,"seed",void 0),a.__decorate([i.postConstruct(),a.__metadata("design:type",Function),a.__metadata("design:paramtypes",[]),a.__metadata("design:returntype",void 0)],d.prototype,"initialize",null),d=p=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])],d),t.RandomGenerator=d;var p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(13),o=r(23);t.DEFAULT_PRESET=Object.freeze({compact:!0,config:"",controlFlowFlattening:!1,controlFlowFlatteningThreshold:.75,deadCodeInjection:!1,deadCodeInjectionThreshold:.4,debugProtection:!1,debugProtectionInterval:!1,disableConsoleOutput:!1,domainLock:[],log:!1,mangle:!1,renameGlobals:!1,reservedNames:[],rotateStringArray:!0,seed:0,selfDefending:!1,sourceMap:!1,sourceMapBaseUrl:"",sourceMapFileName:"",sourceMapMode:o.SourceMapMode.Separate,stringArray:!0,stringArrayEncoding:!1,stringArrayThreshold:.75,target:n.ObfuscationTarget.Browser,unicodeEscapeSequence:!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;r [options]").version(m.CLIUtils.getPackageConfig().version,"-v, --version").option("-o, --output ","Output path for obfuscated code").option("--compact ","Disable one line output code compacting",f.BooleanSanitizer).option("--config ","Name of js / json config file").option("--controlFlowFlattening ","Enables control flow flattening",f.BooleanSanitizer).option("--controlFlowFlatteningThreshold ","The probability that the control flow flattening transformation will be applied to the node",parseFloat).option("--deadCodeInjection ","Enables dead code injection",f.BooleanSanitizer).option("--deadCodeInjectionThreshold ","The probability that the dead code injection transformation will be applied to the node",parseFloat).option("--debugProtection ","Disable browser Debug panel (can cause DevTools enabled browser freeze)",f.BooleanSanitizer).option("--debugProtectionInterval ","Disable browser Debug panel even after page was loaded (can cause DevTools enabled browser freeze)",f.BooleanSanitizer).option("--disableConsoleOutput ","Allow console.log, console.info, console.error and console.warn messages output into browser console",f.BooleanSanitizer).option("--domainLock (comma separated, without whitespaces)","Blocks the execution of the code in domains that do not match the passed RegExp patterns (comma separated)",l.ArraySanitizer).option("--log ","Enables logging of the information to the console",f.BooleanSanitizer).option("--mangle ","Enables mangling of variable names",f.BooleanSanitizer).option("--reservedNames (comma separated, without whitespaces)","Disable obfuscation of variable names, function names and names of function parameters that match the passed RegExp patterns (comma separated)",l.ArraySanitizer).option("--renameGlobals ","Allows to enable obfuscation of global variable and function names with declaration.",f.BooleanSanitizer).option("--rotateStringArray ","Disable rotation of unicode array values during obfuscation",f.BooleanSanitizer).option("--seed ","Sets seed for random generator. This is useful for creating repeatable results.",parseFloat).option("--selfDefending ","Disables self-defending for obfuscated code",f.BooleanSanitizer).option("--sourceMap ","Enables source map generation",f.BooleanSanitizer).option("--sourceMapBaseUrl ","Sets base url to the source map import url when `--sourceMapMode=separate`").option("--sourceMapFileName ","Sets file name for output source map when `--sourceMapMode=separate`").option("--sourceMapMode [inline, separate]","Specify source map output mode",p.SourceMapModeSanitizer).option("--stringArray ","Disables gathering of all literal strings into an array and replacing every literal string with an array call",f.BooleanSanitizer).option("--stringArrayEncoding [true, false, base64, rc4]","Encodes all strings in strings array using base64 or rc4 (this option can slow down your code speed",y.StringArrayEncodingSanitizer).option("--stringArrayThreshold ","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.",d.ObfuscationTargetSanitizer).option("--unicodeEscapeSequence ","Allows to enable/disable string conversion to unicode escape sequence",f.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 --selfDefending false"),console.log(" %> javascript-obfuscator input_file_name.js --output output_file_name.js --compact true --selfDefending false"),console.log(" %> javascript-obfuscator input_directory_name --compact true --selfDefending 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=m.CLIUtils.getOutputCodePath(r);t.processSourceCode(n,o)});else{var r=this.inputCLIOptions.output||m.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=b.JavaScriptObfuscator.obfuscate(e,r).getObfuscatedCode();m.CLIUtils.writeFile(t,n)}},{key:"processSourceCodeWithSourceMap",value:function(e,t,r){var n=m.CLIUtils.getOutputSourceMapPath(t,r.sourceMapFileName||"");r=Object.assign({},r,{sourceMapFileName:c.basename(n)});var o=b.JavaScriptObfuscator.obfuscate(e,r);m.CLIUtils.writeFile(t,o.getObfuscatedCode()),"separate"===r.sourceMapMode&&o.getSourceMap()&&m.CLIUtils.writeFile(n,o.getSourceMap())}}]),e}();h.availableInputExtensions=[".js"],h.encoding="utf8",h.obfuscatedFilePrefix="-obfuscated",a.__decorate([s.initializable(),a.__metadata("design:type",Object)],h.prototype,"commands",void 0),a.__decorate([s.initializable(),a.__metadata("design:type",Object)],h.prototype,"inputCLIOptions",void 0),a.__decorate([s.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.__metadata("design:paramtypes",[Object])],f),t.MapStorage=f},function(e,t){e.exports=require("fs")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(18);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(47),s=r(48),u=r(49),l=r(50);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(21),s=r(52),u=r(53),l=r(54),f=r(55),d=r(56),p=r(57),y=r(58);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(b.NodeUtils.getBlockScopesOfNode(e)[0].type===d.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=this,n=b.NodeUtils.clone(e),o=0,a=!0;f.replace(n,{enter:function(e,t){return y.NodeGuards.isBlockStatementNode(e)&&o++,o>h.maxNestedBlockStatementsCount||y.NodeGuards.isBreakStatementNode(e)||y.NodeGuards.isContinueStatementNode(e)?(a=!1,f.VisitorOption.Break):(y.NodeGuards.isIdentifierNode(e)&&t&&!y.NodeGuards.isMemberExpressionNode(t)&&(e.name=r.randomGenerator.getRandomVariableName(6)),e)}}),a&&t.push(n)}},{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=m.Nodes.getBlockStatementNode([m.Nodes.getIfStatementNode(m.Nodes.getBinaryExpressionNode(o,m.Nodes.getLiteralNode(a),m.Nodes.getLiteralNode(c)),l,f)]);return d=b.NodeUtils.parentize(d)}}]),t}(p.AbstractNodeTransformer);g.maxNestedBlockStatementsCount=4,g.minCollectedBlockStatementsCount=5,g=h=s.__decorate([u.injectable(),s.__param(0,u.inject(l.ServiceIdentifiers.IRandomGenerator)),s.__param(1,u.inject(l.ServiceIdentifiers.IOptions)),s.__metadata("design:paramtypes",[Object,Object])],g),t.DeadCodeInjectionTransformer=g;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;rv.hostNodeSearchMinDepth&&t.splice(0,v.hostNodeSearchMinDepth),t.length>v.hostNodeSearchMaxDepth&&(t.length=v.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(!v.controlFlowReplacersMap.has(e.type))return e;if(r.randomGenerator.getMathRandom()>r.options.controlFlowFlatteningThreshold)return e;var o=v.controlFlowReplacersMap.get(e.type);return void 0===o?e:Object.assign({},r.controlFlowReplacerFactory(o).replace(e,n,t),{parentNode:n})}})}}]),t}(y.AbstractNodeTransformer);h.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]]),h.hostNodeSearchMinDepth=0,h.hostNodeSearchMaxDepth=2,h=v=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])],h),t.FunctionControlFlowTransformer=h;var v},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(64),l=r(65),f=r(66),d=r(67),p=r(68),y=r(70),m=r(73),b=r(74),g=r(75),h=r(76),v=r(77),_=r(79),N=r(81),O=r(83),S=r(87),C=r(89),w=r(90),j=r(91),I=r(93),E=r(95),T=r(102),F=r(104),k=r(107),P=r(108);t.customNodesModule=new o.ContainerModule(function(e){e(a.ServiceIdentifiers.ICustomNode).to(v.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(j.NodeCallsControllerFunctionNode).whenTargetNamed(c.CustomNode.NodeCallsControllerFunctionNode),e(a.ServiceIdentifiers.ICustomNode).to(I.SelfDefendingUnicodeNode).whenTargetNamed(c.CustomNode.SelfDefendingUnicodeNode),e(a.ServiceIdentifiers.ICustomNode).to(E.StringArrayCallsWrapper).whenTargetNamed(c.CustomNode.StringArrayCallsWrapper),e(a.ServiceIdentifiers.ICustomNode).to(T.StringArrayNode).whenTargetNamed(c.CustomNode.StringArrayNode),e(a.ServiceIdentifiers.ICustomNode).to(F.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(h.ControlFlowStorageNode).whenTargetNamed(i.ControlFlowCustomNode.ControlFlowStorageNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(C.ExpressionWithOperatorControlFlowStorageCallNode).whenTargetNamed(i.ControlFlowCustomNode.ExpressionWithOperatorControlFlowStorageCallNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(w.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.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=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=p.Utils.stringRotate(this.stringArrayStorage.getStorageId(),1),c="_"+p.Utils.hexadecimalPrefix+i,s=this.getStringArrayHexadecimalIndex(o,a),u=s.fromCache,l=s.index;u||this.stringArrayStorage.set(a,o);var f=[m.getHexadecimalLiteralNode(l)];return n&&f.push(m.getRc4KeyLiteralNode(this.escapeSequenceEncoder.encode(n,this.options.unicodeEscapeSequence))),d.Nodes.getCallExpressionNode(d.Nodes.getIdentifierNode(c),f)}}],[{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.__metadata("design:paramtypes",[Object])],l),t.ArrayStorage=l},function(e,t){e.exports=require("md5")},function(e,t){e.exports=require("chance")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(1),a=r(136),i=r(137),c=r(138),s=r(31);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:"getPackageConfig",value:function(){return JSON.parse(a.readFileSync(c.join(c.dirname(a.realpathSync(process.argv[1])),"../package.json"),s.JavaScriptObfuscatorCLI.encoding))}},{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=173},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.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.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;n-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;r1&&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";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";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,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]:p.randomGeneratorPool;return this.getRandomGenerator().string({length:e,pool:t})}},{key:"getRandomVariableName",value:function(e){var t="_"+f.Utils.hexadecimalPrefix,r=this.getRandomInteger(1e4,99999999),n=f.Utils.decToHex(r),o=""+t+n.substr(0,e);return this.randomVariableNameSet.has(o)?this.getRandomVariableName(e):(this.randomVariableNameSet.add(o),o)}},{key:"getSeed",value:function(){return this.seed}}]),e}();d.randomGeneratorPool="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",d.randomGeneratorPoolNumbers="0123456789",d.randomGeneratorPoolHexadecimal="abcdef"+p.randomGeneratorPoolNumbers,a.__decorate([l.initializable(),a.__metadata("design:type",Object)],d.prototype,"randomGenerator",void 0),a.__decorate([l.initializable(),a.__metadata("design:type",Number)],d.prototype,"seed",void 0),a.__decorate([i.postConstruct(),a.__metadata("design:type",Function),a.__metadata("design:paramtypes",[]),a.__metadata("design:returntype",void 0)],d.prototype,"initialize",null),d=p=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])],d),t.RandomGenerator=d;var p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(13),o=r(23);t.DEFAULT_PRESET=Object.freeze({compact:!0,config:"",controlFlowFlattening:!1,controlFlowFlatteningThreshold:.75,deadCodeInjection:!1,deadCodeInjectionThreshold:.4,debugProtection:!1,debugProtectionInterval:!1,disableConsoleOutput:!1,domainLock:[],log:!1,mangle:!1,renameGlobals:!1,reservedNames:[],rotateStringArray:!0,seed:0,selfDefending:!1,sourceMap:!1,sourceMapBaseUrl:"",sourceMapFileName:"",sourceMapMode:o.SourceMapMode.Separate,stringArray:!0,stringArrayEncoding:!1,stringArrayThreshold:.75,target:n.ObfuscationTarget.Browser,unicodeEscapeSequence:!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;r [options]").version(m.CLIUtils.getPackageConfig().version,"-v, --version").option("-o, --output ","Output path for obfuscated code").option("--compact ","Disable one line output code compacting",f.BooleanSanitizer).option("--config ","Name of js / json config file").option("--controlFlowFlattening ","Enables control flow flattening",f.BooleanSanitizer).option("--controlFlowFlatteningThreshold ","The probability that the control flow flattening transformation will be applied to the node",parseFloat).option("--deadCodeInjection ","Enables dead code injection",f.BooleanSanitizer).option("--deadCodeInjectionThreshold ","The probability that the dead code injection transformation will be applied to the node",parseFloat).option("--debugProtection ","Disable browser Debug panel (can cause DevTools enabled browser freeze)",f.BooleanSanitizer).option("--debugProtectionInterval ","Disable browser Debug panel even after page was loaded (can cause DevTools enabled browser freeze)",f.BooleanSanitizer).option("--disableConsoleOutput ","Allow console.log, console.info, console.error and console.warn messages output into browser console",f.BooleanSanitizer).option("--domainLock (comma separated, without whitespaces)","Blocks the execution of the code in domains that do not match the passed RegExp patterns (comma separated)",l.ArraySanitizer).option("--log ","Enables logging of the information to the console",f.BooleanSanitizer).option("--mangle ","Enables mangling of variable names",f.BooleanSanitizer).option("--reservedNames (comma separated, without whitespaces)","Disable obfuscation of variable names, function names and names of function parameters that match the passed RegExp patterns (comma separated)",l.ArraySanitizer).option("--renameGlobals ","Allows to enable obfuscation of global variable and function names with declaration.",f.BooleanSanitizer).option("--rotateStringArray ","Disable rotation of unicode array values during obfuscation",f.BooleanSanitizer).option("--seed ","Sets seed for random generator. This is useful for creating repeatable results.",parseFloat).option("--selfDefending ","Disables self-defending for obfuscated code",f.BooleanSanitizer).option("--sourceMap ","Enables source map generation",f.BooleanSanitizer).option("--sourceMapBaseUrl ","Sets base url to the source map import url when `--sourceMapMode=separate`").option("--sourceMapFileName ","Sets file name for output source map when `--sourceMapMode=separate`").option("--sourceMapMode [inline, separate]","Specify source map output mode",p.SourceMapModeSanitizer).option("--stringArray ","Disables gathering of all literal strings into an array and replacing every literal string with an array call",f.BooleanSanitizer).option("--stringArrayEncoding [true, false, base64, rc4]","Encodes all strings in strings array using base64 or rc4 (this option can slow down your code speed",y.StringArrayEncodingSanitizer).option("--stringArrayThreshold ","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.",d.ObfuscationTargetSanitizer).option("--unicodeEscapeSequence ","Allows to enable/disable string conversion to unicode escape sequence",f.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 --selfDefending false"),console.log(" %> javascript-obfuscator input_file_name.js --output output_file_name.js --compact true --selfDefending false"),console.log(" %> javascript-obfuscator input_directory_name --compact true --selfDefending 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=m.CLIUtils.getOutputCodePath(r);t.processSourceCode(n,o)});else{var r=this.inputCLIOptions.output||m.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=b.JavaScriptObfuscator.obfuscate(e,r).getObfuscatedCode();m.CLIUtils.writeFile(t,n)}},{key:"processSourceCodeWithSourceMap",value:function(e,t,r){var n=m.CLIUtils.getOutputSourceMapPath(t,r.sourceMapFileName||"");r=Object.assign({},r,{sourceMapFileName:c.basename(n)});var o=b.JavaScriptObfuscator.obfuscate(e,r);m.CLIUtils.writeFile(t,o.getObfuscatedCode()),"separate"===r.sourceMapMode&&o.getSourceMap()&&m.CLIUtils.writeFile(n,o.getSourceMap())}}]),e}();h.availableInputExtensions=[".js"],h.encoding="utf8",h.obfuscatedFilePrefix="-obfuscated",a.__decorate([s.initializable(),a.__metadata("design:type",Object)],h.prototype,"commands",void 0),a.__decorate([s.initializable(),a.__metadata("design:type",Object)],h.prototype,"inputCLIOptions",void 0),a.__decorate([s.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.__metadata("design:paramtypes",[Object])],f),t.MapStorage=f},function(e,t){e.exports=require("fs")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(18);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(47),s=r(48),u=r(49),l=r(50);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(21),s=r(52),u=r(53),l=r(54),f=r(55),d=r(56),p=r(57),y=r(58);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(b.NodeUtils.getBlockScopesOfNode(e)[0].type===d.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=this,n=b.NodeUtils.clone(e),o=0,a=!0;f.replace(n,{enter:function(e,t){return y.NodeGuards.isBlockStatementNode(e)&&o++,o>h.maxNestedBlockStatementsCount||y.NodeGuards.isBreakStatementNode(e)||y.NodeGuards.isContinueStatementNode(e)?(a=!1,f.VisitorOption.Break):(y.NodeGuards.isIdentifierNode(e)&&t&&!y.NodeGuards.isMemberExpressionNode(t)&&(e.name=r.randomGenerator.getRandomVariableName(6)),e)}}),a&&t.push(n)}},{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=m.Nodes.getBlockStatementNode([m.Nodes.getIfStatementNode(m.Nodes.getBinaryExpressionNode(o,m.Nodes.getLiteralNode(a),m.Nodes.getLiteralNode(c)),l,f)]);return d=b.NodeUtils.parentize(d)}}]),t}(p.AbstractNodeTransformer);g.maxNestedBlockStatementsCount=4,g.minCollectedBlockStatementsCount=5,g=h=s.__decorate([u.injectable(),s.__param(0,u.inject(l.ServiceIdentifiers.IRandomGenerator)),s.__param(1,u.inject(l.ServiceIdentifiers.IOptions)),s.__metadata("design:paramtypes",[Object,Object])],g),t.DeadCodeInjectionTransformer=g;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;rv.hostNodeSearchMinDepth&&t.splice(0,v.hostNodeSearchMinDepth),t.length>v.hostNodeSearchMaxDepth&&(t.length=v.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(!v.controlFlowReplacersMap.has(e.type))return e;if(r.randomGenerator.getMathRandom()>r.options.controlFlowFlatteningThreshold)return e;var o=v.controlFlowReplacersMap.get(e.type);return void 0===o?e:Object.assign({},r.controlFlowReplacerFactory(o).replace(e,n,t),{parentNode:n})}})}}]),t}(y.AbstractNodeTransformer);h.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]]),h.hostNodeSearchMinDepth=0,h.hostNodeSearchMaxDepth=2,h=v=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])],h),t.FunctionControlFlowTransformer=h;var v},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(64),l=r(65),f=r(66),d=r(67),p=r(68),y=r(70),m=r(73),b=r(74),g=r(75),h=r(76),v=r(77),_=r(79),N=r(81),O=r(83),S=r(87),C=r(89),w=r(90),j=r(91),I=r(93),E=r(95),T=r(102),F=r(104),k=r(107),P=r(108);t.customNodesModule=new o.ContainerModule(function(e){e(a.ServiceIdentifiers.ICustomNode).to(v.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(j.NodeCallsControllerFunctionNode).whenTargetNamed(c.CustomNode.NodeCallsControllerFunctionNode),e(a.ServiceIdentifiers.ICustomNode).to(I.SelfDefendingUnicodeNode).whenTargetNamed(c.CustomNode.SelfDefendingUnicodeNode),e(a.ServiceIdentifiers.ICustomNode).to(E.StringArrayCallsWrapper).whenTargetNamed(c.CustomNode.StringArrayCallsWrapper),e(a.ServiceIdentifiers.ICustomNode).to(T.StringArrayNode).whenTargetNamed(c.CustomNode.StringArrayNode),e(a.ServiceIdentifiers.ICustomNode).to(F.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(h.ControlFlowStorageNode).whenTargetNamed(i.ControlFlowCustomNode.ControlFlowStorageNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(C.ExpressionWithOperatorControlFlowStorageCallNode).whenTargetNamed(i.ControlFlowCustomNode.ExpressionWithOperatorControlFlowStorageCallNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(w.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.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=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=p.Utils.stringRotate(this.stringArrayStorage.getStorageId(),1),c="_"+p.Utils.hexadecimalPrefix+i,s=this.getStringArrayHexadecimalIndex(o,a),u=s.fromCache,l=s.index;u||this.stringArrayStorage.set(a,o);var f=[m.getHexadecimalLiteralNode(l)];return n&&f.push(m.getRc4KeyLiteralNode(this.escapeSequenceEncoder.encode(n,this.options.unicodeEscapeSequence))),d.Nodes.getCallExpressionNode(d.Nodes.getIdentifierNode(c),f)}}],[{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.__metadata("design:paramtypes",[Object])],l),t.ArrayStorage=l},function(e,t){e.exports=require("md5")},function(e,t){e.exports=require("chance")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(1),a=r(136),i=r(137),c=r(138),s=r(31);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:"getPackageConfig",value:function(){return JSON.parse(a.readFileSync(c.join(c.dirname(a.realpathSync(process.argv[1])),"../package.json"),s.JavaScriptObfuscatorCLI.encoding))}},{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=173},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} ignoredIdentifierNamesSet + */ + private addIdentifiersToIgnoredIdentifierNamesSet ( + properties: ESTree.Property[], + ignoredIdentifierNamesSet: Set + ): void { + properties.forEach((property: ESTree.Property) => { + if (!NodeGuards.isIdentifierNode(property.key)) { + return; + } + + ignoredIdentifierNamesSet.add(property.key.name); + }); + } + /** * @param {Function} functionNode * @param {number} nodeIdentifier */ private replaceFunctionParams (functionNode: ESTree.Function, nodeIdentifier: number): void { + const ignoredIdentifierNamesSet: Set = new Set(); + const replaceVisitor: estraverse.Visitor = { enter: (node: ESTree.Node, parentNode: ESTree.Node | null): any => { - if (parentNode && NodeGuards.isReplaceableIdentifierNode(node, parentNode)) { + if (NodeGuards.isObjectPatternNode(node)) { + this.addIdentifiersToIgnoredIdentifierNamesSet(node.properties, ignoredIdentifierNamesSet); + } + + if ( + parentNode && + NodeGuards.isReplaceableIdentifierNode(node, parentNode) && + !ignoredIdentifierNamesSet.has(node.name) + ) { const newIdentifier: ESTree.Identifier = this.identifierObfuscatingReplacer.replace(node.name, nodeIdentifier); const newIdentifierName: string = newIdentifier.name; diff --git a/src/node/NodeGuards.ts b/src/node/NodeGuards.ts index 206d99ce..3497a5b1 100644 --- a/src/node/NodeGuards.ts +++ b/src/node/NodeGuards.ts @@ -221,7 +221,9 @@ export class NodeGuards { parentNode.property === node ); - return !parentNodeIsPropertyNode && !parentNodeIsMemberExpressionNode && !NodeGuards.isLabelIdentifierNode(node, parentNode); + return !parentNodeIsPropertyNode && + !parentNodeIsMemberExpressionNode && + !NodeGuards.isLabelIdentifierNode(node, parentNode); } /** diff --git a/test/functional-tests/node-transformers/obfuscating-transformers/function-transformer/FunctionTransformer.spec.ts b/test/functional-tests/node-transformers/obfuscating-transformers/function-transformer/FunctionTransformer.spec.ts index 834a3e6f..38816c8d 100644 --- a/test/functional-tests/node-transformers/obfuscating-transformers/function-transformer/FunctionTransformer.spec.ts +++ b/test/functional-tests/node-transformers/obfuscating-transformers/function-transformer/FunctionTransformer.spec.ts @@ -49,29 +49,58 @@ describe('FunctionTransformer', () => { }); describe('object pattern as parameter', () => { - const functionParameterRegExp: RegExp = /function *\(\{ *bar *\}\) *\{/; - const functionBodyRegExp: RegExp = /return *bar;/; + describe('variant #1: simple', () => { + const functionParameterRegExp: RegExp = /function *\(\{ *bar *\}\) *\{/; + const functionBodyRegExp: RegExp = /return *bar;/; - let obfuscatedCode: string; + let obfuscatedCode: string; - before(() => { - const code: string = readFileAsString(__dirname + '/fixtures/object-pattern-as-parameter.js'); - const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate( - code, - { - ...NO_CUSTOM_NODES_PRESET - } - ); + before(() => { + const code: string = readFileAsString(__dirname + '/fixtures/object-pattern-as-parameter-1.js'); + const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate( + code, + { + ...NO_CUSTOM_NODES_PRESET + } + ); - obfuscatedCode = obfuscationResult.getObfuscatedCode(); + obfuscatedCode = obfuscationResult.getObfuscatedCode(); + }); + + it('match #1: shouldn\'t transform function parameter object pattern identifier', () => { + assert.match(obfuscatedCode, functionParameterRegExp); + }); + + it('match #2: shouldn\'t transform function parameter object pattern identifier', () => { + assert.match(obfuscatedCode, functionBodyRegExp); + }); }); - it('match #1: shouldn\'t transform function parameter object pattern identifier', () => { - assert.match(obfuscatedCode, functionParameterRegExp); - }); + describe('variant #2: correct transformation when identifier with same name in parent scope exist', () => { + const callbackParameterRegExp: RegExp = /\['then'] *\(\({ *data *}\)/; + const callbackBodyRegExp: RegExp = /console\['log']\(data\)/; - it('match #2: shouldn\'t transform function parameter object pattern identifier', () => { - assert.match(obfuscatedCode, functionBodyRegExp); + let obfuscatedCode: string; + + before(() => { + const code: string = readFileAsString(__dirname + '/fixtures/object-pattern-as-parameter-2.js'); + const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate( + code, + { + ...NO_CUSTOM_NODES_PRESET + } + ); + + obfuscatedCode = obfuscationResult.getObfuscatedCode(); + }); + + it('match #1: shouldn\'t transform callback parameter object pattern identifier', () => { + assert.match(obfuscatedCode, callbackParameterRegExp); + }); + + it('match #2: shouldn\'t transform callback parameter object pattern identifier', () => { + assert.match(obfuscatedCode, callbackBodyRegExp); + }); }); }); diff --git a/test/functional-tests/node-transformers/obfuscating-transformers/function-transformer/fixtures/object-pattern-as-parameter.js b/test/functional-tests/node-transformers/obfuscating-transformers/function-transformer/fixtures/object-pattern-as-parameter-1.js similarity index 100% rename from test/functional-tests/node-transformers/obfuscating-transformers/function-transformer/fixtures/object-pattern-as-parameter.js rename to test/functional-tests/node-transformers/obfuscating-transformers/function-transformer/fixtures/object-pattern-as-parameter-1.js diff --git a/test/functional-tests/node-transformers/obfuscating-transformers/function-transformer/fixtures/object-pattern-as-parameter-2.js b/test/functional-tests/node-transformers/obfuscating-transformers/function-transformer/fixtures/object-pattern-as-parameter-2.js new file mode 100644 index 00000000..de39f766 --- /dev/null +++ b/test/functional-tests/node-transformers/obfuscating-transformers/function-transformer/fixtures/object-pattern-as-parameter-2.js @@ -0,0 +1,8 @@ +(function(){ + function foo (data) { + new Promise((resolve) => resolve({data: data})) + .then(({data}) => console.log(data)); + } + + foo(1); +})(); \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index ca5ac28f..dc3d49c3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -52,10 +52,14 @@ version "2.2.44" resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-2.2.44.tgz#1d4a798e53f35212fd5ad4d04050620171cd5b5e" -"@types/node@*", "@types/node@8.0.47": +"@types/node@*": version "8.0.47" resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.47.tgz#968e596f91acd59069054558a00708c445ca30c2" +"@types/node@8.0.50": + version "8.0.50" + resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.50.tgz#dc545448e128c88c4eec7cd64025fcc3b7604541" + "@types/sinon@2.3.7": version "2.3.7" resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-2.3.7.tgz#e92c2fed3297eae078d78d1da032b26788b4af86" @@ -1413,9 +1417,9 @@ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1 version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" -escodegen-wallaby@1.6.12: - version "1.6.12" - resolved "https://registry.yarnpkg.com/escodegen-wallaby/-/escodegen-wallaby-1.6.12.tgz#dac2ed380daca6c7a2c9e8496d50c091239fe26f" +escodegen-wallaby@1.6.14: + version "1.6.14" + resolved "https://registry.yarnpkg.com/escodegen-wallaby/-/escodegen-wallaby-1.6.14.tgz#41a0a7a2a2bd776207d25b4d2f373f12853de23f" dependencies: esprima "^2.7.1" estraverse "^1.9.1" @@ -2037,9 +2041,9 @@ invariant@^2.2.2: dependencies: loose-envify "^1.0.0" -inversify@4.5.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/inversify/-/inversify-4.5.0.tgz#1a575ddf1db216ed3292d9b0f70f497de275874e" +inversify@4.5.1: + version "4.5.1" + resolved "https://registry.yarnpkg.com/inversify/-/inversify-4.5.1.tgz#2f8a249e1fc5346e4f28b4b86dfae5af1b673178" invert-kv@^1.0.0: version "1.0.0" @@ -2300,14 +2304,14 @@ js-tokens@^3.0.0, js-tokens@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" -js-yaml@3.6.1: +js-yaml@3.6.1, js-yaml@3.x: version "3.6.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.6.1.tgz#6e5fe67d8b205ce4d22fad05b7781e8dadcc4b30" dependencies: argparse "^1.0.7" esprima "^2.6.0" -js-yaml@3.x, js-yaml@^3.7.0: +js-yaml@^3.7.0: version "3.10.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.10.0.tgz#2e78441646bd4682e963f22b6e92823c309c62dc" dependencies: @@ -2475,9 +2479,9 @@ lolex@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/lolex/-/lolex-1.6.0.tgz#3a9a0283452a47d7439e72731b9e07d7386e49f6" -lolex@^2.1.3: - version "2.1.3" - resolved "https://registry.yarnpkg.com/lolex/-/lolex-2.1.3.tgz#53f893bbe88c80378156240e127126b905c83087" +lolex@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/lolex/-/lolex-2.3.0.tgz#d6bad0f0aa5caebffcfebb09fb2caa89baaff51c" longest@^1.0.1: version "1.0.1" @@ -3431,14 +3435,14 @@ signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" -sinon@4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/sinon/-/sinon-4.1.1.tgz#bd657be815df608887fe1f0b75f9590ec563748a" +sinon@4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/sinon/-/sinon-4.1.2.tgz#65610521d926fb53742dd84cd599f0b89a82f440" dependencies: diff "^3.1.0" formatio "1.2.0" lodash.get "^4.4.2" - lolex "^2.1.3" + lolex "^2.2.0" nise "^1.2.0" supports-color "^4.4.0" type-detect "^4.0.0"