diff --git a/dist/index.js b/dist/index.js index d8e41fae..60972abb 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=48)}([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__IDeadCodeInjectionCustomNode="Factory",e.Factory__IIdentifierNamesGenerator="Factory",e.Factory__IIdentifierObfuscatingReplacer="Factory",e.Factory__INodeGuard="Factory",e.Factory__INodeTransformer="Factory",e.Factory__IObfuscationResult="Factory",e.Factory__IObfuscatingReplacer="Factory",e.Factory__TControlFlowStorage="Factory",e.IArrayUtils="IArrayUtils",e.ICalleeDataExtractor="ICalleeDataExtractor",e.ICryptUtils="ICryptUtils",e.ICustomNode="ICustomNode",e.ICustomNodeGroup="ICustomNodeGroup",e.IControlFlowReplacer="IControlFlowReplacer",e.IEscapeSequenceEncoder="IEscapeSequenceEncoder",e.IIdentifierNamesGenerator="IIdentifierNamesGenerator",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(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]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=t.parentNode;if(!o)throw new ReferenceError("`parentNode` property of given node is `undefined`");return(u.NodeGuards.isProgramNode(t)||n&&u.NodeGuards.isNodeHasBlockScope(t,o))&&r.push(t),t!==o?e.getBlockScopesOfNodeRecursive(o,r,++n):r}}]),e}();t.NodeUtils=l},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(){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:"getMethodDefinitionNode",value:function(e,t,r,n){return{type:i.NodeType.MethodDefinition,key:e,value:t,kind:r,computed:n,static:!1,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){e.exports=require("estraverse")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e.ArrayExpression="ArrayExpression",e.ArrayPattern="ArrayPattern",e.ArrowFunctionExpression="ArrowFunctionExpression",e.AssignmentExpression="AssignmentExpression",e.AssignmentPattern="AssignmentPattern",e.AwaitExpression="AwaitExpression",e.BinaryExpression="BinaryExpression",e.BlockStatement="BlockStatement",e.BreakStatement="BreakStatement",e.CallExpression="CallExpression",e.CatchClause="CatchClause",e.ClassDeclaration="ClassDeclaration",e.ContinueStatement="ContinueStatement",e.ExpressionStatement="ExpressionStatement",e.FunctionDeclaration="FunctionDeclaration",e.FunctionExpression="FunctionExpression",e.Identifier="Identifier",e.IfStatement="IfStatement",e.LabeledStatement="LabeledStatement",e.Literal="Literal",e.LogicalExpression="LogicalExpression",e.MemberExpression="MemberExpression",e.MethodDefinition="MethodDefinition",e.ObjectExpression="ObjectExpression",e.ObjectPattern="ObjectPattern",e.Program="Program",e.Property="Property",e.RestElement="RestElement",e.ReturnStatement="ReturnStatement",e.Super="Super",e.SwitchCase="SwitchCase",e.SwitchStatement="SwitchStatement",e.TemplateLiteral="TemplateLiteral",e.TryStatement="TryStatement",e.UnaryExpression="UnaryExpression",e.UpdateExpression="UpdateExpression",e.VariableDeclaration="VariableDeclaration",e.VariableDeclarator="VariableDeclarator",e.WhileStatement="WhileStatement"}(t.NodeType||(t.NodeType={}))},function(e,t){e.exports=require("string-template")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e.BinaryExpressionFunctionNode="BinaryExpressionFunctionNode",e.BlockStatementControlFlowFlatteningNode="BlockStatementControlFlowFlatteningNode",e.CallExpressionControlFlowStorageCallNode="CallExpressionControlFlowStorageCallNode",e.CallExpressionFunctionNode="CallExpressionFunctionNode",e.ControlFlowStorageNode="ControlFlowStorageNode",e.ExpressionWithOperatorControlFlowStorageCallNode="ExpressionWithOperatorControlFlowStorageCallNode",e.LogicalExpressionFunctionNode="LogicalExpressionFunctionNode",e.StringLiteralControlFlowStorageCallNode="StringLiteralControlFlowStorageCallNode",e.StringLiteralNode="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;n3&&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:"insertNodeAfter",value:function(t,r,n){var o=e.getScopeNodeStatements(t).indexOf(n);e.insertNodeAtIndex(t,r,o+1)}},{key:"insertNodeAtIndex",value:function(t,r,o){e.validateScopeStatements(r)||(r=[]),r=e.parentizeScopeStatementsBeforeAppend(t,r),e.setScopeNodeStatements(t,[].concat(n(e.getScopeNodeStatements(t).slice(0,o)),n(r),n(e.getScopeNodeStatements(t).slice(o))))}},{key:"prependNode",value:function(t,r){e.validateScopeStatements(r)||(r=[]),r=e.parentizeScopeStatementsBeforeAppend(t,r),e.setScopeNodeStatements(t,[].concat(n(r),n(e.getScopeNodeStatements(t))))}},{key:"getScopeNodeStatements",value:function(e){return i.NodeGuards.isSwitchCaseNode(e)?e.consequent:e.body}},{key:"parentizeScopeStatementsBeforeAppend",value:function(e,t){return t.forEach(function(t){t.parentNode=e}),t}},{key:"setScopeNodeStatements",value:function(e,t){if(i.NodeGuards.isSwitchCaseNode(e))return void(e.consequent=t);e.body=t}},{key:"validateScopeStatements",value:function(e){return e.every(function(e){return!!e&&e.hasOwnProperty("type")})}}]),e}();t.NodeAppender=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e.AfterObfuscation="afterObfuscation",e.BeforeObfuscation="beforeObfuscation"}(t.ObfuscationEvent||(t.ObfuscationEvent={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e.BaseIdentifierObfuscatingReplacer="BaseIdentifierObfuscatingReplacer"}(t.IdentifierObfuscatingReplacer||(t.IdentifierObfuscatingReplacer={}))},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]:{},r=new i.InversifyContainerFacade;r.load(e,t);var n=r.get(a.ServiceIdentifiers.IJavaScriptObfuscator),o=n.obfuscate(e);return r.unload(),o}},{key:"runCLI",value:function(e){var t=new c.JavaScriptObfuscatorCLI(e);t.initialize(),t.run()}}]),e}();t.JavaScriptObfuscator=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e.ConsoleOutputDisableExpressionNode="ConsoleOutputDisableExpressionNode",e.DebugProtectionFunctionCallNode="DebugProtectionFunctionCallNode",e.DebugProtectionFunctionIntervalNode="DebugProtectionFunctionIntervalNode",e.DebugProtectionFunctionNode="DebugProtectionFunctionNode",e.DomainLockNode="DomainLockNode",e.NodeCallsControllerFunctionNode="NodeCallsControllerFunctionNode",e.SelfDefendingUnicodeNode="SelfDefendingUnicodeNode",e.StringArrayCallsWrapper="StringArrayCallsWrapper",e.StringArrayNode="StringArrayNode",e.StringArrayRotateFunctionNode="StringArrayRotateFunctionNode"}(t.CustomNode||(t.CustomNode={}))},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var r=0;r-1||0===e.indexOf("//")?e.split("/")[2]:e.split("/")[0],t=t.split(":")[0]}},{key:"isCeilNumber",value:function(e){return e%1==0}},{key:"stringRotate",value:function(e,t){if(!e)throw new ReferenceError("Cannot rotate empty string.");for(var r=0;r [options]").version(c.version,"-v, --version").option("-o, --output ","Output path for obfuscated code").option("--compact ","Disable one line output code compacting",d.BooleanSanitizer).option("--config ","Name of js / json config file").option("--control-flow-flattening ","Enables control flow flattening",d.BooleanSanitizer).option("--control-flow-flattening-threshold ","The probability that the control flow flattening transformation will be applied to the node",parseFloat).option("--dead-code-injection ","Enables dead code injection",d.BooleanSanitizer).option("--dead-code-injection-threshold ","The probability that the dead code injection transformation will be applied to the node",parseFloat).option("--debug-protection ","Disable browser Debug panel (can cause DevTools enabled browser freeze)",d.BooleanSanitizer).option("--debug-protection-interval ","Disable browser Debug panel even after page was loaded (can cause DevTools enabled browser freeze)",d.BooleanSanitizer).option("--disable-console-output ","Allow console.log, console.info, console.error and console.warn messages output into browser console",d.BooleanSanitizer).option("--domain-lock (comma separated, without whitespaces)","Blocks the execution of the code in domains that do not match the passed RegExp patterns (comma separated)",f.ArraySanitizer).option("--identifier-names-generator [hexadecimal, mangled]","Sets identifier names generator (Default: hexadecimal)",p.IdentifierNamesGeneratorSanitizer).option("--log ","Enables logging of the information to the console",d.BooleanSanitizer).option("--reserved-names (comma separated, without whitespaces)","Disable obfuscation of variable names, function names and names of function parameters that match the passed RegExp patterns (comma separated)",f.ArraySanitizer).option("--rename-globals ","Allows to enable obfuscation of global variable and function names with declaration.",d.BooleanSanitizer).option("--rotate-string-array ","Disable rotation of unicode array values during obfuscation",d.BooleanSanitizer).option("--seed ","Sets seed for random generator. This is useful for creating repeatable results.",parseFloat).option("--self-defending ","Disables self-defending for obfuscated code",d.BooleanSanitizer).option("--source-map ","Enables source map generation",d.BooleanSanitizer).option("--source-map-base-url ","Sets base url to the source map import url when `--source-map-mode=separate`").option("--source-map-file-name ","Sets file name for output source map when `--source-map-mode=separate`").option("--source-map-mode [inline, separate]","Specify source map output mode",y.SourceMapModeSanitizer).option("--string-array ","Disables gathering of all literal strings into an array and replacing every literal string with an array call",d.BooleanSanitizer).option("--string-array-encoding [true, false, base64, rc4]","Encodes all strings in strings array using base64 or rc4 (this option can slow down your code speed",b.StringArrayEncodingSanitizer).option("--string-array-threshold ","The probability that the literal string will be inserted into stringArray (Default: 0.8, Min: 0, Max: 1)",parseFloat).option("--target ","Allows to set target environment for obfuscated code.",m.ObfuscationTargetSanitizer).option("--transform-object-keys ","Enables transformation of object keys",d.BooleanSanitizer).option("--unicode-escape-sequence ","Allows to enable/disable string conversion to unicode escape sequence",d.BooleanSanitizer).parse(this.rawArguments)}},{key:"configureHelp",value:function(){this.commands.on("--help",function(){console.log(" Examples:\n"),console.log(" %> javascript-obfuscator input_file_name.js --compact true --self-defending false"),console.log(" %> javascript-obfuscator input_file_name.js --output output_file_name.js --compact true --self-defending false"),console.log(" %> javascript-obfuscator input_directory_name --compact true --self-defending false"),console.log("")})}},{key:"processSourceCodeData",value:function(e){var t=this,r=this.inputCLIOptions.output?s.normalize(this.inputCLIOptions.output):"";if(Array.isArray(e))e.forEach(function(e){var n=e.filePath,o=e.content,a=r?s.join(r,n):g.CLIUtils.getOutputCodePath(n);t.processSourceCode(o,a)});else{var n=r||g.CLIUtils.getOutputCodePath(this.inputPath);this.processSourceCode(e,n)}}},{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=v.JavaScriptObfuscator.obfuscate(e,r).getObfuscatedCode();g.CLIUtils.writeFile(t,n)}},{key:"processSourceCodeWithSourceMap",value:function(e,t,r){var n=g.CLIUtils.getOutputSourceMapPath(t,r.sourceMapFileName||"");r=Object.assign({},r,{sourceMapFileName:s.basename(n)});var o=v.JavaScriptObfuscator.obfuscate(e,r);g.CLIUtils.writeFile(t,o.getObfuscatedCode()),"separate"===r.sourceMapMode&&o.getSourceMap()&&g.CLIUtils.writeFile(n,o.getSourceMap())}}]),e}();_.availableInputExtensions=[".js"],_.encoding="utf8",_.obfuscatedFilePrefix="-obfuscated",a.__decorate([u.initializable(),a.__metadata("design:type",Object)],_.prototype,"commands",void 0),a.__decorate([u.initializable(),a.__metadata("design:type",Object)],_.prototype,"inputCLIOptions",void 0),a.__decorate([u.initializable(),a.__metadata("design:type",String)],_.prototype,"inputPath",void 0),t.JavaScriptObfuscatorCLI=_},function(e,t){e.exports=require("path")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e.FunctionDeclarationCalleeDataExtractor="FunctionDeclarationCalleeDataExtractor",e.FunctionExpressionCalleeDataExtractor="FunctionExpressionCalleeDataExtractor",e.ObjectExpressionCalleeDataExtractor="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.BinaryExpressionControlFlowReplacer="BinaryExpressionControlFlowReplacer",e.CallExpressionControlFlowReplacer="CallExpressionControlFlowReplacer",e.LogicalExpressionControlFlowReplacer="LogicalExpressionControlFlowReplacer",e.StringLiteralControlFlowReplacer="StringLiteralControlFlowReplacer"}(t.ControlFlowReplacer||(t.ControlFlowReplacer={}))},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;r1&&void 0!==arguments[1]&&arguments[1];this.storage=new Map([].concat(n(this.storage),n(e.getStorage()))),t&&(this.storageId=e.getStorageId())}},{key:"set",value:function(e,t){this.storage.set(e,t)}}]),e}();c.__decorate([l.initializable(),c.__metadata("design:type",String)],f.prototype,"storageId",void 0),c.__decorate([l.initializable(),c.__metadata("design:type",Map)],f.prototype,"storage",void 0),c.__decorate([s.postConstruct(),c.__metadata("design:type",Function),c.__metadata("design:paramtypes",[]),c.__metadata("design:returntype",void 0)],f.prototype,"initialize",null),f=c.__decorate([s.injectable(),c.__param(0,s.inject(u.ServiceIdentifiers.IRandomGenerator)),c.__param(1,s.inject(u.ServiceIdentifiers.IOptions)),c.__metadata("design:paramtypes",[Object,Object])],f),t.MapStorage=f},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:d.randomGeneratorPool;return this.getRandomGenerator().string({length:e,pool:t})}},{key:"getSeed",value:function(){return this.seed}}]),e}();f.randomGeneratorPool="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",f.randomGeneratorPoolNumbers="0123456789",f.randomGeneratorPoolHexadecimal="abcdef"+d.randomGeneratorPoolNumbers,a.__decorate([l.initializable(),a.__metadata("design:type",Object)],f.prototype,"randomGenerator",void 0),a.__decorate([l.initializable(),a.__metadata("design:type",Number)],f.prototype,"seed",void 0),a.__decorate([i.postConstruct(),a.__metadata("design:type",Function),a.__metadata("design:paramtypes",[]),a.__metadata("design:returntype",void 0)],f.prototype,"initialize",null),f=d=a.__decorate([i.injectable(),a.__param(0,i.inject(c.ServiceIdentifiers.ISourceCode)),a.__param(1,i.inject(c.ServiceIdentifiers.IOptions)),a.__metadata("design:paramtypes",[Object,Object])],f),t.RandomGenerator=f;var d},function(e,t){e.exports=require("pjson")},function(e,t){e.exports=require("fs")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(19);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(51),s=r(52),u=r(53),l=r(54);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(15),s=r(56),u=r(57),l=r(58),f=r(59),d=r(60),p=r(61),m=r(62);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(m.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||!b.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);i.initialize(r,o,a);var c=i.getNode()[0];return m.NodeUtils.parentizeNode(c,t),c}}],[{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)&&b.blockStatementHasProhibitedStatements(e)&&(t=!1)}}),e.body.length<=4&&(t=!1),t}}]),t}(d.AbstractNodeTransformer);y=b=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 b},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===p.NodeType.Program)return e;var r=this.collectedBlockStatements.length-1,n=this.randomGenerator.getRandomInteger(0,r),o=this.collectedBlockStatements.splice(n,1)[0];return o===e?e:this.replaceBlockStatementNode(e,o,t)}},{key:"collectBlockStatementNodes",value:function(e,t,r){var n=b.NodeUtils.clone(e),o=0,a=!0;l.replace(n,{enter:function(e){return y.NodeGuards.isBlockStatementNode(e)&&o++,o>v.maxNestedBlockStatementsCount||!v.isValidBlockStatementNode(e)?(a=!1,l.VisitorOption.Break):e}}),a&&(b.NodeUtils.parentizeNode(n,r),n=this.transformersRunner.transform(n,v.transformersToRenameBlockScopeIdentifiers),t.push(n))}},{key:"replaceBlockStatementNode",value:function(e,t,r){var n=this.deadCodeInjectionCustomNodeFactory(f.DeadCodeInjectionCustomNode.BlockStatementDeadCodeInjectionNode);n.initialize(e,t);var o=n.getNode()[0];return b.NodeUtils.parentizeNode(o,r),o}}],[{key:"isValidBlockStatementNode",value:function(e){return!(y.NodeGuards.isBreakStatementNode(e)||y.NodeGuards.isContinueStatementNode(e)||y.NodeGuards.isAwaitExpressionNode(e)||y.NodeGuards.isSuperNode(e))}}]),t}(m.AbstractNodeTransformer);g.maxNestedBlockStatementsCount=4,g.minCollectedBlockStatementsCount=5,g.transformersToRenameBlockScopeIdentifiers=[d.NodeTransformer.CatchClauseTransformer,d.NodeTransformer.ClassDeclarationTransformer,d.NodeTransformer.FunctionDeclarationTransformer,d.NodeTransformer.FunctionTransformer,d.NodeTransformer.LabeledStatementTransformer,d.NodeTransformer.VariableDeclarationTransformer],g=v=c.__decorate([s.injectable(),c.__param(0,s.inject(u.ServiceIdentifiers.Factory__IDeadCodeInjectionCustomNode)),c.__param(1,s.inject(u.ServiceIdentifiers.ITransformersRunner)),c.__param(2,s.inject(u.ServiceIdentifiers.IRandomGenerator)),c.__param(3,s.inject(u.ServiceIdentifiers.IOptions)),c.__metadata("design:paramtypes",[Function,Object,Object,Object])],g),t.DeadCodeInjectionTransformer=g;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;rh.hostNodeSearchMinDepth&&t.splice(0,h.hostNodeSearchMinDepth),t.length>h.hostNodeSearchMaxDepth&&(t.length=h.hostNodeSearchMaxDepth),this.randomGenerator.getRandomGenerator().pickone(t))}},{key:"isVisitedFunctionNode",value:function(e){return(y.NodeGuards.isFunctionDeclarationNode(e)||y.NodeGuards.isFunctionExpressionNode(e)||y.NodeGuards.isArrowFunctionExpressionNode(e))&&this.visitedFunctionNodes.has(e)}},{key:"transformFunctionBody",value:function(e,t){var r=this;l.replace(e,{enter:function(e,n){if(e.ignoredNode)return l.VisitorOption.Skip;if(r.isVisitedFunctionNode(e)||!n)return l.VisitorOption.Skip;if(!h.controlFlowReplacersMap.has(e.type))return e;if(r.randomGenerator.getMathRandom()>r.options.controlFlowFlatteningThreshold)return e;var o=h.controlFlowReplacersMap.get(e.type);return void 0===o?e:Object.assign({},r.controlFlowReplacerFactory(o).replace(e,n,t),{parentNode:n})}})}}]),t}(m.AbstractNodeTransformer);v.controlFlowReplacersMap=new Map([[p.NodeType.BinaryExpression,d.ControlFlowReplacer.BinaryExpressionControlFlowReplacer],[p.NodeType.CallExpression,d.ControlFlowReplacer.CallExpressionControlFlowReplacer],[p.NodeType.LogicalExpression,d.ControlFlowReplacer.LogicalExpressionControlFlowReplacer],[p.NodeType.Literal,d.ControlFlowReplacer.StringLiteralControlFlowReplacer]]),v.hostNodeSearchMinDepth=0,v.hostNodeSearchMaxDepth=2,v=h=c.__decorate([s.injectable(),c.__param(0,s.inject(u.ServiceIdentifiers.Factory__TControlFlowStorage)),c.__param(1,s.inject(u.ServiceIdentifiers.Factory__IControlFlowReplacer)),c.__param(2,s.inject(u.ServiceIdentifiers.Factory__IControlFlowCustomNode)),c.__param(3,s.inject(u.ServiceIdentifiers.IRandomGenerator)),c.__param(4,s.inject(u.ServiceIdentifiers.IOptions)),c.__metadata("design:paramtypes",[Function,Function,Function,Object,Object])],v),t.FunctionControlFlowTransformer=v;var h},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;r1){var o=d.Nodes.getBinaryExpressionNode("+",n.shift(),n.shift());return n.forEach(function(e){o=d.Nodes.getBinaryExpressionNode("+",o,e)}),o}return n[0]}}],[{key:"isLiteralNodeWithStringValue",value:function(e){return e&&f.NodeGuards.isLiteralNode(e)&&"string"==typeof e.value}}]),t}(l.AbstractNodeTransformer);p=m=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 m},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(40),u=r(39),l=r(69),f=r(70),d=r(71),p=r(72),m=r(73),y=r(74),b=r(77),g=r(78),v=r(79),h=r(80),_=r(81),N=r(82),O=r(84),S=r(86),j=r(88),C=r(92),w=r(94),I=r(95),T=r(96),E=r(98),F=r(100),k=r(107),P=r(109),x=r(113),R=r(114);t.customNodesModule=new o.ContainerModule(function(e){e(a.ServiceIdentifiers.ICustomNode).to(N.ConsoleOutputDisableExpressionNode).whenTargetNamed(c.CustomNode.ConsoleOutputDisableExpressionNode),e(a.ServiceIdentifiers.ICustomNode).to(O.DebugProtectionFunctionCallNode).whenTargetNamed(c.CustomNode.DebugProtectionFunctionCallNode),e(a.ServiceIdentifiers.ICustomNode).to(S.DebugProtectionFunctionIntervalNode).whenTargetNamed(c.CustomNode.DebugProtectionFunctionIntervalNode),e(a.ServiceIdentifiers.ICustomNode).to(j.DebugProtectionFunctionNode).whenTargetNamed(c.CustomNode.DebugProtectionFunctionNode),e(a.ServiceIdentifiers.ICustomNode).to(C.DomainLockNode).whenTargetNamed(c.CustomNode.DomainLockNode),e(a.ServiceIdentifiers.ICustomNode).to(T.NodeCallsControllerFunctionNode).whenTargetNamed(c.CustomNode.NodeCallsControllerFunctionNode),e(a.ServiceIdentifiers.ICustomNode).to(E.SelfDefendingUnicodeNode).whenTargetNamed(c.CustomNode.SelfDefendingUnicodeNode),e(a.ServiceIdentifiers.ICustomNode).to(F.StringArrayCallsWrapper).whenTargetNamed(c.CustomNode.StringArrayCallsWrapper),e(a.ServiceIdentifiers.ICustomNode).to(k.StringArrayNode).whenTargetNamed(c.CustomNode.StringArrayNode),e(a.ServiceIdentifiers.ICustomNode).to(P.StringArrayRotateFunctionNode).whenTargetNamed(c.CustomNode.StringArrayRotateFunctionNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(y.BinaryExpressionFunctionNode).whenTargetNamed(i.ControlFlowCustomNode.BinaryExpressionFunctionNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(b.BlockStatementControlFlowFlatteningNode).whenTargetNamed(i.ControlFlowCustomNode.BlockStatementControlFlowFlatteningNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(v.CallExpressionControlFlowStorageCallNode).whenTargetNamed(i.ControlFlowCustomNode.CallExpressionControlFlowStorageCallNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(h.CallExpressionFunctionNode).whenTargetNamed(i.ControlFlowCustomNode.CallExpressionFunctionNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(_.ControlFlowStorageNode).whenTargetNamed(i.ControlFlowCustomNode.ControlFlowStorageNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(w.ExpressionWithOperatorControlFlowStorageCallNode).whenTargetNamed(i.ControlFlowCustomNode.ExpressionWithOperatorControlFlowStorageCallNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(I.LogicalExpressionFunctionNode).whenTargetNamed(i.ControlFlowCustomNode.LogicalExpressionFunctionNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(R.StringLiteralNode).whenTargetNamed(i.ControlFlowCustomNode.StringLiteralNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(x.StringLiteralControlFlowStorageCallNode).whenTargetNamed(i.ControlFlowCustomNode.StringLiteralControlFlowStorageCallNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(g.BlockStatementDeadCodeInjectionNode).whenTargetNamed(u.DeadCodeInjectionCustomNode.BlockStatementDeadCodeInjectionNode),e(a.ServiceIdentifiers.ICustomNodeGroup).to(l.ConsoleOutputCustomNodeGroup).whenTargetNamed(s.CustomNodeGroup.ConsoleOutputCustomNodeGroup),e(a.ServiceIdentifiers.ICustomNodeGroup).to(f.DebugProtectionCustomNodeGroup).whenTargetNamed(s.CustomNodeGroup.DebugProtectionCustomNodeGroup),e(a.ServiceIdentifiers.ICustomNodeGroup).to(d.DomainLockCustomNodeGroup).whenTargetNamed(s.CustomNodeGroup.DomainLockCustomNodeGroup),e(a.ServiceIdentifiers.ICustomNodeGroup).to(p.SelfDefendingCustomNodeGroup).whenTargetNamed(s.CustomNodeGroup.SelfDefendingCustomNodeGroup),e(a.ServiceIdentifiers.ICustomNodeGroup).to(m.StringArrayCustomNodeGroup).whenTargetNamed(s.CustomNodeGroup.StringArrayCustomNodeGroup),e(a.ServiceIdentifiers.Factory__ICustomNode).toFactory(n.InversifyContainerFacade.getFactory(a.ServiceIdentifiers.ICustomNode)),e(a.ServiceIdentifiers.Factory__IControlFlowCustomNode).toFactory(n.InversifyContainerFacade.getConstructorFactory(a.ServiceIdentifiers.Newable__ICustomNode,a.ServiceIdentifiers.Factory__IIdentifierNamesGenerator,a.ServiceIdentifiers.IRandomGenerator,a.ServiceIdentifiers.IOptions)),e(a.ServiceIdentifiers.Factory__IDeadCodeInjectionCustomNode).toFactory(n.InversifyContainerFacade.getConstructorFactory(a.ServiceIdentifiers.Newable__ICustomNode,a.ServiceIdentifiers.Factory__IIdentifierNamesGenerator,a.ServiceIdentifiers.IRandomGenerator,a.ServiceIdentifiers.IOptions)),e(a.ServiceIdentifiers.Factory__ICustomNodeGroup).toFactory(n.InversifyContainerFacade.getFactory(a.ServiceIdentifiers.ICustomNodeGroup))})},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;r.5,t=this.randomGenerator.getMathRandom()>.5,r=e?"===":"!==",n=this.randomGenerator.getRandomString(5),o=t?n:this.randomGenerator.getRandomString(5),a=e===t?[this.blockStatementNode,this.randomBlockStatementNode]:[this.randomBlockStatementNode,this.blockStatementNode],c=i(a,2),s=c[0],u=c[1],l=p.Nodes.getBlockStatementNode([p.Nodes.getIfStatementNode(p.Nodes.getBinaryExpressionNode(r,p.Nodes.getLiteralNode(n),p.Nodes.getLiteralNode(o)),s,u)]);return m.NodeUtils.parentize(l),[l]}}]),t}(d.AbstractCustomNode);s.__decorate([f.initializable(),s.__metadata("design:type",Object)],y.prototype,"blockStatementNode",void 0),s.__decorate([f.initializable(),s.__metadata("design:type",Object)],y.prototype,"randomBlockStatementNode",void 0),y=s.__decorate([u.injectable(),s.__param(0,u.inject(l.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),s.__param(1,u.inject(l.ServiceIdentifiers.IRandomGenerator)),s.__param(2,u.inject(l.ServiceIdentifiers.IOptions)),s.__metadata("design:paramtypes",[Function,Object,Object])],y),t.BlockStatementDeadCodeInjectionNode=y},function(e,t,r){"use strict";function n(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t 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,t){var r=e.getRandomString(6),n=e.getRandomString(6),o=e.getRandomString(6),a=e.getRandomString(6),i=e.getRandomString(6),c=e.getRandomString(6),s=e.getRandomString(6),u=e.getRandomString(6),l=e.getRandomString(6);return"\n var StatesClass = function ("+r+") {\n this."+r+" = "+r+";\n this."+n+" = [1, 0, 0];\n this."+o+" = function(){return 'newState';};\n this."+a+" = '"+t.encode("\\w+ *\\(\\) *{\\w+ *",!0)+"';\n this."+i+" = '"+t.encode("['|\"].+['|\"];? *}",!0)+"';\n };\n \n StatesClass.prototype."+c+" = function () {\n var regExp = new RegExp(this."+a+" + this."+i+");\n var expression = regExp.test(this."+o+".toString())\n ? --this."+n+"[1]\n : --this."+n+"[0];\n \n return this."+s+"(expression);\n };\n \n StatesClass.prototype."+s+" = function ("+l+") {\n if (!Boolean(~"+l+")) {\n return "+l+";\n }\n \n return this."+u+"(this."+r+");\n };\n\n StatesClass.prototype."+u+" = function ("+r+") {\n for (var i = 0, len = this."+n+".length; i < len; i++) {\n this."+n+".push(Math.round(Math.random()));\n len = this."+n+".length;\n }\n \n return "+r+"(this."+n+"[0]);\n };\n\n new StatesClass({stringArrayCallsWrapperName})."+c+"();\n "}Object.defineProperty(t,"__esModule",{value:!0}),t.SelfDefendingTemplate=n},function(e,t,r){"use strict";function n(e){var t=e.getRandomString(6),r=e.getRandomString(6),n=e.getRandomString(6);return"\n if ({stringArrayCallsWrapperName}."+t+" === undefined) {\n {atobPolyfill}\n \n {stringArrayCallsWrapperName}."+r+" = 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}."+n+" = {};\n \n {stringArrayCallsWrapperName}."+t+" = true;\n }\n \n var cachedValue = {stringArrayCallsWrapperName}."+n+"[index];\n \n if (cachedValue === undefined) {\n {selfDefendingCode}\n \n value = {stringArrayCallsWrapperName}."+r+"(value);\n {stringArrayCallsWrapperName}."+n+"[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(e){var t=e.getRandomString(6),r=e.getRandomString(6),n=e.getRandomString(6),o=e.getRandomString(6);return"\n if ({stringArrayCallsWrapperName}."+t+" === undefined) {\n {atobPolyfill}\n \n {rc4Polyfill}\n {stringArrayCallsWrapperName}."+r+" = rc4;\n \n {stringArrayCallsWrapperName}."+n+" = {};\n \n {stringArrayCallsWrapperName}."+t+" = true;\n }\n \n var cachedValue = {stringArrayCallsWrapperName}."+n+"[index];\n\n if (cachedValue === undefined) {\n if ({stringArrayCallsWrapperName}."+o+" === undefined) {\n {selfDefendingCode}\n \n {stringArrayCallsWrapperName}."+o+" = true;\n }\n \n value = {stringArrayCallsWrapperName}."+r+"(value, key);\n {stringArrayCallsWrapperName}."+n+"[index] = value;\n } else {\n value = cachedValue;\n }\n "}Object.defineProperty(t,"__esModule",{value:!0}),t.StringArrayRc4DecodeNodeTemplate=n},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;r=0);return"a"+o(n)}(e);return d.validateMangledName(t)||(t=d.generateNewMangledName(t)),t}},{key:"validateMangledName",value:function(e){return!(-1!==d.reservedNames.indexOf(e))}}]),t}(l.AbstractIdentifierNamesGenerator);f.initMangledNameCharacter="9",f.nameSequence="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),f.reservedNames=["byte","case","char","do","else","enum","eval","for","goto","if","in","int","let","long","new","null","this","true","try","var","void","with"],f=d=c.__decorate([s.injectable(),c.__param(0,s.inject(u.ServiceIdentifiers.IRandomGenerator)),c.__param(1,s.inject(u.ServiceIdentifiers.IOptions)),c.__metadata("design:paramtypes",[Object,Object])],f),t.MangledIdentifierNamesGenerator=f;var d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(14),o=r(0),a=r(1);t.nodeTransformersModule=new o.ContainerModule(function(e){e(a.ServiceIdentifiers.Factory__INodeTransformer).toFactory(n.InversifyContainerFacade.getCacheFactory(a.ServiceIdentifiers.INodeTransformer))})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(14),o=r(0),a=r(1),i=r(18),c=r(42),s=r(15),u=r(123),l=r(124),f=r(125),d=r(126),p=r(127),m=r(128),y=r(129),b=r(130),g=r(131),v=r(132),h=r(133),_=r(134);t.obfuscatingTransformersModule=new o.ContainerModule(function(e){e(a.ServiceIdentifiers.INodeTransformer).to(f.CatchClauseTransformer).whenTargetNamed(s.NodeTransformer.CatchClauseTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(d.ClassDeclarationTransformer).whenTargetNamed(s.NodeTransformer.ClassDeclarationTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(p.FunctionDeclarationTransformer).whenTargetNamed(s.NodeTransformer.FunctionDeclarationTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(m.FunctionTransformer).whenTargetNamed(s.NodeTransformer.FunctionTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(y.LabeledStatementTransformer).whenTargetNamed(s.NodeTransformer.LabeledStatementTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(b.LiteralTransformer).whenTargetNamed(s.NodeTransformer.LiteralTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(v.ObjectExpressionTransformer).whenTargetNamed(s.NodeTransformer.ObjectExpressionTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(_.VariableDeclarationTransformer).whenTargetNamed(s.NodeTransformer.VariableDeclarationTransformer),e(a.ServiceIdentifiers.IObfuscatingReplacer).to(l.BooleanLiteralObfuscatingReplacer).whenTargetNamed(c.LiteralObfuscatingReplacer.BooleanLiteralObfuscatingReplacer),e(a.ServiceIdentifiers.IObfuscatingReplacer).to(g.NumberLiteralObfuscatingReplacer).whenTargetNamed(c.LiteralObfuscatingReplacer.NumberLiteralObfuscatingReplacer),e(a.ServiceIdentifiers.IObfuscatingReplacer).to(h.StringLiteralObfuscatingReplacer).whenTargetNamed(c.LiteralObfuscatingReplacer.StringLiteralObfuscatingReplacer),e(a.ServiceIdentifiers.IIdentifierObfuscatingReplacer).to(u.BaseIdentifierObfuscatingReplacer).whenTargetNamed(i.IdentifierObfuscatingReplacer.BaseIdentifierObfuscatingReplacer),e(a.ServiceIdentifiers.Factory__IObfuscatingReplacer).toFactory(n.InversifyContainerFacade.getCacheFactory(a.ServiceIdentifiers.IObfuscatingReplacer)),e(a.ServiceIdentifiers.Factory__IIdentifierObfuscatingReplacer).toFactory(n.InversifyContainerFacade.getCacheFactory(a.ServiceIdentifiers.IIdentifierObfuscatingReplacer))})},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;r=y.minimumLengthForStringArray&&this.randomGenerator.getMathRandom()<=this.options.stringArrayThreshold}},{key:"getStringArrayHexadecimalIndex",value:function(e,t){if(this.stringLiteralHexadecimalIndexCache.has(e))return{fromCache:!0,index:this.stringLiteralHexadecimalIndexCache.get(e)};var r=p.Utils.decToHex(t),n=""+p.Utils.hexadecimalPrefix+r;return this.stringLiteralHexadecimalIndexCache.set(e,n),{fromCache:!1,index:n}}},{key:"getEncodedValue",value:function(e){var t=void 0,r=null;switch(this.options.stringArrayEncoding){case l.StringArrayEncoding.Rc4:r=this.randomGenerator.getRandomGenerator().pickone(this.rc4Keys),t=this.cryptUtils.btoa(this.cryptUtils.rc4(e,r));break;case l.StringArrayEncoding.Base64:t=this.cryptUtils.btoa(e);break;default:t=e}return{encodedValue:t,key:r}}},{key:"replaceWithLiteralNode",value:function(e){return d.Nodes.getLiteralNode(this.escapeSequenceEncoder.encode(e,this.options.unicodeEscapeSequence))}},{key:"replaceWithStringArrayCallNode",value:function(e){var t=this.getEncodedValue(e),r=t.encodedValue,n=t.key,o=this.escapeSequenceEncoder.encode(r,this.options.unicodeEscapeSequence),a=this.stringArrayStorage.getLength(),i=this.stringArrayStorage.getStorageId().split("|")[1],c=this.getStringArrayHexadecimalIndex(o,a),s=c.fromCache,u=c.index;s||this.stringArrayStorage.set(a,o);var l=[y.getHexadecimalLiteralNode(u)];n&&l.push(y.getRc4KeyLiteralNode(this.escapeSequenceEncoder.encode(n,this.options.unicodeEscapeSequence)));var f=d.Nodes.getIdentifierNode(i);return f.obfuscatedNode=!0,d.Nodes.getCallExpressionNode(f,l)}}],[{key:"getHexadecimalLiteralNode",value:function(e){var t=d.Nodes.getLiteralNode(e);return t.obfuscatedNode=!0,t}},{key:"getRc4KeyLiteralNode",value:function(e){var t=d.Nodes.getLiteralNode(e);return t.obfuscatedNode=!0,t}}]),t}(f.AbstractObfuscatingReplacer);m.minimumLengthForStringArray=3,m.rc4KeyLength=4,m.rc4KeysCount=50,m=y=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])],m),t.StringLiteralObfuscatingReplacer=m;var y},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;r=0?t:null}},{key:"getLength",value:function(){return this.storageLength}},{key:"getStorage",value:function(){return this.storage}},{key:"getStorageId",value:function(){return this.storageId}},{key:"mergeWith",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.storage=[].concat(n(this.storage),n(e.getStorage())),t&&(this.storageId=e.getStorageId())}},{key:"set",value:function(e,t){e===this.storageLength?this.storage.push(t):this.storage.splice(e,0,t),this.storageLength++}}]),e}();i.__decorate([u.initializable(),i.__metadata("design:type",Array)],l.prototype,"storage",void 0),i.__decorate([u.initializable(),i.__metadata("design:type",String)],l.prototype,"storageId",void 0),i.__decorate([c.postConstruct(),i.__metadata("design:type",Function),i.__metadata("design:paramtypes",[]),i.__metadata("design:returntype",void 0)],l.prototype,"initialize",null),l=i.__decorate([c.injectable(),i.__param(0,c.inject(s.ServiceIdentifiers.IRandomGenerator)),i.__param(1,c.inject(s.ServiceIdentifiers.IOptions)),i.__metadata("design:paramtypes",[Object,Object])],l),t.ArrayStorage=l},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(1),a=r(148),i=r(149),c=r(152),s=r(45);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: --option-name '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(23);t.IdentifierNamesGeneratorSanitizer=function(e){if(!Object.keys(n.IdentifierNamesGenerator).some(function(t){return n.IdentifierNamesGenerator[t]===e}))throw new ReferenceError("Invalid value of `--identifier-names-generator` option");return 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(24);t.SourceMapModeSanitizer=function(e){if(!Object.keys(n.SourceMapMode).some(function(t){return n.SourceMapMode[t]===e}))throw new ReferenceError("Invalid value of `--source-map-mode` option");return e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(25);t.StringArrayEncodingSanitizer=function(e){switch(e){case"true":case"1":case n.StringArrayEncoding.Base64:return!0;case n.StringArrayEncoding.Rc4:return n.StringArrayEncoding.Rc4;default:return!1}}},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:"";return t&&(e=e.substring(0,e.lastIndexOf("/"))+"/"+t),/\.js\.map$/.test(e)?/\.js$/.test(e)&&(e+=".map"):e=e.split(".")[0]+".js.map",e}},{key:"getUserConfig",value:function(e){var t=void 0;try{t=!function(){var e=new Error('Cannot find module "."');throw e.code="MODULE_NOT_FOUND",e}()}catch(r){try{t=require(e)}catch(e){throw new ReferenceError("Given config path must be a valid file path")}}return t}},{key:"writeFile",value:function(e,t){i.sync(c.dirname(e)),a.writeFileSync(e,t,{encoding:s.JavaScriptObfuscatorCLI.encoding})}}]),e}();t.CLIUtils=u},function(e,t){e.exports=require("mkdirp")},function(e,t){function r(e){throw new Error("Cannot find module '"+e+"'.")}r.keys=function(){return[]},r.resolve=r,e.exports=r,r.id=187},function(e,t,r){"use strict";function n(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t1&&void 0!==arguments[1]?arguments[1]:[];return i.readdirSync(t,s.JavaScriptObfuscatorCLI.encoding).forEach(function(o){var a=t+"/"+o;if(e.isDirectoryPath(a))r.push.apply(r,n(e.readDirectoryRecursive(a)));else if(e.isFilePath(a)&&e.isValidFile(o)){var c=i.readFileSync(a,s.JavaScriptObfuscatorCLI.encoding);r.push({filePath:a,content:c})}}),r}},{key:"readFile",value:function(t){if(!e.isValidFile(t))throw new ReferenceError("Input file must have .js extension");return i.readFileSync(t,s.JavaScriptObfuscatorCLI.encoding)}},{key:"isValidFile",value:function(e){return-1!==s.JavaScriptObfuscatorCLI.availableInputExtensions.indexOf(c.extname(e))&&!(-1!==e.indexOf(s.JavaScriptObfuscatorCLI.obfuscatedFilePrefix))}}]),e}();t.SourceCodeReader=u}]); +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=48)}([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__IDeadCodeInjectionCustomNode="Factory",e.Factory__IIdentifierNamesGenerator="Factory",e.Factory__IIdentifierObfuscatingReplacer="Factory",e.Factory__INodeGuard="Factory",e.Factory__INodeTransformer="Factory",e.Factory__IObfuscationResult="Factory",e.Factory__IObfuscatingReplacer="Factory",e.Factory__TControlFlowStorage="Factory",e.IArrayUtils="IArrayUtils",e.ICalleeDataExtractor="ICalleeDataExtractor",e.ICryptUtils="ICryptUtils",e.ICustomNode="ICustomNode",e.ICustomNodeGroup="ICustomNodeGroup",e.IControlFlowReplacer="IControlFlowReplacer",e.IEscapeSequenceEncoder="IEscapeSequenceEncoder",e.IIdentifierNamesGenerator="IIdentifierNamesGenerator",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(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]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=t.parentNode;if(!o)throw new ReferenceError("`parentNode` property of given node is `undefined`");return(u.NodeGuards.isProgramNode(t)||n&&u.NodeGuards.isNodeHasBlockScope(t,o))&&r.push(t),t!==o?e.getBlockScopesOfNodeRecursive(o,r,++n):r}}]),e}();t.NodeUtils=l},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(){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:"getMethodDefinitionNode",value:function(e,t,r,n){return{type:i.NodeType.MethodDefinition,key:e,value:t,kind:r,computed:n,static:!1,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){e.exports=require("estraverse")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e.ArrayExpression="ArrayExpression",e.ArrayPattern="ArrayPattern",e.ArrowFunctionExpression="ArrowFunctionExpression",e.AssignmentExpression="AssignmentExpression",e.AssignmentPattern="AssignmentPattern",e.AwaitExpression="AwaitExpression",e.BinaryExpression="BinaryExpression",e.BlockStatement="BlockStatement",e.BreakStatement="BreakStatement",e.CallExpression="CallExpression",e.CatchClause="CatchClause",e.ClassDeclaration="ClassDeclaration",e.ContinueStatement="ContinueStatement",e.ExpressionStatement="ExpressionStatement",e.FunctionDeclaration="FunctionDeclaration",e.FunctionExpression="FunctionExpression",e.Identifier="Identifier",e.IfStatement="IfStatement",e.LabeledStatement="LabeledStatement",e.Literal="Literal",e.LogicalExpression="LogicalExpression",e.MemberExpression="MemberExpression",e.MethodDefinition="MethodDefinition",e.ObjectExpression="ObjectExpression",e.ObjectPattern="ObjectPattern",e.Program="Program",e.Property="Property",e.RestElement="RestElement",e.ReturnStatement="ReturnStatement",e.Super="Super",e.SwitchCase="SwitchCase",e.SwitchStatement="SwitchStatement",e.TemplateLiteral="TemplateLiteral",e.TryStatement="TryStatement",e.UnaryExpression="UnaryExpression",e.UpdateExpression="UpdateExpression",e.VariableDeclaration="VariableDeclaration",e.VariableDeclarator="VariableDeclarator",e.WhileStatement="WhileStatement"}(t.NodeType||(t.NodeType={}))},function(e,t){e.exports=require("string-template")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e.BinaryExpressionFunctionNode="BinaryExpressionFunctionNode",e.BlockStatementControlFlowFlatteningNode="BlockStatementControlFlowFlatteningNode",e.CallExpressionControlFlowStorageCallNode="CallExpressionControlFlowStorageCallNode",e.CallExpressionFunctionNode="CallExpressionFunctionNode",e.ControlFlowStorageNode="ControlFlowStorageNode",e.ExpressionWithOperatorControlFlowStorageCallNode="ExpressionWithOperatorControlFlowStorageCallNode",e.LogicalExpressionFunctionNode="LogicalExpressionFunctionNode",e.StringLiteralControlFlowStorageCallNode="StringLiteralControlFlowStorageCallNode",e.StringLiteralNode="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;n3&&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:"insertNodeAfter",value:function(t,r,n){var o=e.getScopeNodeStatements(t).indexOf(n);e.insertNodeAtIndex(t,r,o+1)}},{key:"insertNodeAtIndex",value:function(t,r,o){e.validateScopeStatements(r)||(r=[]),r=e.parentizeScopeStatementsBeforeAppend(t,r),e.setScopeNodeStatements(t,[].concat(n(e.getScopeNodeStatements(t).slice(0,o)),n(r),n(e.getScopeNodeStatements(t).slice(o))))}},{key:"prependNode",value:function(t,r){e.validateScopeStatements(r)||(r=[]),r=e.parentizeScopeStatementsBeforeAppend(t,r),e.setScopeNodeStatements(t,[].concat(n(r),n(e.getScopeNodeStatements(t))))}},{key:"getScopeNodeStatements",value:function(e){return i.NodeGuards.isSwitchCaseNode(e)?e.consequent:e.body}},{key:"parentizeScopeStatementsBeforeAppend",value:function(e,t){return t.forEach(function(t){t.parentNode=e}),t}},{key:"setScopeNodeStatements",value:function(e,t){if(i.NodeGuards.isSwitchCaseNode(e))return void(e.consequent=t);e.body=t}},{key:"validateScopeStatements",value:function(e){return e.every(function(e){return!!e&&e.hasOwnProperty("type")})}}]),e}();t.NodeAppender=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e.AfterObfuscation="afterObfuscation",e.BeforeObfuscation="beforeObfuscation"}(t.ObfuscationEvent||(t.ObfuscationEvent={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e.BaseIdentifierObfuscatingReplacer="BaseIdentifierObfuscatingReplacer"}(t.IdentifierObfuscatingReplacer||(t.IdentifierObfuscatingReplacer={}))},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]:{},r=new i.InversifyContainerFacade;r.load(e,t);var n=r.get(a.ServiceIdentifiers.IJavaScriptObfuscator),o=n.obfuscate(e);return r.unload(),o}},{key:"runCLI",value:function(e){var t=new c.JavaScriptObfuscatorCLI(e);t.initialize(),t.run()}}]),e}();t.JavaScriptObfuscator=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e.ConsoleOutputDisableExpressionNode="ConsoleOutputDisableExpressionNode",e.DebugProtectionFunctionCallNode="DebugProtectionFunctionCallNode",e.DebugProtectionFunctionIntervalNode="DebugProtectionFunctionIntervalNode",e.DebugProtectionFunctionNode="DebugProtectionFunctionNode",e.DomainLockNode="DomainLockNode",e.NodeCallsControllerFunctionNode="NodeCallsControllerFunctionNode",e.SelfDefendingUnicodeNode="SelfDefendingUnicodeNode",e.StringArrayCallsWrapper="StringArrayCallsWrapper",e.StringArrayNode="StringArrayNode",e.StringArrayRotateFunctionNode="StringArrayRotateFunctionNode"}(t.CustomNode||(t.CustomNode={}))},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var r=0;r-1||0===e.indexOf("//")?e.split("/")[2]:e.split("/")[0],t=t.split(":")[0]}},{key:"isCeilNumber",value:function(e){return e%1==0}},{key:"stringRotate",value:function(e,t){if(!e)throw new ReferenceError("Cannot rotate empty string.");for(var r=0;r [options]").version(c.version,"-v, --version").option("-o, --output ","Output path for obfuscated code").option("--compact ","Disable one line output code compacting",d.BooleanSanitizer).option("--config ","Name of js / json config file").option("--control-flow-flattening ","Enables control flow flattening",d.BooleanSanitizer).option("--control-flow-flattening-threshold ","The probability that the control flow flattening transformation will be applied to the node",parseFloat).option("--dead-code-injection ","Enables dead code injection",d.BooleanSanitizer).option("--dead-code-injection-threshold ","The probability that the dead code injection transformation will be applied to the node",parseFloat).option("--debug-protection ","Disable browser Debug panel (can cause DevTools enabled browser freeze)",d.BooleanSanitizer).option("--debug-protection-interval ","Disable browser Debug panel even after page was loaded (can cause DevTools enabled browser freeze)",d.BooleanSanitizer).option("--disable-console-output ","Allow console.log, console.info, console.error and console.warn messages output into browser console",d.BooleanSanitizer).option("--domain-lock (comma separated, without whitespaces)","Blocks the execution of the code in domains that do not match the passed RegExp patterns (comma separated)",f.ArraySanitizer).option("--identifier-names-generator [hexadecimal, mangled]","Sets identifier names generator (Default: hexadecimal)",p.IdentifierNamesGeneratorSanitizer).option("--log ","Enables logging of the information to the console",d.BooleanSanitizer).option("--reserved-names (comma separated, without whitespaces)","Disable obfuscation of variable names, function names and names of function parameters that match the passed RegExp patterns (comma separated)",f.ArraySanitizer).option("--rename-globals ","Allows to enable obfuscation of global variable and function names with declaration.",d.BooleanSanitizer).option("--rotate-string-array ","Disable rotation of unicode array values during obfuscation",d.BooleanSanitizer).option("--seed ","Sets seed for random generator. This is useful for creating repeatable results.",parseFloat).option("--self-defending ","Disables self-defending for obfuscated code",d.BooleanSanitizer).option("--source-map ","Enables source map generation",d.BooleanSanitizer).option("--source-map-base-url ","Sets base url to the source map import url when `--source-map-mode=separate`").option("--source-map-file-name ","Sets file name for output source map when `--source-map-mode=separate`").option("--source-map-mode [inline, separate]","Specify source map output mode",y.SourceMapModeSanitizer).option("--string-array ","Disables gathering of all literal strings into an array and replacing every literal string with an array call",d.BooleanSanitizer).option("--string-array-encoding [true, false, base64, rc4]","Encodes all strings in strings array using base64 or rc4 (this option can slow down your code speed",b.StringArrayEncodingSanitizer).option("--string-array-threshold ","The probability that the literal string will be inserted into stringArray (Default: 0.8, Min: 0, Max: 1)",parseFloat).option("--target ","Allows to set target environment for obfuscated code.",m.ObfuscationTargetSanitizer).option("--transform-object-keys ","Enables transformation of object keys",d.BooleanSanitizer).option("--unicode-escape-sequence ","Allows to enable/disable string conversion to unicode escape sequence",d.BooleanSanitizer).parse(this.rawArguments)}},{key:"configureHelp",value:function(){this.commands.on("--help",function(){console.log(" Examples:\n"),console.log(" %> javascript-obfuscator input_file_name.js --compact true --self-defending false"),console.log(" %> javascript-obfuscator input_file_name.js --output output_file_name.js --compact true --self-defending false"),console.log(" %> javascript-obfuscator input_directory_name --compact true --self-defending false"),console.log("")})}},{key:"processSourceCodeData",value:function(e){var t=this,r=this.inputCLIOptions.output?s.normalize(this.inputCLIOptions.output):"";if(Array.isArray(e))e.forEach(function(e){var n=e.filePath,o=e.content,a=r?s.join(r,n):g.CLIUtils.getOutputCodePath(n);t.processSourceCode(o,a)});else{var n=r||g.CLIUtils.getOutputCodePath(this.inputPath);this.processSourceCode(e,n)}}},{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=v.JavaScriptObfuscator.obfuscate(e,r).getObfuscatedCode();g.CLIUtils.writeFile(t,n)}},{key:"processSourceCodeWithSourceMap",value:function(e,t,r){var n=g.CLIUtils.getOutputSourceMapPath(t,r.sourceMapFileName||"");r=Object.assign({},r,{sourceMapFileName:s.basename(n)});var o=v.JavaScriptObfuscator.obfuscate(e,r);g.CLIUtils.writeFile(t,o.getObfuscatedCode()),"separate"===r.sourceMapMode&&o.getSourceMap()&&g.CLIUtils.writeFile(n,o.getSourceMap())}}]),e}();_.availableInputExtensions=[".js"],_.encoding="utf8",_.obfuscatedFilePrefix="-obfuscated",a.__decorate([u.initializable(),a.__metadata("design:type",Object)],_.prototype,"commands",void 0),a.__decorate([u.initializable(),a.__metadata("design:type",Object)],_.prototype,"inputCLIOptions",void 0),a.__decorate([u.initializable(),a.__metadata("design:type",String)],_.prototype,"inputPath",void 0),t.JavaScriptObfuscatorCLI=_},function(e,t){e.exports=require("path")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e.FunctionDeclarationCalleeDataExtractor="FunctionDeclarationCalleeDataExtractor",e.FunctionExpressionCalleeDataExtractor="FunctionExpressionCalleeDataExtractor",e.ObjectExpressionCalleeDataExtractor="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.BinaryExpressionControlFlowReplacer="BinaryExpressionControlFlowReplacer",e.CallExpressionControlFlowReplacer="CallExpressionControlFlowReplacer",e.LogicalExpressionControlFlowReplacer="LogicalExpressionControlFlowReplacer",e.StringLiteralControlFlowReplacer="StringLiteralControlFlowReplacer"}(t.ControlFlowReplacer||(t.ControlFlowReplacer={}))},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;r1&&void 0!==arguments[1]&&arguments[1];this.storage=new Map([].concat(n(this.storage),n(e.getStorage()))),t&&(this.storageId=e.getStorageId())}},{key:"set",value:function(e,t){this.storage.set(e,t)}}]),e}();c.__decorate([l.initializable(),c.__metadata("design:type",String)],f.prototype,"storageId",void 0),c.__decorate([l.initializable(),c.__metadata("design:type",Map)],f.prototype,"storage",void 0),c.__decorate([s.postConstruct(),c.__metadata("design:type",Function),c.__metadata("design:paramtypes",[]),c.__metadata("design:returntype",void 0)],f.prototype,"initialize",null),f=c.__decorate([s.injectable(),c.__param(0,s.inject(u.ServiceIdentifiers.IRandomGenerator)),c.__param(1,s.inject(u.ServiceIdentifiers.IOptions)),c.__metadata("design:paramtypes",[Object,Object])],f),t.MapStorage=f},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:d.randomGeneratorPool;return this.getRandomGenerator().string({length:e,pool:t})}},{key:"getSeed",value:function(){return this.seed}}]),e}();f.randomGeneratorPool="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",f.randomGeneratorPoolNumbers="0123456789",f.randomGeneratorPoolHexadecimal="abcdef"+d.randomGeneratorPoolNumbers,a.__decorate([l.initializable(),a.__metadata("design:type",Object)],f.prototype,"randomGenerator",void 0),a.__decorate([l.initializable(),a.__metadata("design:type",Number)],f.prototype,"seed",void 0),a.__decorate([i.postConstruct(),a.__metadata("design:type",Function),a.__metadata("design:paramtypes",[]),a.__metadata("design:returntype",void 0)],f.prototype,"initialize",null),f=d=a.__decorate([i.injectable(),a.__param(0,i.inject(c.ServiceIdentifiers.ISourceCode)),a.__param(1,i.inject(c.ServiceIdentifiers.IOptions)),a.__metadata("design:paramtypes",[Object,Object])],f),t.RandomGenerator=f;var d},function(e,t){e.exports=require("pjson")},function(e,t){e.exports=require("fs")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(19);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(51),s=r(52),u=r(53),l=r(54);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(15),s=r(56),u=r(57),l=r(58),f=r(59),d=r(60),p=r(61),m=r(62);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(m.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||!b.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);i.initialize(r,o,a);var c=i.getNode()[0];return m.NodeUtils.parentizeNode(c,t),c}}],[{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)&&b.blockStatementHasProhibitedStatements(e)&&(t=!1)}}),e.body.length<=4&&(t=!1),t}}]),t}(d.AbstractNodeTransformer);y=b=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 b},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===p.NodeType.Program)return e;var r=this.collectedBlockStatements.length-1,n=this.randomGenerator.getRandomInteger(0,r),o=this.collectedBlockStatements.splice(n,1)[0];return o===e?e:this.replaceBlockStatementNode(e,o,t)}},{key:"collectBlockStatementNodes",value:function(e,t,r){var n=b.NodeUtils.clone(e),o=0,a=!0;l.replace(n,{enter:function(e){return y.NodeGuards.isBlockStatementNode(e)&&o++,o>v.maxNestedBlockStatementsCount||!v.isValidBlockStatementNode(e)?(a=!1,l.VisitorOption.Break):e}}),a&&(b.NodeUtils.parentizeNode(n,r),n=this.transformersRunner.transform(n,v.transformersToRenameBlockScopeIdentifiers),t.push(n))}},{key:"replaceBlockStatementNode",value:function(e,t,r){var n=this.deadCodeInjectionCustomNodeFactory(f.DeadCodeInjectionCustomNode.BlockStatementDeadCodeInjectionNode);n.initialize(e,t);var o=n.getNode()[0];return b.NodeUtils.parentizeNode(o,r),o}}],[{key:"isValidBlockStatementNode",value:function(e){return!(y.NodeGuards.isBreakStatementNode(e)||y.NodeGuards.isContinueStatementNode(e)||y.NodeGuards.isAwaitExpressionNode(e)||y.NodeGuards.isSuperNode(e))}}]),t}(m.AbstractNodeTransformer);g.maxNestedBlockStatementsCount=4,g.minCollectedBlockStatementsCount=5,g.transformersToRenameBlockScopeIdentifiers=[d.NodeTransformer.CatchClauseTransformer,d.NodeTransformer.ClassDeclarationTransformer,d.NodeTransformer.FunctionDeclarationTransformer,d.NodeTransformer.FunctionTransformer,d.NodeTransformer.LabeledStatementTransformer,d.NodeTransformer.VariableDeclarationTransformer],g=v=c.__decorate([s.injectable(),c.__param(0,s.inject(u.ServiceIdentifiers.Factory__IDeadCodeInjectionCustomNode)),c.__param(1,s.inject(u.ServiceIdentifiers.ITransformersRunner)),c.__param(2,s.inject(u.ServiceIdentifiers.IRandomGenerator)),c.__param(3,s.inject(u.ServiceIdentifiers.IOptions)),c.__metadata("design:paramtypes",[Function,Object,Object,Object])],g),t.DeadCodeInjectionTransformer=g;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;rh.hostNodeSearchMinDepth&&t.splice(0,h.hostNodeSearchMinDepth),t.length>h.hostNodeSearchMaxDepth&&(t.length=h.hostNodeSearchMaxDepth),this.randomGenerator.getRandomGenerator().pickone(t))}},{key:"isVisitedFunctionNode",value:function(e){return(y.NodeGuards.isFunctionDeclarationNode(e)||y.NodeGuards.isFunctionExpressionNode(e)||y.NodeGuards.isArrowFunctionExpressionNode(e))&&this.visitedFunctionNodes.has(e)}},{key:"transformFunctionBody",value:function(e,t){var r=this;l.replace(e,{enter:function(e,n){if(e.ignoredNode)return l.VisitorOption.Skip;if(r.isVisitedFunctionNode(e)||!n)return l.VisitorOption.Skip;if(!h.controlFlowReplacersMap.has(e.type))return e;if(r.randomGenerator.getMathRandom()>r.options.controlFlowFlatteningThreshold)return e;var o=h.controlFlowReplacersMap.get(e.type);return void 0===o?e:Object.assign({},r.controlFlowReplacerFactory(o).replace(e,n,t),{parentNode:n})}})}}]),t}(m.AbstractNodeTransformer);v.controlFlowReplacersMap=new Map([[p.NodeType.BinaryExpression,d.ControlFlowReplacer.BinaryExpressionControlFlowReplacer],[p.NodeType.CallExpression,d.ControlFlowReplacer.CallExpressionControlFlowReplacer],[p.NodeType.LogicalExpression,d.ControlFlowReplacer.LogicalExpressionControlFlowReplacer],[p.NodeType.Literal,d.ControlFlowReplacer.StringLiteralControlFlowReplacer]]),v.hostNodeSearchMinDepth=0,v.hostNodeSearchMaxDepth=2,v=h=c.__decorate([s.injectable(),c.__param(0,s.inject(u.ServiceIdentifiers.Factory__TControlFlowStorage)),c.__param(1,s.inject(u.ServiceIdentifiers.Factory__IControlFlowReplacer)),c.__param(2,s.inject(u.ServiceIdentifiers.Factory__IControlFlowCustomNode)),c.__param(3,s.inject(u.ServiceIdentifiers.IRandomGenerator)),c.__param(4,s.inject(u.ServiceIdentifiers.IOptions)),c.__metadata("design:paramtypes",[Function,Function,Function,Object,Object])],v),t.FunctionControlFlowTransformer=v;var h},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;r1){var o=d.Nodes.getBinaryExpressionNode("+",n.shift(),n.shift());return n.forEach(function(e){o=d.Nodes.getBinaryExpressionNode("+",o,e)}),o}return n[0]}}],[{key:"isLiteralNodeWithStringValue",value:function(e){return e&&f.NodeGuards.isLiteralNode(e)&&"string"==typeof e.value}}]),t}(l.AbstractNodeTransformer);p=m=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 m},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(40),u=r(39),l=r(69),f=r(70),d=r(71),p=r(72),m=r(73),y=r(74),b=r(77),g=r(78),v=r(79),h=r(80),_=r(81),N=r(82),O=r(84),S=r(86),j=r(88),C=r(92),w=r(94),I=r(95),T=r(96),E=r(98),F=r(100),k=r(107),P=r(109),x=r(113),R=r(114);t.customNodesModule=new o.ContainerModule(function(e){e(a.ServiceIdentifiers.ICustomNode).to(N.ConsoleOutputDisableExpressionNode).whenTargetNamed(c.CustomNode.ConsoleOutputDisableExpressionNode),e(a.ServiceIdentifiers.ICustomNode).to(O.DebugProtectionFunctionCallNode).whenTargetNamed(c.CustomNode.DebugProtectionFunctionCallNode),e(a.ServiceIdentifiers.ICustomNode).to(S.DebugProtectionFunctionIntervalNode).whenTargetNamed(c.CustomNode.DebugProtectionFunctionIntervalNode),e(a.ServiceIdentifiers.ICustomNode).to(j.DebugProtectionFunctionNode).whenTargetNamed(c.CustomNode.DebugProtectionFunctionNode),e(a.ServiceIdentifiers.ICustomNode).to(C.DomainLockNode).whenTargetNamed(c.CustomNode.DomainLockNode),e(a.ServiceIdentifiers.ICustomNode).to(T.NodeCallsControllerFunctionNode).whenTargetNamed(c.CustomNode.NodeCallsControllerFunctionNode),e(a.ServiceIdentifiers.ICustomNode).to(E.SelfDefendingUnicodeNode).whenTargetNamed(c.CustomNode.SelfDefendingUnicodeNode),e(a.ServiceIdentifiers.ICustomNode).to(F.StringArrayCallsWrapper).whenTargetNamed(c.CustomNode.StringArrayCallsWrapper),e(a.ServiceIdentifiers.ICustomNode).to(k.StringArrayNode).whenTargetNamed(c.CustomNode.StringArrayNode),e(a.ServiceIdentifiers.ICustomNode).to(P.StringArrayRotateFunctionNode).whenTargetNamed(c.CustomNode.StringArrayRotateFunctionNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(y.BinaryExpressionFunctionNode).whenTargetNamed(i.ControlFlowCustomNode.BinaryExpressionFunctionNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(b.BlockStatementControlFlowFlatteningNode).whenTargetNamed(i.ControlFlowCustomNode.BlockStatementControlFlowFlatteningNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(v.CallExpressionControlFlowStorageCallNode).whenTargetNamed(i.ControlFlowCustomNode.CallExpressionControlFlowStorageCallNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(h.CallExpressionFunctionNode).whenTargetNamed(i.ControlFlowCustomNode.CallExpressionFunctionNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(_.ControlFlowStorageNode).whenTargetNamed(i.ControlFlowCustomNode.ControlFlowStorageNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(w.ExpressionWithOperatorControlFlowStorageCallNode).whenTargetNamed(i.ControlFlowCustomNode.ExpressionWithOperatorControlFlowStorageCallNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(I.LogicalExpressionFunctionNode).whenTargetNamed(i.ControlFlowCustomNode.LogicalExpressionFunctionNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(R.StringLiteralNode).whenTargetNamed(i.ControlFlowCustomNode.StringLiteralNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(x.StringLiteralControlFlowStorageCallNode).whenTargetNamed(i.ControlFlowCustomNode.StringLiteralControlFlowStorageCallNode),e(a.ServiceIdentifiers.Newable__ICustomNode).toConstructor(g.BlockStatementDeadCodeInjectionNode).whenTargetNamed(u.DeadCodeInjectionCustomNode.BlockStatementDeadCodeInjectionNode),e(a.ServiceIdentifiers.ICustomNodeGroup).to(l.ConsoleOutputCustomNodeGroup).whenTargetNamed(s.CustomNodeGroup.ConsoleOutputCustomNodeGroup),e(a.ServiceIdentifiers.ICustomNodeGroup).to(f.DebugProtectionCustomNodeGroup).whenTargetNamed(s.CustomNodeGroup.DebugProtectionCustomNodeGroup),e(a.ServiceIdentifiers.ICustomNodeGroup).to(d.DomainLockCustomNodeGroup).whenTargetNamed(s.CustomNodeGroup.DomainLockCustomNodeGroup),e(a.ServiceIdentifiers.ICustomNodeGroup).to(p.SelfDefendingCustomNodeGroup).whenTargetNamed(s.CustomNodeGroup.SelfDefendingCustomNodeGroup),e(a.ServiceIdentifiers.ICustomNodeGroup).to(m.StringArrayCustomNodeGroup).whenTargetNamed(s.CustomNodeGroup.StringArrayCustomNodeGroup),e(a.ServiceIdentifiers.Factory__ICustomNode).toFactory(n.InversifyContainerFacade.getFactory(a.ServiceIdentifiers.ICustomNode)),e(a.ServiceIdentifiers.Factory__IControlFlowCustomNode).toFactory(n.InversifyContainerFacade.getConstructorFactory(a.ServiceIdentifiers.Newable__ICustomNode,a.ServiceIdentifiers.Factory__IIdentifierNamesGenerator,a.ServiceIdentifiers.IRandomGenerator,a.ServiceIdentifiers.IOptions)),e(a.ServiceIdentifiers.Factory__IDeadCodeInjectionCustomNode).toFactory(n.InversifyContainerFacade.getConstructorFactory(a.ServiceIdentifiers.Newable__ICustomNode,a.ServiceIdentifiers.Factory__IIdentifierNamesGenerator,a.ServiceIdentifiers.IRandomGenerator,a.ServiceIdentifiers.IOptions)),e(a.ServiceIdentifiers.Factory__ICustomNodeGroup).toFactory(n.InversifyContainerFacade.getFactory(a.ServiceIdentifiers.ICustomNodeGroup))})},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;r.5,t=this.randomGenerator.getMathRandom()>.5,r=e?"===":"!==",n=this.randomGenerator.getRandomString(5),o=t?n:this.randomGenerator.getRandomString(5),a=e===t?[this.blockStatementNode,this.randomBlockStatementNode]:[this.randomBlockStatementNode,this.blockStatementNode],c=i(a,2),s=c[0],u=c[1],l=p.Nodes.getBlockStatementNode([p.Nodes.getIfStatementNode(p.Nodes.getBinaryExpressionNode(r,p.Nodes.getLiteralNode(n),p.Nodes.getLiteralNode(o)),s,u)]);return m.NodeUtils.parentize(l),[l]}}]),t}(d.AbstractCustomNode);s.__decorate([f.initializable(),s.__metadata("design:type",Object)],y.prototype,"blockStatementNode",void 0),s.__decorate([f.initializable(),s.__metadata("design:type",Object)],y.prototype,"randomBlockStatementNode",void 0),y=s.__decorate([u.injectable(),s.__param(0,u.inject(l.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),s.__param(1,u.inject(l.ServiceIdentifiers.IRandomGenerator)),s.__param(2,u.inject(l.ServiceIdentifiers.IOptions)),s.__metadata("design:paramtypes",[Function,Object,Object])],y),t.BlockStatementDeadCodeInjectionNode=y},function(e,t,r){"use strict";function n(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t 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,t){var r=e.getRandomString(6),n=e.getRandomString(6),o=e.getRandomString(6),a=e.getRandomString(6),i=e.getRandomString(6),c=e.getRandomString(6),s=e.getRandomString(6),u=e.getRandomString(6),l=e.getRandomString(6);return"\n var StatesClass = function ("+r+") {\n this."+r+" = "+r+";\n this."+n+" = [1, 0, 0];\n this."+o+" = function(){return 'newState';};\n this."+a+" = '"+t.encode("\\w+ *\\(\\) *{\\w+ *",!0)+"';\n this."+i+" = '"+t.encode("['|\"].+['|\"];? *}",!0)+"';\n };\n \n StatesClass.prototype."+c+" = function () {\n var regExp = new RegExp(this."+a+" + this."+i+");\n var expression = regExp.test(this."+o+".toString())\n ? --this."+n+"[1]\n : --this."+n+"[0];\n \n return this."+s+"(expression);\n };\n \n StatesClass.prototype."+s+" = function ("+l+") {\n if (!Boolean(~"+l+")) {\n return "+l+";\n }\n \n return this."+u+"(this."+r+");\n };\n\n StatesClass.prototype."+u+" = function ("+r+") {\n for (var i = 0, len = this."+n+".length; i < len; i++) {\n this."+n+".push(Math.round(Math.random()));\n len = this."+n+".length;\n }\n \n return "+r+"(this."+n+"[0]);\n };\n\n new StatesClass({stringArrayCallsWrapperName})."+c+"();\n "}Object.defineProperty(t,"__esModule",{value:!0}),t.SelfDefendingTemplate=n},function(e,t,r){"use strict";function n(e){var t=e.getRandomString(6),r=e.getRandomString(6),n=e.getRandomString(6);return"\n if ({stringArrayCallsWrapperName}."+t+" === undefined) {\n {atobPolyfill}\n \n {stringArrayCallsWrapperName}."+r+" = 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}."+n+" = {};\n \n {stringArrayCallsWrapperName}."+t+" = true;\n }\n \n var cachedValue = {stringArrayCallsWrapperName}."+n+"[index];\n \n if (cachedValue === undefined) {\n {selfDefendingCode}\n \n value = {stringArrayCallsWrapperName}."+r+"(value);\n {stringArrayCallsWrapperName}."+n+"[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(e){var t=e.getRandomString(6),r=e.getRandomString(6),n=e.getRandomString(6),o=e.getRandomString(6);return"\n if ({stringArrayCallsWrapperName}."+t+" === undefined) {\n {atobPolyfill}\n \n {rc4Polyfill}\n {stringArrayCallsWrapperName}."+r+" = rc4;\n \n {stringArrayCallsWrapperName}."+n+" = {};\n \n {stringArrayCallsWrapperName}."+t+" = true;\n }\n \n var cachedValue = {stringArrayCallsWrapperName}."+n+"[index];\n\n if (cachedValue === undefined) {\n if ({stringArrayCallsWrapperName}."+o+" === undefined) {\n {selfDefendingCode}\n \n {stringArrayCallsWrapperName}."+o+" = true;\n }\n \n value = {stringArrayCallsWrapperName}."+r+"(value, key);\n {stringArrayCallsWrapperName}."+n+"[index] = value;\n } else {\n value = cachedValue;\n }\n "}Object.defineProperty(t,"__esModule",{value:!0}),t.StringArrayRc4DecodeNodeTemplate=n},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;r=0);return"a"+o(n)}(e);return d.validateMangledName(t)||(t=d.generateNewMangledName(t)),t}},{key:"validateMangledName",value:function(e){return!(-1!==d.reservedNames.indexOf(e))}}]),t}(l.AbstractIdentifierNamesGenerator);f.initMangledNameCharacter="9",f.nameSequence="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),f.reservedNames=["byte","case","char","do","else","enum","eval","for","goto","if","in","int","let","long","new","null","this","true","try","var","void","with"],f=d=c.__decorate([s.injectable(),c.__param(0,s.inject(u.ServiceIdentifiers.IRandomGenerator)),c.__param(1,s.inject(u.ServiceIdentifiers.IOptions)),c.__metadata("design:paramtypes",[Object,Object])],f),t.MangledIdentifierNamesGenerator=f;var d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(14),o=r(0),a=r(1);t.nodeTransformersModule=new o.ContainerModule(function(e){e(a.ServiceIdentifiers.Factory__INodeTransformer).toFactory(n.InversifyContainerFacade.getCacheFactory(a.ServiceIdentifiers.INodeTransformer))})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(14),o=r(0),a=r(1),i=r(18),c=r(42),s=r(15),u=r(123),l=r(124),f=r(125),d=r(126),p=r(127),m=r(128),y=r(129),b=r(130),g=r(131),v=r(132),h=r(133),_=r(134);t.obfuscatingTransformersModule=new o.ContainerModule(function(e){e(a.ServiceIdentifiers.INodeTransformer).to(f.CatchClauseTransformer).whenTargetNamed(s.NodeTransformer.CatchClauseTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(d.ClassDeclarationTransformer).whenTargetNamed(s.NodeTransformer.ClassDeclarationTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(p.FunctionDeclarationTransformer).whenTargetNamed(s.NodeTransformer.FunctionDeclarationTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(m.FunctionTransformer).whenTargetNamed(s.NodeTransformer.FunctionTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(y.LabeledStatementTransformer).whenTargetNamed(s.NodeTransformer.LabeledStatementTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(b.LiteralTransformer).whenTargetNamed(s.NodeTransformer.LiteralTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(v.ObjectExpressionTransformer).whenTargetNamed(s.NodeTransformer.ObjectExpressionTransformer),e(a.ServiceIdentifiers.INodeTransformer).to(_.VariableDeclarationTransformer).whenTargetNamed(s.NodeTransformer.VariableDeclarationTransformer),e(a.ServiceIdentifiers.IObfuscatingReplacer).to(l.BooleanLiteralObfuscatingReplacer).whenTargetNamed(c.LiteralObfuscatingReplacer.BooleanLiteralObfuscatingReplacer),e(a.ServiceIdentifiers.IObfuscatingReplacer).to(g.NumberLiteralObfuscatingReplacer).whenTargetNamed(c.LiteralObfuscatingReplacer.NumberLiteralObfuscatingReplacer),e(a.ServiceIdentifiers.IObfuscatingReplacer).to(h.StringLiteralObfuscatingReplacer).whenTargetNamed(c.LiteralObfuscatingReplacer.StringLiteralObfuscatingReplacer),e(a.ServiceIdentifiers.IIdentifierObfuscatingReplacer).to(u.BaseIdentifierObfuscatingReplacer).whenTargetNamed(i.IdentifierObfuscatingReplacer.BaseIdentifierObfuscatingReplacer),e(a.ServiceIdentifiers.Factory__IObfuscatingReplacer).toFactory(n.InversifyContainerFacade.getCacheFactory(a.ServiceIdentifiers.IObfuscatingReplacer)),e(a.ServiceIdentifiers.Factory__IIdentifierObfuscatingReplacer).toFactory(n.InversifyContainerFacade.getCacheFactory(a.ServiceIdentifiers.IIdentifierObfuscatingReplacer))})},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;r=y.minimumLengthForStringArray&&this.randomGenerator.getMathRandom()<=this.options.stringArrayThreshold}},{key:"getStringArrayHexadecimalIndex",value:function(e,t){if(this.stringLiteralHexadecimalIndexCache.has(e))return{fromCache:!0,index:this.stringLiteralHexadecimalIndexCache.get(e)};var r=p.Utils.decToHex(t),n=""+p.Utils.hexadecimalPrefix+r;return this.stringLiteralHexadecimalIndexCache.set(e,n),{fromCache:!1,index:n}}},{key:"getEncodedValue",value:function(e){var t=void 0,r=null;switch(this.options.stringArrayEncoding){case l.StringArrayEncoding.Rc4:r=this.randomGenerator.getRandomGenerator().pickone(this.rc4Keys),t=this.cryptUtils.btoa(this.cryptUtils.rc4(e,r));break;case l.StringArrayEncoding.Base64:t=this.cryptUtils.btoa(e);break;default:t=e}return{encodedValue:t,key:r}}},{key:"replaceWithLiteralNode",value:function(e){return d.Nodes.getLiteralNode(this.escapeSequenceEncoder.encode(e,this.options.unicodeEscapeSequence))}},{key:"replaceWithStringArrayCallNode",value:function(e){var t=this.getEncodedValue(e),r=t.encodedValue,n=t.key,o=this.escapeSequenceEncoder.encode(r,this.options.unicodeEscapeSequence),a=this.stringArrayStorage.getLength(),i=this.stringArrayStorage.getStorageId().split("|")[1],c=this.getStringArrayHexadecimalIndex(o,a),s=c.fromCache,u=c.index;s||this.stringArrayStorage.set(a,o);var l=[y.getHexadecimalLiteralNode(u)];n&&l.push(y.getRc4KeyLiteralNode(this.escapeSequenceEncoder.encode(n,this.options.unicodeEscapeSequence)));var f=d.Nodes.getIdentifierNode(i);return f.obfuscatedNode=!0,d.Nodes.getCallExpressionNode(f,l)}}],[{key:"getHexadecimalLiteralNode",value:function(e){var t=d.Nodes.getLiteralNode(e);return t.obfuscatedNode=!0,t}},{key:"getRc4KeyLiteralNode",value:function(e){var t=d.Nodes.getLiteralNode(e);return t.obfuscatedNode=!0,t}}]),t}(f.AbstractObfuscatingReplacer);m.minimumLengthForStringArray=3,m.rc4KeyLength=4,m.rc4KeysCount=50,m=y=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])],m),t.StringLiteralObfuscatingReplacer=m;var y},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var r=0;r=0?t:null}},{key:"getLength",value:function(){return this.storageLength}},{key:"getStorage",value:function(){return this.storage}},{key:"getStorageId",value:function(){return this.storageId}},{key:"mergeWith",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.storage=[].concat(n(this.storage),n(e.getStorage())),t&&(this.storageId=e.getStorageId())}},{key:"set",value:function(e,t){e===this.storageLength?this.storage.push(t):this.storage.splice(e,0,t),this.storageLength++}}]),e}();i.__decorate([u.initializable(),i.__metadata("design:type",Array)],l.prototype,"storage",void 0),i.__decorate([u.initializable(),i.__metadata("design:type",String)],l.prototype,"storageId",void 0),i.__decorate([c.postConstruct(),i.__metadata("design:type",Function),i.__metadata("design:paramtypes",[]),i.__metadata("design:returntype",void 0)],l.prototype,"initialize",null),l=i.__decorate([c.injectable(),i.__param(0,c.inject(s.ServiceIdentifiers.IRandomGenerator)),i.__param(1,c.inject(s.ServiceIdentifiers.IOptions)),i.__metadata("design:paramtypes",[Object,Object])],l),t.ArrayStorage=l},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(1),a=r(148),i=r(149),c=r(152),s=r(45);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: --option-name '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(23);t.IdentifierNamesGeneratorSanitizer=function(e){if(!Object.keys(n.IdentifierNamesGenerator).some(function(t){return n.IdentifierNamesGenerator[t]===e}))throw new ReferenceError("Invalid value of `--identifier-names-generator` option");return 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(24);t.SourceMapModeSanitizer=function(e){if(!Object.keys(n.SourceMapMode).some(function(t){return n.SourceMapMode[t]===e}))throw new ReferenceError("Invalid value of `--source-map-mode` option");return e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(25);t.StringArrayEncodingSanitizer=function(e){switch(e){case"true":case"1":case n.StringArrayEncoding.Base64:return!0;case n.StringArrayEncoding.Rc4:return n.StringArrayEncoding.Rc4;default:return!1}}},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:"";return t&&(e=e.substring(0,e.lastIndexOf("/"))+"/"+t),/\.js\.map$/.test(e)?/\.js$/.test(e)&&(e+=".map"):e=e.split(".")[0]+".js.map",e}},{key:"getUserConfig",value:function(e){var t=void 0;try{t=!function(){var e=new Error('Cannot find module "."');throw e.code="MODULE_NOT_FOUND",e}()}catch(r){try{t=require(e)}catch(e){throw new ReferenceError("Given config path must be a valid file path")}}return t}},{key:"writeFile",value:function(e,t){i.sync(c.dirname(e)),a.writeFileSync(e,t,{encoding:s.JavaScriptObfuscatorCLI.encoding})}}]),e}();t.CLIUtils=u},function(e,t){e.exports=require("mkdirp")},function(e,t){function r(e){throw new Error("Cannot find module '"+e+"'.")}r.keys=function(){return[]},r.resolve=r,e.exports=r,r.id=187},function(e,t,r){"use strict";function n(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t1&&void 0!==arguments[1]?arguments[1]:[];return i.readdirSync(t,s.JavaScriptObfuscatorCLI.encoding).forEach(function(o){var a=t+"/"+o;if(e.isDirectoryPath(a))r.push.apply(r,n(e.readDirectoryRecursive(a)));else if(e.isFilePath(a)&&e.isValidFile(o)){var c=i.readFileSync(a,s.JavaScriptObfuscatorCLI.encoding);r.push({filePath:a,content:c})}}),r}},{key:"readFile",value:function(t){if(!e.isValidFile(t))throw new ReferenceError("Input file must have .js extension");return i.readFileSync(t,s.JavaScriptObfuscatorCLI.encoding)}},{key:"isValidFile",value:function(e){return-1!==s.JavaScriptObfuscatorCLI.availableInputExtensions.indexOf(c.extname(e))&&!(-1!==e.indexOf(s.JavaScriptObfuscatorCLI.obfuscatedFilePrefix))}}]),e}();t.SourceCodeReader=u}]); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/src/node-transformers/finalizing-transformers/AstToEvalCallExpressionTransformer.ts b/src/node-transformers/finalizing-transformers/AstToEvalCallExpressionTransformer.ts index 8b06c639..c65c287e 100644 --- a/src/node-transformers/finalizing-transformers/AstToEvalCallExpressionTransformer.ts +++ b/src/node-transformers/finalizing-transformers/AstToEvalCallExpressionTransformer.ts @@ -9,6 +9,7 @@ import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator'; import { IVisitor } from '../../interfaces/node-transformers/IVisitor'; import { AbstractNodeTransformer } from '../AbstractNodeTransformer'; +import { NodeGuards } from '../../node/NodeGuards'; import { Nodes } from '../../node/Nodes'; import { NodeUtils } from '../../node/NodeUtils'; @@ -30,8 +31,8 @@ export class AstToEvalCallExpressionTransformer extends AbstractNodeTransformer */ public getVisitor (): IVisitor { return { - enter: (node: ESTree.Node, parentNode: ESTree.Node | null) => { - if (parentNode && node.isEvalRoot) { + leave: (node: ESTree.Node, parentNode: ESTree.Node | null) => { + if (parentNode && node.isEvalRoot && NodeGuards.isFunctionDeclarationNode(node)) { return this.transformNode(node, parentNode); } } @@ -39,12 +40,13 @@ export class AstToEvalCallExpressionTransformer extends AbstractNodeTransformer } /** - * @param {ExpressionStatement} node + * @param {FunctionDeclaration} functionDeclaration * @param {Node} parentNode * @returns {Node} */ - public transformNode (node: ESTree.Node, parentNode: ESTree.Node): ESTree.Node { - const code: string = NodeUtils.convertStructureToCode([node]); + public transformNode (functionDeclaration: ESTree.FunctionDeclaration, parentNode: ESTree.Node): ESTree.Node { + const targetAst: ESTree.Statement[] = functionDeclaration.body.body; + const code: string = NodeUtils.convertStructureToCode(targetAst); return Nodes.getCallExpressionNode( Nodes.getIdentifierNode('eval'), diff --git a/src/node-transformers/preparing-transformers/EvaCallExpressionToAstTransformer.ts b/src/node-transformers/preparing-transformers/EvaCallExpressionToAstTransformer.ts index 92cf0c92..89ae2b74 100644 --- a/src/node-transformers/preparing-transformers/EvaCallExpressionToAstTransformer.ts +++ b/src/node-transformers/preparing-transformers/EvaCallExpressionToAstTransformer.ts @@ -63,10 +63,14 @@ export class EvalCallExpressionToAstTransformer extends AbstractNodeTransformer const code: string = callExpressionFirstArgument.value; const ast: TStatement[] = NodeUtils.convertCodeToStructure(code); - const programNode: ESTree.Program = Nodes.getProgramNode(ast); + const functionDeclaration: ESTree.FunctionDeclaration = Nodes.getFunctionDeclarationNode( + 'evalRoot', + [], + Nodes.getBlockStatementNode(ast) + ); - programNode.isEvalRoot = true; + functionDeclaration.isEvalRoot = true; - return programNode; + return functionDeclaration; } } diff --git a/test/dev/dev.ts b/test/dev/dev.ts index f4ed799e..fd8a1b0a 100644 --- a/test/dev/dev.ts +++ b/test/dev/dev.ts @@ -7,19 +7,17 @@ import { NO_ADDITIONAL_NODES_PRESET } from '../../src/options/presets/NoCustomNo let obfuscatedCode: string = JavaScriptObfuscator.obfuscate( ` (function(){ - function foo (bar) { - eval('console.log(bar, \\'baz\\');'); - console.log(eval('bar; console.log(\\'bark\\')')); + function foo (a, b) { + return eval('var c = a + b; eval(\\'a + c\\');'); + } - foo(1); + console.log(foo(1, 2)); })(); `, { ...NO_ADDITIONAL_NODES_PRESET, - compact: false, - stringArray: true, - stringArrayThreshold: 1 + compact: false } ).getObfuscatedCode(); diff --git a/test/functional-tests/node-transformers/finalizing-transformers/ast-to-eval-call-expression-transformer/AstToEvalCallExpressionTransformer.spec.ts b/test/functional-tests/node-transformers/finalizing-transformers/ast-to-eval-call-expression-transformer/AstToEvalCallExpressionTransformer.spec.ts index fd790413..232fb7cd 100644 --- a/test/functional-tests/node-transformers/finalizing-transformers/ast-to-eval-call-expression-transformer/AstToEvalCallExpressionTransformer.spec.ts +++ b/test/functional-tests/node-transformers/finalizing-transformers/ast-to-eval-call-expression-transformer/AstToEvalCallExpressionTransformer.spec.ts @@ -12,7 +12,7 @@ import { getRegExpMatch } from '../../../../helpers/getRegExpMatch'; describe('AstToEvalCallExpressionTransformer', () => { describe('variant #1: identifier reference', () => { const functionIdentifierRegExp: RegExp = /function *_0x(?:[a-f0-9]){4,6} *\((_0x(?:[a-f0-9]){4,6})\)/; - const variableReferenceIdentifierRegExp: RegExp = /eval *\('(_0x(?:[a-f0-9]){4,6});'\);/; + const evalExpressionRegExp: RegExp = /eval *\('(_0x(?:[a-f0-9]){4,6});'\);/; let functionIdentifierName: string | null, obfuscatedCode: string, @@ -30,11 +30,11 @@ describe('AstToEvalCallExpressionTransformer', () => { obfuscatedCode = obfuscationResult.getObfuscatedCode(); functionIdentifierName = getRegExpMatch(obfuscatedCode, functionIdentifierRegExp); - variableReferenceIdentifierName = getRegExpMatch(obfuscatedCode, variableReferenceIdentifierRegExp); + variableReferenceIdentifierName = getRegExpMatch(obfuscatedCode, evalExpressionRegExp); }); it('should obfuscate eval string', () => { - assert.match(obfuscatedCode, variableReferenceIdentifierRegExp); + assert.match(obfuscatedCode, evalExpressionRegExp); }); it('should correctly transform function parameter inside eval expression', () => { @@ -44,7 +44,7 @@ describe('AstToEvalCallExpressionTransformer', () => { describe('variant #2: call expression with identifier reference', () => { const functionIdentifierRegExp: RegExp = /function *_0x(?:[a-f0-9]){4,6} *\((_0x(?:[a-f0-9]){4,6})\)/; - const variableReferenceIdentifierRegExp: RegExp = /eval *\('console\[\\'log\\']\((_0x(?:[a-f0-9]){4,6})\);'\);/; + const evalExpressionRegExp: RegExp = /eval *\('console\[\\'log\\']\((_0x(?:[a-f0-9]){4,6})\);'\);/; let functionIdentifierName: string | null, obfuscatedCode: string, @@ -62,11 +62,11 @@ describe('AstToEvalCallExpressionTransformer', () => { obfuscatedCode = obfuscationResult.getObfuscatedCode(); functionIdentifierName = getRegExpMatch(obfuscatedCode, functionIdentifierRegExp); - variableReferenceIdentifierName = getRegExpMatch(obfuscatedCode, variableReferenceIdentifierRegExp); + variableReferenceIdentifierName = getRegExpMatch(obfuscatedCode, evalExpressionRegExp); }); it('should obfuscate eval string', () => { - assert.match(obfuscatedCode, variableReferenceIdentifierRegExp); + assert.match(obfuscatedCode, evalExpressionRegExp); }); it('should correctly transform function parameter inside eval expression', () => { @@ -75,7 +75,7 @@ describe('AstToEvalCallExpressionTransformer', () => { }); describe('variant #3: multiple statements in eval', () => { - const regExp: RegExp = /eval *\('_0x([a-f0-9]){4,6}; *\\n_0x([a-f0-9]){4,6};'\);/; + const regExp: RegExp = /eval *\('_0x([a-f0-9]){4,6}; *_0x([a-f0-9]){4,6};'\);/; let obfuscatedCode: string; @@ -127,7 +127,7 @@ describe('AstToEvalCallExpressionTransformer', () => { describe('variant #5: eval expression as argument', () => { const functionIdentifierRegExp: RegExp = /function *_0x(?:[a-f0-9]){4,6} *\((_0x(?:[a-f0-9]){4,6})\)/; - const variableReferenceIdentifierRegExp: RegExp = /console\['log']\(eval *\('(_0x(?:[a-f0-9]){4,6});'\)\);/; + const evalExpressionRegExp: RegExp = /console\['log']\(eval *\('(_0x(?:[a-f0-9]){4,6});'\)\);/; let functionIdentifierName: string | null, obfuscatedCode: string, @@ -145,11 +145,11 @@ describe('AstToEvalCallExpressionTransformer', () => { obfuscatedCode = obfuscationResult.getObfuscatedCode(); functionIdentifierName = getRegExpMatch(obfuscatedCode, functionIdentifierRegExp); - variableReferenceIdentifierName = getRegExpMatch(obfuscatedCode, variableReferenceIdentifierRegExp); + variableReferenceIdentifierName = getRegExpMatch(obfuscatedCode, evalExpressionRegExp); }); it('should obfuscate eval string', () => { - assert.match(obfuscatedCode, variableReferenceIdentifierRegExp); + assert.match(obfuscatedCode, evalExpressionRegExp); }); it('should correctly transform function parameter inside eval expression', () => { @@ -157,7 +157,83 @@ describe('AstToEvalCallExpressionTransformer', () => { }); }); - describe('variant #6: integration with control flow flattening', () => { + describe('variant #6: nested eval expressions', () => { + const functionIdentifierRegExp: RegExp = /function *_0x(?:[a-f0-9]){4,6} *\((_0x(?:[a-f0-9]){4,6}), *(_0x(?:[a-f0-9]){4,6})\)/; + const evalExpressionMatch: string = `` + + `eval *\\('` + + `var *(_0x(?:[a-f0-9]){4,6}) *= *(_0x(?:[a-f0-9]){4,6}) *\\+ *(_0x(?:[a-f0-9]){4,6});` + + `eval\\(\\\\'` + + `(_0x(?:[a-f0-9]){4,6}) *\\+ *(_0x(?:[a-f0-9]){4,6});` + + `\\\\'\\);` + + `'\\);` + + ``; + const evalExpressionRegExp: RegExp = new RegExp(evalExpressionMatch); + const expectedEvaluationResult: number = 4; + + let evaluationResult: number, + functionIdentifierAName: string | null, + functionIdentifierBName: string | null, + obfuscatedCode: string, + variableReferenceIdentifierAName1: string | null, + variableReferenceIdentifierAName2: string | null, + variableReferenceIdentifierBName: string | null, + variableReferenceIdentifierCName1: string | null, + variableReferenceIdentifierCName2: string | null; + + before(() => { + const code: string = readFileAsString(__dirname + '/fixtures/nested-eval-expressions.js'); + const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate( + code, + { + ...NO_ADDITIONAL_NODES_PRESET + } + ); + + obfuscatedCode = obfuscationResult.getObfuscatedCode(); + + functionIdentifierAName = getRegExpMatch(obfuscatedCode, functionIdentifierRegExp, 0); + functionIdentifierBName = getRegExpMatch(obfuscatedCode, functionIdentifierRegExp, 1); + + // parameter `a` reference inside parent eval expression + variableReferenceIdentifierAName1 = getRegExpMatch(obfuscatedCode, evalExpressionRegExp, 1); + // parameter `a` reference inside nested eval expression + variableReferenceIdentifierAName2 = getRegExpMatch(obfuscatedCode, evalExpressionRegExp, 3); + // parameter `b` reference inside parent eval expression + variableReferenceIdentifierBName = getRegExpMatch(obfuscatedCode, evalExpressionRegExp, 2); + // variable declaration `c` inside parent eval expression + variableReferenceIdentifierCName1 = getRegExpMatch(obfuscatedCode, evalExpressionRegExp, 0); + // variable `c` reference inside nested eval expression + variableReferenceIdentifierCName2 = getRegExpMatch(obfuscatedCode, evalExpressionRegExp, 4); + + evaluationResult = eval(obfuscatedCode); + }); + + it('should obfuscate eval string', () => { + assert.match(obfuscatedCode, evalExpressionRegExp); + }); + + it('should generate correct code', () => { + assert.equal(evaluationResult, expectedEvaluationResult); + }); + + it('match #1: should correctly transform function parameter `a` inside eval expression', () => { + assert.equal(functionIdentifierAName, variableReferenceIdentifierAName1); + }); + + it('match #2: should correctly transform function parameter `a` inside nested eval expression', () => { + assert.equal(functionIdentifierAName, variableReferenceIdentifierAName2); + }); + + it('match #3: should correctly transform function parameter `b` inside eval expression', () => { + assert.equal(functionIdentifierBName, variableReferenceIdentifierBName); + }); + + it('match #4: should correctly transform variable declaration and variable reference inside eval and nested eval expressions', () => { + assert.equal(variableReferenceIdentifierCName1, variableReferenceIdentifierCName2); + }); + }); + + describe('variant #7: integration with control flow flattening', () => { const variableMatch: string = '_0x([a-f0-9]){4,6}'; const controlFlowStorageNodeMatch: string = `` + `var *${variableMatch} *= *\\{` + diff --git a/test/functional-tests/node-transformers/finalizing-transformers/ast-to-eval-call-expression-transformer/fixtures/nested-eval-expressions.js b/test/functional-tests/node-transformers/finalizing-transformers/ast-to-eval-call-expression-transformer/fixtures/nested-eval-expressions.js new file mode 100644 index 00000000..2089ad35 --- /dev/null +++ b/test/functional-tests/node-transformers/finalizing-transformers/ast-to-eval-call-expression-transformer/fixtures/nested-eval-expressions.js @@ -0,0 +1,7 @@ +(function(){ + function foo (a, b) { + return eval('var c = a + b; eval(\'a + c\');'); + } + + return foo(1, 2); +})(); \ No newline at end of file