index.js 569 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861
  1. /*!
  2. Copyright (C) 2016-2018 Timofey Kachalov <[email protected]>
  3. Redistribution and use in source and binary forms, with or without
  4. modification, are permitted provided that the following conditions are met:
  5. * Redistributions of source code must retain the above copyright
  6. notice, this list of conditions and the following disclaimer.
  7. * Redistributions in binary form must reproduce the above copyright
  8. notice, this list of conditions and the following disclaimer in the
  9. documentation and/or other materials provided with the distribution.
  10. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  11. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  12. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  13. ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  14. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  15. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  16. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  17. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  18. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  19. THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  20. */
  21. require("source-map-support").install();
  22. module.exports =
  23. /******/ (function(modules) { // webpackBootstrap
  24. /******/ // The module cache
  25. /******/ var installedModules = {};
  26. /******/
  27. /******/ // The require function
  28. /******/ function __webpack_require__(moduleId) {
  29. /******/
  30. /******/ // Check if module is in cache
  31. /******/ if(installedModules[moduleId]) {
  32. /******/ return installedModules[moduleId].exports;
  33. /******/ }
  34. /******/ // Create a new module (and put it into the cache)
  35. /******/ var module = installedModules[moduleId] = {
  36. /******/ i: moduleId,
  37. /******/ l: false,
  38. /******/ exports: {}
  39. /******/ };
  40. /******/
  41. /******/ // Execute the module function
  42. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  43. /******/
  44. /******/ // Flag the module as loaded
  45. /******/ module.l = true;
  46. /******/
  47. /******/ // Return the exports of the module
  48. /******/ return module.exports;
  49. /******/ }
  50. /******/
  51. /******/
  52. /******/ // expose the modules object (__webpack_modules__)
  53. /******/ __webpack_require__.m = modules;
  54. /******/
  55. /******/ // expose the module cache
  56. /******/ __webpack_require__.c = installedModules;
  57. /******/
  58. /******/ // define getter function for harmony exports
  59. /******/ __webpack_require__.d = function(exports, name, getter) {
  60. /******/ if(!__webpack_require__.o(exports, name)) {
  61. /******/ Object.defineProperty(exports, name, {
  62. /******/ configurable: false,
  63. /******/ enumerable: true,
  64. /******/ get: getter
  65. /******/ });
  66. /******/ }
  67. /******/ };
  68. /******/
  69. /******/ // getDefaultExport function for compatibility with non-harmony modules
  70. /******/ __webpack_require__.n = function(module) {
  71. /******/ var getter = module && module.__esModule ?
  72. /******/ function getDefault() { return module['default']; } :
  73. /******/ function getModuleExports() { return module; };
  74. /******/ __webpack_require__.d(getter, 'a', getter);
  75. /******/ return getter;
  76. /******/ };
  77. /******/
  78. /******/ // Object.prototype.hasOwnProperty.call
  79. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  80. /******/
  81. /******/ // __webpack_public_path__
  82. /******/ __webpack_require__.p = "";
  83. /******/
  84. /******/ // Load entry module and return exports
  85. /******/ return __webpack_require__(__webpack_require__.s = 49);
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ([
  89. /* 0 */
  90. /***/ (function(module, exports) {
  91. module.exports = require("inversify");
  92. /***/ }),
  93. /* 1 */
  94. /***/ (function(module, exports, __webpack_require__) {
  95. "use strict";
  96. Object.defineProperty(exports, "__esModule", { value: true });
  97. var ServiceIdentifiers;
  98. (function (ServiceIdentifiers) {
  99. ServiceIdentifiers["Factory__ICalleeDataExtractor"] = "Factory<ICalleeDataExtractor>";
  100. ServiceIdentifiers["Factory__IControlFlowCustomNode"] = "Factory<IControlFlowCustomNode>";
  101. ServiceIdentifiers["Factory__IControlFlowReplacer"] = "Factory<IControlFlowReplacer>";
  102. ServiceIdentifiers["Factory__ICustomNode"] = "Factory<ICustomNode>";
  103. ServiceIdentifiers["Factory__ICustomNodeGroup"] = "Factory<ICustomNodeGroup>";
  104. ServiceIdentifiers["Factory__IDeadCodeInjectionCustomNode"] = "Factory<IDeadCodeInjectionCustomNode>";
  105. ServiceIdentifiers["Factory__IIdentifierNamesGenerator"] = "Factory<IIdentifierNamesGenerator>";
  106. ServiceIdentifiers["Factory__IIdentifierObfuscatingReplacer"] = "Factory<IIdentifierObfuscatingReplacer>";
  107. ServiceIdentifiers["Factory__INodeGuard"] = "Factory<INodeGuard>";
  108. ServiceIdentifiers["Factory__INodeTransformer"] = "Factory<INodeTransformer[]>";
  109. ServiceIdentifiers["Factory__IObfuscationResult"] = "Factory<IObfuscationResult>";
  110. ServiceIdentifiers["Factory__IObfuscatingReplacer"] = "Factory<IObfuscatingReplacer>";
  111. ServiceIdentifiers["Factory__TControlFlowStorage"] = "Factory<TControlFlowStorage>";
  112. ServiceIdentifiers["IArrayUtils"] = "IArrayUtils";
  113. ServiceIdentifiers["ICalleeDataExtractor"] = "ICalleeDataExtractor";
  114. ServiceIdentifiers["ICryptUtils"] = "ICryptUtils";
  115. ServiceIdentifiers["ICustomNode"] = "ICustomNode";
  116. ServiceIdentifiers["ICustomNodeGroup"] = "ICustomNodeGroup";
  117. ServiceIdentifiers["IControlFlowReplacer"] = "IControlFlowReplacer";
  118. ServiceIdentifiers["IEscapeSequenceEncoder"] = "IEscapeSequenceEncoder";
  119. ServiceIdentifiers["IIdentifierNamesGenerator"] = "IIdentifierNamesGenerator";
  120. ServiceIdentifiers["IIdentifierObfuscatingReplacer"] = "IIdentifierObfuscatingReplacer";
  121. ServiceIdentifiers["IJavaScriptObfuscator"] = "IJavaScriptObfuscator";
  122. ServiceIdentifiers["ILogger"] = "ILogger";
  123. ServiceIdentifiers["INodeGuard"] = "INodeGuard";
  124. ServiceIdentifiers["INodeTransformer"] = "INodeTransformer";
  125. ServiceIdentifiers["IObfuscationEventEmitter"] = "IObfuscationEventEmitter";
  126. ServiceIdentifiers["IObfuscationResult"] = "IObfuscationResult";
  127. ServiceIdentifiers["IOptions"] = "IOptions";
  128. ServiceIdentifiers["IObfuscatingReplacer"] = "IObfuscatingReplacer";
  129. ServiceIdentifiers["IRandomGenerator"] = "IRandomGenerator";
  130. ServiceIdentifiers["ISourceCode"] = "ISourceCode";
  131. ServiceIdentifiers["ISourceMapCorrector"] = "ISourceMapCorrector";
  132. ServiceIdentifiers["IStackTraceAnalyzer"] = "IStackTraceAnalyzer";
  133. ServiceIdentifiers["ITransformersRunner"] = "ITransformersRunner";
  134. ServiceIdentifiers["Newable__ICustomNode"] = "Newable<ICustomNode>";
  135. ServiceIdentifiers["Newable__TControlFlowStorage"] = "Newable<TControlFlowStorage>";
  136. ServiceIdentifiers["TCustomNodeGroupStorage"] = "TCustomNodeGroupStorage";
  137. ServiceIdentifiers["TStringArrayStorage"] = "TStringArrayStorage";
  138. })(ServiceIdentifiers = exports.ServiceIdentifiers || (exports.ServiceIdentifiers = {}));
  139. /***/ }),
  140. /* 2 */
  141. /***/ (function(module, exports) {
  142. module.exports = require("tslib");
  143. /***/ }),
  144. /* 3 */
  145. /***/ (function(module, exports, __webpack_require__) {
  146. "use strict";
  147. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  148. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  149. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  150. Object.defineProperty(exports, "__esModule", { value: true });
  151. var escodegen = __webpack_require__(30);
  152. var esprima = __webpack_require__(37);
  153. var estraverse = __webpack_require__(10);
  154. var NodeGuards_1 = __webpack_require__(4);
  155. var NodeUtils = function () {
  156. function NodeUtils() {
  157. _classCallCheck(this, NodeUtils);
  158. }
  159. _createClass(NodeUtils, null, [{
  160. key: "addXVerbatimPropertyToLiterals",
  161. value: function addXVerbatimPropertyToLiterals(astTree) {
  162. estraverse.replace(astTree, {
  163. leave: function leave(node) {
  164. if (NodeGuards_1.NodeGuards.isLiteralNode(node)) {
  165. node['x-verbatim-property'] = {
  166. content: node.raw,
  167. precedence: escodegen.Precedence.Primary
  168. };
  169. }
  170. }
  171. });
  172. return astTree;
  173. }
  174. }, {
  175. key: "clone",
  176. value: function clone(astTree) {
  177. return NodeUtils.parentize(NodeUtils.cloneRecursive(astTree));
  178. }
  179. }, {
  180. key: "convertCodeToStructure",
  181. value: function convertCodeToStructure(code) {
  182. var structure = esprima.parseScript(code);
  183. structure = NodeUtils.addXVerbatimPropertyToLiterals(structure);
  184. structure = NodeUtils.parentize(structure);
  185. return structure.body;
  186. }
  187. }, {
  188. key: "convertStructureToCode",
  189. value: function convertStructureToCode(structure) {
  190. return structure.reduce(function (code, node) {
  191. return code + escodegen.generate(node, {
  192. sourceMapWithCode: true
  193. }).code;
  194. }, '');
  195. }
  196. }, {
  197. key: "getBlockScopesOfNode",
  198. value: function getBlockScopesOfNode(targetNode) {
  199. return NodeUtils.getBlockScopesOfNodeRecursive(targetNode);
  200. }
  201. }, {
  202. key: "getScopeOfNode",
  203. value: function getScopeOfNode(node) {
  204. var parentNode = node.parentNode;
  205. if (!parentNode) {
  206. throw new ReferenceError('`parentNode` property of given node is `undefined`');
  207. }
  208. if (!NodeGuards_1.NodeGuards.isNodeHasScope(parentNode)) {
  209. return NodeUtils.getScopeOfNode(parentNode);
  210. }
  211. return parentNode;
  212. }
  213. }, {
  214. key: "getUnaryExpressionArgumentNode",
  215. value: function getUnaryExpressionArgumentNode(unaryExpressionNode) {
  216. if (NodeGuards_1.NodeGuards.isUnaryExpressionNode(unaryExpressionNode.argument)) {
  217. return NodeUtils.getUnaryExpressionArgumentNode(unaryExpressionNode.argument);
  218. }
  219. return unaryExpressionNode.argument;
  220. }
  221. }, {
  222. key: "parentize",
  223. value: function parentize(astTree) {
  224. estraverse.replace(astTree, {
  225. enter: NodeUtils.parentizeNode
  226. });
  227. return astTree;
  228. }
  229. }, {
  230. key: "parentizeNode",
  231. value: function parentizeNode(node, parentNode) {
  232. node.parentNode = parentNode || node;
  233. node.obfuscatedNode = false;
  234. return node;
  235. }
  236. }, {
  237. key: "cloneRecursive",
  238. value: function cloneRecursive(node) {
  239. if (node === null) {
  240. return node;
  241. }
  242. var copy = {};
  243. Object.keys(node).forEach(function (property) {
  244. if (property === 'parentNode') {
  245. return;
  246. }
  247. var value = node[property];
  248. var clonedValue = void 0;
  249. if (value === null || value instanceof RegExp) {
  250. clonedValue = value;
  251. } else if (Array.isArray(value)) {
  252. clonedValue = value.map(NodeUtils.cloneRecursive);
  253. } else if ((typeof value === "undefined" ? "undefined" : _typeof(value)) === 'object') {
  254. clonedValue = NodeUtils.cloneRecursive(value);
  255. } else {
  256. clonedValue = value;
  257. }
  258. copy[property] = clonedValue;
  259. });
  260. return copy;
  261. }
  262. }, {
  263. key: "getBlockScopesOfNodeRecursive",
  264. value: function getBlockScopesOfNodeRecursive(node) {
  265. var blockScopes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  266. var depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  267. var parentNode = node.parentNode;
  268. if (!parentNode) {
  269. throw new ReferenceError('`parentNode` property of given node is `undefined`');
  270. }
  271. if (NodeGuards_1.NodeGuards.isProgramNode(node) || depth && NodeGuards_1.NodeGuards.isNodeHasBlockScope(node, parentNode)) {
  272. blockScopes.push(node);
  273. }
  274. if (node !== parentNode) {
  275. return NodeUtils.getBlockScopesOfNodeRecursive(parentNode, blockScopes, ++depth);
  276. }
  277. return blockScopes;
  278. }
  279. }]);
  280. return NodeUtils;
  281. }();
  282. exports.NodeUtils = NodeUtils;
  283. /***/ }),
  284. /* 4 */
  285. /***/ (function(module, exports, __webpack_require__) {
  286. "use strict";
  287. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  288. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  289. Object.defineProperty(exports, "__esModule", { value: true });
  290. var NodeType_1 = __webpack_require__(11);
  291. var NodeGuards = function () {
  292. function NodeGuards() {
  293. _classCallCheck(this, NodeGuards);
  294. }
  295. _createClass(NodeGuards, null, [{
  296. key: "isArrayPatternNode",
  297. value: function isArrayPatternNode(node) {
  298. return node.type === NodeType_1.NodeType.ArrayPattern;
  299. }
  300. }, {
  301. key: "isArrowFunctionExpressionNode",
  302. value: function isArrowFunctionExpressionNode(node) {
  303. return node.type === NodeType_1.NodeType.ArrowFunctionExpression;
  304. }
  305. }, {
  306. key: "isAssignmentPatternNode",
  307. value: function isAssignmentPatternNode(node) {
  308. return node.type === NodeType_1.NodeType.AssignmentPattern;
  309. }
  310. }, {
  311. key: "isAwaitExpressionNode",
  312. value: function isAwaitExpressionNode(node) {
  313. return node.type === NodeType_1.NodeType.AwaitExpression;
  314. }
  315. }, {
  316. key: "isBlockStatementNode",
  317. value: function isBlockStatementNode(node) {
  318. return node.type === NodeType_1.NodeType.BlockStatement;
  319. }
  320. }, {
  321. key: "isBreakStatementNode",
  322. value: function isBreakStatementNode(node) {
  323. return node.type === NodeType_1.NodeType.BreakStatement;
  324. }
  325. }, {
  326. key: "isCallExpressionNode",
  327. value: function isCallExpressionNode(node) {
  328. return node.type === NodeType_1.NodeType.CallExpression;
  329. }
  330. }, {
  331. key: "isCatchClauseNode",
  332. value: function isCatchClauseNode(node) {
  333. return node.type === NodeType_1.NodeType.CatchClause;
  334. }
  335. }, {
  336. key: "isClassDeclarationNode",
  337. value: function isClassDeclarationNode(node) {
  338. return node.type === NodeType_1.NodeType.ClassDeclaration;
  339. }
  340. }, {
  341. key: "isContinueStatementNode",
  342. value: function isContinueStatementNode(node) {
  343. return node.type === NodeType_1.NodeType.ContinueStatement;
  344. }
  345. }, {
  346. key: "isExpressionStatementNode",
  347. value: function isExpressionStatementNode(node) {
  348. return node.type === NodeType_1.NodeType.ExpressionStatement;
  349. }
  350. }, {
  351. key: "isFunctionDeclarationNode",
  352. value: function isFunctionDeclarationNode(node) {
  353. return node.type === NodeType_1.NodeType.FunctionDeclaration;
  354. }
  355. }, {
  356. key: "isFunctionExpressionNode",
  357. value: function isFunctionExpressionNode(node) {
  358. return node.type === NodeType_1.NodeType.FunctionExpression;
  359. }
  360. }, {
  361. key: "isIdentifierNode",
  362. value: function isIdentifierNode(node) {
  363. return node.type === NodeType_1.NodeType.Identifier;
  364. }
  365. }, {
  366. key: "isIfStatementNode",
  367. value: function isIfStatementNode(node) {
  368. return node.type === NodeType_1.NodeType.IfStatement;
  369. }
  370. }, {
  371. key: "isLabelIdentifierNode",
  372. value: function isLabelIdentifierNode(node, parentNode) {
  373. var parentNodeIsLabeledStatementNode = NodeGuards.isLabeledStatementNode(parentNode) && parentNode.label === node;
  374. var parentNodeIsContinueStatementNode = NodeGuards.isContinueStatementNode(parentNode) && parentNode.label === node;
  375. var parentNodeIsBreakStatementNode = NodeGuards.isBreakStatementNode(parentNode) && parentNode.label === node;
  376. return parentNodeIsLabeledStatementNode || parentNodeIsContinueStatementNode || parentNodeIsBreakStatementNode;
  377. }
  378. }, {
  379. key: "isLabeledStatementNode",
  380. value: function isLabeledStatementNode(node) {
  381. return node.type === NodeType_1.NodeType.LabeledStatement;
  382. }
  383. }, {
  384. key: "isLiteralNode",
  385. value: function isLiteralNode(node) {
  386. return node.type === NodeType_1.NodeType.Literal;
  387. }
  388. }, {
  389. key: "isMemberExpressionNode",
  390. value: function isMemberExpressionNode(node) {
  391. return node.type === NodeType_1.NodeType.MemberExpression;
  392. }
  393. }, {
  394. key: "isMethodDefinitionNode",
  395. value: function isMethodDefinitionNode(node) {
  396. return node.type === NodeType_1.NodeType.MethodDefinition;
  397. }
  398. }, {
  399. key: "isNode",
  400. value: function isNode(object) {
  401. return object && !object.type !== undefined;
  402. }
  403. }, {
  404. key: "isNodeHasBlockScope",
  405. value: function isNodeHasBlockScope(node, parentNode) {
  406. return NodeGuards.isProgramNode(node) || NodeGuards.isBlockStatementNode(node) && NodeGuards.nodesWithBlockScope.indexOf(parentNode.type) !== -1;
  407. }
  408. }, {
  409. key: "isNodeHasScope",
  410. value: function isNodeHasScope(node) {
  411. return NodeGuards.isProgramNode(node) || NodeGuards.isBlockStatementNode(node) || NodeGuards.isSwitchCaseNode(node);
  412. }
  413. }, {
  414. key: "isNodeWithComments",
  415. value: function isNodeWithComments(node) {
  416. return Boolean(node.leadingComments) || Boolean(node.trailingComments);
  417. }
  418. }, {
  419. key: "isObjectPatternNode",
  420. value: function isObjectPatternNode(node) {
  421. return node.type === NodeType_1.NodeType.ObjectPattern;
  422. }
  423. }, {
  424. key: "isObjectExpressionNode",
  425. value: function isObjectExpressionNode(node) {
  426. return node.type === NodeType_1.NodeType.ObjectExpression;
  427. }
  428. }, {
  429. key: "isProgramNode",
  430. value: function isProgramNode(node) {
  431. return node.type === NodeType_1.NodeType.Program;
  432. }
  433. }, {
  434. key: "isPropertyNode",
  435. value: function isPropertyNode(node) {
  436. return node.type === NodeType_1.NodeType.Property;
  437. }
  438. }, {
  439. key: "isReplaceableIdentifierNode",
  440. value: function isReplaceableIdentifierNode(node, parentNode) {
  441. if (!NodeGuards.isIdentifierNode(node)) {
  442. return false;
  443. }
  444. var parentNodeIsPropertyNode = NodeGuards.isPropertyNode(parentNode) && !parentNode.computed && parentNode.key === node;
  445. var parentNodeIsMemberExpressionNode = NodeGuards.isMemberExpressionNode(parentNode) && !parentNode.computed && parentNode.property === node;
  446. var parentNodeIsMethodDefinitionNode = NodeGuards.isMethodDefinitionNode(parentNode) && !parentNode.computed;
  447. var isLabelIdentifierNode = NodeGuards.isLabelIdentifierNode(node, parentNode);
  448. return !parentNodeIsPropertyNode && !parentNodeIsMemberExpressionNode && !parentNodeIsMethodDefinitionNode && !isLabelIdentifierNode;
  449. }
  450. }, {
  451. key: "isRestElementNode",
  452. value: function isRestElementNode(node) {
  453. return node.type === NodeType_1.NodeType.RestElement;
  454. }
  455. }, {
  456. key: "isReturnStatementNode",
  457. value: function isReturnStatementNode(node) {
  458. return node.type === NodeType_1.NodeType.ReturnStatement;
  459. }
  460. }, {
  461. key: "isSuperNode",
  462. value: function isSuperNode(node) {
  463. return node.type === NodeType_1.NodeType.Super;
  464. }
  465. }, {
  466. key: "isSwitchCaseNode",
  467. value: function isSwitchCaseNode(node) {
  468. return node.type === NodeType_1.NodeType.SwitchCase;
  469. }
  470. }, {
  471. key: "isTemplateLiteralNode",
  472. value: function isTemplateLiteralNode(node) {
  473. return node.type === NodeType_1.NodeType.TemplateLiteral;
  474. }
  475. }, {
  476. key: "isUnaryExpressionNode",
  477. value: function isUnaryExpressionNode(node) {
  478. return node.type === NodeType_1.NodeType.UnaryExpression;
  479. }
  480. }, {
  481. key: "isUseStrictOperator",
  482. value: function isUseStrictOperator(node) {
  483. return node.type === NodeType_1.NodeType.ExpressionStatement && node.directive === 'use strict';
  484. }
  485. }, {
  486. key: "isVariableDeclarationNode",
  487. value: function isVariableDeclarationNode(node) {
  488. return node.type === NodeType_1.NodeType.VariableDeclaration;
  489. }
  490. }, {
  491. key: "isVariableDeclaratorNode",
  492. value: function isVariableDeclaratorNode(node) {
  493. return node.type === NodeType_1.NodeType.VariableDeclarator;
  494. }
  495. }, {
  496. key: "isWhileStatementNode",
  497. value: function isWhileStatementNode(node) {
  498. return node.type === NodeType_1.NodeType.WhileStatement;
  499. }
  500. }]);
  501. return NodeGuards;
  502. }();
  503. NodeGuards.nodesWithBlockScope = [NodeType_1.NodeType.ArrowFunctionExpression, NodeType_1.NodeType.FunctionDeclaration, NodeType_1.NodeType.FunctionExpression, NodeType_1.NodeType.MethodDefinition];
  504. exports.NodeGuards = NodeGuards;
  505. /***/ }),
  506. /* 5 */
  507. /***/ (function(module, exports, __webpack_require__) {
  508. "use strict";
  509. Object.defineProperty(exports, "__esModule", { value: true });
  510. function initializable() {
  511. var initializeMethodKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'initialize';
  512. var decoratorName = Object.keys(this)[0];
  513. return function (target, propertyKey) {
  514. var descriptor = {
  515. configurable: true,
  516. enumerable: true
  517. };
  518. var initializeMethod = target[initializeMethodKey];
  519. if (!initializeMethod || typeof initializeMethod !== 'function') {
  520. throw new Error("`" + initializeMethodKey + "` method with initialization logic not " + ("found. `@" + decoratorName + "` decorator requires `" + initializeMethodKey + "` method"));
  521. }
  522. var metadataPropertyKey = "_" + propertyKey;
  523. var propertyDescriptor = Object.getOwnPropertyDescriptor(target, metadataPropertyKey) || descriptor;
  524. var methodDescriptor = Object.getOwnPropertyDescriptor(target, initializeMethodKey) || descriptor;
  525. var originalMethod = methodDescriptor.value;
  526. Object.defineProperty(target, propertyKey, Object.assign({}, propertyDescriptor, { get: function get() {
  527. if (this[metadataPropertyKey] === undefined) {
  528. throw new Error("Property `" + propertyKey + "` is not initialized! Initialize it first!");
  529. }
  530. return this[metadataPropertyKey];
  531. }, set: function set(newVal) {
  532. this[metadataPropertyKey] = newVal;
  533. } }));
  534. Object.defineProperty(target, initializeMethodKey, Object.assign({}, methodDescriptor, { value: function value() {
  535. originalMethod.apply(this, arguments);
  536. if (this[propertyKey]) {}
  537. } }));
  538. return propertyDescriptor;
  539. };
  540. }
  541. exports.initializable = initializable;
  542. /***/ }),
  543. /* 6 */
  544. /***/ (function(module, exports, __webpack_require__) {
  545. "use strict";
  546. Object.defineProperty(exports, "__esModule", { value: true });
  547. var TransformationStage;
  548. (function (TransformationStage) {
  549. TransformationStage["Preparing"] = "Preparing";
  550. TransformationStage["DeadCodeInjection"] = "DeadCodeInjection";
  551. TransformationStage["ControlFlowFlattening"] = "ControlFlowFlattening";
  552. TransformationStage["Converting"] = "Converting";
  553. TransformationStage["Obfuscating"] = "Obfuscating";
  554. TransformationStage["Finalizing"] = "Finalizing";
  555. })(TransformationStage = exports.TransformationStage || (exports.TransformationStage = {}));
  556. /***/ }),
  557. /* 7 */
  558. /***/ (function(module, exports, __webpack_require__) {
  559. "use strict";
  560. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  561. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  562. Object.defineProperty(exports, "__esModule", { value: true });
  563. var tslib_1 = __webpack_require__(2);
  564. var inversify_1 = __webpack_require__(0);
  565. var ServiceIdentifiers_1 = __webpack_require__(1);
  566. var GlobalVariableTemplate1_1 = __webpack_require__(76);
  567. var GlobalVariableTemplate2_1 = __webpack_require__(77);
  568. var NodeUtils_1 = __webpack_require__(3);
  569. var AbstractCustomNode = AbstractCustomNode_1 = function () {
  570. function AbstractCustomNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  571. _classCallCheck(this, AbstractCustomNode);
  572. this.identifierNamesGenerator = identifierNamesGeneratorFactory(options);
  573. this.randomGenerator = randomGenerator;
  574. this.options = options;
  575. }
  576. _createClass(AbstractCustomNode, [{
  577. key: "getCode",
  578. value: function getCode() {
  579. if (!this.cachedCode) {
  580. this.cachedCode = NodeUtils_1.NodeUtils.convertStructureToCode(this.getNode());
  581. }
  582. return this.cachedCode;
  583. }
  584. }, {
  585. key: "getNode",
  586. value: function getNode() {
  587. if (!this.cachedNode) {
  588. this.cachedNode = this.getNodeStructure();
  589. }
  590. return this.cachedNode;
  591. }
  592. }, {
  593. key: "getGlobalVariableTemplate",
  594. value: function getGlobalVariableTemplate() {
  595. return this.randomGenerator.getRandomGenerator().pickone(AbstractCustomNode_1.globalVariableTemplateFunctions);
  596. }
  597. }]);
  598. return AbstractCustomNode;
  599. }();
  600. AbstractCustomNode.globalVariableTemplateFunctions = [GlobalVariableTemplate1_1.GlobalVariableTemplate1(), GlobalVariableTemplate2_1.GlobalVariableTemplate2()];
  601. AbstractCustomNode = AbstractCustomNode_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], AbstractCustomNode);
  602. exports.AbstractCustomNode = AbstractCustomNode;
  603. var AbstractCustomNode_1;
  604. /***/ }),
  605. /* 8 */
  606. /***/ (function(module, exports, __webpack_require__) {
  607. "use strict";
  608. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  609. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  610. Object.defineProperty(exports, "__esModule", { value: true });
  611. var tslib_1 = __webpack_require__(2);
  612. var inversify_1 = __webpack_require__(0);
  613. var ServiceIdentifiers_1 = __webpack_require__(1);
  614. var Initializable_1 = __webpack_require__(5);
  615. var AbstractNodeTransformer = function () {
  616. function AbstractNodeTransformer(randomGenerator, options) {
  617. _classCallCheck(this, AbstractNodeTransformer);
  618. this.randomGenerator = randomGenerator;
  619. this.options = options;
  620. }
  621. _createClass(AbstractNodeTransformer, [{
  622. key: "initialize",
  623. value: function initialize() {
  624. this.nodeIdentifier = this.randomGenerator.getRandomInteger(0, 10000);
  625. }
  626. }]);
  627. return AbstractNodeTransformer;
  628. }();
  629. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Number)], AbstractNodeTransformer.prototype, "nodeIdentifier", void 0);
  630. tslib_1.__decorate([inversify_1.postConstruct(), tslib_1.__metadata("design:type", Function), tslib_1.__metadata("design:paramtypes", []), tslib_1.__metadata("design:returntype", void 0)], AbstractNodeTransformer.prototype, "initialize", null);
  631. AbstractNodeTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], AbstractNodeTransformer);
  632. exports.AbstractNodeTransformer = AbstractNodeTransformer;
  633. /***/ }),
  634. /* 9 */
  635. /***/ (function(module, exports, __webpack_require__) {
  636. "use strict";
  637. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  638. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  639. Object.defineProperty(exports, "__esModule", { value: true });
  640. var escodegen = __webpack_require__(30);
  641. var NodeType_1 = __webpack_require__(11);
  642. var Nodes = function () {
  643. function Nodes() {
  644. _classCallCheck(this, Nodes);
  645. }
  646. _createClass(Nodes, null, [{
  647. key: "getProgramNode",
  648. value: function getProgramNode() {
  649. var body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  650. return {
  651. type: NodeType_1.NodeType.Program,
  652. body: body,
  653. sourceType: 'script',
  654. obfuscatedNode: false
  655. };
  656. }
  657. }, {
  658. key: "getArrayExpressionNode",
  659. value: function getArrayExpressionNode() {
  660. var elements = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  661. return {
  662. type: NodeType_1.NodeType.ArrayExpression,
  663. elements: elements
  664. };
  665. }
  666. }, {
  667. key: "getAssignmentExpressionNode",
  668. value: function getAssignmentExpressionNode(operator, left, right) {
  669. return {
  670. type: NodeType_1.NodeType.AssignmentExpression,
  671. operator: operator,
  672. left: left,
  673. right: right,
  674. obfuscatedNode: false
  675. };
  676. }
  677. }, {
  678. key: "getBinaryExpressionNode",
  679. value: function getBinaryExpressionNode(operator, left, right) {
  680. return {
  681. type: NodeType_1.NodeType.BinaryExpression,
  682. operator: operator,
  683. left: left,
  684. right: right,
  685. obfuscatedNode: false
  686. };
  687. }
  688. }, {
  689. key: "getBlockStatementNode",
  690. value: function getBlockStatementNode() {
  691. var body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  692. return {
  693. type: NodeType_1.NodeType.BlockStatement,
  694. body: body,
  695. obfuscatedNode: false
  696. };
  697. }
  698. }, {
  699. key: "getBreakStatement",
  700. value: function getBreakStatement(label) {
  701. var breakStatementNode = {
  702. type: NodeType_1.NodeType.BreakStatement,
  703. obfuscatedNode: false
  704. };
  705. if (label) {
  706. breakStatementNode.label = label;
  707. }
  708. return breakStatementNode;
  709. }
  710. }, {
  711. key: "getCatchClauseNode",
  712. value: function getCatchClauseNode() {
  713. var body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  714. return {
  715. type: NodeType_1.NodeType.CatchClause,
  716. param: Nodes.getIdentifierNode('err'),
  717. body: Nodes.getBlockStatementNode(body),
  718. obfuscatedNode: false
  719. };
  720. }
  721. }, {
  722. key: "getCallExpressionNode",
  723. value: function getCallExpressionNode(callee) {
  724. var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  725. return {
  726. type: NodeType_1.NodeType.CallExpression,
  727. callee: callee,
  728. arguments: args,
  729. obfuscatedNode: false
  730. };
  731. }
  732. }, {
  733. key: "getContinueStatement",
  734. value: function getContinueStatement(label) {
  735. var continueStatementNode = {
  736. type: NodeType_1.NodeType.ContinueStatement,
  737. obfuscatedNode: false
  738. };
  739. if (label) {
  740. continueStatementNode.label = label;
  741. }
  742. return continueStatementNode;
  743. }
  744. }, {
  745. key: "getExpressionStatementNode",
  746. value: function getExpressionStatementNode(expression) {
  747. return {
  748. type: NodeType_1.NodeType.ExpressionStatement,
  749. expression: expression,
  750. obfuscatedNode: false
  751. };
  752. }
  753. }, {
  754. key: "getFunctionDeclarationNode",
  755. value: function getFunctionDeclarationNode(functionName, params, body) {
  756. return {
  757. type: NodeType_1.NodeType.FunctionDeclaration,
  758. id: Nodes.getIdentifierNode(functionName),
  759. params: params,
  760. body: body,
  761. generator: false,
  762. obfuscatedNode: false
  763. };
  764. }
  765. }, {
  766. key: "getFunctionExpressionNode",
  767. value: function getFunctionExpressionNode(params, body) {
  768. return {
  769. type: NodeType_1.NodeType.FunctionExpression,
  770. params: params,
  771. body: body,
  772. generator: false,
  773. obfuscatedNode: false
  774. };
  775. }
  776. }, {
  777. key: "getIfStatementNode",
  778. value: function getIfStatementNode(test, consequent, alternate) {
  779. return Object.assign({ type: NodeType_1.NodeType.IfStatement, test: test,
  780. consequent: consequent }, alternate && { alternate: alternate }, { obfuscatedNode: false });
  781. }
  782. }, {
  783. key: "getIdentifierNode",
  784. value: function getIdentifierNode(name) {
  785. return {
  786. type: NodeType_1.NodeType.Identifier,
  787. name: name,
  788. obfuscatedNode: false
  789. };
  790. }
  791. }, {
  792. key: "getLabeledStatement",
  793. value: function getLabeledStatement(label, body) {
  794. return {
  795. type: NodeType_1.NodeType.LabeledStatement,
  796. label: label,
  797. body: body,
  798. obfuscatedNode: false
  799. };
  800. }
  801. }, {
  802. key: "getLiteralNode",
  803. value: function getLiteralNode(value, raw) {
  804. raw = raw !== undefined ? raw : "'" + value + "'";
  805. return {
  806. type: NodeType_1.NodeType.Literal,
  807. value: value,
  808. raw: raw,
  809. 'x-verbatim-property': {
  810. content: raw,
  811. precedence: escodegen.Precedence.Primary
  812. },
  813. obfuscatedNode: false
  814. };
  815. }
  816. }, {
  817. key: "getLogicalExpressionNode",
  818. value: function getLogicalExpressionNode(operator, left, right) {
  819. return {
  820. type: NodeType_1.NodeType.LogicalExpression,
  821. operator: operator,
  822. left: left,
  823. right: right,
  824. obfuscatedNode: false
  825. };
  826. }
  827. }, {
  828. key: "getMemberExpressionNode",
  829. value: function getMemberExpressionNode(object, property) {
  830. var computed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  831. return {
  832. type: NodeType_1.NodeType.MemberExpression,
  833. computed: computed,
  834. object: object,
  835. property: property,
  836. obfuscatedNode: false
  837. };
  838. }
  839. }, {
  840. key: "getMethodDefinitionNode",
  841. value: function getMethodDefinitionNode(key, value, kind, computed) {
  842. return {
  843. type: NodeType_1.NodeType.MethodDefinition,
  844. key: key,
  845. value: value,
  846. kind: kind,
  847. computed: computed,
  848. static: false,
  849. obfuscatedNode: false
  850. };
  851. }
  852. }, {
  853. key: "getObjectExpressionNode",
  854. value: function getObjectExpressionNode(properties) {
  855. return {
  856. type: NodeType_1.NodeType.ObjectExpression,
  857. properties: properties,
  858. obfuscatedNode: false
  859. };
  860. }
  861. }, {
  862. key: "getPropertyNode",
  863. value: function getPropertyNode(key, value) {
  864. var computed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  865. return {
  866. type: NodeType_1.NodeType.Property,
  867. key: key,
  868. value: value,
  869. kind: 'init',
  870. method: false,
  871. shorthand: false,
  872. computed: computed,
  873. obfuscatedNode: false
  874. };
  875. }
  876. }, {
  877. key: "getUnaryExpressionNode",
  878. value: function getUnaryExpressionNode(operator, argument) {
  879. var prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  880. return {
  881. type: NodeType_1.NodeType.UnaryExpression,
  882. operator: operator,
  883. argument: argument,
  884. prefix: prefix,
  885. obfuscatedNode: false
  886. };
  887. }
  888. }, {
  889. key: "getReturnStatementNode",
  890. value: function getReturnStatementNode(argument) {
  891. return {
  892. type: NodeType_1.NodeType.ReturnStatement,
  893. argument: argument,
  894. obfuscatedNode: false
  895. };
  896. }
  897. }, {
  898. key: "getSwitchStatementNode",
  899. value: function getSwitchStatementNode(discriminant, cases) {
  900. return {
  901. type: NodeType_1.NodeType.SwitchStatement,
  902. discriminant: discriminant,
  903. cases: cases,
  904. obfuscatedNode: false
  905. };
  906. }
  907. }, {
  908. key: "getSwitchCaseNode",
  909. value: function getSwitchCaseNode(test, consequent) {
  910. return {
  911. type: NodeType_1.NodeType.SwitchCase,
  912. test: test,
  913. consequent: consequent,
  914. obfuscatedNode: false
  915. };
  916. }
  917. }, {
  918. key: "getUpdateExpressionNode",
  919. value: function getUpdateExpressionNode(operator, argumentExpr) {
  920. return {
  921. type: NodeType_1.NodeType.UpdateExpression,
  922. operator: operator,
  923. argument: argumentExpr,
  924. prefix: false,
  925. obfuscatedNode: false
  926. };
  927. }
  928. }, {
  929. key: "getVariableDeclarationNode",
  930. value: function getVariableDeclarationNode() {
  931. var declarations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  932. var kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'var';
  933. return {
  934. type: NodeType_1.NodeType.VariableDeclaration,
  935. declarations: declarations,
  936. kind: kind,
  937. obfuscatedNode: false
  938. };
  939. }
  940. }, {
  941. key: "getVariableDeclaratorNode",
  942. value: function getVariableDeclaratorNode(id, init) {
  943. return {
  944. type: NodeType_1.NodeType.VariableDeclarator,
  945. id: id,
  946. init: init,
  947. obfuscatedNode: false
  948. };
  949. }
  950. }, {
  951. key: "getWhileStatementNode",
  952. value: function getWhileStatementNode(test, body) {
  953. return {
  954. type: NodeType_1.NodeType.WhileStatement,
  955. test: test,
  956. body: body,
  957. obfuscatedNode: false
  958. };
  959. }
  960. }]);
  961. return Nodes;
  962. }();
  963. exports.Nodes = Nodes;
  964. /***/ }),
  965. /* 10 */
  966. /***/ (function(module, exports) {
  967. module.exports = require("estraverse");
  968. /***/ }),
  969. /* 11 */
  970. /***/ (function(module, exports, __webpack_require__) {
  971. "use strict";
  972. Object.defineProperty(exports, "__esModule", { value: true });
  973. var NodeType;
  974. (function (NodeType) {
  975. NodeType["ArrayExpression"] = "ArrayExpression";
  976. NodeType["ArrayPattern"] = "ArrayPattern";
  977. NodeType["ArrowFunctionExpression"] = "ArrowFunctionExpression";
  978. NodeType["AssignmentExpression"] = "AssignmentExpression";
  979. NodeType["AssignmentPattern"] = "AssignmentPattern";
  980. NodeType["AwaitExpression"] = "AwaitExpression";
  981. NodeType["BinaryExpression"] = "BinaryExpression";
  982. NodeType["BlockStatement"] = "BlockStatement";
  983. NodeType["BreakStatement"] = "BreakStatement";
  984. NodeType["CallExpression"] = "CallExpression";
  985. NodeType["CatchClause"] = "CatchClause";
  986. NodeType["ClassDeclaration"] = "ClassDeclaration";
  987. NodeType["ContinueStatement"] = "ContinueStatement";
  988. NodeType["ExpressionStatement"] = "ExpressionStatement";
  989. NodeType["FunctionDeclaration"] = "FunctionDeclaration";
  990. NodeType["FunctionExpression"] = "FunctionExpression";
  991. NodeType["Identifier"] = "Identifier";
  992. NodeType["IfStatement"] = "IfStatement";
  993. NodeType["LabeledStatement"] = "LabeledStatement";
  994. NodeType["Literal"] = "Literal";
  995. NodeType["LogicalExpression"] = "LogicalExpression";
  996. NodeType["MemberExpression"] = "MemberExpression";
  997. NodeType["MethodDefinition"] = "MethodDefinition";
  998. NodeType["ObjectExpression"] = "ObjectExpression";
  999. NodeType["ObjectPattern"] = "ObjectPattern";
  1000. NodeType["Program"] = "Program";
  1001. NodeType["Property"] = "Property";
  1002. NodeType["RestElement"] = "RestElement";
  1003. NodeType["ReturnStatement"] = "ReturnStatement";
  1004. NodeType["Super"] = "Super";
  1005. NodeType["SwitchCase"] = "SwitchCase";
  1006. NodeType["SwitchStatement"] = "SwitchStatement";
  1007. NodeType["TemplateLiteral"] = "TemplateLiteral";
  1008. NodeType["TryStatement"] = "TryStatement";
  1009. NodeType["UnaryExpression"] = "UnaryExpression";
  1010. NodeType["UpdateExpression"] = "UpdateExpression";
  1011. NodeType["VariableDeclaration"] = "VariableDeclaration";
  1012. NodeType["VariableDeclarator"] = "VariableDeclarator";
  1013. NodeType["WhileStatement"] = "WhileStatement";
  1014. })(NodeType = exports.NodeType || (exports.NodeType = {}));
  1015. /***/ }),
  1016. /* 12 */
  1017. /***/ (function(module, exports) {
  1018. module.exports = require("string-template");
  1019. /***/ }),
  1020. /* 13 */
  1021. /***/ (function(module, exports, __webpack_require__) {
  1022. "use strict";
  1023. Object.defineProperty(exports, "__esModule", { value: true });
  1024. var ControlFlowCustomNode;
  1025. (function (ControlFlowCustomNode) {
  1026. ControlFlowCustomNode["BinaryExpressionFunctionNode"] = "BinaryExpressionFunctionNode";
  1027. ControlFlowCustomNode["BlockStatementControlFlowFlatteningNode"] = "BlockStatementControlFlowFlatteningNode";
  1028. ControlFlowCustomNode["CallExpressionControlFlowStorageCallNode"] = "CallExpressionControlFlowStorageCallNode";
  1029. ControlFlowCustomNode["CallExpressionFunctionNode"] = "CallExpressionFunctionNode";
  1030. ControlFlowCustomNode["ControlFlowStorageNode"] = "ControlFlowStorageNode";
  1031. ControlFlowCustomNode["ExpressionWithOperatorControlFlowStorageCallNode"] = "ExpressionWithOperatorControlFlowStorageCallNode";
  1032. ControlFlowCustomNode["LogicalExpressionFunctionNode"] = "LogicalExpressionFunctionNode";
  1033. ControlFlowCustomNode["StringLiteralControlFlowStorageCallNode"] = "StringLiteralControlFlowStorageCallNode";
  1034. ControlFlowCustomNode["StringLiteralNode"] = "StringLiteralNode";
  1035. })(ControlFlowCustomNode = exports.ControlFlowCustomNode || (exports.ControlFlowCustomNode = {}));
  1036. /***/ }),
  1037. /* 14 */
  1038. /***/ (function(module, exports, __webpack_require__) {
  1039. "use strict";
  1040. Object.defineProperty(exports, "__esModule", { value: true });
  1041. var ObfuscationTarget;
  1042. (function (ObfuscationTarget) {
  1043. ObfuscationTarget["Browser"] = "browser";
  1044. ObfuscationTarget["Extension"] = "extension";
  1045. ObfuscationTarget["Node"] = "node";
  1046. })(ObfuscationTarget = exports.ObfuscationTarget || (exports.ObfuscationTarget = {}));
  1047. /***/ }),
  1048. /* 15 */
  1049. /***/ (function(module, exports, __webpack_require__) {
  1050. "use strict";
  1051. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  1052. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1053. Object.defineProperty(exports, "__esModule", { value: true });
  1054. var inversify_1 = __webpack_require__(0);
  1055. var ServiceIdentifiers_1 = __webpack_require__(1);
  1056. var AnalyzersModule_1 = __webpack_require__(51);
  1057. var ControlFlowTransformersModule_1 = __webpack_require__(56);
  1058. var ConvertingTransformersModule_1 = __webpack_require__(64);
  1059. var CustomNodesModule_1 = __webpack_require__(69);
  1060. var FinalizingTransformersModule_1 = __webpack_require__(116);
  1061. var GeneratorsModule_1 = __webpack_require__(117);
  1062. var NodeTransformersModule_1 = __webpack_require__(120);
  1063. var ObfuscatingTransformersModule_1 = __webpack_require__(121);
  1064. var PreparingTransformersModule_1 = __webpack_require__(134);
  1065. var StoragesModule_1 = __webpack_require__(142);
  1066. var UtilsModule_1 = __webpack_require__(147);
  1067. var JavaScriptObfuscator_1 = __webpack_require__(153);
  1068. var Logger_1 = __webpack_require__(155);
  1069. var ObfuscationEventEmitter_1 = __webpack_require__(157);
  1070. var ObfuscationResult_1 = __webpack_require__(159);
  1071. var Options_1 = __webpack_require__(160);
  1072. var SourceCode_1 = __webpack_require__(174);
  1073. var SourceMapCorrector_1 = __webpack_require__(175);
  1074. var TransformersRunner_1 = __webpack_require__(176);
  1075. var InversifyContainerFacade = function () {
  1076. function InversifyContainerFacade() {
  1077. _classCallCheck(this, InversifyContainerFacade);
  1078. this.container = new inversify_1.Container();
  1079. }
  1080. _createClass(InversifyContainerFacade, [{
  1081. key: "get",
  1082. value: function get(serviceIdentifier) {
  1083. return this.container.get(serviceIdentifier);
  1084. }
  1085. }, {
  1086. key: "getNamed",
  1087. value: function getNamed(serviceIdentifier, named) {
  1088. return this.container.getNamed(serviceIdentifier, named);
  1089. }
  1090. }, {
  1091. key: "load",
  1092. value: function load(sourceCode, options) {
  1093. this.container.bind(ServiceIdentifiers_1.ServiceIdentifiers.ISourceCode).toDynamicValue(function () {
  1094. return new SourceCode_1.SourceCode(sourceCode);
  1095. }).inSingletonScope();
  1096. this.container.bind(ServiceIdentifiers_1.ServiceIdentifiers.IOptions).toDynamicValue(function () {
  1097. return new Options_1.Options(options);
  1098. }).inSingletonScope();
  1099. this.container.bind(ServiceIdentifiers_1.ServiceIdentifiers.ILogger).to(Logger_1.Logger).inSingletonScope();
  1100. this.container.bind(ServiceIdentifiers_1.ServiceIdentifiers.IJavaScriptObfuscator).to(JavaScriptObfuscator_1.JavaScriptObfuscator).inSingletonScope();
  1101. this.container.bind(ServiceIdentifiers_1.ServiceIdentifiers.ITransformersRunner).to(TransformersRunner_1.TransformersRunner).inSingletonScope();
  1102. this.container.bind(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscationResult).to(ObfuscationResult_1.ObfuscationResult).inSingletonScope();
  1103. this.container.bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObfuscationResult).toFactory(function (context) {
  1104. return function (obfuscatedCode, sourceMap) {
  1105. var obfuscationResult = context.container.get(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscationResult);
  1106. obfuscationResult.initialize(obfuscatedCode, sourceMap);
  1107. return obfuscationResult;
  1108. };
  1109. });
  1110. this.container.bind(ServiceIdentifiers_1.ServiceIdentifiers.ISourceMapCorrector).to(SourceMapCorrector_1.SourceMapCorrector).inSingletonScope();
  1111. this.container.bind(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscationEventEmitter).to(ObfuscationEventEmitter_1.ObfuscationEventEmitter).inSingletonScope();
  1112. this.container.load(AnalyzersModule_1.analyzersModule);
  1113. this.container.load(ControlFlowTransformersModule_1.controlFlowTransformersModule);
  1114. this.container.load(ConvertingTransformersModule_1.convertingTransformersModule);
  1115. this.container.load(CustomNodesModule_1.customNodesModule);
  1116. this.container.load(FinalizingTransformersModule_1.finalizingTransformersModule);
  1117. this.container.load(GeneratorsModule_1.generatorsModule);
  1118. this.container.load(NodeTransformersModule_1.nodeTransformersModule);
  1119. this.container.load(ObfuscatingTransformersModule_1.obfuscatingTransformersModule);
  1120. this.container.load(PreparingTransformersModule_1.preparingTransformersModule);
  1121. this.container.load(StoragesModule_1.storagesModule);
  1122. this.container.load(UtilsModule_1.utilsModule);
  1123. }
  1124. }, {
  1125. key: "unload",
  1126. value: function unload() {
  1127. this.container.unbindAll();
  1128. }
  1129. }], [{
  1130. key: "getFactory",
  1131. value: function getFactory(serviceIdentifier) {
  1132. return function (context) {
  1133. return function (bindingName) {
  1134. return context.container.getNamed(serviceIdentifier, bindingName);
  1135. };
  1136. };
  1137. }
  1138. }, {
  1139. key: "getCacheFactory",
  1140. value: function getCacheFactory(serviceIdentifier) {
  1141. return function (context) {
  1142. var cache = new Map();
  1143. return function (bindingName) {
  1144. if (cache.has(bindingName)) {
  1145. return cache.get(bindingName);
  1146. }
  1147. var object = context.container.getNamed(serviceIdentifier, bindingName);
  1148. cache.set(bindingName, object);
  1149. return object;
  1150. };
  1151. };
  1152. }
  1153. }, {
  1154. key: "getConstructorFactory",
  1155. value: function getConstructorFactory(serviceIdentifier) {
  1156. for (var _len = arguments.length, dependencies = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  1157. dependencies[_key - 1] = arguments[_key];
  1158. }
  1159. return function (context) {
  1160. var cache = new Map();
  1161. var cachedDependencies = [];
  1162. return function (bindingName) {
  1163. dependencies.forEach(function (dependency, index) {
  1164. if (!cachedDependencies[index]) {
  1165. cachedDependencies[index] = context.container.get(dependency);
  1166. }
  1167. });
  1168. if (cache.has(bindingName)) {
  1169. return new (Function.prototype.bind.apply(cache.get(bindingName), [null].concat(cachedDependencies)))();
  1170. }
  1171. var constructor = context.container.getNamed(serviceIdentifier, bindingName);
  1172. cache.set(bindingName, constructor);
  1173. return new (Function.prototype.bind.apply(constructor, [null].concat(cachedDependencies)))();
  1174. };
  1175. };
  1176. }
  1177. }]);
  1178. return InversifyContainerFacade;
  1179. }();
  1180. exports.InversifyContainerFacade = InversifyContainerFacade;
  1181. /***/ }),
  1182. /* 16 */
  1183. /***/ (function(module, exports, __webpack_require__) {
  1184. "use strict";
  1185. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  1186. function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
  1187. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1188. Object.defineProperty(exports, "__esModule", { value: true });
  1189. var NodeGuards_1 = __webpack_require__(4);
  1190. var NodeAppender = function () {
  1191. function NodeAppender() {
  1192. _classCallCheck(this, NodeAppender);
  1193. }
  1194. _createClass(NodeAppender, null, [{
  1195. key: "appendNode",
  1196. value: function appendNode(scopeNode, scopeStatements) {
  1197. if (!NodeAppender.validateScopeStatements(scopeStatements)) {
  1198. scopeStatements = [];
  1199. }
  1200. scopeStatements = NodeAppender.parentizeScopeStatementsBeforeAppend(scopeNode, scopeStatements);
  1201. NodeAppender.setScopeNodeStatements(scopeNode, [].concat(_toConsumableArray(NodeAppender.getScopeNodeStatements(scopeNode)), _toConsumableArray(scopeStatements)));
  1202. }
  1203. }, {
  1204. key: "appendNodeToOptimalBlockScope",
  1205. value: function appendNodeToOptimalBlockScope(blockScopeStackTraceData, blockScopeNode, nodeBodyStatements) {
  1206. var index = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  1207. var targetBlockScope = void 0;
  1208. if (!blockScopeStackTraceData.length) {
  1209. targetBlockScope = blockScopeNode;
  1210. } else {
  1211. targetBlockScope = NodeAppender.getOptimalBlockScope(blockScopeStackTraceData, index);
  1212. }
  1213. NodeAppender.prependNode(targetBlockScope, nodeBodyStatements);
  1214. }
  1215. }, {
  1216. key: "getOptimalBlockScope",
  1217. value: function getOptimalBlockScope(blockScopeTraceData, index) {
  1218. var deep = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Infinity;
  1219. var firstCall = blockScopeTraceData[index];
  1220. if (deep <= 0) {
  1221. throw new Error("Invalid `deep` argument value. Value should be bigger then 0.");
  1222. }
  1223. if (deep > 1 && firstCall.stackTrace.length) {
  1224. return NodeAppender.getOptimalBlockScope(firstCall.stackTrace, 0, --deep);
  1225. } else {
  1226. return firstCall.callee;
  1227. }
  1228. }
  1229. }, {
  1230. key: "insertNodeAfter",
  1231. value: function insertNodeAfter(scopeNode, scopeStatements, targetStatement) {
  1232. var indexInScopeStatement = NodeAppender.getScopeNodeStatements(scopeNode).indexOf(targetStatement);
  1233. NodeAppender.insertNodeAtIndex(scopeNode, scopeStatements, indexInScopeStatement + 1);
  1234. }
  1235. }, {
  1236. key: "insertNodeAtIndex",
  1237. value: function insertNodeAtIndex(scopeNode, scopeStatements, index) {
  1238. if (!NodeAppender.validateScopeStatements(scopeStatements)) {
  1239. scopeStatements = [];
  1240. }
  1241. scopeStatements = NodeAppender.parentizeScopeStatementsBeforeAppend(scopeNode, scopeStatements);
  1242. NodeAppender.setScopeNodeStatements(scopeNode, [].concat(_toConsumableArray(NodeAppender.getScopeNodeStatements(scopeNode).slice(0, index)), _toConsumableArray(scopeStatements), _toConsumableArray(NodeAppender.getScopeNodeStatements(scopeNode).slice(index))));
  1243. }
  1244. }, {
  1245. key: "prependNode",
  1246. value: function prependNode(scopeNode, scopeStatements) {
  1247. if (!NodeAppender.validateScopeStatements(scopeStatements)) {
  1248. scopeStatements = [];
  1249. }
  1250. scopeStatements = NodeAppender.parentizeScopeStatementsBeforeAppend(scopeNode, scopeStatements);
  1251. NodeAppender.setScopeNodeStatements(scopeNode, [].concat(_toConsumableArray(scopeStatements), _toConsumableArray(NodeAppender.getScopeNodeStatements(scopeNode))));
  1252. }
  1253. }, {
  1254. key: "getScopeNodeStatements",
  1255. value: function getScopeNodeStatements(scopeNode) {
  1256. if (NodeGuards_1.NodeGuards.isSwitchCaseNode(scopeNode)) {
  1257. return scopeNode.consequent;
  1258. }
  1259. return scopeNode.body;
  1260. }
  1261. }, {
  1262. key: "parentizeScopeStatementsBeforeAppend",
  1263. value: function parentizeScopeStatementsBeforeAppend(scopeNode, scopeStatements) {
  1264. scopeStatements.forEach(function (statement) {
  1265. statement.parentNode = scopeNode;
  1266. });
  1267. return scopeStatements;
  1268. }
  1269. }, {
  1270. key: "setScopeNodeStatements",
  1271. value: function setScopeNodeStatements(scopeNode, statements) {
  1272. if (NodeGuards_1.NodeGuards.isSwitchCaseNode(scopeNode)) {
  1273. scopeNode.consequent = statements;
  1274. return;
  1275. }
  1276. scopeNode.body = statements;
  1277. }
  1278. }, {
  1279. key: "validateScopeStatements",
  1280. value: function validateScopeStatements(scopeStatement) {
  1281. return scopeStatement.every(function (statementNode) {
  1282. return !!statementNode && statementNode.hasOwnProperty('type');
  1283. });
  1284. }
  1285. }]);
  1286. return NodeAppender;
  1287. }();
  1288. exports.NodeAppender = NodeAppender;
  1289. /***/ }),
  1290. /* 17 */
  1291. /***/ (function(module, exports, __webpack_require__) {
  1292. "use strict";
  1293. Object.defineProperty(exports, "__esModule", { value: true });
  1294. var ObfuscationEvent;
  1295. (function (ObfuscationEvent) {
  1296. ObfuscationEvent["AfterObfuscation"] = "afterObfuscation";
  1297. ObfuscationEvent["BeforeObfuscation"] = "beforeObfuscation";
  1298. })(ObfuscationEvent = exports.ObfuscationEvent || (exports.ObfuscationEvent = {}));
  1299. /***/ }),
  1300. /* 18 */
  1301. /***/ (function(module, exports, __webpack_require__) {
  1302. "use strict";
  1303. Object.defineProperty(exports, "__esModule", { value: true });
  1304. var IdentifierObfuscatingReplacer;
  1305. (function (IdentifierObfuscatingReplacer) {
  1306. IdentifierObfuscatingReplacer["BaseIdentifierObfuscatingReplacer"] = "BaseIdentifierObfuscatingReplacer";
  1307. })(IdentifierObfuscatingReplacer = exports.IdentifierObfuscatingReplacer || (exports.IdentifierObfuscatingReplacer = {}));
  1308. /***/ }),
  1309. /* 19 */
  1310. /***/ (function(module, exports, __webpack_require__) {
  1311. "use strict";
  1312. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  1313. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1314. Object.defineProperty(exports, "__esModule", { value: true });
  1315. __webpack_require__(50);
  1316. var ServiceIdentifiers_1 = __webpack_require__(1);
  1317. var InversifyContainerFacade_1 = __webpack_require__(15);
  1318. var JavaScriptObfuscatorCLI_1 = __webpack_require__(34);
  1319. var JavaScriptObfuscatorFacade = function () {
  1320. function JavaScriptObfuscatorFacade() {
  1321. _classCallCheck(this, JavaScriptObfuscatorFacade);
  1322. }
  1323. _createClass(JavaScriptObfuscatorFacade, null, [{
  1324. key: "obfuscate",
  1325. value: function obfuscate(sourceCode) {
  1326. var inputOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1327. var inversifyContainerFacade = new InversifyContainerFacade_1.InversifyContainerFacade();
  1328. inversifyContainerFacade.load(sourceCode, inputOptions);
  1329. var javaScriptObfuscator = inversifyContainerFacade.get(ServiceIdentifiers_1.ServiceIdentifiers.IJavaScriptObfuscator);
  1330. var obfuscationResult = javaScriptObfuscator.obfuscate(sourceCode);
  1331. inversifyContainerFacade.unload();
  1332. return obfuscationResult;
  1333. }
  1334. }, {
  1335. key: "runCLI",
  1336. value: function runCLI(argv) {
  1337. var javaScriptObfuscatorCLI = new JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI(argv);
  1338. javaScriptObfuscatorCLI.initialize();
  1339. javaScriptObfuscatorCLI.run();
  1340. }
  1341. }]);
  1342. return JavaScriptObfuscatorFacade;
  1343. }();
  1344. exports.JavaScriptObfuscator = JavaScriptObfuscatorFacade;
  1345. /***/ }),
  1346. /* 20 */
  1347. /***/ (function(module, exports, __webpack_require__) {
  1348. "use strict";
  1349. Object.defineProperty(exports, "__esModule", { value: true });
  1350. var NodeTransformer;
  1351. (function (NodeTransformer) {
  1352. NodeTransformer["BlockStatementControlFlowTransformer"] = "BlockStatementControlFlowTransformer";
  1353. NodeTransformer["ClassDeclarationTransformer"] = "ClassDeclarationTransformer";
  1354. NodeTransformer["CommentsTransformer"] = "CommentsTransformer";
  1355. NodeTransformer["DeadCodeInjectionTransformer"] = "DeadCodeInjectionTransformer";
  1356. NodeTransformer["EvalCallExpressionTransformer"] = "EvalCallExpressionTransformer";
  1357. NodeTransformer["FunctionControlFlowTransformer"] = "FunctionControlFlowTransformer";
  1358. NodeTransformer["CatchClauseTransformer"] = "CatchClauseTransformer";
  1359. NodeTransformer["FunctionDeclarationTransformer"] = "FunctionDeclarationTransformer";
  1360. NodeTransformer["FunctionTransformer"] = "FunctionTransformer";
  1361. NodeTransformer["LabeledStatementTransformer"] = "LabeledStatementTransformer";
  1362. NodeTransformer["LiteralTransformer"] = "LiteralTransformer";
  1363. NodeTransformer["MemberExpressionTransformer"] = "MemberExpressionTransformer";
  1364. NodeTransformer["MethodDefinitionTransformer"] = "MethodDefinitionTransformer";
  1365. NodeTransformer["ObfuscatingGuardsTransformer"] = "ObfuscatingGuardsTransformer";
  1366. NodeTransformer["ObjectExpressionKeysTransformer"] = "ObjectExpressionKeysTransformer";
  1367. NodeTransformer["ObjectExpressionTransformer"] = "ObjectExpressionTransformer";
  1368. NodeTransformer["ParentificationTransformer"] = "ParentificationTransformer";
  1369. NodeTransformer["TemplateLiteralTransformer"] = "TemplateLiteralTransformer";
  1370. NodeTransformer["VariableDeclarationTransformer"] = "VariableDeclarationTransformer";
  1371. })(NodeTransformer = exports.NodeTransformer || (exports.NodeTransformer = {}));
  1372. /***/ }),
  1373. /* 21 */
  1374. /***/ (function(module, exports, __webpack_require__) {
  1375. "use strict";
  1376. Object.defineProperty(exports, "__esModule", { value: true });
  1377. var CustomNode;
  1378. (function (CustomNode) {
  1379. CustomNode["ConsoleOutputDisableExpressionNode"] = "ConsoleOutputDisableExpressionNode";
  1380. CustomNode["DebugProtectionFunctionCallNode"] = "DebugProtectionFunctionCallNode";
  1381. CustomNode["DebugProtectionFunctionIntervalNode"] = "DebugProtectionFunctionIntervalNode";
  1382. CustomNode["DebugProtectionFunctionNode"] = "DebugProtectionFunctionNode";
  1383. CustomNode["DomainLockNode"] = "DomainLockNode";
  1384. CustomNode["NodeCallsControllerFunctionNode"] = "NodeCallsControllerFunctionNode";
  1385. CustomNode["SelfDefendingUnicodeNode"] = "SelfDefendingUnicodeNode";
  1386. CustomNode["StringArrayCallsWrapper"] = "StringArrayCallsWrapper";
  1387. CustomNode["StringArrayNode"] = "StringArrayNode";
  1388. CustomNode["StringArrayRotateFunctionNode"] = "StringArrayRotateFunctionNode";
  1389. })(CustomNode = exports.CustomNode || (exports.CustomNode = {}));
  1390. /***/ }),
  1391. /* 22 */
  1392. /***/ (function(module, exports, __webpack_require__) {
  1393. "use strict";
  1394. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  1395. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1396. Object.defineProperty(exports, "__esModule", { value: true });
  1397. var JSFuck_1 = __webpack_require__(113);
  1398. var Utils = function () {
  1399. function Utils() {
  1400. _classCallCheck(this, Utils);
  1401. }
  1402. _createClass(Utils, null, [{
  1403. key: "decToHex",
  1404. value: function decToHex(dec) {
  1405. var radix = 16;
  1406. return dec.toString(radix);
  1407. }
  1408. }, {
  1409. key: "extractDomainFromUrl",
  1410. value: function extractDomainFromUrl(url) {
  1411. var domain = void 0;
  1412. if (url.indexOf('://') > -1 || url.indexOf('//') === 0) {
  1413. domain = url.split('/')[2];
  1414. } else {
  1415. domain = url.split('/')[0];
  1416. }
  1417. domain = domain.split(':')[0];
  1418. return domain;
  1419. }
  1420. }, {
  1421. key: "isCeilNumber",
  1422. value: function isCeilNumber(number) {
  1423. return number % 1 === 0;
  1424. }
  1425. }, {
  1426. key: "stringRotate",
  1427. value: function stringRotate(string, times) {
  1428. if (!string) {
  1429. throw new ReferenceError("Cannot rotate empty string.");
  1430. }
  1431. for (var i = 0; i < times; i++) {
  1432. string = string[string.length - 1] + string.substring(0, string.length - 1);
  1433. }
  1434. return string;
  1435. }
  1436. }, {
  1437. key: "stringToJSFuck",
  1438. value: function stringToJSFuck(string) {
  1439. return Array.from(string).map(function (character) {
  1440. return JSFuck_1.JSFuck[character] || character;
  1441. }).join(' + ');
  1442. }
  1443. }]);
  1444. return Utils;
  1445. }();
  1446. Utils.hexadecimalPrefix = '0x';
  1447. exports.Utils = Utils;
  1448. /***/ }),
  1449. /* 23 */
  1450. /***/ (function(module, exports, __webpack_require__) {
  1451. "use strict";
  1452. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  1453. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1454. Object.defineProperty(exports, "__esModule", { value: true });
  1455. var tslib_1 = __webpack_require__(2);
  1456. var inversify_1 = __webpack_require__(0);
  1457. var ServiceIdentifiers_1 = __webpack_require__(1);
  1458. var AbstractCustomNodeGroup = function () {
  1459. function AbstractCustomNodeGroup(identifierNamesGeneratorFactory, randomGenerator, options) {
  1460. _classCallCheck(this, AbstractCustomNodeGroup);
  1461. this.identifierNamesGenerator = identifierNamesGeneratorFactory(options);
  1462. this.randomGenerator = randomGenerator;
  1463. this.options = options;
  1464. }
  1465. _createClass(AbstractCustomNodeGroup, [{
  1466. key: "getAppendEvent",
  1467. value: function getAppendEvent() {
  1468. return this.appendEvent;
  1469. }
  1470. }, {
  1471. key: "getCustomNodes",
  1472. value: function getCustomNodes() {
  1473. return this.customNodes;
  1474. }
  1475. }, {
  1476. key: "appendCustomNodeIfExist",
  1477. value: function appendCustomNodeIfExist(customNodeName, callback) {
  1478. var customNode = this.customNodes.get(customNodeName);
  1479. if (!customNode) {
  1480. return;
  1481. }
  1482. callback(customNode);
  1483. }
  1484. }, {
  1485. key: "getRandomStackTraceIndex",
  1486. value: function getRandomStackTraceIndex(stackTraceLength) {
  1487. return this.randomGenerator.getRandomInteger(0, Math.max(0, Math.round(stackTraceLength - 1)));
  1488. }
  1489. }]);
  1490. return AbstractCustomNodeGroup;
  1491. }();
  1492. AbstractCustomNodeGroup = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], AbstractCustomNodeGroup);
  1493. exports.AbstractCustomNodeGroup = AbstractCustomNodeGroup;
  1494. /***/ }),
  1495. /* 24 */
  1496. /***/ (function(module, exports, __webpack_require__) {
  1497. "use strict";
  1498. Object.defineProperty(exports, "__esModule", { value: true });
  1499. var IdentifierNamesGenerator;
  1500. (function (IdentifierNamesGenerator) {
  1501. IdentifierNamesGenerator["HexadecimalIdentifierNamesGenerator"] = "hexadecimal";
  1502. IdentifierNamesGenerator["MangledIdentifierNamesGenerator"] = "mangled";
  1503. })(IdentifierNamesGenerator = exports.IdentifierNamesGenerator || (exports.IdentifierNamesGenerator = {}));
  1504. /***/ }),
  1505. /* 25 */
  1506. /***/ (function(module, exports, __webpack_require__) {
  1507. "use strict";
  1508. Object.defineProperty(exports, "__esModule", { value: true });
  1509. var SourceMapMode;
  1510. (function (SourceMapMode) {
  1511. SourceMapMode["Inline"] = "inline";
  1512. SourceMapMode["Separate"] = "separate";
  1513. })(SourceMapMode = exports.SourceMapMode || (exports.SourceMapMode = {}));
  1514. /***/ }),
  1515. /* 26 */
  1516. /***/ (function(module, exports, __webpack_require__) {
  1517. "use strict";
  1518. Object.defineProperty(exports, "__esModule", { value: true });
  1519. var StringArrayEncoding;
  1520. (function (StringArrayEncoding) {
  1521. StringArrayEncoding["Base64"] = "base64";
  1522. StringArrayEncoding["Rc4"] = "rc4";
  1523. })(StringArrayEncoding = exports.StringArrayEncoding || (exports.StringArrayEncoding = {}));
  1524. /***/ }),
  1525. /* 27 */
  1526. /***/ (function(module, exports, __webpack_require__) {
  1527. "use strict";
  1528. Object.defineProperty(exports, "__esModule", { value: true });
  1529. var IdentifierNamesGenerator_1 = __webpack_require__(24);
  1530. var ObfuscationTarget_1 = __webpack_require__(14);
  1531. var SourceMapMode_1 = __webpack_require__(25);
  1532. exports.NO_ADDITIONAL_NODES_PRESET = Object.freeze({
  1533. compact: true,
  1534. controlFlowFlattening: false,
  1535. controlFlowFlatteningThreshold: 0,
  1536. deadCodeInjection: false,
  1537. deadCodeInjectionThreshold: 0,
  1538. debugProtection: false,
  1539. debugProtectionInterval: false,
  1540. disableConsoleOutput: false,
  1541. domainLock: [],
  1542. identifierNamesGenerator: IdentifierNamesGenerator_1.IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator,
  1543. log: false,
  1544. renameGlobals: false,
  1545. reservedNames: [],
  1546. rotateStringArray: false,
  1547. seed: 0,
  1548. selfDefending: false,
  1549. sourceMap: false,
  1550. sourceMapBaseUrl: '',
  1551. sourceMapFileName: '',
  1552. sourceMapMode: SourceMapMode_1.SourceMapMode.Separate,
  1553. stringArray: false,
  1554. stringArrayEncoding: false,
  1555. stringArrayThreshold: 0,
  1556. target: ObfuscationTarget_1.ObfuscationTarget.Browser,
  1557. transformObjectKeys: false,
  1558. unicodeEscapeSequence: false
  1559. });
  1560. /***/ }),
  1561. /* 28 */
  1562. /***/ (function(module, exports, __webpack_require__) {
  1563. "use strict";
  1564. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1565. Object.defineProperty(exports, "__esModule", { value: true });
  1566. var tslib_1 = __webpack_require__(2);
  1567. var inversify_1 = __webpack_require__(0);
  1568. var ServiceIdentifiers_1 = __webpack_require__(1);
  1569. var AbstractObfuscatingReplacer = function AbstractObfuscatingReplacer(options) {
  1570. _classCallCheck(this, AbstractObfuscatingReplacer);
  1571. this.options = options;
  1572. };
  1573. AbstractObfuscatingReplacer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object])], AbstractObfuscatingReplacer);
  1574. exports.AbstractObfuscatingReplacer = AbstractObfuscatingReplacer;
  1575. /***/ }),
  1576. /* 29 */
  1577. /***/ (function(module, exports, __webpack_require__) {
  1578. "use strict";
  1579. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1580. Object.defineProperty(exports, "__esModule", { value: true });
  1581. var tslib_1 = __webpack_require__(2);
  1582. var inversify_1 = __webpack_require__(0);
  1583. var AbstractCalleeDataExtractor = function AbstractCalleeDataExtractor() {
  1584. _classCallCheck(this, AbstractCalleeDataExtractor);
  1585. };
  1586. AbstractCalleeDataExtractor = tslib_1.__decorate([inversify_1.injectable()], AbstractCalleeDataExtractor);
  1587. exports.AbstractCalleeDataExtractor = AbstractCalleeDataExtractor;
  1588. /***/ }),
  1589. /* 30 */
  1590. /***/ (function(module, exports) {
  1591. module.exports = require("escodegen-wallaby");
  1592. /***/ }),
  1593. /* 31 */
  1594. /***/ (function(module, exports, __webpack_require__) {
  1595. "use strict";
  1596. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  1597. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1598. Object.defineProperty(exports, "__esModule", { value: true });
  1599. var tslib_1 = __webpack_require__(2);
  1600. var inversify_1 = __webpack_require__(0);
  1601. var ServiceIdentifiers_1 = __webpack_require__(1);
  1602. var AbstractControlFlowReplacer = AbstractControlFlowReplacer_1 = function () {
  1603. function AbstractControlFlowReplacer(controlFlowCustomNodeFactory, randomGenerator, options) {
  1604. _classCallCheck(this, AbstractControlFlowReplacer);
  1605. this.replacerDataByControlFlowStorageId = new Map();
  1606. this.controlFlowCustomNodeFactory = controlFlowCustomNodeFactory;
  1607. this.randomGenerator = randomGenerator;
  1608. this.options = options;
  1609. }
  1610. _createClass(AbstractControlFlowReplacer, [{
  1611. key: "insertCustomNodeToControlFlowStorage",
  1612. value: function insertCustomNodeToControlFlowStorage(customNode, controlFlowStorage, replacerId, usingExistingIdentifierChance) {
  1613. var _this = this;
  1614. var controlFlowStorageId = controlFlowStorage.getStorageId();
  1615. var storageKeysById = AbstractControlFlowReplacer_1.getStorageKeysByIdForCurrentStorage(this.replacerDataByControlFlowStorageId, controlFlowStorageId);
  1616. var storageKeysForCurrentId = storageKeysById.get(replacerId);
  1617. if (this.randomGenerator.getMathRandom() < usingExistingIdentifierChance && storageKeysForCurrentId && storageKeysForCurrentId.length) {
  1618. return this.randomGenerator.getRandomGenerator().pickone(storageKeysForCurrentId);
  1619. }
  1620. var generateStorageKey = function generateStorageKey(length) {
  1621. var key = _this.randomGenerator.getRandomString(length);
  1622. if (controlFlowStorage.getStorage().has(key)) {
  1623. return generateStorageKey(length);
  1624. }
  1625. return key;
  1626. };
  1627. var storageKey = generateStorageKey(5);
  1628. storageKeysById.set(replacerId, [storageKey]);
  1629. this.replacerDataByControlFlowStorageId.set(controlFlowStorageId, storageKeysById);
  1630. controlFlowStorage.set(storageKey, customNode);
  1631. return storageKey;
  1632. }
  1633. }], [{
  1634. key: "getStorageKeysByIdForCurrentStorage",
  1635. value: function getStorageKeysByIdForCurrentStorage(identifierDataByControlFlowStorageId, controlFlowStorageId) {
  1636. var storageKeysById = void 0;
  1637. if (identifierDataByControlFlowStorageId.has(controlFlowStorageId)) {
  1638. storageKeysById = identifierDataByControlFlowStorageId.get(controlFlowStorageId);
  1639. } else {
  1640. storageKeysById = new Map();
  1641. }
  1642. return storageKeysById;
  1643. }
  1644. }]);
  1645. return AbstractControlFlowReplacer;
  1646. }();
  1647. AbstractControlFlowReplacer = AbstractControlFlowReplacer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowCustomNode)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], AbstractControlFlowReplacer);
  1648. exports.AbstractControlFlowReplacer = AbstractControlFlowReplacer;
  1649. var AbstractControlFlowReplacer_1;
  1650. /***/ }),
  1651. /* 32 */
  1652. /***/ (function(module, exports, __webpack_require__) {
  1653. "use strict";
  1654. Object.defineProperty(exports, "__esModule", { value: true });
  1655. function GlobalVariableNoEvalTemplate() {
  1656. return "\n var that = (typeof window !== 'undefined'\n ? window\n : (typeof process === 'object' &&\n typeof require === 'function' &&\n typeof global === 'object')\n ? global\n : this);\n ";
  1657. }
  1658. exports.GlobalVariableNoEvalTemplate = GlobalVariableNoEvalTemplate;
  1659. /***/ }),
  1660. /* 33 */
  1661. /***/ (function(module, exports, __webpack_require__) {
  1662. "use strict";
  1663. Object.defineProperty(exports, "__esModule", { value: true });
  1664. var IdentifierNamesGenerator_1 = __webpack_require__(24);
  1665. var ObfuscationTarget_1 = __webpack_require__(14);
  1666. var SourceMapMode_1 = __webpack_require__(25);
  1667. exports.DEFAULT_PRESET = Object.freeze({
  1668. compact: true,
  1669. config: '',
  1670. controlFlowFlattening: false,
  1671. controlFlowFlatteningThreshold: 0.75,
  1672. deadCodeInjection: false,
  1673. deadCodeInjectionThreshold: 0.4,
  1674. debugProtection: false,
  1675. debugProtectionInterval: false,
  1676. disableConsoleOutput: false,
  1677. domainLock: [],
  1678. identifierNamesGenerator: IdentifierNamesGenerator_1.IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator,
  1679. log: false,
  1680. renameGlobals: false,
  1681. reservedNames: [],
  1682. rotateStringArray: true,
  1683. seed: 0,
  1684. selfDefending: false,
  1685. sourceMap: false,
  1686. sourceMapBaseUrl: '',
  1687. sourceMapFileName: '',
  1688. sourceMapMode: SourceMapMode_1.SourceMapMode.Separate,
  1689. stringArray: true,
  1690. stringArrayEncoding: false,
  1691. stringArrayThreshold: 0.75,
  1692. target: ObfuscationTarget_1.ObfuscationTarget.Browser,
  1693. transformObjectKeys: false,
  1694. unicodeEscapeSequence: false
  1695. });
  1696. /***/ }),
  1697. /* 34 */
  1698. /***/ (function(module, exports, __webpack_require__) {
  1699. "use strict";
  1700. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  1701. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1702. Object.defineProperty(exports, "__esModule", { value: true });
  1703. var tslib_1 = __webpack_require__(2);
  1704. var commander = __webpack_require__(178);
  1705. var packageJson = __webpack_require__(47);
  1706. var path = __webpack_require__(35);
  1707. var Initializable_1 = __webpack_require__(5);
  1708. var Default_1 = __webpack_require__(33);
  1709. var ArraySanitizer_1 = __webpack_require__(179);
  1710. var BooleanSanitizer_1 = __webpack_require__(180);
  1711. var IdentifierNamesGeneratorSanitizer_1 = __webpack_require__(181);
  1712. var ObfuscatingTargetSanitizer_1 = __webpack_require__(182);
  1713. var SourceMapModeSanitizer_1 = __webpack_require__(183);
  1714. var StringArrayEncodingSanitizer_1 = __webpack_require__(184);
  1715. var CLIUtils_1 = __webpack_require__(185);
  1716. var JavaScriptObfuscatorFacade_1 = __webpack_require__(19);
  1717. var SourceCodeReader_1 = __webpack_require__(188);
  1718. var JavaScriptObfuscatorCLI = function () {
  1719. function JavaScriptObfuscatorCLI(argv) {
  1720. _classCallCheck(this, JavaScriptObfuscatorCLI);
  1721. this.rawArguments = argv;
  1722. this.arguments = argv.slice(2);
  1723. }
  1724. _createClass(JavaScriptObfuscatorCLI, [{
  1725. key: "initialize",
  1726. value: function initialize() {
  1727. this.inputPath = path.normalize(this.arguments[0] || '');
  1728. this.commands = new commander.Command();
  1729. this.configureCommands();
  1730. this.configureHelp();
  1731. this.inputCLIOptions = this.commands.opts();
  1732. }
  1733. }, {
  1734. key: "run",
  1735. value: function run() {
  1736. var canShowHelp = !this.arguments.length || this.arguments.indexOf('--help') !== -1;
  1737. if (canShowHelp) {
  1738. return this.commands.outputHelp();
  1739. }
  1740. var sourceCodeData = SourceCodeReader_1.SourceCodeReader.readSourceCode(this.inputPath);
  1741. this.processSourceCodeData(sourceCodeData);
  1742. }
  1743. }, {
  1744. key: "buildOptions",
  1745. value: function buildOptions() {
  1746. var inputCLIOptions = JavaScriptObfuscatorCLI.filterOptions(this.inputCLIOptions);
  1747. var configFilePath = this.inputCLIOptions.config;
  1748. var configFileLocation = configFilePath ? path.resolve(configFilePath, '.') : '';
  1749. var configFileOptions = configFileLocation ? CLIUtils_1.CLIUtils.getUserConfig(configFileLocation) : {};
  1750. return Object.assign({}, Default_1.DEFAULT_PRESET, configFileOptions, inputCLIOptions);
  1751. }
  1752. }, {
  1753. key: "configureCommands",
  1754. value: function configureCommands() {
  1755. this.commands.usage('<inputPath> [options]').version(packageJson.version, '-v, --version').option('-o, --output <path>', 'Output path for obfuscated code').option('--compact <boolean>', 'Disable one line output code compacting', BooleanSanitizer_1.BooleanSanitizer).option('--config <boolean>', 'Name of js / json config file').option('--control-flow-flattening <boolean>', 'Enables control flow flattening', BooleanSanitizer_1.BooleanSanitizer).option('--control-flow-flattening-threshold <number>', 'The probability that the control flow flattening transformation will be applied to the node', parseFloat).option('--dead-code-injection <boolean>', 'Enables dead code injection', BooleanSanitizer_1.BooleanSanitizer).option('--dead-code-injection-threshold <number>', 'The probability that the dead code injection transformation will be applied to the node', parseFloat).option('--debug-protection <boolean>', 'Disable browser Debug panel (can cause DevTools enabled browser freeze)', BooleanSanitizer_1.BooleanSanitizer).option('--debug-protection-interval <boolean>', 'Disable browser Debug panel even after page was loaded (can cause DevTools enabled browser freeze)', BooleanSanitizer_1.BooleanSanitizer).option('--disable-console-output <boolean>', 'Allow console.log, console.info, console.error and console.warn messages output into browser console', BooleanSanitizer_1.BooleanSanitizer).option('--domain-lock <list> (comma separated, without whitespaces)', 'Blocks the execution of the code in domains that do not match the passed RegExp patterns (comma separated)', ArraySanitizer_1.ArraySanitizer).option('--identifier-names-generator <string> [hexadecimal, mangled]', 'Sets identifier names generator (Default: hexadecimal)', IdentifierNamesGeneratorSanitizer_1.IdentifierNamesGeneratorSanitizer).option('--log <boolean>', 'Enables logging of the information to the console', BooleanSanitizer_1.BooleanSanitizer).option('--reserved-names <list> (comma separated, without whitespaces)', 'Disable obfuscation of variable names, function names and names of function parameters that match the passed RegExp patterns (comma separated)', ArraySanitizer_1.ArraySanitizer).option('--rename-globals <boolean>', 'Allows to enable obfuscation of global variable and function names with declaration.', BooleanSanitizer_1.BooleanSanitizer).option('--rotate-string-array <boolean>', 'Disable rotation of unicode array values during obfuscation', BooleanSanitizer_1.BooleanSanitizer).option('--seed <number>', 'Sets seed for random generator. This is useful for creating repeatable results.', parseFloat).option('--self-defending <boolean>', 'Disables self-defending for obfuscated code', BooleanSanitizer_1.BooleanSanitizer).option('--source-map <boolean>', 'Enables source map generation', BooleanSanitizer_1.BooleanSanitizer).option('--source-map-base-url <string>', 'Sets base url to the source map import url when `--source-map-mode=separate`').option('--source-map-file-name <string>', 'Sets file name for output source map when `--source-map-mode=separate`').option('--source-map-mode <string> [inline, separate]', 'Specify source map output mode', SourceMapModeSanitizer_1.SourceMapModeSanitizer).option('--string-array <boolean>', 'Disables gathering of all literal strings into an array and replacing every literal string with an array call', BooleanSanitizer_1.BooleanSanitizer).option('--string-array-encoding <boolean|string> [true, false, base64, rc4]', 'Encodes all strings in strings array using base64 or rc4 (this option can slow down your code speed', StringArrayEncodingSanitizer_1.StringArrayEncodingSanitizer).option('--string-array-threshold <number>', 'The probability that the literal string will be inserted into stringArray (Default: 0.8, Min: 0, Max: 1)', parseFloat).option('--target <string>', 'Allows to set target environment for obfuscated code.', ObfuscatingTargetSanitizer_1.ObfuscationTargetSanitizer).option('--transform-object-keys <boolean>', 'Enables transformation of object keys', BooleanSanitizer_1.BooleanSanitizer).option('--unicode-escape-sequence <boolean>', 'Allows to enable/disable string conversion to unicode escape sequence', BooleanSanitizer_1.BooleanSanitizer).parse(this.rawArguments);
  1756. }
  1757. }, {
  1758. key: "configureHelp",
  1759. value: function configureHelp() {
  1760. this.commands.on('--help', function () {
  1761. console.log(' Examples:\n');
  1762. console.log(' %> javascript-obfuscator input_file_name.js --compact true --self-defending false');
  1763. console.log(' %> javascript-obfuscator input_file_name.js --output output_file_name.js --compact true --self-defending false');
  1764. console.log(' %> javascript-obfuscator input_directory_name --compact true --self-defending false');
  1765. console.log('');
  1766. });
  1767. }
  1768. }, {
  1769. key: "processSourceCodeData",
  1770. value: function processSourceCodeData(sourceCodeData) {
  1771. var _this = this;
  1772. var outputPath = this.inputCLIOptions.output ? path.normalize(this.inputCLIOptions.output) : '';
  1773. if (!Array.isArray(sourceCodeData)) {
  1774. var outputCodePath = outputPath || CLIUtils_1.CLIUtils.getOutputCodePath(this.inputPath);
  1775. this.processSourceCode(sourceCodeData, outputCodePath);
  1776. } else {
  1777. sourceCodeData.forEach(function (_ref) {
  1778. var filePath = _ref.filePath,
  1779. content = _ref.content;
  1780. var outputCodePath = outputPath ? path.join(outputPath, filePath) : CLIUtils_1.CLIUtils.getOutputCodePath(filePath);
  1781. _this.processSourceCode(content, outputCodePath);
  1782. });
  1783. }
  1784. }
  1785. }, {
  1786. key: "processSourceCode",
  1787. value: function processSourceCode(sourceCode, outputCodePath) {
  1788. var options = this.buildOptions();
  1789. if (options.sourceMap) {
  1790. JavaScriptObfuscatorCLI.processSourceCodeWithSourceMap(sourceCode, outputCodePath, options);
  1791. } else {
  1792. JavaScriptObfuscatorCLI.processSourceCodeWithoutSourceMap(sourceCode, outputCodePath, options);
  1793. }
  1794. }
  1795. }], [{
  1796. key: "filterOptions",
  1797. value: function filterOptions(options) {
  1798. var filteredOptions = {};
  1799. for (var option in options) {
  1800. if (!options.hasOwnProperty(option) || options[option] === undefined) {
  1801. continue;
  1802. }
  1803. filteredOptions[option] = options[option];
  1804. }
  1805. return filteredOptions;
  1806. }
  1807. }, {
  1808. key: "processSourceCodeWithoutSourceMap",
  1809. value: function processSourceCodeWithoutSourceMap(sourceCode, outputCodePath, options) {
  1810. var obfuscatedCode = JavaScriptObfuscatorFacade_1.JavaScriptObfuscator.obfuscate(sourceCode, options).getObfuscatedCode();
  1811. CLIUtils_1.CLIUtils.writeFile(outputCodePath, obfuscatedCode);
  1812. }
  1813. }, {
  1814. key: "processSourceCodeWithSourceMap",
  1815. value: function processSourceCodeWithSourceMap(sourceCode, outputCodePath, options) {
  1816. var outputSourceMapPath = CLIUtils_1.CLIUtils.getOutputSourceMapPath(outputCodePath, options.sourceMapFileName || '');
  1817. options = Object.assign({}, options, { sourceMapFileName: path.basename(outputSourceMapPath) });
  1818. var obfuscationResult = JavaScriptObfuscatorFacade_1.JavaScriptObfuscator.obfuscate(sourceCode, options);
  1819. CLIUtils_1.CLIUtils.writeFile(outputCodePath, obfuscationResult.getObfuscatedCode());
  1820. if (options.sourceMapMode === 'separate' && obfuscationResult.getSourceMap()) {
  1821. CLIUtils_1.CLIUtils.writeFile(outputSourceMapPath, obfuscationResult.getSourceMap());
  1822. }
  1823. }
  1824. }]);
  1825. return JavaScriptObfuscatorCLI;
  1826. }();
  1827. JavaScriptObfuscatorCLI.availableInputExtensions = ['.js'];
  1828. JavaScriptObfuscatorCLI.encoding = 'utf8';
  1829. JavaScriptObfuscatorCLI.obfuscatedFilePrefix = '-obfuscated';
  1830. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], JavaScriptObfuscatorCLI.prototype, "commands", void 0);
  1831. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], JavaScriptObfuscatorCLI.prototype, "inputCLIOptions", void 0);
  1832. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], JavaScriptObfuscatorCLI.prototype, "inputPath", void 0);
  1833. exports.JavaScriptObfuscatorCLI = JavaScriptObfuscatorCLI;
  1834. /***/ }),
  1835. /* 35 */
  1836. /***/ (function(module, exports) {
  1837. module.exports = require("path");
  1838. /***/ }),
  1839. /* 36 */
  1840. /***/ (function(module, exports, __webpack_require__) {
  1841. "use strict";
  1842. Object.defineProperty(exports, "__esModule", { value: true });
  1843. var CalleeDataExtractor;
  1844. (function (CalleeDataExtractor) {
  1845. CalleeDataExtractor["FunctionDeclarationCalleeDataExtractor"] = "FunctionDeclarationCalleeDataExtractor";
  1846. CalleeDataExtractor["FunctionExpressionCalleeDataExtractor"] = "FunctionExpressionCalleeDataExtractor";
  1847. CalleeDataExtractor["ObjectExpressionCalleeDataExtractor"] = "ObjectExpressionCalleeDataExtractor";
  1848. })(CalleeDataExtractor = exports.CalleeDataExtractor || (exports.CalleeDataExtractor = {}));
  1849. /***/ }),
  1850. /* 37 */
  1851. /***/ (function(module, exports) {
  1852. module.exports = require("esprima");
  1853. /***/ }),
  1854. /* 38 */
  1855. /***/ (function(module, exports, __webpack_require__) {
  1856. "use strict";
  1857. Object.defineProperty(exports, "__esModule", { value: true });
  1858. var ControlFlowReplacer;
  1859. (function (ControlFlowReplacer) {
  1860. ControlFlowReplacer["BinaryExpressionControlFlowReplacer"] = "BinaryExpressionControlFlowReplacer";
  1861. ControlFlowReplacer["CallExpressionControlFlowReplacer"] = "CallExpressionControlFlowReplacer";
  1862. ControlFlowReplacer["LogicalExpressionControlFlowReplacer"] = "LogicalExpressionControlFlowReplacer";
  1863. ControlFlowReplacer["StringLiteralControlFlowReplacer"] = "StringLiteralControlFlowReplacer";
  1864. })(ControlFlowReplacer = exports.ControlFlowReplacer || (exports.ControlFlowReplacer = {}));
  1865. /***/ }),
  1866. /* 39 */
  1867. /***/ (function(module, exports, __webpack_require__) {
  1868. "use strict";
  1869. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  1870. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1871. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  1872. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  1873. Object.defineProperty(exports, "__esModule", { value: true });
  1874. var tslib_1 = __webpack_require__(2);
  1875. var inversify_1 = __webpack_require__(0);
  1876. var ServiceIdentifiers_1 = __webpack_require__(1);
  1877. var ControlFlowCustomNode_1 = __webpack_require__(13);
  1878. var AbstractControlFlowReplacer_1 = __webpack_require__(31);
  1879. var NodeGuards_1 = __webpack_require__(4);
  1880. var ExpressionWithOperatorControlFlowReplacer = function (_AbstractControlFlowR) {
  1881. _inherits(ExpressionWithOperatorControlFlowReplacer, _AbstractControlFlowR);
  1882. function ExpressionWithOperatorControlFlowReplacer(controlFlowCustomNodeFactory, randomGenerator, options) {
  1883. _classCallCheck(this, ExpressionWithOperatorControlFlowReplacer);
  1884. var _this = _possibleConstructorReturn(this, (ExpressionWithOperatorControlFlowReplacer.__proto__ || Object.getPrototypeOf(ExpressionWithOperatorControlFlowReplacer)).call(this, controlFlowCustomNodeFactory, randomGenerator, options));
  1885. _this.replacerDataByControlFlowStorageId = new Map();
  1886. return _this;
  1887. }
  1888. _createClass(ExpressionWithOperatorControlFlowReplacer, [{
  1889. key: "getControlFlowStorageCallNode",
  1890. value: function getControlFlowStorageCallNode(controlFlowStorageId, storageKey, leftExpression, rightExpression) {
  1891. var controlFlowStorageCallCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.ExpressionWithOperatorControlFlowStorageCallNode);
  1892. controlFlowStorageCallCustomNode.initialize(controlFlowStorageId, storageKey, leftExpression, rightExpression);
  1893. var statementNode = controlFlowStorageCallCustomNode.getNode()[0];
  1894. if (!statementNode || !NodeGuards_1.NodeGuards.isExpressionStatementNode(statementNode)) {
  1895. throw new Error("`controlFlowStorageCallCustomNode.getNode()[0]` should returns array with `ExpressionStatement` node");
  1896. }
  1897. return statementNode.expression;
  1898. }
  1899. }]);
  1900. return ExpressionWithOperatorControlFlowReplacer;
  1901. }(AbstractControlFlowReplacer_1.AbstractControlFlowReplacer);
  1902. ExpressionWithOperatorControlFlowReplacer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowCustomNode)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], ExpressionWithOperatorControlFlowReplacer);
  1903. exports.ExpressionWithOperatorControlFlowReplacer = ExpressionWithOperatorControlFlowReplacer;
  1904. /***/ }),
  1905. /* 40 */
  1906. /***/ (function(module, exports, __webpack_require__) {
  1907. "use strict";
  1908. Object.defineProperty(exports, "__esModule", { value: true });
  1909. var DeadCodeInjectionCustomNode;
  1910. (function (DeadCodeInjectionCustomNode) {
  1911. DeadCodeInjectionCustomNode["BlockStatementDeadCodeInjectionNode"] = "BlockStatementDeadCodeInjectionNode";
  1912. })(DeadCodeInjectionCustomNode = exports.DeadCodeInjectionCustomNode || (exports.DeadCodeInjectionCustomNode = {}));
  1913. /***/ }),
  1914. /* 41 */
  1915. /***/ (function(module, exports, __webpack_require__) {
  1916. "use strict";
  1917. Object.defineProperty(exports, "__esModule", { value: true });
  1918. var CustomNodeGroup;
  1919. (function (CustomNodeGroup) {
  1920. CustomNodeGroup["ConsoleOutputCustomNodeGroup"] = "ConsoleOutputCustomNodeGroup";
  1921. CustomNodeGroup["DebugProtectionCustomNodeGroup"] = "DebugProtectionCustomNodeGroup";
  1922. CustomNodeGroup["DomainLockCustomNodeGroup"] = "DomainLockCustomNodeGroup";
  1923. CustomNodeGroup["SelfDefendingCustomNodeGroup"] = "SelfDefendingCustomNodeGroup";
  1924. CustomNodeGroup["StringArrayCustomNodeGroup"] = "StringArrayCustomNodeGroup";
  1925. })(CustomNodeGroup = exports.CustomNodeGroup || (exports.CustomNodeGroup = {}));
  1926. /***/ }),
  1927. /* 42 */
  1928. /***/ (function(module, exports, __webpack_require__) {
  1929. "use strict";
  1930. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1931. Object.defineProperty(exports, "__esModule", { value: true });
  1932. var tslib_1 = __webpack_require__(2);
  1933. var inversify_1 = __webpack_require__(0);
  1934. var ServiceIdentifiers_1 = __webpack_require__(1);
  1935. var AbstractIdentifierNamesGenerator = function AbstractIdentifierNamesGenerator(randomGenerator, options) {
  1936. _classCallCheck(this, AbstractIdentifierNamesGenerator);
  1937. this.randomGenerator = randomGenerator;
  1938. this.options = options;
  1939. };
  1940. AbstractIdentifierNamesGenerator = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], AbstractIdentifierNamesGenerator);
  1941. exports.AbstractIdentifierNamesGenerator = AbstractIdentifierNamesGenerator;
  1942. /***/ }),
  1943. /* 43 */
  1944. /***/ (function(module, exports, __webpack_require__) {
  1945. "use strict";
  1946. Object.defineProperty(exports, "__esModule", { value: true });
  1947. var LiteralObfuscatingReplacer;
  1948. (function (LiteralObfuscatingReplacer) {
  1949. LiteralObfuscatingReplacer["BooleanLiteralObfuscatingReplacer"] = "BooleanLiteralObfuscatingReplacer";
  1950. LiteralObfuscatingReplacer["NumberLiteralObfuscatingReplacer"] = "NumberLiteralObfuscatingReplacer";
  1951. LiteralObfuscatingReplacer["StringLiteralObfuscatingReplacer"] = "StringLiteralObfuscatingReplacer";
  1952. })(LiteralObfuscatingReplacer = exports.LiteralObfuscatingReplacer || (exports.LiteralObfuscatingReplacer = {}));
  1953. /***/ }),
  1954. /* 44 */
  1955. /***/ (function(module, exports, __webpack_require__) {
  1956. "use strict";
  1957. Object.defineProperty(exports, "__esModule", { value: true });
  1958. var ObfuscatingGuard;
  1959. (function (ObfuscatingGuard) {
  1960. ObfuscatingGuard["BlackListNodeGuard"] = "BlackListNodeGuard";
  1961. ObfuscatingGuard["ConditionalCommentNodeGuard"] = "ConditionalCommentNodeGuard";
  1962. })(ObfuscatingGuard = exports.ObfuscatingGuard || (exports.ObfuscatingGuard = {}));
  1963. /***/ }),
  1964. /* 45 */
  1965. /***/ (function(module, exports, __webpack_require__) {
  1966. "use strict";
  1967. var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; })();
  1968. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  1969. function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
  1970. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1971. Object.defineProperty(exports, "__esModule", { value: true });
  1972. var tslib_1 = __webpack_require__(2);
  1973. var inversify_1 = __webpack_require__(0);
  1974. var ServiceIdentifiers_1 = __webpack_require__(1);
  1975. var Initializable_1 = __webpack_require__(5);
  1976. var MapStorage = function () {
  1977. function MapStorage(randomGenerator, options) {
  1978. _classCallCheck(this, MapStorage);
  1979. this.randomGenerator = randomGenerator;
  1980. this.options = options;
  1981. }
  1982. _createClass(MapStorage, [{
  1983. key: "initialize",
  1984. value: function initialize() {
  1985. this.storage = new Map();
  1986. this.storageId = this.randomGenerator.getRandomString(6);
  1987. }
  1988. }, {
  1989. key: "get",
  1990. value: function get(key) {
  1991. var value = this.storage.get(key);
  1992. if (!value) {
  1993. throw new Error("No value found in map storage with key `" + key + "`");
  1994. }
  1995. return value;
  1996. }
  1997. }, {
  1998. key: "getKeyOf",
  1999. value: function getKeyOf(value) {
  2000. var _iteratorNormalCompletion = true;
  2001. var _didIteratorError = false;
  2002. var _iteratorError = undefined;
  2003. try {
  2004. for (var _iterator = this.storage[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  2005. var _step$value = _slicedToArray(_step.value, 2),
  2006. key = _step$value[0],
  2007. storageValue = _step$value[1];
  2008. if (value === storageValue) {
  2009. return key;
  2010. }
  2011. }
  2012. } catch (err) {
  2013. _didIteratorError = true;
  2014. _iteratorError = err;
  2015. } finally {
  2016. try {
  2017. if (!_iteratorNormalCompletion && _iterator.return) {
  2018. _iterator.return();
  2019. }
  2020. } finally {
  2021. if (_didIteratorError) {
  2022. throw _iteratorError;
  2023. }
  2024. }
  2025. }
  2026. return null;
  2027. }
  2028. }, {
  2029. key: "getLength",
  2030. value: function getLength() {
  2031. return this.storage.size;
  2032. }
  2033. }, {
  2034. key: "getStorage",
  2035. value: function getStorage() {
  2036. return this.storage;
  2037. }
  2038. }, {
  2039. key: "getStorageId",
  2040. value: function getStorageId() {
  2041. return this.storageId;
  2042. }
  2043. }, {
  2044. key: "mergeWith",
  2045. value: function mergeWith(storage) {
  2046. var mergeId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  2047. this.storage = new Map([].concat(_toConsumableArray(this.storage), _toConsumableArray(storage.getStorage())));
  2048. if (mergeId) {
  2049. this.storageId = storage.getStorageId();
  2050. }
  2051. }
  2052. }, {
  2053. key: "set",
  2054. value: function set(key, value) {
  2055. this.storage.set(key, value);
  2056. }
  2057. }]);
  2058. return MapStorage;
  2059. }();
  2060. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], MapStorage.prototype, "storageId", void 0);
  2061. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Map)], MapStorage.prototype, "storage", void 0);
  2062. tslib_1.__decorate([inversify_1.postConstruct(), tslib_1.__metadata("design:type", Function), tslib_1.__metadata("design:paramtypes", []), tslib_1.__metadata("design:returntype", void 0)], MapStorage.prototype, "initialize", null);
  2063. MapStorage = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], MapStorage);
  2064. exports.MapStorage = MapStorage;
  2065. /***/ }),
  2066. /* 46 */
  2067. /***/ (function(module, exports, __webpack_require__) {
  2068. "use strict";
  2069. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  2070. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2071. Object.defineProperty(exports, "__esModule", { value: true });
  2072. var tslib_1 = __webpack_require__(2);
  2073. var inversify_1 = __webpack_require__(0);
  2074. var ServiceIdentifiers_1 = __webpack_require__(1);
  2075. var md5 = __webpack_require__(150);
  2076. var chance_1 = __webpack_require__(151);
  2077. var Initializable_1 = __webpack_require__(5);
  2078. var RandomGenerator = RandomGenerator_1 = function () {
  2079. function RandomGenerator(sourceCode, options) {
  2080. _classCallCheck(this, RandomGenerator);
  2081. this.sourceCode = sourceCode;
  2082. this.options = options;
  2083. }
  2084. _createClass(RandomGenerator, [{
  2085. key: "initialize",
  2086. value: function initialize() {
  2087. var _this = this;
  2088. var getRandomInteger = function getRandomInteger(min, max) {
  2089. return Math.floor(Math.random() * (max - min + 1) + min);
  2090. };
  2091. var getSeed = function getSeed() {
  2092. var md5Hash = md5(_this.sourceCode.getSourceCode());
  2093. return _this.seed + Number(md5Hash.replace(/\D/g, ''));
  2094. };
  2095. this.seed = this.options.seed !== 0 ? this.options.seed : getRandomInteger(0, 999999999);
  2096. this.randomGenerator = new chance_1.Chance(getSeed());
  2097. }
  2098. }, {
  2099. key: "getMathRandom",
  2100. value: function getMathRandom() {
  2101. return this.getRandomInteger(0, 99999) / 100000;
  2102. }
  2103. }, {
  2104. key: "getRandomFloat",
  2105. value: function getRandomFloat(min, max) {
  2106. return this.getRandomGenerator().floating({
  2107. min: min,
  2108. max: max,
  2109. fixed: 7
  2110. });
  2111. }
  2112. }, {
  2113. key: "getRandomGenerator",
  2114. value: function getRandomGenerator() {
  2115. return this.randomGenerator;
  2116. }
  2117. }, {
  2118. key: "getRandomInteger",
  2119. value: function getRandomInteger(min, max) {
  2120. return this.getRandomGenerator().integer({
  2121. min: min,
  2122. max: max
  2123. });
  2124. }
  2125. }, {
  2126. key: "getRandomString",
  2127. value: function getRandomString(length) {
  2128. var pool = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : RandomGenerator_1.randomGeneratorPool;
  2129. return this.getRandomGenerator().string({ length: length, pool: pool });
  2130. }
  2131. }, {
  2132. key: "getSeed",
  2133. value: function getSeed() {
  2134. return this.seed;
  2135. }
  2136. }]);
  2137. return RandomGenerator;
  2138. }();
  2139. RandomGenerator.randomGeneratorPool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
  2140. RandomGenerator.randomGeneratorPoolNumbers = '0123456789';
  2141. RandomGenerator.randomGeneratorPoolHexadecimal = "abcdef" + RandomGenerator_1.randomGeneratorPoolNumbers;
  2142. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], RandomGenerator.prototype, "randomGenerator", void 0);
  2143. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Number)], RandomGenerator.prototype, "seed", void 0);
  2144. tslib_1.__decorate([inversify_1.postConstruct(), tslib_1.__metadata("design:type", Function), tslib_1.__metadata("design:paramtypes", []), tslib_1.__metadata("design:returntype", void 0)], RandomGenerator.prototype, "initialize", null);
  2145. RandomGenerator = RandomGenerator_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ISourceCode)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], RandomGenerator);
  2146. exports.RandomGenerator = RandomGenerator;
  2147. var RandomGenerator_1;
  2148. /***/ }),
  2149. /* 47 */
  2150. /***/ (function(module, exports) {
  2151. module.exports = require("pjson");
  2152. /***/ }),
  2153. /* 48 */
  2154. /***/ (function(module, exports) {
  2155. module.exports = require("fs");
  2156. /***/ }),
  2157. /* 49 */
  2158. /***/ (function(module, exports, __webpack_require__) {
  2159. "use strict";
  2160. Object.defineProperty(exports, "__esModule", { value: true });
  2161. var JavaScriptObfuscatorFacade_1 = __webpack_require__(19);
  2162. module.exports = JavaScriptObfuscatorFacade_1.JavaScriptObfuscator;
  2163. /***/ }),
  2164. /* 50 */
  2165. /***/ (function(module, exports) {
  2166. module.exports = require("reflect-metadata");
  2167. /***/ }),
  2168. /* 51 */
  2169. /***/ (function(module, exports, __webpack_require__) {
  2170. "use strict";
  2171. Object.defineProperty(exports, "__esModule", { value: true });
  2172. var InversifyContainerFacade_1 = __webpack_require__(15);
  2173. var inversify_1 = __webpack_require__(0);
  2174. var ServiceIdentifiers_1 = __webpack_require__(1);
  2175. var CalleeDataExtractor_1 = __webpack_require__(36);
  2176. var FunctionDeclarationCalleeDataExtractor_1 = __webpack_require__(52);
  2177. var FunctionExpressionCalleeDataExtractor_1 = __webpack_require__(53);
  2178. var ObjectExpressionCalleeDataExtractor_1 = __webpack_require__(54);
  2179. var StackTraceAnalyzer_1 = __webpack_require__(55);
  2180. exports.analyzersModule = new inversify_1.ContainerModule(function (bind) {
  2181. bind(ServiceIdentifiers_1.ServiceIdentifiers.IStackTraceAnalyzer).to(StackTraceAnalyzer_1.StackTraceAnalyzer).inSingletonScope();
  2182. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICalleeDataExtractor).to(FunctionDeclarationCalleeDataExtractor_1.FunctionDeclarationCalleeDataExtractor).whenTargetNamed(CalleeDataExtractor_1.CalleeDataExtractor.FunctionDeclarationCalleeDataExtractor);
  2183. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICalleeDataExtractor).to(FunctionExpressionCalleeDataExtractor_1.FunctionExpressionCalleeDataExtractor).whenTargetNamed(CalleeDataExtractor_1.CalleeDataExtractor.FunctionExpressionCalleeDataExtractor);
  2184. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICalleeDataExtractor).to(ObjectExpressionCalleeDataExtractor_1.ObjectExpressionCalleeDataExtractor).whenTargetNamed(CalleeDataExtractor_1.CalleeDataExtractor.ObjectExpressionCalleeDataExtractor);
  2185. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICalleeDataExtractor).toFactory(InversifyContainerFacade_1.InversifyContainerFacade.getCacheFactory(ServiceIdentifiers_1.ServiceIdentifiers.ICalleeDataExtractor));
  2186. });
  2187. /***/ }),
  2188. /* 52 */
  2189. /***/ (function(module, exports, __webpack_require__) {
  2190. "use strict";
  2191. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  2192. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2193. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2194. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2195. Object.defineProperty(exports, "__esModule", { value: true });
  2196. var tslib_1 = __webpack_require__(2);
  2197. var inversify_1 = __webpack_require__(0);
  2198. var estraverse = __webpack_require__(10);
  2199. var AbstractCalleeDataExtractor_1 = __webpack_require__(29);
  2200. var NodeGuards_1 = __webpack_require__(4);
  2201. var NodeUtils_1 = __webpack_require__(3);
  2202. var FunctionDeclarationCalleeDataExtractor = function (_AbstractCalleeDataEx) {
  2203. _inherits(FunctionDeclarationCalleeDataExtractor, _AbstractCalleeDataEx);
  2204. function FunctionDeclarationCalleeDataExtractor() {
  2205. _classCallCheck(this, FunctionDeclarationCalleeDataExtractor);
  2206. return _possibleConstructorReturn(this, (FunctionDeclarationCalleeDataExtractor.__proto__ || Object.getPrototypeOf(FunctionDeclarationCalleeDataExtractor)).apply(this, arguments));
  2207. }
  2208. _createClass(FunctionDeclarationCalleeDataExtractor, [{
  2209. key: "extract",
  2210. value: function extract(blockScopeBody, callee) {
  2211. if (!NodeGuards_1.NodeGuards.isIdentifierNode(callee)) {
  2212. return null;
  2213. }
  2214. var calleeBlockStatement = this.getCalleeBlockStatement(NodeUtils_1.NodeUtils.getBlockScopesOfNode(blockScopeBody[0])[0], callee.name);
  2215. if (!calleeBlockStatement) {
  2216. return null;
  2217. }
  2218. return {
  2219. callee: calleeBlockStatement,
  2220. name: callee.name
  2221. };
  2222. }
  2223. }, {
  2224. key: "getCalleeBlockStatement",
  2225. value: function getCalleeBlockStatement(targetNode, name) {
  2226. var calleeBlockStatement = null;
  2227. estraverse.traverse(targetNode, {
  2228. enter: function enter(node) {
  2229. if (NodeGuards_1.NodeGuards.isFunctionDeclarationNode(node) && node.id.name === name) {
  2230. calleeBlockStatement = node.body;
  2231. return estraverse.VisitorOption.Break;
  2232. }
  2233. }
  2234. });
  2235. return calleeBlockStatement;
  2236. }
  2237. }]);
  2238. return FunctionDeclarationCalleeDataExtractor;
  2239. }(AbstractCalleeDataExtractor_1.AbstractCalleeDataExtractor);
  2240. FunctionDeclarationCalleeDataExtractor = tslib_1.__decorate([inversify_1.injectable()], FunctionDeclarationCalleeDataExtractor);
  2241. exports.FunctionDeclarationCalleeDataExtractor = FunctionDeclarationCalleeDataExtractor;
  2242. /***/ }),
  2243. /* 53 */
  2244. /***/ (function(module, exports, __webpack_require__) {
  2245. "use strict";
  2246. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  2247. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2248. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2249. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2250. Object.defineProperty(exports, "__esModule", { value: true });
  2251. var tslib_1 = __webpack_require__(2);
  2252. var inversify_1 = __webpack_require__(0);
  2253. var estraverse = __webpack_require__(10);
  2254. var AbstractCalleeDataExtractor_1 = __webpack_require__(29);
  2255. var NodeGuards_1 = __webpack_require__(4);
  2256. var NodeUtils_1 = __webpack_require__(3);
  2257. var FunctionExpressionCalleeDataExtractor = function (_AbstractCalleeDataEx) {
  2258. _inherits(FunctionExpressionCalleeDataExtractor, _AbstractCalleeDataEx);
  2259. function FunctionExpressionCalleeDataExtractor() {
  2260. _classCallCheck(this, FunctionExpressionCalleeDataExtractor);
  2261. return _possibleConstructorReturn(this, (FunctionExpressionCalleeDataExtractor.__proto__ || Object.getPrototypeOf(FunctionExpressionCalleeDataExtractor)).apply(this, arguments));
  2262. }
  2263. _createClass(FunctionExpressionCalleeDataExtractor, [{
  2264. key: "extract",
  2265. value: function extract(blockScopeBody, callee) {
  2266. var calleeBlockStatement = null;
  2267. if (NodeGuards_1.NodeGuards.isIdentifierNode(callee)) {
  2268. calleeBlockStatement = this.getCalleeBlockStatement(NodeUtils_1.NodeUtils.getBlockScopesOfNode(blockScopeBody[0])[0], callee.name);
  2269. }
  2270. if (NodeGuards_1.NodeGuards.isFunctionExpressionNode(callee)) {
  2271. calleeBlockStatement = callee.body;
  2272. }
  2273. if (!calleeBlockStatement) {
  2274. return null;
  2275. }
  2276. return {
  2277. callee: calleeBlockStatement,
  2278. name: callee.name || null
  2279. };
  2280. }
  2281. }, {
  2282. key: "getCalleeBlockStatement",
  2283. value: function getCalleeBlockStatement(targetNode, name) {
  2284. var calleeBlockStatement = null;
  2285. estraverse.traverse(targetNode, {
  2286. enter: function enter(node, parentNode) {
  2287. if (NodeGuards_1.NodeGuards.isFunctionExpressionNode(node) && parentNode && NodeGuards_1.NodeGuards.isVariableDeclaratorNode(parentNode) && NodeGuards_1.NodeGuards.isIdentifierNode(parentNode.id) && parentNode.id.name === name) {
  2288. calleeBlockStatement = node.body;
  2289. return estraverse.VisitorOption.Break;
  2290. }
  2291. }
  2292. });
  2293. return calleeBlockStatement;
  2294. }
  2295. }]);
  2296. return FunctionExpressionCalleeDataExtractor;
  2297. }(AbstractCalleeDataExtractor_1.AbstractCalleeDataExtractor);
  2298. FunctionExpressionCalleeDataExtractor = tslib_1.__decorate([inversify_1.injectable()], FunctionExpressionCalleeDataExtractor);
  2299. exports.FunctionExpressionCalleeDataExtractor = FunctionExpressionCalleeDataExtractor;
  2300. /***/ }),
  2301. /* 54 */
  2302. /***/ (function(module, exports, __webpack_require__) {
  2303. "use strict";
  2304. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  2305. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2306. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2307. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2308. Object.defineProperty(exports, "__esModule", { value: true });
  2309. var tslib_1 = __webpack_require__(2);
  2310. var inversify_1 = __webpack_require__(0);
  2311. var estraverse = __webpack_require__(10);
  2312. var AbstractCalleeDataExtractor_1 = __webpack_require__(29);
  2313. var NodeGuards_1 = __webpack_require__(4);
  2314. var NodeUtils_1 = __webpack_require__(3);
  2315. var ObjectExpressionCalleeDataExtractor = function (_AbstractCalleeDataEx) {
  2316. _inherits(ObjectExpressionCalleeDataExtractor, _AbstractCalleeDataEx);
  2317. function ObjectExpressionCalleeDataExtractor() {
  2318. _classCallCheck(this, ObjectExpressionCalleeDataExtractor);
  2319. return _possibleConstructorReturn(this, (ObjectExpressionCalleeDataExtractor.__proto__ || Object.getPrototypeOf(ObjectExpressionCalleeDataExtractor)).apply(this, arguments));
  2320. }
  2321. _createClass(ObjectExpressionCalleeDataExtractor, [{
  2322. key: "extract",
  2323. value: function extract(blockScopeBody, callee) {
  2324. if (!NodeGuards_1.NodeGuards.isMemberExpressionNode(callee)) {
  2325. return null;
  2326. }
  2327. var objectMembersCallsChain = this.createObjectMembersCallsChain([], callee);
  2328. if (!objectMembersCallsChain.length) {
  2329. return null;
  2330. }
  2331. var functionExpressionName = objectMembersCallsChain[objectMembersCallsChain.length - 1];
  2332. var calleeBlockStatement = this.getCalleeBlockStatement(NodeUtils_1.NodeUtils.getBlockScopesOfNode(blockScopeBody[0])[0], objectMembersCallsChain);
  2333. if (!calleeBlockStatement) {
  2334. return null;
  2335. }
  2336. return {
  2337. callee: calleeBlockStatement,
  2338. name: functionExpressionName
  2339. };
  2340. }
  2341. }, {
  2342. key: "createObjectMembersCallsChain",
  2343. value: function createObjectMembersCallsChain(currentChain, memberExpression) {
  2344. if (NodeGuards_1.NodeGuards.isIdentifierNode(memberExpression.property) && memberExpression.computed === false) {
  2345. currentChain.unshift(memberExpression.property.name);
  2346. } else if (NodeGuards_1.NodeGuards.isLiteralNode(memberExpression.property) && (typeof memberExpression.property.value === 'string' || typeof memberExpression.property.value === 'number')) {
  2347. currentChain.unshift(memberExpression.property.value);
  2348. } else {
  2349. return currentChain;
  2350. }
  2351. if (NodeGuards_1.NodeGuards.isMemberExpressionNode(memberExpression.object)) {
  2352. return this.createObjectMembersCallsChain(currentChain, memberExpression.object);
  2353. } else if (NodeGuards_1.NodeGuards.isIdentifierNode(memberExpression.object)) {
  2354. currentChain.unshift(memberExpression.object.name);
  2355. }
  2356. return currentChain;
  2357. }
  2358. }, {
  2359. key: "getCalleeBlockStatement",
  2360. value: function getCalleeBlockStatement(targetNode, objectMembersCallsChain) {
  2361. var _this2 = this;
  2362. var objectName = objectMembersCallsChain.shift();
  2363. if (!objectName) {
  2364. return null;
  2365. }
  2366. var calleeBlockStatement = null;
  2367. estraverse.traverse(targetNode, {
  2368. enter: function enter(node) {
  2369. if (NodeGuards_1.NodeGuards.isVariableDeclaratorNode(node) && NodeGuards_1.NodeGuards.isIdentifierNode(node.id) && node.init && NodeGuards_1.NodeGuards.isObjectExpressionNode(node.init) && node.id.name === objectName) {
  2370. calleeBlockStatement = _this2.findCalleeBlockStatement(node.init.properties, objectMembersCallsChain);
  2371. return estraverse.VisitorOption.Break;
  2372. }
  2373. }
  2374. });
  2375. return calleeBlockStatement;
  2376. }
  2377. }, {
  2378. key: "findCalleeBlockStatement",
  2379. value: function findCalleeBlockStatement(objectExpressionProperties, objectMembersCallsChain) {
  2380. var nextItemInCallsChain = objectMembersCallsChain.shift();
  2381. if (!nextItemInCallsChain) {
  2382. return null;
  2383. }
  2384. var _iteratorNormalCompletion = true;
  2385. var _didIteratorError = false;
  2386. var _iteratorError = undefined;
  2387. try {
  2388. for (var _iterator = objectExpressionProperties[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  2389. var propertyNode = _step.value;
  2390. var isTargetPropertyNodeWithIdentifierKey = NodeGuards_1.NodeGuards.isIdentifierNode(propertyNode.key) && propertyNode.key.name === nextItemInCallsChain;
  2391. var isTargetPropertyNodeWithLiteralKey = NodeGuards_1.NodeGuards.isLiteralNode(propertyNode.key) && Boolean(propertyNode.key.value) && propertyNode.key.value === nextItemInCallsChain;
  2392. if (!isTargetPropertyNodeWithIdentifierKey && !isTargetPropertyNodeWithLiteralKey) {
  2393. continue;
  2394. }
  2395. if (NodeGuards_1.NodeGuards.isObjectExpressionNode(propertyNode.value)) {
  2396. return this.findCalleeBlockStatement(propertyNode.value.properties, objectMembersCallsChain);
  2397. }
  2398. if (NodeGuards_1.NodeGuards.isFunctionExpressionNode(propertyNode.value)) {
  2399. return propertyNode.value.body;
  2400. }
  2401. }
  2402. } catch (err) {
  2403. _didIteratorError = true;
  2404. _iteratorError = err;
  2405. } finally {
  2406. try {
  2407. if (!_iteratorNormalCompletion && _iterator.return) {
  2408. _iterator.return();
  2409. }
  2410. } finally {
  2411. if (_didIteratorError) {
  2412. throw _iteratorError;
  2413. }
  2414. }
  2415. }
  2416. return null;
  2417. }
  2418. }]);
  2419. return ObjectExpressionCalleeDataExtractor;
  2420. }(AbstractCalleeDataExtractor_1.AbstractCalleeDataExtractor);
  2421. ObjectExpressionCalleeDataExtractor = tslib_1.__decorate([inversify_1.injectable()], ObjectExpressionCalleeDataExtractor);
  2422. exports.ObjectExpressionCalleeDataExtractor = ObjectExpressionCalleeDataExtractor;
  2423. /***/ }),
  2424. /* 55 */
  2425. /***/ (function(module, exports, __webpack_require__) {
  2426. "use strict";
  2427. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  2428. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2429. Object.defineProperty(exports, "__esModule", { value: true });
  2430. var tslib_1 = __webpack_require__(2);
  2431. var inversify_1 = __webpack_require__(0);
  2432. var ServiceIdentifiers_1 = __webpack_require__(1);
  2433. var estraverse = __webpack_require__(10);
  2434. var CalleeDataExtractor_1 = __webpack_require__(36);
  2435. var NodeGuards_1 = __webpack_require__(4);
  2436. var NodeUtils_1 = __webpack_require__(3);
  2437. var StackTraceAnalyzer = StackTraceAnalyzer_1 = function () {
  2438. function StackTraceAnalyzer(calleeDataExtractorFactory) {
  2439. _classCallCheck(this, StackTraceAnalyzer);
  2440. this.calleeDataExtractorFactory = calleeDataExtractorFactory;
  2441. }
  2442. _createClass(StackTraceAnalyzer, [{
  2443. key: "analyze",
  2444. value: function analyze(astTree) {
  2445. return this.analyzeRecursive(astTree.body);
  2446. }
  2447. }, {
  2448. key: "analyzeRecursive",
  2449. value: function analyzeRecursive(blockScopeBody) {
  2450. var _this = this;
  2451. var limitIndex = StackTraceAnalyzer_1.getLimitIndex(blockScopeBody.length);
  2452. var stackTraceData = [];
  2453. var blockScopeBodyLength = blockScopeBody.length;
  2454. var _loop = function _loop(index) {
  2455. if (index > limitIndex) {
  2456. return "break";
  2457. }
  2458. var blockScopeBodyNode = blockScopeBody[index];
  2459. estraverse.traverse(blockScopeBodyNode, {
  2460. enter: function enter(node) {
  2461. if (!NodeGuards_1.NodeGuards.isCallExpressionNode(node)) {
  2462. return;
  2463. }
  2464. if (blockScopeBodyNode.parentNode !== NodeUtils_1.NodeUtils.getBlockScopesOfNode(node)[0]) {
  2465. return estraverse.VisitorOption.Skip;
  2466. }
  2467. _this.analyzeCallExpressionNode(stackTraceData, blockScopeBody, node);
  2468. }
  2469. });
  2470. };
  2471. for (var index = 0; index < blockScopeBodyLength; index++) {
  2472. var _ret = _loop(index);
  2473. if (_ret === "break") break;
  2474. }
  2475. return stackTraceData;
  2476. }
  2477. }, {
  2478. key: "analyzeCallExpressionNode",
  2479. value: function analyzeCallExpressionNode(stackTraceData, blockScopeBody, callExpressionNode) {
  2480. var _this2 = this;
  2481. StackTraceAnalyzer_1.calleeDataExtractorsList.forEach(function (calleeDataExtractorName) {
  2482. var calleeData = _this2.calleeDataExtractorFactory(calleeDataExtractorName).extract(blockScopeBody, callExpressionNode.callee);
  2483. if (!calleeData) {
  2484. return;
  2485. }
  2486. stackTraceData.push(Object.assign({}, calleeData, { stackTrace: _this2.analyzeRecursive(calleeData.callee.body) }));
  2487. });
  2488. }
  2489. }], [{
  2490. key: "getLimitIndex",
  2491. value: function getLimitIndex(blockScopeBodyLength) {
  2492. var lastIndex = blockScopeBodyLength - 1;
  2493. var limitThresholdActivationIndex = StackTraceAnalyzer_1.limitThresholdActivationLength - 1;
  2494. var limitIndex = lastIndex;
  2495. if (lastIndex > limitThresholdActivationIndex) {
  2496. limitIndex = Math.round(limitThresholdActivationIndex + lastIndex * StackTraceAnalyzer_1.limitThreshold);
  2497. if (limitIndex > lastIndex) {
  2498. limitIndex = lastIndex;
  2499. }
  2500. }
  2501. return limitIndex;
  2502. }
  2503. }]);
  2504. return StackTraceAnalyzer;
  2505. }();
  2506. StackTraceAnalyzer.calleeDataExtractorsList = [CalleeDataExtractor_1.CalleeDataExtractor.FunctionDeclarationCalleeDataExtractor, CalleeDataExtractor_1.CalleeDataExtractor.FunctionExpressionCalleeDataExtractor, CalleeDataExtractor_1.CalleeDataExtractor.ObjectExpressionCalleeDataExtractor];
  2507. StackTraceAnalyzer.limitThresholdActivationLength = 25;
  2508. StackTraceAnalyzer.limitThreshold = 0.002;
  2509. StackTraceAnalyzer = StackTraceAnalyzer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICalleeDataExtractor)), tslib_1.__metadata("design:paramtypes", [Function])], StackTraceAnalyzer);
  2510. exports.StackTraceAnalyzer = StackTraceAnalyzer;
  2511. var StackTraceAnalyzer_1;
  2512. /***/ }),
  2513. /* 56 */
  2514. /***/ (function(module, exports, __webpack_require__) {
  2515. "use strict";
  2516. Object.defineProperty(exports, "__esModule", { value: true });
  2517. var InversifyContainerFacade_1 = __webpack_require__(15);
  2518. var inversify_1 = __webpack_require__(0);
  2519. var ServiceIdentifiers_1 = __webpack_require__(1);
  2520. var ControlFlowReplacer_1 = __webpack_require__(38);
  2521. var NodeTransformer_1 = __webpack_require__(20);
  2522. var BinaryExpressionControlFlowReplacer_1 = __webpack_require__(57);
  2523. var BlockStatementControlFlowTransformer_1 = __webpack_require__(58);
  2524. var CallExpressionControlFlowReplacer_1 = __webpack_require__(59);
  2525. var DeadCodeInjectionTransformer_1 = __webpack_require__(60);
  2526. var FunctionControlFlowTransformer_1 = __webpack_require__(61);
  2527. var LogicalExpressionControlFlowReplacer_1 = __webpack_require__(62);
  2528. var StringLiteralControlFlowReplacer_1 = __webpack_require__(63);
  2529. exports.controlFlowTransformersModule = new inversify_1.ContainerModule(function (bind) {
  2530. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(BlockStatementControlFlowTransformer_1.BlockStatementControlFlowTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.BlockStatementControlFlowTransformer);
  2531. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(DeadCodeInjectionTransformer_1.DeadCodeInjectionTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.DeadCodeInjectionTransformer);
  2532. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(FunctionControlFlowTransformer_1.FunctionControlFlowTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.FunctionControlFlowTransformer);
  2533. bind(ServiceIdentifiers_1.ServiceIdentifiers.IControlFlowReplacer).to(BinaryExpressionControlFlowReplacer_1.BinaryExpressionControlFlowReplacer).whenTargetNamed(ControlFlowReplacer_1.ControlFlowReplacer.BinaryExpressionControlFlowReplacer);
  2534. bind(ServiceIdentifiers_1.ServiceIdentifiers.IControlFlowReplacer).to(CallExpressionControlFlowReplacer_1.CallExpressionControlFlowReplacer).whenTargetNamed(ControlFlowReplacer_1.ControlFlowReplacer.CallExpressionControlFlowReplacer);
  2535. bind(ServiceIdentifiers_1.ServiceIdentifiers.IControlFlowReplacer).to(LogicalExpressionControlFlowReplacer_1.LogicalExpressionControlFlowReplacer).whenTargetNamed(ControlFlowReplacer_1.ControlFlowReplacer.LogicalExpressionControlFlowReplacer);
  2536. bind(ServiceIdentifiers_1.ServiceIdentifiers.IControlFlowReplacer).to(StringLiteralControlFlowReplacer_1.StringLiteralControlFlowReplacer).whenTargetNamed(ControlFlowReplacer_1.ControlFlowReplacer.StringLiteralControlFlowReplacer);
  2537. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowReplacer).toFactory(InversifyContainerFacade_1.InversifyContainerFacade.getCacheFactory(ServiceIdentifiers_1.ServiceIdentifiers.IControlFlowReplacer));
  2538. });
  2539. /***/ }),
  2540. /* 57 */
  2541. /***/ (function(module, exports, __webpack_require__) {
  2542. "use strict";
  2543. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  2544. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2545. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2546. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2547. Object.defineProperty(exports, "__esModule", { value: true });
  2548. var tslib_1 = __webpack_require__(2);
  2549. var inversify_1 = __webpack_require__(0);
  2550. var ServiceIdentifiers_1 = __webpack_require__(1);
  2551. var ControlFlowCustomNode_1 = __webpack_require__(13);
  2552. var ExpressionWithOperatorControlFlowReplacer_1 = __webpack_require__(39);
  2553. var BinaryExpressionControlFlowReplacer = BinaryExpressionControlFlowReplacer_1 = function (_ExpressionWithOperat) {
  2554. _inherits(BinaryExpressionControlFlowReplacer, _ExpressionWithOperat);
  2555. function BinaryExpressionControlFlowReplacer(controlFlowCustomNodeFactory, randomGenerator, options) {
  2556. _classCallCheck(this, BinaryExpressionControlFlowReplacer);
  2557. return _possibleConstructorReturn(this, (BinaryExpressionControlFlowReplacer.__proto__ || Object.getPrototypeOf(BinaryExpressionControlFlowReplacer)).call(this, controlFlowCustomNodeFactory, randomGenerator, options));
  2558. }
  2559. _createClass(BinaryExpressionControlFlowReplacer, [{
  2560. key: "replace",
  2561. value: function replace(binaryExpressionNode, parentNode, controlFlowStorage) {
  2562. var replacerId = binaryExpressionNode.operator;
  2563. var binaryExpressionFunctionCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.BinaryExpressionFunctionNode);
  2564. binaryExpressionFunctionCustomNode.initialize(replacerId);
  2565. var storageKey = this.insertCustomNodeToControlFlowStorage(binaryExpressionFunctionCustomNode, controlFlowStorage, replacerId, BinaryExpressionControlFlowReplacer_1.usingExistingIdentifierChance);
  2566. return this.getControlFlowStorageCallNode(controlFlowStorage.getStorageId(), storageKey, binaryExpressionNode.left, binaryExpressionNode.right);
  2567. }
  2568. }]);
  2569. return BinaryExpressionControlFlowReplacer;
  2570. }(ExpressionWithOperatorControlFlowReplacer_1.ExpressionWithOperatorControlFlowReplacer);
  2571. BinaryExpressionControlFlowReplacer.usingExistingIdentifierChance = 0.5;
  2572. BinaryExpressionControlFlowReplacer = BinaryExpressionControlFlowReplacer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowCustomNode)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], BinaryExpressionControlFlowReplacer);
  2573. exports.BinaryExpressionControlFlowReplacer = BinaryExpressionControlFlowReplacer;
  2574. var BinaryExpressionControlFlowReplacer_1;
  2575. /***/ }),
  2576. /* 58 */
  2577. /***/ (function(module, exports, __webpack_require__) {
  2578. "use strict";
  2579. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  2580. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2581. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2582. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2583. Object.defineProperty(exports, "__esModule", { value: true });
  2584. var tslib_1 = __webpack_require__(2);
  2585. var inversify_1 = __webpack_require__(0);
  2586. var ServiceIdentifiers_1 = __webpack_require__(1);
  2587. var estraverse = __webpack_require__(10);
  2588. var ControlFlowCustomNode_1 = __webpack_require__(13);
  2589. var TransformationStage_1 = __webpack_require__(6);
  2590. var AbstractNodeTransformer_1 = __webpack_require__(8);
  2591. var NodeGuards_1 = __webpack_require__(4);
  2592. var NodeUtils_1 = __webpack_require__(3);
  2593. var BlockStatementControlFlowTransformer = BlockStatementControlFlowTransformer_1 = function (_AbstractNodeTransfor) {
  2594. _inherits(BlockStatementControlFlowTransformer, _AbstractNodeTransfor);
  2595. function BlockStatementControlFlowTransformer(controlFlowCustomNodeFactory, arrayUtils, randomGenerator, options) {
  2596. _classCallCheck(this, BlockStatementControlFlowTransformer);
  2597. var _this = _possibleConstructorReturn(this, (BlockStatementControlFlowTransformer.__proto__ || Object.getPrototypeOf(BlockStatementControlFlowTransformer)).call(this, randomGenerator, options));
  2598. _this.controlFlowCustomNodeFactory = controlFlowCustomNodeFactory;
  2599. _this.arrayUtils = arrayUtils;
  2600. return _this;
  2601. }
  2602. _createClass(BlockStatementControlFlowTransformer, [{
  2603. key: "getVisitor",
  2604. value: function getVisitor(transformationStage) {
  2605. var _this2 = this;
  2606. if (!this.options.controlFlowFlattening) {
  2607. return null;
  2608. }
  2609. switch (transformationStage) {
  2610. case TransformationStage_1.TransformationStage.ControlFlowFlattening:
  2611. return {
  2612. leave: function leave(node, parentNode) {
  2613. if (parentNode && NodeGuards_1.NodeGuards.isBlockStatementNode(node)) {
  2614. return _this2.transformNode(node, parentNode);
  2615. }
  2616. }
  2617. };
  2618. default:
  2619. return null;
  2620. }
  2621. }
  2622. }, {
  2623. key: "transformNode",
  2624. value: function transformNode(blockStatementNode, parentNode) {
  2625. if (this.randomGenerator.getMathRandom() > this.options.controlFlowFlatteningThreshold || !BlockStatementControlFlowTransformer_1.canTransformBlockStatementNode(blockStatementNode)) {
  2626. return blockStatementNode;
  2627. }
  2628. var blockStatementBody = blockStatementNode.body;
  2629. var originalKeys = this.arrayUtils.arrayRange(blockStatementBody.length);
  2630. var shuffledKeys = this.arrayUtils.arrayShuffle(originalKeys);
  2631. var originalKeysIndexesInShuffledArray = originalKeys.map(function (key) {
  2632. return shuffledKeys.indexOf(key);
  2633. });
  2634. var blockStatementControlFlowFlatteningCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.BlockStatementControlFlowFlatteningNode);
  2635. blockStatementControlFlowFlatteningCustomNode.initialize(blockStatementBody, shuffledKeys, originalKeysIndexesInShuffledArray);
  2636. var newBlockStatementNode = blockStatementControlFlowFlatteningCustomNode.getNode()[0];
  2637. NodeUtils_1.NodeUtils.parentizeNode(newBlockStatementNode, parentNode);
  2638. return newBlockStatementNode;
  2639. }
  2640. }], [{
  2641. key: "blockStatementHasProhibitedStatements",
  2642. value: function blockStatementHasProhibitedStatements(blockStatementNode) {
  2643. return blockStatementNode.body.some(function (statement) {
  2644. var isBreakOrContinueStatement = NodeGuards_1.NodeGuards.isBreakStatementNode(statement) || NodeGuards_1.NodeGuards.isContinueStatementNode(statement);
  2645. var isVariableDeclarationWithLetOrConstKind = NodeGuards_1.NodeGuards.isVariableDeclarationNode(statement) && (statement.kind === 'const' || statement.kind === 'let');
  2646. return NodeGuards_1.NodeGuards.isFunctionDeclarationNode(statement) || isBreakOrContinueStatement || isVariableDeclarationWithLetOrConstKind;
  2647. });
  2648. }
  2649. }, {
  2650. key: "canTransformBlockStatementNode",
  2651. value: function canTransformBlockStatementNode(blockStatementNode) {
  2652. var canTransform = true;
  2653. estraverse.traverse(blockStatementNode, {
  2654. enter: function enter(node) {
  2655. if (NodeGuards_1.NodeGuards.isWhileStatementNode(node)) {
  2656. return estraverse.VisitorOption.Skip;
  2657. }
  2658. if (NodeGuards_1.NodeGuards.isBlockStatementNode(node) && BlockStatementControlFlowTransformer_1.blockStatementHasProhibitedStatements(node)) {
  2659. canTransform = false;
  2660. }
  2661. }
  2662. });
  2663. if (blockStatementNode.body.length <= 4) {
  2664. canTransform = false;
  2665. }
  2666. return canTransform;
  2667. }
  2668. }]);
  2669. return BlockStatementControlFlowTransformer;
  2670. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  2671. BlockStatementControlFlowTransformer = BlockStatementControlFlowTransformer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowCustomNode)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IArrayUtils)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object, Object])], BlockStatementControlFlowTransformer);
  2672. exports.BlockStatementControlFlowTransformer = BlockStatementControlFlowTransformer;
  2673. var BlockStatementControlFlowTransformer_1;
  2674. /***/ }),
  2675. /* 59 */
  2676. /***/ (function(module, exports, __webpack_require__) {
  2677. "use strict";
  2678. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  2679. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2680. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2681. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2682. Object.defineProperty(exports, "__esModule", { value: true });
  2683. var tslib_1 = __webpack_require__(2);
  2684. var inversify_1 = __webpack_require__(0);
  2685. var ServiceIdentifiers_1 = __webpack_require__(1);
  2686. var ControlFlowCustomNode_1 = __webpack_require__(13);
  2687. var AbstractControlFlowReplacer_1 = __webpack_require__(31);
  2688. var NodeGuards_1 = __webpack_require__(4);
  2689. var CallExpressionControlFlowReplacer = CallExpressionControlFlowReplacer_1 = function (_AbstractControlFlowR) {
  2690. _inherits(CallExpressionControlFlowReplacer, _AbstractControlFlowR);
  2691. function CallExpressionControlFlowReplacer(controlFlowCustomNodeFactory, randomGenerator, options) {
  2692. _classCallCheck(this, CallExpressionControlFlowReplacer);
  2693. return _possibleConstructorReturn(this, (CallExpressionControlFlowReplacer.__proto__ || Object.getPrototypeOf(CallExpressionControlFlowReplacer)).call(this, controlFlowCustomNodeFactory, randomGenerator, options));
  2694. }
  2695. _createClass(CallExpressionControlFlowReplacer, [{
  2696. key: "replace",
  2697. value: function replace(callExpressionNode, parentNode, controlFlowStorage) {
  2698. var callee = callExpressionNode.callee;
  2699. if (!NodeGuards_1.NodeGuards.isIdentifierNode(callee)) {
  2700. return callExpressionNode;
  2701. }
  2702. var replacerId = String(callExpressionNode.arguments.length);
  2703. var callExpressionFunctionCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.CallExpressionFunctionNode);
  2704. var expressionArguments = callExpressionNode.arguments;
  2705. callExpressionFunctionCustomNode.initialize(expressionArguments);
  2706. var storageKey = this.insertCustomNodeToControlFlowStorage(callExpressionFunctionCustomNode, controlFlowStorage, replacerId, CallExpressionControlFlowReplacer_1.usingExistingIdentifierChance);
  2707. return this.getControlFlowStorageCallNode(controlFlowStorage.getStorageId(), storageKey, callee, expressionArguments);
  2708. }
  2709. }, {
  2710. key: "getControlFlowStorageCallNode",
  2711. value: function getControlFlowStorageCallNode(controlFlowStorageId, storageKey, callee, expressionArguments) {
  2712. var controlFlowStorageCallCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.CallExpressionControlFlowStorageCallNode);
  2713. controlFlowStorageCallCustomNode.initialize(controlFlowStorageId, storageKey, callee, expressionArguments);
  2714. var statementNode = controlFlowStorageCallCustomNode.getNode()[0];
  2715. if (!statementNode || !NodeGuards_1.NodeGuards.isExpressionStatementNode(statementNode)) {
  2716. throw new Error("`controlFlowStorageCallCustomNode.getNode()[0]` should returns array with `ExpressionStatement` node");
  2717. }
  2718. return statementNode.expression;
  2719. }
  2720. }]);
  2721. return CallExpressionControlFlowReplacer;
  2722. }(AbstractControlFlowReplacer_1.AbstractControlFlowReplacer);
  2723. CallExpressionControlFlowReplacer.usingExistingIdentifierChance = 0.5;
  2724. CallExpressionControlFlowReplacer = CallExpressionControlFlowReplacer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowCustomNode)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], CallExpressionControlFlowReplacer);
  2725. exports.CallExpressionControlFlowReplacer = CallExpressionControlFlowReplacer;
  2726. var CallExpressionControlFlowReplacer_1;
  2727. /***/ }),
  2728. /* 60 */
  2729. /***/ (function(module, exports, __webpack_require__) {
  2730. "use strict";
  2731. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  2732. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2733. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2734. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2735. Object.defineProperty(exports, "__esModule", { value: true });
  2736. var tslib_1 = __webpack_require__(2);
  2737. var inversify_1 = __webpack_require__(0);
  2738. var ServiceIdentifiers_1 = __webpack_require__(1);
  2739. var estraverse = __webpack_require__(10);
  2740. var DeadCodeInjectionCustomNode_1 = __webpack_require__(40);
  2741. var NodeType_1 = __webpack_require__(11);
  2742. var TransformationStage_1 = __webpack_require__(6);
  2743. var AbstractNodeTransformer_1 = __webpack_require__(8);
  2744. var NodeGuards_1 = __webpack_require__(4);
  2745. var Nodes_1 = __webpack_require__(9);
  2746. var NodeUtils_1 = __webpack_require__(3);
  2747. var DeadCodeInjectionTransformer = DeadCodeInjectionTransformer_1 = function (_AbstractNodeTransfor) {
  2748. _inherits(DeadCodeInjectionTransformer, _AbstractNodeTransfor);
  2749. function DeadCodeInjectionTransformer(deadCodeInjectionCustomNodeFactory, randomGenerator, options) {
  2750. _classCallCheck(this, DeadCodeInjectionTransformer);
  2751. var _this = _possibleConstructorReturn(this, (DeadCodeInjectionTransformer.__proto__ || Object.getPrototypeOf(DeadCodeInjectionTransformer)).call(this, randomGenerator, options));
  2752. _this.deadCodeInjectionRootAstHostNodeSet = new WeakSet();
  2753. _this.collectedBlockStatements = [];
  2754. _this.deadCodeInjectionCustomNodeFactory = deadCodeInjectionCustomNodeFactory;
  2755. return _this;
  2756. }
  2757. _createClass(DeadCodeInjectionTransformer, [{
  2758. key: "getVisitor",
  2759. value: function getVisitor(transformationStage) {
  2760. var _this2 = this;
  2761. if (!this.options.deadCodeInjection) {
  2762. return null;
  2763. }
  2764. switch (transformationStage) {
  2765. case TransformationStage_1.TransformationStage.DeadCodeInjection:
  2766. return {
  2767. enter: function enter(node, parentNode) {
  2768. if (parentNode && NodeGuards_1.NodeGuards.isProgramNode(node)) {
  2769. _this2.analyzeNode(node, parentNode);
  2770. return node;
  2771. }
  2772. },
  2773. leave: function leave(node, parentNode) {
  2774. if (parentNode && NodeGuards_1.NodeGuards.isBlockStatementNode(node)) {
  2775. return _this2.transformNode(node, parentNode);
  2776. }
  2777. }
  2778. };
  2779. case TransformationStage_1.TransformationStage.Finalizing:
  2780. return {
  2781. enter: function enter(node, parentNode) {
  2782. if (parentNode && _this2.isDeadCodeInjectionRootAstHostNode(node)) {
  2783. return _this2.restoreNode(node, parentNode);
  2784. }
  2785. }
  2786. };
  2787. default:
  2788. return null;
  2789. }
  2790. }
  2791. }, {
  2792. key: "analyzeNode",
  2793. value: function analyzeNode(programNode, parentNode) {
  2794. var _this3 = this;
  2795. estraverse.traverse(programNode, {
  2796. enter: function enter(node) {
  2797. if (NodeGuards_1.NodeGuards.isBlockStatementNode(node)) {
  2798. _this3.collectBlockStatementNodes(node, _this3.collectedBlockStatements, parentNode);
  2799. }
  2800. }
  2801. });
  2802. this.collectedBlockStatementsLength = this.collectedBlockStatements.length;
  2803. }
  2804. }, {
  2805. key: "transformNode",
  2806. value: function transformNode(blockStatementNode, parentNode) {
  2807. if (this.collectedBlockStatementsLength < DeadCodeInjectionTransformer_1.minCollectedBlockStatementsCount) {
  2808. return estraverse.VisitorOption.Break;
  2809. }
  2810. if (!this.collectedBlockStatements.length) {
  2811. return estraverse.VisitorOption.Break;
  2812. }
  2813. if (this.randomGenerator.getMathRandom() > this.options.deadCodeInjectionThreshold) {
  2814. return blockStatementNode;
  2815. }
  2816. var blockScopeOfBlockStatementNode = NodeUtils_1.NodeUtils.getBlockScopesOfNode(blockStatementNode)[0];
  2817. if (blockScopeOfBlockStatementNode.type === NodeType_1.NodeType.Program) {
  2818. return blockStatementNode;
  2819. }
  2820. var minInteger = 0;
  2821. var maxInteger = this.collectedBlockStatements.length - 1;
  2822. var randomIndex = this.randomGenerator.getRandomInteger(minInteger, maxInteger);
  2823. var randomBlockStatementNode = this.collectedBlockStatements.splice(randomIndex, 1)[0];
  2824. if (randomBlockStatementNode === blockStatementNode) {
  2825. return blockStatementNode;
  2826. }
  2827. return this.replaceBlockStatementNode(blockStatementNode, randomBlockStatementNode, parentNode);
  2828. }
  2829. }, {
  2830. key: "restoreNode",
  2831. value: function restoreNode(deadCodeInjectionRootAstHostNode, parentNode) {
  2832. var hostNodeFirstStatement = deadCodeInjectionRootAstHostNode.body[0];
  2833. if (!NodeGuards_1.NodeGuards.isFunctionDeclarationNode(hostNodeFirstStatement)) {
  2834. throw new Error('Wrong dead code injection root AST host node. Host node should contain `FunctionDeclaration` node');
  2835. }
  2836. return hostNodeFirstStatement.body;
  2837. }
  2838. }, {
  2839. key: "collectBlockStatementNodes",
  2840. value: function collectBlockStatementNodes(blockStatementNode, collectedBlockStatements, parentNode) {
  2841. var clonedBlockStatementNode = NodeUtils_1.NodeUtils.clone(blockStatementNode);
  2842. var nestedBlockStatementsCount = 0,
  2843. isValidBlockStatementNode = true;
  2844. estraverse.replace(clonedBlockStatementNode, {
  2845. enter: function enter(node) {
  2846. if (NodeGuards_1.NodeGuards.isBlockStatementNode(node)) {
  2847. nestedBlockStatementsCount++;
  2848. }
  2849. if (nestedBlockStatementsCount > DeadCodeInjectionTransformer_1.maxNestedBlockStatementsCount || !DeadCodeInjectionTransformer_1.isValidBlockStatementNode(node)) {
  2850. isValidBlockStatementNode = false;
  2851. return estraverse.VisitorOption.Break;
  2852. }
  2853. return node;
  2854. }
  2855. });
  2856. if (!isValidBlockStatementNode) {
  2857. return;
  2858. }
  2859. collectedBlockStatements.push(clonedBlockStatementNode);
  2860. }
  2861. }, {
  2862. key: "isDeadCodeInjectionRootAstHostNode",
  2863. value: function isDeadCodeInjectionRootAstHostNode(node) {
  2864. return NodeGuards_1.NodeGuards.isBlockStatementNode(node) && this.deadCodeInjectionRootAstHostNodeSet.has(node);
  2865. }
  2866. }, {
  2867. key: "replaceBlockStatementNode",
  2868. value: function replaceBlockStatementNode(blockStatementNode, randomBlockStatementNode, parentNode) {
  2869. var deadCodeInjectionRootAstHostNode = Nodes_1.Nodes.getBlockStatementNode([Nodes_1.Nodes.getFunctionDeclarationNode('foobar', [], randomBlockStatementNode)]);
  2870. this.deadCodeInjectionRootAstHostNodeSet.add(deadCodeInjectionRootAstHostNode);
  2871. var blockStatementDeadCodeInjectionCustomNode = this.deadCodeInjectionCustomNodeFactory(DeadCodeInjectionCustomNode_1.DeadCodeInjectionCustomNode.BlockStatementDeadCodeInjectionNode);
  2872. blockStatementDeadCodeInjectionCustomNode.initialize(blockStatementNode, deadCodeInjectionRootAstHostNode);
  2873. var newBlockStatementNode = blockStatementDeadCodeInjectionCustomNode.getNode()[0];
  2874. NodeUtils_1.NodeUtils.parentizeNode(newBlockStatementNode, parentNode);
  2875. return newBlockStatementNode;
  2876. }
  2877. }], [{
  2878. key: "isValidBlockStatementNode",
  2879. value: function isValidBlockStatementNode(node) {
  2880. return !NodeGuards_1.NodeGuards.isBreakStatementNode(node) && !NodeGuards_1.NodeGuards.isContinueStatementNode(node) && !NodeGuards_1.NodeGuards.isAwaitExpressionNode(node) && !NodeGuards_1.NodeGuards.isSuperNode(node);
  2881. }
  2882. }]);
  2883. return DeadCodeInjectionTransformer;
  2884. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  2885. DeadCodeInjectionTransformer.maxNestedBlockStatementsCount = 4;
  2886. DeadCodeInjectionTransformer.minCollectedBlockStatementsCount = 5;
  2887. DeadCodeInjectionTransformer = DeadCodeInjectionTransformer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IDeadCodeInjectionCustomNode)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], DeadCodeInjectionTransformer);
  2888. exports.DeadCodeInjectionTransformer = DeadCodeInjectionTransformer;
  2889. var DeadCodeInjectionTransformer_1;
  2890. /***/ }),
  2891. /* 61 */
  2892. /***/ (function(module, exports, __webpack_require__) {
  2893. "use strict";
  2894. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  2895. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2896. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2897. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2898. Object.defineProperty(exports, "__esModule", { value: true });
  2899. var tslib_1 = __webpack_require__(2);
  2900. var inversify_1 = __webpack_require__(0);
  2901. var ServiceIdentifiers_1 = __webpack_require__(1);
  2902. var estraverse = __webpack_require__(10);
  2903. var ControlFlowCustomNode_1 = __webpack_require__(13);
  2904. var ControlFlowReplacer_1 = __webpack_require__(38);
  2905. var NodeType_1 = __webpack_require__(11);
  2906. var TransformationStage_1 = __webpack_require__(6);
  2907. var AbstractNodeTransformer_1 = __webpack_require__(8);
  2908. var NodeGuards_1 = __webpack_require__(4);
  2909. var NodeAppender_1 = __webpack_require__(16);
  2910. var NodeUtils_1 = __webpack_require__(3);
  2911. var FunctionControlFlowTransformer = FunctionControlFlowTransformer_1 = function (_AbstractNodeTransfor) {
  2912. _inherits(FunctionControlFlowTransformer, _AbstractNodeTransfor);
  2913. function FunctionControlFlowTransformer(controlFlowStorageFactory, controlFlowReplacerFactory, controlFlowCustomNodeFactory, randomGenerator, options) {
  2914. _classCallCheck(this, FunctionControlFlowTransformer);
  2915. var _this = _possibleConstructorReturn(this, (FunctionControlFlowTransformer.__proto__ || Object.getPrototypeOf(FunctionControlFlowTransformer)).call(this, randomGenerator, options));
  2916. _this.controlFlowData = new Map();
  2917. _this.visitedFunctionNodes = new Set();
  2918. _this.hostNodesWithControlFlowNode = new Set();
  2919. _this.controlFlowStorageFactory = controlFlowStorageFactory;
  2920. _this.controlFlowReplacerFactory = controlFlowReplacerFactory;
  2921. _this.controlFlowCustomNodeFactory = controlFlowCustomNodeFactory;
  2922. return _this;
  2923. }
  2924. _createClass(FunctionControlFlowTransformer, [{
  2925. key: "getVisitor",
  2926. value: function getVisitor(transformationStage) {
  2927. var _this2 = this;
  2928. if (!this.options.controlFlowFlattening) {
  2929. return null;
  2930. }
  2931. switch (transformationStage) {
  2932. case TransformationStage_1.TransformationStage.ControlFlowFlattening:
  2933. return {
  2934. leave: function leave(node, parentNode) {
  2935. if (parentNode && (NodeGuards_1.NodeGuards.isFunctionDeclarationNode(node) || NodeGuards_1.NodeGuards.isFunctionExpressionNode(node) || NodeGuards_1.NodeGuards.isArrowFunctionExpressionNode(node))) {
  2936. return _this2.transformNode(node, parentNode);
  2937. }
  2938. }
  2939. };
  2940. default:
  2941. return null;
  2942. }
  2943. }
  2944. }, {
  2945. key: "transformNode",
  2946. value: function transformNode(functionNode, parentNode) {
  2947. this.visitedFunctionNodes.add(functionNode);
  2948. if (!NodeGuards_1.NodeGuards.isBlockStatementNode(functionNode.body)) {
  2949. return functionNode;
  2950. }
  2951. var hostNode = this.getHostNode(functionNode.body);
  2952. var controlFlowStorage = this.getControlFlowStorage(hostNode);
  2953. this.controlFlowData.set(hostNode, controlFlowStorage);
  2954. this.transformFunctionBody(functionNode.body, controlFlowStorage);
  2955. if (!controlFlowStorage.getLength()) {
  2956. return functionNode;
  2957. }
  2958. var controlFlowStorageCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.ControlFlowStorageNode);
  2959. controlFlowStorageCustomNode.initialize(controlFlowStorage);
  2960. NodeAppender_1.NodeAppender.prependNode(hostNode, controlFlowStorageCustomNode.getNode());
  2961. this.hostNodesWithControlFlowNode.add(hostNode);
  2962. return functionNode;
  2963. }
  2964. }, {
  2965. key: "getControlFlowStorage",
  2966. value: function getControlFlowStorage(hostNode) {
  2967. var controlFlowStorage = this.controlFlowStorageFactory();
  2968. if (this.controlFlowData.has(hostNode)) {
  2969. if (this.hostNodesWithControlFlowNode.has(hostNode)) {
  2970. hostNode.body.shift();
  2971. }
  2972. var hostControlFlowStorage = this.controlFlowData.get(hostNode);
  2973. controlFlowStorage.mergeWith(hostControlFlowStorage, true);
  2974. }
  2975. return controlFlowStorage;
  2976. }
  2977. }, {
  2978. key: "getHostNode",
  2979. value: function getHostNode(functionNodeBody) {
  2980. var blockScopesOfNode = NodeUtils_1.NodeUtils.getBlockScopesOfNode(functionNodeBody);
  2981. if (blockScopesOfNode.length === 1) {
  2982. return functionNodeBody;
  2983. } else {
  2984. blockScopesOfNode.pop();
  2985. }
  2986. if (blockScopesOfNode.length > FunctionControlFlowTransformer_1.hostNodeSearchMinDepth) {
  2987. blockScopesOfNode.splice(0, FunctionControlFlowTransformer_1.hostNodeSearchMinDepth);
  2988. }
  2989. if (blockScopesOfNode.length > FunctionControlFlowTransformer_1.hostNodeSearchMaxDepth) {
  2990. blockScopesOfNode.length = FunctionControlFlowTransformer_1.hostNodeSearchMaxDepth;
  2991. }
  2992. return this.randomGenerator.getRandomGenerator().pickone(blockScopesOfNode);
  2993. }
  2994. }, {
  2995. key: "isVisitedFunctionNode",
  2996. value: function isVisitedFunctionNode(node) {
  2997. return (NodeGuards_1.NodeGuards.isFunctionDeclarationNode(node) || NodeGuards_1.NodeGuards.isFunctionExpressionNode(node) || NodeGuards_1.NodeGuards.isArrowFunctionExpressionNode(node)) && this.visitedFunctionNodes.has(node);
  2998. }
  2999. }, {
  3000. key: "transformFunctionBody",
  3001. value: function transformFunctionBody(functionNodeBody, controlFlowStorage) {
  3002. var _this3 = this;
  3003. estraverse.replace(functionNodeBody, {
  3004. enter: function enter(node, parentNode) {
  3005. if (node.ignoredNode) {
  3006. return estraverse.VisitorOption.Skip;
  3007. }
  3008. if (_this3.isVisitedFunctionNode(node) || !parentNode) {
  3009. return estraverse.VisitorOption.Skip;
  3010. }
  3011. if (!FunctionControlFlowTransformer_1.controlFlowReplacersMap.has(node.type)) {
  3012. return node;
  3013. }
  3014. if (_this3.randomGenerator.getMathRandom() > _this3.options.controlFlowFlatteningThreshold) {
  3015. return node;
  3016. }
  3017. var controlFlowReplacerName = FunctionControlFlowTransformer_1.controlFlowReplacersMap.get(node.type);
  3018. if (controlFlowReplacerName === undefined) {
  3019. return node;
  3020. }
  3021. return Object.assign({}, _this3.controlFlowReplacerFactory(controlFlowReplacerName).replace(node, parentNode, controlFlowStorage), { parentNode: parentNode });
  3022. }
  3023. });
  3024. }
  3025. }]);
  3026. return FunctionControlFlowTransformer;
  3027. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  3028. FunctionControlFlowTransformer.controlFlowReplacersMap = new Map([[NodeType_1.NodeType.BinaryExpression, ControlFlowReplacer_1.ControlFlowReplacer.BinaryExpressionControlFlowReplacer], [NodeType_1.NodeType.CallExpression, ControlFlowReplacer_1.ControlFlowReplacer.CallExpressionControlFlowReplacer], [NodeType_1.NodeType.LogicalExpression, ControlFlowReplacer_1.ControlFlowReplacer.LogicalExpressionControlFlowReplacer], [NodeType_1.NodeType.Literal, ControlFlowReplacer_1.ControlFlowReplacer.StringLiteralControlFlowReplacer]]);
  3029. FunctionControlFlowTransformer.hostNodeSearchMinDepth = 0;
  3030. FunctionControlFlowTransformer.hostNodeSearchMaxDepth = 2;
  3031. FunctionControlFlowTransformer = FunctionControlFlowTransformer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__TControlFlowStorage)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowReplacer)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowCustomNode)), tslib_1.__param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(4, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Function, Function, Object, Object])], FunctionControlFlowTransformer);
  3032. exports.FunctionControlFlowTransformer = FunctionControlFlowTransformer;
  3033. var FunctionControlFlowTransformer_1;
  3034. /***/ }),
  3035. /* 62 */
  3036. /***/ (function(module, exports, __webpack_require__) {
  3037. "use strict";
  3038. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  3039. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3040. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3041. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3042. Object.defineProperty(exports, "__esModule", { value: true });
  3043. var tslib_1 = __webpack_require__(2);
  3044. var inversify_1 = __webpack_require__(0);
  3045. var ServiceIdentifiers_1 = __webpack_require__(1);
  3046. var ControlFlowCustomNode_1 = __webpack_require__(13);
  3047. var ExpressionWithOperatorControlFlowReplacer_1 = __webpack_require__(39);
  3048. var NodeGuards_1 = __webpack_require__(4);
  3049. var NodeUtils_1 = __webpack_require__(3);
  3050. var LogicalExpressionControlFlowReplacer = LogicalExpressionControlFlowReplacer_1 = function (_ExpressionWithOperat) {
  3051. _inherits(LogicalExpressionControlFlowReplacer, _ExpressionWithOperat);
  3052. function LogicalExpressionControlFlowReplacer(controlFlowCustomNodeFactory, randomGenerator, options) {
  3053. _classCallCheck(this, LogicalExpressionControlFlowReplacer);
  3054. return _possibleConstructorReturn(this, (LogicalExpressionControlFlowReplacer.__proto__ || Object.getPrototypeOf(LogicalExpressionControlFlowReplacer)).call(this, controlFlowCustomNodeFactory, randomGenerator, options));
  3055. }
  3056. _createClass(LogicalExpressionControlFlowReplacer, [{
  3057. key: "replace",
  3058. value: function replace(logicalExpressionNode, parentNode, controlFlowStorage) {
  3059. if (this.checkForProhibitedExpressions(logicalExpressionNode.left, logicalExpressionNode.right)) {
  3060. return logicalExpressionNode;
  3061. }
  3062. var replacerId = logicalExpressionNode.operator;
  3063. var logicalExpressionFunctionCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.LogicalExpressionFunctionNode);
  3064. logicalExpressionFunctionCustomNode.initialize(replacerId);
  3065. var storageKey = this.insertCustomNodeToControlFlowStorage(logicalExpressionFunctionCustomNode, controlFlowStorage, replacerId, LogicalExpressionControlFlowReplacer_1.usingExistingIdentifierChance);
  3066. return this.getControlFlowStorageCallNode(controlFlowStorage.getStorageId(), storageKey, logicalExpressionNode.left, logicalExpressionNode.right);
  3067. }
  3068. }, {
  3069. key: "checkForProhibitedExpressions",
  3070. value: function checkForProhibitedExpressions(leftExpression, rightExpression) {
  3071. return [leftExpression, rightExpression].some(function (expressionNode) {
  3072. var nodeForCheck = void 0;
  3073. if (!NodeGuards_1.NodeGuards.isUnaryExpressionNode(expressionNode)) {
  3074. nodeForCheck = expressionNode;
  3075. } else {
  3076. nodeForCheck = NodeUtils_1.NodeUtils.getUnaryExpressionArgumentNode(expressionNode);
  3077. }
  3078. return !NodeGuards_1.NodeGuards.isLiteralNode(nodeForCheck) && !NodeGuards_1.NodeGuards.isIdentifierNode(nodeForCheck) && !NodeGuards_1.NodeGuards.isObjectExpressionNode(nodeForCheck) && !NodeGuards_1.NodeGuards.isExpressionStatementNode(nodeForCheck);
  3079. });
  3080. }
  3081. }]);
  3082. return LogicalExpressionControlFlowReplacer;
  3083. }(ExpressionWithOperatorControlFlowReplacer_1.ExpressionWithOperatorControlFlowReplacer);
  3084. LogicalExpressionControlFlowReplacer.usingExistingIdentifierChance = 0.5;
  3085. LogicalExpressionControlFlowReplacer = LogicalExpressionControlFlowReplacer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowCustomNode)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], LogicalExpressionControlFlowReplacer);
  3086. exports.LogicalExpressionControlFlowReplacer = LogicalExpressionControlFlowReplacer;
  3087. var LogicalExpressionControlFlowReplacer_1;
  3088. /***/ }),
  3089. /* 63 */
  3090. /***/ (function(module, exports, __webpack_require__) {
  3091. "use strict";
  3092. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  3093. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3094. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3095. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3096. Object.defineProperty(exports, "__esModule", { value: true });
  3097. var tslib_1 = __webpack_require__(2);
  3098. var inversify_1 = __webpack_require__(0);
  3099. var ServiceIdentifiers_1 = __webpack_require__(1);
  3100. var ControlFlowCustomNode_1 = __webpack_require__(13);
  3101. var AbstractControlFlowReplacer_1 = __webpack_require__(31);
  3102. var NodeGuards_1 = __webpack_require__(4);
  3103. var StringLiteralControlFlowReplacer = StringLiteralControlFlowReplacer_1 = function (_AbstractControlFlowR) {
  3104. _inherits(StringLiteralControlFlowReplacer, _AbstractControlFlowR);
  3105. function StringLiteralControlFlowReplacer(controlFlowCustomNodeFactory, randomGenerator, options) {
  3106. _classCallCheck(this, StringLiteralControlFlowReplacer);
  3107. return _possibleConstructorReturn(this, (StringLiteralControlFlowReplacer.__proto__ || Object.getPrototypeOf(StringLiteralControlFlowReplacer)).call(this, controlFlowCustomNodeFactory, randomGenerator, options));
  3108. }
  3109. _createClass(StringLiteralControlFlowReplacer, [{
  3110. key: "replace",
  3111. value: function replace(literalNode, parentNode, controlFlowStorage) {
  3112. if (NodeGuards_1.NodeGuards.isPropertyNode(parentNode) && parentNode.key === literalNode) {
  3113. return literalNode;
  3114. }
  3115. if (typeof literalNode.value !== 'string' || literalNode.value.length < 3) {
  3116. return literalNode;
  3117. }
  3118. var replacerId = String(literalNode.value);
  3119. var literalFunctionCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.StringLiteralNode);
  3120. literalFunctionCustomNode.initialize(literalNode.value);
  3121. var storageKey = this.insertCustomNodeToControlFlowStorage(literalFunctionCustomNode, controlFlowStorage, replacerId, StringLiteralControlFlowReplacer_1.usingExistingIdentifierChance);
  3122. return this.getControlFlowStorageCallNode(controlFlowStorage.getStorageId(), storageKey);
  3123. }
  3124. }, {
  3125. key: "getControlFlowStorageCallNode",
  3126. value: function getControlFlowStorageCallNode(controlFlowStorageId, storageKey) {
  3127. var controlFlowStorageCallCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.StringLiteralControlFlowStorageCallNode);
  3128. controlFlowStorageCallCustomNode.initialize(controlFlowStorageId, storageKey);
  3129. var statementNode = controlFlowStorageCallCustomNode.getNode()[0];
  3130. if (!statementNode || !NodeGuards_1.NodeGuards.isExpressionStatementNode(statementNode)) {
  3131. throw new Error("`controlFlowStorageCallCustomNode.getNode()[0]` should returns array with `ExpressionStatement` node");
  3132. }
  3133. return statementNode.expression;
  3134. }
  3135. }]);
  3136. return StringLiteralControlFlowReplacer;
  3137. }(AbstractControlFlowReplacer_1.AbstractControlFlowReplacer);
  3138. StringLiteralControlFlowReplacer.usingExistingIdentifierChance = 1;
  3139. StringLiteralControlFlowReplacer = StringLiteralControlFlowReplacer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowCustomNode)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], StringLiteralControlFlowReplacer);
  3140. exports.StringLiteralControlFlowReplacer = StringLiteralControlFlowReplacer;
  3141. var StringLiteralControlFlowReplacer_1;
  3142. /***/ }),
  3143. /* 64 */
  3144. /***/ (function(module, exports, __webpack_require__) {
  3145. "use strict";
  3146. Object.defineProperty(exports, "__esModule", { value: true });
  3147. var inversify_1 = __webpack_require__(0);
  3148. var ServiceIdentifiers_1 = __webpack_require__(1);
  3149. var NodeTransformer_1 = __webpack_require__(20);
  3150. var MemberExpressionTransformer_1 = __webpack_require__(65);
  3151. var MethodDefinitionTransformer_1 = __webpack_require__(66);
  3152. var ObjectExpressionKeysTransformer_1 = __webpack_require__(67);
  3153. var TemplateLiteralTransformer_1 = __webpack_require__(68);
  3154. exports.convertingTransformersModule = new inversify_1.ContainerModule(function (bind) {
  3155. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(MemberExpressionTransformer_1.MemberExpressionTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.MemberExpressionTransformer);
  3156. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(MethodDefinitionTransformer_1.MethodDefinitionTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.MethodDefinitionTransformer);
  3157. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(ObjectExpressionKeysTransformer_1.ObjectExpressionKeysTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.ObjectExpressionKeysTransformer);
  3158. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(TemplateLiteralTransformer_1.TemplateLiteralTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.TemplateLiteralTransformer);
  3159. });
  3160. /***/ }),
  3161. /* 65 */
  3162. /***/ (function(module, exports, __webpack_require__) {
  3163. "use strict";
  3164. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  3165. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3166. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3167. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3168. Object.defineProperty(exports, "__esModule", { value: true });
  3169. var tslib_1 = __webpack_require__(2);
  3170. var inversify_1 = __webpack_require__(0);
  3171. var ServiceIdentifiers_1 = __webpack_require__(1);
  3172. var NodeType_1 = __webpack_require__(11);
  3173. var TransformationStage_1 = __webpack_require__(6);
  3174. var AbstractNodeTransformer_1 = __webpack_require__(8);
  3175. var NodeGuards_1 = __webpack_require__(4);
  3176. var MemberExpressionTransformer = function (_AbstractNodeTransfor) {
  3177. _inherits(MemberExpressionTransformer, _AbstractNodeTransfor);
  3178. function MemberExpressionTransformer(randomGenerator, options) {
  3179. _classCallCheck(this, MemberExpressionTransformer);
  3180. return _possibleConstructorReturn(this, (MemberExpressionTransformer.__proto__ || Object.getPrototypeOf(MemberExpressionTransformer)).call(this, randomGenerator, options));
  3181. }
  3182. _createClass(MemberExpressionTransformer, [{
  3183. key: "getVisitor",
  3184. value: function getVisitor(transformationStage) {
  3185. var _this2 = this;
  3186. switch (transformationStage) {
  3187. case TransformationStage_1.TransformationStage.Converting:
  3188. return {
  3189. enter: function enter(node, parentNode) {
  3190. if (parentNode && NodeGuards_1.NodeGuards.isMemberExpressionNode(node)) {
  3191. return _this2.transformNode(node, parentNode);
  3192. }
  3193. }
  3194. };
  3195. default:
  3196. return null;
  3197. }
  3198. }
  3199. }, {
  3200. key: "transformNode",
  3201. value: function transformNode(memberExpressionNode, parentNode) {
  3202. if (NodeGuards_1.NodeGuards.isIdentifierNode(memberExpressionNode.property)) {
  3203. if (memberExpressionNode.computed) {
  3204. return memberExpressionNode;
  3205. }
  3206. memberExpressionNode.computed = true;
  3207. memberExpressionNode.property = {
  3208. type: NodeType_1.NodeType.Literal,
  3209. value: memberExpressionNode.property.name,
  3210. raw: "'" + memberExpressionNode.property.name + "'"
  3211. };
  3212. }
  3213. return memberExpressionNode;
  3214. }
  3215. }]);
  3216. return MemberExpressionTransformer;
  3217. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  3218. MemberExpressionTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], MemberExpressionTransformer);
  3219. exports.MemberExpressionTransformer = MemberExpressionTransformer;
  3220. /***/ }),
  3221. /* 66 */
  3222. /***/ (function(module, exports, __webpack_require__) {
  3223. "use strict";
  3224. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  3225. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3226. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3227. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3228. Object.defineProperty(exports, "__esModule", { value: true });
  3229. var tslib_1 = __webpack_require__(2);
  3230. var inversify_1 = __webpack_require__(0);
  3231. var ServiceIdentifiers_1 = __webpack_require__(1);
  3232. var NodeType_1 = __webpack_require__(11);
  3233. var TransformationStage_1 = __webpack_require__(6);
  3234. var AbstractNodeTransformer_1 = __webpack_require__(8);
  3235. var NodeGuards_1 = __webpack_require__(4);
  3236. var MethodDefinitionTransformer = MethodDefinitionTransformer_1 = function (_AbstractNodeTransfor) {
  3237. _inherits(MethodDefinitionTransformer, _AbstractNodeTransfor);
  3238. function MethodDefinitionTransformer(randomGenerator, options) {
  3239. _classCallCheck(this, MethodDefinitionTransformer);
  3240. return _possibleConstructorReturn(this, (MethodDefinitionTransformer.__proto__ || Object.getPrototypeOf(MethodDefinitionTransformer)).call(this, randomGenerator, options));
  3241. }
  3242. _createClass(MethodDefinitionTransformer, [{
  3243. key: "getVisitor",
  3244. value: function getVisitor(transformationStage) {
  3245. var _this2 = this;
  3246. switch (transformationStage) {
  3247. case TransformationStage_1.TransformationStage.Converting:
  3248. return {
  3249. enter: function enter(node, parentNode) {
  3250. if (parentNode && NodeGuards_1.NodeGuards.isMethodDefinitionNode(node)) {
  3251. return _this2.transformNode(node, parentNode);
  3252. }
  3253. }
  3254. };
  3255. default:
  3256. return null;
  3257. }
  3258. }
  3259. }, {
  3260. key: "transformNode",
  3261. value: function transformNode(methodDefinitionNode, parentNode) {
  3262. if (NodeGuards_1.NodeGuards.isIdentifierNode(methodDefinitionNode.key) && !(MethodDefinitionTransformer_1.ignoredNames.indexOf(methodDefinitionNode.key.name) !== -1) && methodDefinitionNode.computed === false) {
  3263. methodDefinitionNode.computed = true;
  3264. methodDefinitionNode.key = {
  3265. type: NodeType_1.NodeType.Literal,
  3266. value: methodDefinitionNode.key.name,
  3267. raw: "'" + methodDefinitionNode.key.name + "'"
  3268. };
  3269. }
  3270. return methodDefinitionNode;
  3271. }
  3272. }]);
  3273. return MethodDefinitionTransformer;
  3274. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  3275. MethodDefinitionTransformer.ignoredNames = ['constructor'];
  3276. MethodDefinitionTransformer = MethodDefinitionTransformer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], MethodDefinitionTransformer);
  3277. exports.MethodDefinitionTransformer = MethodDefinitionTransformer;
  3278. var MethodDefinitionTransformer_1;
  3279. /***/ }),
  3280. /* 67 */
  3281. /***/ (function(module, exports, __webpack_require__) {
  3282. "use strict";
  3283. var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; })();
  3284. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  3285. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3286. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3287. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3288. Object.defineProperty(exports, "__esModule", { value: true });
  3289. var tslib_1 = __webpack_require__(2);
  3290. var inversify_1 = __webpack_require__(0);
  3291. var ServiceIdentifiers_1 = __webpack_require__(1);
  3292. var TransformationStage_1 = __webpack_require__(6);
  3293. var AbstractNodeTransformer_1 = __webpack_require__(8);
  3294. var NodeAppender_1 = __webpack_require__(16);
  3295. var NodeGuards_1 = __webpack_require__(4);
  3296. var Nodes_1 = __webpack_require__(9);
  3297. var NodeUtils_1 = __webpack_require__(3);
  3298. var ObjectExpressionKeysTransformer = ObjectExpressionKeysTransformer_1 = function (_AbstractNodeTransfor) {
  3299. _inherits(ObjectExpressionKeysTransformer, _AbstractNodeTransfor);
  3300. function ObjectExpressionKeysTransformer(randomGenerator, options) {
  3301. _classCallCheck(this, ObjectExpressionKeysTransformer);
  3302. var _this = _possibleConstructorReturn(this, (ObjectExpressionKeysTransformer.__proto__ || Object.getPrototypeOf(ObjectExpressionKeysTransformer)).call(this, randomGenerator, options));
  3303. _this.cachedScopeNodesMap = new Map();
  3304. return _this;
  3305. }
  3306. _createClass(ObjectExpressionKeysTransformer, [{
  3307. key: "getVisitor",
  3308. value: function getVisitor(transformationStage) {
  3309. var _this2 = this;
  3310. switch (transformationStage) {
  3311. case TransformationStage_1.TransformationStage.Converting:
  3312. return {
  3313. enter: function enter(node, parentNode) {
  3314. if (_this2.options.transformObjectKeys && parentNode && NodeGuards_1.NodeGuards.isObjectExpressionNode(node) && NodeGuards_1.NodeGuards.isVariableDeclaratorNode(parentNode)) {
  3315. return _this2.transformNode(node, parentNode);
  3316. }
  3317. }
  3318. };
  3319. default:
  3320. return null;
  3321. }
  3322. }
  3323. }, {
  3324. key: "transformNode",
  3325. value: function transformNode(objectExpressionNode, variableDeclarator) {
  3326. if (!NodeGuards_1.NodeGuards.isIdentifierNode(variableDeclarator.id)) {
  3327. return objectExpressionNode;
  3328. }
  3329. var scopeNode = NodeUtils_1.NodeUtils.getScopeOfNode(variableDeclarator);
  3330. if (!scopeNode || !NodeGuards_1.NodeGuards.isNodeHasScope(scopeNode)) {
  3331. return objectExpressionNode;
  3332. }
  3333. this.cachedScopeNodesMap.set(variableDeclarator, scopeNode);
  3334. return this.transformObjectExpressionNode(objectExpressionNode, variableDeclarator.id, variableDeclarator);
  3335. }
  3336. }, {
  3337. key: "extractPropertiesToExpressionStatements",
  3338. value: function extractPropertiesToExpressionStatements(properties, memberExpressionObject, variableDeclarator) {
  3339. var propertiesLength = properties.length;
  3340. var expressionStatements = [];
  3341. var removablePropertyIds = [];
  3342. for (var i = 0; i < propertiesLength; i++) {
  3343. var property = properties[i];
  3344. var propertyKey = property.key;
  3345. if (NodeGuards_1.NodeGuards.isObjectPatternNode(property.value) || NodeGuards_1.NodeGuards.isArrayPatternNode(property.value) || NodeGuards_1.NodeGuards.isAssignmentPatternNode(property.value) || NodeGuards_1.NodeGuards.isRestElementNode(property.value)) {
  3346. continue;
  3347. }
  3348. var propertyKeyName = void 0;
  3349. if (NodeGuards_1.NodeGuards.isLiteralNode(propertyKey) && typeof propertyKey.value === 'string') {
  3350. propertyKeyName = propertyKey.value;
  3351. } else if (NodeGuards_1.NodeGuards.isIdentifierNode(propertyKey)) {
  3352. propertyKeyName = propertyKey.name;
  3353. } else {
  3354. continue;
  3355. }
  3356. var shouldCreateLiteralNode = !property.computed || property.computed && NodeGuards_1.NodeGuards.isLiteralNode(property.key);
  3357. var memberExpressionProperty = shouldCreateLiteralNode ? Nodes_1.Nodes.getLiteralNode(propertyKeyName) : Nodes_1.Nodes.getIdentifierNode(propertyKeyName);
  3358. var memberExpressionNode = Nodes_1.Nodes.getMemberExpressionNode(memberExpressionObject, memberExpressionProperty, true);
  3359. var rightExpression = property.value;
  3360. var expressionStatementNode = Nodes_1.Nodes.getExpressionStatementNode(Nodes_1.Nodes.getAssignmentExpressionNode('=', memberExpressionNode, rightExpression));
  3361. if (NodeGuards_1.NodeGuards.isObjectExpressionNode(property.value)) {
  3362. this.transformObjectExpressionNode(property.value, memberExpressionNode, variableDeclarator);
  3363. }
  3364. expressionStatements.push(expressionStatementNode);
  3365. removablePropertyIds.push(i);
  3366. }
  3367. return [expressionStatements, removablePropertyIds];
  3368. }
  3369. }, {
  3370. key: "transformObjectExpressionNode",
  3371. value: function transformObjectExpressionNode(objectExpressionNode, memberExpressionObjectNode, variableDeclarator) {
  3372. var properties = objectExpressionNode.properties;
  3373. if (!properties.length) {
  3374. return objectExpressionNode;
  3375. }
  3376. var scopeNode = this.cachedScopeNodesMap.get(variableDeclarator);
  3377. if (!scopeNode) {
  3378. return objectExpressionNode;
  3379. }
  3380. var _extractPropertiesToE = this.extractPropertiesToExpressionStatements(properties, memberExpressionObjectNode, variableDeclarator),
  3381. _extractPropertiesToE2 = _slicedToArray(_extractPropertiesToE, 2),
  3382. expressionStatements = _extractPropertiesToE2[0],
  3383. removablePropertyIds = _extractPropertiesToE2[1];
  3384. objectExpressionNode.properties = ObjectExpressionKeysTransformer_1.filterObjectExpressionProperties(properties, removablePropertyIds);
  3385. ObjectExpressionKeysTransformer_1.appendExpressionStatements(scopeNode, expressionStatements, variableDeclarator);
  3386. return objectExpressionNode;
  3387. }
  3388. }], [{
  3389. key: "appendExpressionStatements",
  3390. value: function appendExpressionStatements(scopeNode, expressionStatements, variableDeclarator) {
  3391. var variableDeclaration = variableDeclarator.parentNode;
  3392. if (!variableDeclaration || !NodeGuards_1.NodeGuards.isVariableDeclarationNode(variableDeclaration)) {
  3393. throw new Error('Cannot find variable declaration for variable declarator');
  3394. }
  3395. NodeAppender_1.NodeAppender.insertNodeAfter(scopeNode, expressionStatements, variableDeclaration);
  3396. }
  3397. }, {
  3398. key: "filterObjectExpressionProperties",
  3399. value: function filterObjectExpressionProperties(properties, removablePropertyIds) {
  3400. return properties.filter(function (property, index) {
  3401. return !(removablePropertyIds.indexOf(index) !== -1);
  3402. });
  3403. }
  3404. }]);
  3405. return ObjectExpressionKeysTransformer;
  3406. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  3407. ObjectExpressionKeysTransformer = ObjectExpressionKeysTransformer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], ObjectExpressionKeysTransformer);
  3408. exports.ObjectExpressionKeysTransformer = ObjectExpressionKeysTransformer;
  3409. var ObjectExpressionKeysTransformer_1;
  3410. /***/ }),
  3411. /* 68 */
  3412. /***/ (function(module, exports, __webpack_require__) {
  3413. "use strict";
  3414. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  3415. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3416. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3417. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3418. Object.defineProperty(exports, "__esModule", { value: true });
  3419. var tslib_1 = __webpack_require__(2);
  3420. var inversify_1 = __webpack_require__(0);
  3421. var ServiceIdentifiers_1 = __webpack_require__(1);
  3422. var TransformationStage_1 = __webpack_require__(6);
  3423. var AbstractNodeTransformer_1 = __webpack_require__(8);
  3424. var NodeGuards_1 = __webpack_require__(4);
  3425. var Nodes_1 = __webpack_require__(9);
  3426. var TemplateLiteralTransformer = TemplateLiteralTransformer_1 = function (_AbstractNodeTransfor) {
  3427. _inherits(TemplateLiteralTransformer, _AbstractNodeTransfor);
  3428. function TemplateLiteralTransformer(randomGenerator, options) {
  3429. _classCallCheck(this, TemplateLiteralTransformer);
  3430. return _possibleConstructorReturn(this, (TemplateLiteralTransformer.__proto__ || Object.getPrototypeOf(TemplateLiteralTransformer)).call(this, randomGenerator, options));
  3431. }
  3432. _createClass(TemplateLiteralTransformer, [{
  3433. key: "getVisitor",
  3434. value: function getVisitor(transformationStage) {
  3435. var _this2 = this;
  3436. switch (transformationStage) {
  3437. case TransformationStage_1.TransformationStage.Converting:
  3438. return {
  3439. enter: function enter(node, parentNode) {
  3440. if (parentNode && NodeGuards_1.NodeGuards.isTemplateLiteralNode(node)) {
  3441. return _this2.transformNode(node, parentNode);
  3442. }
  3443. }
  3444. };
  3445. default:
  3446. return null;
  3447. }
  3448. }
  3449. }, {
  3450. key: "transformNode",
  3451. value: function transformNode(templateLiteralNode, parentNode) {
  3452. var templateLiteralExpressions = templateLiteralNode.expressions;
  3453. var nodes = [];
  3454. templateLiteralNode.quasis.forEach(function (templateElement) {
  3455. nodes.push(Nodes_1.Nodes.getLiteralNode(templateElement.value.cooked));
  3456. var expression = templateLiteralExpressions.shift();
  3457. if (!expression) {
  3458. return;
  3459. }
  3460. nodes.push(expression);
  3461. });
  3462. nodes = nodes.filter(function (node) {
  3463. return !(NodeGuards_1.NodeGuards.isLiteralNode(node) && node.value === '');
  3464. });
  3465. if (!TemplateLiteralTransformer_1.isLiteralNodeWithStringValue(nodes[0]) && !TemplateLiteralTransformer_1.isLiteralNodeWithStringValue(nodes[1])) {
  3466. nodes.unshift(Nodes_1.Nodes.getLiteralNode(''));
  3467. }
  3468. if (nodes.length > 1) {
  3469. var root = Nodes_1.Nodes.getBinaryExpressionNode('+', nodes.shift(), nodes.shift());
  3470. nodes.forEach(function (node) {
  3471. root = Nodes_1.Nodes.getBinaryExpressionNode('+', root, node);
  3472. });
  3473. return root;
  3474. }
  3475. return nodes[0];
  3476. }
  3477. }], [{
  3478. key: "isLiteralNodeWithStringValue",
  3479. value: function isLiteralNodeWithStringValue(node) {
  3480. return node && NodeGuards_1.NodeGuards.isLiteralNode(node) && typeof node.value === 'string';
  3481. }
  3482. }]);
  3483. return TemplateLiteralTransformer;
  3484. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  3485. TemplateLiteralTransformer = TemplateLiteralTransformer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], TemplateLiteralTransformer);
  3486. exports.TemplateLiteralTransformer = TemplateLiteralTransformer;
  3487. var TemplateLiteralTransformer_1;
  3488. /***/ }),
  3489. /* 69 */
  3490. /***/ (function(module, exports, __webpack_require__) {
  3491. "use strict";
  3492. Object.defineProperty(exports, "__esModule", { value: true });
  3493. var InversifyContainerFacade_1 = __webpack_require__(15);
  3494. var inversify_1 = __webpack_require__(0);
  3495. var ServiceIdentifiers_1 = __webpack_require__(1);
  3496. var ControlFlowCustomNode_1 = __webpack_require__(13);
  3497. var CustomNode_1 = __webpack_require__(21);
  3498. var CustomNodeGroup_1 = __webpack_require__(41);
  3499. var DeadCodeInjectionCustomNode_1 = __webpack_require__(40);
  3500. var ConsoleOutputCustomNodeGroup_1 = __webpack_require__(70);
  3501. var DebugProtectionCustomNodeGroup_1 = __webpack_require__(71);
  3502. var DomainLockCustomNodeGroup_1 = __webpack_require__(72);
  3503. var SelfDefendingCustomNodeGroup_1 = __webpack_require__(73);
  3504. var StringArrayCustomNodeGroup_1 = __webpack_require__(74);
  3505. var BinaryExpressionFunctionNode_1 = __webpack_require__(75);
  3506. var BlockStatementControlFlowFlatteningNode_1 = __webpack_require__(78);
  3507. var BlockStatementDeadCodeInjectionNode_1 = __webpack_require__(79);
  3508. var CallExpressionControlFlowStorageCallNode_1 = __webpack_require__(80);
  3509. var CallExpressionFunctionNode_1 = __webpack_require__(81);
  3510. var ControlFlowStorageNode_1 = __webpack_require__(82);
  3511. var ConsoleOutputDisableExpressionNode_1 = __webpack_require__(83);
  3512. var DebugProtectionFunctionCallNode_1 = __webpack_require__(85);
  3513. var DebugProtectionFunctionIntervalNode_1 = __webpack_require__(87);
  3514. var DebugProtectionFunctionNode_1 = __webpack_require__(89);
  3515. var DomainLockNode_1 = __webpack_require__(93);
  3516. var ExpressionWithOperatorControlFlowStorageCallNode_1 = __webpack_require__(95);
  3517. var LogicalExpressionFunctionNode_1 = __webpack_require__(96);
  3518. var NodeCallsControllerFunctionNode_1 = __webpack_require__(97);
  3519. var SelfDefendingUnicodeNode_1 = __webpack_require__(99);
  3520. var StringArrayCallsWrapper_1 = __webpack_require__(101);
  3521. var StringArrayNode_1 = __webpack_require__(108);
  3522. var StringArrayRotateFunctionNode_1 = __webpack_require__(110);
  3523. var StringLiteralControlFlowStorageCallNode_1 = __webpack_require__(114);
  3524. var StringLiteralNode_1 = __webpack_require__(115);
  3525. exports.customNodesModule = new inversify_1.ContainerModule(function (bind) {
  3526. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode).to(ConsoleOutputDisableExpressionNode_1.ConsoleOutputDisableExpressionNode).whenTargetNamed(CustomNode_1.CustomNode.ConsoleOutputDisableExpressionNode);
  3527. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode).to(DebugProtectionFunctionCallNode_1.DebugProtectionFunctionCallNode).whenTargetNamed(CustomNode_1.CustomNode.DebugProtectionFunctionCallNode);
  3528. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode).to(DebugProtectionFunctionIntervalNode_1.DebugProtectionFunctionIntervalNode).whenTargetNamed(CustomNode_1.CustomNode.DebugProtectionFunctionIntervalNode);
  3529. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode).to(DebugProtectionFunctionNode_1.DebugProtectionFunctionNode).whenTargetNamed(CustomNode_1.CustomNode.DebugProtectionFunctionNode);
  3530. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode).to(DomainLockNode_1.DomainLockNode).whenTargetNamed(CustomNode_1.CustomNode.DomainLockNode);
  3531. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode).to(NodeCallsControllerFunctionNode_1.NodeCallsControllerFunctionNode).whenTargetNamed(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode);
  3532. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode).to(SelfDefendingUnicodeNode_1.SelfDefendingUnicodeNode).whenTargetNamed(CustomNode_1.CustomNode.SelfDefendingUnicodeNode);
  3533. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode).to(StringArrayCallsWrapper_1.StringArrayCallsWrapper).whenTargetNamed(CustomNode_1.CustomNode.StringArrayCallsWrapper);
  3534. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode).to(StringArrayNode_1.StringArrayNode).whenTargetNamed(CustomNode_1.CustomNode.StringArrayNode);
  3535. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode).to(StringArrayRotateFunctionNode_1.StringArrayRotateFunctionNode).whenTargetNamed(CustomNode_1.CustomNode.StringArrayRotateFunctionNode);
  3536. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode).toConstructor(BinaryExpressionFunctionNode_1.BinaryExpressionFunctionNode).whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.BinaryExpressionFunctionNode);
  3537. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode).toConstructor(BlockStatementControlFlowFlatteningNode_1.BlockStatementControlFlowFlatteningNode).whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.BlockStatementControlFlowFlatteningNode);
  3538. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode).toConstructor(CallExpressionControlFlowStorageCallNode_1.CallExpressionControlFlowStorageCallNode).whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.CallExpressionControlFlowStorageCallNode);
  3539. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode).toConstructor(CallExpressionFunctionNode_1.CallExpressionFunctionNode).whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.CallExpressionFunctionNode);
  3540. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode).toConstructor(ControlFlowStorageNode_1.ControlFlowStorageNode).whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.ControlFlowStorageNode);
  3541. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode).toConstructor(ExpressionWithOperatorControlFlowStorageCallNode_1.ExpressionWithOperatorControlFlowStorageCallNode).whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.ExpressionWithOperatorControlFlowStorageCallNode);
  3542. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode).toConstructor(LogicalExpressionFunctionNode_1.LogicalExpressionFunctionNode).whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.LogicalExpressionFunctionNode);
  3543. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode).toConstructor(StringLiteralNode_1.StringLiteralNode).whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.StringLiteralNode);
  3544. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode).toConstructor(StringLiteralControlFlowStorageCallNode_1.StringLiteralControlFlowStorageCallNode).whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.StringLiteralControlFlowStorageCallNode);
  3545. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode).toConstructor(BlockStatementDeadCodeInjectionNode_1.BlockStatementDeadCodeInjectionNode).whenTargetNamed(DeadCodeInjectionCustomNode_1.DeadCodeInjectionCustomNode.BlockStatementDeadCodeInjectionNode);
  3546. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeGroup).to(ConsoleOutputCustomNodeGroup_1.ConsoleOutputCustomNodeGroup).whenTargetNamed(CustomNodeGroup_1.CustomNodeGroup.ConsoleOutputCustomNodeGroup);
  3547. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeGroup).to(DebugProtectionCustomNodeGroup_1.DebugProtectionCustomNodeGroup).whenTargetNamed(CustomNodeGroup_1.CustomNodeGroup.DebugProtectionCustomNodeGroup);
  3548. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeGroup).to(DomainLockCustomNodeGroup_1.DomainLockCustomNodeGroup).whenTargetNamed(CustomNodeGroup_1.CustomNodeGroup.DomainLockCustomNodeGroup);
  3549. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeGroup).to(SelfDefendingCustomNodeGroup_1.SelfDefendingCustomNodeGroup).whenTargetNamed(CustomNodeGroup_1.CustomNodeGroup.SelfDefendingCustomNodeGroup);
  3550. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeGroup).to(StringArrayCustomNodeGroup_1.StringArrayCustomNodeGroup).whenTargetNamed(CustomNodeGroup_1.CustomNodeGroup.StringArrayCustomNodeGroup);
  3551. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICustomNode).toFactory(InversifyContainerFacade_1.InversifyContainerFacade.getFactory(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode));
  3552. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowCustomNode).toFactory(InversifyContainerFacade_1.InversifyContainerFacade.getConstructorFactory(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode, ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator, ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator, ServiceIdentifiers_1.ServiceIdentifiers.IOptions));
  3553. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IDeadCodeInjectionCustomNode).toFactory(InversifyContainerFacade_1.InversifyContainerFacade.getConstructorFactory(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode, ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator, ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator, ServiceIdentifiers_1.ServiceIdentifiers.IOptions));
  3554. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICustomNodeGroup).toFactory(InversifyContainerFacade_1.InversifyContainerFacade.getFactory(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeGroup));
  3555. });
  3556. /***/ }),
  3557. /* 70 */
  3558. /***/ (function(module, exports, __webpack_require__) {
  3559. "use strict";
  3560. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  3561. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3562. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3563. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3564. Object.defineProperty(exports, "__esModule", { value: true });
  3565. var tslib_1 = __webpack_require__(2);
  3566. var inversify_1 = __webpack_require__(0);
  3567. var ServiceIdentifiers_1 = __webpack_require__(1);
  3568. var Initializable_1 = __webpack_require__(5);
  3569. var CustomNode_1 = __webpack_require__(21);
  3570. var ObfuscationEvent_1 = __webpack_require__(17);
  3571. var AbstractCustomNodeGroup_1 = __webpack_require__(23);
  3572. var NodeAppender_1 = __webpack_require__(16);
  3573. var ConsoleOutputCustomNodeGroup = function (_AbstractCustomNodeGr) {
  3574. _inherits(ConsoleOutputCustomNodeGroup, _AbstractCustomNodeGr);
  3575. function ConsoleOutputCustomNodeGroup(customNodeFactory, identifierNamesGeneratorFactory, randomGenerator, options) {
  3576. _classCallCheck(this, ConsoleOutputCustomNodeGroup);
  3577. var _this = _possibleConstructorReturn(this, (ConsoleOutputCustomNodeGroup.__proto__ || Object.getPrototypeOf(ConsoleOutputCustomNodeGroup)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  3578. _this.appendEvent = ObfuscationEvent_1.ObfuscationEvent.BeforeObfuscation;
  3579. _this.customNodeFactory = customNodeFactory;
  3580. return _this;
  3581. }
  3582. _createClass(ConsoleOutputCustomNodeGroup, [{
  3583. key: "appendCustomNodes",
  3584. value: function appendCustomNodes(blockScopeNode, stackTraceData) {
  3585. var randomStackTraceIndex = this.getRandomStackTraceIndex(stackTraceData.length);
  3586. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.ConsoleOutputDisableExpressionNode, function (customNode) {
  3587. NodeAppender_1.NodeAppender.appendNodeToOptimalBlockScope(stackTraceData, blockScopeNode, customNode.getNode(), randomStackTraceIndex);
  3588. });
  3589. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode, function (customNode) {
  3590. var targetBlockScope = void 0;
  3591. if (stackTraceData.length) {
  3592. targetBlockScope = NodeAppender_1.NodeAppender.getOptimalBlockScope(stackTraceData, randomStackTraceIndex, 1);
  3593. } else {
  3594. targetBlockScope = blockScopeNode;
  3595. }
  3596. NodeAppender_1.NodeAppender.prependNode(targetBlockScope, customNode.getNode());
  3597. });
  3598. }
  3599. }, {
  3600. key: "initialize",
  3601. value: function initialize() {
  3602. this.customNodes = new Map();
  3603. if (!this.options.disableConsoleOutput) {
  3604. return;
  3605. }
  3606. var callsControllerFunctionName = this.identifierNamesGenerator.generate(6);
  3607. var consoleOutputDisableExpressionNode = this.customNodeFactory(CustomNode_1.CustomNode.ConsoleOutputDisableExpressionNode);
  3608. var nodeCallsControllerFunctionNode = this.customNodeFactory(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode);
  3609. consoleOutputDisableExpressionNode.initialize(callsControllerFunctionName);
  3610. nodeCallsControllerFunctionNode.initialize(this.appendEvent, callsControllerFunctionName);
  3611. this.customNodes.set(CustomNode_1.CustomNode.ConsoleOutputDisableExpressionNode, consoleOutputDisableExpressionNode);
  3612. this.customNodes.set(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode, nodeCallsControllerFunctionNode);
  3613. }
  3614. }]);
  3615. return ConsoleOutputCustomNodeGroup;
  3616. }(AbstractCustomNodeGroup_1.AbstractCustomNodeGroup);
  3617. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Map)], ConsoleOutputCustomNodeGroup.prototype, "customNodes", void 0);
  3618. ConsoleOutputCustomNodeGroup = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICustomNode)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Function, Object, Object])], ConsoleOutputCustomNodeGroup);
  3619. exports.ConsoleOutputCustomNodeGroup = ConsoleOutputCustomNodeGroup;
  3620. /***/ }),
  3621. /* 71 */
  3622. /***/ (function(module, exports, __webpack_require__) {
  3623. "use strict";
  3624. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  3625. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3626. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3627. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3628. Object.defineProperty(exports, "__esModule", { value: true });
  3629. var tslib_1 = __webpack_require__(2);
  3630. var inversify_1 = __webpack_require__(0);
  3631. var ServiceIdentifiers_1 = __webpack_require__(1);
  3632. var Initializable_1 = __webpack_require__(5);
  3633. var CustomNode_1 = __webpack_require__(21);
  3634. var ObfuscationEvent_1 = __webpack_require__(17);
  3635. var AbstractCustomNodeGroup_1 = __webpack_require__(23);
  3636. var NodeAppender_1 = __webpack_require__(16);
  3637. var DebugProtectionCustomNodeGroup = function (_AbstractCustomNodeGr) {
  3638. _inherits(DebugProtectionCustomNodeGroup, _AbstractCustomNodeGr);
  3639. function DebugProtectionCustomNodeGroup(customNodeFactory, identifierNamesGeneratorFactory, randomGenerator, options) {
  3640. _classCallCheck(this, DebugProtectionCustomNodeGroup);
  3641. var _this = _possibleConstructorReturn(this, (DebugProtectionCustomNodeGroup.__proto__ || Object.getPrototypeOf(DebugProtectionCustomNodeGroup)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  3642. _this.appendEvent = ObfuscationEvent_1.ObfuscationEvent.BeforeObfuscation;
  3643. _this.customNodeFactory = customNodeFactory;
  3644. return _this;
  3645. }
  3646. _createClass(DebugProtectionCustomNodeGroup, [{
  3647. key: "appendCustomNodes",
  3648. value: function appendCustomNodes(blockScopeNode, stackTraceData) {
  3649. var _this2 = this;
  3650. var randomStackTraceIndex = this.getRandomStackTraceIndex(stackTraceData.length);
  3651. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.DebugProtectionFunctionCallNode, function (customNode) {
  3652. NodeAppender_1.NodeAppender.appendNodeToOptimalBlockScope(stackTraceData, blockScopeNode, customNode.getNode(), randomStackTraceIndex);
  3653. });
  3654. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.DebugProtectionFunctionNode, function (customNode) {
  3655. NodeAppender_1.NodeAppender.appendNode(blockScopeNode, customNode.getNode());
  3656. });
  3657. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.DebugProtectionFunctionIntervalNode, function (customNode) {
  3658. var programBodyLength = blockScopeNode.body.length;
  3659. var randomIndex = _this2.randomGenerator.getRandomInteger(0, programBodyLength);
  3660. NodeAppender_1.NodeAppender.insertNodeAtIndex(blockScopeNode, customNode.getNode(), randomIndex);
  3661. });
  3662. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode, function (customNode) {
  3663. var targetBlockScope = void 0;
  3664. if (stackTraceData.length) {
  3665. targetBlockScope = NodeAppender_1.NodeAppender.getOptimalBlockScope(stackTraceData, randomStackTraceIndex, 1);
  3666. } else {
  3667. targetBlockScope = blockScopeNode;
  3668. }
  3669. NodeAppender_1.NodeAppender.prependNode(targetBlockScope, customNode.getNode());
  3670. });
  3671. }
  3672. }, {
  3673. key: "initialize",
  3674. value: function initialize() {
  3675. this.customNodes = new Map();
  3676. if (!this.options.debugProtection) {
  3677. return;
  3678. }
  3679. var debugProtectionFunctionName = this.identifierNamesGenerator.generate(6);
  3680. var callsControllerFunctionName = this.identifierNamesGenerator.generate(6);
  3681. var debugProtectionFunctionNode = this.customNodeFactory(CustomNode_1.CustomNode.DebugProtectionFunctionNode);
  3682. var debugProtectionFunctionCallNode = this.customNodeFactory(CustomNode_1.CustomNode.DebugProtectionFunctionCallNode);
  3683. var debugProtectionFunctionIntervalNode = this.customNodeFactory(CustomNode_1.CustomNode.DebugProtectionFunctionIntervalNode);
  3684. var nodeCallsControllerFunctionNode = this.customNodeFactory(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode);
  3685. debugProtectionFunctionNode.initialize(debugProtectionFunctionName);
  3686. debugProtectionFunctionCallNode.initialize(debugProtectionFunctionName, callsControllerFunctionName);
  3687. debugProtectionFunctionIntervalNode.initialize(debugProtectionFunctionName);
  3688. nodeCallsControllerFunctionNode.initialize(this.appendEvent, callsControllerFunctionName);
  3689. this.customNodes.set(CustomNode_1.CustomNode.DebugProtectionFunctionNode, debugProtectionFunctionNode);
  3690. this.customNodes.set(CustomNode_1.CustomNode.DebugProtectionFunctionCallNode, debugProtectionFunctionCallNode);
  3691. if (this.options.debugProtectionInterval) {
  3692. this.customNodes.set(CustomNode_1.CustomNode.DebugProtectionFunctionIntervalNode, debugProtectionFunctionIntervalNode);
  3693. }
  3694. this.customNodes.set(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode, nodeCallsControllerFunctionNode);
  3695. }
  3696. }]);
  3697. return DebugProtectionCustomNodeGroup;
  3698. }(AbstractCustomNodeGroup_1.AbstractCustomNodeGroup);
  3699. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Map)], DebugProtectionCustomNodeGroup.prototype, "customNodes", void 0);
  3700. DebugProtectionCustomNodeGroup = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICustomNode)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Function, Object, Object])], DebugProtectionCustomNodeGroup);
  3701. exports.DebugProtectionCustomNodeGroup = DebugProtectionCustomNodeGroup;
  3702. /***/ }),
  3703. /* 72 */
  3704. /***/ (function(module, exports, __webpack_require__) {
  3705. "use strict";
  3706. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  3707. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3708. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3709. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3710. Object.defineProperty(exports, "__esModule", { value: true });
  3711. var tslib_1 = __webpack_require__(2);
  3712. var inversify_1 = __webpack_require__(0);
  3713. var ServiceIdentifiers_1 = __webpack_require__(1);
  3714. var Initializable_1 = __webpack_require__(5);
  3715. var CustomNode_1 = __webpack_require__(21);
  3716. var ObfuscationEvent_1 = __webpack_require__(17);
  3717. var AbstractCustomNodeGroup_1 = __webpack_require__(23);
  3718. var NodeAppender_1 = __webpack_require__(16);
  3719. var DomainLockCustomNodeGroup = function (_AbstractCustomNodeGr) {
  3720. _inherits(DomainLockCustomNodeGroup, _AbstractCustomNodeGr);
  3721. function DomainLockCustomNodeGroup(customNodeFactory, identifierNamesGeneratorFactory, randomGenerator, options) {
  3722. _classCallCheck(this, DomainLockCustomNodeGroup);
  3723. var _this = _possibleConstructorReturn(this, (DomainLockCustomNodeGroup.__proto__ || Object.getPrototypeOf(DomainLockCustomNodeGroup)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  3724. _this.appendEvent = ObfuscationEvent_1.ObfuscationEvent.BeforeObfuscation;
  3725. _this.customNodeFactory = customNodeFactory;
  3726. return _this;
  3727. }
  3728. _createClass(DomainLockCustomNodeGroup, [{
  3729. key: "appendCustomNodes",
  3730. value: function appendCustomNodes(blockScopeNode, stackTraceData) {
  3731. var randomStackTraceIndex = this.getRandomStackTraceIndex(stackTraceData.length);
  3732. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.DomainLockNode, function (customNode) {
  3733. NodeAppender_1.NodeAppender.appendNodeToOptimalBlockScope(stackTraceData, blockScopeNode, customNode.getNode(), randomStackTraceIndex);
  3734. });
  3735. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode, function (customNode) {
  3736. var targetBlockScope = void 0;
  3737. if (stackTraceData.length) {
  3738. targetBlockScope = NodeAppender_1.NodeAppender.getOptimalBlockScope(stackTraceData, randomStackTraceIndex, 1);
  3739. } else {
  3740. targetBlockScope = blockScopeNode;
  3741. }
  3742. NodeAppender_1.NodeAppender.prependNode(targetBlockScope, customNode.getNode());
  3743. });
  3744. }
  3745. }, {
  3746. key: "initialize",
  3747. value: function initialize() {
  3748. this.customNodes = new Map();
  3749. if (!this.options.domainLock.length) {
  3750. return;
  3751. }
  3752. var callsControllerFunctionName = this.identifierNamesGenerator.generate(6);
  3753. var domainLockNode = this.customNodeFactory(CustomNode_1.CustomNode.DomainLockNode);
  3754. var nodeCallsControllerFunctionNode = this.customNodeFactory(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode);
  3755. domainLockNode.initialize(callsControllerFunctionName);
  3756. nodeCallsControllerFunctionNode.initialize(this.appendEvent, callsControllerFunctionName);
  3757. this.customNodes.set(CustomNode_1.CustomNode.DomainLockNode, domainLockNode);
  3758. this.customNodes.set(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode, nodeCallsControllerFunctionNode);
  3759. }
  3760. }]);
  3761. return DomainLockCustomNodeGroup;
  3762. }(AbstractCustomNodeGroup_1.AbstractCustomNodeGroup);
  3763. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Map)], DomainLockCustomNodeGroup.prototype, "customNodes", void 0);
  3764. DomainLockCustomNodeGroup = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICustomNode)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Function, Object, Object])], DomainLockCustomNodeGroup);
  3765. exports.DomainLockCustomNodeGroup = DomainLockCustomNodeGroup;
  3766. /***/ }),
  3767. /* 73 */
  3768. /***/ (function(module, exports, __webpack_require__) {
  3769. "use strict";
  3770. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  3771. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3772. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3773. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3774. Object.defineProperty(exports, "__esModule", { value: true });
  3775. var tslib_1 = __webpack_require__(2);
  3776. var inversify_1 = __webpack_require__(0);
  3777. var ServiceIdentifiers_1 = __webpack_require__(1);
  3778. var Initializable_1 = __webpack_require__(5);
  3779. var CustomNode_1 = __webpack_require__(21);
  3780. var ObfuscationEvent_1 = __webpack_require__(17);
  3781. var AbstractCustomNodeGroup_1 = __webpack_require__(23);
  3782. var NodeAppender_1 = __webpack_require__(16);
  3783. var SelfDefendingCustomNodeGroup = function (_AbstractCustomNodeGr) {
  3784. _inherits(SelfDefendingCustomNodeGroup, _AbstractCustomNodeGr);
  3785. function SelfDefendingCustomNodeGroup(customNodeFactory, identifierNamesGeneratorFactory, randomGenerator, options) {
  3786. _classCallCheck(this, SelfDefendingCustomNodeGroup);
  3787. var _this = _possibleConstructorReturn(this, (SelfDefendingCustomNodeGroup.__proto__ || Object.getPrototypeOf(SelfDefendingCustomNodeGroup)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  3788. _this.appendEvent = ObfuscationEvent_1.ObfuscationEvent.AfterObfuscation;
  3789. _this.customNodeFactory = customNodeFactory;
  3790. return _this;
  3791. }
  3792. _createClass(SelfDefendingCustomNodeGroup, [{
  3793. key: "appendCustomNodes",
  3794. value: function appendCustomNodes(blockScopeNode, stackTraceData) {
  3795. var randomStackTraceIndex = this.getRandomStackTraceIndex(stackTraceData.length);
  3796. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.SelfDefendingUnicodeNode, function (customNode) {
  3797. NodeAppender_1.NodeAppender.appendNodeToOptimalBlockScope(stackTraceData, blockScopeNode, customNode.getNode(), randomStackTraceIndex);
  3798. });
  3799. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode, function (customNode) {
  3800. var targetBlockScope = void 0;
  3801. if (stackTraceData.length) {
  3802. targetBlockScope = NodeAppender_1.NodeAppender.getOptimalBlockScope(stackTraceData, randomStackTraceIndex, 1);
  3803. } else {
  3804. targetBlockScope = blockScopeNode;
  3805. }
  3806. NodeAppender_1.NodeAppender.prependNode(targetBlockScope, customNode.getNode());
  3807. });
  3808. }
  3809. }, {
  3810. key: "initialize",
  3811. value: function initialize() {
  3812. this.customNodes = new Map();
  3813. if (!this.options.selfDefending) {
  3814. return;
  3815. }
  3816. var callsControllerFunctionName = this.identifierNamesGenerator.generate(6);
  3817. var selfDefendingUnicodeNode = this.customNodeFactory(CustomNode_1.CustomNode.SelfDefendingUnicodeNode);
  3818. var nodeCallsControllerFunctionNode = this.customNodeFactory(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode);
  3819. selfDefendingUnicodeNode.initialize(callsControllerFunctionName);
  3820. nodeCallsControllerFunctionNode.initialize(this.appendEvent, callsControllerFunctionName);
  3821. this.customNodes.set(CustomNode_1.CustomNode.SelfDefendingUnicodeNode, selfDefendingUnicodeNode);
  3822. this.customNodes.set(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode, nodeCallsControllerFunctionNode);
  3823. }
  3824. }]);
  3825. return SelfDefendingCustomNodeGroup;
  3826. }(AbstractCustomNodeGroup_1.AbstractCustomNodeGroup);
  3827. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Map)], SelfDefendingCustomNodeGroup.prototype, "customNodes", void 0);
  3828. SelfDefendingCustomNodeGroup = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICustomNode)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Function, Object, Object])], SelfDefendingCustomNodeGroup);
  3829. exports.SelfDefendingCustomNodeGroup = SelfDefendingCustomNodeGroup;
  3830. /***/ }),
  3831. /* 74 */
  3832. /***/ (function(module, exports, __webpack_require__) {
  3833. "use strict";
  3834. var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; })();
  3835. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  3836. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3837. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3838. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3839. Object.defineProperty(exports, "__esModule", { value: true });
  3840. var tslib_1 = __webpack_require__(2);
  3841. var inversify_1 = __webpack_require__(0);
  3842. var ServiceIdentifiers_1 = __webpack_require__(1);
  3843. var Initializable_1 = __webpack_require__(5);
  3844. var CustomNode_1 = __webpack_require__(21);
  3845. var ObfuscationEvent_1 = __webpack_require__(17);
  3846. var AbstractCustomNodeGroup_1 = __webpack_require__(23);
  3847. var NodeAppender_1 = __webpack_require__(16);
  3848. var StringArrayCustomNodeGroup = function (_AbstractCustomNodeGr) {
  3849. _inherits(StringArrayCustomNodeGroup, _AbstractCustomNodeGr);
  3850. function StringArrayCustomNodeGroup(customNodeFactory, stringArrayStorage, identifierNamesGeneratorFactory, randomGenerator, options) {
  3851. _classCallCheck(this, StringArrayCustomNodeGroup);
  3852. var _this = _possibleConstructorReturn(this, (StringArrayCustomNodeGroup.__proto__ || Object.getPrototypeOf(StringArrayCustomNodeGroup)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  3853. _this.appendEvent = ObfuscationEvent_1.ObfuscationEvent.AfterObfuscation;
  3854. _this.customNodeFactory = customNodeFactory;
  3855. _this.stringArrayStorage = stringArrayStorage;
  3856. return _this;
  3857. }
  3858. _createClass(StringArrayCustomNodeGroup, [{
  3859. key: "appendCustomNodes",
  3860. value: function appendCustomNodes(blockScopeNode, stackTraceData) {
  3861. if (!this.stringArrayStorage.getLength()) {
  3862. return;
  3863. }
  3864. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.StringArrayNode, function (customNode) {
  3865. NodeAppender_1.NodeAppender.prependNode(blockScopeNode, customNode.getNode());
  3866. });
  3867. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.StringArrayCallsWrapper, function (customNode) {
  3868. NodeAppender_1.NodeAppender.insertNodeAtIndex(blockScopeNode, customNode.getNode(), 1);
  3869. });
  3870. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.StringArrayRotateFunctionNode, function (customNode) {
  3871. NodeAppender_1.NodeAppender.insertNodeAtIndex(blockScopeNode, customNode.getNode(), 1);
  3872. });
  3873. }
  3874. }, {
  3875. key: "initialize",
  3876. value: function initialize() {
  3877. this.customNodes = new Map();
  3878. if (!this.options.stringArray) {
  3879. return;
  3880. }
  3881. var stringArrayNode = this.customNodeFactory(CustomNode_1.CustomNode.StringArrayNode);
  3882. var stringArrayCallsWrapper = this.customNodeFactory(CustomNode_1.CustomNode.StringArrayCallsWrapper);
  3883. var stringArrayRotateFunctionNode = this.customNodeFactory(CustomNode_1.CustomNode.StringArrayRotateFunctionNode);
  3884. var stringArrayStorageId = this.stringArrayStorage.getStorageId();
  3885. var _stringArrayStorageId = stringArrayStorageId.split('|'),
  3886. _stringArrayStorageId2 = _slicedToArray(_stringArrayStorageId, 2),
  3887. stringArrayName = _stringArrayStorageId2[0],
  3888. stringArrayCallsWrapperName = _stringArrayStorageId2[1];
  3889. var stringArrayRotateValue = void 0;
  3890. if (this.options.rotateStringArray) {
  3891. stringArrayRotateValue = this.randomGenerator.getRandomInteger(100, 500);
  3892. } else {
  3893. stringArrayRotateValue = 0;
  3894. }
  3895. stringArrayNode.initialize(this.stringArrayStorage, stringArrayName, stringArrayRotateValue);
  3896. stringArrayCallsWrapper.initialize(stringArrayName, stringArrayCallsWrapperName);
  3897. stringArrayRotateFunctionNode.initialize(stringArrayName, stringArrayRotateValue);
  3898. this.customNodes.set(CustomNode_1.CustomNode.StringArrayNode, stringArrayNode);
  3899. this.customNodes.set(CustomNode_1.CustomNode.StringArrayCallsWrapper, stringArrayCallsWrapper);
  3900. if (this.options.rotateStringArray) {
  3901. this.customNodes.set(CustomNode_1.CustomNode.StringArrayRotateFunctionNode, stringArrayRotateFunctionNode);
  3902. }
  3903. }
  3904. }]);
  3905. return StringArrayCustomNodeGroup;
  3906. }(AbstractCustomNodeGroup_1.AbstractCustomNodeGroup);
  3907. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Map)], StringArrayCustomNodeGroup.prototype, "customNodes", void 0);
  3908. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], StringArrayCustomNodeGroup.prototype, "stringArrayStorage", void 0);
  3909. StringArrayCustomNodeGroup = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICustomNode)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.TStringArrayStorage)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)), tslib_1.__param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(4, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Function, Object, Object])], StringArrayCustomNodeGroup);
  3910. exports.StringArrayCustomNodeGroup = StringArrayCustomNodeGroup;
  3911. /***/ }),
  3912. /* 75 */
  3913. /***/ (function(module, exports, __webpack_require__) {
  3914. "use strict";
  3915. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  3916. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3917. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3918. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3919. Object.defineProperty(exports, "__esModule", { value: true });
  3920. var tslib_1 = __webpack_require__(2);
  3921. var inversify_1 = __webpack_require__(0);
  3922. var ServiceIdentifiers_1 = __webpack_require__(1);
  3923. var Initializable_1 = __webpack_require__(5);
  3924. var AbstractCustomNode_1 = __webpack_require__(7);
  3925. var Nodes_1 = __webpack_require__(9);
  3926. var NodeUtils_1 = __webpack_require__(3);
  3927. var BinaryExpressionFunctionNode = function (_AbstractCustomNode_) {
  3928. _inherits(BinaryExpressionFunctionNode, _AbstractCustomNode_);
  3929. function BinaryExpressionFunctionNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  3930. _classCallCheck(this, BinaryExpressionFunctionNode);
  3931. return _possibleConstructorReturn(this, (BinaryExpressionFunctionNode.__proto__ || Object.getPrototypeOf(BinaryExpressionFunctionNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  3932. }
  3933. _createClass(BinaryExpressionFunctionNode, [{
  3934. key: "initialize",
  3935. value: function initialize(operator) {
  3936. this.operator = operator;
  3937. }
  3938. }, {
  3939. key: "getNodeStructure",
  3940. value: function getNodeStructure() {
  3941. var structure = Nodes_1.Nodes.getFunctionDeclarationNode(this.randomGenerator.getRandomString(3), [Nodes_1.Nodes.getIdentifierNode('x'), Nodes_1.Nodes.getIdentifierNode('y')], Nodes_1.Nodes.getBlockStatementNode([Nodes_1.Nodes.getReturnStatementNode(Nodes_1.Nodes.getBinaryExpressionNode(this.operator, Nodes_1.Nodes.getIdentifierNode('x'), Nodes_1.Nodes.getIdentifierNode('y')))]));
  3942. NodeUtils_1.NodeUtils.parentize(structure);
  3943. return [structure];
  3944. }
  3945. }]);
  3946. return BinaryExpressionFunctionNode;
  3947. }(AbstractCustomNode_1.AbstractCustomNode);
  3948. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], BinaryExpressionFunctionNode.prototype, "operator", void 0);
  3949. BinaryExpressionFunctionNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], BinaryExpressionFunctionNode);
  3950. exports.BinaryExpressionFunctionNode = BinaryExpressionFunctionNode;
  3951. /***/ }),
  3952. /* 76 */
  3953. /***/ (function(module, exports, __webpack_require__) {
  3954. "use strict";
  3955. Object.defineProperty(exports, "__esModule", { value: true });
  3956. function GlobalVariableTemplate1() {
  3957. return "\n var that;\n \n try {\n var getGlobal = Function('return (function() ' + '{}.constructor(\"return this\")( )' + ');');\n \n that = getGlobal();\n } catch (e) {\n that = window;\n }\n ";
  3958. }
  3959. exports.GlobalVariableTemplate1 = GlobalVariableTemplate1;
  3960. /***/ }),
  3961. /* 77 */
  3962. /***/ (function(module, exports, __webpack_require__) {
  3963. "use strict";
  3964. Object.defineProperty(exports, "__esModule", { value: true });
  3965. function GlobalVariableTemplate2() {
  3966. return "\n var getGlobal = function () {\n var globalObject;\n \n try {\n globalObject = Function('return (function() ' + '{}.constructor(\"return this\")( )' + ');')();\n } catch (e) {\n globalObject = window;\n }\n \n return globalObject;\n };\n var that = getGlobal();\n ";
  3967. }
  3968. exports.GlobalVariableTemplate2 = GlobalVariableTemplate2;
  3969. /***/ }),
  3970. /* 78 */
  3971. /***/ (function(module, exports, __webpack_require__) {
  3972. "use strict";
  3973. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  3974. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3975. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3976. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3977. Object.defineProperty(exports, "__esModule", { value: true });
  3978. var tslib_1 = __webpack_require__(2);
  3979. var inversify_1 = __webpack_require__(0);
  3980. var ServiceIdentifiers_1 = __webpack_require__(1);
  3981. var Initializable_1 = __webpack_require__(5);
  3982. var AbstractCustomNode_1 = __webpack_require__(7);
  3983. var NodeGuards_1 = __webpack_require__(4);
  3984. var Nodes_1 = __webpack_require__(9);
  3985. var NodeUtils_1 = __webpack_require__(3);
  3986. var BlockStatementControlFlowFlatteningNode = function (_AbstractCustomNode_) {
  3987. _inherits(BlockStatementControlFlowFlatteningNode, _AbstractCustomNode_);
  3988. function BlockStatementControlFlowFlatteningNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  3989. _classCallCheck(this, BlockStatementControlFlowFlatteningNode);
  3990. return _possibleConstructorReturn(this, (BlockStatementControlFlowFlatteningNode.__proto__ || Object.getPrototypeOf(BlockStatementControlFlowFlatteningNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  3991. }
  3992. _createClass(BlockStatementControlFlowFlatteningNode, [{
  3993. key: "initialize",
  3994. value: function initialize(blockStatementBody, shuffledKeys, originalKeysIndexesInShuffledArray) {
  3995. this.blockStatementBody = blockStatementBody;
  3996. this.shuffledKeys = shuffledKeys;
  3997. this.originalKeysIndexesInShuffledArray = originalKeysIndexesInShuffledArray;
  3998. }
  3999. }, {
  4000. key: "getNodeStructure",
  4001. value: function getNodeStructure() {
  4002. var _this2 = this;
  4003. var controllerIdentifierName = this.randomGenerator.getRandomString(6);
  4004. var indexIdentifierName = this.randomGenerator.getRandomString(6);
  4005. var structure = Nodes_1.Nodes.getBlockStatementNode([Nodes_1.Nodes.getVariableDeclarationNode([Nodes_1.Nodes.getVariableDeclaratorNode(Nodes_1.Nodes.getIdentifierNode(controllerIdentifierName), Nodes_1.Nodes.getCallExpressionNode(Nodes_1.Nodes.getMemberExpressionNode(Nodes_1.Nodes.getLiteralNode(this.originalKeysIndexesInShuffledArray.join('|')), Nodes_1.Nodes.getIdentifierNode('split')), [Nodes_1.Nodes.getLiteralNode('|')])), Nodes_1.Nodes.getVariableDeclaratorNode(Nodes_1.Nodes.getIdentifierNode(indexIdentifierName), Nodes_1.Nodes.getLiteralNode(0))]), Nodes_1.Nodes.getWhileStatementNode(Nodes_1.Nodes.getLiteralNode(true), Nodes_1.Nodes.getBlockStatementNode([Nodes_1.Nodes.getSwitchStatementNode(Nodes_1.Nodes.getMemberExpressionNode(Nodes_1.Nodes.getIdentifierNode(controllerIdentifierName), Nodes_1.Nodes.getUpdateExpressionNode('++', Nodes_1.Nodes.getIdentifierNode(indexIdentifierName)), true), this.shuffledKeys.map(function (key, index) {
  4006. var statement = _this2.blockStatementBody[key];
  4007. var consequent = [statement];
  4008. if (!NodeGuards_1.NodeGuards.isReturnStatementNode(statement)) {
  4009. consequent.push(Nodes_1.Nodes.getContinueStatement());
  4010. }
  4011. return Nodes_1.Nodes.getSwitchCaseNode(Nodes_1.Nodes.getLiteralNode(String(index)), consequent);
  4012. })), Nodes_1.Nodes.getBreakStatement()]))]);
  4013. NodeUtils_1.NodeUtils.parentize(structure);
  4014. return [structure];
  4015. }
  4016. }]);
  4017. return BlockStatementControlFlowFlatteningNode;
  4018. }(AbstractCustomNode_1.AbstractCustomNode);
  4019. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Array)], BlockStatementControlFlowFlatteningNode.prototype, "blockStatementBody", void 0);
  4020. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Array)], BlockStatementControlFlowFlatteningNode.prototype, "originalKeysIndexesInShuffledArray", void 0);
  4021. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Array)], BlockStatementControlFlowFlatteningNode.prototype, "shuffledKeys", void 0);
  4022. BlockStatementControlFlowFlatteningNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], BlockStatementControlFlowFlatteningNode);
  4023. exports.BlockStatementControlFlowFlatteningNode = BlockStatementControlFlowFlatteningNode;
  4024. /***/ }),
  4025. /* 79 */
  4026. /***/ (function(module, exports, __webpack_require__) {
  4027. "use strict";
  4028. var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; })();
  4029. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  4030. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4031. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4032. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4033. Object.defineProperty(exports, "__esModule", { value: true });
  4034. var tslib_1 = __webpack_require__(2);
  4035. var inversify_1 = __webpack_require__(0);
  4036. var ServiceIdentifiers_1 = __webpack_require__(1);
  4037. var Initializable_1 = __webpack_require__(5);
  4038. var AbstractCustomNode_1 = __webpack_require__(7);
  4039. var Nodes_1 = __webpack_require__(9);
  4040. var NodeUtils_1 = __webpack_require__(3);
  4041. var BlockStatementDeadCodeInjectionNode = function (_AbstractCustomNode_) {
  4042. _inherits(BlockStatementDeadCodeInjectionNode, _AbstractCustomNode_);
  4043. function BlockStatementDeadCodeInjectionNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  4044. _classCallCheck(this, BlockStatementDeadCodeInjectionNode);
  4045. return _possibleConstructorReturn(this, (BlockStatementDeadCodeInjectionNode.__proto__ || Object.getPrototypeOf(BlockStatementDeadCodeInjectionNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  4046. }
  4047. _createClass(BlockStatementDeadCodeInjectionNode, [{
  4048. key: "initialize",
  4049. value: function initialize(blockStatementNode, deadCodeInjectionRootAstHostNode) {
  4050. this.blockStatementNode = blockStatementNode;
  4051. this.deadCodeInjectionRootAstHostNode = deadCodeInjectionRootAstHostNode;
  4052. }
  4053. }, {
  4054. key: "getNodeStructure",
  4055. value: function getNodeStructure() {
  4056. var random1 = this.randomGenerator.getMathRandom() > 0.5;
  4057. var random2 = this.randomGenerator.getMathRandom() > 0.5;
  4058. var operator = random1 ? '===' : '!==';
  4059. var leftString = this.randomGenerator.getRandomString(5);
  4060. var rightString = random2 ? leftString : this.randomGenerator.getRandomString(5);
  4061. var _ref = random1 === random2 ? [this.blockStatementNode, this.deadCodeInjectionRootAstHostNode] : [this.deadCodeInjectionRootAstHostNode, this.blockStatementNode],
  4062. _ref2 = _slicedToArray(_ref, 2),
  4063. consequent = _ref2[0],
  4064. alternate = _ref2[1];
  4065. var structure = Nodes_1.Nodes.getBlockStatementNode([Nodes_1.Nodes.getIfStatementNode(Nodes_1.Nodes.getBinaryExpressionNode(operator, Nodes_1.Nodes.getLiteralNode(leftString), Nodes_1.Nodes.getLiteralNode(rightString)), consequent, alternate)]);
  4066. NodeUtils_1.NodeUtils.parentize(structure);
  4067. return [structure];
  4068. }
  4069. }]);
  4070. return BlockStatementDeadCodeInjectionNode;
  4071. }(AbstractCustomNode_1.AbstractCustomNode);
  4072. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], BlockStatementDeadCodeInjectionNode.prototype, "blockStatementNode", void 0);
  4073. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], BlockStatementDeadCodeInjectionNode.prototype, "deadCodeInjectionRootAstHostNode", void 0);
  4074. BlockStatementDeadCodeInjectionNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], BlockStatementDeadCodeInjectionNode);
  4075. exports.BlockStatementDeadCodeInjectionNode = BlockStatementDeadCodeInjectionNode;
  4076. /***/ }),
  4077. /* 80 */
  4078. /***/ (function(module, exports, __webpack_require__) {
  4079. "use strict";
  4080. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  4081. function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
  4082. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4083. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4084. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4085. Object.defineProperty(exports, "__esModule", { value: true });
  4086. var tslib_1 = __webpack_require__(2);
  4087. var inversify_1 = __webpack_require__(0);
  4088. var ServiceIdentifiers_1 = __webpack_require__(1);
  4089. var Initializable_1 = __webpack_require__(5);
  4090. var AbstractCustomNode_1 = __webpack_require__(7);
  4091. var Nodes_1 = __webpack_require__(9);
  4092. var NodeUtils_1 = __webpack_require__(3);
  4093. var CallExpressionControlFlowStorageCallNode = function (_AbstractCustomNode_) {
  4094. _inherits(CallExpressionControlFlowStorageCallNode, _AbstractCustomNode_);
  4095. function CallExpressionControlFlowStorageCallNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  4096. _classCallCheck(this, CallExpressionControlFlowStorageCallNode);
  4097. return _possibleConstructorReturn(this, (CallExpressionControlFlowStorageCallNode.__proto__ || Object.getPrototypeOf(CallExpressionControlFlowStorageCallNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  4098. }
  4099. _createClass(CallExpressionControlFlowStorageCallNode, [{
  4100. key: "initialize",
  4101. value: function initialize(controlFlowStorageName, controlFlowStorageKey, callee, expressionArguments) {
  4102. this.controlFlowStorageName = controlFlowStorageName;
  4103. this.controlFlowStorageKey = controlFlowStorageKey;
  4104. this.callee = callee;
  4105. this.expressionArguments = expressionArguments;
  4106. }
  4107. }, {
  4108. key: "getNodeStructure",
  4109. value: function getNodeStructure() {
  4110. var structure = Nodes_1.Nodes.getExpressionStatementNode(Nodes_1.Nodes.getCallExpressionNode(Nodes_1.Nodes.getMemberExpressionNode(Nodes_1.Nodes.getIdentifierNode(this.controlFlowStorageName), Nodes_1.Nodes.getIdentifierNode(this.controlFlowStorageKey)), [this.callee].concat(_toConsumableArray(this.expressionArguments))));
  4111. NodeUtils_1.NodeUtils.parentize(structure);
  4112. return [structure];
  4113. }
  4114. }]);
  4115. return CallExpressionControlFlowStorageCallNode;
  4116. }(AbstractCustomNode_1.AbstractCustomNode);
  4117. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], CallExpressionControlFlowStorageCallNode.prototype, "callee", void 0);
  4118. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], CallExpressionControlFlowStorageCallNode.prototype, "controlFlowStorageKey", void 0);
  4119. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], CallExpressionControlFlowStorageCallNode.prototype, "controlFlowStorageName", void 0);
  4120. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Array)], CallExpressionControlFlowStorageCallNode.prototype, "expressionArguments", void 0);
  4121. CallExpressionControlFlowStorageCallNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], CallExpressionControlFlowStorageCallNode);
  4122. exports.CallExpressionControlFlowStorageCallNode = CallExpressionControlFlowStorageCallNode;
  4123. /***/ }),
  4124. /* 81 */
  4125. /***/ (function(module, exports, __webpack_require__) {
  4126. "use strict";
  4127. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  4128. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4129. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4130. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4131. Object.defineProperty(exports, "__esModule", { value: true });
  4132. var tslib_1 = __webpack_require__(2);
  4133. var inversify_1 = __webpack_require__(0);
  4134. var ServiceIdentifiers_1 = __webpack_require__(1);
  4135. var Initializable_1 = __webpack_require__(5);
  4136. var AbstractCustomNode_1 = __webpack_require__(7);
  4137. var Nodes_1 = __webpack_require__(9);
  4138. var NodeUtils_1 = __webpack_require__(3);
  4139. var CallExpressionFunctionNode = function (_AbstractCustomNode_) {
  4140. _inherits(CallExpressionFunctionNode, _AbstractCustomNode_);
  4141. function CallExpressionFunctionNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  4142. _classCallCheck(this, CallExpressionFunctionNode);
  4143. return _possibleConstructorReturn(this, (CallExpressionFunctionNode.__proto__ || Object.getPrototypeOf(CallExpressionFunctionNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  4144. }
  4145. _createClass(CallExpressionFunctionNode, [{
  4146. key: "initialize",
  4147. value: function initialize(expressionArguments) {
  4148. this.expressionArguments = expressionArguments;
  4149. }
  4150. }, {
  4151. key: "getNodeStructure",
  4152. value: function getNodeStructure() {
  4153. var calleeIdentifier = Nodes_1.Nodes.getIdentifierNode('callee');
  4154. var params = [];
  4155. var argumentsLength = this.expressionArguments.length;
  4156. for (var i = 0; i < argumentsLength; i++) {
  4157. params.push(Nodes_1.Nodes.getIdentifierNode("param" + (i + 1)));
  4158. }
  4159. var structure = Nodes_1.Nodes.getFunctionDeclarationNode(this.randomGenerator.getRandomString(3), [calleeIdentifier].concat(params), Nodes_1.Nodes.getBlockStatementNode([Nodes_1.Nodes.getReturnStatementNode(Nodes_1.Nodes.getCallExpressionNode(calleeIdentifier, params))]));
  4160. NodeUtils_1.NodeUtils.parentize(structure);
  4161. return [structure];
  4162. }
  4163. }]);
  4164. return CallExpressionFunctionNode;
  4165. }(AbstractCustomNode_1.AbstractCustomNode);
  4166. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Array)], CallExpressionFunctionNode.prototype, "expressionArguments", void 0);
  4167. CallExpressionFunctionNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], CallExpressionFunctionNode);
  4168. exports.CallExpressionFunctionNode = CallExpressionFunctionNode;
  4169. /***/ }),
  4170. /* 82 */
  4171. /***/ (function(module, exports, __webpack_require__) {
  4172. "use strict";
  4173. var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; })();
  4174. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  4175. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4176. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4177. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4178. Object.defineProperty(exports, "__esModule", { value: true });
  4179. var tslib_1 = __webpack_require__(2);
  4180. var inversify_1 = __webpack_require__(0);
  4181. var ServiceIdentifiers_1 = __webpack_require__(1);
  4182. var Initializable_1 = __webpack_require__(5);
  4183. var AbstractCustomNode_1 = __webpack_require__(7);
  4184. var Nodes_1 = __webpack_require__(9);
  4185. var NodeUtils_1 = __webpack_require__(3);
  4186. var ControlFlowStorageNode = function (_AbstractCustomNode_) {
  4187. _inherits(ControlFlowStorageNode, _AbstractCustomNode_);
  4188. function ControlFlowStorageNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  4189. _classCallCheck(this, ControlFlowStorageNode);
  4190. return _possibleConstructorReturn(this, (ControlFlowStorageNode.__proto__ || Object.getPrototypeOf(ControlFlowStorageNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  4191. }
  4192. _createClass(ControlFlowStorageNode, [{
  4193. key: "initialize",
  4194. value: function initialize(controlFlowStorage) {
  4195. this.controlFlowStorage = controlFlowStorage;
  4196. }
  4197. }, {
  4198. key: "getNodeStructure",
  4199. value: function getNodeStructure() {
  4200. var structure = Nodes_1.Nodes.getVariableDeclarationNode([Nodes_1.Nodes.getVariableDeclaratorNode(Nodes_1.Nodes.getIdentifierNode(this.controlFlowStorage.getStorageId()), Nodes_1.Nodes.getObjectExpressionNode(Array.from(this.controlFlowStorage.getStorage()).map(function (_ref) {
  4201. var _ref2 = _slicedToArray(_ref, 2),
  4202. key = _ref2[0],
  4203. value = _ref2[1];
  4204. return Nodes_1.Nodes.getPropertyNode(Nodes_1.Nodes.getIdentifierNode(key), value.getNode()[0]);
  4205. })))]);
  4206. structure = NodeUtils_1.NodeUtils.parentize(structure);
  4207. return [structure];
  4208. }
  4209. }]);
  4210. return ControlFlowStorageNode;
  4211. }(AbstractCustomNode_1.AbstractCustomNode);
  4212. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], ControlFlowStorageNode.prototype, "controlFlowStorage", void 0);
  4213. ControlFlowStorageNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], ControlFlowStorageNode);
  4214. exports.ControlFlowStorageNode = ControlFlowStorageNode;
  4215. /***/ }),
  4216. /* 83 */
  4217. /***/ (function(module, exports, __webpack_require__) {
  4218. "use strict";
  4219. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  4220. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4221. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4222. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4223. Object.defineProperty(exports, "__esModule", { value: true });
  4224. var tslib_1 = __webpack_require__(2);
  4225. var inversify_1 = __webpack_require__(0);
  4226. var ServiceIdentifiers_1 = __webpack_require__(1);
  4227. var format = __webpack_require__(12);
  4228. var ObfuscationTarget_1 = __webpack_require__(14);
  4229. var ConsoleOutputDisableExpressionTemplate_1 = __webpack_require__(84);
  4230. var GlobalVariableNoEvalTemplate_1 = __webpack_require__(32);
  4231. var Initializable_1 = __webpack_require__(5);
  4232. var AbstractCustomNode_1 = __webpack_require__(7);
  4233. var NodeUtils_1 = __webpack_require__(3);
  4234. var ConsoleOutputDisableExpressionNode = function (_AbstractCustomNode_) {
  4235. _inherits(ConsoleOutputDisableExpressionNode, _AbstractCustomNode_);
  4236. function ConsoleOutputDisableExpressionNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  4237. _classCallCheck(this, ConsoleOutputDisableExpressionNode);
  4238. return _possibleConstructorReturn(this, (ConsoleOutputDisableExpressionNode.__proto__ || Object.getPrototypeOf(ConsoleOutputDisableExpressionNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  4239. }
  4240. _createClass(ConsoleOutputDisableExpressionNode, [{
  4241. key: "initialize",
  4242. value: function initialize(callsControllerFunctionName) {
  4243. this.callsControllerFunctionName = callsControllerFunctionName;
  4244. }
  4245. }, {
  4246. key: "getNodeStructure",
  4247. value: function getNodeStructure() {
  4248. return NodeUtils_1.NodeUtils.convertCodeToStructure(this.getTemplate());
  4249. }
  4250. }, {
  4251. key: "getTemplate",
  4252. value: function getTemplate() {
  4253. var globalVariableTemplate = this.options.target !== ObfuscationTarget_1.ObfuscationTarget.Extension ? this.getGlobalVariableTemplate() : GlobalVariableNoEvalTemplate_1.GlobalVariableNoEvalTemplate();
  4254. return format(ConsoleOutputDisableExpressionTemplate_1.ConsoleOutputDisableExpressionTemplate(), {
  4255. consoleLogDisableFunctionName: this.identifierNamesGenerator.generate(6),
  4256. globalVariableTemplate: globalVariableTemplate,
  4257. singleNodeCallControllerFunctionName: this.callsControllerFunctionName
  4258. });
  4259. }
  4260. }]);
  4261. return ConsoleOutputDisableExpressionNode;
  4262. }(AbstractCustomNode_1.AbstractCustomNode);
  4263. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], ConsoleOutputDisableExpressionNode.prototype, "callsControllerFunctionName", void 0);
  4264. ConsoleOutputDisableExpressionNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], ConsoleOutputDisableExpressionNode);
  4265. exports.ConsoleOutputDisableExpressionNode = ConsoleOutputDisableExpressionNode;
  4266. /***/ }),
  4267. /* 84 */
  4268. /***/ (function(module, exports, __webpack_require__) {
  4269. "use strict";
  4270. Object.defineProperty(exports, "__esModule", { value: true });
  4271. function ConsoleOutputDisableExpressionTemplate() {
  4272. return "\n var {consoleLogDisableFunctionName} = {singleNodeCallControllerFunctionName}(this, function () {\n var func = function () {};\n \n {globalVariableTemplate}\n \n if (!that.console) {\n that.console = (function (func){\n var c = {};\n \n c.log = func;\n c.warn = func;\n c.debug = func;\n c.info = func;\n c.error = func;\n c.exception = func;\n c.trace = func;\n \n return c;\n })(func);\n } else {\n that.console.log = func;\n that.console.warn = func;\n that.console.debug = func;\n that.console.info = func;\n that.console.error = func;\n that.console.exception = func;\n that.console.trace = func;\n }\n });\n \n {consoleLogDisableFunctionName}();\n ";
  4273. }
  4274. exports.ConsoleOutputDisableExpressionTemplate = ConsoleOutputDisableExpressionTemplate;
  4275. /***/ }),
  4276. /* 85 */
  4277. /***/ (function(module, exports, __webpack_require__) {
  4278. "use strict";
  4279. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  4280. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4281. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4282. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4283. Object.defineProperty(exports, "__esModule", { value: true });
  4284. var tslib_1 = __webpack_require__(2);
  4285. var inversify_1 = __webpack_require__(0);
  4286. var ServiceIdentifiers_1 = __webpack_require__(1);
  4287. var format = __webpack_require__(12);
  4288. var Initializable_1 = __webpack_require__(5);
  4289. var DebugProtectionFunctionCallTemplate_1 = __webpack_require__(86);
  4290. var AbstractCustomNode_1 = __webpack_require__(7);
  4291. var NodeUtils_1 = __webpack_require__(3);
  4292. var DebugProtectionFunctionCallNode = function (_AbstractCustomNode_) {
  4293. _inherits(DebugProtectionFunctionCallNode, _AbstractCustomNode_);
  4294. function DebugProtectionFunctionCallNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  4295. _classCallCheck(this, DebugProtectionFunctionCallNode);
  4296. return _possibleConstructorReturn(this, (DebugProtectionFunctionCallNode.__proto__ || Object.getPrototypeOf(DebugProtectionFunctionCallNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  4297. }
  4298. _createClass(DebugProtectionFunctionCallNode, [{
  4299. key: "initialize",
  4300. value: function initialize(debugProtectionFunctionName, callsControllerFunctionName) {
  4301. this.debugProtectionFunctionName = debugProtectionFunctionName;
  4302. this.callsControllerFunctionName = callsControllerFunctionName;
  4303. }
  4304. }, {
  4305. key: "getNodeStructure",
  4306. value: function getNodeStructure() {
  4307. return NodeUtils_1.NodeUtils.convertCodeToStructure(this.getTemplate());
  4308. }
  4309. }, {
  4310. key: "getTemplate",
  4311. value: function getTemplate() {
  4312. return format(DebugProtectionFunctionCallTemplate_1.DebugProtectionFunctionCallTemplate(), {
  4313. debugProtectionFunctionName: this.debugProtectionFunctionName,
  4314. singleNodeCallControllerFunctionName: this.callsControllerFunctionName
  4315. });
  4316. }
  4317. }]);
  4318. return DebugProtectionFunctionCallNode;
  4319. }(AbstractCustomNode_1.AbstractCustomNode);
  4320. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], DebugProtectionFunctionCallNode.prototype, "callsControllerFunctionName", void 0);
  4321. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], DebugProtectionFunctionCallNode.prototype, "debugProtectionFunctionName", void 0);
  4322. DebugProtectionFunctionCallNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], DebugProtectionFunctionCallNode);
  4323. exports.DebugProtectionFunctionCallNode = DebugProtectionFunctionCallNode;
  4324. /***/ }),
  4325. /* 86 */
  4326. /***/ (function(module, exports, __webpack_require__) {
  4327. "use strict";
  4328. Object.defineProperty(exports, "__esModule", { value: true });
  4329. function DebugProtectionFunctionCallTemplate() {
  4330. return "\n (function () {\n {singleNodeCallControllerFunctionName}(this, function () {\n var regExp1 = new RegExp('function *\\\\( *\\\\)');\n var regExp2 = new RegExp('\\\\+\\\\+ *\\(?:_0x(?:[a-f0-9]){4,6}|(?:\\\\b|\\\\d)[a-z0-9]{1,4}(?:\\\\b|\\\\d)\\)', 'i');\n \n var result = {debugProtectionFunctionName}('init');\n \n if (!regExp1.test(result + 'chain') || !regExp2.test(result + 'input')) {\n result('0');\n } else {\n {debugProtectionFunctionName}();\n }\n })();\n })();\n ";
  4331. }
  4332. exports.DebugProtectionFunctionCallTemplate = DebugProtectionFunctionCallTemplate;
  4333. /***/ }),
  4334. /* 87 */
  4335. /***/ (function(module, exports, __webpack_require__) {
  4336. "use strict";
  4337. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  4338. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4339. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4340. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4341. Object.defineProperty(exports, "__esModule", { value: true });
  4342. var tslib_1 = __webpack_require__(2);
  4343. var inversify_1 = __webpack_require__(0);
  4344. var ServiceIdentifiers_1 = __webpack_require__(1);
  4345. var format = __webpack_require__(12);
  4346. var Initializable_1 = __webpack_require__(5);
  4347. var DebugProtectionFunctionIntervalTemplate_1 = __webpack_require__(88);
  4348. var AbstractCustomNode_1 = __webpack_require__(7);
  4349. var NodeUtils_1 = __webpack_require__(3);
  4350. var DebugProtectionFunctionIntervalNode = function (_AbstractCustomNode_) {
  4351. _inherits(DebugProtectionFunctionIntervalNode, _AbstractCustomNode_);
  4352. function DebugProtectionFunctionIntervalNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  4353. _classCallCheck(this, DebugProtectionFunctionIntervalNode);
  4354. return _possibleConstructorReturn(this, (DebugProtectionFunctionIntervalNode.__proto__ || Object.getPrototypeOf(DebugProtectionFunctionIntervalNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  4355. }
  4356. _createClass(DebugProtectionFunctionIntervalNode, [{
  4357. key: "initialize",
  4358. value: function initialize(debugProtectionFunctionName) {
  4359. this.debugProtectionFunctionName = debugProtectionFunctionName;
  4360. }
  4361. }, {
  4362. key: "getNodeStructure",
  4363. value: function getNodeStructure() {
  4364. return NodeUtils_1.NodeUtils.convertCodeToStructure(this.getTemplate());
  4365. }
  4366. }, {
  4367. key: "getTemplate",
  4368. value: function getTemplate() {
  4369. return format(DebugProtectionFunctionIntervalTemplate_1.DebugProtectionFunctionIntervalTemplate(), {
  4370. debugProtectionFunctionName: this.debugProtectionFunctionName
  4371. });
  4372. }
  4373. }]);
  4374. return DebugProtectionFunctionIntervalNode;
  4375. }(AbstractCustomNode_1.AbstractCustomNode);
  4376. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], DebugProtectionFunctionIntervalNode.prototype, "debugProtectionFunctionName", void 0);
  4377. DebugProtectionFunctionIntervalNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], DebugProtectionFunctionIntervalNode);
  4378. exports.DebugProtectionFunctionIntervalNode = DebugProtectionFunctionIntervalNode;
  4379. /***/ }),
  4380. /* 88 */
  4381. /***/ (function(module, exports, __webpack_require__) {
  4382. "use strict";
  4383. Object.defineProperty(exports, "__esModule", { value: true });
  4384. function DebugProtectionFunctionIntervalTemplate() {
  4385. return "\n setInterval(function () {\n {debugProtectionFunctionName}();\n }, 4000);\n ";
  4386. }
  4387. exports.DebugProtectionFunctionIntervalTemplate = DebugProtectionFunctionIntervalTemplate;
  4388. /***/ }),
  4389. /* 89 */
  4390. /***/ (function(module, exports, __webpack_require__) {
  4391. "use strict";
  4392. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  4393. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4394. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4395. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4396. Object.defineProperty(exports, "__esModule", { value: true });
  4397. var tslib_1 = __webpack_require__(2);
  4398. var inversify_1 = __webpack_require__(0);
  4399. var ServiceIdentifiers_1 = __webpack_require__(1);
  4400. var format = __webpack_require__(12);
  4401. var ObfuscationTarget_1 = __webpack_require__(14);
  4402. var Initializable_1 = __webpack_require__(5);
  4403. var DebuggerTemplate_1 = __webpack_require__(90);
  4404. var DebuggerTemplateNoEval_1 = __webpack_require__(91);
  4405. var DebugProtectionFunctionTemplate_1 = __webpack_require__(92);
  4406. var AbstractCustomNode_1 = __webpack_require__(7);
  4407. var NodeUtils_1 = __webpack_require__(3);
  4408. var DebugProtectionFunctionNode = function (_AbstractCustomNode_) {
  4409. _inherits(DebugProtectionFunctionNode, _AbstractCustomNode_);
  4410. function DebugProtectionFunctionNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  4411. _classCallCheck(this, DebugProtectionFunctionNode);
  4412. return _possibleConstructorReturn(this, (DebugProtectionFunctionNode.__proto__ || Object.getPrototypeOf(DebugProtectionFunctionNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  4413. }
  4414. _createClass(DebugProtectionFunctionNode, [{
  4415. key: "initialize",
  4416. value: function initialize(debugProtectionFunctionName) {
  4417. this.debugProtectionFunctionName = debugProtectionFunctionName;
  4418. }
  4419. }, {
  4420. key: "getNodeStructure",
  4421. value: function getNodeStructure() {
  4422. return NodeUtils_1.NodeUtils.convertCodeToStructure(this.getTemplate());
  4423. }
  4424. }, {
  4425. key: "getTemplate",
  4426. value: function getTemplate() {
  4427. var debuggerTemplate = this.options.target !== ObfuscationTarget_1.ObfuscationTarget.Extension ? DebuggerTemplate_1.DebuggerTemplate() : DebuggerTemplateNoEval_1.DebuggerTemplateNoEval();
  4428. return format(DebugProtectionFunctionTemplate_1.DebugProtectionFunctionTemplate(), {
  4429. debuggerTemplate: debuggerTemplate,
  4430. debugProtectionFunctionName: this.debugProtectionFunctionName
  4431. });
  4432. }
  4433. }]);
  4434. return DebugProtectionFunctionNode;
  4435. }(AbstractCustomNode_1.AbstractCustomNode);
  4436. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], DebugProtectionFunctionNode.prototype, "debugProtectionFunctionName", void 0);
  4437. DebugProtectionFunctionNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], DebugProtectionFunctionNode);
  4438. exports.DebugProtectionFunctionNode = DebugProtectionFunctionNode;
  4439. /***/ }),
  4440. /* 90 */
  4441. /***/ (function(module, exports, __webpack_require__) {
  4442. "use strict";
  4443. Object.defineProperty(exports, "__esModule", { value: true });
  4444. function DebuggerTemplate() {
  4445. return "\n if (typeof counter === 'string') {\n return (function (arg) {}.constructor('while (true) {}').apply('counter'));\n } else {\n if (('' + counter / counter)['length'] !== 1 || counter % 20 === 0) {\n (function () {return true;}.constructor('debu' + 'gger').call('action'));\n } else {\n (function () {return false;}.constructor('debu' + 'gger').apply('stateObject'));\n }\n \n }\n ";
  4446. }
  4447. exports.DebuggerTemplate = DebuggerTemplate;
  4448. /***/ }),
  4449. /* 91 */
  4450. /***/ (function(module, exports, __webpack_require__) {
  4451. "use strict";
  4452. Object.defineProperty(exports, "__esModule", { value: true });
  4453. function DebuggerTemplateNoEval() {
  4454. return "\n if (typeof counter === 'string') {\n var func = function () {\n while (true) {}\n };\n \n return func();\n } else {\n if (('' + counter / counter)['length'] !== 1 || counter % 20 === 0) {\n debugger;\n } else {\n debugger;\n }\n \n }\n ";
  4455. }
  4456. exports.DebuggerTemplateNoEval = DebuggerTemplateNoEval;
  4457. /***/ }),
  4458. /* 92 */
  4459. /***/ (function(module, exports, __webpack_require__) {
  4460. "use strict";
  4461. Object.defineProperty(exports, "__esModule", { value: true });
  4462. function DebugProtectionFunctionTemplate() {
  4463. return "\n function {debugProtectionFunctionName} (ret) {\n function debuggerProtection (counter) {\n \n {debuggerTemplate}\n \n debuggerProtection(++counter);\n }\n \n try {\n if (ret) {\n return debuggerProtection;\n } else {\n debuggerProtection(0);\n }\n } catch (y) {}\n }\n ";
  4464. }
  4465. exports.DebugProtectionFunctionTemplate = DebugProtectionFunctionTemplate;
  4466. /***/ }),
  4467. /* 93 */
  4468. /***/ (function(module, exports, __webpack_require__) {
  4469. "use strict";
  4470. var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; })();
  4471. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  4472. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4473. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4474. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4475. Object.defineProperty(exports, "__esModule", { value: true });
  4476. var tslib_1 = __webpack_require__(2);
  4477. var inversify_1 = __webpack_require__(0);
  4478. var ServiceIdentifiers_1 = __webpack_require__(1);
  4479. var format = __webpack_require__(12);
  4480. var ObfuscationTarget_1 = __webpack_require__(14);
  4481. var Initializable_1 = __webpack_require__(5);
  4482. var DomainLockNodeTemplate_1 = __webpack_require__(94);
  4483. var GlobalVariableNoEvalTemplate_1 = __webpack_require__(32);
  4484. var AbstractCustomNode_1 = __webpack_require__(7);
  4485. var NodeUtils_1 = __webpack_require__(3);
  4486. var DomainLockNode = function (_AbstractCustomNode_) {
  4487. _inherits(DomainLockNode, _AbstractCustomNode_);
  4488. function DomainLockNode(identifierNamesGeneratorFactory, randomGenerator, cryptUtils, options) {
  4489. _classCallCheck(this, DomainLockNode);
  4490. var _this = _possibleConstructorReturn(this, (DomainLockNode.__proto__ || Object.getPrototypeOf(DomainLockNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  4491. _this.cryptUtils = cryptUtils;
  4492. return _this;
  4493. }
  4494. _createClass(DomainLockNode, [{
  4495. key: "initialize",
  4496. value: function initialize(callsControllerFunctionName) {
  4497. this.callsControllerFunctionName = callsControllerFunctionName;
  4498. }
  4499. }, {
  4500. key: "getNodeStructure",
  4501. value: function getNodeStructure() {
  4502. return NodeUtils_1.NodeUtils.convertCodeToStructure(this.getTemplate());
  4503. }
  4504. }, {
  4505. key: "getTemplate",
  4506. value: function getTemplate() {
  4507. var domainsString = this.options.domainLock.join(';');
  4508. var _cryptUtils$hideStrin = this.cryptUtils.hideString(domainsString, domainsString.length * 3),
  4509. _cryptUtils$hideStrin2 = _slicedToArray(_cryptUtils$hideStrin, 2),
  4510. hiddenDomainsString = _cryptUtils$hideStrin2[0],
  4511. diff = _cryptUtils$hideStrin2[1];
  4512. var globalVariableTemplate = this.options.target !== ObfuscationTarget_1.ObfuscationTarget.Extension ? this.getGlobalVariableTemplate() : GlobalVariableNoEvalTemplate_1.GlobalVariableNoEvalTemplate();
  4513. return format(DomainLockNodeTemplate_1.DomainLockNodeTemplate(), {
  4514. domainLockFunctionName: this.identifierNamesGenerator.generate(6),
  4515. diff: diff,
  4516. domains: hiddenDomainsString,
  4517. globalVariableTemplate: globalVariableTemplate,
  4518. singleNodeCallControllerFunctionName: this.callsControllerFunctionName
  4519. });
  4520. }
  4521. }]);
  4522. return DomainLockNode;
  4523. }(AbstractCustomNode_1.AbstractCustomNode);
  4524. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], DomainLockNode.prototype, "callsControllerFunctionName", void 0);
  4525. DomainLockNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICryptUtils)), tslib_1.__param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object, Object])], DomainLockNode);
  4526. exports.DomainLockNode = DomainLockNode;
  4527. /***/ }),
  4528. /* 94 */
  4529. /***/ (function(module, exports, __webpack_require__) {
  4530. "use strict";
  4531. Object.defineProperty(exports, "__esModule", { value: true });
  4532. function DomainLockNodeTemplate() {
  4533. return "\n var {domainLockFunctionName} = {singleNodeCallControllerFunctionName}(this, function () {\n \n {globalVariableTemplate}\n \n var func = function () {\n return {\n key: 'item',\n value: 'attribute',\n getAttribute: function () {\n for (var i = 0; i < 1000; i--) {\n var isPositive = i > 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 ";
  4534. }
  4535. exports.DomainLockNodeTemplate = DomainLockNodeTemplate;
  4536. /***/ }),
  4537. /* 95 */
  4538. /***/ (function(module, exports, __webpack_require__) {
  4539. "use strict";
  4540. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  4541. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4542. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4543. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4544. Object.defineProperty(exports, "__esModule", { value: true });
  4545. var tslib_1 = __webpack_require__(2);
  4546. var inversify_1 = __webpack_require__(0);
  4547. var ServiceIdentifiers_1 = __webpack_require__(1);
  4548. var Initializable_1 = __webpack_require__(5);
  4549. var AbstractCustomNode_1 = __webpack_require__(7);
  4550. var Nodes_1 = __webpack_require__(9);
  4551. var NodeUtils_1 = __webpack_require__(3);
  4552. var ExpressionWithOperatorControlFlowStorageCallNode = function (_AbstractCustomNode_) {
  4553. _inherits(ExpressionWithOperatorControlFlowStorageCallNode, _AbstractCustomNode_);
  4554. function ExpressionWithOperatorControlFlowStorageCallNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  4555. _classCallCheck(this, ExpressionWithOperatorControlFlowStorageCallNode);
  4556. return _possibleConstructorReturn(this, (ExpressionWithOperatorControlFlowStorageCallNode.__proto__ || Object.getPrototypeOf(ExpressionWithOperatorControlFlowStorageCallNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  4557. }
  4558. _createClass(ExpressionWithOperatorControlFlowStorageCallNode, [{
  4559. key: "initialize",
  4560. value: function initialize(controlFlowStorageName, controlFlowStorageKey, leftValue, rightValue) {
  4561. this.controlFlowStorageName = controlFlowStorageName;
  4562. this.controlFlowStorageKey = controlFlowStorageKey;
  4563. this.leftValue = leftValue;
  4564. this.rightValue = rightValue;
  4565. }
  4566. }, {
  4567. key: "getNodeStructure",
  4568. value: function getNodeStructure() {
  4569. var structure = Nodes_1.Nodes.getExpressionStatementNode(Nodes_1.Nodes.getCallExpressionNode(Nodes_1.Nodes.getMemberExpressionNode(Nodes_1.Nodes.getIdentifierNode(this.controlFlowStorageName), Nodes_1.Nodes.getIdentifierNode(this.controlFlowStorageKey)), [this.leftValue, this.rightValue]));
  4570. NodeUtils_1.NodeUtils.parentize(structure);
  4571. return [structure];
  4572. }
  4573. }]);
  4574. return ExpressionWithOperatorControlFlowStorageCallNode;
  4575. }(AbstractCustomNode_1.AbstractCustomNode);
  4576. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], ExpressionWithOperatorControlFlowStorageCallNode.prototype, "controlFlowStorageKey", void 0);
  4577. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], ExpressionWithOperatorControlFlowStorageCallNode.prototype, "controlFlowStorageName", void 0);
  4578. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], ExpressionWithOperatorControlFlowStorageCallNode.prototype, "leftValue", void 0);
  4579. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], ExpressionWithOperatorControlFlowStorageCallNode.prototype, "rightValue", void 0);
  4580. ExpressionWithOperatorControlFlowStorageCallNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], ExpressionWithOperatorControlFlowStorageCallNode);
  4581. exports.ExpressionWithOperatorControlFlowStorageCallNode = ExpressionWithOperatorControlFlowStorageCallNode;
  4582. /***/ }),
  4583. /* 96 */
  4584. /***/ (function(module, exports, __webpack_require__) {
  4585. "use strict";
  4586. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  4587. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4588. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4589. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4590. Object.defineProperty(exports, "__esModule", { value: true });
  4591. var tslib_1 = __webpack_require__(2);
  4592. var inversify_1 = __webpack_require__(0);
  4593. var ServiceIdentifiers_1 = __webpack_require__(1);
  4594. var Initializable_1 = __webpack_require__(5);
  4595. var AbstractCustomNode_1 = __webpack_require__(7);
  4596. var Nodes_1 = __webpack_require__(9);
  4597. var NodeUtils_1 = __webpack_require__(3);
  4598. var LogicalExpressionFunctionNode = function (_AbstractCustomNode_) {
  4599. _inherits(LogicalExpressionFunctionNode, _AbstractCustomNode_);
  4600. function LogicalExpressionFunctionNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  4601. _classCallCheck(this, LogicalExpressionFunctionNode);
  4602. return _possibleConstructorReturn(this, (LogicalExpressionFunctionNode.__proto__ || Object.getPrototypeOf(LogicalExpressionFunctionNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  4603. }
  4604. _createClass(LogicalExpressionFunctionNode, [{
  4605. key: "initialize",
  4606. value: function initialize(operator) {
  4607. this.operator = operator;
  4608. }
  4609. }, {
  4610. key: "getNodeStructure",
  4611. value: function getNodeStructure() {
  4612. var structure = Nodes_1.Nodes.getFunctionDeclarationNode(this.randomGenerator.getRandomString(3), [Nodes_1.Nodes.getIdentifierNode('x'), Nodes_1.Nodes.getIdentifierNode('y')], Nodes_1.Nodes.getBlockStatementNode([Nodes_1.Nodes.getReturnStatementNode(Nodes_1.Nodes.getLogicalExpressionNode(this.operator, Nodes_1.Nodes.getIdentifierNode('x'), Nodes_1.Nodes.getIdentifierNode('y')))]));
  4613. NodeUtils_1.NodeUtils.parentize(structure);
  4614. return [structure];
  4615. }
  4616. }]);
  4617. return LogicalExpressionFunctionNode;
  4618. }(AbstractCustomNode_1.AbstractCustomNode);
  4619. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], LogicalExpressionFunctionNode.prototype, "operator", void 0);
  4620. LogicalExpressionFunctionNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], LogicalExpressionFunctionNode);
  4621. exports.LogicalExpressionFunctionNode = LogicalExpressionFunctionNode;
  4622. /***/ }),
  4623. /* 97 */
  4624. /***/ (function(module, exports, __webpack_require__) {
  4625. "use strict";
  4626. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  4627. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4628. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4629. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4630. Object.defineProperty(exports, "__esModule", { value: true });
  4631. var tslib_1 = __webpack_require__(2);
  4632. var inversify_1 = __webpack_require__(0);
  4633. var ServiceIdentifiers_1 = __webpack_require__(1);
  4634. var format = __webpack_require__(12);
  4635. var ObfuscationEvent_1 = __webpack_require__(17);
  4636. var Initializable_1 = __webpack_require__(5);
  4637. var SingleNodeCallControllerTemplate_1 = __webpack_require__(98);
  4638. var NoCustomNodes_1 = __webpack_require__(27);
  4639. var AbstractCustomNode_1 = __webpack_require__(7);
  4640. var JavaScriptObfuscatorFacade_1 = __webpack_require__(19);
  4641. var NodeUtils_1 = __webpack_require__(3);
  4642. var NodeCallsControllerFunctionNode = function (_AbstractCustomNode_) {
  4643. _inherits(NodeCallsControllerFunctionNode, _AbstractCustomNode_);
  4644. function NodeCallsControllerFunctionNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  4645. _classCallCheck(this, NodeCallsControllerFunctionNode);
  4646. return _possibleConstructorReturn(this, (NodeCallsControllerFunctionNode.__proto__ || Object.getPrototypeOf(NodeCallsControllerFunctionNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  4647. }
  4648. _createClass(NodeCallsControllerFunctionNode, [{
  4649. key: "initialize",
  4650. value: function initialize(appendEvent, callsControllerFunctionName) {
  4651. this.appendEvent = appendEvent;
  4652. this.callsControllerFunctionName = callsControllerFunctionName;
  4653. }
  4654. }, {
  4655. key: "getNodeStructure",
  4656. value: function getNodeStructure() {
  4657. return NodeUtils_1.NodeUtils.convertCodeToStructure(this.getTemplate());
  4658. }
  4659. }, {
  4660. key: "getTemplate",
  4661. value: function getTemplate() {
  4662. if (this.appendEvent === ObfuscationEvent_1.ObfuscationEvent.AfterObfuscation) {
  4663. return JavaScriptObfuscatorFacade_1.JavaScriptObfuscator.obfuscate(format(SingleNodeCallControllerTemplate_1.SingleNodeCallControllerTemplate(), {
  4664. singleNodeCallControllerFunctionName: this.callsControllerFunctionName
  4665. }), Object.assign({}, NoCustomNodes_1.NO_ADDITIONAL_NODES_PRESET, { identifierNamesGenerator: this.options.identifierNamesGenerator, seed: this.options.seed })).getObfuscatedCode();
  4666. }
  4667. return format(SingleNodeCallControllerTemplate_1.SingleNodeCallControllerTemplate(), {
  4668. singleNodeCallControllerFunctionName: this.callsControllerFunctionName
  4669. });
  4670. }
  4671. }]);
  4672. return NodeCallsControllerFunctionNode;
  4673. }(AbstractCustomNode_1.AbstractCustomNode);
  4674. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], NodeCallsControllerFunctionNode.prototype, "callsControllerFunctionName", void 0);
  4675. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], NodeCallsControllerFunctionNode.prototype, "appendEvent", void 0);
  4676. NodeCallsControllerFunctionNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], NodeCallsControllerFunctionNode);
  4677. exports.NodeCallsControllerFunctionNode = NodeCallsControllerFunctionNode;
  4678. /***/ }),
  4679. /* 98 */
  4680. /***/ (function(module, exports, __webpack_require__) {
  4681. "use strict";
  4682. Object.defineProperty(exports, "__esModule", { value: true });
  4683. function SingleNodeCallControllerTemplate() {
  4684. return "\n var {singleNodeCallControllerFunctionName} = (function(){\n var firstCall = true;\n \n return function (context, fn){\n var rfn = firstCall ? function(){\n if(fn){\n var res = fn.apply(context, arguments);\n fn = null;\n return res;\n }\n } : function(){}\n \n firstCall = false;\n \n return rfn;\n }\n })();\n ";
  4685. }
  4686. exports.SingleNodeCallControllerTemplate = SingleNodeCallControllerTemplate;
  4687. /***/ }),
  4688. /* 99 */
  4689. /***/ (function(module, exports, __webpack_require__) {
  4690. "use strict";
  4691. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  4692. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4693. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4694. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4695. Object.defineProperty(exports, "__esModule", { value: true });
  4696. var tslib_1 = __webpack_require__(2);
  4697. var inversify_1 = __webpack_require__(0);
  4698. var ServiceIdentifiers_1 = __webpack_require__(1);
  4699. var format = __webpack_require__(12);
  4700. var Initializable_1 = __webpack_require__(5);
  4701. var NoCustomNodes_1 = __webpack_require__(27);
  4702. var SelfDefendingTemplate_1 = __webpack_require__(100);
  4703. var AbstractCustomNode_1 = __webpack_require__(7);
  4704. var JavaScriptObfuscatorFacade_1 = __webpack_require__(19);
  4705. var NodeUtils_1 = __webpack_require__(3);
  4706. var SelfDefendingUnicodeNode = function (_AbstractCustomNode_) {
  4707. _inherits(SelfDefendingUnicodeNode, _AbstractCustomNode_);
  4708. function SelfDefendingUnicodeNode(identifierNamesGeneratorFactory, randomGenerator, escapeSequenceEncoder, options) {
  4709. _classCallCheck(this, SelfDefendingUnicodeNode);
  4710. var _this = _possibleConstructorReturn(this, (SelfDefendingUnicodeNode.__proto__ || Object.getPrototypeOf(SelfDefendingUnicodeNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  4711. _this.escapeSequenceEncoder = escapeSequenceEncoder;
  4712. return _this;
  4713. }
  4714. _createClass(SelfDefendingUnicodeNode, [{
  4715. key: "initialize",
  4716. value: function initialize(callsControllerFunctionName) {
  4717. this.callsControllerFunctionName = callsControllerFunctionName;
  4718. }
  4719. }, {
  4720. key: "getNodeStructure",
  4721. value: function getNodeStructure() {
  4722. return NodeUtils_1.NodeUtils.convertCodeToStructure(this.getTemplate());
  4723. }
  4724. }, {
  4725. key: "getTemplate",
  4726. value: function getTemplate() {
  4727. return JavaScriptObfuscatorFacade_1.JavaScriptObfuscator.obfuscate(format(SelfDefendingTemplate_1.SelfDefendingTemplate(this.escapeSequenceEncoder), {
  4728. selfDefendingFunctionName: this.identifierNamesGenerator.generate(6),
  4729. singleNodeCallControllerFunctionName: this.callsControllerFunctionName
  4730. }), Object.assign({}, NoCustomNodes_1.NO_ADDITIONAL_NODES_PRESET, { identifierNamesGenerator: this.options.identifierNamesGenerator, seed: this.options.seed, unicodeEscapeSequence: true })).getObfuscatedCode();
  4731. }
  4732. }]);
  4733. return SelfDefendingUnicodeNode;
  4734. }(AbstractCustomNode_1.AbstractCustomNode);
  4735. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], SelfDefendingUnicodeNode.prototype, "callsControllerFunctionName", void 0);
  4736. SelfDefendingUnicodeNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IEscapeSequenceEncoder)), tslib_1.__param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object, Object])], SelfDefendingUnicodeNode);
  4737. exports.SelfDefendingUnicodeNode = SelfDefendingUnicodeNode;
  4738. /***/ }),
  4739. /* 100 */
  4740. /***/ (function(module, exports, __webpack_require__) {
  4741. "use strict";
  4742. Object.defineProperty(exports, "__esModule", { value: true });
  4743. function SelfDefendingTemplate(escapeSequenceEncoder) {
  4744. return "\n var {selfDefendingFunctionName} = {singleNodeCallControllerFunctionName}(this, function () {\n var func1 = function(){return 'dev';},\n func2 = function () {\n return 'window';\n };\n \n var test1 = function () {\n var regExp = new RegExp('" + escapeSequenceEncoder.encode("\\w+ *\\(\\) *{\\w+ *['|\"].+['|\"];? *}", true) + "');\n \n return !regExp.test(func1.toString());\n };\n \n var test2 = function () {\n var regExp = new RegExp('" + escapeSequenceEncoder.encode("(\\\\[x|u](\\w){2,4})+", true) + "');\n \n return regExp.test(func2.toString());\n };\n \n var recursiveFunc1 = function (string) {\n var i = ~-1 >> 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\u0435xOf');\n } else {\n recursiveFunc1('indexOf');\n }\n } else {\n recursiveFunc1('ind\u0435xOf');\n }\n })\n \n {selfDefendingFunctionName}();\n ";
  4745. }
  4746. exports.SelfDefendingTemplate = SelfDefendingTemplate;
  4747. /***/ }),
  4748. /* 101 */
  4749. /***/ (function(module, exports, __webpack_require__) {
  4750. "use strict";
  4751. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  4752. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4753. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4754. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4755. Object.defineProperty(exports, "__esModule", { value: true });
  4756. var tslib_1 = __webpack_require__(2);
  4757. var inversify_1 = __webpack_require__(0);
  4758. var ServiceIdentifiers_1 = __webpack_require__(1);
  4759. var format = __webpack_require__(12);
  4760. var ObfuscationTarget_1 = __webpack_require__(14);
  4761. var StringArrayEncoding_1 = __webpack_require__(26);
  4762. var Initializable_1 = __webpack_require__(5);
  4763. var NoCustomNodes_1 = __webpack_require__(27);
  4764. var AtobTemplate_1 = __webpack_require__(102);
  4765. var GlobalVariableNoEvalTemplate_1 = __webpack_require__(32);
  4766. var Rc4Template_1 = __webpack_require__(103);
  4767. var SelfDefendingTemplate_1 = __webpack_require__(104);
  4768. var StringArrayBase64DecodeNodeTemplate_1 = __webpack_require__(105);
  4769. var StringArrayCallsWrapperTemplate_1 = __webpack_require__(106);
  4770. var StringArrayRC4DecodeNodeTemplate_1 = __webpack_require__(107);
  4771. var AbstractCustomNode_1 = __webpack_require__(7);
  4772. var JavaScriptObfuscatorFacade_1 = __webpack_require__(19);
  4773. var NodeUtils_1 = __webpack_require__(3);
  4774. var StringArrayCallsWrapper = function (_AbstractCustomNode_) {
  4775. _inherits(StringArrayCallsWrapper, _AbstractCustomNode_);
  4776. function StringArrayCallsWrapper(identifierNamesGeneratorFactory, randomGenerator, escapeSequenceEncoder, options) {
  4777. _classCallCheck(this, StringArrayCallsWrapper);
  4778. var _this = _possibleConstructorReturn(this, (StringArrayCallsWrapper.__proto__ || Object.getPrototypeOf(StringArrayCallsWrapper)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  4779. _this.escapeSequenceEncoder = escapeSequenceEncoder;
  4780. return _this;
  4781. }
  4782. _createClass(StringArrayCallsWrapper, [{
  4783. key: "initialize",
  4784. value: function initialize(stringArrayName, stringArrayCallsWrapperName) {
  4785. this.stringArrayName = stringArrayName;
  4786. this.stringArrayCallsWrapperName = stringArrayCallsWrapperName;
  4787. }
  4788. }, {
  4789. key: "getNodeStructure",
  4790. value: function getNodeStructure() {
  4791. return NodeUtils_1.NodeUtils.convertCodeToStructure(this.getTemplate());
  4792. }
  4793. }, {
  4794. key: "getTemplate",
  4795. value: function getTemplate() {
  4796. var decodeNodeTemplate = this.getDecodeStringArrayTemplate();
  4797. return JavaScriptObfuscatorFacade_1.JavaScriptObfuscator.obfuscate(format(StringArrayCallsWrapperTemplate_1.StringArrayCallsWrapperTemplate(), {
  4798. decodeNodeTemplate: decodeNodeTemplate,
  4799. stringArrayCallsWrapperName: this.stringArrayCallsWrapperName,
  4800. stringArrayName: this.stringArrayName
  4801. }), Object.assign({}, NoCustomNodes_1.NO_ADDITIONAL_NODES_PRESET, { identifierNamesGenerator: this.options.identifierNamesGenerator, seed: this.options.seed })).getObfuscatedCode();
  4802. }
  4803. }, {
  4804. key: "getDecodeStringArrayTemplate",
  4805. value: function getDecodeStringArrayTemplate() {
  4806. var globalVariableTemplate = this.options.target !== ObfuscationTarget_1.ObfuscationTarget.Extension ? this.getGlobalVariableTemplate() : GlobalVariableNoEvalTemplate_1.GlobalVariableNoEvalTemplate();
  4807. var atobPolyfill = format(AtobTemplate_1.AtobTemplate(), { globalVariableTemplate: globalVariableTemplate });
  4808. var decodeStringArrayTemplate = '',
  4809. selfDefendingCode = '';
  4810. if (this.options.selfDefending) {
  4811. selfDefendingCode = format(SelfDefendingTemplate_1.SelfDefendingTemplate(this.randomGenerator, this.escapeSequenceEncoder), {
  4812. stringArrayCallsWrapperName: this.stringArrayCallsWrapperName,
  4813. stringArrayName: this.stringArrayName
  4814. });
  4815. }
  4816. switch (this.options.stringArrayEncoding) {
  4817. case StringArrayEncoding_1.StringArrayEncoding.Rc4:
  4818. decodeStringArrayTemplate = format(StringArrayRC4DecodeNodeTemplate_1.StringArrayRc4DecodeNodeTemplate(this.randomGenerator), {
  4819. atobPolyfill: atobPolyfill,
  4820. rc4Polyfill: Rc4Template_1.Rc4Template(),
  4821. selfDefendingCode: selfDefendingCode,
  4822. stringArrayCallsWrapperName: this.stringArrayCallsWrapperName
  4823. });
  4824. break;
  4825. case StringArrayEncoding_1.StringArrayEncoding.Base64:
  4826. decodeStringArrayTemplate = format(StringArrayBase64DecodeNodeTemplate_1.StringArrayBase64DecodeNodeTemplate(this.randomGenerator), {
  4827. atobPolyfill: atobPolyfill,
  4828. selfDefendingCode: selfDefendingCode,
  4829. stringArrayCallsWrapperName: this.stringArrayCallsWrapperName
  4830. });
  4831. break;
  4832. }
  4833. return decodeStringArrayTemplate;
  4834. }
  4835. }]);
  4836. return StringArrayCallsWrapper;
  4837. }(AbstractCustomNode_1.AbstractCustomNode);
  4838. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], StringArrayCallsWrapper.prototype, "stringArrayName", void 0);
  4839. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], StringArrayCallsWrapper.prototype, "stringArrayCallsWrapperName", void 0);
  4840. StringArrayCallsWrapper = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IEscapeSequenceEncoder)), tslib_1.__param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object, Object])], StringArrayCallsWrapper);
  4841. exports.StringArrayCallsWrapper = StringArrayCallsWrapper;
  4842. /***/ }),
  4843. /* 102 */
  4844. /***/ (function(module, exports, __webpack_require__) {
  4845. "use strict";
  4846. Object.defineProperty(exports, "__esModule", { value: true });
  4847. function AtobTemplate() {
  4848. return "\n (function () {\n {globalVariableTemplate}\n \n var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n that.atob || (\n that.atob = function(input) {\n var str = String(input).replace(/=+$/, '');\n for (\n var bc = 0, bs, buffer, idx = 0, output = '';\n buffer = str.charAt(idx++);\n ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,\n bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0\n ) {\n buffer = chars.indexOf(buffer);\n }\n return output;\n });\n })();\n ";
  4849. }
  4850. exports.AtobTemplate = AtobTemplate;
  4851. /***/ }),
  4852. /* 103 */
  4853. /***/ (function(module, exports, __webpack_require__) {
  4854. "use strict";
  4855. Object.defineProperty(exports, "__esModule", { value: true });
  4856. function Rc4Template() {
  4857. 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 ";
  4858. }
  4859. exports.Rc4Template = Rc4Template;
  4860. /***/ }),
  4861. /* 104 */
  4862. /***/ (function(module, exports, __webpack_require__) {
  4863. "use strict";
  4864. Object.defineProperty(exports, "__esModule", { value: true });
  4865. function SelfDefendingTemplate(randomGenerator, escapeSequenceEncoder) {
  4866. var identifierLength = 6;
  4867. var rc4BytesIdentifier = randomGenerator.getRandomString(identifierLength);
  4868. var statesIdentifier = randomGenerator.getRandomString(identifierLength);
  4869. var newStateIdentifier = randomGenerator.getRandomString(identifierLength);
  4870. var firstStateIdentifier = randomGenerator.getRandomString(identifierLength);
  4871. var secondStateIdentifier = randomGenerator.getRandomString(identifierLength);
  4872. var checkStateIdentifier = randomGenerator.getRandomString(identifierLength);
  4873. var runStateIdentifier = randomGenerator.getRandomString(identifierLength);
  4874. var getStateIdentifier = randomGenerator.getRandomString(identifierLength);
  4875. var stateResultIdentifier = randomGenerator.getRandomString(identifierLength);
  4876. return "\n var StatesClass = function (" + rc4BytesIdentifier + ") {\n this." + rc4BytesIdentifier + " = " + rc4BytesIdentifier + ";\n this." + statesIdentifier + " = [1, 0, 0];\n this." + newStateIdentifier + " = function(){return 'newState';};\n this." + firstStateIdentifier + " = '" + escapeSequenceEncoder.encode("\\w+ *\\(\\) *{\\w+ *", true) + "';\n this." + secondStateIdentifier + " = '" + escapeSequenceEncoder.encode("['|\"].+['|\"];? *}", true) + "';\n };\n \n StatesClass.prototype." + checkStateIdentifier + " = function () {\n var regExp = new RegExp(this." + firstStateIdentifier + " + this." + secondStateIdentifier + ");\n var expression = regExp.test(this." + newStateIdentifier + ".toString())\n ? --this." + statesIdentifier + "[1]\n : --this." + statesIdentifier + "[0];\n \n return this." + runStateIdentifier + "(expression);\n };\n \n StatesClass.prototype." + runStateIdentifier + " = function (" + stateResultIdentifier + ") {\n if (!Boolean(~" + stateResultIdentifier + ")) {\n return " + stateResultIdentifier + ";\n }\n \n return this." + getStateIdentifier + "(this." + rc4BytesIdentifier + ");\n };\n\n StatesClass.prototype." + getStateIdentifier + " = function (" + rc4BytesIdentifier + ") {\n for (var i = 0, len = this." + statesIdentifier + ".length; i < len; i++) {\n this." + statesIdentifier + ".push(Math.round(Math.random()));\n len = this." + statesIdentifier + ".length;\n }\n \n return " + rc4BytesIdentifier + "(this." + statesIdentifier + "[0]);\n };\n\n new StatesClass({stringArrayCallsWrapperName})." + checkStateIdentifier + "();\n ";
  4877. }
  4878. exports.SelfDefendingTemplate = SelfDefendingTemplate;
  4879. /***/ }),
  4880. /* 105 */
  4881. /***/ (function(module, exports, __webpack_require__) {
  4882. "use strict";
  4883. Object.defineProperty(exports, "__esModule", { value: true });
  4884. function StringArrayBase64DecodeNodeTemplate(randomGenerator) {
  4885. var identifierLength = 6;
  4886. var initializedIdentifier = randomGenerator.getRandomString(identifierLength);
  4887. var base64DecodeFunctionIdentifier = randomGenerator.getRandomString(identifierLength);
  4888. var dataIdentifier = randomGenerator.getRandomString(identifierLength);
  4889. return "\n if ({stringArrayCallsWrapperName}." + initializedIdentifier + " === undefined) {\n {atobPolyfill}\n \n {stringArrayCallsWrapperName}." + base64DecodeFunctionIdentifier + " = 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}." + dataIdentifier + " = {};\n \n {stringArrayCallsWrapperName}." + initializedIdentifier + " = true;\n }\n \n var cachedValue = {stringArrayCallsWrapperName}." + dataIdentifier + "[index];\n \n if (cachedValue === undefined) {\n {selfDefendingCode}\n \n value = {stringArrayCallsWrapperName}." + base64DecodeFunctionIdentifier + "(value);\n {stringArrayCallsWrapperName}." + dataIdentifier + "[index] = value;\n } else {\n value = cachedValue;\n }\n ";
  4890. }
  4891. exports.StringArrayBase64DecodeNodeTemplate = StringArrayBase64DecodeNodeTemplate;
  4892. /***/ }),
  4893. /* 106 */
  4894. /***/ (function(module, exports, __webpack_require__) {
  4895. "use strict";
  4896. Object.defineProperty(exports, "__esModule", { value: true });
  4897. function StringArrayCallsWrapperTemplate() {
  4898. 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 ";
  4899. }
  4900. exports.StringArrayCallsWrapperTemplate = StringArrayCallsWrapperTemplate;
  4901. /***/ }),
  4902. /* 107 */
  4903. /***/ (function(module, exports, __webpack_require__) {
  4904. "use strict";
  4905. Object.defineProperty(exports, "__esModule", { value: true });
  4906. function StringArrayRc4DecodeNodeTemplate(randomGenerator) {
  4907. var identifierLength = 6;
  4908. var initializedIdentifier = randomGenerator.getRandomString(identifierLength);
  4909. var rc4Identifier = randomGenerator.getRandomString(identifierLength);
  4910. var dataIdentifier = randomGenerator.getRandomString(identifierLength);
  4911. var onceIdentifier = randomGenerator.getRandomString(identifierLength);
  4912. return "\n if ({stringArrayCallsWrapperName}." + initializedIdentifier + " === undefined) {\n {atobPolyfill}\n \n {rc4Polyfill}\n {stringArrayCallsWrapperName}." + rc4Identifier + " = rc4;\n \n {stringArrayCallsWrapperName}." + dataIdentifier + " = {};\n \n {stringArrayCallsWrapperName}." + initializedIdentifier + " = true;\n }\n \n var cachedValue = {stringArrayCallsWrapperName}." + dataIdentifier + "[index];\n\n if (cachedValue === undefined) {\n if ({stringArrayCallsWrapperName}." + onceIdentifier + " === undefined) {\n {selfDefendingCode}\n \n {stringArrayCallsWrapperName}." + onceIdentifier + " = true;\n }\n \n value = {stringArrayCallsWrapperName}." + rc4Identifier + "(value, key);\n {stringArrayCallsWrapperName}." + dataIdentifier + "[index] = value;\n } else {\n value = cachedValue;\n }\n ";
  4913. }
  4914. exports.StringArrayRc4DecodeNodeTemplate = StringArrayRc4DecodeNodeTemplate;
  4915. /***/ }),
  4916. /* 108 */
  4917. /***/ (function(module, exports, __webpack_require__) {
  4918. "use strict";
  4919. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  4920. var _get = (function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } });
  4921. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4922. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4923. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4924. Object.defineProperty(exports, "__esModule", { value: true });
  4925. var tslib_1 = __webpack_require__(2);
  4926. var inversify_1 = __webpack_require__(0);
  4927. var ServiceIdentifiers_1 = __webpack_require__(1);
  4928. var format = __webpack_require__(12);
  4929. var Initializable_1 = __webpack_require__(5);
  4930. var StringArrayTemplate_1 = __webpack_require__(109);
  4931. var AbstractCustomNode_1 = __webpack_require__(7);
  4932. var NodeUtils_1 = __webpack_require__(3);
  4933. var StringArrayNode = function (_AbstractCustomNode_) {
  4934. _inherits(StringArrayNode, _AbstractCustomNode_);
  4935. function StringArrayNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  4936. _classCallCheck(this, StringArrayNode);
  4937. return _possibleConstructorReturn(this, (StringArrayNode.__proto__ || Object.getPrototypeOf(StringArrayNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  4938. }
  4939. _createClass(StringArrayNode, [{
  4940. key: "initialize",
  4941. value: function initialize(stringArrayStorage, stringArrayName, stringArrayRotateValue) {
  4942. this.stringArrayStorage = stringArrayStorage;
  4943. this.stringArrayName = stringArrayName;
  4944. this.stringArrayRotateValue = stringArrayRotateValue;
  4945. }
  4946. }, {
  4947. key: "getNode",
  4948. value: function getNode() {
  4949. this.stringArrayStorage.rotateArray(this.stringArrayRotateValue);
  4950. return _get(StringArrayNode.prototype.__proto__ || Object.getPrototypeOf(StringArrayNode.prototype), "getNode", this).call(this);
  4951. }
  4952. }, {
  4953. key: "getNodeStructure",
  4954. value: function getNodeStructure() {
  4955. return NodeUtils_1.NodeUtils.convertCodeToStructure(this.getTemplate());
  4956. }
  4957. }, {
  4958. key: "getTemplate",
  4959. value: function getTemplate() {
  4960. return format(StringArrayTemplate_1.StringArrayTemplate(), {
  4961. stringArrayName: this.stringArrayName,
  4962. stringArray: this.stringArrayStorage.toString()
  4963. });
  4964. }
  4965. }]);
  4966. return StringArrayNode;
  4967. }(AbstractCustomNode_1.AbstractCustomNode);
  4968. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], StringArrayNode.prototype, "stringArrayStorage", void 0);
  4969. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], StringArrayNode.prototype, "stringArrayName", void 0);
  4970. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Number)], StringArrayNode.prototype, "stringArrayRotateValue", void 0);
  4971. StringArrayNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], StringArrayNode);
  4972. exports.StringArrayNode = StringArrayNode;
  4973. /***/ }),
  4974. /* 109 */
  4975. /***/ (function(module, exports, __webpack_require__) {
  4976. "use strict";
  4977. Object.defineProperty(exports, "__esModule", { value: true });
  4978. function StringArrayTemplate() {
  4979. return "\n var {stringArrayName} = [{stringArray}];\n ";
  4980. }
  4981. exports.StringArrayTemplate = StringArrayTemplate;
  4982. /***/ }),
  4983. /* 110 */
  4984. /***/ (function(module, exports, __webpack_require__) {
  4985. "use strict";
  4986. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  4987. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4988. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4989. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4990. Object.defineProperty(exports, "__esModule", { value: true });
  4991. var tslib_1 = __webpack_require__(2);
  4992. var inversify_1 = __webpack_require__(0);
  4993. var ServiceIdentifiers_1 = __webpack_require__(1);
  4994. var format = __webpack_require__(12);
  4995. var Initializable_1 = __webpack_require__(5);
  4996. var NoCustomNodes_1 = __webpack_require__(27);
  4997. var SelfDefendingTemplate_1 = __webpack_require__(111);
  4998. var StringArrayRotateFunctionTemplate_1 = __webpack_require__(112);
  4999. var AbstractCustomNode_1 = __webpack_require__(7);
  5000. var JavaScriptObfuscatorFacade_1 = __webpack_require__(19);
  5001. var NodeUtils_1 = __webpack_require__(3);
  5002. var Utils_1 = __webpack_require__(22);
  5003. var StringArrayRotateFunctionNode = function (_AbstractCustomNode_) {
  5004. _inherits(StringArrayRotateFunctionNode, _AbstractCustomNode_);
  5005. function StringArrayRotateFunctionNode(identifierNamesGeneratorFactory, randomGenerator, escapeSequenceEncoder, options) {
  5006. _classCallCheck(this, StringArrayRotateFunctionNode);
  5007. var _this = _possibleConstructorReturn(this, (StringArrayRotateFunctionNode.__proto__ || Object.getPrototypeOf(StringArrayRotateFunctionNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  5008. _this.escapeSequenceEncoder = escapeSequenceEncoder;
  5009. return _this;
  5010. }
  5011. _createClass(StringArrayRotateFunctionNode, [{
  5012. key: "initialize",
  5013. value: function initialize(stringArrayName, stringArrayRotateValue) {
  5014. this.stringArrayName = stringArrayName;
  5015. this.stringArrayRotateValue = stringArrayRotateValue;
  5016. }
  5017. }, {
  5018. key: "getNodeStructure",
  5019. value: function getNodeStructure() {
  5020. return NodeUtils_1.NodeUtils.convertCodeToStructure(this.getTemplate());
  5021. }
  5022. }, {
  5023. key: "getTemplate",
  5024. value: function getTemplate() {
  5025. var timesName = this.identifierNamesGenerator.generate(6);
  5026. var whileFunctionName = this.identifierNamesGenerator.generate(6);
  5027. var code = '';
  5028. if (this.options.selfDefending) {
  5029. code = format(SelfDefendingTemplate_1.SelfDefendingTemplate(this.escapeSequenceEncoder), {
  5030. timesName: timesName,
  5031. whileFunctionName: whileFunctionName
  5032. });
  5033. } else {
  5034. code = whileFunctionName + "(++" + timesName + ")";
  5035. }
  5036. return JavaScriptObfuscatorFacade_1.JavaScriptObfuscator.obfuscate(format(StringArrayRotateFunctionTemplate_1.StringArrayRotateFunctionTemplate(), {
  5037. code: code,
  5038. timesName: timesName,
  5039. stringArrayName: this.stringArrayName,
  5040. stringArrayRotateValue: Utils_1.Utils.decToHex(this.stringArrayRotateValue),
  5041. whileFunctionName: whileFunctionName
  5042. }), Object.assign({}, NoCustomNodes_1.NO_ADDITIONAL_NODES_PRESET, { identifierNamesGenerator: this.options.identifierNamesGenerator, seed: this.options.seed })).getObfuscatedCode();
  5043. }
  5044. }]);
  5045. return StringArrayRotateFunctionNode;
  5046. }(AbstractCustomNode_1.AbstractCustomNode);
  5047. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], StringArrayRotateFunctionNode.prototype, "stringArrayName", void 0);
  5048. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Number)], StringArrayRotateFunctionNode.prototype, "stringArrayRotateValue", void 0);
  5049. StringArrayRotateFunctionNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IEscapeSequenceEncoder)), tslib_1.__param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object, Object])], StringArrayRotateFunctionNode);
  5050. exports.StringArrayRotateFunctionNode = StringArrayRotateFunctionNode;
  5051. /***/ }),
  5052. /* 111 */
  5053. /***/ (function(module, exports, __webpack_require__) {
  5054. "use strict";
  5055. Object.defineProperty(exports, "__esModule", { value: true });
  5056. function SelfDefendingTemplate(escapeSequenceEncoder) {
  5057. return "\n var selfDefendingFunc = function () {\n var object = {\n data: {\n key: 'cookie',\n value: 'timeout'\n },\n setCookie: function (options, name, value, document) {\n document = document || {};\n \n var updatedCookie = name + \"=\" + value;\n\n var i = 0;\n \n for (var i = 0, len = options.length; i < len; i++) {\n var propName = options[i];\n \n updatedCookie += \"; \" + propName;\n \n var propValue = options[propName];\n \n options.push(propValue);\n len = options.length;\n \n if (propValue !== true) {\n updatedCookie += \"=\" + propValue;\n }\n }\n\n document['cookie'] = updatedCookie;\n },\n removeCookie: function(){return 'dev';},\n getCookie: function (document, name) {\n document = document || function (value) { return value };\n var matches = document(new RegExp(\n \"(?:^|; )\" + name.replace(/([.$?*|{}()[]\\/+^])/g, '\\$1') + \"=([^;]*)\"\n ));\n \n var func = function (param1, param2) {\n param1(++param2);\n };\n \n func({whileFunctionName}, {timesName});\n \n return matches ? decodeURIComponent(matches[1]) : undefined;\n }\n };\n \n var test1 = function () {\n var regExp = new RegExp('" + escapeSequenceEncoder.encode("\\w+ *\\(\\) *{\\w+ *['|\"].+['|\"];? *}", true) + "');\n \n return regExp.test(object.removeCookie.toString());\n };\n \n object['updateCookie'] = test1;\n \n var cookie = '';\n var result = object['updateCookie']();\n \n if (!result) {\n object['setCookie'](['*'], 'counter', 1);\n } else if (result) {\n cookie = object['getCookie'](null, 'counter');\n } else {\n object['removeCookie']();\n }\n };\n \n selfDefendingFunc();\n ";
  5058. }
  5059. exports.SelfDefendingTemplate = SelfDefendingTemplate;
  5060. /***/ }),
  5061. /* 112 */
  5062. /***/ (function(module, exports, __webpack_require__) {
  5063. "use strict";
  5064. Object.defineProperty(exports, "__esModule", { value: true });
  5065. function StringArrayRotateFunctionTemplate() {
  5066. return "\n (function (array, {timesName}) {\n var {whileFunctionName} = function (times) {\n while (--times) {\n array['push'](array['shift']());\n }\n };\n \n {code}\n })({stringArrayName}, 0x{stringArrayRotateValue});\n ";
  5067. }
  5068. exports.StringArrayRotateFunctionTemplate = StringArrayRotateFunctionTemplate;
  5069. /***/ }),
  5070. /* 113 */
  5071. /***/ (function(module, exports, __webpack_require__) {
  5072. "use strict";
  5073. Object.defineProperty(exports, "__esModule", { value: true });
  5074. var JSFuck;
  5075. (function (JSFuck) {
  5076. JSFuck["False"] = "![]";
  5077. JSFuck["True"] = "!![]";
  5078. JSFuck["a"] = "(false+\"\")[1]";
  5079. JSFuck["b"] = "([][\"entries\"]()+\"\")[2]";
  5080. JSFuck["c"] = "([][\"fill\"]+\"\")[3]";
  5081. JSFuck["d"] = "(undefined+\"\")[2]";
  5082. JSFuck["e"] = "(true+\"\")[3]";
  5083. JSFuck["f"] = "(false+\"\")[0]";
  5084. JSFuck["g"] = "(false+[0]+String)[20]";
  5085. JSFuck["h"] = "(+(101))[\"toString\"](21)[1]";
  5086. JSFuck["i"] = "([false]+undefined)[10]";
  5087. JSFuck["j"] = "([][\"entries\"]()+\"\")[3]";
  5088. JSFuck["k"] = "(+(20))[\"toString\"](21)";
  5089. JSFuck["l"] = "(false+\"\")[2]";
  5090. JSFuck["m"] = "(Number+\"\")[11]";
  5091. JSFuck["n"] = "(undefined+\"\")[1]";
  5092. JSFuck["o"] = "(true+[][\"fill\"])[10]";
  5093. JSFuck["p"] = "(+(211))[\"toString\"](31)[1]";
  5094. JSFuck["q"] = "(+(212))[\"toString\"](31)[1]";
  5095. JSFuck["r"] = "(true+\"\")[1]";
  5096. JSFuck["s"] = "(false+\"\")[3]";
  5097. JSFuck["t"] = "(true+\"\")[0]";
  5098. JSFuck["u"] = "(undefined+\"\")[0]";
  5099. JSFuck["v"] = "(+(31))[\"toString\"](32)";
  5100. JSFuck["w"] = "(+(32))[\"toString\"](33)";
  5101. JSFuck["x"] = "(+(101))[\"toString\"](34)[1]";
  5102. JSFuck["y"] = "(NaN+[Infinity])[10]";
  5103. JSFuck["z"] = "(+(35))[\"toString\"](36)";
  5104. JSFuck["A"] = "(+[]+Array)[10]";
  5105. JSFuck["B"] = "(+[]+Boolean)[10]";
  5106. JSFuck["C"] = "Function(\"return escape\")()((\"\")[\"italics\"]())[2]";
  5107. JSFuck["D"] = "Function(\"return escape\")()([][\"fill\"])[\"slice\"](\"-1\")";
  5108. JSFuck["E"] = "(RegExp+\"\")[12]";
  5109. JSFuck["F"] = "(+[]+Function)[10]";
  5110. JSFuck["G"] = "(false+Function(\"return Date\")()())[30]";
  5111. JSFuck["H"] = "'H'";
  5112. JSFuck["I"] = "(Infinity+\"\")[0]";
  5113. JSFuck["J"] = "'J'";
  5114. JSFuck["K"] = "'K'";
  5115. JSFuck["L"] = "'L'";
  5116. JSFuck["M"] = "(true+Function(\"return Date\")()())[30]";
  5117. JSFuck["N"] = "(NaN+\"\")[0]";
  5118. JSFuck["O"] = "(NaN+Function(\"return{}\")())[11]";
  5119. JSFuck["P"] = "'P'";
  5120. JSFuck["Q"] = "'Q'";
  5121. JSFuck["R"] = "(+[]+RegExp)[10]";
  5122. JSFuck["S"] = "(+[]+String)[10]";
  5123. JSFuck["T"] = "(NaN+Function(\"return Date\")()())[30]";
  5124. JSFuck["U"] = "(NaN+Function(\"return{}\")()[\"toString\"][\"call\"]())[11]";
  5125. JSFuck["V"] = "'V'";
  5126. JSFuck["W"] = "'W'";
  5127. JSFuck["X"] = "'X'";
  5128. JSFuck["Y"] = "'Y'";
  5129. JSFuck["Z"] = "'Z'";
  5130. })(JSFuck = exports.JSFuck || (exports.JSFuck = {}));
  5131. /***/ }),
  5132. /* 114 */
  5133. /***/ (function(module, exports, __webpack_require__) {
  5134. "use strict";
  5135. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  5136. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5137. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5138. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5139. Object.defineProperty(exports, "__esModule", { value: true });
  5140. var tslib_1 = __webpack_require__(2);
  5141. var inversify_1 = __webpack_require__(0);
  5142. var ServiceIdentifiers_1 = __webpack_require__(1);
  5143. var Initializable_1 = __webpack_require__(5);
  5144. var AbstractCustomNode_1 = __webpack_require__(7);
  5145. var Nodes_1 = __webpack_require__(9);
  5146. var NodeUtils_1 = __webpack_require__(3);
  5147. var StringLiteralControlFlowStorageCallNode = function (_AbstractCustomNode_) {
  5148. _inherits(StringLiteralControlFlowStorageCallNode, _AbstractCustomNode_);
  5149. function StringLiteralControlFlowStorageCallNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  5150. _classCallCheck(this, StringLiteralControlFlowStorageCallNode);
  5151. return _possibleConstructorReturn(this, (StringLiteralControlFlowStorageCallNode.__proto__ || Object.getPrototypeOf(StringLiteralControlFlowStorageCallNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  5152. }
  5153. _createClass(StringLiteralControlFlowStorageCallNode, [{
  5154. key: "initialize",
  5155. value: function initialize(controlFlowStorageName, controlFlowStorageKey) {
  5156. this.controlFlowStorageName = controlFlowStorageName;
  5157. this.controlFlowStorageKey = controlFlowStorageKey;
  5158. }
  5159. }, {
  5160. key: "getNodeStructure",
  5161. value: function getNodeStructure() {
  5162. var structure = Nodes_1.Nodes.getExpressionStatementNode(Nodes_1.Nodes.getMemberExpressionNode(Nodes_1.Nodes.getIdentifierNode(this.controlFlowStorageName), Nodes_1.Nodes.getIdentifierNode(this.controlFlowStorageKey)));
  5163. NodeUtils_1.NodeUtils.parentize(structure);
  5164. return [structure];
  5165. }
  5166. }]);
  5167. return StringLiteralControlFlowStorageCallNode;
  5168. }(AbstractCustomNode_1.AbstractCustomNode);
  5169. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], StringLiteralControlFlowStorageCallNode.prototype, "controlFlowStorageKey", void 0);
  5170. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], StringLiteralControlFlowStorageCallNode.prototype, "controlFlowStorageName", void 0);
  5171. StringLiteralControlFlowStorageCallNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], StringLiteralControlFlowStorageCallNode);
  5172. exports.StringLiteralControlFlowStorageCallNode = StringLiteralControlFlowStorageCallNode;
  5173. /***/ }),
  5174. /* 115 */
  5175. /***/ (function(module, exports, __webpack_require__) {
  5176. "use strict";
  5177. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  5178. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5179. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5180. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5181. Object.defineProperty(exports, "__esModule", { value: true });
  5182. var tslib_1 = __webpack_require__(2);
  5183. var inversify_1 = __webpack_require__(0);
  5184. var ServiceIdentifiers_1 = __webpack_require__(1);
  5185. var Initializable_1 = __webpack_require__(5);
  5186. var AbstractCustomNode_1 = __webpack_require__(7);
  5187. var Nodes_1 = __webpack_require__(9);
  5188. var StringLiteralNode = function (_AbstractCustomNode_) {
  5189. _inherits(StringLiteralNode, _AbstractCustomNode_);
  5190. function StringLiteralNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  5191. _classCallCheck(this, StringLiteralNode);
  5192. return _possibleConstructorReturn(this, (StringLiteralNode.__proto__ || Object.getPrototypeOf(StringLiteralNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  5193. }
  5194. _createClass(StringLiteralNode, [{
  5195. key: "initialize",
  5196. value: function initialize(literalValue) {
  5197. this.literalValue = literalValue;
  5198. }
  5199. }, {
  5200. key: "getNodeStructure",
  5201. value: function getNodeStructure() {
  5202. var structure = Nodes_1.Nodes.getLiteralNode(this.literalValue);
  5203. return [structure];
  5204. }
  5205. }]);
  5206. return StringLiteralNode;
  5207. }(AbstractCustomNode_1.AbstractCustomNode);
  5208. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], StringLiteralNode.prototype, "literalValue", void 0);
  5209. StringLiteralNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], StringLiteralNode);
  5210. exports.StringLiteralNode = StringLiteralNode;
  5211. /***/ }),
  5212. /* 116 */
  5213. /***/ (function(module, exports, __webpack_require__) {
  5214. "use strict";
  5215. Object.defineProperty(exports, "__esModule", { value: true });
  5216. var inversify_1 = __webpack_require__(0);
  5217. exports.finalizingTransformersModule = new inversify_1.ContainerModule(function (bind) {});
  5218. /***/ }),
  5219. /* 117 */
  5220. /***/ (function(module, exports, __webpack_require__) {
  5221. "use strict";
  5222. Object.defineProperty(exports, "__esModule", { value: true });
  5223. var inversify_1 = __webpack_require__(0);
  5224. var ServiceIdentifiers_1 = __webpack_require__(1);
  5225. var IdentifierNamesGenerator_1 = __webpack_require__(24);
  5226. var HexadecimalIdentifierNamesGenerator_1 = __webpack_require__(118);
  5227. var MangledIdentifierNamesGenerator_1 = __webpack_require__(119);
  5228. exports.generatorsModule = new inversify_1.ContainerModule(function (bind) {
  5229. bind(ServiceIdentifiers_1.ServiceIdentifiers.IIdentifierNamesGenerator).to(HexadecimalIdentifierNamesGenerator_1.HexadecimalIdentifierNamesGenerator).inSingletonScope().whenTargetNamed(IdentifierNamesGenerator_1.IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator);
  5230. bind(ServiceIdentifiers_1.ServiceIdentifiers.IIdentifierNamesGenerator).to(MangledIdentifierNamesGenerator_1.MangledIdentifierNamesGenerator).inSingletonScope().whenTargetNamed(IdentifierNamesGenerator_1.IdentifierNamesGenerator.MangledIdentifierNamesGenerator);
  5231. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator).toFactory(function (context) {
  5232. var cachedIdentifierNamesGenerator = null;
  5233. return function (options) {
  5234. if (cachedIdentifierNamesGenerator) {
  5235. return cachedIdentifierNamesGenerator;
  5236. }
  5237. var identifierNamesGenerator = void 0;
  5238. switch (options.identifierNamesGenerator) {
  5239. case IdentifierNamesGenerator_1.IdentifierNamesGenerator.MangledIdentifierNamesGenerator:
  5240. identifierNamesGenerator = context.container.getNamed(ServiceIdentifiers_1.ServiceIdentifiers.IIdentifierNamesGenerator, IdentifierNamesGenerator_1.IdentifierNamesGenerator.MangledIdentifierNamesGenerator);
  5241. break;
  5242. case IdentifierNamesGenerator_1.IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator:
  5243. default:
  5244. identifierNamesGenerator = context.container.getNamed(ServiceIdentifiers_1.ServiceIdentifiers.IIdentifierNamesGenerator, IdentifierNamesGenerator_1.IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator);
  5245. }
  5246. cachedIdentifierNamesGenerator = identifierNamesGenerator;
  5247. return identifierNamesGenerator;
  5248. };
  5249. });
  5250. });
  5251. /***/ }),
  5252. /* 118 */
  5253. /***/ (function(module, exports, __webpack_require__) {
  5254. "use strict";
  5255. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  5256. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5257. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5258. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5259. Object.defineProperty(exports, "__esModule", { value: true });
  5260. var tslib_1 = __webpack_require__(2);
  5261. var inversify_1 = __webpack_require__(0);
  5262. var ServiceIdentifiers_1 = __webpack_require__(1);
  5263. var AbstractIdentifierNamesGenerator_1 = __webpack_require__(42);
  5264. var Utils_1 = __webpack_require__(22);
  5265. var HexadecimalIdentifierNamesGenerator = function (_AbstractIdentifierNa) {
  5266. _inherits(HexadecimalIdentifierNamesGenerator, _AbstractIdentifierNa);
  5267. function HexadecimalIdentifierNamesGenerator(randomGenerator, options) {
  5268. _classCallCheck(this, HexadecimalIdentifierNamesGenerator);
  5269. var _this = _possibleConstructorReturn(this, (HexadecimalIdentifierNamesGenerator.__proto__ || Object.getPrototypeOf(HexadecimalIdentifierNamesGenerator)).call(this, randomGenerator, options));
  5270. _this.randomVariableNameSet = new Set();
  5271. return _this;
  5272. }
  5273. _createClass(HexadecimalIdentifierNamesGenerator, [{
  5274. key: "generate",
  5275. value: function generate(length) {
  5276. var prefix = "_" + Utils_1.Utils.hexadecimalPrefix;
  5277. var rangeMinInteger = 10000;
  5278. var rangeMaxInteger = 99999999;
  5279. var randomInteger = this.randomGenerator.getRandomInteger(rangeMinInteger, rangeMaxInteger);
  5280. var hexadecimalNumber = Utils_1.Utils.decToHex(randomInteger);
  5281. var randomVariableName = "" + prefix + hexadecimalNumber.substr(0, length);
  5282. if (this.randomVariableNameSet.has(randomVariableName)) {
  5283. return this.generate(length);
  5284. }
  5285. this.randomVariableNameSet.add(randomVariableName);
  5286. return randomVariableName;
  5287. }
  5288. }]);
  5289. return HexadecimalIdentifierNamesGenerator;
  5290. }(AbstractIdentifierNamesGenerator_1.AbstractIdentifierNamesGenerator);
  5291. HexadecimalIdentifierNamesGenerator = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], HexadecimalIdentifierNamesGenerator);
  5292. exports.HexadecimalIdentifierNamesGenerator = HexadecimalIdentifierNamesGenerator;
  5293. /***/ }),
  5294. /* 119 */
  5295. /***/ (function(module, exports, __webpack_require__) {
  5296. "use strict";
  5297. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  5298. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5299. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5300. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5301. Object.defineProperty(exports, "__esModule", { value: true });
  5302. var tslib_1 = __webpack_require__(2);
  5303. var inversify_1 = __webpack_require__(0);
  5304. var ServiceIdentifiers_1 = __webpack_require__(1);
  5305. var AbstractIdentifierNamesGenerator_1 = __webpack_require__(42);
  5306. var MangledIdentifierNamesGenerator = MangledIdentifierNamesGenerator_1 = function (_AbstractIdentifierNa) {
  5307. _inherits(MangledIdentifierNamesGenerator, _AbstractIdentifierNa);
  5308. function MangledIdentifierNamesGenerator(randomGenerator, options) {
  5309. _classCallCheck(this, MangledIdentifierNamesGenerator);
  5310. var _this = _possibleConstructorReturn(this, (MangledIdentifierNamesGenerator.__proto__ || Object.getPrototypeOf(MangledIdentifierNamesGenerator)).call(this, randomGenerator, options));
  5311. _this.previousMangledName = MangledIdentifierNamesGenerator_1.initMangledNameCharacter;
  5312. return _this;
  5313. }
  5314. _createClass(MangledIdentifierNamesGenerator, [{
  5315. key: "generate",
  5316. value: function generate(length) {
  5317. var newName = MangledIdentifierNamesGenerator_1.generateNewMangledName(this.previousMangledName);
  5318. this.previousMangledName = newName;
  5319. return newName;
  5320. }
  5321. }], [{
  5322. key: "generateNewMangledName",
  5323. value: function generateNewMangledName(previousMangledName) {
  5324. var generateNewMangledName = function generateNewMangledName(name) {
  5325. var nameSequence = MangledIdentifierNamesGenerator_1.nameSequence;
  5326. var zeroSequenceCache = [];
  5327. var nameLength = name.length;
  5328. var zeroSequence = function zeroSequence(num) {
  5329. var result = zeroSequenceCache[num];
  5330. if (result !== undefined) {
  5331. return result;
  5332. }
  5333. result = '0'.repeat(num);
  5334. zeroSequenceCache[num] = result;
  5335. return result;
  5336. };
  5337. var index = nameLength - 1;
  5338. do {
  5339. var character = name.charAt(index);
  5340. var indexInSequence = nameSequence.indexOf(character);
  5341. var lastNameSequenceIndex = nameSequence.length - 1;
  5342. if (indexInSequence !== lastNameSequenceIndex) {
  5343. var previousNamePart = name.substring(0, index);
  5344. var nextCharacter = nameSequence[indexInSequence + 1];
  5345. var zeroSequenceCharacters = zeroSequence(nameLength - (index + 1));
  5346. return previousNamePart + nextCharacter + zeroSequenceCharacters;
  5347. }
  5348. --index;
  5349. } while (index >= 0);
  5350. return "a" + zeroSequence(nameLength);
  5351. };
  5352. var newMangledName = generateNewMangledName(previousMangledName);
  5353. if (!MangledIdentifierNamesGenerator_1.validateMangledName(newMangledName)) {
  5354. newMangledName = MangledIdentifierNamesGenerator_1.generateNewMangledName(newMangledName);
  5355. }
  5356. return newMangledName;
  5357. }
  5358. }, {
  5359. key: "validateMangledName",
  5360. value: function validateMangledName(mangledName) {
  5361. return !(MangledIdentifierNamesGenerator_1.reservedNames.indexOf(mangledName) !== -1);
  5362. }
  5363. }]);
  5364. return MangledIdentifierNamesGenerator;
  5365. }(AbstractIdentifierNamesGenerator_1.AbstractIdentifierNamesGenerator);
  5366. MangledIdentifierNamesGenerator.initMangledNameCharacter = '9';
  5367. MangledIdentifierNamesGenerator.nameSequence = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
  5368. MangledIdentifierNamesGenerator.reservedNames = ['byte', 'case', 'char', 'do', 'else', 'enum', 'eval', 'for', 'goto', 'if', 'in', 'int', 'let', 'long', 'new', 'null', 'this', 'true', 'try', 'var', 'void', 'with'];
  5369. MangledIdentifierNamesGenerator = MangledIdentifierNamesGenerator_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], MangledIdentifierNamesGenerator);
  5370. exports.MangledIdentifierNamesGenerator = MangledIdentifierNamesGenerator;
  5371. var MangledIdentifierNamesGenerator_1;
  5372. /***/ }),
  5373. /* 120 */
  5374. /***/ (function(module, exports, __webpack_require__) {
  5375. "use strict";
  5376. Object.defineProperty(exports, "__esModule", { value: true });
  5377. var InversifyContainerFacade_1 = __webpack_require__(15);
  5378. var inversify_1 = __webpack_require__(0);
  5379. var ServiceIdentifiers_1 = __webpack_require__(1);
  5380. exports.nodeTransformersModule = new inversify_1.ContainerModule(function (bind) {
  5381. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__INodeTransformer).toFactory(InversifyContainerFacade_1.InversifyContainerFacade.getCacheFactory(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer));
  5382. });
  5383. /***/ }),
  5384. /* 121 */
  5385. /***/ (function(module, exports, __webpack_require__) {
  5386. "use strict";
  5387. Object.defineProperty(exports, "__esModule", { value: true });
  5388. var InversifyContainerFacade_1 = __webpack_require__(15);
  5389. var inversify_1 = __webpack_require__(0);
  5390. var ServiceIdentifiers_1 = __webpack_require__(1);
  5391. var IdentifierObfuscatingReplacer_1 = __webpack_require__(18);
  5392. var LiteralObfuscatingReplacer_1 = __webpack_require__(43);
  5393. var NodeTransformer_1 = __webpack_require__(20);
  5394. var BaseIdentifierObfuscatingReplacer_1 = __webpack_require__(122);
  5395. var BooleanLiteralObfuscatingReplacer_1 = __webpack_require__(123);
  5396. var CatchClauseTransformer_1 = __webpack_require__(124);
  5397. var ClassDeclarationTransformer_1 = __webpack_require__(125);
  5398. var FunctionDeclarationTransformer_1 = __webpack_require__(126);
  5399. var FunctionTransformer_1 = __webpack_require__(127);
  5400. var LabeledStatementTransformer_1 = __webpack_require__(128);
  5401. var LiteralTransformer_1 = __webpack_require__(129);
  5402. var NumberLiteralObfuscatingReplacer_1 = __webpack_require__(130);
  5403. var ObjectExpressionTransformer_1 = __webpack_require__(131);
  5404. var StringLiteralObfuscatingReplacer_1 = __webpack_require__(132);
  5405. var VariableDeclarationTransformer_1 = __webpack_require__(133);
  5406. exports.obfuscatingTransformersModule = new inversify_1.ContainerModule(function (bind) {
  5407. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(CatchClauseTransformer_1.CatchClauseTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.CatchClauseTransformer);
  5408. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(ClassDeclarationTransformer_1.ClassDeclarationTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.ClassDeclarationTransformer);
  5409. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(FunctionDeclarationTransformer_1.FunctionDeclarationTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.FunctionDeclarationTransformer);
  5410. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(FunctionTransformer_1.FunctionTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.FunctionTransformer);
  5411. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(LabeledStatementTransformer_1.LabeledStatementTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.LabeledStatementTransformer);
  5412. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(LiteralTransformer_1.LiteralTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.LiteralTransformer);
  5413. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(ObjectExpressionTransformer_1.ObjectExpressionTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.ObjectExpressionTransformer);
  5414. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(VariableDeclarationTransformer_1.VariableDeclarationTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.VariableDeclarationTransformer);
  5415. bind(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscatingReplacer).to(BooleanLiteralObfuscatingReplacer_1.BooleanLiteralObfuscatingReplacer).whenTargetNamed(LiteralObfuscatingReplacer_1.LiteralObfuscatingReplacer.BooleanLiteralObfuscatingReplacer);
  5416. bind(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscatingReplacer).to(NumberLiteralObfuscatingReplacer_1.NumberLiteralObfuscatingReplacer).whenTargetNamed(LiteralObfuscatingReplacer_1.LiteralObfuscatingReplacer.NumberLiteralObfuscatingReplacer);
  5417. bind(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscatingReplacer).to(StringLiteralObfuscatingReplacer_1.StringLiteralObfuscatingReplacer).whenTargetNamed(LiteralObfuscatingReplacer_1.LiteralObfuscatingReplacer.StringLiteralObfuscatingReplacer);
  5418. bind(ServiceIdentifiers_1.ServiceIdentifiers.IIdentifierObfuscatingReplacer).to(BaseIdentifierObfuscatingReplacer_1.BaseIdentifierObfuscatingReplacer).whenTargetNamed(IdentifierObfuscatingReplacer_1.IdentifierObfuscatingReplacer.BaseIdentifierObfuscatingReplacer);
  5419. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObfuscatingReplacer).toFactory(InversifyContainerFacade_1.InversifyContainerFacade.getCacheFactory(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscatingReplacer));
  5420. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierObfuscatingReplacer).toFactory(InversifyContainerFacade_1.InversifyContainerFacade.getCacheFactory(ServiceIdentifiers_1.ServiceIdentifiers.IIdentifierObfuscatingReplacer));
  5421. });
  5422. /***/ }),
  5423. /* 122 */
  5424. /***/ (function(module, exports, __webpack_require__) {
  5425. "use strict";
  5426. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  5427. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5428. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5429. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5430. Object.defineProperty(exports, "__esModule", { value: true });
  5431. var tslib_1 = __webpack_require__(2);
  5432. var inversify_1 = __webpack_require__(0);
  5433. var ServiceIdentifiers_1 = __webpack_require__(1);
  5434. var AbstractObfuscatingReplacer_1 = __webpack_require__(28);
  5435. var Nodes_1 = __webpack_require__(9);
  5436. var BaseIdentifierObfuscatingReplacer = function (_AbstractObfuscatingR) {
  5437. _inherits(BaseIdentifierObfuscatingReplacer, _AbstractObfuscatingR);
  5438. function BaseIdentifierObfuscatingReplacer(identifierNamesGeneratorFactory, options) {
  5439. _classCallCheck(this, BaseIdentifierObfuscatingReplacer);
  5440. var _this = _possibleConstructorReturn(this, (BaseIdentifierObfuscatingReplacer.__proto__ || Object.getPrototypeOf(BaseIdentifierObfuscatingReplacer)).call(this, options));
  5441. _this.namesMap = new Map();
  5442. _this.identifierNamesGenerator = identifierNamesGeneratorFactory(options);
  5443. return _this;
  5444. }
  5445. _createClass(BaseIdentifierObfuscatingReplacer, [{
  5446. key: "replace",
  5447. value: function replace(nodeValue, nodeIdentifier) {
  5448. var mapKey = nodeValue + "-" + String(nodeIdentifier);
  5449. if (this.namesMap.has(mapKey)) {
  5450. nodeValue = this.namesMap.get(mapKey);
  5451. }
  5452. return Nodes_1.Nodes.getIdentifierNode(nodeValue);
  5453. }
  5454. }, {
  5455. key: "storeNames",
  5456. value: function storeNames(nodeName, nodeIdentifier) {
  5457. if (this.isReservedName(nodeName)) {
  5458. return;
  5459. }
  5460. this.namesMap.set(nodeName + "-" + String(nodeIdentifier), this.identifierNamesGenerator.generate(6));
  5461. }
  5462. }, {
  5463. key: "isReservedName",
  5464. value: function isReservedName(name) {
  5465. return this.options.reservedNames.some(function (reservedName) {
  5466. return new RegExp(reservedName, 'g').exec(name) !== null;
  5467. });
  5468. }
  5469. }]);
  5470. return BaseIdentifierObfuscatingReplacer;
  5471. }(AbstractObfuscatingReplacer_1.AbstractObfuscatingReplacer);
  5472. BaseIdentifierObfuscatingReplacer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object])], BaseIdentifierObfuscatingReplacer);
  5473. exports.BaseIdentifierObfuscatingReplacer = BaseIdentifierObfuscatingReplacer;
  5474. /***/ }),
  5475. /* 123 */
  5476. /***/ (function(module, exports, __webpack_require__) {
  5477. "use strict";
  5478. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  5479. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5480. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5481. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5482. Object.defineProperty(exports, "__esModule", { value: true });
  5483. var tslib_1 = __webpack_require__(2);
  5484. var inversify_1 = __webpack_require__(0);
  5485. var ServiceIdentifiers_1 = __webpack_require__(1);
  5486. var AbstractObfuscatingReplacer_1 = __webpack_require__(28);
  5487. var Nodes_1 = __webpack_require__(9);
  5488. var BooleanLiteralObfuscatingReplacer = BooleanLiteralObfuscatingReplacer_1 = function (_AbstractObfuscatingR) {
  5489. _inherits(BooleanLiteralObfuscatingReplacer, _AbstractObfuscatingR);
  5490. function BooleanLiteralObfuscatingReplacer(options) {
  5491. _classCallCheck(this, BooleanLiteralObfuscatingReplacer);
  5492. return _possibleConstructorReturn(this, (BooleanLiteralObfuscatingReplacer.__proto__ || Object.getPrototypeOf(BooleanLiteralObfuscatingReplacer)).call(this, options));
  5493. }
  5494. _createClass(BooleanLiteralObfuscatingReplacer, [{
  5495. key: "replace",
  5496. value: function replace(nodeValue) {
  5497. return nodeValue ? BooleanLiteralObfuscatingReplacer_1.getTrueUnaryExpressionNode() : BooleanLiteralObfuscatingReplacer_1.getFalseUnaryExpressionNode();
  5498. }
  5499. }], [{
  5500. key: "getTrueUnaryExpressionNode",
  5501. value: function getTrueUnaryExpressionNode() {
  5502. return Nodes_1.Nodes.getUnaryExpressionNode('!', BooleanLiteralObfuscatingReplacer_1.getFalseUnaryExpressionNode());
  5503. }
  5504. }, {
  5505. key: "getFalseUnaryExpressionNode",
  5506. value: function getFalseUnaryExpressionNode() {
  5507. return Nodes_1.Nodes.getUnaryExpressionNode('!', Nodes_1.Nodes.getArrayExpressionNode());
  5508. }
  5509. }]);
  5510. return BooleanLiteralObfuscatingReplacer;
  5511. }(AbstractObfuscatingReplacer_1.AbstractObfuscatingReplacer);
  5512. BooleanLiteralObfuscatingReplacer = BooleanLiteralObfuscatingReplacer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object])], BooleanLiteralObfuscatingReplacer);
  5513. exports.BooleanLiteralObfuscatingReplacer = BooleanLiteralObfuscatingReplacer;
  5514. var BooleanLiteralObfuscatingReplacer_1;
  5515. /***/ }),
  5516. /* 124 */
  5517. /***/ (function(module, exports, __webpack_require__) {
  5518. "use strict";
  5519. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  5520. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5521. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5522. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5523. Object.defineProperty(exports, "__esModule", { value: true });
  5524. var tslib_1 = __webpack_require__(2);
  5525. var inversify_1 = __webpack_require__(0);
  5526. var ServiceIdentifiers_1 = __webpack_require__(1);
  5527. var estraverse = __webpack_require__(10);
  5528. var IdentifierObfuscatingReplacer_1 = __webpack_require__(18);
  5529. var TransformationStage_1 = __webpack_require__(6);
  5530. var AbstractNodeTransformer_1 = __webpack_require__(8);
  5531. var NodeGuards_1 = __webpack_require__(4);
  5532. var CatchClauseTransformer = function (_AbstractNodeTransfor) {
  5533. _inherits(CatchClauseTransformer, _AbstractNodeTransfor);
  5534. function CatchClauseTransformer(identifierObfuscatingReplacerFactory, randomGenerator, options) {
  5535. _classCallCheck(this, CatchClauseTransformer);
  5536. var _this = _possibleConstructorReturn(this, (CatchClauseTransformer.__proto__ || Object.getPrototypeOf(CatchClauseTransformer)).call(this, randomGenerator, options));
  5537. _this.identifierObfuscatingReplacer = identifierObfuscatingReplacerFactory(IdentifierObfuscatingReplacer_1.IdentifierObfuscatingReplacer.BaseIdentifierObfuscatingReplacer);
  5538. return _this;
  5539. }
  5540. _createClass(CatchClauseTransformer, [{
  5541. key: "getVisitor",
  5542. value: function getVisitor(transformationStage) {
  5543. var _this2 = this;
  5544. switch (transformationStage) {
  5545. case TransformationStage_1.TransformationStage.Obfuscating:
  5546. return {
  5547. enter: function enter(node, parentNode) {
  5548. if (parentNode && NodeGuards_1.NodeGuards.isCatchClauseNode(node)) {
  5549. return _this2.transformNode(node, parentNode);
  5550. }
  5551. }
  5552. };
  5553. default:
  5554. return null;
  5555. }
  5556. }
  5557. }, {
  5558. key: "transformNode",
  5559. value: function transformNode(catchClauseNode, parentNode) {
  5560. var nodeIdentifier = this.nodeIdentifier++;
  5561. this.storeCatchClauseParam(catchClauseNode, nodeIdentifier);
  5562. this.replaceCatchClauseParam(catchClauseNode, nodeIdentifier);
  5563. return catchClauseNode;
  5564. }
  5565. }, {
  5566. key: "storeCatchClauseParam",
  5567. value: function storeCatchClauseParam(catchClauseNode, nodeIdentifier) {
  5568. if (NodeGuards_1.NodeGuards.isIdentifierNode(catchClauseNode.param)) {
  5569. this.identifierObfuscatingReplacer.storeNames(catchClauseNode.param.name, nodeIdentifier);
  5570. }
  5571. }
  5572. }, {
  5573. key: "replaceCatchClauseParam",
  5574. value: function replaceCatchClauseParam(catchClauseNode, nodeIdentifier) {
  5575. var _this3 = this;
  5576. estraverse.replace(catchClauseNode, {
  5577. enter: function enter(node, parentNode) {
  5578. if (parentNode && NodeGuards_1.NodeGuards.isReplaceableIdentifierNode(node, parentNode)) {
  5579. var newIdentifier = _this3.identifierObfuscatingReplacer.replace(node.name, nodeIdentifier);
  5580. var newIdentifierName = newIdentifier.name;
  5581. if (node.name !== newIdentifierName) {
  5582. node.name = newIdentifierName;
  5583. node.obfuscatedNode = true;
  5584. }
  5585. }
  5586. }
  5587. });
  5588. }
  5589. }]);
  5590. return CatchClauseTransformer;
  5591. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  5592. CatchClauseTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierObfuscatingReplacer)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], CatchClauseTransformer);
  5593. exports.CatchClauseTransformer = CatchClauseTransformer;
  5594. /***/ }),
  5595. /* 125 */
  5596. /***/ (function(module, exports, __webpack_require__) {
  5597. "use strict";
  5598. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  5599. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5600. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5601. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5602. Object.defineProperty(exports, "__esModule", { value: true });
  5603. var tslib_1 = __webpack_require__(2);
  5604. var inversify_1 = __webpack_require__(0);
  5605. var ServiceIdentifiers_1 = __webpack_require__(1);
  5606. var estraverse = __webpack_require__(10);
  5607. var IdentifierObfuscatingReplacer_1 = __webpack_require__(18);
  5608. var NodeType_1 = __webpack_require__(11);
  5609. var TransformationStage_1 = __webpack_require__(6);
  5610. var AbstractNodeTransformer_1 = __webpack_require__(8);
  5611. var NodeGuards_1 = __webpack_require__(4);
  5612. var NodeUtils_1 = __webpack_require__(3);
  5613. var ClassDeclarationTransformer = function (_AbstractNodeTransfor) {
  5614. _inherits(ClassDeclarationTransformer, _AbstractNodeTransfor);
  5615. function ClassDeclarationTransformer(identifierObfuscatingReplacerFactory, randomGenerator, options) {
  5616. _classCallCheck(this, ClassDeclarationTransformer);
  5617. var _this = _possibleConstructorReturn(this, (ClassDeclarationTransformer.__proto__ || Object.getPrototypeOf(ClassDeclarationTransformer)).call(this, randomGenerator, options));
  5618. _this.replaceableIdentifiers = new Map();
  5619. _this.identifierObfuscatingReplacer = identifierObfuscatingReplacerFactory(IdentifierObfuscatingReplacer_1.IdentifierObfuscatingReplacer.BaseIdentifierObfuscatingReplacer);
  5620. return _this;
  5621. }
  5622. _createClass(ClassDeclarationTransformer, [{
  5623. key: "getVisitor",
  5624. value: function getVisitor(transformationStage) {
  5625. var _this2 = this;
  5626. switch (transformationStage) {
  5627. case TransformationStage_1.TransformationStage.Obfuscating:
  5628. return {
  5629. enter: function enter(node, parentNode) {
  5630. if (parentNode && NodeGuards_1.NodeGuards.isClassDeclarationNode(node)) {
  5631. return _this2.transformNode(node, parentNode);
  5632. }
  5633. }
  5634. };
  5635. default:
  5636. return null;
  5637. }
  5638. }
  5639. }, {
  5640. key: "transformNode",
  5641. value: function transformNode(classDeclarationNode, parentNode) {
  5642. var nodeIdentifier = this.nodeIdentifier++;
  5643. var blockScopeNode = NodeUtils_1.NodeUtils.getBlockScopesOfNode(classDeclarationNode)[0];
  5644. if (!this.options.renameGlobals && blockScopeNode.type === NodeType_1.NodeType.Program) {
  5645. return classDeclarationNode;
  5646. }
  5647. this.storeClassName(classDeclarationNode, nodeIdentifier);
  5648. if (this.replaceableIdentifiers.has(blockScopeNode)) {
  5649. this.replaceScopeCachedIdentifiers(blockScopeNode, nodeIdentifier);
  5650. } else {
  5651. this.replaceScopeIdentifiers(blockScopeNode, nodeIdentifier);
  5652. }
  5653. return classDeclarationNode;
  5654. }
  5655. }, {
  5656. key: "storeClassName",
  5657. value: function storeClassName(classDeclarationNode, nodeIdentifier) {
  5658. this.identifierObfuscatingReplacer.storeNames(classDeclarationNode.id.name, nodeIdentifier);
  5659. }
  5660. }, {
  5661. key: "replaceScopeCachedIdentifiers",
  5662. value: function replaceScopeCachedIdentifiers(blockScopeNode, nodeIdentifier) {
  5663. var _this3 = this;
  5664. var cachedReplaceableIdentifiers = this.replaceableIdentifiers.get(blockScopeNode);
  5665. cachedReplaceableIdentifiers.forEach(function (replaceableIdentifier) {
  5666. var newReplaceableIdentifier = _this3.identifierObfuscatingReplacer.replace(replaceableIdentifier.name, nodeIdentifier);
  5667. replaceableIdentifier.name = newReplaceableIdentifier.name;
  5668. });
  5669. }
  5670. }, {
  5671. key: "replaceScopeIdentifiers",
  5672. value: function replaceScopeIdentifiers(blockScopeNode, nodeIdentifier) {
  5673. var _this4 = this;
  5674. var storedReplaceableIdentifiers = [];
  5675. estraverse.replace(blockScopeNode, {
  5676. enter: function enter(node, parentNode) {
  5677. if (parentNode && NodeGuards_1.NodeGuards.isReplaceableIdentifierNode(node, parentNode)) {
  5678. var newIdentifier = _this4.identifierObfuscatingReplacer.replace(node.name, nodeIdentifier);
  5679. var newIdentifierName = newIdentifier.name;
  5680. if (node.name !== newIdentifierName) {
  5681. node.name = newIdentifierName;
  5682. } else {
  5683. storedReplaceableIdentifiers.push(node);
  5684. }
  5685. }
  5686. }
  5687. });
  5688. this.replaceableIdentifiers.set(blockScopeNode, storedReplaceableIdentifiers);
  5689. }
  5690. }]);
  5691. return ClassDeclarationTransformer;
  5692. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  5693. ClassDeclarationTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierObfuscatingReplacer)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], ClassDeclarationTransformer);
  5694. exports.ClassDeclarationTransformer = ClassDeclarationTransformer;
  5695. /***/ }),
  5696. /* 126 */
  5697. /***/ (function(module, exports, __webpack_require__) {
  5698. "use strict";
  5699. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  5700. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5701. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5702. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5703. Object.defineProperty(exports, "__esModule", { value: true });
  5704. var tslib_1 = __webpack_require__(2);
  5705. var inversify_1 = __webpack_require__(0);
  5706. var ServiceIdentifiers_1 = __webpack_require__(1);
  5707. var estraverse = __webpack_require__(10);
  5708. var IdentifierObfuscatingReplacer_1 = __webpack_require__(18);
  5709. var NodeType_1 = __webpack_require__(11);
  5710. var TransformationStage_1 = __webpack_require__(6);
  5711. var AbstractNodeTransformer_1 = __webpack_require__(8);
  5712. var NodeGuards_1 = __webpack_require__(4);
  5713. var NodeUtils_1 = __webpack_require__(3);
  5714. var FunctionDeclarationTransformer = function (_AbstractNodeTransfor) {
  5715. _inherits(FunctionDeclarationTransformer, _AbstractNodeTransfor);
  5716. function FunctionDeclarationTransformer(identifierObfuscatingReplacerFactory, randomGenerator, options) {
  5717. _classCallCheck(this, FunctionDeclarationTransformer);
  5718. var _this = _possibleConstructorReturn(this, (FunctionDeclarationTransformer.__proto__ || Object.getPrototypeOf(FunctionDeclarationTransformer)).call(this, randomGenerator, options));
  5719. _this.replaceableIdentifiers = new Map();
  5720. _this.identifierObfuscatingReplacer = identifierObfuscatingReplacerFactory(IdentifierObfuscatingReplacer_1.IdentifierObfuscatingReplacer.BaseIdentifierObfuscatingReplacer);
  5721. return _this;
  5722. }
  5723. _createClass(FunctionDeclarationTransformer, [{
  5724. key: "getVisitor",
  5725. value: function getVisitor(transformationStage) {
  5726. var _this2 = this;
  5727. switch (transformationStage) {
  5728. case TransformationStage_1.TransformationStage.Obfuscating:
  5729. return {
  5730. enter: function enter(node, parentNode) {
  5731. if (parentNode && NodeGuards_1.NodeGuards.isFunctionDeclarationNode(node)) {
  5732. return _this2.transformNode(node, parentNode);
  5733. }
  5734. }
  5735. };
  5736. default:
  5737. return null;
  5738. }
  5739. }
  5740. }, {
  5741. key: "transformNode",
  5742. value: function transformNode(functionDeclarationNode, parentNode) {
  5743. var nodeIdentifier = this.nodeIdentifier++;
  5744. var blockScopeNode = NodeUtils_1.NodeUtils.getBlockScopesOfNode(functionDeclarationNode)[0];
  5745. if (!this.options.renameGlobals && blockScopeNode.type === NodeType_1.NodeType.Program) {
  5746. return functionDeclarationNode;
  5747. }
  5748. this.storeFunctionName(functionDeclarationNode, nodeIdentifier);
  5749. if (this.replaceableIdentifiers.has(blockScopeNode)) {
  5750. this.replaceScopeCachedIdentifiers(functionDeclarationNode, blockScopeNode, nodeIdentifier);
  5751. } else {
  5752. this.replaceScopeIdentifiers(blockScopeNode, nodeIdentifier);
  5753. }
  5754. return functionDeclarationNode;
  5755. }
  5756. }, {
  5757. key: "storeFunctionName",
  5758. value: function storeFunctionName(functionDeclarationNode, nodeIdentifier) {
  5759. this.identifierObfuscatingReplacer.storeNames(functionDeclarationNode.id.name, nodeIdentifier);
  5760. }
  5761. }, {
  5762. key: "replaceScopeCachedIdentifiers",
  5763. value: function replaceScopeCachedIdentifiers(functionDeclarationNode, blockScopeNode, nodeIdentifier) {
  5764. var cachedReplaceableIdentifiersNamesMap = this.replaceableIdentifiers.get(blockScopeNode);
  5765. if (!cachedReplaceableIdentifiersNamesMap) {
  5766. return;
  5767. }
  5768. var cachedReplaceableIdentifiers = cachedReplaceableIdentifiersNamesMap.get(functionDeclarationNode.id.name);
  5769. if (!cachedReplaceableIdentifiers) {
  5770. return;
  5771. }
  5772. var cachedReplaceableIdentifierLength = cachedReplaceableIdentifiers.length;
  5773. for (var i = 0; i < cachedReplaceableIdentifierLength; i++) {
  5774. var replaceableIdentifier = cachedReplaceableIdentifiers[i];
  5775. var newReplaceableIdentifier = this.identifierObfuscatingReplacer.replace(replaceableIdentifier.name, nodeIdentifier);
  5776. replaceableIdentifier.name = newReplaceableIdentifier.name;
  5777. }
  5778. }
  5779. }, {
  5780. key: "replaceScopeIdentifiers",
  5781. value: function replaceScopeIdentifiers(blockScopeNode, nodeIdentifier) {
  5782. var _this3 = this;
  5783. var storedReplaceableIdentifiersNamesMap = new Map();
  5784. estraverse.replace(blockScopeNode, {
  5785. enter: function enter(node, parentNode) {
  5786. if (parentNode && NodeGuards_1.NodeGuards.isReplaceableIdentifierNode(node, parentNode)) {
  5787. var newIdentifier = _this3.identifierObfuscatingReplacer.replace(node.name, nodeIdentifier);
  5788. var newIdentifierName = newIdentifier.name;
  5789. if (node.name !== newIdentifierName) {
  5790. node.name = newIdentifierName;
  5791. } else {
  5792. var storedReplaceableIdentifiers = storedReplaceableIdentifiersNamesMap.get(node.name) || [];
  5793. storedReplaceableIdentifiers.push(node);
  5794. storedReplaceableIdentifiersNamesMap.set(node.name, storedReplaceableIdentifiers);
  5795. }
  5796. }
  5797. }
  5798. });
  5799. this.replaceableIdentifiers.set(blockScopeNode, storedReplaceableIdentifiersNamesMap);
  5800. }
  5801. }]);
  5802. return FunctionDeclarationTransformer;
  5803. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  5804. FunctionDeclarationTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierObfuscatingReplacer)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], FunctionDeclarationTransformer);
  5805. exports.FunctionDeclarationTransformer = FunctionDeclarationTransformer;
  5806. /***/ }),
  5807. /* 127 */
  5808. /***/ (function(module, exports, __webpack_require__) {
  5809. "use strict";
  5810. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  5811. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5812. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5813. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5814. Object.defineProperty(exports, "__esModule", { value: true });
  5815. var tslib_1 = __webpack_require__(2);
  5816. var inversify_1 = __webpack_require__(0);
  5817. var ServiceIdentifiers_1 = __webpack_require__(1);
  5818. var estraverse = __webpack_require__(10);
  5819. var IdentifierObfuscatingReplacer_1 = __webpack_require__(18);
  5820. var TransformationStage_1 = __webpack_require__(6);
  5821. var AbstractNodeTransformer_1 = __webpack_require__(8);
  5822. var NodeGuards_1 = __webpack_require__(4);
  5823. var FunctionTransformer = function (_AbstractNodeTransfor) {
  5824. _inherits(FunctionTransformer, _AbstractNodeTransfor);
  5825. function FunctionTransformer(identifierObfuscatingReplacerFactory, randomGenerator, options) {
  5826. _classCallCheck(this, FunctionTransformer);
  5827. var _this = _possibleConstructorReturn(this, (FunctionTransformer.__proto__ || Object.getPrototypeOf(FunctionTransformer)).call(this, randomGenerator, options));
  5828. _this.identifierObfuscatingReplacer = identifierObfuscatingReplacerFactory(IdentifierObfuscatingReplacer_1.IdentifierObfuscatingReplacer.BaseIdentifierObfuscatingReplacer);
  5829. return _this;
  5830. }
  5831. _createClass(FunctionTransformer, [{
  5832. key: "getVisitor",
  5833. value: function getVisitor(transformationStage) {
  5834. var _this2 = this;
  5835. switch (transformationStage) {
  5836. case TransformationStage_1.TransformationStage.Obfuscating:
  5837. return {
  5838. enter: function enter(node, parentNode) {
  5839. if (parentNode && (NodeGuards_1.NodeGuards.isFunctionDeclarationNode(node) || NodeGuards_1.NodeGuards.isFunctionExpressionNode(node) || NodeGuards_1.NodeGuards.isArrowFunctionExpressionNode(node))) {
  5840. return _this2.transformNode(node, parentNode);
  5841. }
  5842. }
  5843. };
  5844. default:
  5845. return null;
  5846. }
  5847. }
  5848. }, {
  5849. key: "transformNode",
  5850. value: function transformNode(functionNode, parentNode) {
  5851. var nodeIdentifier = this.nodeIdentifier++;
  5852. this.storeFunctionParams(functionNode, nodeIdentifier);
  5853. this.replaceFunctionParams(functionNode, nodeIdentifier);
  5854. return functionNode;
  5855. }
  5856. }, {
  5857. key: "storeFunctionParams",
  5858. value: function storeFunctionParams(functionNode, nodeIdentifier) {
  5859. var _this3 = this;
  5860. functionNode.params.forEach(function (paramsNode) {
  5861. if (NodeGuards_1.NodeGuards.isObjectPatternNode(paramsNode)) {
  5862. return estraverse.VisitorOption.Skip;
  5863. }
  5864. estraverse.traverse(paramsNode, {
  5865. enter: function enter(node) {
  5866. if (NodeGuards_1.NodeGuards.isAssignmentPatternNode(node) && NodeGuards_1.NodeGuards.isIdentifierNode(node.left)) {
  5867. _this3.identifierObfuscatingReplacer.storeNames(node.left.name, nodeIdentifier);
  5868. return estraverse.VisitorOption.Skip;
  5869. }
  5870. if (NodeGuards_1.NodeGuards.isIdentifierNode(node)) {
  5871. _this3.identifierObfuscatingReplacer.storeNames(node.name, nodeIdentifier);
  5872. }
  5873. }
  5874. });
  5875. });
  5876. }
  5877. }, {
  5878. key: "addIdentifiersToIgnoredIdentifierNamesSet",
  5879. value: function addIdentifiersToIgnoredIdentifierNamesSet(properties, ignoredIdentifierNamesSet) {
  5880. properties.forEach(function (property) {
  5881. if (!NodeGuards_1.NodeGuards.isIdentifierNode(property.key)) {
  5882. return;
  5883. }
  5884. ignoredIdentifierNamesSet.add(property.key.name);
  5885. });
  5886. }
  5887. }, {
  5888. key: "replaceFunctionParams",
  5889. value: function replaceFunctionParams(functionNode, nodeIdentifier) {
  5890. var _this4 = this;
  5891. var ignoredIdentifierNamesSet = new Set();
  5892. var replaceVisitor = {
  5893. enter: function enter(node, parentNode) {
  5894. if (NodeGuards_1.NodeGuards.isObjectPatternNode(node)) {
  5895. _this4.addIdentifiersToIgnoredIdentifierNamesSet(node.properties, ignoredIdentifierNamesSet);
  5896. }
  5897. if (parentNode && NodeGuards_1.NodeGuards.isReplaceableIdentifierNode(node, parentNode) && !ignoredIdentifierNamesSet.has(node.name)) {
  5898. var newIdentifier = _this4.identifierObfuscatingReplacer.replace(node.name, nodeIdentifier);
  5899. var newIdentifierName = newIdentifier.name;
  5900. if (node.name !== newIdentifierName) {
  5901. node.name = newIdentifierName;
  5902. node.obfuscatedNode = true;
  5903. }
  5904. }
  5905. }
  5906. };
  5907. functionNode.params.forEach(function (paramsNode) {
  5908. return estraverse.replace(paramsNode, replaceVisitor);
  5909. });
  5910. estraverse.replace(functionNode.body, replaceVisitor);
  5911. }
  5912. }]);
  5913. return FunctionTransformer;
  5914. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  5915. FunctionTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierObfuscatingReplacer)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], FunctionTransformer);
  5916. exports.FunctionTransformer = FunctionTransformer;
  5917. /***/ }),
  5918. /* 128 */
  5919. /***/ (function(module, exports, __webpack_require__) {
  5920. "use strict";
  5921. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  5922. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5923. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5924. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5925. Object.defineProperty(exports, "__esModule", { value: true });
  5926. var tslib_1 = __webpack_require__(2);
  5927. var inversify_1 = __webpack_require__(0);
  5928. var ServiceIdentifiers_1 = __webpack_require__(1);
  5929. var estraverse = __webpack_require__(10);
  5930. var IdentifierObfuscatingReplacer_1 = __webpack_require__(18);
  5931. var TransformationStage_1 = __webpack_require__(6);
  5932. var AbstractNodeTransformer_1 = __webpack_require__(8);
  5933. var NodeGuards_1 = __webpack_require__(4);
  5934. var LabeledStatementTransformer = function (_AbstractNodeTransfor) {
  5935. _inherits(LabeledStatementTransformer, _AbstractNodeTransfor);
  5936. function LabeledStatementTransformer(identifierObfuscatingReplacerFactory, randomGenerator, options) {
  5937. _classCallCheck(this, LabeledStatementTransformer);
  5938. var _this = _possibleConstructorReturn(this, (LabeledStatementTransformer.__proto__ || Object.getPrototypeOf(LabeledStatementTransformer)).call(this, randomGenerator, options));
  5939. _this.identifierObfuscatingReplacer = identifierObfuscatingReplacerFactory(IdentifierObfuscatingReplacer_1.IdentifierObfuscatingReplacer.BaseIdentifierObfuscatingReplacer);
  5940. return _this;
  5941. }
  5942. _createClass(LabeledStatementTransformer, [{
  5943. key: "getVisitor",
  5944. value: function getVisitor(transformationStage) {
  5945. var _this2 = this;
  5946. switch (transformationStage) {
  5947. case TransformationStage_1.TransformationStage.Obfuscating:
  5948. return {
  5949. enter: function enter(node, parentNode) {
  5950. if (parentNode && NodeGuards_1.NodeGuards.isLabeledStatementNode(node)) {
  5951. return _this2.transformNode(node, parentNode);
  5952. }
  5953. }
  5954. };
  5955. default:
  5956. return null;
  5957. }
  5958. }
  5959. }, {
  5960. key: "transformNode",
  5961. value: function transformNode(labeledStatementNode, parentNode) {
  5962. var nodeIdentifier = this.nodeIdentifier++;
  5963. this.storeLabeledStatementName(labeledStatementNode, nodeIdentifier);
  5964. this.replaceLabeledStatementName(labeledStatementNode, nodeIdentifier);
  5965. return labeledStatementNode;
  5966. }
  5967. }, {
  5968. key: "storeLabeledStatementName",
  5969. value: function storeLabeledStatementName(labeledStatementNode, nodeIdentifier) {
  5970. this.identifierObfuscatingReplacer.storeNames(labeledStatementNode.label.name, nodeIdentifier);
  5971. }
  5972. }, {
  5973. key: "replaceLabeledStatementName",
  5974. value: function replaceLabeledStatementName(labeledStatementNode, nodeIdentifier) {
  5975. var _this3 = this;
  5976. estraverse.replace(labeledStatementNode, {
  5977. enter: function enter(node, parentNode) {
  5978. if (parentNode && NodeGuards_1.NodeGuards.isLabelIdentifierNode(node, parentNode)) {
  5979. var newIdentifier = _this3.identifierObfuscatingReplacer.replace(node.name, nodeIdentifier);
  5980. node.name = newIdentifier.name;
  5981. }
  5982. }
  5983. });
  5984. }
  5985. }]);
  5986. return LabeledStatementTransformer;
  5987. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  5988. LabeledStatementTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierObfuscatingReplacer)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], LabeledStatementTransformer);
  5989. exports.LabeledStatementTransformer = LabeledStatementTransformer;
  5990. /***/ }),
  5991. /* 129 */
  5992. /***/ (function(module, exports, __webpack_require__) {
  5993. "use strict";
  5994. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  5995. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  5996. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5997. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5998. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5999. Object.defineProperty(exports, "__esModule", { value: true });
  6000. var tslib_1 = __webpack_require__(2);
  6001. var inversify_1 = __webpack_require__(0);
  6002. var ServiceIdentifiers_1 = __webpack_require__(1);
  6003. var LiteralObfuscatingReplacer_1 = __webpack_require__(43);
  6004. var TransformationStage_1 = __webpack_require__(6);
  6005. var AbstractNodeTransformer_1 = __webpack_require__(8);
  6006. var NodeGuards_1 = __webpack_require__(4);
  6007. var LiteralTransformer = function (_AbstractNodeTransfor) {
  6008. _inherits(LiteralTransformer, _AbstractNodeTransfor);
  6009. function LiteralTransformer(literalObfuscatingReplacerFactory, randomGenerator, options) {
  6010. _classCallCheck(this, LiteralTransformer);
  6011. var _this = _possibleConstructorReturn(this, (LiteralTransformer.__proto__ || Object.getPrototypeOf(LiteralTransformer)).call(this, randomGenerator, options));
  6012. _this.literalObfuscatingReplacerFactory = literalObfuscatingReplacerFactory;
  6013. return _this;
  6014. }
  6015. _createClass(LiteralTransformer, [{
  6016. key: "getVisitor",
  6017. value: function getVisitor(transformationStage) {
  6018. var _this2 = this;
  6019. switch (transformationStage) {
  6020. case TransformationStage_1.TransformationStage.Obfuscating:
  6021. return {
  6022. enter: function enter(node, parentNode) {
  6023. if (parentNode && NodeGuards_1.NodeGuards.isLiteralNode(node) && !node.obfuscatedNode) {
  6024. return _this2.transformNode(node, parentNode);
  6025. }
  6026. }
  6027. };
  6028. default:
  6029. return null;
  6030. }
  6031. }
  6032. }, {
  6033. key: "transformNode",
  6034. value: function transformNode(literalNode, parentNode) {
  6035. if (parentNode && NodeGuards_1.NodeGuards.isPropertyNode(parentNode) && parentNode.key === literalNode) {
  6036. return literalNode;
  6037. }
  6038. switch (_typeof(literalNode.value)) {
  6039. case 'boolean':
  6040. return this.literalObfuscatingReplacerFactory(LiteralObfuscatingReplacer_1.LiteralObfuscatingReplacer.BooleanLiteralObfuscatingReplacer).replace(literalNode.value);
  6041. case 'number':
  6042. return this.literalObfuscatingReplacerFactory(LiteralObfuscatingReplacer_1.LiteralObfuscatingReplacer.NumberLiteralObfuscatingReplacer).replace(literalNode.value);
  6043. case 'string':
  6044. return this.literalObfuscatingReplacerFactory(LiteralObfuscatingReplacer_1.LiteralObfuscatingReplacer.StringLiteralObfuscatingReplacer).replace(literalNode.value);
  6045. default:
  6046. return literalNode;
  6047. }
  6048. }
  6049. }]);
  6050. return LiteralTransformer;
  6051. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  6052. LiteralTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObfuscatingReplacer)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], LiteralTransformer);
  6053. exports.LiteralTransformer = LiteralTransformer;
  6054. /***/ }),
  6055. /* 130 */
  6056. /***/ (function(module, exports, __webpack_require__) {
  6057. "use strict";
  6058. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  6059. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6060. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  6061. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  6062. Object.defineProperty(exports, "__esModule", { value: true });
  6063. var tslib_1 = __webpack_require__(2);
  6064. var inversify_1 = __webpack_require__(0);
  6065. var ServiceIdentifiers_1 = __webpack_require__(1);
  6066. var AbstractObfuscatingReplacer_1 = __webpack_require__(28);
  6067. var Nodes_1 = __webpack_require__(9);
  6068. var Utils_1 = __webpack_require__(22);
  6069. var NumberLiteralObfuscatingReplacer = function (_AbstractObfuscatingR) {
  6070. _inherits(NumberLiteralObfuscatingReplacer, _AbstractObfuscatingR);
  6071. function NumberLiteralObfuscatingReplacer(options) {
  6072. _classCallCheck(this, NumberLiteralObfuscatingReplacer);
  6073. var _this = _possibleConstructorReturn(this, (NumberLiteralObfuscatingReplacer.__proto__ || Object.getPrototypeOf(NumberLiteralObfuscatingReplacer)).call(this, options));
  6074. _this.numberLiteralCache = new Map();
  6075. return _this;
  6076. }
  6077. _createClass(NumberLiteralObfuscatingReplacer, [{
  6078. key: "replace",
  6079. value: function replace(nodeValue) {
  6080. var rawValue = void 0;
  6081. if (this.numberLiteralCache.has(nodeValue)) {
  6082. rawValue = this.numberLiteralCache.get(nodeValue);
  6083. } else {
  6084. if (!Utils_1.Utils.isCeilNumber(nodeValue)) {
  6085. rawValue = String(nodeValue);
  6086. } else {
  6087. rawValue = "" + Utils_1.Utils.hexadecimalPrefix + Utils_1.Utils.decToHex(nodeValue);
  6088. }
  6089. this.numberLiteralCache.set(nodeValue, rawValue);
  6090. }
  6091. return Nodes_1.Nodes.getLiteralNode(nodeValue, rawValue);
  6092. }
  6093. }]);
  6094. return NumberLiteralObfuscatingReplacer;
  6095. }(AbstractObfuscatingReplacer_1.AbstractObfuscatingReplacer);
  6096. NumberLiteralObfuscatingReplacer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object])], NumberLiteralObfuscatingReplacer);
  6097. exports.NumberLiteralObfuscatingReplacer = NumberLiteralObfuscatingReplacer;
  6098. /***/ }),
  6099. /* 131 */
  6100. /***/ (function(module, exports, __webpack_require__) {
  6101. "use strict";
  6102. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  6103. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6104. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  6105. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  6106. Object.defineProperty(exports, "__esModule", { value: true });
  6107. var tslib_1 = __webpack_require__(2);
  6108. var inversify_1 = __webpack_require__(0);
  6109. var ServiceIdentifiers_1 = __webpack_require__(1);
  6110. var NodeType_1 = __webpack_require__(11);
  6111. var TransformationStage_1 = __webpack_require__(6);
  6112. var AbstractNodeTransformer_1 = __webpack_require__(8);
  6113. var NodeGuards_1 = __webpack_require__(4);
  6114. var ObjectExpressionTransformer = ObjectExpressionTransformer_1 = function (_AbstractNodeTransfor) {
  6115. _inherits(ObjectExpressionTransformer, _AbstractNodeTransfor);
  6116. function ObjectExpressionTransformer(randomGenerator, options) {
  6117. _classCallCheck(this, ObjectExpressionTransformer);
  6118. return _possibleConstructorReturn(this, (ObjectExpressionTransformer.__proto__ || Object.getPrototypeOf(ObjectExpressionTransformer)).call(this, randomGenerator, options));
  6119. }
  6120. _createClass(ObjectExpressionTransformer, [{
  6121. key: "getVisitor",
  6122. value: function getVisitor(transformationStage) {
  6123. var _this2 = this;
  6124. switch (transformationStage) {
  6125. case TransformationStage_1.TransformationStage.Obfuscating:
  6126. return {
  6127. enter: function enter(node, parentNode) {
  6128. if (parentNode && NodeGuards_1.NodeGuards.isObjectExpressionNode(node)) {
  6129. return _this2.transformNode(node, parentNode);
  6130. }
  6131. }
  6132. };
  6133. default:
  6134. return null;
  6135. }
  6136. }
  6137. }, {
  6138. key: "transformNode",
  6139. value: function transformNode(objectExpressionNode, parentNode) {
  6140. objectExpressionNode.properties.forEach(function (property) {
  6141. if (property.computed) {
  6142. return;
  6143. }
  6144. if (property.shorthand) {
  6145. property.shorthand = false;
  6146. }
  6147. if (NodeGuards_1.NodeGuards.isIdentifierNode(property.key)) {
  6148. property.key = ObjectExpressionTransformer_1.transformIdentifierPropertyKey(property.key);
  6149. }
  6150. });
  6151. return objectExpressionNode;
  6152. }
  6153. }], [{
  6154. key: "transformIdentifierPropertyKey",
  6155. value: function transformIdentifierPropertyKey(node) {
  6156. return {
  6157. type: NodeType_1.NodeType.Literal,
  6158. value: node.name,
  6159. raw: "'" + node.name + "'"
  6160. };
  6161. }
  6162. }]);
  6163. return ObjectExpressionTransformer;
  6164. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  6165. ObjectExpressionTransformer = ObjectExpressionTransformer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], ObjectExpressionTransformer);
  6166. exports.ObjectExpressionTransformer = ObjectExpressionTransformer;
  6167. var ObjectExpressionTransformer_1;
  6168. /***/ }),
  6169. /* 132 */
  6170. /***/ (function(module, exports, __webpack_require__) {
  6171. "use strict";
  6172. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  6173. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6174. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  6175. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  6176. Object.defineProperty(exports, "__esModule", { value: true });
  6177. var tslib_1 = __webpack_require__(2);
  6178. var inversify_1 = __webpack_require__(0);
  6179. var ServiceIdentifiers_1 = __webpack_require__(1);
  6180. var StringArrayEncoding_1 = __webpack_require__(26);
  6181. var AbstractObfuscatingReplacer_1 = __webpack_require__(28);
  6182. var Nodes_1 = __webpack_require__(9);
  6183. var Utils_1 = __webpack_require__(22);
  6184. var StringLiteralObfuscatingReplacer = StringLiteralObfuscatingReplacer_1 = function (_AbstractObfuscatingR) {
  6185. _inherits(StringLiteralObfuscatingReplacer, _AbstractObfuscatingR);
  6186. function StringLiteralObfuscatingReplacer(stringArrayStorage, escapeSequenceEncoder, randomGenerator, cryptUtils, options) {
  6187. _classCallCheck(this, StringLiteralObfuscatingReplacer);
  6188. var _this = _possibleConstructorReturn(this, (StringLiteralObfuscatingReplacer.__proto__ || Object.getPrototypeOf(StringLiteralObfuscatingReplacer)).call(this, options));
  6189. _this.nodesCache = new Map();
  6190. _this.stringLiteralHexadecimalIndexCache = new Map();
  6191. _this.stringArrayStorage = stringArrayStorage;
  6192. _this.escapeSequenceEncoder = escapeSequenceEncoder;
  6193. _this.randomGenerator = randomGenerator;
  6194. _this.cryptUtils = cryptUtils;
  6195. _this.rc4Keys = _this.randomGenerator.getRandomGenerator().n(function () {
  6196. return _this.randomGenerator.getRandomGenerator().string({
  6197. length: StringLiteralObfuscatingReplacer_1.rc4KeyLength
  6198. });
  6199. }, StringLiteralObfuscatingReplacer_1.rc4KeysCount);
  6200. return _this;
  6201. }
  6202. _createClass(StringLiteralObfuscatingReplacer, [{
  6203. key: "replace",
  6204. value: function replace(nodeValue) {
  6205. var useStringArray = this.canUseStringArray(nodeValue);
  6206. var cacheKey = nodeValue + "-" + String(useStringArray);
  6207. var useCacheValue = this.nodesCache.has(cacheKey) && this.options.stringArrayEncoding !== StringArrayEncoding_1.StringArrayEncoding.Rc4;
  6208. if (useCacheValue) {
  6209. return this.nodesCache.get(cacheKey);
  6210. }
  6211. var resultNode = useStringArray ? this.replaceWithStringArrayCallNode(nodeValue) : this.replaceWithLiteralNode(nodeValue);
  6212. this.nodesCache.set(cacheKey, resultNode);
  6213. return resultNode;
  6214. }
  6215. }, {
  6216. key: "canUseStringArray",
  6217. value: function canUseStringArray(nodeValue) {
  6218. return this.options.stringArray && nodeValue.length >= StringLiteralObfuscatingReplacer_1.minimumLengthForStringArray && this.randomGenerator.getMathRandom() <= this.options.stringArrayThreshold;
  6219. }
  6220. }, {
  6221. key: "getStringArrayHexadecimalIndex",
  6222. value: function getStringArrayHexadecimalIndex(value, stringArrayStorageLength) {
  6223. if (this.stringLiteralHexadecimalIndexCache.has(value)) {
  6224. return {
  6225. fromCache: true,
  6226. index: this.stringLiteralHexadecimalIndexCache.get(value)
  6227. };
  6228. }
  6229. var hexadecimalRawIndex = Utils_1.Utils.decToHex(stringArrayStorageLength);
  6230. var hexadecimalIndex = "" + Utils_1.Utils.hexadecimalPrefix + hexadecimalRawIndex;
  6231. this.stringLiteralHexadecimalIndexCache.set(value, hexadecimalIndex);
  6232. return {
  6233. fromCache: false,
  6234. index: hexadecimalIndex
  6235. };
  6236. }
  6237. }, {
  6238. key: "getEncodedValue",
  6239. value: function getEncodedValue(value) {
  6240. var encodedValue = void 0,
  6241. key = null;
  6242. switch (this.options.stringArrayEncoding) {
  6243. case StringArrayEncoding_1.StringArrayEncoding.Rc4:
  6244. key = this.randomGenerator.getRandomGenerator().pickone(this.rc4Keys);
  6245. encodedValue = this.cryptUtils.btoa(this.cryptUtils.rc4(value, key));
  6246. break;
  6247. case StringArrayEncoding_1.StringArrayEncoding.Base64:
  6248. encodedValue = this.cryptUtils.btoa(value);
  6249. break;
  6250. default:
  6251. encodedValue = value;
  6252. }
  6253. return { encodedValue: encodedValue, key: key };
  6254. }
  6255. }, {
  6256. key: "replaceWithLiteralNode",
  6257. value: function replaceWithLiteralNode(value) {
  6258. return Nodes_1.Nodes.getLiteralNode(this.escapeSequenceEncoder.encode(value, this.options.unicodeEscapeSequence));
  6259. }
  6260. }, {
  6261. key: "replaceWithStringArrayCallNode",
  6262. value: function replaceWithStringArrayCallNode(value) {
  6263. var _getEncodedValue = this.getEncodedValue(value),
  6264. encodedValue = _getEncodedValue.encodedValue,
  6265. key = _getEncodedValue.key;
  6266. var escapedValue = this.escapeSequenceEncoder.encode(encodedValue, this.options.unicodeEscapeSequence);
  6267. var stringArrayStorageLength = this.stringArrayStorage.getLength();
  6268. var stringArrayStorageCallsWrapperName = this.stringArrayStorage.getStorageId().split('|')[1];
  6269. var _getStringArrayHexade = this.getStringArrayHexadecimalIndex(escapedValue, stringArrayStorageLength),
  6270. fromCache = _getStringArrayHexade.fromCache,
  6271. index = _getStringArrayHexade.index;
  6272. if (!fromCache) {
  6273. this.stringArrayStorage.set(stringArrayStorageLength, escapedValue);
  6274. }
  6275. var callExpressionArgs = [StringLiteralObfuscatingReplacer_1.getHexadecimalLiteralNode(index)];
  6276. if (key) {
  6277. callExpressionArgs.push(StringLiteralObfuscatingReplacer_1.getRc4KeyLiteralNode(this.escapeSequenceEncoder.encode(key, this.options.unicodeEscapeSequence)));
  6278. }
  6279. var stringArrayIdentifierNode = Nodes_1.Nodes.getIdentifierNode(stringArrayStorageCallsWrapperName);
  6280. stringArrayIdentifierNode.obfuscatedNode = true;
  6281. return Nodes_1.Nodes.getCallExpressionNode(stringArrayIdentifierNode, callExpressionArgs);
  6282. }
  6283. }], [{
  6284. key: "getHexadecimalLiteralNode",
  6285. value: function getHexadecimalLiteralNode(hexadecimalIndex) {
  6286. var hexadecimalLiteralNode = Nodes_1.Nodes.getLiteralNode(hexadecimalIndex);
  6287. hexadecimalLiteralNode.obfuscatedNode = true;
  6288. return hexadecimalLiteralNode;
  6289. }
  6290. }, {
  6291. key: "getRc4KeyLiteralNode",
  6292. value: function getRc4KeyLiteralNode(literalValue) {
  6293. var rc4KeyLiteralNode = Nodes_1.Nodes.getLiteralNode(literalValue);
  6294. rc4KeyLiteralNode.obfuscatedNode = true;
  6295. return rc4KeyLiteralNode;
  6296. }
  6297. }]);
  6298. return StringLiteralObfuscatingReplacer;
  6299. }(AbstractObfuscatingReplacer_1.AbstractObfuscatingReplacer);
  6300. StringLiteralObfuscatingReplacer.minimumLengthForStringArray = 3;
  6301. StringLiteralObfuscatingReplacer.rc4KeyLength = 4;
  6302. StringLiteralObfuscatingReplacer.rc4KeysCount = 50;
  6303. StringLiteralObfuscatingReplacer = StringLiteralObfuscatingReplacer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.TStringArrayStorage)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IEscapeSequenceEncoder)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICryptUtils)), tslib_1.__param(4, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object, Object, Object, Object])], StringLiteralObfuscatingReplacer);
  6304. exports.StringLiteralObfuscatingReplacer = StringLiteralObfuscatingReplacer;
  6305. var StringLiteralObfuscatingReplacer_1;
  6306. /***/ }),
  6307. /* 133 */
  6308. /***/ (function(module, exports, __webpack_require__) {
  6309. "use strict";
  6310. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  6311. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6312. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  6313. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  6314. Object.defineProperty(exports, "__esModule", { value: true });
  6315. var tslib_1 = __webpack_require__(2);
  6316. var inversify_1 = __webpack_require__(0);
  6317. var ServiceIdentifiers_1 = __webpack_require__(1);
  6318. var estraverse = __webpack_require__(10);
  6319. var IdentifierObfuscatingReplacer_1 = __webpack_require__(18);
  6320. var NodeType_1 = __webpack_require__(11);
  6321. var TransformationStage_1 = __webpack_require__(6);
  6322. var AbstractNodeTransformer_1 = __webpack_require__(8);
  6323. var NodeGuards_1 = __webpack_require__(4);
  6324. var NodeUtils_1 = __webpack_require__(3);
  6325. var VariableDeclarationTransformer = function (_AbstractNodeTransfor) {
  6326. _inherits(VariableDeclarationTransformer, _AbstractNodeTransfor);
  6327. function VariableDeclarationTransformer(identifierObfuscatingReplacerFactory, randomGenerator, options) {
  6328. _classCallCheck(this, VariableDeclarationTransformer);
  6329. var _this = _possibleConstructorReturn(this, (VariableDeclarationTransformer.__proto__ || Object.getPrototypeOf(VariableDeclarationTransformer)).call(this, randomGenerator, options));
  6330. _this.replaceableIdentifiers = new Map();
  6331. _this.identifierObfuscatingReplacer = identifierObfuscatingReplacerFactory(IdentifierObfuscatingReplacer_1.IdentifierObfuscatingReplacer.BaseIdentifierObfuscatingReplacer);
  6332. return _this;
  6333. }
  6334. _createClass(VariableDeclarationTransformer, [{
  6335. key: "getVisitor",
  6336. value: function getVisitor(transformationStage) {
  6337. var _this2 = this;
  6338. switch (transformationStage) {
  6339. case TransformationStage_1.TransformationStage.Obfuscating:
  6340. return {
  6341. enter: function enter(node, parentNode) {
  6342. if (parentNode && NodeGuards_1.NodeGuards.isVariableDeclarationNode(node)) {
  6343. return _this2.transformNode(node, parentNode);
  6344. }
  6345. }
  6346. };
  6347. default:
  6348. return null;
  6349. }
  6350. }
  6351. }, {
  6352. key: "transformNode",
  6353. value: function transformNode(variableDeclarationNode, parentNode) {
  6354. var blockScopeNode = NodeUtils_1.NodeUtils.getBlockScopesOfNode(variableDeclarationNode)[0];
  6355. if (!this.options.renameGlobals && blockScopeNode.type === NodeType_1.NodeType.Program) {
  6356. return variableDeclarationNode;
  6357. }
  6358. var nodeIdentifier = this.nodeIdentifier++;
  6359. var scopeNode = variableDeclarationNode.kind === 'var' ? blockScopeNode : parentNode;
  6360. this.storeVariableNames(variableDeclarationNode, nodeIdentifier);
  6361. if (this.replaceableIdentifiers.has(scopeNode)) {
  6362. this.replaceScopeCachedIdentifiers(variableDeclarationNode, scopeNode, nodeIdentifier);
  6363. } else {
  6364. this.replaceScopeIdentifiers(scopeNode, nodeIdentifier);
  6365. }
  6366. return variableDeclarationNode;
  6367. }
  6368. }, {
  6369. key: "storeVariableNames",
  6370. value: function storeVariableNames(variableDeclarationNode, nodeIdentifier) {
  6371. var _this3 = this;
  6372. this.traverseDeclarationIdentifiers(variableDeclarationNode, function (identifierNode) {
  6373. _this3.identifierObfuscatingReplacer.storeNames(identifierNode.name, nodeIdentifier);
  6374. });
  6375. }
  6376. }, {
  6377. key: "replaceScopeCachedIdentifiers",
  6378. value: function replaceScopeCachedIdentifiers(variableDeclarationNode, scopeNode, nodeIdentifier) {
  6379. var _this4 = this;
  6380. var cachedReplaceableIdentifiersNamesMap = this.replaceableIdentifiers.get(scopeNode);
  6381. if (!cachedReplaceableIdentifiersNamesMap) {
  6382. return;
  6383. }
  6384. var identifierNames = [];
  6385. this.traverseDeclarationIdentifiers(variableDeclarationNode, function (identifierNode) {
  6386. identifierNames.push(identifierNode.name);
  6387. });
  6388. identifierNames.forEach(function (identifierName) {
  6389. var cachedReplaceableIdentifiers = cachedReplaceableIdentifiersNamesMap.get(identifierName);
  6390. if (!cachedReplaceableIdentifiers) {
  6391. return;
  6392. }
  6393. var cachedReplaceableIdentifierLength = cachedReplaceableIdentifiers.length;
  6394. for (var i = 0; i < cachedReplaceableIdentifierLength; i++) {
  6395. var replaceableIdentifier = cachedReplaceableIdentifiers[i];
  6396. if (identifierName !== replaceableIdentifier.name) {
  6397. continue;
  6398. }
  6399. var newReplaceableIdentifier = _this4.identifierObfuscatingReplacer.replace(replaceableIdentifier.name, nodeIdentifier);
  6400. replaceableIdentifier.name = newReplaceableIdentifier.name;
  6401. }
  6402. });
  6403. }
  6404. }, {
  6405. key: "replaceScopeIdentifiers",
  6406. value: function replaceScopeIdentifiers(blockScopeNode, nodeIdentifier) {
  6407. var _this5 = this;
  6408. var storedReplaceableIdentifiersNamesMap = new Map();
  6409. estraverse.replace(blockScopeNode, {
  6410. enter: function enter(node, parentNode) {
  6411. if (parentNode && !node.obfuscatedNode && NodeGuards_1.NodeGuards.isReplaceableIdentifierNode(node, parentNode)) {
  6412. var newIdentifier = _this5.identifierObfuscatingReplacer.replace(node.name, nodeIdentifier);
  6413. var newIdentifierName = newIdentifier.name;
  6414. if (node.name !== newIdentifierName) {
  6415. node.name = newIdentifierName;
  6416. } else {
  6417. var storedReplaceableIdentifiers = storedReplaceableIdentifiersNamesMap.get(node.name) || [];
  6418. storedReplaceableIdentifiers.push(node);
  6419. storedReplaceableIdentifiersNamesMap.set(node.name, storedReplaceableIdentifiers);
  6420. }
  6421. }
  6422. }
  6423. });
  6424. this.replaceableIdentifiers.set(blockScopeNode, storedReplaceableIdentifiersNamesMap);
  6425. }
  6426. }, {
  6427. key: "traverseDeclarationIdentifiers",
  6428. value: function traverseDeclarationIdentifiers(variableDeclarationNode, callback) {
  6429. variableDeclarationNode.declarations.forEach(function (declarationNode) {
  6430. if (NodeGuards_1.NodeGuards.isObjectPatternNode(declarationNode.id)) {
  6431. return estraverse.VisitorOption.Skip;
  6432. }
  6433. estraverse.traverse(declarationNode.id, {
  6434. enter: function enter(node) {
  6435. if (NodeGuards_1.NodeGuards.isIdentifierNode(node)) {
  6436. callback(node);
  6437. }
  6438. }
  6439. });
  6440. });
  6441. }
  6442. }]);
  6443. return VariableDeclarationTransformer;
  6444. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  6445. VariableDeclarationTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierObfuscatingReplacer)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], VariableDeclarationTransformer);
  6446. exports.VariableDeclarationTransformer = VariableDeclarationTransformer;
  6447. /***/ }),
  6448. /* 134 */
  6449. /***/ (function(module, exports, __webpack_require__) {
  6450. "use strict";
  6451. Object.defineProperty(exports, "__esModule", { value: true });
  6452. var InversifyContainerFacade_1 = __webpack_require__(15);
  6453. var inversify_1 = __webpack_require__(0);
  6454. var ServiceIdentifiers_1 = __webpack_require__(1);
  6455. var NodeTransformer_1 = __webpack_require__(20);
  6456. var ObfuscatingGuard_1 = __webpack_require__(44);
  6457. var BlackListObfuscatingGuard_1 = __webpack_require__(135);
  6458. var CommentsTransformer_1 = __webpack_require__(136);
  6459. var ConditionalCommentObfuscatingGuard_1 = __webpack_require__(137);
  6460. var EvaCallExpressionTransformer_1 = __webpack_require__(138);
  6461. var ObfuscatingGuardsTransformer_1 = __webpack_require__(140);
  6462. var ParentificationTransformer_1 = __webpack_require__(141);
  6463. exports.preparingTransformersModule = new inversify_1.ContainerModule(function (bind) {
  6464. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(CommentsTransformer_1.CommentsTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.CommentsTransformer);
  6465. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(EvaCallExpressionTransformer_1.EvalCallExpressionTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.EvalCallExpressionTransformer);
  6466. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(ObfuscatingGuardsTransformer_1.ObfuscatingGuardsTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.ObfuscatingGuardsTransformer);
  6467. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(ParentificationTransformer_1.ParentificationTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.ParentificationTransformer);
  6468. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeGuard).to(BlackListObfuscatingGuard_1.BlackListObfuscatingGuard).inSingletonScope().whenTargetNamed(ObfuscatingGuard_1.ObfuscatingGuard.BlackListNodeGuard);
  6469. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeGuard).to(ConditionalCommentObfuscatingGuard_1.ConditionalCommentObfuscatingGuard).inSingletonScope().whenTargetNamed(ObfuscatingGuard_1.ObfuscatingGuard.ConditionalCommentNodeGuard);
  6470. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__INodeGuard).toFactory(InversifyContainerFacade_1.InversifyContainerFacade.getCacheFactory(ServiceIdentifiers_1.ServiceIdentifiers.INodeGuard));
  6471. });
  6472. /***/ }),
  6473. /* 135 */
  6474. /***/ (function(module, exports, __webpack_require__) {
  6475. "use strict";
  6476. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  6477. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6478. Object.defineProperty(exports, "__esModule", { value: true });
  6479. var tslib_1 = __webpack_require__(2);
  6480. var inversify_1 = __webpack_require__(0);
  6481. var NodeGuards_1 = __webpack_require__(4);
  6482. var BlackListObfuscatingGuard = BlackListObfuscatingGuard_1 = function () {
  6483. function BlackListObfuscatingGuard() {
  6484. _classCallCheck(this, BlackListObfuscatingGuard);
  6485. this.blackListGuardsLength = BlackListObfuscatingGuard_1.blackListGuards.length;
  6486. }
  6487. _createClass(BlackListObfuscatingGuard, [{
  6488. key: "check",
  6489. value: function check(node) {
  6490. for (var i = 0; i < this.blackListGuardsLength; i++) {
  6491. if (BlackListObfuscatingGuard_1.blackListGuards[i](node)) {
  6492. return false;
  6493. }
  6494. }
  6495. return true;
  6496. }
  6497. }]);
  6498. return BlackListObfuscatingGuard;
  6499. }();
  6500. BlackListObfuscatingGuard.blackListGuards = [NodeGuards_1.NodeGuards.isUseStrictOperator];
  6501. BlackListObfuscatingGuard = BlackListObfuscatingGuard_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__metadata("design:paramtypes", [])], BlackListObfuscatingGuard);
  6502. exports.BlackListObfuscatingGuard = BlackListObfuscatingGuard;
  6503. var BlackListObfuscatingGuard_1;
  6504. /***/ }),
  6505. /* 136 */
  6506. /***/ (function(module, exports, __webpack_require__) {
  6507. "use strict";
  6508. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  6509. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6510. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  6511. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  6512. Object.defineProperty(exports, "__esModule", { value: true });
  6513. var tslib_1 = __webpack_require__(2);
  6514. var inversify_1 = __webpack_require__(0);
  6515. var ServiceIdentifiers_1 = __webpack_require__(1);
  6516. var TransformationStage_1 = __webpack_require__(6);
  6517. var AbstractNodeTransformer_1 = __webpack_require__(8);
  6518. var NodeGuards_1 = __webpack_require__(4);
  6519. var CommentsTransformer = CommentsTransformer_1 = function (_AbstractNodeTransfor) {
  6520. _inherits(CommentsTransformer, _AbstractNodeTransfor);
  6521. function CommentsTransformer(randomGenerator, options) {
  6522. _classCallCheck(this, CommentsTransformer);
  6523. return _possibleConstructorReturn(this, (CommentsTransformer.__proto__ || Object.getPrototypeOf(CommentsTransformer)).call(this, randomGenerator, options));
  6524. }
  6525. _createClass(CommentsTransformer, [{
  6526. key: "getVisitor",
  6527. value: function getVisitor(transformationStage) {
  6528. var _this2 = this;
  6529. switch (transformationStage) {
  6530. case TransformationStage_1.TransformationStage.Preparing:
  6531. return {
  6532. leave: function leave(node, parentNode) {
  6533. if (parentNode && NodeGuards_1.NodeGuards.isNodeWithComments(node)) {
  6534. return _this2.transformNode(node, parentNode);
  6535. }
  6536. }
  6537. };
  6538. default:
  6539. return null;
  6540. }
  6541. }
  6542. }, {
  6543. key: "transformNode",
  6544. value: function transformNode(node, parentNode) {
  6545. if (node.leadingComments) {
  6546. node.leadingComments = this.transformComments(node.leadingComments);
  6547. }
  6548. if (node.trailingComments) {
  6549. node.trailingComments = this.transformComments(node.trailingComments);
  6550. }
  6551. return node;
  6552. }
  6553. }, {
  6554. key: "transformComments",
  6555. value: function transformComments(comments) {
  6556. return comments.filter(function (comment) {
  6557. return CommentsTransformer_1.preservedWords.some(function (availableWord) {
  6558. return comment.value.indexOf(availableWord) !== -1;
  6559. });
  6560. });
  6561. }
  6562. }]);
  6563. return CommentsTransformer;
  6564. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  6565. CommentsTransformer.preservedWords = ['@license', '@preserve'];
  6566. CommentsTransformer = CommentsTransformer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], CommentsTransformer);
  6567. exports.CommentsTransformer = CommentsTransformer;
  6568. var CommentsTransformer_1;
  6569. /***/ }),
  6570. /* 137 */
  6571. /***/ (function(module, exports, __webpack_require__) {
  6572. "use strict";
  6573. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  6574. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6575. Object.defineProperty(exports, "__esModule", { value: true });
  6576. var tslib_1 = __webpack_require__(2);
  6577. var inversify_1 = __webpack_require__(0);
  6578. var NodeGuards_1 = __webpack_require__(4);
  6579. var ConditionalCommentObfuscatingGuard = ConditionalCommentObfuscatingGuard_1 = function () {
  6580. function ConditionalCommentObfuscatingGuard() {
  6581. _classCallCheck(this, ConditionalCommentObfuscatingGuard);
  6582. this.obfuscationAllowedForCurrentNode = true;
  6583. this.obfuscationAllowedForNextNode = null;
  6584. }
  6585. _createClass(ConditionalCommentObfuscatingGuard, [{
  6586. key: "check",
  6587. value: function check(node) {
  6588. if (this.obfuscationAllowedForNextNode) {
  6589. this.obfuscationAllowedForCurrentNode = this.obfuscationAllowedForNextNode;
  6590. this.obfuscationAllowedForNextNode = null;
  6591. }
  6592. if (!NodeGuards_1.NodeGuards.isNodeWithComments(node)) {
  6593. return this.obfuscationAllowedForCurrentNode;
  6594. }
  6595. var leadingComments = node.leadingComments;
  6596. var trailingComments = node.trailingComments;
  6597. if (leadingComments) {
  6598. this.obfuscationAllowedForCurrentNode = this.checkComments(leadingComments);
  6599. }
  6600. if (trailingComments) {
  6601. this.obfuscationAllowedForNextNode = this.checkComments(trailingComments);
  6602. }
  6603. return this.obfuscationAllowedForCurrentNode;
  6604. }
  6605. }, {
  6606. key: "checkComments",
  6607. value: function checkComments(comments) {
  6608. var commentsLength = comments.length;
  6609. var obfuscationAllowed = this.obfuscationAllowedForCurrentNode;
  6610. for (var i = 0; i < commentsLength; i++) {
  6611. var comment = comments[i];
  6612. if (ConditionalCommentObfuscatingGuard_1.obfuscationEnableCommentRegExp.test(comment.value)) {
  6613. obfuscationAllowed = true;
  6614. continue;
  6615. }
  6616. if (ConditionalCommentObfuscatingGuard_1.obfuscationDisableCommentRegExp.test(comment.value)) {
  6617. obfuscationAllowed = false;
  6618. }
  6619. }
  6620. return obfuscationAllowed;
  6621. }
  6622. }]);
  6623. return ConditionalCommentObfuscatingGuard;
  6624. }();
  6625. ConditionalCommentObfuscatingGuard.obfuscationEnableCommentRegExp = new RegExp('javascript-obfuscator *: *enable');
  6626. ConditionalCommentObfuscatingGuard.obfuscationDisableCommentRegExp = new RegExp('javascript-obfuscator *: *disable');
  6627. ConditionalCommentObfuscatingGuard = ConditionalCommentObfuscatingGuard_1 = tslib_1.__decorate([inversify_1.injectable()], ConditionalCommentObfuscatingGuard);
  6628. exports.ConditionalCommentObfuscatingGuard = ConditionalCommentObfuscatingGuard;
  6629. var ConditionalCommentObfuscatingGuard_1;
  6630. /***/ }),
  6631. /* 138 */
  6632. /***/ (function(module, exports, __webpack_require__) {
  6633. "use strict";
  6634. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  6635. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6636. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  6637. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  6638. Object.defineProperty(exports, "__esModule", { value: true });
  6639. var tslib_1 = __webpack_require__(2);
  6640. var inversify_1 = __webpack_require__(0);
  6641. var ServiceIdentifiers_1 = __webpack_require__(1);
  6642. var jsStringEscape = __webpack_require__(139);
  6643. var TransformationStage_1 = __webpack_require__(6);
  6644. var AbstractNodeTransformer_1 = __webpack_require__(8);
  6645. var NodeGuards_1 = __webpack_require__(4);
  6646. var Nodes_1 = __webpack_require__(9);
  6647. var NodeUtils_1 = __webpack_require__(3);
  6648. var EvalCallExpressionTransformer = EvalCallExpressionTransformer_1 = function (_AbstractNodeTransfor) {
  6649. _inherits(EvalCallExpressionTransformer, _AbstractNodeTransfor);
  6650. function EvalCallExpressionTransformer(randomGenerator, options) {
  6651. _classCallCheck(this, EvalCallExpressionTransformer);
  6652. var _this = _possibleConstructorReturn(this, (EvalCallExpressionTransformer.__proto__ || Object.getPrototypeOf(EvalCallExpressionTransformer)).call(this, randomGenerator, options));
  6653. _this.evalRootAstHostNodeSet = new WeakSet();
  6654. return _this;
  6655. }
  6656. _createClass(EvalCallExpressionTransformer, [{
  6657. key: "getVisitor",
  6658. value: function getVisitor(transformationStage) {
  6659. var _this2 = this;
  6660. switch (transformationStage) {
  6661. case TransformationStage_1.TransformationStage.Preparing:
  6662. return {
  6663. enter: function enter(node, parentNode) {
  6664. if (parentNode && NodeGuards_1.NodeGuards.isCallExpressionNode(node) && NodeGuards_1.NodeGuards.isIdentifierNode(node.callee) && node.callee.name === 'eval') {
  6665. return _this2.transformNode(node, parentNode);
  6666. }
  6667. }
  6668. };
  6669. case TransformationStage_1.TransformationStage.Finalizing:
  6670. return {
  6671. leave: function leave(node, parentNode) {
  6672. if (parentNode && _this2.isEvalRootAstHostNode(node)) {
  6673. return _this2.restoreNode(node, parentNode);
  6674. }
  6675. }
  6676. };
  6677. default:
  6678. return null;
  6679. }
  6680. }
  6681. }, {
  6682. key: "transformNode",
  6683. value: function transformNode(callExpressionNode, parentNode) {
  6684. var callExpressionFirstArgument = callExpressionNode.arguments[0];
  6685. if (!callExpressionFirstArgument) {
  6686. return callExpressionNode;
  6687. }
  6688. var evalString = EvalCallExpressionTransformer_1.extractEvalStringFromCallExpressionArgument(callExpressionFirstArgument);
  6689. if (!evalString) {
  6690. return callExpressionNode;
  6691. }
  6692. var ast = void 0;
  6693. try {
  6694. ast = NodeUtils_1.NodeUtils.convertCodeToStructure(evalString);
  6695. } catch (e) {
  6696. return callExpressionNode;
  6697. }
  6698. var evalRootAstHostNode = Nodes_1.Nodes.getFunctionExpressionNode([], Nodes_1.Nodes.getBlockStatementNode(ast));
  6699. this.evalRootAstHostNodeSet.add(evalRootAstHostNode);
  6700. return evalRootAstHostNode;
  6701. }
  6702. }, {
  6703. key: "restoreNode",
  6704. value: function restoreNode(evalRootAstHostNode, parentNode) {
  6705. var targetAst = evalRootAstHostNode.body.body;
  6706. var obfuscatedCode = NodeUtils_1.NodeUtils.convertStructureToCode(targetAst);
  6707. return Nodes_1.Nodes.getCallExpressionNode(Nodes_1.Nodes.getIdentifierNode('eval'), [Nodes_1.Nodes.getLiteralNode(jsStringEscape(obfuscatedCode))]);
  6708. }
  6709. }, {
  6710. key: "isEvalRootAstHostNode",
  6711. value: function isEvalRootAstHostNode(node) {
  6712. return NodeGuards_1.NodeGuards.isFunctionExpressionNode(node) && this.evalRootAstHostNodeSet.has(node);
  6713. }
  6714. }], [{
  6715. key: "extractEvalStringFromCallExpressionArgument",
  6716. value: function extractEvalStringFromCallExpressionArgument(node) {
  6717. if (NodeGuards_1.NodeGuards.isLiteralNode(node)) {
  6718. return EvalCallExpressionTransformer_1.extractEvalStringFromLiteralNode(node);
  6719. }
  6720. if (NodeGuards_1.NodeGuards.isTemplateLiteralNode(node)) {
  6721. return EvalCallExpressionTransformer_1.extractEvalStringFromTemplateLiteralNode(node);
  6722. }
  6723. return null;
  6724. }
  6725. }, {
  6726. key: "extractEvalStringFromLiteralNode",
  6727. value: function extractEvalStringFromLiteralNode(node) {
  6728. return typeof node.value === 'string' ? node.value : null;
  6729. }
  6730. }, {
  6731. key: "extractEvalStringFromTemplateLiteralNode",
  6732. value: function extractEvalStringFromTemplateLiteralNode(node) {
  6733. var quasis = node.quasis;
  6734. var allowedQuasisLength = 1;
  6735. if (quasis.length !== allowedQuasisLength || node.expressions.length) {
  6736. return null;
  6737. }
  6738. return quasis[0].value.cooked;
  6739. }
  6740. }]);
  6741. return EvalCallExpressionTransformer;
  6742. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  6743. EvalCallExpressionTransformer = EvalCallExpressionTransformer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], EvalCallExpressionTransformer);
  6744. exports.EvalCallExpressionTransformer = EvalCallExpressionTransformer;
  6745. var EvalCallExpressionTransformer_1;
  6746. /***/ }),
  6747. /* 139 */
  6748. /***/ (function(module, exports) {
  6749. module.exports = require("js-string-escape");
  6750. /***/ }),
  6751. /* 140 */
  6752. /***/ (function(module, exports, __webpack_require__) {
  6753. "use strict";
  6754. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  6755. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6756. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  6757. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  6758. Object.defineProperty(exports, "__esModule", { value: true });
  6759. var tslib_1 = __webpack_require__(2);
  6760. var inversify_1 = __webpack_require__(0);
  6761. var ServiceIdentifiers_1 = __webpack_require__(1);
  6762. var ObfuscatingGuard_1 = __webpack_require__(44);
  6763. var TransformationStage_1 = __webpack_require__(6);
  6764. var AbstractNodeTransformer_1 = __webpack_require__(8);
  6765. var ObfuscatingGuardsTransformer = ObfuscatingGuardsTransformer_1 = function (_AbstractNodeTransfor) {
  6766. _inherits(ObfuscatingGuardsTransformer, _AbstractNodeTransfor);
  6767. function ObfuscatingGuardsTransformer(obfuscatingGuardFactory, randomGenerator, options) {
  6768. _classCallCheck(this, ObfuscatingGuardsTransformer);
  6769. var _this = _possibleConstructorReturn(this, (ObfuscatingGuardsTransformer.__proto__ || Object.getPrototypeOf(ObfuscatingGuardsTransformer)).call(this, randomGenerator, options));
  6770. _this.obfuscatingGuards = ObfuscatingGuardsTransformer_1.obfuscatingGuardsList.map(obfuscatingGuardFactory);
  6771. return _this;
  6772. }
  6773. _createClass(ObfuscatingGuardsTransformer, [{
  6774. key: "getVisitor",
  6775. value: function getVisitor(transformationStage) {
  6776. var _this2 = this;
  6777. switch (transformationStage) {
  6778. case TransformationStage_1.TransformationStage.Preparing:
  6779. return {
  6780. enter: function enter(node, parentNode) {
  6781. return _this2.transformNode(node, parentNode);
  6782. }
  6783. };
  6784. default:
  6785. return null;
  6786. }
  6787. }
  6788. }, {
  6789. key: "transformNode",
  6790. value: function transformNode(node, parentNode) {
  6791. var obfuscationAllowed = this.obfuscatingGuards.every(function (nodeGuard) {
  6792. return nodeGuard.check(node);
  6793. });
  6794. node.ignoredNode = !obfuscationAllowed;
  6795. return node;
  6796. }
  6797. }]);
  6798. return ObfuscatingGuardsTransformer;
  6799. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  6800. ObfuscatingGuardsTransformer.obfuscatingGuardsList = [ObfuscatingGuard_1.ObfuscatingGuard.BlackListNodeGuard, ObfuscatingGuard_1.ObfuscatingGuard.ConditionalCommentNodeGuard];
  6801. ObfuscatingGuardsTransformer = ObfuscatingGuardsTransformer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__INodeGuard)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], ObfuscatingGuardsTransformer);
  6802. exports.ObfuscatingGuardsTransformer = ObfuscatingGuardsTransformer;
  6803. var ObfuscatingGuardsTransformer_1;
  6804. /***/ }),
  6805. /* 141 */
  6806. /***/ (function(module, exports, __webpack_require__) {
  6807. "use strict";
  6808. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  6809. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6810. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  6811. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  6812. Object.defineProperty(exports, "__esModule", { value: true });
  6813. var tslib_1 = __webpack_require__(2);
  6814. var inversify_1 = __webpack_require__(0);
  6815. var ServiceIdentifiers_1 = __webpack_require__(1);
  6816. var TransformationStage_1 = __webpack_require__(6);
  6817. var AbstractNodeTransformer_1 = __webpack_require__(8);
  6818. var NodeUtils_1 = __webpack_require__(3);
  6819. var ParentificationTransformer = function (_AbstractNodeTransfor) {
  6820. _inherits(ParentificationTransformer, _AbstractNodeTransfor);
  6821. function ParentificationTransformer(randomGenerator, options) {
  6822. _classCallCheck(this, ParentificationTransformer);
  6823. return _possibleConstructorReturn(this, (ParentificationTransformer.__proto__ || Object.getPrototypeOf(ParentificationTransformer)).call(this, randomGenerator, options));
  6824. }
  6825. _createClass(ParentificationTransformer, [{
  6826. key: "getVisitor",
  6827. value: function getVisitor(transformationStage) {
  6828. var _this2 = this;
  6829. switch (transformationStage) {
  6830. case TransformationStage_1.TransformationStage.Preparing:
  6831. return {
  6832. enter: function enter(node, parentNode) {
  6833. return _this2.transformNode(node, parentNode);
  6834. }
  6835. };
  6836. default:
  6837. return null;
  6838. }
  6839. }
  6840. }, {
  6841. key: "transformNode",
  6842. value: function transformNode(node, parentNode) {
  6843. return NodeUtils_1.NodeUtils.parentizeNode(node, parentNode);
  6844. }
  6845. }]);
  6846. return ParentificationTransformer;
  6847. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  6848. ParentificationTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], ParentificationTransformer);
  6849. exports.ParentificationTransformer = ParentificationTransformer;
  6850. /***/ }),
  6851. /* 142 */
  6852. /***/ (function(module, exports, __webpack_require__) {
  6853. "use strict";
  6854. Object.defineProperty(exports, "__esModule", { value: true });
  6855. var inversify_1 = __webpack_require__(0);
  6856. var ServiceIdentifiers_1 = __webpack_require__(1);
  6857. var ControlFlowStorage_1 = __webpack_require__(143);
  6858. var CustomNodeGroupStorage_1 = __webpack_require__(144);
  6859. var StringArrayStorage_1 = __webpack_require__(145);
  6860. exports.storagesModule = new inversify_1.ContainerModule(function (bind) {
  6861. bind(ServiceIdentifiers_1.ServiceIdentifiers.TCustomNodeGroupStorage).to(CustomNodeGroupStorage_1.CustomNodeGroupStorage).inSingletonScope();
  6862. bind(ServiceIdentifiers_1.ServiceIdentifiers.TStringArrayStorage).to(StringArrayStorage_1.StringArrayStorage).inSingletonScope();
  6863. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__TControlFlowStorage).toConstructor(ControlFlowStorage_1.ControlFlowStorage);
  6864. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__TControlFlowStorage).toFactory(function (context) {
  6865. return function () {
  6866. var constructor = context.container.get(ServiceIdentifiers_1.ServiceIdentifiers.Newable__TControlFlowStorage);
  6867. var randomGenerator = context.container.get(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator);
  6868. var options = context.container.get(ServiceIdentifiers_1.ServiceIdentifiers.IOptions);
  6869. var storage = new constructor(randomGenerator, options);
  6870. storage.initialize();
  6871. return storage;
  6872. };
  6873. });
  6874. });
  6875. /***/ }),
  6876. /* 143 */
  6877. /***/ (function(module, exports, __webpack_require__) {
  6878. "use strict";
  6879. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6880. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  6881. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  6882. Object.defineProperty(exports, "__esModule", { value: true });
  6883. var tslib_1 = __webpack_require__(2);
  6884. var inversify_1 = __webpack_require__(0);
  6885. var ServiceIdentifiers_1 = __webpack_require__(1);
  6886. var MapStorage_1 = __webpack_require__(45);
  6887. var ControlFlowStorage = function (_MapStorage_1$MapStor) {
  6888. _inherits(ControlFlowStorage, _MapStorage_1$MapStor);
  6889. function ControlFlowStorage(randomGenerator, options) {
  6890. _classCallCheck(this, ControlFlowStorage);
  6891. return _possibleConstructorReturn(this, (ControlFlowStorage.__proto__ || Object.getPrototypeOf(ControlFlowStorage)).call(this, randomGenerator, options));
  6892. }
  6893. return ControlFlowStorage;
  6894. }(MapStorage_1.MapStorage);
  6895. ControlFlowStorage = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], ControlFlowStorage);
  6896. exports.ControlFlowStorage = ControlFlowStorage;
  6897. /***/ }),
  6898. /* 144 */
  6899. /***/ (function(module, exports, __webpack_require__) {
  6900. "use strict";
  6901. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  6902. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6903. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  6904. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  6905. Object.defineProperty(exports, "__esModule", { value: true });
  6906. var tslib_1 = __webpack_require__(2);
  6907. var inversify_1 = __webpack_require__(0);
  6908. var ServiceIdentifiers_1 = __webpack_require__(1);
  6909. var CustomNodeGroup_1 = __webpack_require__(41);
  6910. var MapStorage_1 = __webpack_require__(45);
  6911. var CustomNodeGroupStorage = CustomNodeGroupStorage_1 = function (_MapStorage_1$MapStor) {
  6912. _inherits(CustomNodeGroupStorage, _MapStorage_1$MapStor);
  6913. function CustomNodeGroupStorage(customNodeGroupFactory, randomGenerator, options) {
  6914. _classCallCheck(this, CustomNodeGroupStorage);
  6915. var _this = _possibleConstructorReturn(this, (CustomNodeGroupStorage.__proto__ || Object.getPrototypeOf(CustomNodeGroupStorage)).call(this, randomGenerator, options));
  6916. _this.customNodeGroupFactory = customNodeGroupFactory;
  6917. return _this;
  6918. }
  6919. _createClass(CustomNodeGroupStorage, [{
  6920. key: "initialize",
  6921. value: function initialize() {
  6922. var _this2 = this;
  6923. this.storage = new Map();
  6924. this.storageId = this.randomGenerator.getRandomString(6);
  6925. CustomNodeGroupStorage_1.customNodeGroupsList.forEach(function (customNodeGroupName) {
  6926. var customNodeGroup = _this2.customNodeGroupFactory(customNodeGroupName);
  6927. if (!customNodeGroup) {
  6928. return;
  6929. }
  6930. _this2.storage.set(customNodeGroupName, customNodeGroup);
  6931. });
  6932. }
  6933. }]);
  6934. return CustomNodeGroupStorage;
  6935. }(MapStorage_1.MapStorage);
  6936. CustomNodeGroupStorage.customNodeGroupsList = [CustomNodeGroup_1.CustomNodeGroup.ConsoleOutputCustomNodeGroup, CustomNodeGroup_1.CustomNodeGroup.DebugProtectionCustomNodeGroup, CustomNodeGroup_1.CustomNodeGroup.DomainLockCustomNodeGroup, CustomNodeGroup_1.CustomNodeGroup.SelfDefendingCustomNodeGroup, CustomNodeGroup_1.CustomNodeGroup.StringArrayCustomNodeGroup];
  6937. tslib_1.__decorate([inversify_1.postConstruct(), tslib_1.__metadata("design:type", Function), tslib_1.__metadata("design:paramtypes", []), tslib_1.__metadata("design:returntype", void 0)], CustomNodeGroupStorage.prototype, "initialize", null);
  6938. CustomNodeGroupStorage = CustomNodeGroupStorage_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICustomNodeGroup)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], CustomNodeGroupStorage);
  6939. exports.CustomNodeGroupStorage = CustomNodeGroupStorage;
  6940. var CustomNodeGroupStorage_1;
  6941. /***/ }),
  6942. /* 145 */
  6943. /***/ (function(module, exports, __webpack_require__) {
  6944. "use strict";
  6945. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  6946. var _get = (function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } });
  6947. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6948. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  6949. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  6950. Object.defineProperty(exports, "__esModule", { value: true });
  6951. var tslib_1 = __webpack_require__(2);
  6952. var inversify_1 = __webpack_require__(0);
  6953. var ServiceIdentifiers_1 = __webpack_require__(1);
  6954. var ArrayStorage_1 = __webpack_require__(146);
  6955. var StringArrayStorage = function (_ArrayStorage_1$Array) {
  6956. _inherits(StringArrayStorage, _ArrayStorage_1$Array);
  6957. function StringArrayStorage(identifierNamesGeneratorFactory, arrayUtils, randomGenerator, options) {
  6958. _classCallCheck(this, StringArrayStorage);
  6959. var _this = _possibleConstructorReturn(this, (StringArrayStorage.__proto__ || Object.getPrototypeOf(StringArrayStorage)).call(this, randomGenerator, options));
  6960. _this.identifierNamesGenerator = identifierNamesGeneratorFactory(options);
  6961. _this.arrayUtils = arrayUtils;
  6962. return _this;
  6963. }
  6964. _createClass(StringArrayStorage, [{
  6965. key: "initialize",
  6966. value: function initialize() {
  6967. _get(StringArrayStorage.prototype.__proto__ || Object.getPrototypeOf(StringArrayStorage.prototype), "initialize", this).call(this);
  6968. var stringArrayName = this.identifierNamesGenerator.generate(4);
  6969. var stringArrayCallsWrapperName = this.identifierNamesGenerator.generate(4);
  6970. this.storageId = stringArrayName + "|" + stringArrayCallsWrapperName;
  6971. }
  6972. }, {
  6973. key: "rotateArray",
  6974. value: function rotateArray(rotationValue) {
  6975. this.storage = this.arrayUtils.arrayRotate(this.storage, rotationValue);
  6976. }
  6977. }, {
  6978. key: "toString",
  6979. value: function toString() {
  6980. return this.storage.map(function (value) {
  6981. return "'" + value + "'";
  6982. }).toString();
  6983. }
  6984. }]);
  6985. return StringArrayStorage;
  6986. }(ArrayStorage_1.ArrayStorage);
  6987. tslib_1.__decorate([inversify_1.postConstruct(), tslib_1.__metadata("design:type", Function), tslib_1.__metadata("design:paramtypes", []), tslib_1.__metadata("design:returntype", void 0)], StringArrayStorage.prototype, "initialize", null);
  6988. StringArrayStorage = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IArrayUtils)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object, Object])], StringArrayStorage);
  6989. exports.StringArrayStorage = StringArrayStorage;
  6990. /***/ }),
  6991. /* 146 */
  6992. /***/ (function(module, exports, __webpack_require__) {
  6993. "use strict";
  6994. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  6995. function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
  6996. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6997. Object.defineProperty(exports, "__esModule", { value: true });
  6998. var tslib_1 = __webpack_require__(2);
  6999. var inversify_1 = __webpack_require__(0);
  7000. var ServiceIdentifiers_1 = __webpack_require__(1);
  7001. var Initializable_1 = __webpack_require__(5);
  7002. var ArrayStorage = function () {
  7003. function ArrayStorage(randomGenerator, options) {
  7004. _classCallCheck(this, ArrayStorage);
  7005. this.storageLength = 0;
  7006. this.randomGenerator = randomGenerator;
  7007. this.options = options;
  7008. }
  7009. _createClass(ArrayStorage, [{
  7010. key: "initialize",
  7011. value: function initialize() {
  7012. this.storage = [];
  7013. this.storageId = this.randomGenerator.getRandomString(6);
  7014. }
  7015. }, {
  7016. key: "get",
  7017. value: function get(key) {
  7018. var value = this.storage[key];
  7019. if (!value) {
  7020. throw new Error("No value found in array storage with key `" + key + "`");
  7021. }
  7022. return value;
  7023. }
  7024. }, {
  7025. key: "getKeyOf",
  7026. value: function getKeyOf(value) {
  7027. var key = this.storage.indexOf(value);
  7028. return key >= 0 ? key : null;
  7029. }
  7030. }, {
  7031. key: "getLength",
  7032. value: function getLength() {
  7033. return this.storageLength;
  7034. }
  7035. }, {
  7036. key: "getStorage",
  7037. value: function getStorage() {
  7038. return this.storage;
  7039. }
  7040. }, {
  7041. key: "getStorageId",
  7042. value: function getStorageId() {
  7043. return this.storageId;
  7044. }
  7045. }, {
  7046. key: "mergeWith",
  7047. value: function mergeWith(storage) {
  7048. var mergeId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  7049. this.storage = [].concat(_toConsumableArray(this.storage), _toConsumableArray(storage.getStorage()));
  7050. if (mergeId) {
  7051. this.storageId = storage.getStorageId();
  7052. }
  7053. }
  7054. }, {
  7055. key: "set",
  7056. value: function set(key, value) {
  7057. if (key === this.storageLength) {
  7058. this.storage.push(value);
  7059. } else {
  7060. this.storage.splice(key, 0, value);
  7061. }
  7062. this.storageLength++;
  7063. }
  7064. }]);
  7065. return ArrayStorage;
  7066. }();
  7067. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Array)], ArrayStorage.prototype, "storage", void 0);
  7068. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], ArrayStorage.prototype, "storageId", void 0);
  7069. tslib_1.__decorate([inversify_1.postConstruct(), tslib_1.__metadata("design:type", Function), tslib_1.__metadata("design:paramtypes", []), tslib_1.__metadata("design:returntype", void 0)], ArrayStorage.prototype, "initialize", null);
  7070. ArrayStorage = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], ArrayStorage);
  7071. exports.ArrayStorage = ArrayStorage;
  7072. /***/ }),
  7073. /* 147 */
  7074. /***/ (function(module, exports, __webpack_require__) {
  7075. "use strict";
  7076. Object.defineProperty(exports, "__esModule", { value: true });
  7077. var inversify_1 = __webpack_require__(0);
  7078. var ServiceIdentifiers_1 = __webpack_require__(1);
  7079. var ArrayUtils_1 = __webpack_require__(148);
  7080. var CryptUtils_1 = __webpack_require__(149);
  7081. var EscapeSequenceEncoder_1 = __webpack_require__(152);
  7082. var RandomGenerator_1 = __webpack_require__(46);
  7083. exports.utilsModule = new inversify_1.ContainerModule(function (bind) {
  7084. bind(ServiceIdentifiers_1.ServiceIdentifiers.IArrayUtils).to(ArrayUtils_1.ArrayUtils).inSingletonScope();
  7085. bind(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator).to(RandomGenerator_1.RandomGenerator).inSingletonScope();
  7086. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICryptUtils).to(CryptUtils_1.CryptUtils).inSingletonScope();
  7087. bind(ServiceIdentifiers_1.ServiceIdentifiers.IEscapeSequenceEncoder).to(EscapeSequenceEncoder_1.EscapeSequenceEncoder).inSingletonScope();
  7088. });
  7089. /***/ }),
  7090. /* 148 */
  7091. /***/ (function(module, exports, __webpack_require__) {
  7092. "use strict";
  7093. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  7094. function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
  7095. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7096. Object.defineProperty(exports, "__esModule", { value: true });
  7097. var tslib_1 = __webpack_require__(2);
  7098. var inversify_1 = __webpack_require__(0);
  7099. var ServiceIdentifiers_1 = __webpack_require__(1);
  7100. var ArrayUtils = function () {
  7101. function ArrayUtils(randomGenerator) {
  7102. _classCallCheck(this, ArrayUtils);
  7103. this.randomGenerator = randomGenerator;
  7104. }
  7105. _createClass(ArrayUtils, [{
  7106. key: "arrayRange",
  7107. value: function arrayRange(length) {
  7108. var range = [];
  7109. for (var i = 0; i < length; i++) {
  7110. range.push(i);
  7111. }
  7112. return range;
  7113. }
  7114. }, {
  7115. key: "arrayRotate",
  7116. value: function arrayRotate(array, times) {
  7117. if (!array.length) {
  7118. throw new ReferenceError("Cannot rotate empty array.");
  7119. }
  7120. if (times <= 0) {
  7121. return array;
  7122. }
  7123. var newArray = array;
  7124. var temp = void 0;
  7125. while (times--) {
  7126. temp = newArray.pop();
  7127. newArray.unshift(temp);
  7128. }
  7129. return newArray;
  7130. }
  7131. }, {
  7132. key: "arrayShuffle",
  7133. value: function arrayShuffle(array) {
  7134. var shuffledArray = [].concat(_toConsumableArray(array));
  7135. for (var i = shuffledArray.length; i; i--) {
  7136. var j = Math.floor(this.randomGenerator.getMathRandom() * i);
  7137. var _ref = [shuffledArray[j], shuffledArray[i - 1]];
  7138. shuffledArray[i - 1] = _ref[0];
  7139. shuffledArray[j] = _ref[1];
  7140. }
  7141. return shuffledArray;
  7142. }
  7143. }]);
  7144. return ArrayUtils;
  7145. }();
  7146. ArrayUtils = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__metadata("design:paramtypes", [Object])], ArrayUtils);
  7147. exports.ArrayUtils = ArrayUtils;
  7148. /***/ }),
  7149. /* 149 */
  7150. /***/ (function(module, exports, __webpack_require__) {
  7151. "use strict";
  7152. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  7153. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7154. Object.defineProperty(exports, "__esModule", { value: true });
  7155. var tslib_1 = __webpack_require__(2);
  7156. var inversify_1 = __webpack_require__(0);
  7157. var ServiceIdentifiers_1 = __webpack_require__(1);
  7158. var RandomGenerator_1 = __webpack_require__(46);
  7159. var Utils_1 = __webpack_require__(22);
  7160. var CryptUtils = function () {
  7161. function CryptUtils(randomGenerator) {
  7162. _classCallCheck(this, CryptUtils);
  7163. this.randomGenerator = randomGenerator;
  7164. }
  7165. _createClass(CryptUtils, [{
  7166. key: "btoa",
  7167. value: function btoa(string) {
  7168. var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  7169. var output = '';
  7170. string = encodeURIComponent(string).replace(/%([0-9A-F]{2})/g, function (match, p1) {
  7171. return String.fromCharCode(parseInt("" + Utils_1.Utils.hexadecimalPrefix + p1));
  7172. });
  7173. for (var block, charCode, idx = 0, map = chars; string.charAt(idx | 0) || (map = '=', idx % 1); output += map.charAt(63 & block >> 8 - idx % 1 * 8)) {
  7174. charCode = string.charCodeAt(idx += 3 / 4);
  7175. if (charCode > 0xFF) {
  7176. throw new Error("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");
  7177. }
  7178. block = block << 8 | charCode;
  7179. }
  7180. return output;
  7181. }
  7182. }, {
  7183. key: "hideString",
  7184. value: function hideString(str, length) {
  7185. var _this = this;
  7186. var escapeRegExp = function escapeRegExp(s) {
  7187. return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
  7188. };
  7189. var randomMerge = function randomMerge(s1, s2) {
  7190. var i1 = -1,
  7191. i2 = -1,
  7192. result = '';
  7193. while (i1 < s1.length || i2 < s2.length) {
  7194. if (_this.randomGenerator.getMathRandom() < 0.5 && i2 < s2.length) {
  7195. result += s2.charAt(++i2);
  7196. } else {
  7197. result += s1.charAt(++i1);
  7198. }
  7199. }
  7200. return result;
  7201. };
  7202. var randomString = this.randomGenerator.getRandomGenerator().string({
  7203. length: length,
  7204. pool: RandomGenerator_1.RandomGenerator.randomGeneratorPool
  7205. });
  7206. var randomStringDiff = randomString.replace(new RegExp("[" + escapeRegExp(str) + "]", 'g'), '');
  7207. var randomStringDiffArray = randomStringDiff.split('');
  7208. this.randomGenerator.getRandomGenerator().shuffle(randomStringDiffArray);
  7209. randomStringDiff = randomStringDiffArray.join('');
  7210. return [randomMerge(str, randomStringDiff), randomStringDiff];
  7211. }
  7212. }, {
  7213. key: "rc4",
  7214. value: function rc4(string, key) {
  7215. var s = [],
  7216. j = 0,
  7217. x = void 0,
  7218. result = '';
  7219. for (var i = 0; i < 256; i++) {
  7220. s[i] = i;
  7221. }
  7222. for (i = 0; i < 256; i++) {
  7223. j = (j + s[i] + key.charCodeAt(i % key.length)) % 256;
  7224. x = s[i];
  7225. s[i] = s[j];
  7226. s[j] = x;
  7227. }
  7228. i = 0;
  7229. j = 0;
  7230. for (var y = 0; y < string.length; y++) {
  7231. i = (i + 1) % 256;
  7232. j = (j + s[i]) % 256;
  7233. x = s[i];
  7234. s[i] = s[j];
  7235. s[j] = x;
  7236. result += String.fromCharCode(string.charCodeAt(y) ^ s[(s[i] + s[j]) % 256]);
  7237. }
  7238. return result;
  7239. }
  7240. }]);
  7241. return CryptUtils;
  7242. }();
  7243. CryptUtils = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__metadata("design:paramtypes", [Object])], CryptUtils);
  7244. exports.CryptUtils = CryptUtils;
  7245. /***/ }),
  7246. /* 150 */
  7247. /***/ (function(module, exports) {
  7248. module.exports = require("md5");
  7249. /***/ }),
  7250. /* 151 */
  7251. /***/ (function(module, exports) {
  7252. module.exports = require("chance");
  7253. /***/ }),
  7254. /* 152 */
  7255. /***/ (function(module, exports, __webpack_require__) {
  7256. "use strict";
  7257. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  7258. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7259. Object.defineProperty(exports, "__esModule", { value: true });
  7260. var tslib_1 = __webpack_require__(2);
  7261. var inversify_1 = __webpack_require__(0);
  7262. var EscapeSequenceEncoder = function () {
  7263. function EscapeSequenceEncoder() {
  7264. _classCallCheck(this, EscapeSequenceEncoder);
  7265. this.stringsCache = new Map();
  7266. }
  7267. _createClass(EscapeSequenceEncoder, [{
  7268. key: "encode",
  7269. value: function encode(string, encodeAllSymbols) {
  7270. var cacheKey = string + "-" + String(encodeAllSymbols);
  7271. if (this.stringsCache.has(cacheKey)) {
  7272. return this.stringsCache.get(cacheKey);
  7273. }
  7274. var radix = 16;
  7275. var replaceRegExp = new RegExp('[\\s\\S]', 'g');
  7276. var escapeSequenceRegExp = new RegExp('[\'\"\\\\\\s]');
  7277. var regExp = new RegExp('[\\x00-\\x7F]');
  7278. var prefix = void 0,
  7279. template = void 0;
  7280. var result = string.replace(replaceRegExp, function (character) {
  7281. if (!encodeAllSymbols && !escapeSequenceRegExp.exec(character)) {
  7282. return character;
  7283. }
  7284. if (regExp.exec(character)) {
  7285. prefix = '\\x';
  7286. template = '00';
  7287. } else {
  7288. prefix = "\\u";
  7289. template = '0000';
  7290. }
  7291. return "" + prefix + (template + character.charCodeAt(0).toString(radix)).slice(-template.length);
  7292. });
  7293. this.stringsCache.set(cacheKey, result);
  7294. return result;
  7295. }
  7296. }]);
  7297. return EscapeSequenceEncoder;
  7298. }();
  7299. EscapeSequenceEncoder = tslib_1.__decorate([inversify_1.injectable()], EscapeSequenceEncoder);
  7300. exports.EscapeSequenceEncoder = EscapeSequenceEncoder;
  7301. /***/ }),
  7302. /* 153 */
  7303. /***/ (function(module, exports, __webpack_require__) {
  7304. "use strict";
  7305. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  7306. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7307. Object.defineProperty(exports, "__esModule", { value: true });
  7308. var tslib_1 = __webpack_require__(2);
  7309. var inversify_1 = __webpack_require__(0);
  7310. var ServiceIdentifiers_1 = __webpack_require__(1);
  7311. var esprima = __webpack_require__(37);
  7312. var escodegen = __webpack_require__(30);
  7313. var packageJson = __webpack_require__(47);
  7314. var LoggingMessage_1 = __webpack_require__(154);
  7315. var NodeTransformer_1 = __webpack_require__(20);
  7316. var ObfuscationEvent_1 = __webpack_require__(17);
  7317. var TransformationStage_1 = __webpack_require__(6);
  7318. var NodeGuards_1 = __webpack_require__(4);
  7319. var JavaScriptObfuscator = JavaScriptObfuscator_1 = function () {
  7320. function JavaScriptObfuscator(stackTraceAnalyzer, obfuscationEventEmitter, customNodeGroupStorage, transformersRunner, sourceMapCorrector, randomGenerator, logger, options) {
  7321. _classCallCheck(this, JavaScriptObfuscator);
  7322. this.stackTraceAnalyzer = stackTraceAnalyzer;
  7323. this.obfuscationEventEmitter = obfuscationEventEmitter;
  7324. this.customNodeGroupStorage = customNodeGroupStorage;
  7325. this.transformersRunner = transformersRunner;
  7326. this.sourceMapCorrector = sourceMapCorrector;
  7327. this.randomGenerator = randomGenerator;
  7328. this.logger = logger;
  7329. this.options = options;
  7330. }
  7331. _createClass(JavaScriptObfuscator, [{
  7332. key: "obfuscate",
  7333. value: function obfuscate(sourceCode) {
  7334. var timeStart = Date.now();
  7335. this.logger.info(LoggingMessage_1.LoggingMessage.Version, packageJson.version);
  7336. this.logger.info(LoggingMessage_1.LoggingMessage.ObfuscationStarted);
  7337. this.logger.info(LoggingMessage_1.LoggingMessage.RandomGeneratorSeed, this.randomGenerator.getSeed());
  7338. var astTree = this.parseCode(sourceCode);
  7339. var obfuscatedAstTree = this.transformAstTree(astTree);
  7340. var generatorOutput = this.generateCode(sourceCode, obfuscatedAstTree);
  7341. var obfuscationTime = (Date.now() - timeStart) / 1000;
  7342. this.logger.success(LoggingMessage_1.LoggingMessage.ObfuscationCompleted, obfuscationTime);
  7343. return this.getObfuscationResult(generatorOutput);
  7344. }
  7345. }, {
  7346. key: "parseCode",
  7347. value: function parseCode(sourceCode) {
  7348. return esprima.parseScript(sourceCode, {
  7349. attachComment: true,
  7350. loc: this.options.sourceMap
  7351. });
  7352. }
  7353. }, {
  7354. key: "transformAstTree",
  7355. value: function transformAstTree(astTree) {
  7356. var _this = this;
  7357. var isEmptyAstTree = NodeGuards_1.NodeGuards.isProgramNode(astTree) && !astTree.body.length && !astTree.leadingComments;
  7358. if (isEmptyAstTree) {
  7359. this.logger.warn(LoggingMessage_1.LoggingMessage.EmptySourceCode);
  7360. return astTree;
  7361. }
  7362. astTree = this.runPreparingStage(astTree);
  7363. this.logger.info(LoggingMessage_1.LoggingMessage.AnalyzingASTTreeStage);
  7364. var stackTraceData = this.stackTraceAnalyzer.analyze(astTree);
  7365. this.customNodeGroupStorage.getStorage().forEach(function (customNodeGroup) {
  7366. customNodeGroup.initialize();
  7367. _this.obfuscationEventEmitter.once(customNodeGroup.getAppendEvent(), customNodeGroup.appendCustomNodes.bind(customNodeGroup));
  7368. });
  7369. this.obfuscationEventEmitter.emit(ObfuscationEvent_1.ObfuscationEvent.BeforeObfuscation, astTree, stackTraceData);
  7370. astTree = this.runDeadCodeInjectionStage(astTree);
  7371. astTree = this.runControlFlowFlatteningStage(astTree);
  7372. astTree = this.runConvertingStage(astTree);
  7373. astTree = this.runObfuscatingStage(astTree);
  7374. astTree = this.runFinalizingStage(astTree);
  7375. this.obfuscationEventEmitter.emit(ObfuscationEvent_1.ObfuscationEvent.AfterObfuscation, astTree, stackTraceData);
  7376. return astTree;
  7377. }
  7378. }, {
  7379. key: "generateCode",
  7380. value: function generateCode(sourceCode, astTree) {
  7381. var escodegenParams = Object.assign({}, JavaScriptObfuscator_1.escodegenParams);
  7382. if (this.options.sourceMap) {
  7383. escodegenParams.sourceMap = 'sourceMap';
  7384. escodegenParams.sourceContent = sourceCode;
  7385. }
  7386. var generatorOutput = escodegen.generate(astTree, Object.assign({}, escodegenParams, { format: {
  7387. compact: this.options.compact
  7388. } }));
  7389. generatorOutput.map = generatorOutput.map ? generatorOutput.map.toString() : '';
  7390. return generatorOutput;
  7391. }
  7392. }, {
  7393. key: "getObfuscationResult",
  7394. value: function getObfuscationResult(generatorOutput) {
  7395. return this.sourceMapCorrector.correct(generatorOutput.code, generatorOutput.map);
  7396. }
  7397. }, {
  7398. key: "runPreparingStage",
  7399. value: function runPreparingStage(astTree) {
  7400. this.logger.info(LoggingMessage_1.LoggingMessage.TransformationStage, TransformationStage_1.TransformationStage.Preparing);
  7401. return this.transformersRunner.transform(astTree, JavaScriptObfuscator_1.transformersList, TransformationStage_1.TransformationStage.Preparing);
  7402. }
  7403. }, {
  7404. key: "runDeadCodeInjectionStage",
  7405. value: function runDeadCodeInjectionStage(astTree) {
  7406. if (this.options.deadCodeInjection) {
  7407. this.logger.info(LoggingMessage_1.LoggingMessage.TransformationStage, TransformationStage_1.TransformationStage.DeadCodeInjection);
  7408. }
  7409. return this.transformersRunner.transform(astTree, JavaScriptObfuscator_1.transformersList, TransformationStage_1.TransformationStage.DeadCodeInjection);
  7410. }
  7411. }, {
  7412. key: "runControlFlowFlatteningStage",
  7413. value: function runControlFlowFlatteningStage(astTree) {
  7414. if (this.options.controlFlowFlattening) {
  7415. this.logger.info(LoggingMessage_1.LoggingMessage.TransformationStage, TransformationStage_1.TransformationStage.ControlFlowFlattening);
  7416. }
  7417. return this.transformersRunner.transform(astTree, JavaScriptObfuscator_1.transformersList, TransformationStage_1.TransformationStage.ControlFlowFlattening);
  7418. }
  7419. }, {
  7420. key: "runConvertingStage",
  7421. value: function runConvertingStage(astTree) {
  7422. this.logger.info(LoggingMessage_1.LoggingMessage.TransformationStage, TransformationStage_1.TransformationStage.Converting);
  7423. return this.transformersRunner.transform(astTree, JavaScriptObfuscator_1.transformersList, TransformationStage_1.TransformationStage.Converting);
  7424. }
  7425. }, {
  7426. key: "runObfuscatingStage",
  7427. value: function runObfuscatingStage(astTree) {
  7428. this.logger.info(LoggingMessage_1.LoggingMessage.TransformationStage, TransformationStage_1.TransformationStage.Obfuscating);
  7429. return this.transformersRunner.transform(astTree, JavaScriptObfuscator_1.transformersList, TransformationStage_1.TransformationStage.Obfuscating);
  7430. }
  7431. }, {
  7432. key: "runFinalizingStage",
  7433. value: function runFinalizingStage(astTree) {
  7434. this.logger.info(LoggingMessage_1.LoggingMessage.TransformationStage, TransformationStage_1.TransformationStage.Finalizing);
  7435. return this.transformersRunner.transform(astTree, JavaScriptObfuscator_1.transformersList, TransformationStage_1.TransformationStage.Finalizing);
  7436. }
  7437. }]);
  7438. return JavaScriptObfuscator;
  7439. }();
  7440. JavaScriptObfuscator.escodegenParams = {
  7441. comment: true,
  7442. verbatim: 'x-verbatim-property',
  7443. sourceMapWithCode: true
  7444. };
  7445. JavaScriptObfuscator.transformersList = [NodeTransformer_1.NodeTransformer.BlockStatementControlFlowTransformer, NodeTransformer_1.NodeTransformer.ClassDeclarationTransformer, NodeTransformer_1.NodeTransformer.CommentsTransformer, NodeTransformer_1.NodeTransformer.DeadCodeInjectionTransformer, NodeTransformer_1.NodeTransformer.EvalCallExpressionTransformer, NodeTransformer_1.NodeTransformer.FunctionControlFlowTransformer, NodeTransformer_1.NodeTransformer.CatchClauseTransformer, NodeTransformer_1.NodeTransformer.FunctionDeclarationTransformer, NodeTransformer_1.NodeTransformer.FunctionTransformer, NodeTransformer_1.NodeTransformer.LabeledStatementTransformer, NodeTransformer_1.NodeTransformer.LiteralTransformer, NodeTransformer_1.NodeTransformer.MemberExpressionTransformer, NodeTransformer_1.NodeTransformer.MethodDefinitionTransformer, NodeTransformer_1.NodeTransformer.ObfuscatingGuardsTransformer, NodeTransformer_1.NodeTransformer.ObjectExpressionKeysTransformer, NodeTransformer_1.NodeTransformer.ObjectExpressionTransformer, NodeTransformer_1.NodeTransformer.ParentificationTransformer, NodeTransformer_1.NodeTransformer.TemplateLiteralTransformer, NodeTransformer_1.NodeTransformer.VariableDeclarationTransformer];
  7446. JavaScriptObfuscator = JavaScriptObfuscator_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IStackTraceAnalyzer)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscationEventEmitter)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.TCustomNodeGroupStorage)), tslib_1.__param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ITransformersRunner)), tslib_1.__param(4, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ISourceMapCorrector)), tslib_1.__param(5, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(6, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ILogger)), tslib_1.__param(7, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object, Object, Object, Object, Object, Object, Object])], JavaScriptObfuscator);
  7447. exports.JavaScriptObfuscator = JavaScriptObfuscator;
  7448. var JavaScriptObfuscator_1;
  7449. /***/ }),
  7450. /* 154 */
  7451. /***/ (function(module, exports, __webpack_require__) {
  7452. "use strict";
  7453. Object.defineProperty(exports, "__esModule", { value: true });
  7454. var LoggingMessage;
  7455. (function (LoggingMessage) {
  7456. LoggingMessage["AnalyzingASTTreeStage"] = "Stage: analyzing AST-tree...";
  7457. LoggingMessage["EmptySourceCode"] = "Empty source code. Obfuscation canceled...";
  7458. LoggingMessage["ObfuscationCompleted"] = "Obfuscation completed. Total time: %s sec.";
  7459. LoggingMessage["ObfuscationStarted"] = "Obfuscation started...";
  7460. LoggingMessage["RandomGeneratorSeed"] = "Random generator seed: %s...";
  7461. LoggingMessage["TransformationStage"] = "Transformation stage: %s...";
  7462. LoggingMessage["Version"] = "Version: %s";
  7463. })(LoggingMessage = exports.LoggingMessage || (exports.LoggingMessage = {}));
  7464. /***/ }),
  7465. /* 155 */
  7466. /***/ (function(module, exports, __webpack_require__) {
  7467. "use strict";
  7468. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  7469. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7470. Object.defineProperty(exports, "__esModule", { value: true });
  7471. var tslib_1 = __webpack_require__(2);
  7472. var inversify_1 = __webpack_require__(0);
  7473. var ServiceIdentifiers_1 = __webpack_require__(1);
  7474. var chalk_1 = __webpack_require__(156);
  7475. var Initializable_1 = __webpack_require__(5);
  7476. var Logger = Logger_1 = function () {
  7477. function Logger(options) {
  7478. _classCallCheck(this, Logger);
  7479. this.options = options;
  7480. }
  7481. _createClass(Logger, [{
  7482. key: "initialize",
  7483. value: function initialize() {
  7484. this.colorInfo = chalk_1.default.cyan;
  7485. this.colorSuccess = chalk_1.default.green;
  7486. this.colorWarn = chalk_1.default.yellow;
  7487. }
  7488. }, {
  7489. key: "info",
  7490. value: function info(loggingMessage, value) {
  7491. this.log(this.colorInfo, loggingMessage, value);
  7492. }
  7493. }, {
  7494. key: "success",
  7495. value: function success(loggingMessage, value) {
  7496. this.log(this.colorSuccess, loggingMessage, value);
  7497. }
  7498. }, {
  7499. key: "warn",
  7500. value: function warn(loggingMessage, value) {
  7501. this.log(this.colorWarn, loggingMessage, value);
  7502. }
  7503. }, {
  7504. key: "log",
  7505. value: function log(loggingLevelColor, loggingMessage, value) {
  7506. if (!this.options.log) {
  7507. return;
  7508. }
  7509. var processedMessage = loggingLevelColor("\n" + Logger_1.loggingPrefix + " " + loggingMessage);
  7510. !value ? console.log(processedMessage) : console.log(processedMessage, value);
  7511. }
  7512. }]);
  7513. return Logger;
  7514. }();
  7515. Logger.loggingPrefix = '[javascript-obfuscator]';
  7516. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Function)], Logger.prototype, "colorInfo", void 0);
  7517. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Function)], Logger.prototype, "colorSuccess", void 0);
  7518. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Function)], Logger.prototype, "colorWarn", void 0);
  7519. tslib_1.__decorate([inversify_1.postConstruct(), tslib_1.__metadata("design:type", Function), tslib_1.__metadata("design:paramtypes", []), tslib_1.__metadata("design:returntype", void 0)], Logger.prototype, "initialize", null);
  7520. Logger = Logger_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object])], Logger);
  7521. exports.Logger = Logger;
  7522. var Logger_1;
  7523. /***/ }),
  7524. /* 156 */
  7525. /***/ (function(module, exports) {
  7526. module.exports = require("chalk");
  7527. /***/ }),
  7528. /* 157 */
  7529. /***/ (function(module, exports, __webpack_require__) {
  7530. "use strict";
  7531. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7532. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  7533. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  7534. Object.defineProperty(exports, "__esModule", { value: true });
  7535. var tslib_1 = __webpack_require__(2);
  7536. var inversify_1 = __webpack_require__(0);
  7537. var events_1 = __webpack_require__(158);
  7538. inversify_1.decorate(inversify_1.injectable(), events_1.EventEmitter);
  7539. var ObfuscationEventEmitter = function (_events_1$EventEmitte) {
  7540. _inherits(ObfuscationEventEmitter, _events_1$EventEmitte);
  7541. function ObfuscationEventEmitter() {
  7542. _classCallCheck(this, ObfuscationEventEmitter);
  7543. return _possibleConstructorReturn(this, (ObfuscationEventEmitter.__proto__ || Object.getPrototypeOf(ObfuscationEventEmitter)).apply(this, arguments));
  7544. }
  7545. return ObfuscationEventEmitter;
  7546. }(events_1.EventEmitter);
  7547. ObfuscationEventEmitter = tslib_1.__decorate([inversify_1.injectable()], ObfuscationEventEmitter);
  7548. exports.ObfuscationEventEmitter = ObfuscationEventEmitter;
  7549. /***/ }),
  7550. /* 158 */
  7551. /***/ (function(module, exports) {
  7552. module.exports = require("events");
  7553. /***/ }),
  7554. /* 159 */
  7555. /***/ (function(module, exports, __webpack_require__) {
  7556. "use strict";
  7557. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  7558. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7559. Object.defineProperty(exports, "__esModule", { value: true });
  7560. var tslib_1 = __webpack_require__(2);
  7561. var inversify_1 = __webpack_require__(0);
  7562. var Initializable_1 = __webpack_require__(5);
  7563. var ObfuscationResult = function () {
  7564. function ObfuscationResult() {
  7565. _classCallCheck(this, ObfuscationResult);
  7566. }
  7567. _createClass(ObfuscationResult, [{
  7568. key: "initialize",
  7569. value: function initialize(obfuscatedCode, sourceMap) {
  7570. this.obfuscatedCode = obfuscatedCode;
  7571. this.sourceMap = sourceMap;
  7572. }
  7573. }, {
  7574. key: "getObfuscatedCode",
  7575. value: function getObfuscatedCode() {
  7576. return this.obfuscatedCode;
  7577. }
  7578. }, {
  7579. key: "getSourceMap",
  7580. value: function getSourceMap() {
  7581. return this.sourceMap;
  7582. }
  7583. }, {
  7584. key: "toString",
  7585. value: function toString() {
  7586. return this.obfuscatedCode;
  7587. }
  7588. }]);
  7589. return ObfuscationResult;
  7590. }();
  7591. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], ObfuscationResult.prototype, "obfuscatedCode", void 0);
  7592. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], ObfuscationResult.prototype, "sourceMap", void 0);
  7593. ObfuscationResult = tslib_1.__decorate([inversify_1.injectable()], ObfuscationResult);
  7594. exports.ObfuscationResult = ObfuscationResult;
  7595. /***/ }),
  7596. /* 160 */
  7597. /***/ (function(module, exports, __webpack_require__) {
  7598. "use strict";
  7599. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7600. Object.defineProperty(exports, "__esModule", { value: true });
  7601. var tslib_1 = __webpack_require__(2);
  7602. var inversify_1 = __webpack_require__(0);
  7603. var class_validator_1 = __webpack_require__(161);
  7604. var IdentifierNamesGenerator_1 = __webpack_require__(24);
  7605. var ObfuscationTarget_1 = __webpack_require__(14);
  7606. var SourceMapMode_1 = __webpack_require__(25);
  7607. var StringArrayEncoding_1 = __webpack_require__(26);
  7608. var Default_1 = __webpack_require__(33);
  7609. var OptionsNormalizer_1 = __webpack_require__(162);
  7610. var ValidationErrorsFormatter_1 = __webpack_require__(173);
  7611. var Options = Options_1 = function Options(inputOptions) {
  7612. _classCallCheck(this, Options);
  7613. Object.assign(this, Default_1.DEFAULT_PRESET, inputOptions);
  7614. var errors = class_validator_1.validateSync(this, Options_1.validatorOptions);
  7615. if (errors.length) {
  7616. throw new ReferenceError("Validation failed. errors:\n" + ValidationErrorsFormatter_1.ValidationErrorsFormatter.format(errors));
  7617. }
  7618. Object.assign(this, OptionsNormalizer_1.OptionsNormalizer.normalizeOptions(this));
  7619. };
  7620. Options.validatorOptions = {
  7621. validationError: {
  7622. target: false
  7623. }
  7624. };
  7625. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "compact", void 0);
  7626. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "controlFlowFlattening", void 0);
  7627. tslib_1.__decorate([class_validator_1.IsNumber(), class_validator_1.Min(0), class_validator_1.Max(1), tslib_1.__metadata("design:type", Number)], Options.prototype, "controlFlowFlatteningThreshold", void 0);
  7628. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "deadCodeInjection", void 0);
  7629. tslib_1.__decorate([class_validator_1.IsNumber(), tslib_1.__metadata("design:type", Number)], Options.prototype, "deadCodeInjectionThreshold", void 0);
  7630. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "debugProtection", void 0);
  7631. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "debugProtectionInterval", void 0);
  7632. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "disableConsoleOutput", void 0);
  7633. tslib_1.__decorate([class_validator_1.IsArray(), class_validator_1.ArrayUnique(), class_validator_1.IsString({
  7634. each: true
  7635. }), tslib_1.__metadata("design:type", Array)], Options.prototype, "domainLock", void 0);
  7636. tslib_1.__decorate([class_validator_1.IsIn([IdentifierNamesGenerator_1.IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator, IdentifierNamesGenerator_1.IdentifierNamesGenerator.MangledIdentifierNamesGenerator]), tslib_1.__metadata("design:type", String)], Options.prototype, "identifierNamesGenerator", void 0);
  7637. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "log", void 0);
  7638. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "renameGlobals", void 0);
  7639. tslib_1.__decorate([class_validator_1.IsArray(), class_validator_1.ArrayUnique(), class_validator_1.IsString({
  7640. each: true
  7641. }), tslib_1.__metadata("design:type", Array)], Options.prototype, "reservedNames", void 0);
  7642. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "rotateStringArray", void 0);
  7643. tslib_1.__decorate([class_validator_1.IsNumber(), tslib_1.__metadata("design:type", Number)], Options.prototype, "seed", void 0);
  7644. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "selfDefending", void 0);
  7645. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "sourceMap", void 0);
  7646. tslib_1.__decorate([class_validator_1.IsString(), class_validator_1.ValidateIf(function (options) {
  7647. return Boolean(options.sourceMapBaseUrl);
  7648. }), class_validator_1.IsUrl({
  7649. require_protocol: true,
  7650. require_valid_protocol: true
  7651. }), tslib_1.__metadata("design:type", String)], Options.prototype, "sourceMapBaseUrl", void 0);
  7652. tslib_1.__decorate([class_validator_1.IsString(), tslib_1.__metadata("design:type", String)], Options.prototype, "sourceMapFileName", void 0);
  7653. tslib_1.__decorate([class_validator_1.IsIn([SourceMapMode_1.SourceMapMode.Inline, SourceMapMode_1.SourceMapMode.Separate]), tslib_1.__metadata("design:type", String)], Options.prototype, "sourceMapMode", void 0);
  7654. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "stringArray", void 0);
  7655. tslib_1.__decorate([class_validator_1.IsIn([true, false, StringArrayEncoding_1.StringArrayEncoding.Base64, StringArrayEncoding_1.StringArrayEncoding.Rc4]), tslib_1.__metadata("design:type", Object)], Options.prototype, "stringArrayEncoding", void 0);
  7656. tslib_1.__decorate([class_validator_1.IsNumber(), class_validator_1.Min(0), class_validator_1.Max(1), tslib_1.__metadata("design:type", Number)], Options.prototype, "stringArrayThreshold", void 0);
  7657. tslib_1.__decorate([class_validator_1.IsIn([ObfuscationTarget_1.ObfuscationTarget.Browser, ObfuscationTarget_1.ObfuscationTarget.Extension, ObfuscationTarget_1.ObfuscationTarget.Node]), tslib_1.__metadata("design:type", String)], Options.prototype, "target", void 0);
  7658. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "transformObjectKeys", void 0);
  7659. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "unicodeEscapeSequence", void 0);
  7660. Options = Options_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__metadata("design:paramtypes", [Object])], Options);
  7661. exports.Options = Options;
  7662. var Options_1;
  7663. /***/ }),
  7664. /* 161 */
  7665. /***/ (function(module, exports) {
  7666. module.exports = require("class-validator");
  7667. /***/ }),
  7668. /* 162 */
  7669. /***/ (function(module, exports, __webpack_require__) {
  7670. "use strict";
  7671. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  7672. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7673. Object.defineProperty(exports, "__esModule", { value: true });
  7674. var ControlFlowFlatteningThresholdRule_1 = __webpack_require__(163);
  7675. var DeadCodeInjectionRule_1 = __webpack_require__(164);
  7676. var DeadCodeInjectionThresholdRule_1 = __webpack_require__(165);
  7677. var DomainLockRule_1 = __webpack_require__(166);
  7678. var SelfDefendingRule_1 = __webpack_require__(167);
  7679. var SourceMapBaseUrlRule_1 = __webpack_require__(168);
  7680. var SourceMapFileNameRule_1 = __webpack_require__(169);
  7681. var StringArrayRule_1 = __webpack_require__(170);
  7682. var StringArrayEncodingRule_1 = __webpack_require__(171);
  7683. var StringArrayThresholdRule_1 = __webpack_require__(172);
  7684. var OptionsNormalizer = function () {
  7685. function OptionsNormalizer() {
  7686. _classCallCheck(this, OptionsNormalizer);
  7687. }
  7688. _createClass(OptionsNormalizer, null, [{
  7689. key: "normalizeOptions",
  7690. value: function normalizeOptions(options) {
  7691. var normalizedOptions = Object.assign({}, options);
  7692. var _iteratorNormalCompletion = true;
  7693. var _didIteratorError = false;
  7694. var _iteratorError = undefined;
  7695. try {
  7696. for (var _iterator = OptionsNormalizer.normalizerRules[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  7697. var normalizerRule = _step.value;
  7698. normalizedOptions = normalizerRule(normalizedOptions);
  7699. }
  7700. } catch (err) {
  7701. _didIteratorError = true;
  7702. _iteratorError = err;
  7703. } finally {
  7704. try {
  7705. if (!_iteratorNormalCompletion && _iterator.return) {
  7706. _iterator.return();
  7707. }
  7708. } finally {
  7709. if (_didIteratorError) {
  7710. throw _iteratorError;
  7711. }
  7712. }
  7713. }
  7714. return normalizedOptions;
  7715. }
  7716. }]);
  7717. return OptionsNormalizer;
  7718. }();
  7719. OptionsNormalizer.normalizerRules = [ControlFlowFlatteningThresholdRule_1.ControlFlowFlatteningThresholdRule, DeadCodeInjectionRule_1.DeadCodeInjectionRule, DeadCodeInjectionThresholdRule_1.DeadCodeInjectionThresholdRule, DomainLockRule_1.DomainLockRule, SelfDefendingRule_1.SelfDefendingRule, SourceMapBaseUrlRule_1.SourceMapBaseUrlRule, SourceMapFileNameRule_1.SourceMapFileNameRule, StringArrayRule_1.StringArrayRule, StringArrayEncodingRule_1.StringArrayEncodingRule, StringArrayThresholdRule_1.StringArrayThresholdRule];
  7720. exports.OptionsNormalizer = OptionsNormalizer;
  7721. /***/ }),
  7722. /* 163 */
  7723. /***/ (function(module, exports, __webpack_require__) {
  7724. "use strict";
  7725. Object.defineProperty(exports, "__esModule", { value: true });
  7726. exports.ControlFlowFlatteningThresholdRule = function (options) {
  7727. if (options.controlFlowFlatteningThreshold === 0) {
  7728. options = Object.assign({}, options, { controlFlowFlattening: false, controlFlowFlatteningThreshold: 0 });
  7729. }
  7730. return options;
  7731. };
  7732. /***/ }),
  7733. /* 164 */
  7734. /***/ (function(module, exports, __webpack_require__) {
  7735. "use strict";
  7736. Object.defineProperty(exports, "__esModule", { value: true });
  7737. var Default_1 = __webpack_require__(33);
  7738. exports.DeadCodeInjectionRule = function (options) {
  7739. if (options.deadCodeInjection) {
  7740. options = Object.assign({}, options, { deadCodeInjection: true, stringArray: true });
  7741. if (!options.stringArrayThreshold) {
  7742. options = Object.assign({}, options, { stringArray: true, stringArrayThreshold: Default_1.DEFAULT_PRESET.stringArrayThreshold });
  7743. }
  7744. }
  7745. return options;
  7746. };
  7747. /***/ }),
  7748. /* 165 */
  7749. /***/ (function(module, exports, __webpack_require__) {
  7750. "use strict";
  7751. Object.defineProperty(exports, "__esModule", { value: true });
  7752. exports.DeadCodeInjectionThresholdRule = function (options) {
  7753. if (options.deadCodeInjectionThreshold === 0) {
  7754. options = Object.assign({}, options, { deadCodeInjection: false, deadCodeInjectionThreshold: 0 });
  7755. }
  7756. return options;
  7757. };
  7758. /***/ }),
  7759. /* 166 */
  7760. /***/ (function(module, exports, __webpack_require__) {
  7761. "use strict";
  7762. Object.defineProperty(exports, "__esModule", { value: true });
  7763. var Utils_1 = __webpack_require__(22);
  7764. exports.DomainLockRule = function (options) {
  7765. if (options.domainLock.length) {
  7766. var normalizedDomains = [];
  7767. var _iteratorNormalCompletion = true;
  7768. var _didIteratorError = false;
  7769. var _iteratorError = undefined;
  7770. try {
  7771. for (var _iterator = options.domainLock[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  7772. var domain = _step.value;
  7773. normalizedDomains.push(Utils_1.Utils.extractDomainFromUrl(domain));
  7774. }
  7775. } catch (err) {
  7776. _didIteratorError = true;
  7777. _iteratorError = err;
  7778. } finally {
  7779. try {
  7780. if (!_iteratorNormalCompletion && _iterator.return) {
  7781. _iterator.return();
  7782. }
  7783. } finally {
  7784. if (_didIteratorError) {
  7785. throw _iteratorError;
  7786. }
  7787. }
  7788. }
  7789. options = Object.assign({}, options, { domainLock: normalizedDomains });
  7790. }
  7791. return options;
  7792. };
  7793. /***/ }),
  7794. /* 167 */
  7795. /***/ (function(module, exports, __webpack_require__) {
  7796. "use strict";
  7797. Object.defineProperty(exports, "__esModule", { value: true });
  7798. exports.SelfDefendingRule = function (options) {
  7799. if (options.selfDefending) {
  7800. options = Object.assign({}, options, { compact: true, selfDefending: true });
  7801. }
  7802. return options;
  7803. };
  7804. /***/ }),
  7805. /* 168 */
  7806. /***/ (function(module, exports, __webpack_require__) {
  7807. "use strict";
  7808. Object.defineProperty(exports, "__esModule", { value: true });
  7809. exports.SourceMapBaseUrlRule = function (options) {
  7810. var _options = options,
  7811. sourceMapBaseUrl = _options.sourceMapBaseUrl;
  7812. if (!options.sourceMapFileName) {
  7813. options = Object.assign({}, options, { sourceMapBaseUrl: '' });
  7814. return options;
  7815. }
  7816. if (sourceMapBaseUrl && !sourceMapBaseUrl.endsWith('/')) {
  7817. options = Object.assign({}, options, { sourceMapBaseUrl: sourceMapBaseUrl + "/" });
  7818. }
  7819. return options;
  7820. };
  7821. /***/ }),
  7822. /* 169 */
  7823. /***/ (function(module, exports, __webpack_require__) {
  7824. "use strict";
  7825. Object.defineProperty(exports, "__esModule", { value: true });
  7826. exports.SourceMapFileNameRule = function (options) {
  7827. var _options = options,
  7828. sourceMapFileName = _options.sourceMapFileName;
  7829. if (sourceMapFileName) {
  7830. sourceMapFileName = sourceMapFileName.replace(/^\/+/, '').split('.')[0];
  7831. options = Object.assign({}, options, { sourceMapFileName: sourceMapFileName + ".js.map" });
  7832. }
  7833. return options;
  7834. };
  7835. /***/ }),
  7836. /* 170 */
  7837. /***/ (function(module, exports, __webpack_require__) {
  7838. "use strict";
  7839. Object.defineProperty(exports, "__esModule", { value: true });
  7840. exports.StringArrayRule = function (options) {
  7841. if (!options.stringArray) {
  7842. options = Object.assign({}, options, { rotateStringArray: false, stringArray: false, stringArrayEncoding: false, stringArrayThreshold: 0 });
  7843. }
  7844. return options;
  7845. };
  7846. /***/ }),
  7847. /* 171 */
  7848. /***/ (function(module, exports, __webpack_require__) {
  7849. "use strict";
  7850. Object.defineProperty(exports, "__esModule", { value: true });
  7851. var StringArrayEncoding_1 = __webpack_require__(26);
  7852. exports.StringArrayEncodingRule = function (options) {
  7853. if (options.stringArrayEncoding === true) {
  7854. options = Object.assign({}, options, { stringArrayEncoding: StringArrayEncoding_1.StringArrayEncoding.Base64 });
  7855. }
  7856. return options;
  7857. };
  7858. /***/ }),
  7859. /* 172 */
  7860. /***/ (function(module, exports, __webpack_require__) {
  7861. "use strict";
  7862. Object.defineProperty(exports, "__esModule", { value: true });
  7863. exports.StringArrayThresholdRule = function (options) {
  7864. if (options.stringArrayThreshold === 0) {
  7865. options = Object.assign({}, options, { rotateStringArray: false, stringArray: false, stringArrayEncoding: false, stringArrayThreshold: 0 });
  7866. }
  7867. return options;
  7868. };
  7869. /***/ }),
  7870. /* 173 */
  7871. /***/ (function(module, exports, __webpack_require__) {
  7872. "use strict";
  7873. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  7874. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7875. Object.defineProperty(exports, "__esModule", { value: true });
  7876. var ValidationErrorsFormatter = function () {
  7877. function ValidationErrorsFormatter() {
  7878. _classCallCheck(this, ValidationErrorsFormatter);
  7879. }
  7880. _createClass(ValidationErrorsFormatter, null, [{
  7881. key: "format",
  7882. value: function format(validationErrors) {
  7883. var errorsArray = [];
  7884. var _iteratorNormalCompletion = true;
  7885. var _didIteratorError = false;
  7886. var _iteratorError = undefined;
  7887. try {
  7888. for (var _iterator = validationErrors[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  7889. var error = _step.value;
  7890. errorsArray.push(ValidationErrorsFormatter.formatError(error));
  7891. }
  7892. } catch (err) {
  7893. _didIteratorError = true;
  7894. _iteratorError = err;
  7895. } finally {
  7896. try {
  7897. if (!_iteratorNormalCompletion && _iterator.return) {
  7898. _iterator.return();
  7899. }
  7900. } finally {
  7901. if (_didIteratorError) {
  7902. throw _iteratorError;
  7903. }
  7904. }
  7905. }
  7906. return errorsArray.join('\n');
  7907. }
  7908. }, {
  7909. key: "formatError",
  7910. value: function formatError(validationError) {
  7911. var constraints = validationError.constraints;
  7912. var errorString = "`" + validationError.property + "` errors:\n";
  7913. for (var constraint in constraints) {
  7914. if (!constraints.hasOwnProperty(constraint)) {
  7915. continue;
  7916. }
  7917. errorString += " - " + constraints[constraint] + "\n";
  7918. }
  7919. return errorString;
  7920. }
  7921. }]);
  7922. return ValidationErrorsFormatter;
  7923. }();
  7924. exports.ValidationErrorsFormatter = ValidationErrorsFormatter;
  7925. /***/ }),
  7926. /* 174 */
  7927. /***/ (function(module, exports, __webpack_require__) {
  7928. "use strict";
  7929. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  7930. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7931. Object.defineProperty(exports, "__esModule", { value: true });
  7932. var SourceCode = function () {
  7933. function SourceCode(sourceCode) {
  7934. _classCallCheck(this, SourceCode);
  7935. this.sourceCode = sourceCode;
  7936. }
  7937. _createClass(SourceCode, [{
  7938. key: "getSourceCode",
  7939. value: function getSourceCode() {
  7940. return this.sourceCode;
  7941. }
  7942. }]);
  7943. return SourceCode;
  7944. }();
  7945. exports.SourceCode = SourceCode;
  7946. /***/ }),
  7947. /* 175 */
  7948. /***/ (function(module, exports, __webpack_require__) {
  7949. "use strict";
  7950. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  7951. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7952. Object.defineProperty(exports, "__esModule", { value: true });
  7953. var tslib_1 = __webpack_require__(2);
  7954. var inversify_1 = __webpack_require__(0);
  7955. var ServiceIdentifiers_1 = __webpack_require__(1);
  7956. var SourceMapMode_1 = __webpack_require__(25);
  7957. var SourceMapCorrector = function () {
  7958. function SourceMapCorrector(obfuscationResultFactory, cryptUtils, options) {
  7959. _classCallCheck(this, SourceMapCorrector);
  7960. this.obfuscationResultFactory = obfuscationResultFactory;
  7961. this.cryptUtils = cryptUtils;
  7962. this.options = options;
  7963. }
  7964. _createClass(SourceMapCorrector, [{
  7965. key: "correct",
  7966. value: function correct(obfuscatedCode, sourceMap) {
  7967. return this.obfuscationResultFactory(this.correctObfuscatedCode(obfuscatedCode, sourceMap), sourceMap);
  7968. }
  7969. }, {
  7970. key: "correctObfuscatedCode",
  7971. value: function correctObfuscatedCode(obfuscatedCode, sourceMap) {
  7972. if (!sourceMap) {
  7973. return obfuscatedCode;
  7974. }
  7975. var sourceMapUrl = this.options.sourceMapBaseUrl + this.options.sourceMapFileName;
  7976. var sourceMappingUrl = '//# sourceMappingURL=';
  7977. switch (this.options.sourceMapMode) {
  7978. case SourceMapMode_1.SourceMapMode.Inline:
  7979. sourceMappingUrl += "data:application/json;base64," + this.cryptUtils.btoa(sourceMap);
  7980. break;
  7981. case SourceMapMode_1.SourceMapMode.Separate:
  7982. default:
  7983. if (!sourceMapUrl) {
  7984. return obfuscatedCode;
  7985. }
  7986. sourceMappingUrl += sourceMapUrl;
  7987. break;
  7988. }
  7989. return obfuscatedCode + "\n" + sourceMappingUrl;
  7990. }
  7991. }]);
  7992. return SourceMapCorrector;
  7993. }();
  7994. SourceMapCorrector = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObfuscationResult)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICryptUtils)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], SourceMapCorrector);
  7995. exports.SourceMapCorrector = SourceMapCorrector;
  7996. /***/ }),
  7997. /* 176 */
  7998. /***/ (function(module, exports, __webpack_require__) {
  7999. "use strict";
  8000. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  8001. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8002. Object.defineProperty(exports, "__esModule", { value: true });
  8003. var tslib_1 = __webpack_require__(2);
  8004. var inversify_1 = __webpack_require__(0);
  8005. var ServiceIdentifiers_1 = __webpack_require__(1);
  8006. var estraverse = __webpack_require__(10);
  8007. var VisitorDirection_1 = __webpack_require__(177);
  8008. var NodeGuards_1 = __webpack_require__(4);
  8009. var TransformersRunner = function () {
  8010. function TransformersRunner(nodeTransformerFactory) {
  8011. _classCallCheck(this, TransformersRunner);
  8012. this.nodeTransformerFactory = nodeTransformerFactory;
  8013. }
  8014. _createClass(TransformersRunner, [{
  8015. key: "transform",
  8016. value: function transform(astTree, nodeTransformers, transformationStage) {
  8017. if (!nodeTransformers.length) {
  8018. return astTree;
  8019. }
  8020. var enterVisitors = [];
  8021. var leaveVisitors = [];
  8022. var nodeTransformersLength = nodeTransformers.length;
  8023. var visitor = void 0;
  8024. for (var i = 0; i < nodeTransformersLength; i++) {
  8025. visitor = this.nodeTransformerFactory(nodeTransformers[i]).getVisitor(transformationStage);
  8026. if (!visitor) {
  8027. continue;
  8028. }
  8029. if (visitor.enter) {
  8030. enterVisitors.push(visitor);
  8031. }
  8032. if (visitor.leave) {
  8033. leaveVisitors.push(visitor);
  8034. }
  8035. }
  8036. estraverse.replace(astTree, {
  8037. enter: this.mergeVisitorsForDirection(enterVisitors, VisitorDirection_1.VisitorDirection.Enter),
  8038. leave: this.mergeVisitorsForDirection(leaveVisitors, VisitorDirection_1.VisitorDirection.Leave)
  8039. });
  8040. return astTree;
  8041. }
  8042. }, {
  8043. key: "mergeVisitorsForDirection",
  8044. value: function mergeVisitorsForDirection(visitors, direction) {
  8045. var visitorsLength = visitors.length;
  8046. if (!visitorsLength) {
  8047. return function (node, parentNode) {
  8048. return node;
  8049. };
  8050. }
  8051. return function (node, parentNode) {
  8052. if (node.ignoredNode) {
  8053. return estraverse.VisitorOption.Skip;
  8054. }
  8055. for (var i = 0; i < visitorsLength; i++) {
  8056. var visitorFunction = visitors[i][direction];
  8057. if (!visitorFunction) {
  8058. continue;
  8059. }
  8060. var visitorResult = visitorFunction(node, parentNode);
  8061. if (!visitorResult || !NodeGuards_1.NodeGuards.isNode(visitorResult)) {
  8062. continue;
  8063. }
  8064. node = visitorResult;
  8065. }
  8066. return node;
  8067. };
  8068. }
  8069. }]);
  8070. return TransformersRunner;
  8071. }();
  8072. TransformersRunner = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__INodeTransformer)), tslib_1.__metadata("design:paramtypes", [Function])], TransformersRunner);
  8073. exports.TransformersRunner = TransformersRunner;
  8074. /***/ }),
  8075. /* 177 */
  8076. /***/ (function(module, exports, __webpack_require__) {
  8077. "use strict";
  8078. Object.defineProperty(exports, "__esModule", { value: true });
  8079. var VisitorDirection;
  8080. (function (VisitorDirection) {
  8081. VisitorDirection["Enter"] = "enter";
  8082. VisitorDirection["Leave"] = "leave";
  8083. })(VisitorDirection = exports.VisitorDirection || (exports.VisitorDirection = {}));
  8084. /***/ }),
  8085. /* 178 */
  8086. /***/ (function(module, exports) {
  8087. module.exports = require("commander");
  8088. /***/ }),
  8089. /* 179 */
  8090. /***/ (function(module, exports, __webpack_require__) {
  8091. "use strict";
  8092. Object.defineProperty(exports, "__esModule", { value: true });
  8093. exports.ArraySanitizer = function (value) {
  8094. if (/,$/.test(value)) {
  8095. throw new SyntaxError("Multiple <list> values should be wrapped inside quotes: --option-name 'value1, value2'");
  8096. }
  8097. return value.split(',').map(function (string) {
  8098. return string.trim();
  8099. });
  8100. };
  8101. /***/ }),
  8102. /* 180 */
  8103. /***/ (function(module, exports, __webpack_require__) {
  8104. "use strict";
  8105. Object.defineProperty(exports, "__esModule", { value: true });
  8106. exports.BooleanSanitizer = function (value) {
  8107. return value === 'true' || value === '1';
  8108. };
  8109. /***/ }),
  8110. /* 181 */
  8111. /***/ (function(module, exports, __webpack_require__) {
  8112. "use strict";
  8113. Object.defineProperty(exports, "__esModule", { value: true });
  8114. var IdentifierNamesGenerator_1 = __webpack_require__(24);
  8115. exports.IdentifierNamesGeneratorSanitizer = function (value) {
  8116. var isCorrectIdentifierNamesGenerator = Object.keys(IdentifierNamesGenerator_1.IdentifierNamesGenerator).some(function (key) {
  8117. return IdentifierNamesGenerator_1.IdentifierNamesGenerator[key] === value;
  8118. });
  8119. if (!isCorrectIdentifierNamesGenerator) {
  8120. throw new ReferenceError('Invalid value of `--identifier-names-generator` option');
  8121. }
  8122. return value;
  8123. };
  8124. /***/ }),
  8125. /* 182 */
  8126. /***/ (function(module, exports, __webpack_require__) {
  8127. "use strict";
  8128. Object.defineProperty(exports, "__esModule", { value: true });
  8129. var ObfuscationTarget_1 = __webpack_require__(14);
  8130. exports.ObfuscationTargetSanitizer = function (value) {
  8131. var isCorrectTarget = Object.keys(ObfuscationTarget_1.ObfuscationTarget).some(function (key) {
  8132. return ObfuscationTarget_1.ObfuscationTarget[key] === value;
  8133. });
  8134. if (!isCorrectTarget) {
  8135. throw new ReferenceError('Invalid value of `--target` option');
  8136. }
  8137. return value;
  8138. };
  8139. /***/ }),
  8140. /* 183 */
  8141. /***/ (function(module, exports, __webpack_require__) {
  8142. "use strict";
  8143. Object.defineProperty(exports, "__esModule", { value: true });
  8144. var SourceMapMode_1 = __webpack_require__(25);
  8145. exports.SourceMapModeSanitizer = function (value) {
  8146. var isCorrectSourceMapMode = Object.keys(SourceMapMode_1.SourceMapMode).some(function (key) {
  8147. return SourceMapMode_1.SourceMapMode[key] === value;
  8148. });
  8149. if (!isCorrectSourceMapMode) {
  8150. throw new ReferenceError('Invalid value of `--source-map-mode` option');
  8151. }
  8152. return value;
  8153. };
  8154. /***/ }),
  8155. /* 184 */
  8156. /***/ (function(module, exports, __webpack_require__) {
  8157. "use strict";
  8158. Object.defineProperty(exports, "__esModule", { value: true });
  8159. var StringArrayEncoding_1 = __webpack_require__(26);
  8160. exports.StringArrayEncodingSanitizer = function (value) {
  8161. switch (value) {
  8162. case 'true':
  8163. case '1':
  8164. case StringArrayEncoding_1.StringArrayEncoding.Base64:
  8165. return true;
  8166. case StringArrayEncoding_1.StringArrayEncoding.Rc4:
  8167. return StringArrayEncoding_1.StringArrayEncoding.Rc4;
  8168. default:
  8169. return false;
  8170. }
  8171. };
  8172. /***/ }),
  8173. /* 185 */
  8174. /***/ (function(module, exports, __webpack_require__) {
  8175. "use strict";
  8176. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  8177. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8178. Object.defineProperty(exports, "__esModule", { value: true });
  8179. var fs = __webpack_require__(48);
  8180. var mkdirp = __webpack_require__(186);
  8181. var path = __webpack_require__(35);
  8182. var JavaScriptObfuscatorCLI_1 = __webpack_require__(34);
  8183. var CLIUtils = function () {
  8184. function CLIUtils() {
  8185. _classCallCheck(this, CLIUtils);
  8186. }
  8187. _createClass(CLIUtils, null, [{
  8188. key: "getOutputCodePath",
  8189. value: function getOutputCodePath(inputPath) {
  8190. return path.normalize(inputPath).split('.').map(function (value, index) {
  8191. return index === 0 ? "" + value + JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI.obfuscatedFilePrefix : value;
  8192. }).join('.');
  8193. }
  8194. }, {
  8195. key: "getOutputSourceMapPath",
  8196. value: function getOutputSourceMapPath(outputCodePath) {
  8197. var sourceMapFileName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
  8198. if (sourceMapFileName) {
  8199. outputCodePath = outputCodePath.substring(0, outputCodePath.lastIndexOf('/')) + "/" + sourceMapFileName;
  8200. }
  8201. if (!/\.js\.map$/.test(outputCodePath)) {
  8202. outputCodePath = outputCodePath.split('.')[0] + ".js.map";
  8203. } else if (/\.js$/.test(outputCodePath)) {
  8204. outputCodePath += '.map';
  8205. }
  8206. return outputCodePath;
  8207. }
  8208. }, {
  8209. key: "getUserConfig",
  8210. value: function getUserConfig(configPath) {
  8211. var config = void 0;
  8212. try {
  8213. config = !(function webpackMissingModule() { var e = new Error("Cannot find module \".\""); e.code = 'MODULE_NOT_FOUND'; throw e; }());
  8214. } catch (e) {
  8215. try {
  8216. config = require(configPath);
  8217. } catch (e) {
  8218. throw new ReferenceError('Given config path must be a valid file path');
  8219. }
  8220. }
  8221. return config;
  8222. }
  8223. }, {
  8224. key: "writeFile",
  8225. value: function writeFile(outputPath, data) {
  8226. mkdirp.sync(path.dirname(outputPath));
  8227. fs.writeFileSync(outputPath, data, {
  8228. encoding: JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI.encoding
  8229. });
  8230. }
  8231. }]);
  8232. return CLIUtils;
  8233. }();
  8234. exports.CLIUtils = CLIUtils;
  8235. /***/ }),
  8236. /* 186 */
  8237. /***/ (function(module, exports) {
  8238. module.exports = require("mkdirp");
  8239. /***/ }),
  8240. /* 187 */
  8241. /***/ (function(module, exports) {
  8242. function webpackEmptyContext(req) {
  8243. throw new Error("Cannot find module '" + req + "'.");
  8244. }
  8245. webpackEmptyContext.keys = function() { return []; };
  8246. webpackEmptyContext.resolve = webpackEmptyContext;
  8247. module.exports = webpackEmptyContext;
  8248. webpackEmptyContext.id = 187;
  8249. /***/ }),
  8250. /* 188 */
  8251. /***/ (function(module, exports, __webpack_require__) {
  8252. "use strict";
  8253. var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
  8254. function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
  8255. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8256. Object.defineProperty(exports, "__esModule", { value: true });
  8257. var fs = __webpack_require__(48);
  8258. var path = __webpack_require__(35);
  8259. var JavaScriptObfuscatorCLI_1 = __webpack_require__(34);
  8260. var SourceCodeReader = function () {
  8261. function SourceCodeReader() {
  8262. _classCallCheck(this, SourceCodeReader);
  8263. }
  8264. _createClass(SourceCodeReader, null, [{
  8265. key: "readSourceCode",
  8266. value: function readSourceCode(inputPath) {
  8267. if (SourceCodeReader.isFilePath(inputPath)) {
  8268. return SourceCodeReader.readFile(inputPath);
  8269. }
  8270. if (SourceCodeReader.isDirectoryPath(inputPath)) {
  8271. return SourceCodeReader.readDirectoryRecursive(inputPath);
  8272. }
  8273. throw new ReferenceError("Given input path must be a valid source code file or directory path");
  8274. }
  8275. }, {
  8276. key: "isDirectoryPath",
  8277. value: function isDirectoryPath(filePath) {
  8278. try {
  8279. return fs.statSync(filePath).isDirectory();
  8280. } catch (e) {
  8281. return false;
  8282. }
  8283. }
  8284. }, {
  8285. key: "isFilePath",
  8286. value: function isFilePath(filePath) {
  8287. try {
  8288. return fs.statSync(filePath).isFile();
  8289. } catch (e) {
  8290. return false;
  8291. }
  8292. }
  8293. }, {
  8294. key: "readDirectoryRecursive",
  8295. value: function readDirectoryRecursive(directoryPath) {
  8296. var fileData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  8297. fs.readdirSync(directoryPath, JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI.encoding).forEach(function (fileName) {
  8298. var filePath = directoryPath + "/" + fileName;
  8299. if (SourceCodeReader.isDirectoryPath(filePath)) {
  8300. fileData.push.apply(fileData, _toConsumableArray(SourceCodeReader.readDirectoryRecursive(filePath)));
  8301. } else if (SourceCodeReader.isFilePath(filePath) && SourceCodeReader.isValidFile(fileName)) {
  8302. var content = fs.readFileSync(filePath, JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI.encoding);
  8303. fileData.push({ filePath: filePath, content: content });
  8304. }
  8305. });
  8306. return fileData;
  8307. }
  8308. }, {
  8309. key: "readFile",
  8310. value: function readFile(filePath) {
  8311. if (!SourceCodeReader.isValidFile(filePath)) {
  8312. throw new ReferenceError("Input file must have .js extension");
  8313. }
  8314. return fs.readFileSync(filePath, JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI.encoding);
  8315. }
  8316. }, {
  8317. key: "isValidFile",
  8318. value: function isValidFile(filePath) {
  8319. return JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI.availableInputExtensions.indexOf(path.extname(filePath)) !== -1 && !(filePath.indexOf(JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI.obfuscatedFilePrefix) !== -1);
  8320. }
  8321. }]);
  8322. return SourceCodeReader;
  8323. }();
  8324. exports.SourceCodeReader = SourceCodeReader;
  8325. /***/ })
  8326. /******/ ]);
  8327. //# sourceMappingURL=index.js.map