index.js 472 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887
  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 = 68);
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ([
  89. /* 0 */
  90. /***/ (function(module, exports) {
  91. module.exports = require("@babel/runtime/helpers/classCallCheck");
  92. /***/ }),
  93. /* 1 */
  94. /***/ (function(module, exports) {
  95. module.exports = require("inversify");
  96. /***/ }),
  97. /* 2 */
  98. /***/ (function(module, exports) {
  99. module.exports = require("@babel/runtime/helpers/createClass");
  100. /***/ }),
  101. /* 3 */
  102. /***/ (function(module, exports, __webpack_require__) {
  103. "use strict";
  104. Object.defineProperty(exports, "__esModule", {
  105. value: true
  106. });
  107. var ServiceIdentifiers;
  108. (function (ServiceIdentifiers) {
  109. ServiceIdentifiers["Factory__ICalleeDataExtractor"] = "Factory<ICalleeDataExtractor>";
  110. ServiceIdentifiers["Factory__IControlFlowCustomNode"] = "Factory<IControlFlowCustomNode>";
  111. ServiceIdentifiers["Factory__IControlFlowReplacer"] = "Factory<IControlFlowReplacer>";
  112. ServiceIdentifiers["Factory__ICustomNode"] = "Factory<ICustomNode>";
  113. ServiceIdentifiers["Factory__ICustomNodeGroup"] = "Factory<ICustomNodeGroup>";
  114. ServiceIdentifiers["Factory__IDeadCodeInjectionCustomNode"] = "Factory<IDeadCodeInjectionCustomNode>";
  115. ServiceIdentifiers["Factory__IIdentifierNamesGenerator"] = "Factory<IIdentifierNamesGenerator>";
  116. ServiceIdentifiers["Factory__IIdentifierObfuscatingReplacer"] = "Factory<IIdentifierObfuscatingReplacer>";
  117. ServiceIdentifiers["Factory__INodeGuard"] = "Factory<INodeGuard>";
  118. ServiceIdentifiers["Factory__INodeTransformer"] = "Factory<INodeTransformer[]>";
  119. ServiceIdentifiers["Factory__IObfuscationResult"] = "Factory<IObfuscationResult>";
  120. ServiceIdentifiers["Factory__IObfuscatingReplacer"] = "Factory<IObfuscatingReplacer>";
  121. ServiceIdentifiers["Factory__TControlFlowStorage"] = "Factory<TControlFlowStorage>";
  122. ServiceIdentifiers["IArrayUtils"] = "IArrayUtils";
  123. ServiceIdentifiers["ICalleeDataExtractor"] = "ICalleeDataExtractor";
  124. ServiceIdentifiers["ICryptUtils"] = "ICryptUtils";
  125. ServiceIdentifiers["ICustomNode"] = "ICustomNode";
  126. ServiceIdentifiers["ICustomNodeGroup"] = "ICustomNodeGroup";
  127. ServiceIdentifiers["IControlFlowReplacer"] = "IControlFlowReplacer";
  128. ServiceIdentifiers["IEscapeSequenceEncoder"] = "IEscapeSequenceEncoder";
  129. ServiceIdentifiers["IIdentifierNamesGenerator"] = "IIdentifierNamesGenerator";
  130. ServiceIdentifiers["IIdentifierObfuscatingReplacer"] = "IIdentifierObfuscatingReplacer";
  131. ServiceIdentifiers["IJavaScriptObfuscator"] = "IJavaScriptObfuscator";
  132. ServiceIdentifiers["ILogger"] = "ILogger";
  133. ServiceIdentifiers["INodeGuard"] = "INodeGuard";
  134. ServiceIdentifiers["INodeTransformer"] = "INodeTransformer";
  135. ServiceIdentifiers["IObfuscationEventEmitter"] = "IObfuscationEventEmitter";
  136. ServiceIdentifiers["IObfuscationResult"] = "IObfuscationResult";
  137. ServiceIdentifiers["IOptions"] = "IOptions";
  138. ServiceIdentifiers["IOptionsNormalizer"] = "IOptionsNormalizer";
  139. ServiceIdentifiers["IObfuscatingReplacer"] = "IObfuscatingReplacer";
  140. ServiceIdentifiers["IRandomGenerator"] = "IRandomGenerator";
  141. ServiceIdentifiers["ISourceCode"] = "ISourceCode";
  142. ServiceIdentifiers["ISourceMapCorrector"] = "ISourceMapCorrector";
  143. ServiceIdentifiers["IStackTraceAnalyzer"] = "IStackTraceAnalyzer";
  144. ServiceIdentifiers["ITransformersRunner"] = "ITransformersRunner";
  145. ServiceIdentifiers["Newable__ICustomNode"] = "Newable<ICustomNode>";
  146. ServiceIdentifiers["Newable__TControlFlowStorage"] = "Newable<TControlFlowStorage>";
  147. ServiceIdentifiers["TCustomNodeGroupStorage"] = "TCustomNodeGroupStorage";
  148. ServiceIdentifiers["TInputOptions"] = "TInputOptions";
  149. ServiceIdentifiers["TStringArrayStorage"] = "TStringArrayStorage";
  150. })(ServiceIdentifiers = exports.ServiceIdentifiers || (exports.ServiceIdentifiers = {}));
  151. /***/ }),
  152. /* 4 */
  153. /***/ (function(module, exports) {
  154. module.exports = require("tslib");
  155. /***/ }),
  156. /* 5 */
  157. /***/ (function(module, exports) {
  158. module.exports = require("@babel/runtime/core-js/object/get-prototype-of");
  159. /***/ }),
  160. /* 6 */
  161. /***/ (function(module, exports) {
  162. module.exports = require("@babel/runtime/helpers/possibleConstructorReturn");
  163. /***/ }),
  164. /* 7 */
  165. /***/ (function(module, exports) {
  166. module.exports = require("@babel/runtime/helpers/inherits");
  167. /***/ }),
  168. /* 8 */
  169. /***/ (function(module, exports, __webpack_require__) {
  170. "use strict";
  171. var _classCallCheck = __webpack_require__(0);
  172. var _createClass = __webpack_require__(2);
  173. Object.defineProperty(exports, "__esModule", {
  174. value: true
  175. });
  176. var NodeType_1 = __webpack_require__(18);
  177. var NodeGuards =
  178. /*#__PURE__*/
  179. function () {
  180. function NodeGuards() {
  181. _classCallCheck(this, NodeGuards);
  182. }
  183. _createClass(NodeGuards, null, [{
  184. key: "isArrayPatternNode",
  185. value: function isArrayPatternNode(node) {
  186. return node.type === NodeType_1.NodeType.ArrayPattern;
  187. }
  188. }, {
  189. key: "isArrowFunctionExpressionNode",
  190. value: function isArrowFunctionExpressionNode(node) {
  191. return node.type === NodeType_1.NodeType.ArrowFunctionExpression;
  192. }
  193. }, {
  194. key: "isAssignmentPatternNode",
  195. value: function isAssignmentPatternNode(node) {
  196. return node.type === NodeType_1.NodeType.AssignmentPattern;
  197. }
  198. }, {
  199. key: "isAwaitExpressionNode",
  200. value: function isAwaitExpressionNode(node) {
  201. return node.type === NodeType_1.NodeType.AwaitExpression;
  202. }
  203. }, {
  204. key: "isBlockStatementNode",
  205. value: function isBlockStatementNode(node) {
  206. return node.type === NodeType_1.NodeType.BlockStatement;
  207. }
  208. }, {
  209. key: "isBreakStatementNode",
  210. value: function isBreakStatementNode(node) {
  211. return node.type === NodeType_1.NodeType.BreakStatement;
  212. }
  213. }, {
  214. key: "isCallExpressionNode",
  215. value: function isCallExpressionNode(node) {
  216. return node.type === NodeType_1.NodeType.CallExpression;
  217. }
  218. }, {
  219. key: "isCatchClauseNode",
  220. value: function isCatchClauseNode(node) {
  221. return node.type === NodeType_1.NodeType.CatchClause;
  222. }
  223. }, {
  224. key: "isClassDeclarationNode",
  225. value: function isClassDeclarationNode(node) {
  226. return node.type === NodeType_1.NodeType.ClassDeclaration;
  227. }
  228. }, {
  229. key: "isContinueStatementNode",
  230. value: function isContinueStatementNode(node) {
  231. return node.type === NodeType_1.NodeType.ContinueStatement;
  232. }
  233. }, {
  234. key: "isExpressionStatementNode",
  235. value: function isExpressionStatementNode(node) {
  236. return node.type === NodeType_1.NodeType.ExpressionStatement;
  237. }
  238. }, {
  239. key: "isFunctionDeclarationNode",
  240. value: function isFunctionDeclarationNode(node) {
  241. return node.type === NodeType_1.NodeType.FunctionDeclaration;
  242. }
  243. }, {
  244. key: "isFunctionExpressionNode",
  245. value: function isFunctionExpressionNode(node) {
  246. return node.type === NodeType_1.NodeType.FunctionExpression;
  247. }
  248. }, {
  249. key: "isIdentifierNode",
  250. value: function isIdentifierNode(node) {
  251. return node.type === NodeType_1.NodeType.Identifier;
  252. }
  253. }, {
  254. key: "isIfStatementNode",
  255. value: function isIfStatementNode(node) {
  256. return node.type === NodeType_1.NodeType.IfStatement;
  257. }
  258. }, {
  259. key: "isLabelIdentifierNode",
  260. value: function isLabelIdentifierNode(node, parentNode) {
  261. var parentNodeIsLabeledStatementNode = NodeGuards.isLabeledStatementNode(parentNode) && parentNode.label === node;
  262. var parentNodeIsContinueStatementNode = NodeGuards.isContinueStatementNode(parentNode) && parentNode.label === node;
  263. var parentNodeIsBreakStatementNode = NodeGuards.isBreakStatementNode(parentNode) && parentNode.label === node;
  264. return parentNodeIsLabeledStatementNode || parentNodeIsContinueStatementNode || parentNodeIsBreakStatementNode;
  265. }
  266. }, {
  267. key: "isLabeledStatementNode",
  268. value: function isLabeledStatementNode(node) {
  269. return node.type === NodeType_1.NodeType.LabeledStatement;
  270. }
  271. }, {
  272. key: "isLiteralNode",
  273. value: function isLiteralNode(node) {
  274. return node.type === NodeType_1.NodeType.Literal;
  275. }
  276. }, {
  277. key: "isMemberExpressionNode",
  278. value: function isMemberExpressionNode(node) {
  279. return node.type === NodeType_1.NodeType.MemberExpression;
  280. }
  281. }, {
  282. key: "isMethodDefinitionNode",
  283. value: function isMethodDefinitionNode(node) {
  284. return node.type === NodeType_1.NodeType.MethodDefinition;
  285. }
  286. }, {
  287. key: "isNode",
  288. value: function isNode(object) {
  289. return object && !object.type !== undefined;
  290. }
  291. }, {
  292. key: "isNodeHasBlockScope",
  293. value: function isNodeHasBlockScope(node, parentNode) {
  294. return NodeGuards.isProgramNode(node) || NodeGuards.isBlockStatementNode(node) && NodeGuards.nodesWithBlockScope.includes(parentNode.type);
  295. }
  296. }, {
  297. key: "isNodeHasScope",
  298. value: function isNodeHasScope(node) {
  299. return NodeGuards.isProgramNode(node) || NodeGuards.isBlockStatementNode(node) || NodeGuards.isSwitchCaseNode(node);
  300. }
  301. }, {
  302. key: "isNodeWithComments",
  303. value: function isNodeWithComments(node) {
  304. return Boolean(node.leadingComments) || Boolean(node.trailingComments);
  305. }
  306. }, {
  307. key: "isObjectPatternNode",
  308. value: function isObjectPatternNode(node) {
  309. return node.type === NodeType_1.NodeType.ObjectPattern;
  310. }
  311. }, {
  312. key: "isObjectExpressionNode",
  313. value: function isObjectExpressionNode(node) {
  314. return node.type === NodeType_1.NodeType.ObjectExpression;
  315. }
  316. }, {
  317. key: "isProgramNode",
  318. value: function isProgramNode(node) {
  319. return node.type === NodeType_1.NodeType.Program;
  320. }
  321. }, {
  322. key: "isPropertyNode",
  323. value: function isPropertyNode(node) {
  324. return node.type === NodeType_1.NodeType.Property;
  325. }
  326. }, {
  327. key: "isReplaceableIdentifierNode",
  328. value: function isReplaceableIdentifierNode(node, parentNode) {
  329. if (!NodeGuards.isIdentifierNode(node)) {
  330. return false;
  331. }
  332. var parentNodeIsPropertyNode = NodeGuards.isPropertyNode(parentNode) && !parentNode.computed && parentNode.key === node;
  333. var parentNodeIsMemberExpressionNode = NodeGuards.isMemberExpressionNode(parentNode) && !parentNode.computed && parentNode.property === node;
  334. var parentNodeIsMethodDefinitionNode = NodeGuards.isMethodDefinitionNode(parentNode) && !parentNode.computed;
  335. var isLabelIdentifierNode = NodeGuards.isLabelIdentifierNode(node, parentNode);
  336. return !parentNodeIsPropertyNode && !parentNodeIsMemberExpressionNode && !parentNodeIsMethodDefinitionNode && !isLabelIdentifierNode;
  337. }
  338. }, {
  339. key: "isRestElementNode",
  340. value: function isRestElementNode(node) {
  341. return node.type === NodeType_1.NodeType.RestElement;
  342. }
  343. }, {
  344. key: "isReturnStatementNode",
  345. value: function isReturnStatementNode(node) {
  346. return node.type === NodeType_1.NodeType.ReturnStatement;
  347. }
  348. }, {
  349. key: "isSuperNode",
  350. value: function isSuperNode(node) {
  351. return node.type === NodeType_1.NodeType.Super;
  352. }
  353. }, {
  354. key: "isSwitchCaseNode",
  355. value: function isSwitchCaseNode(node) {
  356. return node.type === NodeType_1.NodeType.SwitchCase;
  357. }
  358. }, {
  359. key: "isTemplateLiteralNode",
  360. value: function isTemplateLiteralNode(node) {
  361. return node.type === NodeType_1.NodeType.TemplateLiteral;
  362. }
  363. }, {
  364. key: "isUnaryExpressionNode",
  365. value: function isUnaryExpressionNode(node) {
  366. return node.type === NodeType_1.NodeType.UnaryExpression;
  367. }
  368. }, {
  369. key: "isUseStrictOperator",
  370. value: function isUseStrictOperator(node) {
  371. return node.type === NodeType_1.NodeType.ExpressionStatement && node.directive === 'use strict';
  372. }
  373. }, {
  374. key: "isVariableDeclarationNode",
  375. value: function isVariableDeclarationNode(node) {
  376. return node.type === NodeType_1.NodeType.VariableDeclaration;
  377. }
  378. }, {
  379. key: "isVariableDeclaratorNode",
  380. value: function isVariableDeclaratorNode(node) {
  381. return node.type === NodeType_1.NodeType.VariableDeclarator;
  382. }
  383. }, {
  384. key: "isWhileStatementNode",
  385. value: function isWhileStatementNode(node) {
  386. return node.type === NodeType_1.NodeType.WhileStatement;
  387. }
  388. }]);
  389. return NodeGuards;
  390. }();
  391. NodeGuards.nodesWithBlockScope = [NodeType_1.NodeType.ArrowFunctionExpression, NodeType_1.NodeType.FunctionDeclaration, NodeType_1.NodeType.FunctionExpression, NodeType_1.NodeType.MethodDefinition];
  392. exports.NodeGuards = NodeGuards;
  393. /***/ }),
  394. /* 9 */
  395. /***/ (function(module, exports, __webpack_require__) {
  396. "use strict";
  397. var _typeof = __webpack_require__(50);
  398. var _classCallCheck = __webpack_require__(0);
  399. var _createClass = __webpack_require__(2);
  400. Object.defineProperty(exports, "__esModule", {
  401. value: true
  402. });
  403. var escodegen = __importStar(__webpack_require__(42));
  404. var esprima = __importStar(__webpack_require__(51));
  405. var estraverse = __importStar(__webpack_require__(17));
  406. var NodeGuards_1 = __webpack_require__(8);
  407. var NodeUtils =
  408. /*#__PURE__*/
  409. function () {
  410. function NodeUtils() {
  411. _classCallCheck(this, NodeUtils);
  412. }
  413. _createClass(NodeUtils, null, [{
  414. key: "addXVerbatimPropertyToLiterals",
  415. value: function addXVerbatimPropertyToLiterals(astTree) {
  416. estraverse.replace(astTree, {
  417. leave: function leave(node) {
  418. if (NodeGuards_1.NodeGuards.isLiteralNode(node)) {
  419. node['x-verbatim-property'] = {
  420. content: node.raw,
  421. precedence: escodegen.Precedence.Primary
  422. };
  423. }
  424. }
  425. });
  426. return astTree;
  427. }
  428. }, {
  429. key: "clone",
  430. value: function clone(astTree) {
  431. return NodeUtils.parentize(NodeUtils.cloneRecursive(astTree));
  432. }
  433. }, {
  434. key: "convertCodeToStructure",
  435. value: function convertCodeToStructure(code) {
  436. var structure = esprima.parseScript(code);
  437. structure = NodeUtils.addXVerbatimPropertyToLiterals(structure);
  438. structure = NodeUtils.parentize(structure);
  439. return structure.body;
  440. }
  441. }, {
  442. key: "convertStructureToCode",
  443. value: function convertStructureToCode(structure) {
  444. return structure.reduce(function (code, node) {
  445. return code + escodegen.generate(node, {
  446. sourceMapWithCode: true
  447. }).code;
  448. }, '');
  449. }
  450. }, {
  451. key: "getBlockScopesOfNode",
  452. value: function getBlockScopesOfNode(targetNode) {
  453. return NodeUtils.getBlockScopesOfNodeRecursive(targetNode);
  454. }
  455. }, {
  456. key: "getNextSiblingStatementNode",
  457. value: function getNextSiblingStatementNode(node) {
  458. return NodeUtils.getSiblingStatementNodeByOffset(node, 1);
  459. }
  460. }, {
  461. key: "getPreviousSiblingStatementNode",
  462. value: function getPreviousSiblingStatementNode(node) {
  463. return NodeUtils.getSiblingStatementNodeByOffset(node, -1);
  464. }
  465. }, {
  466. key: "getScopeOfNode",
  467. value: function getScopeOfNode(node) {
  468. var parentNode = node.parentNode;
  469. if (!parentNode) {
  470. throw new ReferenceError('`parentNode` property of given node is `undefined`');
  471. }
  472. if (!NodeGuards_1.NodeGuards.isNodeHasScope(parentNode)) {
  473. return NodeUtils.getScopeOfNode(parentNode);
  474. }
  475. return parentNode;
  476. }
  477. }, {
  478. key: "getUnaryExpressionArgumentNode",
  479. value: function getUnaryExpressionArgumentNode(unaryExpressionNode) {
  480. if (NodeGuards_1.NodeGuards.isUnaryExpressionNode(unaryExpressionNode.argument)) {
  481. return NodeUtils.getUnaryExpressionArgumentNode(unaryExpressionNode.argument);
  482. }
  483. return unaryExpressionNode.argument;
  484. }
  485. }, {
  486. key: "parentize",
  487. value: function parentize(astTree) {
  488. estraverse.replace(astTree, {
  489. enter: NodeUtils.parentizeNode
  490. });
  491. return astTree;
  492. }
  493. }, {
  494. key: "parentizeNode",
  495. value: function parentizeNode(node, parentNode) {
  496. node.parentNode = parentNode || node;
  497. node.obfuscatedNode = false;
  498. return node;
  499. }
  500. }, {
  501. key: "cloneRecursive",
  502. value: function cloneRecursive(node) {
  503. if (node === null) {
  504. return node;
  505. }
  506. var copy = {};
  507. for (var property in node) {
  508. if (!node.hasOwnProperty(property) || property === 'parentNode') {
  509. continue;
  510. }
  511. var value = node[property];
  512. var clonedValue = void 0;
  513. if (value === null || value instanceof RegExp) {
  514. clonedValue = value;
  515. } else if (Array.isArray(value)) {
  516. clonedValue = value.map(NodeUtils.cloneRecursive);
  517. } else if (_typeof(value) === 'object') {
  518. clonedValue = NodeUtils.cloneRecursive(value);
  519. } else {
  520. clonedValue = value;
  521. }
  522. copy[property] = clonedValue;
  523. }
  524. return copy;
  525. }
  526. }, {
  527. key: "getBlockScopesOfNodeRecursive",
  528. value: function getBlockScopesOfNodeRecursive(node) {
  529. var blockScopes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  530. var depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  531. var parentNode = node.parentNode;
  532. if (!parentNode) {
  533. throw new ReferenceError('`parentNode` property of given node is `undefined`');
  534. }
  535. if (NodeGuards_1.NodeGuards.isBlockStatementNode(node) && parentNode === node) {
  536. blockScopes.push(node);
  537. }
  538. if (NodeGuards_1.NodeGuards.isProgramNode(node) || depth && NodeGuards_1.NodeGuards.isNodeHasBlockScope(node, parentNode)) {
  539. blockScopes.push(node);
  540. }
  541. if (node !== parentNode) {
  542. return NodeUtils.getBlockScopesOfNodeRecursive(parentNode, blockScopes, ++depth);
  543. }
  544. return blockScopes;
  545. }
  546. }, {
  547. key: "getSiblingStatementNodeByOffset",
  548. value: function getSiblingStatementNodeByOffset(node, offset) {
  549. var scopeNode = NodeUtils.getScopeOfNode(node);
  550. var scopeBody = !NodeGuards_1.NodeGuards.isSwitchCaseNode(scopeNode) ? scopeNode.body : scopeNode.consequent;
  551. var indexInScope = scopeBody.indexOf(node);
  552. return scopeBody[indexInScope + offset] || null;
  553. }
  554. }]);
  555. return NodeUtils;
  556. }();
  557. exports.NodeUtils = NodeUtils;
  558. /***/ }),
  559. /* 10 */
  560. /***/ (function(module, exports, __webpack_require__) {
  561. "use strict";
  562. var _Object$assign = __webpack_require__(11);
  563. var _Object$defineProperty = __webpack_require__(78);
  564. var _Object$getOwnPropertyDescriptor = __webpack_require__(79);
  565. var _Reflect$getMetadata = __webpack_require__(80);
  566. var _Object$getOwnPropertyNames = __webpack_require__(81);
  567. var _Reflect$defineMetadata = __webpack_require__(82);
  568. var _Reflect$hasMetadata = __webpack_require__(83);
  569. var _Set = __webpack_require__(29);
  570. var _Object$keys = __webpack_require__(38);
  571. Object.defineProperty(exports, "__esModule", {
  572. value: true
  573. });
  574. var defaultDescriptor = {
  575. configurable: true,
  576. enumerable: true
  577. };
  578. var initializedTargetMetadataKey = '_initialized';
  579. var initializablePropertiesSetMetadataKey = '_initializablePropertiesSet';
  580. var wrappedMethodsSetMetadataKey = '_wrappedMethodsSet';
  581. var constructorMethodName = 'constructor';
  582. function initializable() {
  583. var initializeMethodName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'initialize';
  584. var decoratorName = _Object$keys(this)[0];
  585. return function (target, propertyKey) {
  586. var initializeMethod = target[initializeMethodName];
  587. if (!initializeMethod || typeof initializeMethod !== 'function') {
  588. throw new Error("`".concat(initializeMethodName, "` method with initialization logic not ") + "found. `@".concat(decoratorName, "` decorator requires `").concat(initializeMethodName, "` method"));
  589. }
  590. initializeTargetMetadata(initializedTargetMetadataKey, false, target);
  591. initializeTargetMetadata(initializablePropertiesSetMetadataKey, new _Set(), target);
  592. initializeTargetMetadata(wrappedMethodsSetMetadataKey, new _Set(), target);
  593. wrapTargetMethodsInInitializedCheck(target, initializeMethodName);
  594. wrapInitializeMethodInInitializeCheck(target, initializeMethodName, propertyKey);
  595. return wrapInitializableProperty(target, propertyKey);
  596. };
  597. }
  598. exports.initializable = initializable;
  599. function initializeTargetMetadata(metadataKey, metadataValue, target) {
  600. var hasInitializedMetadata = _Reflect$hasMetadata(metadataKey, target);
  601. if (!hasInitializedMetadata) {
  602. _Reflect$defineMetadata(metadataKey, metadataValue, target);
  603. }
  604. }
  605. function wrapTargetMethodsInInitializedCheck(target, initializeMethodName) {
  606. var ownPropertyNames = _Object$getOwnPropertyNames(target);
  607. var prohibitedPropertyNames = [initializeMethodName, constructorMethodName];
  608. ownPropertyNames.forEach(function (propertyName) {
  609. var initializablePropertiesSet = _Reflect$getMetadata(initializablePropertiesSetMetadataKey, target);
  610. var wrappedMethodsSet = _Reflect$getMetadata(wrappedMethodsSetMetadataKey, target);
  611. var isProhibitedPropertyName = prohibitedPropertyNames.includes(propertyName) || initializablePropertiesSet.has(propertyName) || wrappedMethodsSet.has(propertyName);
  612. if (isProhibitedPropertyName) {
  613. return;
  614. }
  615. var targetProperty = target[propertyName];
  616. if (typeof targetProperty !== 'function') {
  617. return;
  618. }
  619. var methodDescriptor = _Object$getOwnPropertyDescriptor(target, propertyName) || defaultDescriptor;
  620. var originalMethod = methodDescriptor.value;
  621. _Object$defineProperty(target, propertyName, _Object$assign({}, methodDescriptor, {
  622. value: function value() {
  623. if (!_Reflect$getMetadata(initializedTargetMetadataKey, this)) {
  624. throw new Error("Class should be initialized with `".concat(initializeMethodName, "()` method"));
  625. }
  626. return originalMethod.apply(this, arguments);
  627. }
  628. }));
  629. wrappedMethodsSet.add(propertyName);
  630. });
  631. }
  632. function wrapInitializeMethodInInitializeCheck(target, initializeMethodName, propertyKey) {
  633. var methodDescriptor = _Object$getOwnPropertyDescriptor(target, initializeMethodName) || defaultDescriptor;
  634. var originalMethod = methodDescriptor.value;
  635. _Object$defineProperty(target, initializeMethodName, _Object$assign({}, methodDescriptor, {
  636. value: function value() {
  637. _Reflect$defineMetadata(initializedTargetMetadataKey, true, this);
  638. var result = originalMethod.apply(this, arguments);
  639. if (this[propertyKey]) {}
  640. return result;
  641. }
  642. }));
  643. }
  644. function wrapInitializableProperty(target, propertyKey) {
  645. var initializablePropertiesSet = _Reflect$getMetadata(initializablePropertiesSetMetadataKey, target);
  646. initializablePropertiesSet.add(propertyKey);
  647. var initializablePropertyMetadataKey = "_".concat(propertyKey);
  648. var propertyDescriptor = _Object$getOwnPropertyDescriptor(target, initializablePropertyMetadataKey) || defaultDescriptor;
  649. _Object$defineProperty(target, propertyKey, _Object$assign({}, propertyDescriptor, {
  650. get: function get() {
  651. if (this[initializablePropertyMetadataKey] === undefined) {
  652. throw new Error("Property `".concat(propertyKey, "` is not initialized! Initialize it first!"));
  653. }
  654. return this[initializablePropertyMetadataKey];
  655. },
  656. set: function set(newVal) {
  657. this[initializablePropertyMetadataKey] = newVal;
  658. }
  659. }));
  660. return propertyDescriptor;
  661. }
  662. /***/ }),
  663. /* 11 */
  664. /***/ (function(module, exports) {
  665. module.exports = require("@babel/runtime/core-js/object/assign");
  666. /***/ }),
  667. /* 12 */
  668. /***/ (function(module, exports, __webpack_require__) {
  669. "use strict";
  670. Object.defineProperty(exports, "__esModule", {
  671. value: true
  672. });
  673. var TransformationStage;
  674. (function (TransformationStage) {
  675. TransformationStage["Preparing"] = "Preparing";
  676. TransformationStage["DeadCodeInjection"] = "DeadCodeInjection";
  677. TransformationStage["ControlFlowFlattening"] = "ControlFlowFlattening";
  678. TransformationStage["Converting"] = "Converting";
  679. TransformationStage["Obfuscating"] = "Obfuscating";
  680. TransformationStage["Finalizing"] = "Finalizing";
  681. })(TransformationStage = exports.TransformationStage || (exports.TransformationStage = {}));
  682. /***/ }),
  683. /* 13 */
  684. /***/ (function(module, exports, __webpack_require__) {
  685. "use strict";
  686. var _classCallCheck = __webpack_require__(0);
  687. var _createClass = __webpack_require__(2);
  688. Object.defineProperty(exports, "__esModule", {
  689. value: true
  690. });
  691. var tslib_1 = __webpack_require__(4);
  692. var inversify_1 = __webpack_require__(1);
  693. var ServiceIdentifiers_1 = __webpack_require__(3);
  694. var Initializable_1 = __webpack_require__(10);
  695. var AbstractNodeTransformer =
  696. /*#__PURE__*/
  697. function () {
  698. function AbstractNodeTransformer(randomGenerator, options) {
  699. _classCallCheck(this, AbstractNodeTransformer);
  700. this.randomGenerator = randomGenerator;
  701. this.options = options;
  702. }
  703. _createClass(AbstractNodeTransformer, [{
  704. key: "initialize",
  705. value: function initialize() {
  706. this.nodeIdentifier = this.randomGenerator.getRandomInteger(0, 10000);
  707. }
  708. }]);
  709. return AbstractNodeTransformer;
  710. }();
  711. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Number)], AbstractNodeTransformer.prototype, "nodeIdentifier", void 0);
  712. 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);
  713. 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);
  714. exports.AbstractNodeTransformer = AbstractNodeTransformer;
  715. /***/ }),
  716. /* 14 */
  717. /***/ (function(module, exports, __webpack_require__) {
  718. "use strict";
  719. var _classCallCheck = __webpack_require__(0);
  720. var _createClass = __webpack_require__(2);
  721. Object.defineProperty(exports, "__esModule", {
  722. value: true
  723. });
  724. var tslib_1 = __webpack_require__(4);
  725. var inversify_1 = __webpack_require__(1);
  726. var ServiceIdentifiers_1 = __webpack_require__(3);
  727. var GlobalVariableTemplate1_1 = __webpack_require__(101);
  728. var GlobalVariableTemplate2_1 = __webpack_require__(102);
  729. var AbstractCustomNode = AbstractCustomNode_1 =
  730. /*#__PURE__*/
  731. function () {
  732. function AbstractCustomNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  733. _classCallCheck(this, AbstractCustomNode);
  734. this.cachedNode = null;
  735. this.identifierNamesGenerator = identifierNamesGeneratorFactory(options);
  736. this.randomGenerator = randomGenerator;
  737. this.options = options;
  738. }
  739. _createClass(AbstractCustomNode, [{
  740. key: "getNode",
  741. value: function getNode() {
  742. if (!this.cachedNode) {
  743. this.cachedNode = this.getNodeStructure();
  744. }
  745. return this.cachedNode;
  746. }
  747. }, {
  748. key: "getGlobalVariableTemplate",
  749. value: function getGlobalVariableTemplate() {
  750. return this.randomGenerator.getRandomGenerator().pickone(AbstractCustomNode_1.globalVariableTemplateFunctions);
  751. }
  752. }]);
  753. return AbstractCustomNode;
  754. }();
  755. AbstractCustomNode.globalVariableTemplateFunctions = [GlobalVariableTemplate1_1.GlobalVariableTemplate1(), GlobalVariableTemplate2_1.GlobalVariableTemplate2()];
  756. 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);
  757. exports.AbstractCustomNode = AbstractCustomNode;
  758. var AbstractCustomNode_1;
  759. /***/ }),
  760. /* 15 */
  761. /***/ (function(module, exports, __webpack_require__) {
  762. "use strict";
  763. var _Object$assign = __webpack_require__(11);
  764. var _classCallCheck = __webpack_require__(0);
  765. var _createClass = __webpack_require__(2);
  766. Object.defineProperty(exports, "__esModule", {
  767. value: true
  768. });
  769. var escodegen = __importStar(__webpack_require__(42));
  770. var NodeType_1 = __webpack_require__(18);
  771. var Nodes =
  772. /*#__PURE__*/
  773. function () {
  774. function Nodes() {
  775. _classCallCheck(this, Nodes);
  776. }
  777. _createClass(Nodes, null, [{
  778. key: "getProgramNode",
  779. value: function getProgramNode() {
  780. var body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  781. return {
  782. type: NodeType_1.NodeType.Program,
  783. body: body,
  784. sourceType: 'script',
  785. obfuscatedNode: false
  786. };
  787. }
  788. }, {
  789. key: "getArrayExpressionNode",
  790. value: function getArrayExpressionNode() {
  791. var elements = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  792. return {
  793. type: NodeType_1.NodeType.ArrayExpression,
  794. elements: elements
  795. };
  796. }
  797. }, {
  798. key: "getAssignmentExpressionNode",
  799. value: function getAssignmentExpressionNode(operator, left, right) {
  800. return {
  801. type: NodeType_1.NodeType.AssignmentExpression,
  802. operator: operator,
  803. left: left,
  804. right: right,
  805. obfuscatedNode: false
  806. };
  807. }
  808. }, {
  809. key: "getBinaryExpressionNode",
  810. value: function getBinaryExpressionNode(operator, left, right) {
  811. return {
  812. type: NodeType_1.NodeType.BinaryExpression,
  813. operator: operator,
  814. left: left,
  815. right: right,
  816. obfuscatedNode: false
  817. };
  818. }
  819. }, {
  820. key: "getBlockStatementNode",
  821. value: function getBlockStatementNode() {
  822. var body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  823. return {
  824. type: NodeType_1.NodeType.BlockStatement,
  825. body: body,
  826. obfuscatedNode: false
  827. };
  828. }
  829. }, {
  830. key: "getBreakStatement",
  831. value: function getBreakStatement(label) {
  832. var breakStatementNode = {
  833. type: NodeType_1.NodeType.BreakStatement,
  834. obfuscatedNode: false
  835. };
  836. if (label) {
  837. breakStatementNode.label = label;
  838. }
  839. return breakStatementNode;
  840. }
  841. }, {
  842. key: "getCallExpressionNode",
  843. value: function getCallExpressionNode(callee) {
  844. var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  845. return {
  846. type: NodeType_1.NodeType.CallExpression,
  847. callee: callee,
  848. arguments: args,
  849. obfuscatedNode: false
  850. };
  851. }
  852. }, {
  853. key: "getContinueStatement",
  854. value: function getContinueStatement(label) {
  855. var continueStatementNode = {
  856. type: NodeType_1.NodeType.ContinueStatement,
  857. obfuscatedNode: false
  858. };
  859. if (label) {
  860. continueStatementNode.label = label;
  861. }
  862. return continueStatementNode;
  863. }
  864. }, {
  865. key: "getExpressionStatementNode",
  866. value: function getExpressionStatementNode(expression) {
  867. return {
  868. type: NodeType_1.NodeType.ExpressionStatement,
  869. expression: expression,
  870. obfuscatedNode: false
  871. };
  872. }
  873. }, {
  874. key: "getFunctionDeclarationNode",
  875. value: function getFunctionDeclarationNode(functionName, params, body) {
  876. return {
  877. type: NodeType_1.NodeType.FunctionDeclaration,
  878. id: Nodes.getIdentifierNode(functionName),
  879. params: params,
  880. body: body,
  881. generator: false,
  882. obfuscatedNode: false
  883. };
  884. }
  885. }, {
  886. key: "getFunctionExpressionNode",
  887. value: function getFunctionExpressionNode(params, body) {
  888. return {
  889. type: NodeType_1.NodeType.FunctionExpression,
  890. params: params,
  891. body: body,
  892. generator: false,
  893. obfuscatedNode: false
  894. };
  895. }
  896. }, {
  897. key: "getIfStatementNode",
  898. value: function getIfStatementNode(test, consequent, alternate) {
  899. return _Object$assign({
  900. type: NodeType_1.NodeType.IfStatement,
  901. test: test,
  902. consequent: consequent
  903. }, alternate && {
  904. alternate: alternate
  905. }, {
  906. obfuscatedNode: false
  907. });
  908. }
  909. }, {
  910. key: "getIdentifierNode",
  911. value: function getIdentifierNode(name) {
  912. return {
  913. type: NodeType_1.NodeType.Identifier,
  914. name: name,
  915. obfuscatedNode: false
  916. };
  917. }
  918. }, {
  919. key: "getLiteralNode",
  920. value: function getLiteralNode(value, raw) {
  921. raw = raw !== undefined ? raw : "'".concat(value, "'");
  922. return {
  923. type: NodeType_1.NodeType.Literal,
  924. value: value,
  925. raw: raw,
  926. 'x-verbatim-property': {
  927. content: raw,
  928. precedence: escodegen.Precedence.Primary
  929. },
  930. obfuscatedNode: false
  931. };
  932. }
  933. }, {
  934. key: "getLogicalExpressionNode",
  935. value: function getLogicalExpressionNode(operator, left, right) {
  936. return {
  937. type: NodeType_1.NodeType.LogicalExpression,
  938. operator: operator,
  939. left: left,
  940. right: right,
  941. obfuscatedNode: false
  942. };
  943. }
  944. }, {
  945. key: "getMemberExpressionNode",
  946. value: function getMemberExpressionNode(object, property) {
  947. var computed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  948. return {
  949. type: NodeType_1.NodeType.MemberExpression,
  950. computed: computed,
  951. object: object,
  952. property: property,
  953. obfuscatedNode: false
  954. };
  955. }
  956. }, {
  957. key: "getMethodDefinitionNode",
  958. value: function getMethodDefinitionNode(key, value, kind, computed) {
  959. return {
  960. type: NodeType_1.NodeType.MethodDefinition,
  961. key: key,
  962. value: value,
  963. kind: kind,
  964. computed: computed,
  965. static: false,
  966. obfuscatedNode: false
  967. };
  968. }
  969. }, {
  970. key: "getObjectExpressionNode",
  971. value: function getObjectExpressionNode(properties) {
  972. return {
  973. type: NodeType_1.NodeType.ObjectExpression,
  974. properties: properties,
  975. obfuscatedNode: false
  976. };
  977. }
  978. }, {
  979. key: "getPropertyNode",
  980. value: function getPropertyNode(key, value) {
  981. var computed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  982. return {
  983. type: NodeType_1.NodeType.Property,
  984. key: key,
  985. value: value,
  986. kind: 'init',
  987. method: false,
  988. shorthand: false,
  989. computed: computed,
  990. obfuscatedNode: false
  991. };
  992. }
  993. }, {
  994. key: "getUnaryExpressionNode",
  995. value: function getUnaryExpressionNode(operator, argument) {
  996. var prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  997. return {
  998. type: NodeType_1.NodeType.UnaryExpression,
  999. operator: operator,
  1000. argument: argument,
  1001. prefix: prefix,
  1002. obfuscatedNode: false
  1003. };
  1004. }
  1005. }, {
  1006. key: "getReturnStatementNode",
  1007. value: function getReturnStatementNode(argument) {
  1008. return {
  1009. type: NodeType_1.NodeType.ReturnStatement,
  1010. argument: argument,
  1011. obfuscatedNode: false
  1012. };
  1013. }
  1014. }, {
  1015. key: "getSwitchStatementNode",
  1016. value: function getSwitchStatementNode(discriminant, cases) {
  1017. return {
  1018. type: NodeType_1.NodeType.SwitchStatement,
  1019. discriminant: discriminant,
  1020. cases: cases,
  1021. obfuscatedNode: false
  1022. };
  1023. }
  1024. }, {
  1025. key: "getSwitchCaseNode",
  1026. value: function getSwitchCaseNode(test, consequent) {
  1027. return {
  1028. type: NodeType_1.NodeType.SwitchCase,
  1029. test: test,
  1030. consequent: consequent,
  1031. obfuscatedNode: false
  1032. };
  1033. }
  1034. }, {
  1035. key: "getUpdateExpressionNode",
  1036. value: function getUpdateExpressionNode(operator, argumentExpr) {
  1037. return {
  1038. type: NodeType_1.NodeType.UpdateExpression,
  1039. operator: operator,
  1040. argument: argumentExpr,
  1041. prefix: false,
  1042. obfuscatedNode: false
  1043. };
  1044. }
  1045. }, {
  1046. key: "getVariableDeclarationNode",
  1047. value: function getVariableDeclarationNode() {
  1048. var declarations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  1049. var kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'var';
  1050. return {
  1051. type: NodeType_1.NodeType.VariableDeclaration,
  1052. declarations: declarations,
  1053. kind: kind,
  1054. obfuscatedNode: false
  1055. };
  1056. }
  1057. }, {
  1058. key: "getVariableDeclaratorNode",
  1059. value: function getVariableDeclaratorNode(id, init) {
  1060. return {
  1061. type: NodeType_1.NodeType.VariableDeclarator,
  1062. id: id,
  1063. init: init,
  1064. obfuscatedNode: false
  1065. };
  1066. }
  1067. }, {
  1068. key: "getWhileStatementNode",
  1069. value: function getWhileStatementNode(test, body) {
  1070. return {
  1071. type: NodeType_1.NodeType.WhileStatement,
  1072. test: test,
  1073. body: body,
  1074. obfuscatedNode: false
  1075. };
  1076. }
  1077. }]);
  1078. return Nodes;
  1079. }();
  1080. exports.Nodes = Nodes;
  1081. /***/ }),
  1082. /* 16 */
  1083. /***/ (function(module, exports) {
  1084. module.exports = require("@babel/runtime/core-js/map");
  1085. /***/ }),
  1086. /* 17 */
  1087. /***/ (function(module, exports) {
  1088. module.exports = require("estraverse");
  1089. /***/ }),
  1090. /* 18 */
  1091. /***/ (function(module, exports, __webpack_require__) {
  1092. "use strict";
  1093. Object.defineProperty(exports, "__esModule", {
  1094. value: true
  1095. });
  1096. var NodeType;
  1097. (function (NodeType) {
  1098. NodeType["ArrayExpression"] = "ArrayExpression";
  1099. NodeType["ArrayPattern"] = "ArrayPattern";
  1100. NodeType["ArrowFunctionExpression"] = "ArrowFunctionExpression";
  1101. NodeType["AssignmentExpression"] = "AssignmentExpression";
  1102. NodeType["AssignmentPattern"] = "AssignmentPattern";
  1103. NodeType["AwaitExpression"] = "AwaitExpression";
  1104. NodeType["BinaryExpression"] = "BinaryExpression";
  1105. NodeType["BlockStatement"] = "BlockStatement";
  1106. NodeType["BreakStatement"] = "BreakStatement";
  1107. NodeType["CallExpression"] = "CallExpression";
  1108. NodeType["CatchClause"] = "CatchClause";
  1109. NodeType["ClassDeclaration"] = "ClassDeclaration";
  1110. NodeType["ContinueStatement"] = "ContinueStatement";
  1111. NodeType["ExpressionStatement"] = "ExpressionStatement";
  1112. NodeType["FunctionDeclaration"] = "FunctionDeclaration";
  1113. NodeType["FunctionExpression"] = "FunctionExpression";
  1114. NodeType["Identifier"] = "Identifier";
  1115. NodeType["IfStatement"] = "IfStatement";
  1116. NodeType["LabeledStatement"] = "LabeledStatement";
  1117. NodeType["Literal"] = "Literal";
  1118. NodeType["LogicalExpression"] = "LogicalExpression";
  1119. NodeType["MemberExpression"] = "MemberExpression";
  1120. NodeType["MethodDefinition"] = "MethodDefinition";
  1121. NodeType["ObjectExpression"] = "ObjectExpression";
  1122. NodeType["ObjectPattern"] = "ObjectPattern";
  1123. NodeType["Program"] = "Program";
  1124. NodeType["Property"] = "Property";
  1125. NodeType["RestElement"] = "RestElement";
  1126. NodeType["ReturnStatement"] = "ReturnStatement";
  1127. NodeType["Super"] = "Super";
  1128. NodeType["SwitchCase"] = "SwitchCase";
  1129. NodeType["SwitchStatement"] = "SwitchStatement";
  1130. NodeType["TemplateLiteral"] = "TemplateLiteral";
  1131. NodeType["TryStatement"] = "TryStatement";
  1132. NodeType["UnaryExpression"] = "UnaryExpression";
  1133. NodeType["UpdateExpression"] = "UpdateExpression";
  1134. NodeType["VariableDeclaration"] = "VariableDeclaration";
  1135. NodeType["VariableDeclarator"] = "VariableDeclarator";
  1136. NodeType["WhileStatement"] = "WhileStatement";
  1137. })(NodeType = exports.NodeType || (exports.NodeType = {}));
  1138. /***/ }),
  1139. /* 19 */
  1140. /***/ (function(module, exports) {
  1141. module.exports = require("string-template");
  1142. /***/ }),
  1143. /* 20 */
  1144. /***/ (function(module, exports, __webpack_require__) {
  1145. "use strict";
  1146. Object.defineProperty(exports, "__esModule", {
  1147. value: true
  1148. });
  1149. var ControlFlowCustomNode;
  1150. (function (ControlFlowCustomNode) {
  1151. ControlFlowCustomNode["BinaryExpressionFunctionNode"] = "BinaryExpressionFunctionNode";
  1152. ControlFlowCustomNode["BlockStatementControlFlowFlatteningNode"] = "BlockStatementControlFlowFlatteningNode";
  1153. ControlFlowCustomNode["CallExpressionControlFlowStorageCallNode"] = "CallExpressionControlFlowStorageCallNode";
  1154. ControlFlowCustomNode["CallExpressionFunctionNode"] = "CallExpressionFunctionNode";
  1155. ControlFlowCustomNode["ControlFlowStorageNode"] = "ControlFlowStorageNode";
  1156. ControlFlowCustomNode["ExpressionWithOperatorControlFlowStorageCallNode"] = "ExpressionWithOperatorControlFlowStorageCallNode";
  1157. ControlFlowCustomNode["LogicalExpressionFunctionNode"] = "LogicalExpressionFunctionNode";
  1158. ControlFlowCustomNode["StringLiteralControlFlowStorageCallNode"] = "StringLiteralControlFlowStorageCallNode";
  1159. ControlFlowCustomNode["StringLiteralNode"] = "StringLiteralNode";
  1160. })(ControlFlowCustomNode = exports.ControlFlowCustomNode || (exports.ControlFlowCustomNode = {}));
  1161. /***/ }),
  1162. /* 21 */
  1163. /***/ (function(module, exports, __webpack_require__) {
  1164. "use strict";
  1165. Object.defineProperty(exports, "__esModule", {
  1166. value: true
  1167. });
  1168. var ObfuscationTarget;
  1169. (function (ObfuscationTarget) {
  1170. ObfuscationTarget["Browser"] = "browser";
  1171. ObfuscationTarget["Extension"] = "extension";
  1172. ObfuscationTarget["Node"] = "node";
  1173. })(ObfuscationTarget = exports.ObfuscationTarget || (exports.ObfuscationTarget = {}));
  1174. /***/ }),
  1175. /* 22 */
  1176. /***/ (function(module, exports, __webpack_require__) {
  1177. "use strict";
  1178. var _Map = __webpack_require__(16);
  1179. var _classCallCheck = __webpack_require__(0);
  1180. var _createClass = __webpack_require__(2);
  1181. Object.defineProperty(exports, "__esModule", {
  1182. value: true
  1183. });
  1184. var inversify_1 = __webpack_require__(1);
  1185. var ServiceIdentifiers_1 = __webpack_require__(3);
  1186. var AnalyzersModule_1 = __webpack_require__(70);
  1187. var ControlFlowTransformersModule_1 = __webpack_require__(75);
  1188. var ConvertingTransformersModule_1 = __webpack_require__(89);
  1189. var CustomNodesModule_1 = __webpack_require__(94);
  1190. var FinalizingTransformersModule_1 = __webpack_require__(141);
  1191. var GeneratorsModule_1 = __webpack_require__(142);
  1192. var NodeTransformersModule_1 = __webpack_require__(145);
  1193. var ObfuscatingTransformersModule_1 = __webpack_require__(146);
  1194. var OptionsModule_1 = __webpack_require__(159);
  1195. var PreparingTransformersModule_1 = __webpack_require__(174);
  1196. var StoragesModule_1 = __webpack_require__(183);
  1197. var UtilsModule_1 = __webpack_require__(188);
  1198. var JavaScriptObfuscator_1 = __webpack_require__(194);
  1199. var Logger_1 = __webpack_require__(65);
  1200. var ObfuscationEventEmitter_1 = __webpack_require__(197);
  1201. var ObfuscationResult_1 = __webpack_require__(199);
  1202. var SourceCode_1 = __webpack_require__(200);
  1203. var SourceMapCorrector_1 = __webpack_require__(201);
  1204. var TransformersRunner_1 = __webpack_require__(202);
  1205. var InversifyContainerFacade =
  1206. /*#__PURE__*/
  1207. function () {
  1208. function InversifyContainerFacade() {
  1209. _classCallCheck(this, InversifyContainerFacade);
  1210. this.container = new inversify_1.Container();
  1211. }
  1212. _createClass(InversifyContainerFacade, [{
  1213. key: "get",
  1214. value: function get(serviceIdentifier) {
  1215. return this.container.get(serviceIdentifier);
  1216. }
  1217. }, {
  1218. key: "getNamed",
  1219. value: function getNamed(serviceIdentifier, named) {
  1220. return this.container.getNamed(serviceIdentifier, named);
  1221. }
  1222. }, {
  1223. key: "load",
  1224. value: function load(sourceCode, options) {
  1225. this.container.bind(ServiceIdentifiers_1.ServiceIdentifiers.ISourceCode).toDynamicValue(function () {
  1226. return new SourceCode_1.SourceCode(sourceCode);
  1227. }).inSingletonScope();
  1228. this.container.bind(ServiceIdentifiers_1.ServiceIdentifiers.TInputOptions).toDynamicValue(function () {
  1229. return options;
  1230. }).inSingletonScope();
  1231. this.container.bind(ServiceIdentifiers_1.ServiceIdentifiers.ILogger).to(Logger_1.Logger).inSingletonScope();
  1232. this.container.bind(ServiceIdentifiers_1.ServiceIdentifiers.IJavaScriptObfuscator).to(JavaScriptObfuscator_1.JavaScriptObfuscator).inSingletonScope();
  1233. this.container.bind(ServiceIdentifiers_1.ServiceIdentifiers.ITransformersRunner).to(TransformersRunner_1.TransformersRunner).inSingletonScope();
  1234. this.container.bind(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscationResult).to(ObfuscationResult_1.ObfuscationResult).inSingletonScope();
  1235. this.container.bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObfuscationResult).toFactory(function (context) {
  1236. return function (obfuscatedCode, sourceMap) {
  1237. var obfuscationResult = context.container.get(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscationResult);
  1238. obfuscationResult.initialize(obfuscatedCode, sourceMap);
  1239. return obfuscationResult;
  1240. };
  1241. });
  1242. this.container.bind(ServiceIdentifiers_1.ServiceIdentifiers.ISourceMapCorrector).to(SourceMapCorrector_1.SourceMapCorrector).inSingletonScope();
  1243. this.container.bind(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscationEventEmitter).to(ObfuscationEventEmitter_1.ObfuscationEventEmitter).inSingletonScope();
  1244. this.container.load(AnalyzersModule_1.analyzersModule);
  1245. this.container.load(ControlFlowTransformersModule_1.controlFlowTransformersModule);
  1246. this.container.load(ConvertingTransformersModule_1.convertingTransformersModule);
  1247. this.container.load(CustomNodesModule_1.customNodesModule);
  1248. this.container.load(FinalizingTransformersModule_1.finalizingTransformersModule);
  1249. this.container.load(GeneratorsModule_1.generatorsModule);
  1250. this.container.load(NodeTransformersModule_1.nodeTransformersModule);
  1251. this.container.load(ObfuscatingTransformersModule_1.obfuscatingTransformersModule);
  1252. this.container.load(OptionsModule_1.optionsModule);
  1253. this.container.load(PreparingTransformersModule_1.preparingTransformersModule);
  1254. this.container.load(StoragesModule_1.storagesModule);
  1255. this.container.load(UtilsModule_1.utilsModule);
  1256. }
  1257. }, {
  1258. key: "unload",
  1259. value: function unload() {
  1260. this.container.unbindAll();
  1261. }
  1262. }], [{
  1263. key: "getFactory",
  1264. value: function getFactory(serviceIdentifier) {
  1265. return function (context) {
  1266. return function (bindingName) {
  1267. return context.container.getNamed(serviceIdentifier, bindingName);
  1268. };
  1269. };
  1270. }
  1271. }, {
  1272. key: "getCacheFactory",
  1273. value: function getCacheFactory(serviceIdentifier) {
  1274. return function (context) {
  1275. var cache = new _Map();
  1276. return function (bindingName) {
  1277. if (cache.has(bindingName)) {
  1278. return cache.get(bindingName);
  1279. }
  1280. var object = context.container.getNamed(serviceIdentifier, bindingName);
  1281. cache.set(bindingName, object);
  1282. return object;
  1283. };
  1284. };
  1285. }
  1286. }, {
  1287. key: "getConstructorFactory",
  1288. value: function getConstructorFactory(serviceIdentifier) {
  1289. for (var _len = arguments.length, dependencies = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  1290. dependencies[_key - 1] = arguments[_key];
  1291. }
  1292. return function (context) {
  1293. var cache = new _Map();
  1294. var cachedDependencies = [];
  1295. return function (bindingName) {
  1296. dependencies.forEach(function (dependency, index) {
  1297. if (!cachedDependencies[index]) {
  1298. cachedDependencies[index] = context.container.get(dependency);
  1299. }
  1300. });
  1301. if (cache.has(bindingName)) {
  1302. return new (Function.prototype.bind.apply(cache.get(bindingName), [null].concat(cachedDependencies)))();
  1303. }
  1304. var constructor = context.container.getNamed(serviceIdentifier, bindingName);
  1305. cache.set(bindingName, constructor);
  1306. return new (Function.prototype.bind.apply(constructor, [null].concat(cachedDependencies)))();
  1307. };
  1308. };
  1309. }
  1310. }]);
  1311. return InversifyContainerFacade;
  1312. }();
  1313. exports.InversifyContainerFacade = InversifyContainerFacade;
  1314. /***/ }),
  1315. /* 23 */
  1316. /***/ (function(module, exports, __webpack_require__) {
  1317. "use strict";
  1318. var _toConsumableArray = __webpack_require__(24);
  1319. var _classCallCheck = __webpack_require__(0);
  1320. var _createClass = __webpack_require__(2);
  1321. Object.defineProperty(exports, "__esModule", {
  1322. value: true
  1323. });
  1324. var NodeGuards_1 = __webpack_require__(8);
  1325. var NodeAppender =
  1326. /*#__PURE__*/
  1327. function () {
  1328. function NodeAppender() {
  1329. _classCallCheck(this, NodeAppender);
  1330. }
  1331. _createClass(NodeAppender, null, [{
  1332. key: "appendNode",
  1333. value: function appendNode(scopeNode, scopeStatements) {
  1334. scopeStatements = NodeAppender.parentizeScopeStatementsBeforeAppend(scopeNode, scopeStatements);
  1335. NodeAppender.setScopeNodeStatements(scopeNode, _toConsumableArray(NodeAppender.getScopeNodeStatements(scopeNode)).concat(_toConsumableArray(scopeStatements)));
  1336. }
  1337. }, {
  1338. key: "appendNodeToOptimalBlockScope",
  1339. value: function appendNodeToOptimalBlockScope(blockScopeStackTraceData, blockScopeNode, nodeBodyStatements) {
  1340. var index = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  1341. var targetBlockScope;
  1342. if (!blockScopeStackTraceData.length) {
  1343. targetBlockScope = blockScopeNode;
  1344. } else {
  1345. targetBlockScope = NodeAppender.getOptimalBlockScope(blockScopeStackTraceData, index);
  1346. }
  1347. NodeAppender.prependNode(targetBlockScope, nodeBodyStatements);
  1348. }
  1349. }, {
  1350. key: "getOptimalBlockScope",
  1351. value: function getOptimalBlockScope(blockScopeTraceData, index) {
  1352. var deep = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Infinity;
  1353. var firstCall = blockScopeTraceData[index];
  1354. if (deep <= 0) {
  1355. throw new Error("Invalid `deep` argument value. Value should be bigger then 0.");
  1356. }
  1357. if (deep > 1 && firstCall.stackTrace.length) {
  1358. return NodeAppender.getOptimalBlockScope(firstCall.stackTrace, 0, --deep);
  1359. } else {
  1360. return firstCall.callee;
  1361. }
  1362. }
  1363. }, {
  1364. key: "insertNodeAfter",
  1365. value: function insertNodeAfter(scopeNode, scopeStatements, targetStatement) {
  1366. var indexInScopeStatement = NodeAppender.getScopeNodeStatements(scopeNode).indexOf(targetStatement);
  1367. NodeAppender.insertNodeAtIndex(scopeNode, scopeStatements, indexInScopeStatement + 1);
  1368. }
  1369. }, {
  1370. key: "insertNodeAtIndex",
  1371. value: function insertNodeAtIndex(scopeNode, scopeStatements, index) {
  1372. scopeStatements = NodeAppender.parentizeScopeStatementsBeforeAppend(scopeNode, scopeStatements);
  1373. NodeAppender.setScopeNodeStatements(scopeNode, _toConsumableArray(NodeAppender.getScopeNodeStatements(scopeNode).slice(0, index)).concat(_toConsumableArray(scopeStatements), _toConsumableArray(NodeAppender.getScopeNodeStatements(scopeNode).slice(index))));
  1374. }
  1375. }, {
  1376. key: "prependNode",
  1377. value: function prependNode(scopeNode, scopeStatements) {
  1378. scopeStatements = NodeAppender.parentizeScopeStatementsBeforeAppend(scopeNode, scopeStatements);
  1379. NodeAppender.setScopeNodeStatements(scopeNode, _toConsumableArray(scopeStatements).concat(_toConsumableArray(NodeAppender.getScopeNodeStatements(scopeNode))));
  1380. }
  1381. }, {
  1382. key: "getScopeNodeStatements",
  1383. value: function getScopeNodeStatements(scopeNode) {
  1384. if (NodeGuards_1.NodeGuards.isSwitchCaseNode(scopeNode)) {
  1385. return scopeNode.consequent;
  1386. }
  1387. return scopeNode.body;
  1388. }
  1389. }, {
  1390. key: "parentizeScopeStatementsBeforeAppend",
  1391. value: function parentizeScopeStatementsBeforeAppend(scopeNode, scopeStatements) {
  1392. scopeStatements.forEach(function (statement) {
  1393. statement.parentNode = scopeNode;
  1394. });
  1395. return scopeStatements;
  1396. }
  1397. }, {
  1398. key: "setScopeNodeStatements",
  1399. value: function setScopeNodeStatements(scopeNode, statements) {
  1400. if (NodeGuards_1.NodeGuards.isSwitchCaseNode(scopeNode)) {
  1401. scopeNode.consequent = statements;
  1402. return;
  1403. }
  1404. scopeNode.body = statements;
  1405. }
  1406. }]);
  1407. return NodeAppender;
  1408. }();
  1409. exports.NodeAppender = NodeAppender;
  1410. /***/ }),
  1411. /* 24 */
  1412. /***/ (function(module, exports) {
  1413. module.exports = require("@babel/runtime/helpers/toConsumableArray");
  1414. /***/ }),
  1415. /* 25 */
  1416. /***/ (function(module, exports, __webpack_require__) {
  1417. "use strict";
  1418. Object.defineProperty(exports, "__esModule", {
  1419. value: true
  1420. });
  1421. var ObfuscationEvent;
  1422. (function (ObfuscationEvent) {
  1423. ObfuscationEvent["AfterObfuscation"] = "afterObfuscation";
  1424. ObfuscationEvent["BeforeObfuscation"] = "beforeObfuscation";
  1425. })(ObfuscationEvent = exports.ObfuscationEvent || (exports.ObfuscationEvent = {}));
  1426. /***/ }),
  1427. /* 26 */
  1428. /***/ (function(module, exports, __webpack_require__) {
  1429. "use strict";
  1430. Object.defineProperty(exports, "__esModule", {
  1431. value: true
  1432. });
  1433. var IdentifierObfuscatingReplacer;
  1434. (function (IdentifierObfuscatingReplacer) {
  1435. IdentifierObfuscatingReplacer["BaseIdentifierObfuscatingReplacer"] = "BaseIdentifierObfuscatingReplacer";
  1436. })(IdentifierObfuscatingReplacer = exports.IdentifierObfuscatingReplacer || (exports.IdentifierObfuscatingReplacer = {}));
  1437. /***/ }),
  1438. /* 27 */
  1439. /***/ (function(module, exports, __webpack_require__) {
  1440. "use strict";
  1441. var _classCallCheck = __webpack_require__(0);
  1442. var _createClass = __webpack_require__(2);
  1443. Object.defineProperty(exports, "__esModule", {
  1444. value: true
  1445. });
  1446. __webpack_require__(69);
  1447. var ServiceIdentifiers_1 = __webpack_require__(3);
  1448. var InversifyContainerFacade_1 = __webpack_require__(22);
  1449. var JavaScriptObfuscatorCLI_1 = __webpack_require__(47);
  1450. var JavaScriptObfuscatorFacade =
  1451. /*#__PURE__*/
  1452. function () {
  1453. function JavaScriptObfuscatorFacade() {
  1454. _classCallCheck(this, JavaScriptObfuscatorFacade);
  1455. }
  1456. _createClass(JavaScriptObfuscatorFacade, null, [{
  1457. key: "obfuscate",
  1458. value: function obfuscate(sourceCode) {
  1459. var inputOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1460. var inversifyContainerFacade = new InversifyContainerFacade_1.InversifyContainerFacade();
  1461. inversifyContainerFacade.load(sourceCode, inputOptions);
  1462. var javaScriptObfuscator = inversifyContainerFacade.get(ServiceIdentifiers_1.ServiceIdentifiers.IJavaScriptObfuscator);
  1463. var obfuscationResult = javaScriptObfuscator.obfuscate(sourceCode);
  1464. inversifyContainerFacade.unload();
  1465. return obfuscationResult;
  1466. }
  1467. }, {
  1468. key: "runCLI",
  1469. value: function runCLI(argv) {
  1470. var javaScriptObfuscatorCLI = new JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI(argv);
  1471. javaScriptObfuscatorCLI.initialize();
  1472. javaScriptObfuscatorCLI.run();
  1473. }
  1474. }]);
  1475. return JavaScriptObfuscatorFacade;
  1476. }();
  1477. exports.JavaScriptObfuscator = JavaScriptObfuscatorFacade;
  1478. /***/ }),
  1479. /* 28 */
  1480. /***/ (function(module, exports, __webpack_require__) {
  1481. "use strict";
  1482. Object.defineProperty(exports, "__esModule", {
  1483. value: true
  1484. });
  1485. var NodeTransformer;
  1486. (function (NodeTransformer) {
  1487. NodeTransformer["BlockStatementControlFlowTransformer"] = "BlockStatementControlFlowTransformer";
  1488. NodeTransformer["ClassDeclarationTransformer"] = "ClassDeclarationTransformer";
  1489. NodeTransformer["CommentsTransformer"] = "CommentsTransformer";
  1490. NodeTransformer["CustomNodesTransformer"] = "CustomNodesTransformer";
  1491. NodeTransformer["DeadCodeInjectionTransformer"] = "DeadCodeInjectionTransformer";
  1492. NodeTransformer["EvalCallExpressionTransformer"] = "EvalCallExpressionTransformer";
  1493. NodeTransformer["FunctionControlFlowTransformer"] = "FunctionControlFlowTransformer";
  1494. NodeTransformer["CatchClauseTransformer"] = "CatchClauseTransformer";
  1495. NodeTransformer["FunctionDeclarationTransformer"] = "FunctionDeclarationTransformer";
  1496. NodeTransformer["FunctionTransformer"] = "FunctionTransformer";
  1497. NodeTransformer["LabeledStatementTransformer"] = "LabeledStatementTransformer";
  1498. NodeTransformer["LiteralTransformer"] = "LiteralTransformer";
  1499. NodeTransformer["MemberExpressionTransformer"] = "MemberExpressionTransformer";
  1500. NodeTransformer["MethodDefinitionTransformer"] = "MethodDefinitionTransformer";
  1501. NodeTransformer["ObfuscatingGuardsTransformer"] = "ObfuscatingGuardsTransformer";
  1502. NodeTransformer["ObjectExpressionKeysTransformer"] = "ObjectExpressionKeysTransformer";
  1503. NodeTransformer["ObjectExpressionTransformer"] = "ObjectExpressionTransformer";
  1504. NodeTransformer["ParentificationTransformer"] = "ParentificationTransformer";
  1505. NodeTransformer["TemplateLiteralTransformer"] = "TemplateLiteralTransformer";
  1506. NodeTransformer["VariableDeclarationTransformer"] = "VariableDeclarationTransformer";
  1507. })(NodeTransformer = exports.NodeTransformer || (exports.NodeTransformer = {}));
  1508. /***/ }),
  1509. /* 29 */
  1510. /***/ (function(module, exports) {
  1511. module.exports = require("@babel/runtime/core-js/set");
  1512. /***/ }),
  1513. /* 30 */
  1514. /***/ (function(module, exports) {
  1515. module.exports = require("@babel/runtime/helpers/slicedToArray");
  1516. /***/ }),
  1517. /* 31 */
  1518. /***/ (function(module, exports, __webpack_require__) {
  1519. "use strict";
  1520. Object.defineProperty(exports, "__esModule", {
  1521. value: true
  1522. });
  1523. var CustomNode;
  1524. (function (CustomNode) {
  1525. CustomNode["ConsoleOutputDisableExpressionNode"] = "ConsoleOutputDisableExpressionNode";
  1526. CustomNode["DebugProtectionFunctionCallNode"] = "DebugProtectionFunctionCallNode";
  1527. CustomNode["DebugProtectionFunctionIntervalNode"] = "DebugProtectionFunctionIntervalNode";
  1528. CustomNode["DebugProtectionFunctionNode"] = "DebugProtectionFunctionNode";
  1529. CustomNode["DomainLockNode"] = "DomainLockNode";
  1530. CustomNode["NodeCallsControllerFunctionNode"] = "NodeCallsControllerFunctionNode";
  1531. CustomNode["SelfDefendingUnicodeNode"] = "SelfDefendingUnicodeNode";
  1532. CustomNode["StringArrayCallsWrapper"] = "StringArrayCallsWrapper";
  1533. CustomNode["StringArrayNode"] = "StringArrayNode";
  1534. CustomNode["StringArrayRotateFunctionNode"] = "StringArrayRotateFunctionNode";
  1535. })(CustomNode = exports.CustomNode || (exports.CustomNode = {}));
  1536. /***/ }),
  1537. /* 32 */
  1538. /***/ (function(module, exports, __webpack_require__) {
  1539. "use strict";
  1540. var _Array$from = __webpack_require__(56);
  1541. var _classCallCheck = __webpack_require__(0);
  1542. var _createClass = __webpack_require__(2);
  1543. Object.defineProperty(exports, "__esModule", {
  1544. value: true
  1545. });
  1546. var JSFuck_1 = __webpack_require__(138);
  1547. var Utils =
  1548. /*#__PURE__*/
  1549. function () {
  1550. function Utils() {
  1551. _classCallCheck(this, Utils);
  1552. }
  1553. _createClass(Utils, null, [{
  1554. key: "decToHex",
  1555. value: function decToHex(dec) {
  1556. var radix = 16;
  1557. return dec.toString(radix);
  1558. }
  1559. }, {
  1560. key: "extractDomainFromUrl",
  1561. value: function extractDomainFromUrl(url) {
  1562. var domain;
  1563. if (url.indexOf('://') > -1 || url.indexOf('//') === 0) {
  1564. domain = url.split('/')[2];
  1565. } else {
  1566. domain = url.split('/')[0];
  1567. }
  1568. domain = domain.split(':')[0];
  1569. return domain;
  1570. }
  1571. }, {
  1572. key: "isCeilNumber",
  1573. value: function isCeilNumber(number) {
  1574. return number % 1 === 0;
  1575. }
  1576. }, {
  1577. key: "stringRotate",
  1578. value: function stringRotate(string, times) {
  1579. if (!string) {
  1580. throw new ReferenceError("Cannot rotate empty string.");
  1581. }
  1582. for (var i = 0; i < times; i++) {
  1583. string = string[string.length - 1] + string.substring(0, string.length - 1);
  1584. }
  1585. return string;
  1586. }
  1587. }, {
  1588. key: "stringToJSFuck",
  1589. value: function stringToJSFuck(string) {
  1590. return _Array$from(string).map(function (character) {
  1591. return JSFuck_1.JSFuck[character] || character;
  1592. }).join(' + ');
  1593. }
  1594. }]);
  1595. return Utils;
  1596. }();
  1597. Utils.hexadecimalPrefix = '0x';
  1598. exports.Utils = Utils;
  1599. /***/ }),
  1600. /* 33 */
  1601. /***/ (function(module, exports) {
  1602. module.exports = require("@babel/runtime/core-js/get-iterator");
  1603. /***/ }),
  1604. /* 34 */
  1605. /***/ (function(module, exports, __webpack_require__) {
  1606. "use strict";
  1607. var _classCallCheck = __webpack_require__(0);
  1608. var _createClass = __webpack_require__(2);
  1609. Object.defineProperty(exports, "__esModule", {
  1610. value: true
  1611. });
  1612. var tslib_1 = __webpack_require__(4);
  1613. var inversify_1 = __webpack_require__(1);
  1614. var ServiceIdentifiers_1 = __webpack_require__(3);
  1615. var AbstractCustomNodeGroup =
  1616. /*#__PURE__*/
  1617. function () {
  1618. function AbstractCustomNodeGroup(identifierNamesGeneratorFactory, randomGenerator, options) {
  1619. _classCallCheck(this, AbstractCustomNodeGroup);
  1620. this.identifierNamesGenerator = identifierNamesGeneratorFactory(options);
  1621. this.randomGenerator = randomGenerator;
  1622. this.options = options;
  1623. }
  1624. _createClass(AbstractCustomNodeGroup, [{
  1625. key: "getAppendEvent",
  1626. value: function getAppendEvent() {
  1627. return this.appendEvent;
  1628. }
  1629. }, {
  1630. key: "getCustomNodes",
  1631. value: function getCustomNodes() {
  1632. return this.customNodes;
  1633. }
  1634. }, {
  1635. key: "appendCustomNodeIfExist",
  1636. value: function appendCustomNodeIfExist(customNodeName, callback) {
  1637. var customNode = this.customNodes.get(customNodeName);
  1638. if (!customNode) {
  1639. return;
  1640. }
  1641. callback(customNode);
  1642. }
  1643. }, {
  1644. key: "getRandomStackTraceIndex",
  1645. value: function getRandomStackTraceIndex(stackTraceLength) {
  1646. return this.randomGenerator.getRandomInteger(0, Math.max(0, Math.round(stackTraceLength - 1)));
  1647. }
  1648. }]);
  1649. return AbstractCustomNodeGroup;
  1650. }();
  1651. 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);
  1652. exports.AbstractCustomNodeGroup = AbstractCustomNodeGroup;
  1653. /***/ }),
  1654. /* 35 */
  1655. /***/ (function(module, exports, __webpack_require__) {
  1656. "use strict";
  1657. Object.defineProperty(exports, "__esModule", {
  1658. value: true
  1659. });
  1660. var IdentifierNamesGenerator;
  1661. (function (IdentifierNamesGenerator) {
  1662. IdentifierNamesGenerator["HexadecimalIdentifierNamesGenerator"] = "hexadecimal";
  1663. IdentifierNamesGenerator["MangledIdentifierNamesGenerator"] = "mangled";
  1664. })(IdentifierNamesGenerator = exports.IdentifierNamesGenerator || (exports.IdentifierNamesGenerator = {}));
  1665. /***/ }),
  1666. /* 36 */
  1667. /***/ (function(module, exports, __webpack_require__) {
  1668. "use strict";
  1669. Object.defineProperty(exports, "__esModule", {
  1670. value: true
  1671. });
  1672. var SourceMapMode;
  1673. (function (SourceMapMode) {
  1674. SourceMapMode["Inline"] = "inline";
  1675. SourceMapMode["Separate"] = "separate";
  1676. })(SourceMapMode = exports.SourceMapMode || (exports.SourceMapMode = {}));
  1677. /***/ }),
  1678. /* 37 */
  1679. /***/ (function(module, exports, __webpack_require__) {
  1680. "use strict";
  1681. Object.defineProperty(exports, "__esModule", {
  1682. value: true
  1683. });
  1684. var StringArrayEncoding;
  1685. (function (StringArrayEncoding) {
  1686. StringArrayEncoding["Base64"] = "base64";
  1687. StringArrayEncoding["Rc4"] = "rc4";
  1688. })(StringArrayEncoding = exports.StringArrayEncoding || (exports.StringArrayEncoding = {}));
  1689. /***/ }),
  1690. /* 38 */
  1691. /***/ (function(module, exports) {
  1692. module.exports = require("@babel/runtime/core-js/object/keys");
  1693. /***/ }),
  1694. /* 39 */
  1695. /***/ (function(module, exports, __webpack_require__) {
  1696. "use strict";
  1697. var _Object$freeze = __webpack_require__(57);
  1698. Object.defineProperty(exports, "__esModule", {
  1699. value: true
  1700. });
  1701. var IdentifierNamesGenerator_1 = __webpack_require__(35);
  1702. var ObfuscationTarget_1 = __webpack_require__(21);
  1703. var SourceMapMode_1 = __webpack_require__(36);
  1704. exports.NO_ADDITIONAL_NODES_PRESET = _Object$freeze({
  1705. compact: true,
  1706. controlFlowFlattening: false,
  1707. controlFlowFlatteningThreshold: 0,
  1708. deadCodeInjection: false,
  1709. deadCodeInjectionThreshold: 0,
  1710. debugProtection: false,
  1711. debugProtectionInterval: false,
  1712. disableConsoleOutput: false,
  1713. domainLock: [],
  1714. exclude: [],
  1715. identifierNamesGenerator: IdentifierNamesGenerator_1.IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator,
  1716. identifiersPrefix: '',
  1717. log: false,
  1718. renameGlobals: false,
  1719. reservedNames: [],
  1720. rotateStringArray: false,
  1721. seed: 0,
  1722. selfDefending: false,
  1723. sourceMap: false,
  1724. sourceMapBaseUrl: '',
  1725. sourceMapFileName: '',
  1726. sourceMapMode: SourceMapMode_1.SourceMapMode.Separate,
  1727. stringArray: false,
  1728. stringArrayEncoding: false,
  1729. stringArrayThreshold: 0,
  1730. target: ObfuscationTarget_1.ObfuscationTarget.Browser,
  1731. transformObjectKeys: false,
  1732. unicodeEscapeSequence: false
  1733. });
  1734. /***/ }),
  1735. /* 40 */
  1736. /***/ (function(module, exports, __webpack_require__) {
  1737. "use strict";
  1738. var _classCallCheck = __webpack_require__(0);
  1739. Object.defineProperty(exports, "__esModule", {
  1740. value: true
  1741. });
  1742. var tslib_1 = __webpack_require__(4);
  1743. var inversify_1 = __webpack_require__(1);
  1744. var ServiceIdentifiers_1 = __webpack_require__(3);
  1745. var AbstractObfuscatingReplacer = function AbstractObfuscatingReplacer(options) {
  1746. _classCallCheck(this, AbstractObfuscatingReplacer);
  1747. this.options = options;
  1748. };
  1749. 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);
  1750. exports.AbstractObfuscatingReplacer = AbstractObfuscatingReplacer;
  1751. /***/ }),
  1752. /* 41 */
  1753. /***/ (function(module, exports, __webpack_require__) {
  1754. "use strict";
  1755. var _classCallCheck = __webpack_require__(0);
  1756. Object.defineProperty(exports, "__esModule", {
  1757. value: true
  1758. });
  1759. var tslib_1 = __webpack_require__(4);
  1760. var inversify_1 = __webpack_require__(1);
  1761. var AbstractCalleeDataExtractor = function AbstractCalleeDataExtractor() {
  1762. _classCallCheck(this, AbstractCalleeDataExtractor);
  1763. };
  1764. AbstractCalleeDataExtractor = tslib_1.__decorate([inversify_1.injectable()], AbstractCalleeDataExtractor);
  1765. exports.AbstractCalleeDataExtractor = AbstractCalleeDataExtractor;
  1766. /***/ }),
  1767. /* 42 */
  1768. /***/ (function(module, exports) {
  1769. module.exports = require("escodegen-wallaby");
  1770. /***/ }),
  1771. /* 43 */
  1772. /***/ (function(module, exports, __webpack_require__) {
  1773. "use strict";
  1774. var _Map = __webpack_require__(16);
  1775. var _classCallCheck = __webpack_require__(0);
  1776. var _createClass = __webpack_require__(2);
  1777. Object.defineProperty(exports, "__esModule", {
  1778. value: true
  1779. });
  1780. var tslib_1 = __webpack_require__(4);
  1781. var inversify_1 = __webpack_require__(1);
  1782. var ServiceIdentifiers_1 = __webpack_require__(3);
  1783. var AbstractControlFlowReplacer = AbstractControlFlowReplacer_1 =
  1784. /*#__PURE__*/
  1785. function () {
  1786. function AbstractControlFlowReplacer(controlFlowCustomNodeFactory, randomGenerator, options) {
  1787. _classCallCheck(this, AbstractControlFlowReplacer);
  1788. this.replacerDataByControlFlowStorageId = new _Map();
  1789. this.controlFlowCustomNodeFactory = controlFlowCustomNodeFactory;
  1790. this.randomGenerator = randomGenerator;
  1791. this.options = options;
  1792. }
  1793. _createClass(AbstractControlFlowReplacer, [{
  1794. key: "insertCustomNodeToControlFlowStorage",
  1795. value: function insertCustomNodeToControlFlowStorage(customNode, controlFlowStorage, replacerId, usingExistingIdentifierChance) {
  1796. var _this = this;
  1797. var controlFlowStorageId = controlFlowStorage.getStorageId();
  1798. var storageKeysById = AbstractControlFlowReplacer_1.getStorageKeysByIdForCurrentStorage(this.replacerDataByControlFlowStorageId, controlFlowStorageId);
  1799. var storageKeysForCurrentId = storageKeysById.get(replacerId);
  1800. if (this.randomGenerator.getMathRandom() < usingExistingIdentifierChance && storageKeysForCurrentId && storageKeysForCurrentId.length) {
  1801. return this.randomGenerator.getRandomGenerator().pickone(storageKeysForCurrentId);
  1802. }
  1803. var generateStorageKey = function generateStorageKey(length) {
  1804. var key = _this.randomGenerator.getRandomString(length);
  1805. if (controlFlowStorage.getStorage().has(key)) {
  1806. return generateStorageKey(length);
  1807. }
  1808. return key;
  1809. };
  1810. var storageKey = generateStorageKey(5);
  1811. storageKeysById.set(replacerId, [storageKey]);
  1812. this.replacerDataByControlFlowStorageId.set(controlFlowStorageId, storageKeysById);
  1813. controlFlowStorage.set(storageKey, customNode);
  1814. return storageKey;
  1815. }
  1816. }], [{
  1817. key: "getStorageKeysByIdForCurrentStorage",
  1818. value: function getStorageKeysByIdForCurrentStorage(identifierDataByControlFlowStorageId, controlFlowStorageId) {
  1819. var storageKeysById;
  1820. if (identifierDataByControlFlowStorageId.has(controlFlowStorageId)) {
  1821. storageKeysById = identifierDataByControlFlowStorageId.get(controlFlowStorageId);
  1822. } else {
  1823. storageKeysById = new _Map();
  1824. }
  1825. return storageKeysById;
  1826. }
  1827. }]);
  1828. return AbstractControlFlowReplacer;
  1829. }();
  1830. 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);
  1831. exports.AbstractControlFlowReplacer = AbstractControlFlowReplacer;
  1832. var AbstractControlFlowReplacer_1;
  1833. /***/ }),
  1834. /* 44 */
  1835. /***/ (function(module, exports, __webpack_require__) {
  1836. "use strict";
  1837. Object.defineProperty(exports, "__esModule", {
  1838. value: true
  1839. });
  1840. function GlobalVariableNoEvalTemplate() {
  1841. 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 ";
  1842. }
  1843. exports.GlobalVariableNoEvalTemplate = GlobalVariableNoEvalTemplate;
  1844. /***/ }),
  1845. /* 45 */
  1846. /***/ (function(module, exports) {
  1847. module.exports = require("@babel/runtime/helpers/get");
  1848. /***/ }),
  1849. /* 46 */
  1850. /***/ (function(module, exports, __webpack_require__) {
  1851. "use strict";
  1852. var _Object$freeze = __webpack_require__(57);
  1853. Object.defineProperty(exports, "__esModule", {
  1854. value: true
  1855. });
  1856. var IdentifierNamesGenerator_1 = __webpack_require__(35);
  1857. var ObfuscationTarget_1 = __webpack_require__(21);
  1858. var SourceMapMode_1 = __webpack_require__(36);
  1859. exports.DEFAULT_PRESET = _Object$freeze({
  1860. compact: true,
  1861. config: '',
  1862. controlFlowFlattening: false,
  1863. controlFlowFlatteningThreshold: 0.75,
  1864. deadCodeInjection: false,
  1865. deadCodeInjectionThreshold: 0.4,
  1866. debugProtection: false,
  1867. debugProtectionInterval: false,
  1868. disableConsoleOutput: false,
  1869. domainLock: [],
  1870. exclude: [],
  1871. identifierNamesGenerator: IdentifierNamesGenerator_1.IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator,
  1872. identifiersPrefix: '',
  1873. log: false,
  1874. renameGlobals: false,
  1875. reservedNames: [],
  1876. rotateStringArray: true,
  1877. seed: 0,
  1878. selfDefending: false,
  1879. sourceMap: false,
  1880. sourceMapBaseUrl: '',
  1881. sourceMapFileName: '',
  1882. sourceMapMode: SourceMapMode_1.SourceMapMode.Separate,
  1883. stringArray: true,
  1884. stringArrayEncoding: false,
  1885. stringArrayThreshold: 0.75,
  1886. target: ObfuscationTarget_1.ObfuscationTarget.Browser,
  1887. transformObjectKeys: false,
  1888. unicodeEscapeSequence: false
  1889. });
  1890. /***/ }),
  1891. /* 47 */
  1892. /***/ (function(module, exports, __webpack_require__) {
  1893. "use strict";
  1894. var _Object$assign = __webpack_require__(11);
  1895. var _classCallCheck = __webpack_require__(0);
  1896. var _createClass = __webpack_require__(2);
  1897. Object.defineProperty(exports, "__esModule", {
  1898. value: true
  1899. });
  1900. var tslib_1 = __webpack_require__(4);
  1901. var commander = tslib_1.__importStar(__webpack_require__(204));
  1902. var packageJson = tslib_1.__importStar(__webpack_require__(63));
  1903. var path = tslib_1.__importStar(__webpack_require__(48));
  1904. var Initializable_1 = __webpack_require__(10);
  1905. var Default_1 = __webpack_require__(46);
  1906. var ArraySanitizer_1 = __webpack_require__(205);
  1907. var BooleanSanitizer_1 = __webpack_require__(206);
  1908. var IdentifierNamesGeneratorSanitizer_1 = __webpack_require__(207);
  1909. var ObfuscatingTargetSanitizer_1 = __webpack_require__(208);
  1910. var SourceMapModeSanitizer_1 = __webpack_require__(209);
  1911. var StringArrayEncodingSanitizer_1 = __webpack_require__(210);
  1912. var CLIUtils_1 = __webpack_require__(211);
  1913. var JavaScriptObfuscatorFacade_1 = __webpack_require__(27);
  1914. var SourceCodeReader_1 = __webpack_require__(214);
  1915. var JavaScriptObfuscatorCLI =
  1916. /*#__PURE__*/
  1917. function () {
  1918. function JavaScriptObfuscatorCLI(argv) {
  1919. _classCallCheck(this, JavaScriptObfuscatorCLI);
  1920. this.rawArguments = argv;
  1921. this.arguments = argv.slice(2);
  1922. }
  1923. _createClass(JavaScriptObfuscatorCLI, [{
  1924. key: "initialize",
  1925. value: function initialize() {
  1926. this.inputPath = path.normalize(this.arguments[0] || '');
  1927. this.commands = new commander.Command();
  1928. this.configureCommands();
  1929. this.configureHelp();
  1930. this.inputCLIOptions = this.commands.opts();
  1931. }
  1932. }, {
  1933. key: "run",
  1934. value: function run() {
  1935. var canShowHelp = !this.arguments.length || this.arguments.includes('--help');
  1936. if (canShowHelp) {
  1937. return this.commands.outputHelp();
  1938. }
  1939. var sourceCodeData = new SourceCodeReader_1.SourceCodeReader(this.inputCLIOptions).readSourceCode(this.inputPath);
  1940. this.processSourceCodeData(sourceCodeData);
  1941. }
  1942. }, {
  1943. key: "buildOptions",
  1944. value: function buildOptions() {
  1945. var inputCLIOptions = JavaScriptObfuscatorCLI.filterOptions(this.inputCLIOptions);
  1946. var configFilePath = this.inputCLIOptions.config;
  1947. var configFileLocation = configFilePath ? path.resolve(configFilePath, '.') : '';
  1948. var configFileOptions = configFileLocation ? CLIUtils_1.CLIUtils.getUserConfig(configFileLocation) : {};
  1949. return _Object$assign({}, Default_1.DEFAULT_PRESET, configFileOptions, inputCLIOptions);
  1950. }
  1951. }, {
  1952. key: "configureCommands",
  1953. value: function configureCommands() {
  1954. 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('--exclude <list> (comma separated, without whitespaces)', 'A filename or glob which indicates files to exclude from obfuscation', ArraySanitizer_1.ArraySanitizer).option('--identifier-names-generator <string> [hexadecimal, mangled]', 'Sets identifier names generator (Default: hexadecimal)', IdentifierNamesGeneratorSanitizer_1.IdentifierNamesGeneratorSanitizer).option('--identifiers-prefix <string>', 'Sets prefix for all global identifiers.').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 <string|boolean> [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);
  1955. }
  1956. }, {
  1957. key: "configureHelp",
  1958. value: function configureHelp() {
  1959. this.commands.on('--help', function () {
  1960. console.log(' Examples:\n');
  1961. console.log(' %> javascript-obfuscator input_file_name.js --compact true --self-defending false');
  1962. console.log(' %> javascript-obfuscator input_file_name.js --output output_file_name.js --compact true --self-defending false');
  1963. console.log(' %> javascript-obfuscator input_directory_name --compact true --self-defending false');
  1964. console.log('');
  1965. });
  1966. }
  1967. }, {
  1968. key: "processSourceCodeData",
  1969. value: function processSourceCodeData(sourceCodeData) {
  1970. var _this = this;
  1971. var outputPath = this.inputCLIOptions.output ? path.normalize(this.inputCLIOptions.output) : '';
  1972. if (!Array.isArray(sourceCodeData)) {
  1973. var outputCodePath = outputPath || CLIUtils_1.CLIUtils.getOutputCodePath(this.inputPath);
  1974. this.processSourceCode(sourceCodeData, outputCodePath, null);
  1975. } else {
  1976. sourceCodeData.forEach(function (_ref, index) {
  1977. var filePath = _ref.filePath,
  1978. content = _ref.content;
  1979. var outputCodePath = outputPath ? path.join(outputPath, filePath) : CLIUtils_1.CLIUtils.getOutputCodePath(filePath);
  1980. _this.processSourceCode(content, outputCodePath, index);
  1981. });
  1982. }
  1983. }
  1984. }, {
  1985. key: "processSourceCode",
  1986. value: function processSourceCode(sourceCode, outputCodePath, sourceCodeIndex) {
  1987. var options = this.buildOptions();
  1988. if (sourceCodeIndex !== null) {
  1989. var baseIdentifiersPrefix = this.inputCLIOptions.identifiersPrefix || JavaScriptObfuscatorCLI.baseIdentifiersPrefix;
  1990. var identifiersPrefix = "".concat(baseIdentifiersPrefix).concat(sourceCodeIndex);
  1991. options = _Object$assign({}, options, {
  1992. identifiersPrefix: identifiersPrefix
  1993. });
  1994. }
  1995. if (options.sourceMap) {
  1996. JavaScriptObfuscatorCLI.processSourceCodeWithSourceMap(sourceCode, outputCodePath, options);
  1997. } else {
  1998. JavaScriptObfuscatorCLI.processSourceCodeWithoutSourceMap(sourceCode, outputCodePath, options);
  1999. }
  2000. }
  2001. }], [{
  2002. key: "filterOptions",
  2003. value: function filterOptions(options) {
  2004. var filteredOptions = {};
  2005. for (var option in options) {
  2006. if (!options.hasOwnProperty(option) || options[option] === undefined) {
  2007. continue;
  2008. }
  2009. filteredOptions[option] = options[option];
  2010. }
  2011. return filteredOptions;
  2012. }
  2013. }, {
  2014. key: "processSourceCodeWithoutSourceMap",
  2015. value: function processSourceCodeWithoutSourceMap(sourceCode, outputCodePath, options) {
  2016. var obfuscatedCode = JavaScriptObfuscatorFacade_1.JavaScriptObfuscator.obfuscate(sourceCode, options).getObfuscatedCode();
  2017. CLIUtils_1.CLIUtils.writeFile(outputCodePath, obfuscatedCode);
  2018. }
  2019. }, {
  2020. key: "processSourceCodeWithSourceMap",
  2021. value: function processSourceCodeWithSourceMap(sourceCode, outputCodePath, options) {
  2022. var outputSourceMapPath = CLIUtils_1.CLIUtils.getOutputSourceMapPath(outputCodePath, options.sourceMapFileName || '');
  2023. options = _Object$assign({}, options, {
  2024. sourceMapFileName: path.basename(outputSourceMapPath)
  2025. });
  2026. var obfuscationResult = JavaScriptObfuscatorFacade_1.JavaScriptObfuscator.obfuscate(sourceCode, options);
  2027. CLIUtils_1.CLIUtils.writeFile(outputCodePath, obfuscationResult.getObfuscatedCode());
  2028. if (options.sourceMapMode === 'separate' && obfuscationResult.getSourceMap()) {
  2029. CLIUtils_1.CLIUtils.writeFile(outputSourceMapPath, obfuscationResult.getSourceMap());
  2030. }
  2031. }
  2032. }]);
  2033. return JavaScriptObfuscatorCLI;
  2034. }();
  2035. JavaScriptObfuscatorCLI.encoding = 'utf8';
  2036. JavaScriptObfuscatorCLI.obfuscatedFilePrefix = '-obfuscated';
  2037. JavaScriptObfuscatorCLI.baseIdentifiersPrefix = 'a';
  2038. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], JavaScriptObfuscatorCLI.prototype, "commands", void 0);
  2039. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], JavaScriptObfuscatorCLI.prototype, "inputCLIOptions", void 0);
  2040. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], JavaScriptObfuscatorCLI.prototype, "inputPath", void 0);
  2041. exports.JavaScriptObfuscatorCLI = JavaScriptObfuscatorCLI;
  2042. /***/ }),
  2043. /* 48 */
  2044. /***/ (function(module, exports) {
  2045. module.exports = require("path");
  2046. /***/ }),
  2047. /* 49 */
  2048. /***/ (function(module, exports, __webpack_require__) {
  2049. "use strict";
  2050. Object.defineProperty(exports, "__esModule", {
  2051. value: true
  2052. });
  2053. var CalleeDataExtractor;
  2054. (function (CalleeDataExtractor) {
  2055. CalleeDataExtractor["FunctionDeclarationCalleeDataExtractor"] = "FunctionDeclarationCalleeDataExtractor";
  2056. CalleeDataExtractor["FunctionExpressionCalleeDataExtractor"] = "FunctionExpressionCalleeDataExtractor";
  2057. CalleeDataExtractor["ObjectExpressionCalleeDataExtractor"] = "ObjectExpressionCalleeDataExtractor";
  2058. })(CalleeDataExtractor = exports.CalleeDataExtractor || (exports.CalleeDataExtractor = {}));
  2059. /***/ }),
  2060. /* 50 */
  2061. /***/ (function(module, exports) {
  2062. module.exports = require("@babel/runtime/helpers/typeof");
  2063. /***/ }),
  2064. /* 51 */
  2065. /***/ (function(module, exports) {
  2066. module.exports = require("esprima");
  2067. /***/ }),
  2068. /* 52 */
  2069. /***/ (function(module, exports, __webpack_require__) {
  2070. "use strict";
  2071. Object.defineProperty(exports, "__esModule", {
  2072. value: true
  2073. });
  2074. var ControlFlowReplacer;
  2075. (function (ControlFlowReplacer) {
  2076. ControlFlowReplacer["BinaryExpressionControlFlowReplacer"] = "BinaryExpressionControlFlowReplacer";
  2077. ControlFlowReplacer["CallExpressionControlFlowReplacer"] = "CallExpressionControlFlowReplacer";
  2078. ControlFlowReplacer["LogicalExpressionControlFlowReplacer"] = "LogicalExpressionControlFlowReplacer";
  2079. ControlFlowReplacer["StringLiteralControlFlowReplacer"] = "StringLiteralControlFlowReplacer";
  2080. })(ControlFlowReplacer = exports.ControlFlowReplacer || (exports.ControlFlowReplacer = {}));
  2081. /***/ }),
  2082. /* 53 */
  2083. /***/ (function(module, exports, __webpack_require__) {
  2084. "use strict";
  2085. var _Object$getPrototypeOf = __webpack_require__(5);
  2086. var _classCallCheck = __webpack_require__(0);
  2087. var _createClass = __webpack_require__(2);
  2088. var _possibleConstructorReturn = __webpack_require__(6);
  2089. var _inherits = __webpack_require__(7);
  2090. Object.defineProperty(exports, "__esModule", {
  2091. value: true
  2092. });
  2093. var tslib_1 = __webpack_require__(4);
  2094. var inversify_1 = __webpack_require__(1);
  2095. var ServiceIdentifiers_1 = __webpack_require__(3);
  2096. var ControlFlowCustomNode_1 = __webpack_require__(20);
  2097. var AbstractControlFlowReplacer_1 = __webpack_require__(43);
  2098. var NodeGuards_1 = __webpack_require__(8);
  2099. var ExpressionWithOperatorControlFlowReplacer =
  2100. /*#__PURE__*/
  2101. function (_AbstractControlFlowR) {
  2102. _inherits(ExpressionWithOperatorControlFlowReplacer, _AbstractControlFlowR);
  2103. function ExpressionWithOperatorControlFlowReplacer(controlFlowCustomNodeFactory, randomGenerator, options) {
  2104. _classCallCheck(this, ExpressionWithOperatorControlFlowReplacer);
  2105. return _possibleConstructorReturn(this, (ExpressionWithOperatorControlFlowReplacer.__proto__ || _Object$getPrototypeOf(ExpressionWithOperatorControlFlowReplacer)).call(this, controlFlowCustomNodeFactory, randomGenerator, options));
  2106. }
  2107. _createClass(ExpressionWithOperatorControlFlowReplacer, [{
  2108. key: "getControlFlowStorageCallNode",
  2109. value: function getControlFlowStorageCallNode(controlFlowStorageId, storageKey, leftExpression, rightExpression) {
  2110. var controlFlowStorageCallCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.ExpressionWithOperatorControlFlowStorageCallNode);
  2111. controlFlowStorageCallCustomNode.initialize(controlFlowStorageId, storageKey, leftExpression, rightExpression);
  2112. var statementNode = controlFlowStorageCallCustomNode.getNode()[0];
  2113. if (!statementNode || !NodeGuards_1.NodeGuards.isExpressionStatementNode(statementNode)) {
  2114. throw new Error("`controlFlowStorageCallCustomNode.getNode()[0]` should returns array with `ExpressionStatement` node");
  2115. }
  2116. return statementNode.expression;
  2117. }
  2118. }]);
  2119. return ExpressionWithOperatorControlFlowReplacer;
  2120. }(AbstractControlFlowReplacer_1.AbstractControlFlowReplacer);
  2121. 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);
  2122. exports.ExpressionWithOperatorControlFlowReplacer = ExpressionWithOperatorControlFlowReplacer;
  2123. /***/ }),
  2124. /* 54 */
  2125. /***/ (function(module, exports, __webpack_require__) {
  2126. "use strict";
  2127. Object.defineProperty(exports, "__esModule", {
  2128. value: true
  2129. });
  2130. var DeadCodeInjectionCustomNode;
  2131. (function (DeadCodeInjectionCustomNode) {
  2132. DeadCodeInjectionCustomNode["BlockStatementDeadCodeInjectionNode"] = "BlockStatementDeadCodeInjectionNode";
  2133. })(DeadCodeInjectionCustomNode = exports.DeadCodeInjectionCustomNode || (exports.DeadCodeInjectionCustomNode = {}));
  2134. /***/ }),
  2135. /* 55 */
  2136. /***/ (function(module, exports, __webpack_require__) {
  2137. "use strict";
  2138. Object.defineProperty(exports, "__esModule", {
  2139. value: true
  2140. });
  2141. var CustomNodeGroup;
  2142. (function (CustomNodeGroup) {
  2143. CustomNodeGroup["ConsoleOutputCustomNodeGroup"] = "ConsoleOutputCustomNodeGroup";
  2144. CustomNodeGroup["DebugProtectionCustomNodeGroup"] = "DebugProtectionCustomNodeGroup";
  2145. CustomNodeGroup["DomainLockCustomNodeGroup"] = "DomainLockCustomNodeGroup";
  2146. CustomNodeGroup["SelfDefendingCustomNodeGroup"] = "SelfDefendingCustomNodeGroup";
  2147. CustomNodeGroup["StringArrayCustomNodeGroup"] = "StringArrayCustomNodeGroup";
  2148. })(CustomNodeGroup = exports.CustomNodeGroup || (exports.CustomNodeGroup = {}));
  2149. /***/ }),
  2150. /* 56 */
  2151. /***/ (function(module, exports) {
  2152. module.exports = require("@babel/runtime/core-js/array/from");
  2153. /***/ }),
  2154. /* 57 */
  2155. /***/ (function(module, exports) {
  2156. module.exports = require("@babel/runtime/core-js/object/freeze");
  2157. /***/ }),
  2158. /* 58 */
  2159. /***/ (function(module, exports, __webpack_require__) {
  2160. "use strict";
  2161. var _classCallCheck = __webpack_require__(0);
  2162. Object.defineProperty(exports, "__esModule", {
  2163. value: true
  2164. });
  2165. var tslib_1 = __webpack_require__(4);
  2166. var inversify_1 = __webpack_require__(1);
  2167. var ServiceIdentifiers_1 = __webpack_require__(3);
  2168. var AbstractIdentifierNamesGenerator = function AbstractIdentifierNamesGenerator(randomGenerator, options) {
  2169. _classCallCheck(this, AbstractIdentifierNamesGenerator);
  2170. this.randomGenerator = randomGenerator;
  2171. this.options = options;
  2172. };
  2173. 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);
  2174. exports.AbstractIdentifierNamesGenerator = AbstractIdentifierNamesGenerator;
  2175. /***/ }),
  2176. /* 59 */
  2177. /***/ (function(module, exports, __webpack_require__) {
  2178. "use strict";
  2179. Object.defineProperty(exports, "__esModule", {
  2180. value: true
  2181. });
  2182. var LiteralObfuscatingReplacer;
  2183. (function (LiteralObfuscatingReplacer) {
  2184. LiteralObfuscatingReplacer["BooleanLiteralObfuscatingReplacer"] = "BooleanLiteralObfuscatingReplacer";
  2185. LiteralObfuscatingReplacer["NumberLiteralObfuscatingReplacer"] = "NumberLiteralObfuscatingReplacer";
  2186. LiteralObfuscatingReplacer["StringLiteralObfuscatingReplacer"] = "StringLiteralObfuscatingReplacer";
  2187. })(LiteralObfuscatingReplacer = exports.LiteralObfuscatingReplacer || (exports.LiteralObfuscatingReplacer = {}));
  2188. /***/ }),
  2189. /* 60 */
  2190. /***/ (function(module, exports, __webpack_require__) {
  2191. "use strict";
  2192. Object.defineProperty(exports, "__esModule", {
  2193. value: true
  2194. });
  2195. var ObfuscatingGuard;
  2196. (function (ObfuscatingGuard) {
  2197. ObfuscatingGuard["BlackListNodeGuard"] = "BlackListNodeGuard";
  2198. ObfuscatingGuard["ConditionalCommentNodeGuard"] = "ConditionalCommentNodeGuard";
  2199. })(ObfuscatingGuard = exports.ObfuscatingGuard || (exports.ObfuscatingGuard = {}));
  2200. /***/ }),
  2201. /* 61 */
  2202. /***/ (function(module, exports, __webpack_require__) {
  2203. "use strict";
  2204. var _toConsumableArray = __webpack_require__(24);
  2205. var _getIterator = __webpack_require__(33);
  2206. var _slicedToArray = __webpack_require__(30);
  2207. var _Map = __webpack_require__(16);
  2208. var _classCallCheck = __webpack_require__(0);
  2209. var _createClass = __webpack_require__(2);
  2210. Object.defineProperty(exports, "__esModule", {
  2211. value: true
  2212. });
  2213. var tslib_1 = __webpack_require__(4);
  2214. var inversify_1 = __webpack_require__(1);
  2215. var ServiceIdentifiers_1 = __webpack_require__(3);
  2216. var Initializable_1 = __webpack_require__(10);
  2217. var MapStorage =
  2218. /*#__PURE__*/
  2219. function () {
  2220. function MapStorage(randomGenerator, options) {
  2221. _classCallCheck(this, MapStorage);
  2222. this.randomGenerator = randomGenerator;
  2223. this.options = options;
  2224. }
  2225. _createClass(MapStorage, [{
  2226. key: "initialize",
  2227. value: function initialize() {
  2228. this.storage = new _Map();
  2229. this.storageId = this.randomGenerator.getRandomString(6);
  2230. }
  2231. }, {
  2232. key: "get",
  2233. value: function get(key) {
  2234. var value = this.storage.get(key);
  2235. if (!value) {
  2236. throw new Error("No value found in map storage with key `".concat(key, "`"));
  2237. }
  2238. return value;
  2239. }
  2240. }, {
  2241. key: "getKeyOf",
  2242. value: function getKeyOf(value) {
  2243. var _iteratorNormalCompletion = true;
  2244. var _didIteratorError = false;
  2245. var _iteratorError = undefined;
  2246. try {
  2247. for (var _iterator = _getIterator(this.storage), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  2248. var _ref3 = _step.value;
  2249. var _ref2 = _slicedToArray(_ref3, 2);
  2250. var _key = _ref2[0];
  2251. var _storageValue = _ref2[1];
  2252. if (value === _storageValue) {
  2253. return _key;
  2254. }
  2255. }
  2256. } catch (err) {
  2257. _didIteratorError = true;
  2258. _iteratorError = err;
  2259. } finally {
  2260. try {
  2261. if (!_iteratorNormalCompletion && _iterator.return != null) {
  2262. _iterator.return();
  2263. }
  2264. } finally {
  2265. if (_didIteratorError) {
  2266. throw _iteratorError;
  2267. }
  2268. }
  2269. }
  2270. return null;
  2271. }
  2272. }, {
  2273. key: "getLength",
  2274. value: function getLength() {
  2275. return this.storage.size;
  2276. }
  2277. }, {
  2278. key: "getStorage",
  2279. value: function getStorage() {
  2280. return this.storage;
  2281. }
  2282. }, {
  2283. key: "getStorageId",
  2284. value: function getStorageId() {
  2285. return this.storageId;
  2286. }
  2287. }, {
  2288. key: "mergeWith",
  2289. value: function mergeWith(storage) {
  2290. var mergeId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  2291. this.storage = new _Map(_toConsumableArray(this.storage).concat(_toConsumableArray(storage.getStorage())));
  2292. if (mergeId) {
  2293. this.storageId = storage.getStorageId();
  2294. }
  2295. }
  2296. }, {
  2297. key: "set",
  2298. value: function set(key, value) {
  2299. this.storage.set(key, value);
  2300. }
  2301. }]);
  2302. return MapStorage;
  2303. }();
  2304. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], MapStorage.prototype, "storageId", void 0);
  2305. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", _Map)], MapStorage.prototype, "storage", void 0);
  2306. 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);
  2307. 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);
  2308. exports.MapStorage = MapStorage;
  2309. /***/ }),
  2310. /* 62 */
  2311. /***/ (function(module, exports, __webpack_require__) {
  2312. "use strict";
  2313. var _classCallCheck = __webpack_require__(0);
  2314. var _createClass = __webpack_require__(2);
  2315. Object.defineProperty(exports, "__esModule", {
  2316. value: true
  2317. });
  2318. var tslib_1 = __webpack_require__(4);
  2319. var inversify_1 = __webpack_require__(1);
  2320. var ServiceIdentifiers_1 = __webpack_require__(3);
  2321. var md5_1 = tslib_1.__importDefault(__webpack_require__(191));
  2322. var chance_1 = __webpack_require__(192);
  2323. var Initializable_1 = __webpack_require__(10);
  2324. var RandomGenerator = RandomGenerator_1 =
  2325. /*#__PURE__*/
  2326. function () {
  2327. function RandomGenerator(sourceCode, options) {
  2328. _classCallCheck(this, RandomGenerator);
  2329. this.sourceCode = sourceCode;
  2330. this.options = options;
  2331. }
  2332. _createClass(RandomGenerator, [{
  2333. key: "initialize",
  2334. value: function initialize() {
  2335. var _this = this;
  2336. var getRandomInteger = function getRandomInteger(min, max) {
  2337. return Math.floor(Math.random() * (max - min + 1) + min);
  2338. };
  2339. var getSeed = function getSeed() {
  2340. var md5Hash = md5_1.default(_this.sourceCode.getSourceCode());
  2341. return _this.seed + Number(md5Hash.replace(/\D/g, ''));
  2342. };
  2343. this.seed = this.options.seed !== 0 ? this.options.seed : getRandomInteger(0, 999999999);
  2344. this.randomGenerator = new chance_1.Chance(getSeed());
  2345. }
  2346. }, {
  2347. key: "getMathRandom",
  2348. value: function getMathRandom() {
  2349. return this.getRandomInteger(0, 99999) / 100000;
  2350. }
  2351. }, {
  2352. key: "getRandomFloat",
  2353. value: function getRandomFloat(min, max) {
  2354. return this.getRandomGenerator().floating({
  2355. min: min,
  2356. max: max,
  2357. fixed: 7
  2358. });
  2359. }
  2360. }, {
  2361. key: "getRandomGenerator",
  2362. value: function getRandomGenerator() {
  2363. return this.randomGenerator;
  2364. }
  2365. }, {
  2366. key: "getRandomInteger",
  2367. value: function getRandomInteger(min, max) {
  2368. return this.getRandomGenerator().integer({
  2369. min: min,
  2370. max: max
  2371. });
  2372. }
  2373. }, {
  2374. key: "getRandomString",
  2375. value: function getRandomString(length) {
  2376. var pool = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : RandomGenerator_1.randomGeneratorPool;
  2377. return this.getRandomGenerator().string({
  2378. length: length,
  2379. pool: pool
  2380. });
  2381. }
  2382. }, {
  2383. key: "getSeed",
  2384. value: function getSeed() {
  2385. return this.seed;
  2386. }
  2387. }]);
  2388. return RandomGenerator;
  2389. }();
  2390. RandomGenerator.randomGeneratorPool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
  2391. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], RandomGenerator.prototype, "randomGenerator", void 0);
  2392. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Number)], RandomGenerator.prototype, "seed", void 0);
  2393. 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);
  2394. 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);
  2395. exports.RandomGenerator = RandomGenerator;
  2396. var RandomGenerator_1;
  2397. /***/ }),
  2398. /* 63 */
  2399. /***/ (function(module, exports) {
  2400. module.exports = require("pjson");
  2401. /***/ }),
  2402. /* 64 */
  2403. /***/ (function(module, exports) {
  2404. module.exports = require("chalk");
  2405. /***/ }),
  2406. /* 65 */
  2407. /***/ (function(module, exports, __webpack_require__) {
  2408. "use strict";
  2409. var _classCallCheck = __webpack_require__(0);
  2410. var _createClass = __webpack_require__(2);
  2411. Object.defineProperty(exports, "__esModule", {
  2412. value: true
  2413. });
  2414. var tslib_1 = __webpack_require__(4);
  2415. var inversify_1 = __webpack_require__(1);
  2416. var ServiceIdentifiers_1 = __webpack_require__(3);
  2417. var chalk_1 = tslib_1.__importDefault(__webpack_require__(64));
  2418. var LoggingPrefix_1 = __webpack_require__(66);
  2419. var Logger = Logger_1 =
  2420. /*#__PURE__*/
  2421. function () {
  2422. function Logger(options) {
  2423. _classCallCheck(this, Logger);
  2424. this.options = options;
  2425. }
  2426. _createClass(Logger, [{
  2427. key: "info",
  2428. value: function info(loggingMessage, value) {
  2429. if (!this.options.log) {
  2430. return;
  2431. }
  2432. Logger_1.log(Logger_1.colorInfo, LoggingPrefix_1.LoggingPrefix.Base, loggingMessage, value);
  2433. }
  2434. }, {
  2435. key: "success",
  2436. value: function success(loggingMessage, value) {
  2437. if (!this.options.log) {
  2438. return;
  2439. }
  2440. Logger_1.log(Logger_1.colorSuccess, LoggingPrefix_1.LoggingPrefix.Base, loggingMessage, value);
  2441. }
  2442. }, {
  2443. key: "warn",
  2444. value: function warn(loggingMessage, value) {
  2445. if (!this.options.log) {
  2446. return;
  2447. }
  2448. Logger_1.log(Logger_1.colorWarn, LoggingPrefix_1.LoggingPrefix.Base, loggingMessage, value);
  2449. }
  2450. }], [{
  2451. key: "log",
  2452. value: function log(loggingLevelColor, loggingPrefix, loggingMessage, value) {
  2453. var processedMessage = loggingLevelColor("\n".concat(loggingPrefix, " ").concat(loggingMessage));
  2454. !value ? console.log(processedMessage) : console.log(processedMessage, value);
  2455. }
  2456. }]);
  2457. return Logger;
  2458. }();
  2459. Logger.colorInfo = chalk_1.default.cyan;
  2460. Logger.colorSuccess = chalk_1.default.green;
  2461. Logger.colorWarn = chalk_1.default.yellow;
  2462. 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);
  2463. exports.Logger = Logger;
  2464. var Logger_1;
  2465. /***/ }),
  2466. /* 66 */
  2467. /***/ (function(module, exports, __webpack_require__) {
  2468. "use strict";
  2469. Object.defineProperty(exports, "__esModule", {
  2470. value: true
  2471. });
  2472. var LoggingPrefix;
  2473. (function (LoggingPrefix) {
  2474. LoggingPrefix["Base"] = "[javascript-obfuscator]";
  2475. LoggingPrefix["CLI"] = "[javascript-obfuscator-cli]";
  2476. })(LoggingPrefix = exports.LoggingPrefix || (exports.LoggingPrefix = {}));
  2477. /***/ }),
  2478. /* 67 */
  2479. /***/ (function(module, exports) {
  2480. module.exports = require("fs");
  2481. /***/ }),
  2482. /* 68 */
  2483. /***/ (function(module, exports, __webpack_require__) {
  2484. "use strict";
  2485. Object.defineProperty(exports, "__esModule", {
  2486. value: true
  2487. });
  2488. var JavaScriptObfuscatorFacade_1 = __webpack_require__(27);
  2489. module.exports = JavaScriptObfuscatorFacade_1.JavaScriptObfuscator;
  2490. /***/ }),
  2491. /* 69 */
  2492. /***/ (function(module, exports) {
  2493. module.exports = require("reflect-metadata");
  2494. /***/ }),
  2495. /* 70 */
  2496. /***/ (function(module, exports, __webpack_require__) {
  2497. "use strict";
  2498. Object.defineProperty(exports, "__esModule", {
  2499. value: true
  2500. });
  2501. var InversifyContainerFacade_1 = __webpack_require__(22);
  2502. var inversify_1 = __webpack_require__(1);
  2503. var ServiceIdentifiers_1 = __webpack_require__(3);
  2504. var CalleeDataExtractor_1 = __webpack_require__(49);
  2505. var FunctionDeclarationCalleeDataExtractor_1 = __webpack_require__(71);
  2506. var FunctionExpressionCalleeDataExtractor_1 = __webpack_require__(72);
  2507. var ObjectExpressionCalleeDataExtractor_1 = __webpack_require__(73);
  2508. var StackTraceAnalyzer_1 = __webpack_require__(74);
  2509. exports.analyzersModule = new inversify_1.ContainerModule(function (bind) {
  2510. bind(ServiceIdentifiers_1.ServiceIdentifiers.IStackTraceAnalyzer).to(StackTraceAnalyzer_1.StackTraceAnalyzer).inSingletonScope();
  2511. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICalleeDataExtractor).to(FunctionDeclarationCalleeDataExtractor_1.FunctionDeclarationCalleeDataExtractor).whenTargetNamed(CalleeDataExtractor_1.CalleeDataExtractor.FunctionDeclarationCalleeDataExtractor);
  2512. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICalleeDataExtractor).to(FunctionExpressionCalleeDataExtractor_1.FunctionExpressionCalleeDataExtractor).whenTargetNamed(CalleeDataExtractor_1.CalleeDataExtractor.FunctionExpressionCalleeDataExtractor);
  2513. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICalleeDataExtractor).to(ObjectExpressionCalleeDataExtractor_1.ObjectExpressionCalleeDataExtractor).whenTargetNamed(CalleeDataExtractor_1.CalleeDataExtractor.ObjectExpressionCalleeDataExtractor);
  2514. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICalleeDataExtractor).toFactory(InversifyContainerFacade_1.InversifyContainerFacade.getCacheFactory(ServiceIdentifiers_1.ServiceIdentifiers.ICalleeDataExtractor));
  2515. });
  2516. /***/ }),
  2517. /* 71 */
  2518. /***/ (function(module, exports, __webpack_require__) {
  2519. "use strict";
  2520. var _Object$getPrototypeOf = __webpack_require__(5);
  2521. var _classCallCheck = __webpack_require__(0);
  2522. var _createClass = __webpack_require__(2);
  2523. var _possibleConstructorReturn = __webpack_require__(6);
  2524. var _inherits = __webpack_require__(7);
  2525. Object.defineProperty(exports, "__esModule", {
  2526. value: true
  2527. });
  2528. var tslib_1 = __webpack_require__(4);
  2529. var inversify_1 = __webpack_require__(1);
  2530. var estraverse = tslib_1.__importStar(__webpack_require__(17));
  2531. var AbstractCalleeDataExtractor_1 = __webpack_require__(41);
  2532. var NodeGuards_1 = __webpack_require__(8);
  2533. var NodeUtils_1 = __webpack_require__(9);
  2534. var FunctionDeclarationCalleeDataExtractor =
  2535. /*#__PURE__*/
  2536. function (_AbstractCalleeDataEx) {
  2537. _inherits(FunctionDeclarationCalleeDataExtractor, _AbstractCalleeDataEx);
  2538. function FunctionDeclarationCalleeDataExtractor() {
  2539. _classCallCheck(this, FunctionDeclarationCalleeDataExtractor);
  2540. return _possibleConstructorReturn(this, (FunctionDeclarationCalleeDataExtractor.__proto__ || _Object$getPrototypeOf(FunctionDeclarationCalleeDataExtractor)).apply(this, arguments));
  2541. }
  2542. _createClass(FunctionDeclarationCalleeDataExtractor, [{
  2543. key: "extract",
  2544. value: function extract(blockScopeBody, callee) {
  2545. if (!NodeGuards_1.NodeGuards.isIdentifierNode(callee)) {
  2546. return null;
  2547. }
  2548. var calleeBlockStatement = this.getCalleeBlockStatement(NodeUtils_1.NodeUtils.getBlockScopesOfNode(blockScopeBody[0])[0], callee.name);
  2549. if (!calleeBlockStatement) {
  2550. return null;
  2551. }
  2552. return {
  2553. callee: calleeBlockStatement,
  2554. name: callee.name
  2555. };
  2556. }
  2557. }, {
  2558. key: "getCalleeBlockStatement",
  2559. value: function getCalleeBlockStatement(targetNode, name) {
  2560. var calleeBlockStatement = null;
  2561. estraverse.traverse(targetNode, {
  2562. enter: function enter(node) {
  2563. if (NodeGuards_1.NodeGuards.isFunctionDeclarationNode(node) && node.id.name === name) {
  2564. calleeBlockStatement = node.body;
  2565. return estraverse.VisitorOption.Break;
  2566. }
  2567. }
  2568. });
  2569. return calleeBlockStatement;
  2570. }
  2571. }]);
  2572. return FunctionDeclarationCalleeDataExtractor;
  2573. }(AbstractCalleeDataExtractor_1.AbstractCalleeDataExtractor);
  2574. FunctionDeclarationCalleeDataExtractor = tslib_1.__decorate([inversify_1.injectable()], FunctionDeclarationCalleeDataExtractor);
  2575. exports.FunctionDeclarationCalleeDataExtractor = FunctionDeclarationCalleeDataExtractor;
  2576. /***/ }),
  2577. /* 72 */
  2578. /***/ (function(module, exports, __webpack_require__) {
  2579. "use strict";
  2580. var _Object$getPrototypeOf = __webpack_require__(5);
  2581. var _classCallCheck = __webpack_require__(0);
  2582. var _createClass = __webpack_require__(2);
  2583. var _possibleConstructorReturn = __webpack_require__(6);
  2584. var _inherits = __webpack_require__(7);
  2585. Object.defineProperty(exports, "__esModule", {
  2586. value: true
  2587. });
  2588. var tslib_1 = __webpack_require__(4);
  2589. var inversify_1 = __webpack_require__(1);
  2590. var estraverse = tslib_1.__importStar(__webpack_require__(17));
  2591. var AbstractCalleeDataExtractor_1 = __webpack_require__(41);
  2592. var NodeGuards_1 = __webpack_require__(8);
  2593. var NodeUtils_1 = __webpack_require__(9);
  2594. var FunctionExpressionCalleeDataExtractor =
  2595. /*#__PURE__*/
  2596. function (_AbstractCalleeDataEx) {
  2597. _inherits(FunctionExpressionCalleeDataExtractor, _AbstractCalleeDataEx);
  2598. function FunctionExpressionCalleeDataExtractor() {
  2599. _classCallCheck(this, FunctionExpressionCalleeDataExtractor);
  2600. return _possibleConstructorReturn(this, (FunctionExpressionCalleeDataExtractor.__proto__ || _Object$getPrototypeOf(FunctionExpressionCalleeDataExtractor)).apply(this, arguments));
  2601. }
  2602. _createClass(FunctionExpressionCalleeDataExtractor, [{
  2603. key: "extract",
  2604. value: function extract(blockScopeBody, callee) {
  2605. var calleeBlockStatement = null;
  2606. if (NodeGuards_1.NodeGuards.isIdentifierNode(callee)) {
  2607. calleeBlockStatement = this.getCalleeBlockStatement(NodeUtils_1.NodeUtils.getBlockScopesOfNode(blockScopeBody[0])[0], callee.name);
  2608. }
  2609. if (NodeGuards_1.NodeGuards.isFunctionExpressionNode(callee)) {
  2610. calleeBlockStatement = callee.body;
  2611. }
  2612. if (!calleeBlockStatement) {
  2613. return null;
  2614. }
  2615. return {
  2616. callee: calleeBlockStatement,
  2617. name: callee.name || null
  2618. };
  2619. }
  2620. }, {
  2621. key: "getCalleeBlockStatement",
  2622. value: function getCalleeBlockStatement(targetNode, name) {
  2623. var calleeBlockStatement = null;
  2624. estraverse.traverse(targetNode, {
  2625. enter: function enter(node, parentNode) {
  2626. if (NodeGuards_1.NodeGuards.isFunctionExpressionNode(node) && parentNode && NodeGuards_1.NodeGuards.isVariableDeclaratorNode(parentNode) && NodeGuards_1.NodeGuards.isIdentifierNode(parentNode.id) && parentNode.id.name === name) {
  2627. calleeBlockStatement = node.body;
  2628. return estraverse.VisitorOption.Break;
  2629. }
  2630. }
  2631. });
  2632. return calleeBlockStatement;
  2633. }
  2634. }]);
  2635. return FunctionExpressionCalleeDataExtractor;
  2636. }(AbstractCalleeDataExtractor_1.AbstractCalleeDataExtractor);
  2637. FunctionExpressionCalleeDataExtractor = tslib_1.__decorate([inversify_1.injectable()], FunctionExpressionCalleeDataExtractor);
  2638. exports.FunctionExpressionCalleeDataExtractor = FunctionExpressionCalleeDataExtractor;
  2639. /***/ }),
  2640. /* 73 */
  2641. /***/ (function(module, exports, __webpack_require__) {
  2642. "use strict";
  2643. var _getIterator = __webpack_require__(33);
  2644. var _Object$getPrototypeOf = __webpack_require__(5);
  2645. var _classCallCheck = __webpack_require__(0);
  2646. var _createClass = __webpack_require__(2);
  2647. var _possibleConstructorReturn = __webpack_require__(6);
  2648. var _inherits = __webpack_require__(7);
  2649. Object.defineProperty(exports, "__esModule", {
  2650. value: true
  2651. });
  2652. var tslib_1 = __webpack_require__(4);
  2653. var inversify_1 = __webpack_require__(1);
  2654. var estraverse = tslib_1.__importStar(__webpack_require__(17));
  2655. var AbstractCalleeDataExtractor_1 = __webpack_require__(41);
  2656. var NodeGuards_1 = __webpack_require__(8);
  2657. var NodeUtils_1 = __webpack_require__(9);
  2658. var ObjectExpressionCalleeDataExtractor =
  2659. /*#__PURE__*/
  2660. function (_AbstractCalleeDataEx) {
  2661. _inherits(ObjectExpressionCalleeDataExtractor, _AbstractCalleeDataEx);
  2662. function ObjectExpressionCalleeDataExtractor() {
  2663. _classCallCheck(this, ObjectExpressionCalleeDataExtractor);
  2664. return _possibleConstructorReturn(this, (ObjectExpressionCalleeDataExtractor.__proto__ || _Object$getPrototypeOf(ObjectExpressionCalleeDataExtractor)).apply(this, arguments));
  2665. }
  2666. _createClass(ObjectExpressionCalleeDataExtractor, [{
  2667. key: "extract",
  2668. value: function extract(blockScopeBody, callee) {
  2669. if (!NodeGuards_1.NodeGuards.isMemberExpressionNode(callee)) {
  2670. return null;
  2671. }
  2672. var objectMembersCallsChain = this.createObjectMembersCallsChain([], callee);
  2673. if (!objectMembersCallsChain.length) {
  2674. return null;
  2675. }
  2676. var functionExpressionName = objectMembersCallsChain[objectMembersCallsChain.length - 1];
  2677. var calleeBlockStatement = this.getCalleeBlockStatement(NodeUtils_1.NodeUtils.getBlockScopesOfNode(blockScopeBody[0])[0], objectMembersCallsChain);
  2678. if (!calleeBlockStatement) {
  2679. return null;
  2680. }
  2681. return {
  2682. callee: calleeBlockStatement,
  2683. name: functionExpressionName
  2684. };
  2685. }
  2686. }, {
  2687. key: "createObjectMembersCallsChain",
  2688. value: function createObjectMembersCallsChain(currentChain, memberExpression) {
  2689. if (NodeGuards_1.NodeGuards.isIdentifierNode(memberExpression.property) && memberExpression.computed === false) {
  2690. currentChain.unshift(memberExpression.property.name);
  2691. } else if (NodeGuards_1.NodeGuards.isLiteralNode(memberExpression.property) && (typeof memberExpression.property.value === 'string' || typeof memberExpression.property.value === 'number')) {
  2692. currentChain.unshift(memberExpression.property.value);
  2693. } else {
  2694. return currentChain;
  2695. }
  2696. if (NodeGuards_1.NodeGuards.isMemberExpressionNode(memberExpression.object)) {
  2697. return this.createObjectMembersCallsChain(currentChain, memberExpression.object);
  2698. } else if (NodeGuards_1.NodeGuards.isIdentifierNode(memberExpression.object)) {
  2699. currentChain.unshift(memberExpression.object.name);
  2700. }
  2701. return currentChain;
  2702. }
  2703. }, {
  2704. key: "getCalleeBlockStatement",
  2705. value: function getCalleeBlockStatement(targetNode, objectMembersCallsChain) {
  2706. var _this = this;
  2707. var objectName = objectMembersCallsChain.shift();
  2708. if (!objectName) {
  2709. return null;
  2710. }
  2711. var calleeBlockStatement = null;
  2712. estraverse.traverse(targetNode, {
  2713. enter: function enter(node) {
  2714. if (NodeGuards_1.NodeGuards.isVariableDeclaratorNode(node) && NodeGuards_1.NodeGuards.isIdentifierNode(node.id) && node.init && NodeGuards_1.NodeGuards.isObjectExpressionNode(node.init) && node.id.name === objectName) {
  2715. calleeBlockStatement = _this.findCalleeBlockStatement(node.init.properties, objectMembersCallsChain);
  2716. return estraverse.VisitorOption.Break;
  2717. }
  2718. }
  2719. });
  2720. return calleeBlockStatement;
  2721. }
  2722. }, {
  2723. key: "findCalleeBlockStatement",
  2724. value: function findCalleeBlockStatement(objectExpressionProperties, objectMembersCallsChain) {
  2725. var nextItemInCallsChain = objectMembersCallsChain.shift();
  2726. if (!nextItemInCallsChain) {
  2727. return null;
  2728. }
  2729. var _iteratorNormalCompletion = true;
  2730. var _didIteratorError = false;
  2731. var _iteratorError = undefined;
  2732. try {
  2733. for (var _iterator = _getIterator(objectExpressionProperties), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  2734. var _propertyNode = _step.value;
  2735. var isTargetPropertyNodeWithIdentifierKey = NodeGuards_1.NodeGuards.isIdentifierNode(_propertyNode.key) && _propertyNode.key.name === nextItemInCallsChain;
  2736. var isTargetPropertyNodeWithLiteralKey = NodeGuards_1.NodeGuards.isLiteralNode(_propertyNode.key) && Boolean(_propertyNode.key.value) && _propertyNode.key.value === nextItemInCallsChain;
  2737. if (!isTargetPropertyNodeWithIdentifierKey && !isTargetPropertyNodeWithLiteralKey) {
  2738. continue;
  2739. }
  2740. if (NodeGuards_1.NodeGuards.isObjectExpressionNode(_propertyNode.value)) {
  2741. return this.findCalleeBlockStatement(_propertyNode.value.properties, objectMembersCallsChain);
  2742. }
  2743. if (NodeGuards_1.NodeGuards.isFunctionExpressionNode(_propertyNode.value)) {
  2744. return _propertyNode.value.body;
  2745. }
  2746. }
  2747. } catch (err) {
  2748. _didIteratorError = true;
  2749. _iteratorError = err;
  2750. } finally {
  2751. try {
  2752. if (!_iteratorNormalCompletion && _iterator.return != null) {
  2753. _iterator.return();
  2754. }
  2755. } finally {
  2756. if (_didIteratorError) {
  2757. throw _iteratorError;
  2758. }
  2759. }
  2760. }
  2761. return null;
  2762. }
  2763. }]);
  2764. return ObjectExpressionCalleeDataExtractor;
  2765. }(AbstractCalleeDataExtractor_1.AbstractCalleeDataExtractor);
  2766. ObjectExpressionCalleeDataExtractor = tslib_1.__decorate([inversify_1.injectable()], ObjectExpressionCalleeDataExtractor);
  2767. exports.ObjectExpressionCalleeDataExtractor = ObjectExpressionCalleeDataExtractor;
  2768. /***/ }),
  2769. /* 74 */
  2770. /***/ (function(module, exports, __webpack_require__) {
  2771. "use strict";
  2772. var _Object$assign = __webpack_require__(11);
  2773. var _classCallCheck = __webpack_require__(0);
  2774. var _createClass = __webpack_require__(2);
  2775. Object.defineProperty(exports, "__esModule", {
  2776. value: true
  2777. });
  2778. var tslib_1 = __webpack_require__(4);
  2779. var inversify_1 = __webpack_require__(1);
  2780. var ServiceIdentifiers_1 = __webpack_require__(3);
  2781. var estraverse = tslib_1.__importStar(__webpack_require__(17));
  2782. var CalleeDataExtractor_1 = __webpack_require__(49);
  2783. var NodeGuards_1 = __webpack_require__(8);
  2784. var NodeUtils_1 = __webpack_require__(9);
  2785. var StackTraceAnalyzer = StackTraceAnalyzer_1 =
  2786. /*#__PURE__*/
  2787. function () {
  2788. function StackTraceAnalyzer(calleeDataExtractorFactory) {
  2789. _classCallCheck(this, StackTraceAnalyzer);
  2790. this.calleeDataExtractorFactory = calleeDataExtractorFactory;
  2791. }
  2792. _createClass(StackTraceAnalyzer, [{
  2793. key: "analyze",
  2794. value: function analyze(astTree) {
  2795. return this.analyzeRecursive(astTree.body);
  2796. }
  2797. }, {
  2798. key: "analyzeRecursive",
  2799. value: function analyzeRecursive(blockScopeBody) {
  2800. var _this = this;
  2801. var limitIndex = StackTraceAnalyzer_1.getLimitIndex(blockScopeBody.length);
  2802. var stackTraceData = [];
  2803. var blockScopeBodyLength = blockScopeBody.length;
  2804. var _loop = function _loop(index) {
  2805. if (index > limitIndex) {
  2806. return "break";
  2807. }
  2808. var blockScopeBodyNode = blockScopeBody[index];
  2809. estraverse.traverse(blockScopeBodyNode, {
  2810. enter: function enter(node) {
  2811. if (!NodeGuards_1.NodeGuards.isCallExpressionNode(node)) {
  2812. return;
  2813. }
  2814. if (blockScopeBodyNode.parentNode !== NodeUtils_1.NodeUtils.getBlockScopesOfNode(node)[0]) {
  2815. return estraverse.VisitorOption.Skip;
  2816. }
  2817. _this.analyzeCallExpressionNode(stackTraceData, blockScopeBody, node);
  2818. }
  2819. });
  2820. };
  2821. for (var index = 0; index < blockScopeBodyLength; index++) {
  2822. var _ret = _loop(index);
  2823. if (_ret === "break") break;
  2824. }
  2825. return stackTraceData;
  2826. }
  2827. }, {
  2828. key: "analyzeCallExpressionNode",
  2829. value: function analyzeCallExpressionNode(stackTraceData, blockScopeBody, callExpressionNode) {
  2830. var _this2 = this;
  2831. StackTraceAnalyzer_1.calleeDataExtractorsList.forEach(function (calleeDataExtractorName) {
  2832. var calleeData = _this2.calleeDataExtractorFactory(calleeDataExtractorName).extract(blockScopeBody, callExpressionNode.callee);
  2833. if (!calleeData) {
  2834. return;
  2835. }
  2836. stackTraceData.push(_Object$assign({}, calleeData, {
  2837. stackTrace: _this2.analyzeRecursive(calleeData.callee.body)
  2838. }));
  2839. });
  2840. }
  2841. }], [{
  2842. key: "getLimitIndex",
  2843. value: function getLimitIndex(blockScopeBodyLength) {
  2844. var lastIndex = blockScopeBodyLength - 1;
  2845. var limitThresholdActivationIndex = StackTraceAnalyzer_1.limitThresholdActivationLength - 1;
  2846. var limitIndex = lastIndex;
  2847. if (lastIndex > limitThresholdActivationIndex) {
  2848. limitIndex = Math.round(limitThresholdActivationIndex + lastIndex * StackTraceAnalyzer_1.limitThreshold);
  2849. if (limitIndex > lastIndex) {
  2850. limitIndex = lastIndex;
  2851. }
  2852. }
  2853. return limitIndex;
  2854. }
  2855. }]);
  2856. return StackTraceAnalyzer;
  2857. }();
  2858. StackTraceAnalyzer.calleeDataExtractorsList = [CalleeDataExtractor_1.CalleeDataExtractor.FunctionDeclarationCalleeDataExtractor, CalleeDataExtractor_1.CalleeDataExtractor.FunctionExpressionCalleeDataExtractor, CalleeDataExtractor_1.CalleeDataExtractor.ObjectExpressionCalleeDataExtractor];
  2859. StackTraceAnalyzer.limitThresholdActivationLength = 25;
  2860. StackTraceAnalyzer.limitThreshold = 0.002;
  2861. 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);
  2862. exports.StackTraceAnalyzer = StackTraceAnalyzer;
  2863. var StackTraceAnalyzer_1;
  2864. /***/ }),
  2865. /* 75 */
  2866. /***/ (function(module, exports, __webpack_require__) {
  2867. "use strict";
  2868. Object.defineProperty(exports, "__esModule", {
  2869. value: true
  2870. });
  2871. var InversifyContainerFacade_1 = __webpack_require__(22);
  2872. var inversify_1 = __webpack_require__(1);
  2873. var ServiceIdentifiers_1 = __webpack_require__(3);
  2874. var ControlFlowReplacer_1 = __webpack_require__(52);
  2875. var NodeTransformer_1 = __webpack_require__(28);
  2876. var BinaryExpressionControlFlowReplacer_1 = __webpack_require__(76);
  2877. var BlockStatementControlFlowTransformer_1 = __webpack_require__(77);
  2878. var CallExpressionControlFlowReplacer_1 = __webpack_require__(84);
  2879. var DeadCodeInjectionTransformer_1 = __webpack_require__(85);
  2880. var FunctionControlFlowTransformer_1 = __webpack_require__(86);
  2881. var LogicalExpressionControlFlowReplacer_1 = __webpack_require__(87);
  2882. var StringLiteralControlFlowReplacer_1 = __webpack_require__(88);
  2883. exports.controlFlowTransformersModule = new inversify_1.ContainerModule(function (bind) {
  2884. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(BlockStatementControlFlowTransformer_1.BlockStatementControlFlowTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.BlockStatementControlFlowTransformer);
  2885. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(DeadCodeInjectionTransformer_1.DeadCodeInjectionTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.DeadCodeInjectionTransformer);
  2886. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(FunctionControlFlowTransformer_1.FunctionControlFlowTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.FunctionControlFlowTransformer);
  2887. bind(ServiceIdentifiers_1.ServiceIdentifiers.IControlFlowReplacer).to(BinaryExpressionControlFlowReplacer_1.BinaryExpressionControlFlowReplacer).whenTargetNamed(ControlFlowReplacer_1.ControlFlowReplacer.BinaryExpressionControlFlowReplacer);
  2888. bind(ServiceIdentifiers_1.ServiceIdentifiers.IControlFlowReplacer).to(CallExpressionControlFlowReplacer_1.CallExpressionControlFlowReplacer).whenTargetNamed(ControlFlowReplacer_1.ControlFlowReplacer.CallExpressionControlFlowReplacer);
  2889. bind(ServiceIdentifiers_1.ServiceIdentifiers.IControlFlowReplacer).to(LogicalExpressionControlFlowReplacer_1.LogicalExpressionControlFlowReplacer).whenTargetNamed(ControlFlowReplacer_1.ControlFlowReplacer.LogicalExpressionControlFlowReplacer);
  2890. bind(ServiceIdentifiers_1.ServiceIdentifiers.IControlFlowReplacer).to(StringLiteralControlFlowReplacer_1.StringLiteralControlFlowReplacer).whenTargetNamed(ControlFlowReplacer_1.ControlFlowReplacer.StringLiteralControlFlowReplacer);
  2891. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowReplacer).toFactory(InversifyContainerFacade_1.InversifyContainerFacade.getCacheFactory(ServiceIdentifiers_1.ServiceIdentifiers.IControlFlowReplacer));
  2892. });
  2893. /***/ }),
  2894. /* 76 */
  2895. /***/ (function(module, exports, __webpack_require__) {
  2896. "use strict";
  2897. var _Object$getPrototypeOf = __webpack_require__(5);
  2898. var _classCallCheck = __webpack_require__(0);
  2899. var _createClass = __webpack_require__(2);
  2900. var _possibleConstructorReturn = __webpack_require__(6);
  2901. var _inherits = __webpack_require__(7);
  2902. Object.defineProperty(exports, "__esModule", {
  2903. value: true
  2904. });
  2905. var tslib_1 = __webpack_require__(4);
  2906. var inversify_1 = __webpack_require__(1);
  2907. var ServiceIdentifiers_1 = __webpack_require__(3);
  2908. var ControlFlowCustomNode_1 = __webpack_require__(20);
  2909. var ExpressionWithOperatorControlFlowReplacer_1 = __webpack_require__(53);
  2910. var BinaryExpressionControlFlowReplacer = BinaryExpressionControlFlowReplacer_1 =
  2911. /*#__PURE__*/
  2912. function (_ExpressionWithOperat) {
  2913. _inherits(BinaryExpressionControlFlowReplacer, _ExpressionWithOperat);
  2914. function BinaryExpressionControlFlowReplacer(controlFlowCustomNodeFactory, randomGenerator, options) {
  2915. _classCallCheck(this, BinaryExpressionControlFlowReplacer);
  2916. return _possibleConstructorReturn(this, (BinaryExpressionControlFlowReplacer.__proto__ || _Object$getPrototypeOf(BinaryExpressionControlFlowReplacer)).call(this, controlFlowCustomNodeFactory, randomGenerator, options));
  2917. }
  2918. _createClass(BinaryExpressionControlFlowReplacer, [{
  2919. key: "replace",
  2920. value: function replace(binaryExpressionNode, parentNode, controlFlowStorage) {
  2921. var replacerId = binaryExpressionNode.operator;
  2922. var binaryExpressionFunctionCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.BinaryExpressionFunctionNode);
  2923. binaryExpressionFunctionCustomNode.initialize(replacerId);
  2924. var storageKey = this.insertCustomNodeToControlFlowStorage(binaryExpressionFunctionCustomNode, controlFlowStorage, replacerId, BinaryExpressionControlFlowReplacer_1.usingExistingIdentifierChance);
  2925. return this.getControlFlowStorageCallNode(controlFlowStorage.getStorageId(), storageKey, binaryExpressionNode.left, binaryExpressionNode.right);
  2926. }
  2927. }]);
  2928. return BinaryExpressionControlFlowReplacer;
  2929. }(ExpressionWithOperatorControlFlowReplacer_1.ExpressionWithOperatorControlFlowReplacer);
  2930. BinaryExpressionControlFlowReplacer.usingExistingIdentifierChance = 0.5;
  2931. 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);
  2932. exports.BinaryExpressionControlFlowReplacer = BinaryExpressionControlFlowReplacer;
  2933. var BinaryExpressionControlFlowReplacer_1;
  2934. /***/ }),
  2935. /* 77 */
  2936. /***/ (function(module, exports, __webpack_require__) {
  2937. "use strict";
  2938. var _Object$getPrototypeOf = __webpack_require__(5);
  2939. var _classCallCheck = __webpack_require__(0);
  2940. var _createClass = __webpack_require__(2);
  2941. var _possibleConstructorReturn = __webpack_require__(6);
  2942. var _inherits = __webpack_require__(7);
  2943. Object.defineProperty(exports, "__esModule", {
  2944. value: true
  2945. });
  2946. var tslib_1 = __webpack_require__(4);
  2947. var inversify_1 = __webpack_require__(1);
  2948. var ServiceIdentifiers_1 = __webpack_require__(3);
  2949. var estraverse = tslib_1.__importStar(__webpack_require__(17));
  2950. var ControlFlowCustomNode_1 = __webpack_require__(20);
  2951. var TransformationStage_1 = __webpack_require__(12);
  2952. var AbstractNodeTransformer_1 = __webpack_require__(13);
  2953. var NodeGuards_1 = __webpack_require__(8);
  2954. var NodeUtils_1 = __webpack_require__(9);
  2955. var BlockStatementControlFlowTransformer = BlockStatementControlFlowTransformer_1 =
  2956. /*#__PURE__*/
  2957. function (_AbstractNodeTransfor) {
  2958. _inherits(BlockStatementControlFlowTransformer, _AbstractNodeTransfor);
  2959. function BlockStatementControlFlowTransformer(controlFlowCustomNodeFactory, arrayUtils, randomGenerator, options) {
  2960. var _this;
  2961. _classCallCheck(this, BlockStatementControlFlowTransformer);
  2962. _this = _possibleConstructorReturn(this, (BlockStatementControlFlowTransformer.__proto__ || _Object$getPrototypeOf(BlockStatementControlFlowTransformer)).call(this, randomGenerator, options));
  2963. _this.controlFlowCustomNodeFactory = controlFlowCustomNodeFactory;
  2964. _this.arrayUtils = arrayUtils;
  2965. return _this;
  2966. }
  2967. _createClass(BlockStatementControlFlowTransformer, [{
  2968. key: "getVisitor",
  2969. value: function getVisitor(transformationStage) {
  2970. var _this2 = this;
  2971. switch (transformationStage) {
  2972. case TransformationStage_1.TransformationStage.ControlFlowFlattening:
  2973. return {
  2974. leave: function leave(node, parentNode) {
  2975. if (parentNode && NodeGuards_1.NodeGuards.isBlockStatementNode(node)) {
  2976. return _this2.transformNode(node, parentNode);
  2977. }
  2978. }
  2979. };
  2980. default:
  2981. return null;
  2982. }
  2983. }
  2984. }, {
  2985. key: "transformNode",
  2986. value: function transformNode(blockStatementNode, parentNode) {
  2987. if (this.randomGenerator.getMathRandom() > this.options.controlFlowFlatteningThreshold || !BlockStatementControlFlowTransformer_1.canTransformBlockStatementNode(blockStatementNode)) {
  2988. return blockStatementNode;
  2989. }
  2990. var blockStatementBody = blockStatementNode.body;
  2991. var originalKeys = this.arrayUtils.arrayRange(blockStatementBody.length);
  2992. var shuffledKeys = this.arrayUtils.arrayShuffle(originalKeys);
  2993. var originalKeysIndexesInShuffledArray = originalKeys.map(function (key) {
  2994. return shuffledKeys.indexOf(key);
  2995. });
  2996. var blockStatementControlFlowFlatteningCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.BlockStatementControlFlowFlatteningNode);
  2997. blockStatementControlFlowFlatteningCustomNode.initialize(blockStatementBody, shuffledKeys, originalKeysIndexesInShuffledArray);
  2998. var newBlockStatementNode = blockStatementControlFlowFlatteningCustomNode.getNode()[0];
  2999. NodeUtils_1.NodeUtils.parentizeNode(newBlockStatementNode, parentNode);
  3000. return newBlockStatementNode;
  3001. }
  3002. }], [{
  3003. key: "blockStatementHasProhibitedStatements",
  3004. value: function blockStatementHasProhibitedStatements(blockStatementNode) {
  3005. return blockStatementNode.body.some(function (statement) {
  3006. var isBreakOrContinueStatement = NodeGuards_1.NodeGuards.isBreakStatementNode(statement) || NodeGuards_1.NodeGuards.isContinueStatementNode(statement);
  3007. var isVariableDeclarationWithLetOrConstKind = NodeGuards_1.NodeGuards.isVariableDeclarationNode(statement) && (statement.kind === 'const' || statement.kind === 'let');
  3008. var isClassDeclaration = NodeGuards_1.NodeGuards.isClassDeclarationNode(statement);
  3009. return NodeGuards_1.NodeGuards.isFunctionDeclarationNode(statement) || isBreakOrContinueStatement || isVariableDeclarationWithLetOrConstKind || isClassDeclaration;
  3010. });
  3011. }
  3012. }, {
  3013. key: "canTransformBlockStatementNode",
  3014. value: function canTransformBlockStatementNode(blockStatementNode) {
  3015. var canTransform = true;
  3016. estraverse.traverse(blockStatementNode, {
  3017. enter: function enter(node) {
  3018. if (NodeGuards_1.NodeGuards.isWhileStatementNode(node)) {
  3019. return estraverse.VisitorOption.Skip;
  3020. }
  3021. if (NodeGuards_1.NodeGuards.isBlockStatementNode(node) && BlockStatementControlFlowTransformer_1.blockStatementHasProhibitedStatements(node)) {
  3022. canTransform = false;
  3023. }
  3024. }
  3025. });
  3026. if (blockStatementNode.body.length <= 4) {
  3027. canTransform = false;
  3028. }
  3029. return canTransform;
  3030. }
  3031. }]);
  3032. return BlockStatementControlFlowTransformer;
  3033. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  3034. 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);
  3035. exports.BlockStatementControlFlowTransformer = BlockStatementControlFlowTransformer;
  3036. var BlockStatementControlFlowTransformer_1;
  3037. /***/ }),
  3038. /* 78 */
  3039. /***/ (function(module, exports) {
  3040. module.exports = require("@babel/runtime/core-js/object/define-property");
  3041. /***/ }),
  3042. /* 79 */
  3043. /***/ (function(module, exports) {
  3044. module.exports = require("@babel/runtime/core-js/object/get-own-property-descriptor");
  3045. /***/ }),
  3046. /* 80 */
  3047. /***/ (function(module, exports) {
  3048. module.exports = require("@babel/runtime/core-js/reflect/get-metadata");
  3049. /***/ }),
  3050. /* 81 */
  3051. /***/ (function(module, exports) {
  3052. module.exports = require("@babel/runtime/core-js/object/get-own-property-names");
  3053. /***/ }),
  3054. /* 82 */
  3055. /***/ (function(module, exports) {
  3056. module.exports = require("@babel/runtime/core-js/reflect/define-metadata");
  3057. /***/ }),
  3058. /* 83 */
  3059. /***/ (function(module, exports) {
  3060. module.exports = require("@babel/runtime/core-js/reflect/has-metadata");
  3061. /***/ }),
  3062. /* 84 */
  3063. /***/ (function(module, exports, __webpack_require__) {
  3064. "use strict";
  3065. var _Object$getPrototypeOf = __webpack_require__(5);
  3066. var _classCallCheck = __webpack_require__(0);
  3067. var _createClass = __webpack_require__(2);
  3068. var _possibleConstructorReturn = __webpack_require__(6);
  3069. var _inherits = __webpack_require__(7);
  3070. Object.defineProperty(exports, "__esModule", {
  3071. value: true
  3072. });
  3073. var tslib_1 = __webpack_require__(4);
  3074. var inversify_1 = __webpack_require__(1);
  3075. var ServiceIdentifiers_1 = __webpack_require__(3);
  3076. var ControlFlowCustomNode_1 = __webpack_require__(20);
  3077. var AbstractControlFlowReplacer_1 = __webpack_require__(43);
  3078. var NodeGuards_1 = __webpack_require__(8);
  3079. var CallExpressionControlFlowReplacer = CallExpressionControlFlowReplacer_1 =
  3080. /*#__PURE__*/
  3081. function (_AbstractControlFlowR) {
  3082. _inherits(CallExpressionControlFlowReplacer, _AbstractControlFlowR);
  3083. function CallExpressionControlFlowReplacer(controlFlowCustomNodeFactory, randomGenerator, options) {
  3084. _classCallCheck(this, CallExpressionControlFlowReplacer);
  3085. return _possibleConstructorReturn(this, (CallExpressionControlFlowReplacer.__proto__ || _Object$getPrototypeOf(CallExpressionControlFlowReplacer)).call(this, controlFlowCustomNodeFactory, randomGenerator, options));
  3086. }
  3087. _createClass(CallExpressionControlFlowReplacer, [{
  3088. key: "replace",
  3089. value: function replace(callExpressionNode, parentNode, controlFlowStorage) {
  3090. var callee = callExpressionNode.callee;
  3091. if (!NodeGuards_1.NodeGuards.isIdentifierNode(callee)) {
  3092. return callExpressionNode;
  3093. }
  3094. var replacerId = String(callExpressionNode.arguments.length);
  3095. var callExpressionFunctionCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.CallExpressionFunctionNode);
  3096. var expressionArguments = callExpressionNode.arguments;
  3097. callExpressionFunctionCustomNode.initialize(expressionArguments);
  3098. var storageKey = this.insertCustomNodeToControlFlowStorage(callExpressionFunctionCustomNode, controlFlowStorage, replacerId, CallExpressionControlFlowReplacer_1.usingExistingIdentifierChance);
  3099. return this.getControlFlowStorageCallNode(controlFlowStorage.getStorageId(), storageKey, callee, expressionArguments);
  3100. }
  3101. }, {
  3102. key: "getControlFlowStorageCallNode",
  3103. value: function getControlFlowStorageCallNode(controlFlowStorageId, storageKey, callee, expressionArguments) {
  3104. var controlFlowStorageCallCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.CallExpressionControlFlowStorageCallNode);
  3105. controlFlowStorageCallCustomNode.initialize(controlFlowStorageId, storageKey, callee, expressionArguments);
  3106. var statementNode = controlFlowStorageCallCustomNode.getNode()[0];
  3107. if (!statementNode || !NodeGuards_1.NodeGuards.isExpressionStatementNode(statementNode)) {
  3108. throw new Error("`controlFlowStorageCallCustomNode.getNode()[0]` should returns array with `ExpressionStatement` node");
  3109. }
  3110. return statementNode.expression;
  3111. }
  3112. }]);
  3113. return CallExpressionControlFlowReplacer;
  3114. }(AbstractControlFlowReplacer_1.AbstractControlFlowReplacer);
  3115. CallExpressionControlFlowReplacer.usingExistingIdentifierChance = 0.5;
  3116. 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);
  3117. exports.CallExpressionControlFlowReplacer = CallExpressionControlFlowReplacer;
  3118. var CallExpressionControlFlowReplacer_1;
  3119. /***/ }),
  3120. /* 85 */
  3121. /***/ (function(module, exports, __webpack_require__) {
  3122. "use strict";
  3123. var _Set = __webpack_require__(29);
  3124. var _Object$getPrototypeOf = __webpack_require__(5);
  3125. var _classCallCheck = __webpack_require__(0);
  3126. var _createClass = __webpack_require__(2);
  3127. var _possibleConstructorReturn = __webpack_require__(6);
  3128. var _inherits = __webpack_require__(7);
  3129. Object.defineProperty(exports, "__esModule", {
  3130. value: true
  3131. });
  3132. var tslib_1 = __webpack_require__(4);
  3133. var inversify_1 = __webpack_require__(1);
  3134. var ServiceIdentifiers_1 = __webpack_require__(3);
  3135. var estraverse = tslib_1.__importStar(__webpack_require__(17));
  3136. var DeadCodeInjectionCustomNode_1 = __webpack_require__(54);
  3137. var NodeTransformer_1 = __webpack_require__(28);
  3138. var NodeType_1 = __webpack_require__(18);
  3139. var TransformationStage_1 = __webpack_require__(12);
  3140. var AbstractNodeTransformer_1 = __webpack_require__(13);
  3141. var NodeGuards_1 = __webpack_require__(8);
  3142. var Nodes_1 = __webpack_require__(15);
  3143. var NodeUtils_1 = __webpack_require__(9);
  3144. var DeadCodeInjectionTransformer = DeadCodeInjectionTransformer_1 =
  3145. /*#__PURE__*/
  3146. function (_AbstractNodeTransfor) {
  3147. _inherits(DeadCodeInjectionTransformer, _AbstractNodeTransfor);
  3148. function DeadCodeInjectionTransformer(deadCodeInjectionCustomNodeFactory, transformersRunner, randomGenerator, options) {
  3149. var _this;
  3150. _classCallCheck(this, DeadCodeInjectionTransformer);
  3151. _this = _possibleConstructorReturn(this, (DeadCodeInjectionTransformer.__proto__ || _Object$getPrototypeOf(DeadCodeInjectionTransformer)).call(this, randomGenerator, options));
  3152. _this.deadCodeInjectionRootAstHostNodeSet = new _Set();
  3153. _this.collectedBlockStatements = [];
  3154. _this.collectedBlockStatementsTotalLength = 0;
  3155. _this.deadCodeInjectionCustomNodeFactory = deadCodeInjectionCustomNodeFactory;
  3156. _this.transformersRunner = transformersRunner;
  3157. return _this;
  3158. }
  3159. _createClass(DeadCodeInjectionTransformer, [{
  3160. key: "getVisitor",
  3161. value: function getVisitor(transformationStage) {
  3162. var _this2 = this;
  3163. switch (transformationStage) {
  3164. case TransformationStage_1.TransformationStage.DeadCodeInjection:
  3165. return {
  3166. enter: function enter(node, parentNode) {
  3167. if (parentNode && NodeGuards_1.NodeGuards.isProgramNode(node)) {
  3168. _this2.analyzeNode(node, parentNode);
  3169. return node;
  3170. }
  3171. },
  3172. leave: function leave(node, parentNode) {
  3173. if (parentNode && NodeGuards_1.NodeGuards.isBlockStatementNode(node)) {
  3174. return _this2.transformNode(node, parentNode);
  3175. }
  3176. }
  3177. };
  3178. case TransformationStage_1.TransformationStage.Finalizing:
  3179. if (!this.deadCodeInjectionRootAstHostNodeSet.size) {
  3180. return null;
  3181. }
  3182. return {
  3183. enter: function enter(node, parentNode) {
  3184. if (parentNode && _this2.isDeadCodeInjectionRootAstHostNode(node)) {
  3185. return _this2.restoreNode(node, parentNode);
  3186. }
  3187. }
  3188. };
  3189. default:
  3190. return null;
  3191. }
  3192. }
  3193. }, {
  3194. key: "analyzeNode",
  3195. value: function analyzeNode(programNode, parentNode) {
  3196. var _this3 = this;
  3197. estraverse.traverse(programNode, {
  3198. enter: function enter(node) {
  3199. if (!NodeGuards_1.NodeGuards.isBlockStatementNode(node)) {
  3200. return;
  3201. }
  3202. var clonedBlockStatementNode = NodeUtils_1.NodeUtils.clone(node);
  3203. if (!DeadCodeInjectionTransformer_1.isValidCollectedBlockStatementNode(clonedBlockStatementNode)) {
  3204. return;
  3205. }
  3206. NodeUtils_1.NodeUtils.parentizeNode(clonedBlockStatementNode, clonedBlockStatementNode);
  3207. clonedBlockStatementNode = _this3.transformersRunner.transform(clonedBlockStatementNode, DeadCodeInjectionTransformer_1.transformersToRenameBlockScopeIdentifiers, TransformationStage_1.TransformationStage.Obfuscating);
  3208. _this3.collectedBlockStatements.push(clonedBlockStatementNode);
  3209. }
  3210. });
  3211. this.collectedBlockStatementsTotalLength = this.collectedBlockStatements.length;
  3212. }
  3213. }, {
  3214. key: "transformNode",
  3215. value: function transformNode(blockStatementNode, parentNode) {
  3216. var canBreakTraverse = !this.collectedBlockStatements.length || this.collectedBlockStatementsTotalLength < DeadCodeInjectionTransformer_1.minCollectedBlockStatementsCount;
  3217. if (canBreakTraverse) {
  3218. return estraverse.VisitorOption.Break;
  3219. }
  3220. if (this.randomGenerator.getMathRandom() > this.options.deadCodeInjectionThreshold || !DeadCodeInjectionTransformer_1.isValidWrappedBlockStatementNode(blockStatementNode)) {
  3221. return blockStatementNode;
  3222. }
  3223. var minInteger = 0;
  3224. var maxInteger = this.collectedBlockStatements.length - 1;
  3225. var randomIndex = this.randomGenerator.getRandomInteger(minInteger, maxInteger);
  3226. var randomBlockStatementNode = this.collectedBlockStatements.splice(randomIndex, 1)[0];
  3227. var isDuplicateBlockStatementNodes = randomBlockStatementNode === blockStatementNode;
  3228. if (isDuplicateBlockStatementNodes) {
  3229. return blockStatementNode;
  3230. }
  3231. return this.replaceBlockStatementNode(blockStatementNode, randomBlockStatementNode, parentNode);
  3232. }
  3233. }, {
  3234. key: "restoreNode",
  3235. value: function restoreNode(deadCodeInjectionRootAstHostNode, parentNode) {
  3236. var hostNodeFirstStatement = deadCodeInjectionRootAstHostNode.body[0];
  3237. if (!NodeGuards_1.NodeGuards.isFunctionDeclarationNode(hostNodeFirstStatement)) {
  3238. throw new Error('Wrong dead code injection root AST host node. Host node should contain `FunctionDeclaration` node');
  3239. }
  3240. return hostNodeFirstStatement.body;
  3241. }
  3242. }, {
  3243. key: "isDeadCodeInjectionRootAstHostNode",
  3244. value: function isDeadCodeInjectionRootAstHostNode(node) {
  3245. return NodeGuards_1.NodeGuards.isBlockStatementNode(node) && this.deadCodeInjectionRootAstHostNodeSet.has(node);
  3246. }
  3247. }, {
  3248. key: "replaceBlockStatementNode",
  3249. value: function replaceBlockStatementNode(blockStatementNode, randomBlockStatementNode, parentNode) {
  3250. var deadCodeInjectionRootAstHostNode = Nodes_1.Nodes.getBlockStatementNode([Nodes_1.Nodes.getFunctionDeclarationNode(DeadCodeInjectionTransformer_1.deadCodeInjectionRootAstHostNodeName, [], randomBlockStatementNode)]);
  3251. this.deadCodeInjectionRootAstHostNodeSet.add(deadCodeInjectionRootAstHostNode);
  3252. var blockStatementDeadCodeInjectionCustomNode = this.deadCodeInjectionCustomNodeFactory(DeadCodeInjectionCustomNode_1.DeadCodeInjectionCustomNode.BlockStatementDeadCodeInjectionNode);
  3253. blockStatementDeadCodeInjectionCustomNode.initialize(blockStatementNode, deadCodeInjectionRootAstHostNode);
  3254. var newBlockStatementNode = blockStatementDeadCodeInjectionCustomNode.getNode()[0];
  3255. NodeUtils_1.NodeUtils.parentizeNode(newBlockStatementNode, parentNode);
  3256. return newBlockStatementNode;
  3257. }
  3258. }], [{
  3259. key: "isProhibitedNodeInsideCollectedBlockStatement",
  3260. value: function isProhibitedNodeInsideCollectedBlockStatement(targetNode) {
  3261. return NodeGuards_1.NodeGuards.isBreakStatementNode(targetNode) || NodeGuards_1.NodeGuards.isContinueStatementNode(targetNode) || NodeGuards_1.NodeGuards.isAwaitExpressionNode(targetNode) || NodeGuards_1.NodeGuards.isSuperNode(targetNode);
  3262. }
  3263. }, {
  3264. key: "isScopeHoistingFunctionDeclaration",
  3265. value: function isScopeHoistingFunctionDeclaration(targetNode) {
  3266. if (!NodeGuards_1.NodeGuards.isFunctionDeclarationNode(targetNode)) {
  3267. return false;
  3268. }
  3269. var scopeNode = NodeUtils_1.NodeUtils.getScopeOfNode(targetNode);
  3270. var scopeBody = !NodeGuards_1.NodeGuards.isSwitchCaseNode(scopeNode) ? scopeNode.body : scopeNode.consequent;
  3271. var indexInScope = scopeBody.indexOf(targetNode);
  3272. if (indexInScope === 0) {
  3273. return false;
  3274. }
  3275. var slicedBody = scopeBody.slice(0, indexInScope);
  3276. var hostBlockStatementNode = Nodes_1.Nodes.getBlockStatementNode(slicedBody);
  3277. var functionDeclarationName = targetNode.id.name;
  3278. var isScopeHoistedFunctionDeclaration = false;
  3279. estraverse.traverse(hostBlockStatementNode, {
  3280. enter: function enter(node) {
  3281. if (NodeGuards_1.NodeGuards.isIdentifierNode(node) && node.name === functionDeclarationName) {
  3282. isScopeHoistedFunctionDeclaration = true;
  3283. return estraverse.VisitorOption.Break;
  3284. }
  3285. }
  3286. });
  3287. return isScopeHoistedFunctionDeclaration;
  3288. }
  3289. }, {
  3290. key: "isValidCollectedBlockStatementNode",
  3291. value: function isValidCollectedBlockStatementNode(blockStatementNode) {
  3292. if (!blockStatementNode.body.length) {
  3293. return false;
  3294. }
  3295. var nestedBlockStatementsCount = 0;
  3296. var isValidBlockStatementNode = true;
  3297. estraverse.traverse(blockStatementNode, {
  3298. enter: function enter(node) {
  3299. if (NodeGuards_1.NodeGuards.isBlockStatementNode(node)) {
  3300. nestedBlockStatementsCount++;
  3301. }
  3302. if (nestedBlockStatementsCount > DeadCodeInjectionTransformer_1.maxNestedBlockStatementsCount || DeadCodeInjectionTransformer_1.isProhibitedNodeInsideCollectedBlockStatement(node) || DeadCodeInjectionTransformer_1.isScopeHoistingFunctionDeclaration(node)) {
  3303. isValidBlockStatementNode = false;
  3304. return estraverse.VisitorOption.Break;
  3305. }
  3306. }
  3307. });
  3308. return isValidBlockStatementNode;
  3309. }
  3310. }, {
  3311. key: "isValidWrappedBlockStatementNode",
  3312. value: function isValidWrappedBlockStatementNode(blockStatementNode) {
  3313. if (!blockStatementNode.body.length) {
  3314. return false;
  3315. }
  3316. var isValidBlockStatementNode = true;
  3317. estraverse.traverse(blockStatementNode, {
  3318. enter: function enter(node) {
  3319. if (DeadCodeInjectionTransformer_1.isScopeHoistingFunctionDeclaration(node)) {
  3320. isValidBlockStatementNode = false;
  3321. return estraverse.VisitorOption.Break;
  3322. }
  3323. }
  3324. });
  3325. if (!isValidBlockStatementNode) {
  3326. return false;
  3327. }
  3328. var blockScopeOfBlockStatementNode = NodeUtils_1.NodeUtils.getBlockScopesOfNode(blockStatementNode)[0];
  3329. return blockScopeOfBlockStatementNode.type !== NodeType_1.NodeType.Program;
  3330. }
  3331. }]);
  3332. return DeadCodeInjectionTransformer;
  3333. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  3334. DeadCodeInjectionTransformer.deadCodeInjectionRootAstHostNodeName = 'deadCodeInjectionRootAstHostNode';
  3335. DeadCodeInjectionTransformer.maxNestedBlockStatementsCount = 4;
  3336. DeadCodeInjectionTransformer.minCollectedBlockStatementsCount = 5;
  3337. DeadCodeInjectionTransformer.transformersToRenameBlockScopeIdentifiers = [NodeTransformer_1.NodeTransformer.CatchClauseTransformer, NodeTransformer_1.NodeTransformer.ClassDeclarationTransformer, NodeTransformer_1.NodeTransformer.FunctionDeclarationTransformer, NodeTransformer_1.NodeTransformer.FunctionTransformer, NodeTransformer_1.NodeTransformer.LabeledStatementTransformer, NodeTransformer_1.NodeTransformer.VariableDeclarationTransformer];
  3338. 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.ITransformersRunner)), 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])], DeadCodeInjectionTransformer);
  3339. exports.DeadCodeInjectionTransformer = DeadCodeInjectionTransformer;
  3340. var DeadCodeInjectionTransformer_1;
  3341. /***/ }),
  3342. /* 86 */
  3343. /***/ (function(module, exports, __webpack_require__) {
  3344. "use strict";
  3345. var _Object$assign = __webpack_require__(11);
  3346. var _Set = __webpack_require__(29);
  3347. var _Map = __webpack_require__(16);
  3348. var _Object$getPrototypeOf = __webpack_require__(5);
  3349. var _classCallCheck = __webpack_require__(0);
  3350. var _createClass = __webpack_require__(2);
  3351. var _possibleConstructorReturn = __webpack_require__(6);
  3352. var _inherits = __webpack_require__(7);
  3353. Object.defineProperty(exports, "__esModule", {
  3354. value: true
  3355. });
  3356. var tslib_1 = __webpack_require__(4);
  3357. var inversify_1 = __webpack_require__(1);
  3358. var ServiceIdentifiers_1 = __webpack_require__(3);
  3359. var estraverse = tslib_1.__importStar(__webpack_require__(17));
  3360. var ControlFlowCustomNode_1 = __webpack_require__(20);
  3361. var ControlFlowReplacer_1 = __webpack_require__(52);
  3362. var NodeType_1 = __webpack_require__(18);
  3363. var TransformationStage_1 = __webpack_require__(12);
  3364. var AbstractNodeTransformer_1 = __webpack_require__(13);
  3365. var NodeGuards_1 = __webpack_require__(8);
  3366. var NodeAppender_1 = __webpack_require__(23);
  3367. var NodeUtils_1 = __webpack_require__(9);
  3368. var FunctionControlFlowTransformer = FunctionControlFlowTransformer_1 =
  3369. /*#__PURE__*/
  3370. function (_AbstractNodeTransfor) {
  3371. _inherits(FunctionControlFlowTransformer, _AbstractNodeTransfor);
  3372. function FunctionControlFlowTransformer(controlFlowStorageFactory, controlFlowReplacerFactory, controlFlowCustomNodeFactory, randomGenerator, options) {
  3373. var _this;
  3374. _classCallCheck(this, FunctionControlFlowTransformer);
  3375. _this = _possibleConstructorReturn(this, (FunctionControlFlowTransformer.__proto__ || _Object$getPrototypeOf(FunctionControlFlowTransformer)).call(this, randomGenerator, options));
  3376. _this.controlFlowData = new _Map();
  3377. _this.visitedFunctionNodes = new _Set();
  3378. _this.hostNodesWithControlFlowNode = new _Set();
  3379. _this.controlFlowStorageFactory = controlFlowStorageFactory;
  3380. _this.controlFlowReplacerFactory = controlFlowReplacerFactory;
  3381. _this.controlFlowCustomNodeFactory = controlFlowCustomNodeFactory;
  3382. return _this;
  3383. }
  3384. _createClass(FunctionControlFlowTransformer, [{
  3385. key: "getVisitor",
  3386. value: function getVisitor(transformationStage) {
  3387. var _this2 = this;
  3388. switch (transformationStage) {
  3389. case TransformationStage_1.TransformationStage.ControlFlowFlattening:
  3390. return {
  3391. leave: function leave(node, parentNode) {
  3392. if (parentNode && (NodeGuards_1.NodeGuards.isFunctionDeclarationNode(node) || NodeGuards_1.NodeGuards.isFunctionExpressionNode(node) || NodeGuards_1.NodeGuards.isArrowFunctionExpressionNode(node))) {
  3393. return _this2.transformNode(node, parentNode);
  3394. }
  3395. }
  3396. };
  3397. default:
  3398. return null;
  3399. }
  3400. }
  3401. }, {
  3402. key: "transformNode",
  3403. value: function transformNode(functionNode, parentNode) {
  3404. this.visitedFunctionNodes.add(functionNode);
  3405. if (!NodeGuards_1.NodeGuards.isBlockStatementNode(functionNode.body)) {
  3406. return functionNode;
  3407. }
  3408. var hostNode = this.getHostNode(functionNode.body);
  3409. var controlFlowStorage = this.getControlFlowStorage(hostNode);
  3410. this.controlFlowData.set(hostNode, controlFlowStorage);
  3411. this.transformFunctionBody(functionNode.body, controlFlowStorage);
  3412. if (!controlFlowStorage.getLength()) {
  3413. return functionNode;
  3414. }
  3415. var controlFlowStorageCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.ControlFlowStorageNode);
  3416. controlFlowStorageCustomNode.initialize(controlFlowStorage);
  3417. NodeAppender_1.NodeAppender.prependNode(hostNode, controlFlowStorageCustomNode.getNode());
  3418. this.hostNodesWithControlFlowNode.add(hostNode);
  3419. return functionNode;
  3420. }
  3421. }, {
  3422. key: "getControlFlowStorage",
  3423. value: function getControlFlowStorage(hostNode) {
  3424. var controlFlowStorage = this.controlFlowStorageFactory();
  3425. if (this.controlFlowData.has(hostNode)) {
  3426. if (this.hostNodesWithControlFlowNode.has(hostNode)) {
  3427. hostNode.body.shift();
  3428. }
  3429. var hostControlFlowStorage = this.controlFlowData.get(hostNode);
  3430. controlFlowStorage.mergeWith(hostControlFlowStorage, true);
  3431. }
  3432. return controlFlowStorage;
  3433. }
  3434. }, {
  3435. key: "getHostNode",
  3436. value: function getHostNode(functionNodeBody) {
  3437. var blockScopesOfNode = NodeUtils_1.NodeUtils.getBlockScopesOfNode(functionNodeBody);
  3438. if (blockScopesOfNode.length === 1) {
  3439. return functionNodeBody;
  3440. } else {
  3441. blockScopesOfNode.pop();
  3442. }
  3443. if (blockScopesOfNode.length > FunctionControlFlowTransformer_1.hostNodeSearchMinDepth) {
  3444. blockScopesOfNode.splice(0, FunctionControlFlowTransformer_1.hostNodeSearchMinDepth);
  3445. }
  3446. if (blockScopesOfNode.length > FunctionControlFlowTransformer_1.hostNodeSearchMaxDepth) {
  3447. blockScopesOfNode.length = FunctionControlFlowTransformer_1.hostNodeSearchMaxDepth;
  3448. }
  3449. return this.randomGenerator.getRandomGenerator().pickone(blockScopesOfNode);
  3450. }
  3451. }, {
  3452. key: "isVisitedFunctionNode",
  3453. value: function isVisitedFunctionNode(node) {
  3454. return (NodeGuards_1.NodeGuards.isFunctionDeclarationNode(node) || NodeGuards_1.NodeGuards.isFunctionExpressionNode(node) || NodeGuards_1.NodeGuards.isArrowFunctionExpressionNode(node)) && this.visitedFunctionNodes.has(node);
  3455. }
  3456. }, {
  3457. key: "transformFunctionBody",
  3458. value: function transformFunctionBody(functionNodeBody, controlFlowStorage) {
  3459. var _this3 = this;
  3460. estraverse.replace(functionNodeBody, {
  3461. enter: function enter(node, parentNode) {
  3462. if (node.ignoredNode) {
  3463. return estraverse.VisitorOption.Skip;
  3464. }
  3465. if (_this3.isVisitedFunctionNode(node) || !parentNode) {
  3466. return estraverse.VisitorOption.Skip;
  3467. }
  3468. if (!FunctionControlFlowTransformer_1.controlFlowReplacersMap.has(node.type)) {
  3469. return node;
  3470. }
  3471. if (_this3.randomGenerator.getMathRandom() > _this3.options.controlFlowFlatteningThreshold) {
  3472. return node;
  3473. }
  3474. var controlFlowReplacerName = FunctionControlFlowTransformer_1.controlFlowReplacersMap.get(node.type);
  3475. if (controlFlowReplacerName === undefined) {
  3476. return node;
  3477. }
  3478. return _Object$assign({}, _this3.controlFlowReplacerFactory(controlFlowReplacerName).replace(node, parentNode, controlFlowStorage), {
  3479. parentNode: parentNode
  3480. });
  3481. }
  3482. });
  3483. }
  3484. }]);
  3485. return FunctionControlFlowTransformer;
  3486. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  3487. 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]]);
  3488. FunctionControlFlowTransformer.hostNodeSearchMinDepth = 0;
  3489. FunctionControlFlowTransformer.hostNodeSearchMaxDepth = 2;
  3490. 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);
  3491. exports.FunctionControlFlowTransformer = FunctionControlFlowTransformer;
  3492. var FunctionControlFlowTransformer_1;
  3493. /***/ }),
  3494. /* 87 */
  3495. /***/ (function(module, exports, __webpack_require__) {
  3496. "use strict";
  3497. var _Object$getPrototypeOf = __webpack_require__(5);
  3498. var _classCallCheck = __webpack_require__(0);
  3499. var _createClass = __webpack_require__(2);
  3500. var _possibleConstructorReturn = __webpack_require__(6);
  3501. var _inherits = __webpack_require__(7);
  3502. Object.defineProperty(exports, "__esModule", {
  3503. value: true
  3504. });
  3505. var tslib_1 = __webpack_require__(4);
  3506. var inversify_1 = __webpack_require__(1);
  3507. var ServiceIdentifiers_1 = __webpack_require__(3);
  3508. var ControlFlowCustomNode_1 = __webpack_require__(20);
  3509. var ExpressionWithOperatorControlFlowReplacer_1 = __webpack_require__(53);
  3510. var NodeGuards_1 = __webpack_require__(8);
  3511. var NodeUtils_1 = __webpack_require__(9);
  3512. var LogicalExpressionControlFlowReplacer = LogicalExpressionControlFlowReplacer_1 =
  3513. /*#__PURE__*/
  3514. function (_ExpressionWithOperat) {
  3515. _inherits(LogicalExpressionControlFlowReplacer, _ExpressionWithOperat);
  3516. function LogicalExpressionControlFlowReplacer(controlFlowCustomNodeFactory, randomGenerator, options) {
  3517. _classCallCheck(this, LogicalExpressionControlFlowReplacer);
  3518. return _possibleConstructorReturn(this, (LogicalExpressionControlFlowReplacer.__proto__ || _Object$getPrototypeOf(LogicalExpressionControlFlowReplacer)).call(this, controlFlowCustomNodeFactory, randomGenerator, options));
  3519. }
  3520. _createClass(LogicalExpressionControlFlowReplacer, [{
  3521. key: "replace",
  3522. value: function replace(logicalExpressionNode, parentNode, controlFlowStorage) {
  3523. if (this.checkForProhibitedExpressions(logicalExpressionNode.left, logicalExpressionNode.right)) {
  3524. return logicalExpressionNode;
  3525. }
  3526. var replacerId = logicalExpressionNode.operator;
  3527. var logicalExpressionFunctionCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.LogicalExpressionFunctionNode);
  3528. logicalExpressionFunctionCustomNode.initialize(replacerId);
  3529. var storageKey = this.insertCustomNodeToControlFlowStorage(logicalExpressionFunctionCustomNode, controlFlowStorage, replacerId, LogicalExpressionControlFlowReplacer_1.usingExistingIdentifierChance);
  3530. return this.getControlFlowStorageCallNode(controlFlowStorage.getStorageId(), storageKey, logicalExpressionNode.left, logicalExpressionNode.right);
  3531. }
  3532. }, {
  3533. key: "checkForProhibitedExpressions",
  3534. value: function checkForProhibitedExpressions(leftExpression, rightExpression) {
  3535. return [leftExpression, rightExpression].some(function (expressionNode) {
  3536. var nodeForCheck;
  3537. if (!NodeGuards_1.NodeGuards.isUnaryExpressionNode(expressionNode)) {
  3538. nodeForCheck = expressionNode;
  3539. } else {
  3540. nodeForCheck = NodeUtils_1.NodeUtils.getUnaryExpressionArgumentNode(expressionNode);
  3541. }
  3542. return !NodeGuards_1.NodeGuards.isLiteralNode(nodeForCheck) && !NodeGuards_1.NodeGuards.isIdentifierNode(nodeForCheck) && !NodeGuards_1.NodeGuards.isObjectExpressionNode(nodeForCheck) && !NodeGuards_1.NodeGuards.isExpressionStatementNode(nodeForCheck);
  3543. });
  3544. }
  3545. }]);
  3546. return LogicalExpressionControlFlowReplacer;
  3547. }(ExpressionWithOperatorControlFlowReplacer_1.ExpressionWithOperatorControlFlowReplacer);
  3548. LogicalExpressionControlFlowReplacer.usingExistingIdentifierChance = 0.5;
  3549. 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);
  3550. exports.LogicalExpressionControlFlowReplacer = LogicalExpressionControlFlowReplacer;
  3551. var LogicalExpressionControlFlowReplacer_1;
  3552. /***/ }),
  3553. /* 88 */
  3554. /***/ (function(module, exports, __webpack_require__) {
  3555. "use strict";
  3556. var _Object$getPrototypeOf = __webpack_require__(5);
  3557. var _classCallCheck = __webpack_require__(0);
  3558. var _createClass = __webpack_require__(2);
  3559. var _possibleConstructorReturn = __webpack_require__(6);
  3560. var _inherits = __webpack_require__(7);
  3561. Object.defineProperty(exports, "__esModule", {
  3562. value: true
  3563. });
  3564. var tslib_1 = __webpack_require__(4);
  3565. var inversify_1 = __webpack_require__(1);
  3566. var ServiceIdentifiers_1 = __webpack_require__(3);
  3567. var ControlFlowCustomNode_1 = __webpack_require__(20);
  3568. var AbstractControlFlowReplacer_1 = __webpack_require__(43);
  3569. var NodeGuards_1 = __webpack_require__(8);
  3570. var StringLiteralControlFlowReplacer = StringLiteralControlFlowReplacer_1 =
  3571. /*#__PURE__*/
  3572. function (_AbstractControlFlowR) {
  3573. _inherits(StringLiteralControlFlowReplacer, _AbstractControlFlowR);
  3574. function StringLiteralControlFlowReplacer(controlFlowCustomNodeFactory, randomGenerator, options) {
  3575. _classCallCheck(this, StringLiteralControlFlowReplacer);
  3576. return _possibleConstructorReturn(this, (StringLiteralControlFlowReplacer.__proto__ || _Object$getPrototypeOf(StringLiteralControlFlowReplacer)).call(this, controlFlowCustomNodeFactory, randomGenerator, options));
  3577. }
  3578. _createClass(StringLiteralControlFlowReplacer, [{
  3579. key: "replace",
  3580. value: function replace(literalNode, parentNode, controlFlowStorage) {
  3581. if (NodeGuards_1.NodeGuards.isPropertyNode(parentNode) && parentNode.key === literalNode) {
  3582. return literalNode;
  3583. }
  3584. if (typeof literalNode.value !== 'string' || literalNode.value.length < 3) {
  3585. return literalNode;
  3586. }
  3587. var replacerId = String(literalNode.value);
  3588. var literalFunctionCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.StringLiteralNode);
  3589. literalFunctionCustomNode.initialize(literalNode.value);
  3590. var storageKey = this.insertCustomNodeToControlFlowStorage(literalFunctionCustomNode, controlFlowStorage, replacerId, StringLiteralControlFlowReplacer_1.usingExistingIdentifierChance);
  3591. return this.getControlFlowStorageCallNode(controlFlowStorage.getStorageId(), storageKey);
  3592. }
  3593. }, {
  3594. key: "getControlFlowStorageCallNode",
  3595. value: function getControlFlowStorageCallNode(controlFlowStorageId, storageKey) {
  3596. var controlFlowStorageCallCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.StringLiteralControlFlowStorageCallNode);
  3597. controlFlowStorageCallCustomNode.initialize(controlFlowStorageId, storageKey);
  3598. var statementNode = controlFlowStorageCallCustomNode.getNode()[0];
  3599. if (!statementNode || !NodeGuards_1.NodeGuards.isExpressionStatementNode(statementNode)) {
  3600. throw new Error("`controlFlowStorageCallCustomNode.getNode()[0]` should returns array with `ExpressionStatement` node");
  3601. }
  3602. return statementNode.expression;
  3603. }
  3604. }]);
  3605. return StringLiteralControlFlowReplacer;
  3606. }(AbstractControlFlowReplacer_1.AbstractControlFlowReplacer);
  3607. StringLiteralControlFlowReplacer.usingExistingIdentifierChance = 1;
  3608. 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);
  3609. exports.StringLiteralControlFlowReplacer = StringLiteralControlFlowReplacer;
  3610. var StringLiteralControlFlowReplacer_1;
  3611. /***/ }),
  3612. /* 89 */
  3613. /***/ (function(module, exports, __webpack_require__) {
  3614. "use strict";
  3615. Object.defineProperty(exports, "__esModule", {
  3616. value: true
  3617. });
  3618. var inversify_1 = __webpack_require__(1);
  3619. var ServiceIdentifiers_1 = __webpack_require__(3);
  3620. var NodeTransformer_1 = __webpack_require__(28);
  3621. var MemberExpressionTransformer_1 = __webpack_require__(90);
  3622. var MethodDefinitionTransformer_1 = __webpack_require__(91);
  3623. var ObjectExpressionKeysTransformer_1 = __webpack_require__(92);
  3624. var TemplateLiteralTransformer_1 = __webpack_require__(93);
  3625. exports.convertingTransformersModule = new inversify_1.ContainerModule(function (bind) {
  3626. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(MemberExpressionTransformer_1.MemberExpressionTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.MemberExpressionTransformer);
  3627. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(MethodDefinitionTransformer_1.MethodDefinitionTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.MethodDefinitionTransformer);
  3628. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(ObjectExpressionKeysTransformer_1.ObjectExpressionKeysTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.ObjectExpressionKeysTransformer);
  3629. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(TemplateLiteralTransformer_1.TemplateLiteralTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.TemplateLiteralTransformer);
  3630. });
  3631. /***/ }),
  3632. /* 90 */
  3633. /***/ (function(module, exports, __webpack_require__) {
  3634. "use strict";
  3635. var _Object$getPrototypeOf = __webpack_require__(5);
  3636. var _classCallCheck = __webpack_require__(0);
  3637. var _createClass = __webpack_require__(2);
  3638. var _possibleConstructorReturn = __webpack_require__(6);
  3639. var _inherits = __webpack_require__(7);
  3640. Object.defineProperty(exports, "__esModule", {
  3641. value: true
  3642. });
  3643. var tslib_1 = __webpack_require__(4);
  3644. var inversify_1 = __webpack_require__(1);
  3645. var ServiceIdentifiers_1 = __webpack_require__(3);
  3646. var NodeType_1 = __webpack_require__(18);
  3647. var TransformationStage_1 = __webpack_require__(12);
  3648. var AbstractNodeTransformer_1 = __webpack_require__(13);
  3649. var NodeGuards_1 = __webpack_require__(8);
  3650. var MemberExpressionTransformer =
  3651. /*#__PURE__*/
  3652. function (_AbstractNodeTransfor) {
  3653. _inherits(MemberExpressionTransformer, _AbstractNodeTransfor);
  3654. function MemberExpressionTransformer(randomGenerator, options) {
  3655. _classCallCheck(this, MemberExpressionTransformer);
  3656. return _possibleConstructorReturn(this, (MemberExpressionTransformer.__proto__ || _Object$getPrototypeOf(MemberExpressionTransformer)).call(this, randomGenerator, options));
  3657. }
  3658. _createClass(MemberExpressionTransformer, [{
  3659. key: "getVisitor",
  3660. value: function getVisitor(transformationStage) {
  3661. var _this = this;
  3662. switch (transformationStage) {
  3663. case TransformationStage_1.TransformationStage.Converting:
  3664. return {
  3665. enter: function enter(node, parentNode) {
  3666. if (parentNode && NodeGuards_1.NodeGuards.isMemberExpressionNode(node)) {
  3667. return _this.transformNode(node, parentNode);
  3668. }
  3669. }
  3670. };
  3671. default:
  3672. return null;
  3673. }
  3674. }
  3675. }, {
  3676. key: "transformNode",
  3677. value: function transformNode(memberExpressionNode, parentNode) {
  3678. if (NodeGuards_1.NodeGuards.isIdentifierNode(memberExpressionNode.property)) {
  3679. if (memberExpressionNode.computed) {
  3680. return memberExpressionNode;
  3681. }
  3682. memberExpressionNode.computed = true;
  3683. memberExpressionNode.property = {
  3684. type: NodeType_1.NodeType.Literal,
  3685. value: memberExpressionNode.property.name,
  3686. raw: "'".concat(memberExpressionNode.property.name, "'")
  3687. };
  3688. }
  3689. return memberExpressionNode;
  3690. }
  3691. }]);
  3692. return MemberExpressionTransformer;
  3693. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  3694. 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);
  3695. exports.MemberExpressionTransformer = MemberExpressionTransformer;
  3696. /***/ }),
  3697. /* 91 */
  3698. /***/ (function(module, exports, __webpack_require__) {
  3699. "use strict";
  3700. var _Object$getPrototypeOf = __webpack_require__(5);
  3701. var _classCallCheck = __webpack_require__(0);
  3702. var _createClass = __webpack_require__(2);
  3703. var _possibleConstructorReturn = __webpack_require__(6);
  3704. var _inherits = __webpack_require__(7);
  3705. Object.defineProperty(exports, "__esModule", {
  3706. value: true
  3707. });
  3708. var tslib_1 = __webpack_require__(4);
  3709. var inversify_1 = __webpack_require__(1);
  3710. var ServiceIdentifiers_1 = __webpack_require__(3);
  3711. var NodeType_1 = __webpack_require__(18);
  3712. var TransformationStage_1 = __webpack_require__(12);
  3713. var AbstractNodeTransformer_1 = __webpack_require__(13);
  3714. var NodeGuards_1 = __webpack_require__(8);
  3715. var MethodDefinitionTransformer = MethodDefinitionTransformer_1 =
  3716. /*#__PURE__*/
  3717. function (_AbstractNodeTransfor) {
  3718. _inherits(MethodDefinitionTransformer, _AbstractNodeTransfor);
  3719. function MethodDefinitionTransformer(randomGenerator, options) {
  3720. _classCallCheck(this, MethodDefinitionTransformer);
  3721. return _possibleConstructorReturn(this, (MethodDefinitionTransformer.__proto__ || _Object$getPrototypeOf(MethodDefinitionTransformer)).call(this, randomGenerator, options));
  3722. }
  3723. _createClass(MethodDefinitionTransformer, [{
  3724. key: "getVisitor",
  3725. value: function getVisitor(transformationStage) {
  3726. var _this = this;
  3727. switch (transformationStage) {
  3728. case TransformationStage_1.TransformationStage.Converting:
  3729. return {
  3730. enter: function enter(node, parentNode) {
  3731. if (parentNode && NodeGuards_1.NodeGuards.isMethodDefinitionNode(node)) {
  3732. return _this.transformNode(node, parentNode);
  3733. }
  3734. }
  3735. };
  3736. default:
  3737. return null;
  3738. }
  3739. }
  3740. }, {
  3741. key: "transformNode",
  3742. value: function transformNode(methodDefinitionNode, parentNode) {
  3743. if (NodeGuards_1.NodeGuards.isIdentifierNode(methodDefinitionNode.key) && !MethodDefinitionTransformer_1.ignoredNames.includes(methodDefinitionNode.key.name) && methodDefinitionNode.computed === false) {
  3744. methodDefinitionNode.computed = true;
  3745. methodDefinitionNode.key = {
  3746. type: NodeType_1.NodeType.Literal,
  3747. value: methodDefinitionNode.key.name,
  3748. raw: "'".concat(methodDefinitionNode.key.name, "'")
  3749. };
  3750. }
  3751. return methodDefinitionNode;
  3752. }
  3753. }]);
  3754. return MethodDefinitionTransformer;
  3755. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  3756. MethodDefinitionTransformer.ignoredNames = ['constructor'];
  3757. 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);
  3758. exports.MethodDefinitionTransformer = MethodDefinitionTransformer;
  3759. var MethodDefinitionTransformer_1;
  3760. /***/ }),
  3761. /* 92 */
  3762. /***/ (function(module, exports, __webpack_require__) {
  3763. "use strict";
  3764. var _slicedToArray = __webpack_require__(30);
  3765. var _Map = __webpack_require__(16);
  3766. var _Object$getPrototypeOf = __webpack_require__(5);
  3767. var _classCallCheck = __webpack_require__(0);
  3768. var _createClass = __webpack_require__(2);
  3769. var _possibleConstructorReturn = __webpack_require__(6);
  3770. var _inherits = __webpack_require__(7);
  3771. Object.defineProperty(exports, "__esModule", {
  3772. value: true
  3773. });
  3774. var tslib_1 = __webpack_require__(4);
  3775. var inversify_1 = __webpack_require__(1);
  3776. var ServiceIdentifiers_1 = __webpack_require__(3);
  3777. var TransformationStage_1 = __webpack_require__(12);
  3778. var AbstractNodeTransformer_1 = __webpack_require__(13);
  3779. var NodeAppender_1 = __webpack_require__(23);
  3780. var NodeGuards_1 = __webpack_require__(8);
  3781. var Nodes_1 = __webpack_require__(15);
  3782. var NodeUtils_1 = __webpack_require__(9);
  3783. var ObjectExpressionKeysTransformer = ObjectExpressionKeysTransformer_1 =
  3784. /*#__PURE__*/
  3785. function (_AbstractNodeTransfor) {
  3786. _inherits(ObjectExpressionKeysTransformer, _AbstractNodeTransfor);
  3787. function ObjectExpressionKeysTransformer(randomGenerator, options) {
  3788. var _this;
  3789. _classCallCheck(this, ObjectExpressionKeysTransformer);
  3790. _this = _possibleConstructorReturn(this, (ObjectExpressionKeysTransformer.__proto__ || _Object$getPrototypeOf(ObjectExpressionKeysTransformer)).call(this, randomGenerator, options));
  3791. _this.cachedScopeNodesMap = new _Map();
  3792. return _this;
  3793. }
  3794. _createClass(ObjectExpressionKeysTransformer, [{
  3795. key: "getVisitor",
  3796. value: function getVisitor(transformationStage) {
  3797. var _this2 = this;
  3798. switch (transformationStage) {
  3799. case TransformationStage_1.TransformationStage.Converting:
  3800. return {
  3801. enter: function enter(node, parentNode) {
  3802. if (_this2.options.transformObjectKeys && parentNode && NodeGuards_1.NodeGuards.isObjectExpressionNode(node) && NodeGuards_1.NodeGuards.isVariableDeclaratorNode(parentNode)) {
  3803. return _this2.transformNode(node, parentNode);
  3804. }
  3805. }
  3806. };
  3807. default:
  3808. return null;
  3809. }
  3810. }
  3811. }, {
  3812. key: "transformNode",
  3813. value: function transformNode(objectExpressionNode, variableDeclarator) {
  3814. if (!NodeGuards_1.NodeGuards.isIdentifierNode(variableDeclarator.id)) {
  3815. return objectExpressionNode;
  3816. }
  3817. var scopeNode = NodeUtils_1.NodeUtils.getScopeOfNode(variableDeclarator);
  3818. if (!scopeNode || !NodeGuards_1.NodeGuards.isNodeHasScope(scopeNode)) {
  3819. return objectExpressionNode;
  3820. }
  3821. this.cachedScopeNodesMap.set(variableDeclarator, scopeNode);
  3822. return this.transformObjectExpressionNode(objectExpressionNode, variableDeclarator.id, variableDeclarator);
  3823. }
  3824. }, {
  3825. key: "extractPropertiesToExpressionStatements",
  3826. value: function extractPropertiesToExpressionStatements(properties, memberExpressionObject, variableDeclarator) {
  3827. var propertiesLength = properties.length;
  3828. var expressionStatements = [];
  3829. var removablePropertyIds = [];
  3830. for (var i = 0; i < propertiesLength; i++) {
  3831. var property = properties[i];
  3832. var propertyValue = property.value;
  3833. if (!ObjectExpressionKeysTransformer_1.isValidPropertyValueNode(propertyValue)) {
  3834. continue;
  3835. }
  3836. var propertyKeyName = ObjectExpressionKeysTransformer_1.getPropertyNodeKeyName(property);
  3837. if (!propertyKeyName) {
  3838. continue;
  3839. }
  3840. var shouldCreateLiteralNode = !property.computed || property.computed && NodeGuards_1.NodeGuards.isLiteralNode(property.key);
  3841. var memberExpressionProperty = shouldCreateLiteralNode ? Nodes_1.Nodes.getLiteralNode(propertyKeyName) : Nodes_1.Nodes.getIdentifierNode(propertyKeyName);
  3842. var memberExpressionNode = Nodes_1.Nodes.getMemberExpressionNode(memberExpressionObject, memberExpressionProperty, true);
  3843. var expressionStatementNode = Nodes_1.Nodes.getExpressionStatementNode(Nodes_1.Nodes.getAssignmentExpressionNode('=', memberExpressionNode, propertyValue));
  3844. if (NodeGuards_1.NodeGuards.isObjectExpressionNode(property.value)) {
  3845. this.transformObjectExpressionNode(property.value, memberExpressionNode, variableDeclarator);
  3846. }
  3847. expressionStatements.push(expressionStatementNode);
  3848. removablePropertyIds.push(i);
  3849. }
  3850. return [expressionStatements, removablePropertyIds];
  3851. }
  3852. }, {
  3853. key: "transformObjectExpressionNode",
  3854. value: function transformObjectExpressionNode(objectExpressionNode, memberExpressionObjectNode, variableDeclarator) {
  3855. var properties = objectExpressionNode.properties;
  3856. if (!properties.length) {
  3857. return objectExpressionNode;
  3858. }
  3859. var scopeNode = this.cachedScopeNodesMap.get(variableDeclarator);
  3860. if (!scopeNode) {
  3861. return objectExpressionNode;
  3862. }
  3863. var _extractPropertiesToE = this.extractPropertiesToExpressionStatements(properties, memberExpressionObjectNode, variableDeclarator),
  3864. _extractPropertiesToE2 = _slicedToArray(_extractPropertiesToE, 2),
  3865. expressionStatements = _extractPropertiesToE2[0],
  3866. removablePropertyIds = _extractPropertiesToE2[1];
  3867. objectExpressionNode.properties = ObjectExpressionKeysTransformer_1.filterObjectExpressionProperties(properties, removablePropertyIds);
  3868. ObjectExpressionKeysTransformer_1.appendExpressionStatements(scopeNode, expressionStatements, variableDeclarator);
  3869. return objectExpressionNode;
  3870. }
  3871. }], [{
  3872. key: "appendExpressionStatements",
  3873. value: function appendExpressionStatements(scopeNode, expressionStatements, variableDeclarator) {
  3874. var variableDeclaration = variableDeclarator.parentNode;
  3875. if (!variableDeclaration || !NodeGuards_1.NodeGuards.isVariableDeclarationNode(variableDeclaration)) {
  3876. throw new Error('Cannot find variable declaration for variable declarator');
  3877. }
  3878. NodeAppender_1.NodeAppender.insertNodeAfter(scopeNode, expressionStatements, variableDeclaration);
  3879. }
  3880. }, {
  3881. key: "filterObjectExpressionProperties",
  3882. value: function filterObjectExpressionProperties(properties, removablePropertyIds) {
  3883. return properties.filter(function (property, index) {
  3884. return !removablePropertyIds.includes(index);
  3885. });
  3886. }
  3887. }, {
  3888. key: "getPropertyNodeKeyName",
  3889. value: function getPropertyNodeKeyName(propertyNode) {
  3890. var propertyKeyNode = propertyNode.key;
  3891. if (NodeGuards_1.NodeGuards.isLiteralNode(propertyKeyNode) && typeof propertyKeyNode.value === 'string') {
  3892. return propertyKeyNode.value;
  3893. } else if (NodeGuards_1.NodeGuards.isIdentifierNode(propertyKeyNode)) {
  3894. return propertyKeyNode.name;
  3895. }
  3896. return null;
  3897. }
  3898. }, {
  3899. key: "isValidPropertyValueNode",
  3900. value: function isValidPropertyValueNode(propertyValueNode) {
  3901. return !NodeGuards_1.NodeGuards.isObjectPatternNode(propertyValueNode) && !NodeGuards_1.NodeGuards.isArrayPatternNode(propertyValueNode) && !NodeGuards_1.NodeGuards.isAssignmentPatternNode(propertyValueNode) && !NodeGuards_1.NodeGuards.isRestElementNode(propertyValueNode);
  3902. }
  3903. }]);
  3904. return ObjectExpressionKeysTransformer;
  3905. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  3906. 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);
  3907. exports.ObjectExpressionKeysTransformer = ObjectExpressionKeysTransformer;
  3908. var ObjectExpressionKeysTransformer_1;
  3909. /***/ }),
  3910. /* 93 */
  3911. /***/ (function(module, exports, __webpack_require__) {
  3912. "use strict";
  3913. var _toConsumableArray = __webpack_require__(24);
  3914. var _Object$getPrototypeOf = __webpack_require__(5);
  3915. var _classCallCheck = __webpack_require__(0);
  3916. var _createClass = __webpack_require__(2);
  3917. var _possibleConstructorReturn = __webpack_require__(6);
  3918. var _inherits = __webpack_require__(7);
  3919. Object.defineProperty(exports, "__esModule", {
  3920. value: true
  3921. });
  3922. var tslib_1 = __webpack_require__(4);
  3923. var inversify_1 = __webpack_require__(1);
  3924. var ServiceIdentifiers_1 = __webpack_require__(3);
  3925. var estraverse = tslib_1.__importStar(__webpack_require__(17));
  3926. var TransformationStage_1 = __webpack_require__(12);
  3927. var AbstractNodeTransformer_1 = __webpack_require__(13);
  3928. var NodeGuards_1 = __webpack_require__(8);
  3929. var Nodes_1 = __webpack_require__(15);
  3930. var NodeUtils_1 = __webpack_require__(9);
  3931. var TemplateLiteralTransformer = TemplateLiteralTransformer_1 =
  3932. /*#__PURE__*/
  3933. function (_AbstractNodeTransfor) {
  3934. _inherits(TemplateLiteralTransformer, _AbstractNodeTransfor);
  3935. function TemplateLiteralTransformer(randomGenerator, options) {
  3936. _classCallCheck(this, TemplateLiteralTransformer);
  3937. return _possibleConstructorReturn(this, (TemplateLiteralTransformer.__proto__ || _Object$getPrototypeOf(TemplateLiteralTransformer)).call(this, randomGenerator, options));
  3938. }
  3939. _createClass(TemplateLiteralTransformer, [{
  3940. key: "getVisitor",
  3941. value: function getVisitor(transformationStage) {
  3942. var _this = this;
  3943. switch (transformationStage) {
  3944. case TransformationStage_1.TransformationStage.Converting:
  3945. return {
  3946. enter: function enter(node, parentNode) {
  3947. if (parentNode && NodeGuards_1.NodeGuards.isReturnStatementNode(node) && node.argument === null) {
  3948. return _this.fixEsprimaReturnStatementTemplateLiteralNode(node);
  3949. }
  3950. },
  3951. leave: function leave(node, parentNode) {
  3952. if (parentNode && NodeGuards_1.NodeGuards.isTemplateLiteralNode(node)) {
  3953. return _this.transformNode(node, parentNode);
  3954. }
  3955. }
  3956. };
  3957. default:
  3958. return null;
  3959. }
  3960. }
  3961. }, {
  3962. key: "transformNode",
  3963. value: function transformNode(templateLiteralNode, parentNode) {
  3964. var templateLiteralExpressions = templateLiteralNode.expressions;
  3965. var nodes = [];
  3966. templateLiteralNode.quasis.forEach(function (templateElement) {
  3967. nodes.push(Nodes_1.Nodes.getLiteralNode(templateElement.value.cooked));
  3968. var expression = templateLiteralExpressions.shift();
  3969. if (!expression) {
  3970. return;
  3971. }
  3972. nodes.push(expression);
  3973. });
  3974. nodes = nodes.filter(function (node) {
  3975. return !(NodeGuards_1.NodeGuards.isLiteralNode(node) && node.value === '');
  3976. });
  3977. if (!TemplateLiteralTransformer_1.isLiteralNodeWithStringValue(nodes[0]) && !TemplateLiteralTransformer_1.isLiteralNodeWithStringValue(nodes[1])) {
  3978. nodes.unshift(Nodes_1.Nodes.getLiteralNode(''));
  3979. }
  3980. if (nodes.length > 1) {
  3981. var root = Nodes_1.Nodes.getBinaryExpressionNode('+', nodes.shift(), nodes.shift());
  3982. nodes.forEach(function (node) {
  3983. root = Nodes_1.Nodes.getBinaryExpressionNode('+', root, node);
  3984. });
  3985. return root;
  3986. }
  3987. return nodes[0];
  3988. }
  3989. }, {
  3990. key: "fixEsprimaReturnStatementTemplateLiteralNode",
  3991. value: function fixEsprimaReturnStatementTemplateLiteralNode(returnStatementNode) {
  3992. var scopeNode = NodeUtils_1.NodeUtils.getScopeOfNode(returnStatementNode);
  3993. var scopeBody = !NodeGuards_1.NodeGuards.isSwitchCaseNode(scopeNode) ? scopeNode.body : scopeNode.consequent;
  3994. var indexInScope = scopeBody.indexOf(returnStatementNode);
  3995. if (indexInScope !== scopeBody.length - 2) {
  3996. return;
  3997. }
  3998. var nextSiblingStatementNode = scopeBody[indexInScope + 1];
  3999. if (!nextSiblingStatementNode || !NodeGuards_1.NodeGuards.isExpressionStatementNode(nextSiblingStatementNode)) {
  4000. return;
  4001. }
  4002. var isSiblingStatementHasTemplateLiteralNode = false;
  4003. estraverse.traverse(nextSiblingStatementNode, {
  4004. enter: function enter(node, parentNode) {
  4005. if (!NodeGuards_1.NodeGuards.isTemplateLiteralNode(node)) {
  4006. return;
  4007. }
  4008. isSiblingStatementHasTemplateLiteralNode = true;
  4009. return estraverse.VisitorOption.Break;
  4010. }
  4011. });
  4012. if (!isSiblingStatementHasTemplateLiteralNode) {
  4013. return;
  4014. }
  4015. returnStatementNode.argument = nextSiblingStatementNode.expression;
  4016. scopeBody.pop();
  4017. if (!NodeGuards_1.NodeGuards.isSwitchCaseNode(scopeNode)) {
  4018. scopeNode.body = _toConsumableArray(scopeBody);
  4019. } else {
  4020. scopeNode.consequent = _toConsumableArray(scopeBody);
  4021. }
  4022. return returnStatementNode;
  4023. }
  4024. }], [{
  4025. key: "isLiteralNodeWithStringValue",
  4026. value: function isLiteralNodeWithStringValue(node) {
  4027. return node && NodeGuards_1.NodeGuards.isLiteralNode(node) && typeof node.value === 'string';
  4028. }
  4029. }]);
  4030. return TemplateLiteralTransformer;
  4031. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  4032. 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);
  4033. exports.TemplateLiteralTransformer = TemplateLiteralTransformer;
  4034. var TemplateLiteralTransformer_1;
  4035. /***/ }),
  4036. /* 94 */
  4037. /***/ (function(module, exports, __webpack_require__) {
  4038. "use strict";
  4039. Object.defineProperty(exports, "__esModule", {
  4040. value: true
  4041. });
  4042. var InversifyContainerFacade_1 = __webpack_require__(22);
  4043. var inversify_1 = __webpack_require__(1);
  4044. var ServiceIdentifiers_1 = __webpack_require__(3);
  4045. var ControlFlowCustomNode_1 = __webpack_require__(20);
  4046. var CustomNode_1 = __webpack_require__(31);
  4047. var CustomNodeGroup_1 = __webpack_require__(55);
  4048. var DeadCodeInjectionCustomNode_1 = __webpack_require__(54);
  4049. var ConsoleOutputCustomNodeGroup_1 = __webpack_require__(95);
  4050. var DebugProtectionCustomNodeGroup_1 = __webpack_require__(96);
  4051. var DomainLockCustomNodeGroup_1 = __webpack_require__(97);
  4052. var SelfDefendingCustomNodeGroup_1 = __webpack_require__(98);
  4053. var StringArrayCustomNodeGroup_1 = __webpack_require__(99);
  4054. var BinaryExpressionFunctionNode_1 = __webpack_require__(100);
  4055. var BlockStatementControlFlowFlatteningNode_1 = __webpack_require__(103);
  4056. var BlockStatementDeadCodeInjectionNode_1 = __webpack_require__(104);
  4057. var CallExpressionControlFlowStorageCallNode_1 = __webpack_require__(105);
  4058. var CallExpressionFunctionNode_1 = __webpack_require__(106);
  4059. var ControlFlowStorageNode_1 = __webpack_require__(107);
  4060. var ConsoleOutputDisableExpressionNode_1 = __webpack_require__(108);
  4061. var DebugProtectionFunctionCallNode_1 = __webpack_require__(110);
  4062. var DebugProtectionFunctionIntervalNode_1 = __webpack_require__(112);
  4063. var DebugProtectionFunctionNode_1 = __webpack_require__(114);
  4064. var DomainLockNode_1 = __webpack_require__(118);
  4065. var ExpressionWithOperatorControlFlowStorageCallNode_1 = __webpack_require__(120);
  4066. var LogicalExpressionFunctionNode_1 = __webpack_require__(121);
  4067. var NodeCallsControllerFunctionNode_1 = __webpack_require__(122);
  4068. var SelfDefendingUnicodeNode_1 = __webpack_require__(124);
  4069. var StringArrayCallsWrapper_1 = __webpack_require__(126);
  4070. var StringArrayNode_1 = __webpack_require__(133);
  4071. var StringArrayRotateFunctionNode_1 = __webpack_require__(135);
  4072. var StringLiteralControlFlowStorageCallNode_1 = __webpack_require__(139);
  4073. var StringLiteralNode_1 = __webpack_require__(140);
  4074. exports.customNodesModule = new inversify_1.ContainerModule(function (bind) {
  4075. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode).to(ConsoleOutputDisableExpressionNode_1.ConsoleOutputDisableExpressionNode).whenTargetNamed(CustomNode_1.CustomNode.ConsoleOutputDisableExpressionNode);
  4076. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode).to(DebugProtectionFunctionCallNode_1.DebugProtectionFunctionCallNode).whenTargetNamed(CustomNode_1.CustomNode.DebugProtectionFunctionCallNode);
  4077. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode).to(DebugProtectionFunctionIntervalNode_1.DebugProtectionFunctionIntervalNode).whenTargetNamed(CustomNode_1.CustomNode.DebugProtectionFunctionIntervalNode);
  4078. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode).to(DebugProtectionFunctionNode_1.DebugProtectionFunctionNode).whenTargetNamed(CustomNode_1.CustomNode.DebugProtectionFunctionNode);
  4079. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode).to(DomainLockNode_1.DomainLockNode).whenTargetNamed(CustomNode_1.CustomNode.DomainLockNode);
  4080. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode).to(NodeCallsControllerFunctionNode_1.NodeCallsControllerFunctionNode).whenTargetNamed(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode);
  4081. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode).to(SelfDefendingUnicodeNode_1.SelfDefendingUnicodeNode).whenTargetNamed(CustomNode_1.CustomNode.SelfDefendingUnicodeNode);
  4082. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode).to(StringArrayCallsWrapper_1.StringArrayCallsWrapper).whenTargetNamed(CustomNode_1.CustomNode.StringArrayCallsWrapper);
  4083. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode).to(StringArrayNode_1.StringArrayNode).whenTargetNamed(CustomNode_1.CustomNode.StringArrayNode);
  4084. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode).to(StringArrayRotateFunctionNode_1.StringArrayRotateFunctionNode).whenTargetNamed(CustomNode_1.CustomNode.StringArrayRotateFunctionNode);
  4085. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode).toConstructor(BinaryExpressionFunctionNode_1.BinaryExpressionFunctionNode).whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.BinaryExpressionFunctionNode);
  4086. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode).toConstructor(BlockStatementControlFlowFlatteningNode_1.BlockStatementControlFlowFlatteningNode).whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.BlockStatementControlFlowFlatteningNode);
  4087. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode).toConstructor(CallExpressionControlFlowStorageCallNode_1.CallExpressionControlFlowStorageCallNode).whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.CallExpressionControlFlowStorageCallNode);
  4088. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode).toConstructor(CallExpressionFunctionNode_1.CallExpressionFunctionNode).whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.CallExpressionFunctionNode);
  4089. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode).toConstructor(ControlFlowStorageNode_1.ControlFlowStorageNode).whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.ControlFlowStorageNode);
  4090. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode).toConstructor(ExpressionWithOperatorControlFlowStorageCallNode_1.ExpressionWithOperatorControlFlowStorageCallNode).whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.ExpressionWithOperatorControlFlowStorageCallNode);
  4091. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode).toConstructor(LogicalExpressionFunctionNode_1.LogicalExpressionFunctionNode).whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.LogicalExpressionFunctionNode);
  4092. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode).toConstructor(StringLiteralNode_1.StringLiteralNode).whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.StringLiteralNode);
  4093. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode).toConstructor(StringLiteralControlFlowStorageCallNode_1.StringLiteralControlFlowStorageCallNode).whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.StringLiteralControlFlowStorageCallNode);
  4094. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode).toConstructor(BlockStatementDeadCodeInjectionNode_1.BlockStatementDeadCodeInjectionNode).whenTargetNamed(DeadCodeInjectionCustomNode_1.DeadCodeInjectionCustomNode.BlockStatementDeadCodeInjectionNode);
  4095. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeGroup).to(ConsoleOutputCustomNodeGroup_1.ConsoleOutputCustomNodeGroup).whenTargetNamed(CustomNodeGroup_1.CustomNodeGroup.ConsoleOutputCustomNodeGroup);
  4096. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeGroup).to(DebugProtectionCustomNodeGroup_1.DebugProtectionCustomNodeGroup).whenTargetNamed(CustomNodeGroup_1.CustomNodeGroup.DebugProtectionCustomNodeGroup);
  4097. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeGroup).to(DomainLockCustomNodeGroup_1.DomainLockCustomNodeGroup).whenTargetNamed(CustomNodeGroup_1.CustomNodeGroup.DomainLockCustomNodeGroup);
  4098. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeGroup).to(SelfDefendingCustomNodeGroup_1.SelfDefendingCustomNodeGroup).whenTargetNamed(CustomNodeGroup_1.CustomNodeGroup.SelfDefendingCustomNodeGroup);
  4099. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeGroup).to(StringArrayCustomNodeGroup_1.StringArrayCustomNodeGroup).whenTargetNamed(CustomNodeGroup_1.CustomNodeGroup.StringArrayCustomNodeGroup);
  4100. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICustomNode).toFactory(InversifyContainerFacade_1.InversifyContainerFacade.getFactory(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode));
  4101. 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));
  4102. 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));
  4103. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICustomNodeGroup).toFactory(InversifyContainerFacade_1.InversifyContainerFacade.getFactory(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeGroup));
  4104. });
  4105. /***/ }),
  4106. /* 95 */
  4107. /***/ (function(module, exports, __webpack_require__) {
  4108. "use strict";
  4109. var _Map = __webpack_require__(16);
  4110. var _Object$getPrototypeOf = __webpack_require__(5);
  4111. var _classCallCheck = __webpack_require__(0);
  4112. var _createClass = __webpack_require__(2);
  4113. var _possibleConstructorReturn = __webpack_require__(6);
  4114. var _inherits = __webpack_require__(7);
  4115. Object.defineProperty(exports, "__esModule", {
  4116. value: true
  4117. });
  4118. var tslib_1 = __webpack_require__(4);
  4119. var inversify_1 = __webpack_require__(1);
  4120. var ServiceIdentifiers_1 = __webpack_require__(3);
  4121. var Initializable_1 = __webpack_require__(10);
  4122. var CustomNode_1 = __webpack_require__(31);
  4123. var ObfuscationEvent_1 = __webpack_require__(25);
  4124. var AbstractCustomNodeGroup_1 = __webpack_require__(34);
  4125. var NodeAppender_1 = __webpack_require__(23);
  4126. var ConsoleOutputCustomNodeGroup =
  4127. /*#__PURE__*/
  4128. function (_AbstractCustomNodeGr) {
  4129. _inherits(ConsoleOutputCustomNodeGroup, _AbstractCustomNodeGr);
  4130. function ConsoleOutputCustomNodeGroup(customNodeFactory, identifierNamesGeneratorFactory, randomGenerator, options) {
  4131. var _this;
  4132. _classCallCheck(this, ConsoleOutputCustomNodeGroup);
  4133. _this = _possibleConstructorReturn(this, (ConsoleOutputCustomNodeGroup.__proto__ || _Object$getPrototypeOf(ConsoleOutputCustomNodeGroup)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  4134. _this.appendEvent = ObfuscationEvent_1.ObfuscationEvent.BeforeObfuscation;
  4135. _this.customNodeFactory = customNodeFactory;
  4136. return _this;
  4137. }
  4138. _createClass(ConsoleOutputCustomNodeGroup, [{
  4139. key: "appendCustomNodes",
  4140. value: function appendCustomNodes(blockScopeNode, stackTraceData) {
  4141. var randomStackTraceIndex = this.getRandomStackTraceIndex(stackTraceData.length);
  4142. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.ConsoleOutputDisableExpressionNode, function (customNode) {
  4143. NodeAppender_1.NodeAppender.appendNodeToOptimalBlockScope(stackTraceData, blockScopeNode, customNode.getNode(), randomStackTraceIndex);
  4144. });
  4145. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode, function (customNode) {
  4146. var targetBlockScope;
  4147. if (stackTraceData.length) {
  4148. targetBlockScope = NodeAppender_1.NodeAppender.getOptimalBlockScope(stackTraceData, randomStackTraceIndex, 1);
  4149. } else {
  4150. targetBlockScope = blockScopeNode;
  4151. }
  4152. NodeAppender_1.NodeAppender.prependNode(targetBlockScope, customNode.getNode());
  4153. });
  4154. }
  4155. }, {
  4156. key: "initialize",
  4157. value: function initialize() {
  4158. this.customNodes = new _Map();
  4159. if (!this.options.disableConsoleOutput) {
  4160. return;
  4161. }
  4162. var callsControllerFunctionName = this.identifierNamesGenerator.generate();
  4163. var consoleOutputDisableExpressionNode = this.customNodeFactory(CustomNode_1.CustomNode.ConsoleOutputDisableExpressionNode);
  4164. var nodeCallsControllerFunctionNode = this.customNodeFactory(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode);
  4165. consoleOutputDisableExpressionNode.initialize(callsControllerFunctionName);
  4166. nodeCallsControllerFunctionNode.initialize(this.appendEvent, callsControllerFunctionName);
  4167. this.customNodes.set(CustomNode_1.CustomNode.ConsoleOutputDisableExpressionNode, consoleOutputDisableExpressionNode);
  4168. this.customNodes.set(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode, nodeCallsControllerFunctionNode);
  4169. }
  4170. }]);
  4171. return ConsoleOutputCustomNodeGroup;
  4172. }(AbstractCustomNodeGroup_1.AbstractCustomNodeGroup);
  4173. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", _Map)], ConsoleOutputCustomNodeGroup.prototype, "customNodes", void 0);
  4174. 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);
  4175. exports.ConsoleOutputCustomNodeGroup = ConsoleOutputCustomNodeGroup;
  4176. /***/ }),
  4177. /* 96 */
  4178. /***/ (function(module, exports, __webpack_require__) {
  4179. "use strict";
  4180. var _Map = __webpack_require__(16);
  4181. var _Object$getPrototypeOf = __webpack_require__(5);
  4182. var _classCallCheck = __webpack_require__(0);
  4183. var _createClass = __webpack_require__(2);
  4184. var _possibleConstructorReturn = __webpack_require__(6);
  4185. var _inherits = __webpack_require__(7);
  4186. Object.defineProperty(exports, "__esModule", {
  4187. value: true
  4188. });
  4189. var tslib_1 = __webpack_require__(4);
  4190. var inversify_1 = __webpack_require__(1);
  4191. var ServiceIdentifiers_1 = __webpack_require__(3);
  4192. var Initializable_1 = __webpack_require__(10);
  4193. var CustomNode_1 = __webpack_require__(31);
  4194. var ObfuscationEvent_1 = __webpack_require__(25);
  4195. var AbstractCustomNodeGroup_1 = __webpack_require__(34);
  4196. var NodeAppender_1 = __webpack_require__(23);
  4197. var DebugProtectionCustomNodeGroup =
  4198. /*#__PURE__*/
  4199. function (_AbstractCustomNodeGr) {
  4200. _inherits(DebugProtectionCustomNodeGroup, _AbstractCustomNodeGr);
  4201. function DebugProtectionCustomNodeGroup(customNodeFactory, identifierNamesGeneratorFactory, randomGenerator, options) {
  4202. var _this;
  4203. _classCallCheck(this, DebugProtectionCustomNodeGroup);
  4204. _this = _possibleConstructorReturn(this, (DebugProtectionCustomNodeGroup.__proto__ || _Object$getPrototypeOf(DebugProtectionCustomNodeGroup)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  4205. _this.appendEvent = ObfuscationEvent_1.ObfuscationEvent.BeforeObfuscation;
  4206. _this.customNodeFactory = customNodeFactory;
  4207. return _this;
  4208. }
  4209. _createClass(DebugProtectionCustomNodeGroup, [{
  4210. key: "appendCustomNodes",
  4211. value: function appendCustomNodes(blockScopeNode, stackTraceData) {
  4212. var _this2 = this;
  4213. var randomStackTraceIndex = this.getRandomStackTraceIndex(stackTraceData.length);
  4214. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.DebugProtectionFunctionCallNode, function (customNode) {
  4215. NodeAppender_1.NodeAppender.appendNodeToOptimalBlockScope(stackTraceData, blockScopeNode, customNode.getNode(), randomStackTraceIndex);
  4216. });
  4217. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.DebugProtectionFunctionNode, function (customNode) {
  4218. NodeAppender_1.NodeAppender.appendNode(blockScopeNode, customNode.getNode());
  4219. });
  4220. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.DebugProtectionFunctionIntervalNode, function (customNode) {
  4221. var programBodyLength = blockScopeNode.body.length;
  4222. var randomIndex = _this2.randomGenerator.getRandomInteger(0, programBodyLength);
  4223. NodeAppender_1.NodeAppender.insertNodeAtIndex(blockScopeNode, customNode.getNode(), randomIndex);
  4224. });
  4225. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode, function (customNode) {
  4226. var targetBlockScope;
  4227. if (stackTraceData.length) {
  4228. targetBlockScope = NodeAppender_1.NodeAppender.getOptimalBlockScope(stackTraceData, randomStackTraceIndex, 1);
  4229. } else {
  4230. targetBlockScope = blockScopeNode;
  4231. }
  4232. NodeAppender_1.NodeAppender.prependNode(targetBlockScope, customNode.getNode());
  4233. });
  4234. }
  4235. }, {
  4236. key: "initialize",
  4237. value: function initialize() {
  4238. this.customNodes = new _Map();
  4239. if (!this.options.debugProtection) {
  4240. return;
  4241. }
  4242. var debugProtectionFunctionName = this.identifierNamesGenerator.generate();
  4243. var callsControllerFunctionName = this.identifierNamesGenerator.generate();
  4244. var debugProtectionFunctionNode = this.customNodeFactory(CustomNode_1.CustomNode.DebugProtectionFunctionNode);
  4245. var debugProtectionFunctionCallNode = this.customNodeFactory(CustomNode_1.CustomNode.DebugProtectionFunctionCallNode);
  4246. var debugProtectionFunctionIntervalNode = this.customNodeFactory(CustomNode_1.CustomNode.DebugProtectionFunctionIntervalNode);
  4247. var nodeCallsControllerFunctionNode = this.customNodeFactory(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode);
  4248. debugProtectionFunctionNode.initialize(debugProtectionFunctionName);
  4249. debugProtectionFunctionCallNode.initialize(debugProtectionFunctionName, callsControllerFunctionName);
  4250. debugProtectionFunctionIntervalNode.initialize(debugProtectionFunctionName);
  4251. nodeCallsControllerFunctionNode.initialize(this.appendEvent, callsControllerFunctionName);
  4252. this.customNodes.set(CustomNode_1.CustomNode.DebugProtectionFunctionNode, debugProtectionFunctionNode);
  4253. this.customNodes.set(CustomNode_1.CustomNode.DebugProtectionFunctionCallNode, debugProtectionFunctionCallNode);
  4254. if (this.options.debugProtectionInterval) {
  4255. this.customNodes.set(CustomNode_1.CustomNode.DebugProtectionFunctionIntervalNode, debugProtectionFunctionIntervalNode);
  4256. }
  4257. this.customNodes.set(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode, nodeCallsControllerFunctionNode);
  4258. }
  4259. }]);
  4260. return DebugProtectionCustomNodeGroup;
  4261. }(AbstractCustomNodeGroup_1.AbstractCustomNodeGroup);
  4262. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", _Map)], DebugProtectionCustomNodeGroup.prototype, "customNodes", void 0);
  4263. 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);
  4264. exports.DebugProtectionCustomNodeGroup = DebugProtectionCustomNodeGroup;
  4265. /***/ }),
  4266. /* 97 */
  4267. /***/ (function(module, exports, __webpack_require__) {
  4268. "use strict";
  4269. var _Map = __webpack_require__(16);
  4270. var _Object$getPrototypeOf = __webpack_require__(5);
  4271. var _classCallCheck = __webpack_require__(0);
  4272. var _createClass = __webpack_require__(2);
  4273. var _possibleConstructorReturn = __webpack_require__(6);
  4274. var _inherits = __webpack_require__(7);
  4275. Object.defineProperty(exports, "__esModule", {
  4276. value: true
  4277. });
  4278. var tslib_1 = __webpack_require__(4);
  4279. var inversify_1 = __webpack_require__(1);
  4280. var ServiceIdentifiers_1 = __webpack_require__(3);
  4281. var Initializable_1 = __webpack_require__(10);
  4282. var CustomNode_1 = __webpack_require__(31);
  4283. var ObfuscationEvent_1 = __webpack_require__(25);
  4284. var AbstractCustomNodeGroup_1 = __webpack_require__(34);
  4285. var NodeAppender_1 = __webpack_require__(23);
  4286. var DomainLockCustomNodeGroup =
  4287. /*#__PURE__*/
  4288. function (_AbstractCustomNodeGr) {
  4289. _inherits(DomainLockCustomNodeGroup, _AbstractCustomNodeGr);
  4290. function DomainLockCustomNodeGroup(customNodeFactory, identifierNamesGeneratorFactory, randomGenerator, options) {
  4291. var _this;
  4292. _classCallCheck(this, DomainLockCustomNodeGroup);
  4293. _this = _possibleConstructorReturn(this, (DomainLockCustomNodeGroup.__proto__ || _Object$getPrototypeOf(DomainLockCustomNodeGroup)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  4294. _this.appendEvent = ObfuscationEvent_1.ObfuscationEvent.BeforeObfuscation;
  4295. _this.customNodeFactory = customNodeFactory;
  4296. return _this;
  4297. }
  4298. _createClass(DomainLockCustomNodeGroup, [{
  4299. key: "appendCustomNodes",
  4300. value: function appendCustomNodes(blockScopeNode, stackTraceData) {
  4301. var randomStackTraceIndex = this.getRandomStackTraceIndex(stackTraceData.length);
  4302. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.DomainLockNode, function (customNode) {
  4303. NodeAppender_1.NodeAppender.appendNodeToOptimalBlockScope(stackTraceData, blockScopeNode, customNode.getNode(), randomStackTraceIndex);
  4304. });
  4305. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode, function (customNode) {
  4306. var targetBlockScope;
  4307. if (stackTraceData.length) {
  4308. targetBlockScope = NodeAppender_1.NodeAppender.getOptimalBlockScope(stackTraceData, randomStackTraceIndex, 1);
  4309. } else {
  4310. targetBlockScope = blockScopeNode;
  4311. }
  4312. NodeAppender_1.NodeAppender.prependNode(targetBlockScope, customNode.getNode());
  4313. });
  4314. }
  4315. }, {
  4316. key: "initialize",
  4317. value: function initialize() {
  4318. this.customNodes = new _Map();
  4319. if (!this.options.domainLock.length) {
  4320. return;
  4321. }
  4322. var callsControllerFunctionName = this.identifierNamesGenerator.generate();
  4323. var domainLockNode = this.customNodeFactory(CustomNode_1.CustomNode.DomainLockNode);
  4324. var nodeCallsControllerFunctionNode = this.customNodeFactory(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode);
  4325. domainLockNode.initialize(callsControllerFunctionName);
  4326. nodeCallsControllerFunctionNode.initialize(this.appendEvent, callsControllerFunctionName);
  4327. this.customNodes.set(CustomNode_1.CustomNode.DomainLockNode, domainLockNode);
  4328. this.customNodes.set(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode, nodeCallsControllerFunctionNode);
  4329. }
  4330. }]);
  4331. return DomainLockCustomNodeGroup;
  4332. }(AbstractCustomNodeGroup_1.AbstractCustomNodeGroup);
  4333. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", _Map)], DomainLockCustomNodeGroup.prototype, "customNodes", void 0);
  4334. 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);
  4335. exports.DomainLockCustomNodeGroup = DomainLockCustomNodeGroup;
  4336. /***/ }),
  4337. /* 98 */
  4338. /***/ (function(module, exports, __webpack_require__) {
  4339. "use strict";
  4340. var _Map = __webpack_require__(16);
  4341. var _Object$getPrototypeOf = __webpack_require__(5);
  4342. var _classCallCheck = __webpack_require__(0);
  4343. var _createClass = __webpack_require__(2);
  4344. var _possibleConstructorReturn = __webpack_require__(6);
  4345. var _inherits = __webpack_require__(7);
  4346. Object.defineProperty(exports, "__esModule", {
  4347. value: true
  4348. });
  4349. var tslib_1 = __webpack_require__(4);
  4350. var inversify_1 = __webpack_require__(1);
  4351. var ServiceIdentifiers_1 = __webpack_require__(3);
  4352. var Initializable_1 = __webpack_require__(10);
  4353. var CustomNode_1 = __webpack_require__(31);
  4354. var ObfuscationEvent_1 = __webpack_require__(25);
  4355. var AbstractCustomNodeGroup_1 = __webpack_require__(34);
  4356. var NodeAppender_1 = __webpack_require__(23);
  4357. var SelfDefendingCustomNodeGroup =
  4358. /*#__PURE__*/
  4359. function (_AbstractCustomNodeGr) {
  4360. _inherits(SelfDefendingCustomNodeGroup, _AbstractCustomNodeGr);
  4361. function SelfDefendingCustomNodeGroup(customNodeFactory, identifierNamesGeneratorFactory, randomGenerator, options) {
  4362. var _this;
  4363. _classCallCheck(this, SelfDefendingCustomNodeGroup);
  4364. _this = _possibleConstructorReturn(this, (SelfDefendingCustomNodeGroup.__proto__ || _Object$getPrototypeOf(SelfDefendingCustomNodeGroup)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  4365. _this.appendEvent = ObfuscationEvent_1.ObfuscationEvent.AfterObfuscation;
  4366. _this.customNodeFactory = customNodeFactory;
  4367. return _this;
  4368. }
  4369. _createClass(SelfDefendingCustomNodeGroup, [{
  4370. key: "appendCustomNodes",
  4371. value: function appendCustomNodes(blockScopeNode, stackTraceData) {
  4372. var randomStackTraceIndex = this.getRandomStackTraceIndex(stackTraceData.length);
  4373. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.SelfDefendingUnicodeNode, function (customNode) {
  4374. NodeAppender_1.NodeAppender.appendNodeToOptimalBlockScope(stackTraceData, blockScopeNode, customNode.getNode(), randomStackTraceIndex);
  4375. });
  4376. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode, function (customNode) {
  4377. var targetBlockScope;
  4378. if (stackTraceData.length) {
  4379. targetBlockScope = NodeAppender_1.NodeAppender.getOptimalBlockScope(stackTraceData, randomStackTraceIndex, 1);
  4380. } else {
  4381. targetBlockScope = blockScopeNode;
  4382. }
  4383. NodeAppender_1.NodeAppender.prependNode(targetBlockScope, customNode.getNode());
  4384. });
  4385. }
  4386. }, {
  4387. key: "initialize",
  4388. value: function initialize() {
  4389. this.customNodes = new _Map();
  4390. if (!this.options.selfDefending) {
  4391. return;
  4392. }
  4393. var callsControllerFunctionName = this.identifierNamesGenerator.generate();
  4394. var selfDefendingUnicodeNode = this.customNodeFactory(CustomNode_1.CustomNode.SelfDefendingUnicodeNode);
  4395. var nodeCallsControllerFunctionNode = this.customNodeFactory(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode);
  4396. selfDefendingUnicodeNode.initialize(callsControllerFunctionName);
  4397. nodeCallsControllerFunctionNode.initialize(this.appendEvent, callsControllerFunctionName);
  4398. this.customNodes.set(CustomNode_1.CustomNode.SelfDefendingUnicodeNode, selfDefendingUnicodeNode);
  4399. this.customNodes.set(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode, nodeCallsControllerFunctionNode);
  4400. }
  4401. }]);
  4402. return SelfDefendingCustomNodeGroup;
  4403. }(AbstractCustomNodeGroup_1.AbstractCustomNodeGroup);
  4404. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", _Map)], SelfDefendingCustomNodeGroup.prototype, "customNodes", void 0);
  4405. 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);
  4406. exports.SelfDefendingCustomNodeGroup = SelfDefendingCustomNodeGroup;
  4407. /***/ }),
  4408. /* 99 */
  4409. /***/ (function(module, exports, __webpack_require__) {
  4410. "use strict";
  4411. var _slicedToArray = __webpack_require__(30);
  4412. var _Map = __webpack_require__(16);
  4413. var _Object$getPrototypeOf = __webpack_require__(5);
  4414. var _classCallCheck = __webpack_require__(0);
  4415. var _createClass = __webpack_require__(2);
  4416. var _possibleConstructorReturn = __webpack_require__(6);
  4417. var _inherits = __webpack_require__(7);
  4418. Object.defineProperty(exports, "__esModule", {
  4419. value: true
  4420. });
  4421. var tslib_1 = __webpack_require__(4);
  4422. var inversify_1 = __webpack_require__(1);
  4423. var ServiceIdentifiers_1 = __webpack_require__(3);
  4424. var Initializable_1 = __webpack_require__(10);
  4425. var CustomNode_1 = __webpack_require__(31);
  4426. var ObfuscationEvent_1 = __webpack_require__(25);
  4427. var AbstractCustomNodeGroup_1 = __webpack_require__(34);
  4428. var NodeAppender_1 = __webpack_require__(23);
  4429. var StringArrayCustomNodeGroup =
  4430. /*#__PURE__*/
  4431. function (_AbstractCustomNodeGr) {
  4432. _inherits(StringArrayCustomNodeGroup, _AbstractCustomNodeGr);
  4433. function StringArrayCustomNodeGroup(customNodeFactory, stringArrayStorage, identifierNamesGeneratorFactory, randomGenerator, options) {
  4434. var _this;
  4435. _classCallCheck(this, StringArrayCustomNodeGroup);
  4436. _this = _possibleConstructorReturn(this, (StringArrayCustomNodeGroup.__proto__ || _Object$getPrototypeOf(StringArrayCustomNodeGroup)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  4437. _this.appendEvent = ObfuscationEvent_1.ObfuscationEvent.AfterObfuscation;
  4438. _this.customNodeFactory = customNodeFactory;
  4439. _this.stringArrayStorage = stringArrayStorage;
  4440. return _this;
  4441. }
  4442. _createClass(StringArrayCustomNodeGroup, [{
  4443. key: "appendCustomNodes",
  4444. value: function appendCustomNodes(blockScopeNode, stackTraceData) {
  4445. if (!this.stringArrayStorage.getLength()) {
  4446. return;
  4447. }
  4448. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.StringArrayNode, function (customNode) {
  4449. NodeAppender_1.NodeAppender.prependNode(blockScopeNode, customNode.getNode());
  4450. });
  4451. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.StringArrayCallsWrapper, function (customNode) {
  4452. NodeAppender_1.NodeAppender.insertNodeAtIndex(blockScopeNode, customNode.getNode(), 1);
  4453. });
  4454. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.StringArrayRotateFunctionNode, function (customNode) {
  4455. NodeAppender_1.NodeAppender.insertNodeAtIndex(blockScopeNode, customNode.getNode(), 1);
  4456. });
  4457. }
  4458. }, {
  4459. key: "initialize",
  4460. value: function initialize() {
  4461. this.customNodes = new _Map();
  4462. if (!this.options.stringArray) {
  4463. return;
  4464. }
  4465. var stringArrayNode = this.customNodeFactory(CustomNode_1.CustomNode.StringArrayNode);
  4466. var stringArrayCallsWrapper = this.customNodeFactory(CustomNode_1.CustomNode.StringArrayCallsWrapper);
  4467. var stringArrayRotateFunctionNode = this.customNodeFactory(CustomNode_1.CustomNode.StringArrayRotateFunctionNode);
  4468. var stringArrayStorageId = this.stringArrayStorage.getStorageId();
  4469. var _stringArrayStorageId = stringArrayStorageId.split('|'),
  4470. _stringArrayStorageId2 = _slicedToArray(_stringArrayStorageId, 2),
  4471. stringArrayName = _stringArrayStorageId2[0],
  4472. stringArrayCallsWrapperName = _stringArrayStorageId2[1];
  4473. var stringArrayRotateValue;
  4474. if (this.options.rotateStringArray) {
  4475. stringArrayRotateValue = this.randomGenerator.getRandomInteger(100, 500);
  4476. } else {
  4477. stringArrayRotateValue = 0;
  4478. }
  4479. stringArrayNode.initialize(this.stringArrayStorage, stringArrayName, stringArrayRotateValue);
  4480. stringArrayCallsWrapper.initialize(stringArrayName, stringArrayCallsWrapperName);
  4481. stringArrayRotateFunctionNode.initialize(stringArrayName, stringArrayRotateValue);
  4482. this.customNodes.set(CustomNode_1.CustomNode.StringArrayNode, stringArrayNode);
  4483. this.customNodes.set(CustomNode_1.CustomNode.StringArrayCallsWrapper, stringArrayCallsWrapper);
  4484. if (this.options.rotateStringArray) {
  4485. this.customNodes.set(CustomNode_1.CustomNode.StringArrayRotateFunctionNode, stringArrayRotateFunctionNode);
  4486. }
  4487. }
  4488. }]);
  4489. return StringArrayCustomNodeGroup;
  4490. }(AbstractCustomNodeGroup_1.AbstractCustomNodeGroup);
  4491. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", _Map)], StringArrayCustomNodeGroup.prototype, "customNodes", void 0);
  4492. 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);
  4493. exports.StringArrayCustomNodeGroup = StringArrayCustomNodeGroup;
  4494. /***/ }),
  4495. /* 100 */
  4496. /***/ (function(module, exports, __webpack_require__) {
  4497. "use strict";
  4498. var _Object$getPrototypeOf = __webpack_require__(5);
  4499. var _classCallCheck = __webpack_require__(0);
  4500. var _createClass = __webpack_require__(2);
  4501. var _possibleConstructorReturn = __webpack_require__(6);
  4502. var _inherits = __webpack_require__(7);
  4503. Object.defineProperty(exports, "__esModule", {
  4504. value: true
  4505. });
  4506. var tslib_1 = __webpack_require__(4);
  4507. var inversify_1 = __webpack_require__(1);
  4508. var ServiceIdentifiers_1 = __webpack_require__(3);
  4509. var Initializable_1 = __webpack_require__(10);
  4510. var AbstractCustomNode_1 = __webpack_require__(14);
  4511. var Nodes_1 = __webpack_require__(15);
  4512. var NodeUtils_1 = __webpack_require__(9);
  4513. var BinaryExpressionFunctionNode =
  4514. /*#__PURE__*/
  4515. function (_AbstractCustomNode_) {
  4516. _inherits(BinaryExpressionFunctionNode, _AbstractCustomNode_);
  4517. function BinaryExpressionFunctionNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  4518. _classCallCheck(this, BinaryExpressionFunctionNode);
  4519. return _possibleConstructorReturn(this, (BinaryExpressionFunctionNode.__proto__ || _Object$getPrototypeOf(BinaryExpressionFunctionNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  4520. }
  4521. _createClass(BinaryExpressionFunctionNode, [{
  4522. key: "initialize",
  4523. value: function initialize(operator) {
  4524. this.operator = operator;
  4525. }
  4526. }, {
  4527. key: "getNodeStructure",
  4528. value: function getNodeStructure() {
  4529. var structure = Nodes_1.Nodes.getExpressionStatementNode(Nodes_1.Nodes.getFunctionExpressionNode([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')))])));
  4530. NodeUtils_1.NodeUtils.parentize(structure);
  4531. return [structure];
  4532. }
  4533. }]);
  4534. return BinaryExpressionFunctionNode;
  4535. }(AbstractCustomNode_1.AbstractCustomNode);
  4536. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], BinaryExpressionFunctionNode.prototype, "operator", void 0);
  4537. 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);
  4538. exports.BinaryExpressionFunctionNode = BinaryExpressionFunctionNode;
  4539. /***/ }),
  4540. /* 101 */
  4541. /***/ (function(module, exports, __webpack_require__) {
  4542. "use strict";
  4543. Object.defineProperty(exports, "__esModule", {
  4544. value: true
  4545. });
  4546. function GlobalVariableTemplate1() {
  4547. 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 ";
  4548. }
  4549. exports.GlobalVariableTemplate1 = GlobalVariableTemplate1;
  4550. /***/ }),
  4551. /* 102 */
  4552. /***/ (function(module, exports, __webpack_require__) {
  4553. "use strict";
  4554. Object.defineProperty(exports, "__esModule", {
  4555. value: true
  4556. });
  4557. function GlobalVariableTemplate2() {
  4558. 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 ";
  4559. }
  4560. exports.GlobalVariableTemplate2 = GlobalVariableTemplate2;
  4561. /***/ }),
  4562. /* 103 */
  4563. /***/ (function(module, exports, __webpack_require__) {
  4564. "use strict";
  4565. var _Object$getPrototypeOf = __webpack_require__(5);
  4566. var _classCallCheck = __webpack_require__(0);
  4567. var _createClass = __webpack_require__(2);
  4568. var _possibleConstructorReturn = __webpack_require__(6);
  4569. var _inherits = __webpack_require__(7);
  4570. Object.defineProperty(exports, "__esModule", {
  4571. value: true
  4572. });
  4573. var tslib_1 = __webpack_require__(4);
  4574. var inversify_1 = __webpack_require__(1);
  4575. var ServiceIdentifiers_1 = __webpack_require__(3);
  4576. var Initializable_1 = __webpack_require__(10);
  4577. var AbstractCustomNode_1 = __webpack_require__(14);
  4578. var NodeGuards_1 = __webpack_require__(8);
  4579. var Nodes_1 = __webpack_require__(15);
  4580. var NodeUtils_1 = __webpack_require__(9);
  4581. var BlockStatementControlFlowFlatteningNode =
  4582. /*#__PURE__*/
  4583. function (_AbstractCustomNode_) {
  4584. _inherits(BlockStatementControlFlowFlatteningNode, _AbstractCustomNode_);
  4585. function BlockStatementControlFlowFlatteningNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  4586. _classCallCheck(this, BlockStatementControlFlowFlatteningNode);
  4587. return _possibleConstructorReturn(this, (BlockStatementControlFlowFlatteningNode.__proto__ || _Object$getPrototypeOf(BlockStatementControlFlowFlatteningNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  4588. }
  4589. _createClass(BlockStatementControlFlowFlatteningNode, [{
  4590. key: "initialize",
  4591. value: function initialize(blockStatementBody, shuffledKeys, originalKeysIndexesInShuffledArray) {
  4592. this.blockStatementBody = blockStatementBody;
  4593. this.shuffledKeys = shuffledKeys;
  4594. this.originalKeysIndexesInShuffledArray = originalKeysIndexesInShuffledArray;
  4595. }
  4596. }, {
  4597. key: "getNodeStructure",
  4598. value: function getNodeStructure() {
  4599. var _this = this;
  4600. var controllerIdentifierName = this.randomGenerator.getRandomString(6);
  4601. var indexIdentifierName = this.randomGenerator.getRandomString(6);
  4602. 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) {
  4603. var statement = _this.blockStatementBody[key];
  4604. var consequent = [statement];
  4605. if (!NodeGuards_1.NodeGuards.isReturnStatementNode(statement)) {
  4606. consequent.push(Nodes_1.Nodes.getContinueStatement());
  4607. }
  4608. return Nodes_1.Nodes.getSwitchCaseNode(Nodes_1.Nodes.getLiteralNode(String(index)), consequent);
  4609. })), Nodes_1.Nodes.getBreakStatement()]))]);
  4610. NodeUtils_1.NodeUtils.parentize(structure);
  4611. return [structure];
  4612. }
  4613. }]);
  4614. return BlockStatementControlFlowFlatteningNode;
  4615. }(AbstractCustomNode_1.AbstractCustomNode);
  4616. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Array)], BlockStatementControlFlowFlatteningNode.prototype, "blockStatementBody", void 0);
  4617. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Array)], BlockStatementControlFlowFlatteningNode.prototype, "originalKeysIndexesInShuffledArray", void 0);
  4618. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Array)], BlockStatementControlFlowFlatteningNode.prototype, "shuffledKeys", void 0);
  4619. 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);
  4620. exports.BlockStatementControlFlowFlatteningNode = BlockStatementControlFlowFlatteningNode;
  4621. /***/ }),
  4622. /* 104 */
  4623. /***/ (function(module, exports, __webpack_require__) {
  4624. "use strict";
  4625. var _slicedToArray = __webpack_require__(30);
  4626. var _Object$getPrototypeOf = __webpack_require__(5);
  4627. var _classCallCheck = __webpack_require__(0);
  4628. var _createClass = __webpack_require__(2);
  4629. var _possibleConstructorReturn = __webpack_require__(6);
  4630. var _inherits = __webpack_require__(7);
  4631. Object.defineProperty(exports, "__esModule", {
  4632. value: true
  4633. });
  4634. var tslib_1 = __webpack_require__(4);
  4635. var inversify_1 = __webpack_require__(1);
  4636. var ServiceIdentifiers_1 = __webpack_require__(3);
  4637. var Initializable_1 = __webpack_require__(10);
  4638. var AbstractCustomNode_1 = __webpack_require__(14);
  4639. var Nodes_1 = __webpack_require__(15);
  4640. var NodeUtils_1 = __webpack_require__(9);
  4641. var BlockStatementDeadCodeInjectionNode =
  4642. /*#__PURE__*/
  4643. function (_AbstractCustomNode_) {
  4644. _inherits(BlockStatementDeadCodeInjectionNode, _AbstractCustomNode_);
  4645. function BlockStatementDeadCodeInjectionNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  4646. _classCallCheck(this, BlockStatementDeadCodeInjectionNode);
  4647. return _possibleConstructorReturn(this, (BlockStatementDeadCodeInjectionNode.__proto__ || _Object$getPrototypeOf(BlockStatementDeadCodeInjectionNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  4648. }
  4649. _createClass(BlockStatementDeadCodeInjectionNode, [{
  4650. key: "initialize",
  4651. value: function initialize(blockStatementNode, deadCodeInjectionRootAstHostNode) {
  4652. this.blockStatementNode = blockStatementNode;
  4653. this.deadCodeInjectionRootAstHostNode = deadCodeInjectionRootAstHostNode;
  4654. }
  4655. }, {
  4656. key: "getNodeStructure",
  4657. value: function getNodeStructure() {
  4658. var random1 = this.randomGenerator.getMathRandom() > 0.5;
  4659. var random2 = this.randomGenerator.getMathRandom() > 0.5;
  4660. var operator = random1 ? '===' : '!==';
  4661. var leftString = this.randomGenerator.getRandomString(5);
  4662. var rightString = random2 ? leftString : this.randomGenerator.getRandomString(5);
  4663. var _ref = random1 === random2 ? [this.blockStatementNode, this.deadCodeInjectionRootAstHostNode] : [this.deadCodeInjectionRootAstHostNode, this.blockStatementNode],
  4664. _ref2 = _slicedToArray(_ref, 2),
  4665. consequent = _ref2[0],
  4666. alternate = _ref2[1];
  4667. 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)]);
  4668. NodeUtils_1.NodeUtils.parentize(structure);
  4669. return [structure];
  4670. }
  4671. }]);
  4672. return BlockStatementDeadCodeInjectionNode;
  4673. }(AbstractCustomNode_1.AbstractCustomNode);
  4674. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], BlockStatementDeadCodeInjectionNode.prototype, "blockStatementNode", void 0);
  4675. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], BlockStatementDeadCodeInjectionNode.prototype, "deadCodeInjectionRootAstHostNode", void 0);
  4676. 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);
  4677. exports.BlockStatementDeadCodeInjectionNode = BlockStatementDeadCodeInjectionNode;
  4678. /***/ }),
  4679. /* 105 */
  4680. /***/ (function(module, exports, __webpack_require__) {
  4681. "use strict";
  4682. var _toConsumableArray = __webpack_require__(24);
  4683. var _Object$getPrototypeOf = __webpack_require__(5);
  4684. var _classCallCheck = __webpack_require__(0);
  4685. var _createClass = __webpack_require__(2);
  4686. var _possibleConstructorReturn = __webpack_require__(6);
  4687. var _inherits = __webpack_require__(7);
  4688. Object.defineProperty(exports, "__esModule", {
  4689. value: true
  4690. });
  4691. var tslib_1 = __webpack_require__(4);
  4692. var inversify_1 = __webpack_require__(1);
  4693. var ServiceIdentifiers_1 = __webpack_require__(3);
  4694. var Initializable_1 = __webpack_require__(10);
  4695. var AbstractCustomNode_1 = __webpack_require__(14);
  4696. var Nodes_1 = __webpack_require__(15);
  4697. var NodeUtils_1 = __webpack_require__(9);
  4698. var CallExpressionControlFlowStorageCallNode =
  4699. /*#__PURE__*/
  4700. function (_AbstractCustomNode_) {
  4701. _inherits(CallExpressionControlFlowStorageCallNode, _AbstractCustomNode_);
  4702. function CallExpressionControlFlowStorageCallNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  4703. _classCallCheck(this, CallExpressionControlFlowStorageCallNode);
  4704. return _possibleConstructorReturn(this, (CallExpressionControlFlowStorageCallNode.__proto__ || _Object$getPrototypeOf(CallExpressionControlFlowStorageCallNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  4705. }
  4706. _createClass(CallExpressionControlFlowStorageCallNode, [{
  4707. key: "initialize",
  4708. value: function initialize(controlFlowStorageName, controlFlowStorageKey, callee, expressionArguments) {
  4709. this.controlFlowStorageName = controlFlowStorageName;
  4710. this.controlFlowStorageKey = controlFlowStorageKey;
  4711. this.callee = callee;
  4712. this.expressionArguments = expressionArguments;
  4713. }
  4714. }, {
  4715. key: "getNodeStructure",
  4716. value: function getNodeStructure() {
  4717. 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))));
  4718. NodeUtils_1.NodeUtils.parentize(structure);
  4719. return [structure];
  4720. }
  4721. }]);
  4722. return CallExpressionControlFlowStorageCallNode;
  4723. }(AbstractCustomNode_1.AbstractCustomNode);
  4724. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], CallExpressionControlFlowStorageCallNode.prototype, "callee", void 0);
  4725. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], CallExpressionControlFlowStorageCallNode.prototype, "controlFlowStorageKey", void 0);
  4726. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], CallExpressionControlFlowStorageCallNode.prototype, "controlFlowStorageName", void 0);
  4727. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Array)], CallExpressionControlFlowStorageCallNode.prototype, "expressionArguments", void 0);
  4728. 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);
  4729. exports.CallExpressionControlFlowStorageCallNode = CallExpressionControlFlowStorageCallNode;
  4730. /***/ }),
  4731. /* 106 */
  4732. /***/ (function(module, exports, __webpack_require__) {
  4733. "use strict";
  4734. var _Object$getPrototypeOf = __webpack_require__(5);
  4735. var _classCallCheck = __webpack_require__(0);
  4736. var _createClass = __webpack_require__(2);
  4737. var _possibleConstructorReturn = __webpack_require__(6);
  4738. var _inherits = __webpack_require__(7);
  4739. Object.defineProperty(exports, "__esModule", {
  4740. value: true
  4741. });
  4742. var tslib_1 = __webpack_require__(4);
  4743. var inversify_1 = __webpack_require__(1);
  4744. var ServiceIdentifiers_1 = __webpack_require__(3);
  4745. var Initializable_1 = __webpack_require__(10);
  4746. var AbstractCustomNode_1 = __webpack_require__(14);
  4747. var Nodes_1 = __webpack_require__(15);
  4748. var NodeUtils_1 = __webpack_require__(9);
  4749. var CallExpressionFunctionNode =
  4750. /*#__PURE__*/
  4751. function (_AbstractCustomNode_) {
  4752. _inherits(CallExpressionFunctionNode, _AbstractCustomNode_);
  4753. function CallExpressionFunctionNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  4754. _classCallCheck(this, CallExpressionFunctionNode);
  4755. return _possibleConstructorReturn(this, (CallExpressionFunctionNode.__proto__ || _Object$getPrototypeOf(CallExpressionFunctionNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  4756. }
  4757. _createClass(CallExpressionFunctionNode, [{
  4758. key: "initialize",
  4759. value: function initialize(expressionArguments) {
  4760. this.expressionArguments = expressionArguments;
  4761. }
  4762. }, {
  4763. key: "getNodeStructure",
  4764. value: function getNodeStructure() {
  4765. var calleeIdentifier = Nodes_1.Nodes.getIdentifierNode('callee');
  4766. var params = [];
  4767. var argumentsLength = this.expressionArguments.length;
  4768. for (var i = 0; i < argumentsLength; i++) {
  4769. params.push(Nodes_1.Nodes.getIdentifierNode("param".concat(i + 1)));
  4770. }
  4771. var structure = Nodes_1.Nodes.getExpressionStatementNode(Nodes_1.Nodes.getFunctionExpressionNode([calleeIdentifier].concat(params), Nodes_1.Nodes.getBlockStatementNode([Nodes_1.Nodes.getReturnStatementNode(Nodes_1.Nodes.getCallExpressionNode(calleeIdentifier, params))])));
  4772. NodeUtils_1.NodeUtils.parentize(structure);
  4773. return [structure];
  4774. }
  4775. }]);
  4776. return CallExpressionFunctionNode;
  4777. }(AbstractCustomNode_1.AbstractCustomNode);
  4778. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Array)], CallExpressionFunctionNode.prototype, "expressionArguments", void 0);
  4779. 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);
  4780. exports.CallExpressionFunctionNode = CallExpressionFunctionNode;
  4781. /***/ }),
  4782. /* 107 */
  4783. /***/ (function(module, exports, __webpack_require__) {
  4784. "use strict";
  4785. var _slicedToArray = __webpack_require__(30);
  4786. var _Array$from = __webpack_require__(56);
  4787. var _Object$getPrototypeOf = __webpack_require__(5);
  4788. var _classCallCheck = __webpack_require__(0);
  4789. var _createClass = __webpack_require__(2);
  4790. var _possibleConstructorReturn = __webpack_require__(6);
  4791. var _inherits = __webpack_require__(7);
  4792. Object.defineProperty(exports, "__esModule", {
  4793. value: true
  4794. });
  4795. var tslib_1 = __webpack_require__(4);
  4796. var inversify_1 = __webpack_require__(1);
  4797. var ServiceIdentifiers_1 = __webpack_require__(3);
  4798. var Initializable_1 = __webpack_require__(10);
  4799. var AbstractCustomNode_1 = __webpack_require__(14);
  4800. var NodeGuards_1 = __webpack_require__(8);
  4801. var Nodes_1 = __webpack_require__(15);
  4802. var NodeUtils_1 = __webpack_require__(9);
  4803. var ControlFlowStorageNode =
  4804. /*#__PURE__*/
  4805. function (_AbstractCustomNode_) {
  4806. _inherits(ControlFlowStorageNode, _AbstractCustomNode_);
  4807. function ControlFlowStorageNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  4808. _classCallCheck(this, ControlFlowStorageNode);
  4809. return _possibleConstructorReturn(this, (ControlFlowStorageNode.__proto__ || _Object$getPrototypeOf(ControlFlowStorageNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  4810. }
  4811. _createClass(ControlFlowStorageNode, [{
  4812. key: "initialize",
  4813. value: function initialize(controlFlowStorage) {
  4814. this.controlFlowStorage = controlFlowStorage;
  4815. }
  4816. }, {
  4817. key: "getNodeStructure",
  4818. value: function getNodeStructure() {
  4819. var propertyNodes = _Array$from(this.controlFlowStorage.getStorage()).map(function (_ref) {
  4820. var _ref2 = _slicedToArray(_ref, 2),
  4821. key = _ref2[0],
  4822. value = _ref2[1];
  4823. var node = value.getNode()[0];
  4824. if (!NodeGuards_1.NodeGuards.isExpressionStatementNode(node)) {
  4825. throw new Error('Function node for control flow storage object should be passed inside the `ExpressionStatement` node!');
  4826. }
  4827. return Nodes_1.Nodes.getPropertyNode(Nodes_1.Nodes.getIdentifierNode(key), node.expression);
  4828. });
  4829. var structure = Nodes_1.Nodes.getVariableDeclarationNode([Nodes_1.Nodes.getVariableDeclaratorNode(Nodes_1.Nodes.getIdentifierNode(this.controlFlowStorage.getStorageId()), Nodes_1.Nodes.getObjectExpressionNode(propertyNodes))]);
  4830. structure = NodeUtils_1.NodeUtils.parentize(structure);
  4831. return [structure];
  4832. }
  4833. }]);
  4834. return ControlFlowStorageNode;
  4835. }(AbstractCustomNode_1.AbstractCustomNode);
  4836. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], ControlFlowStorageNode.prototype, "controlFlowStorage", void 0);
  4837. 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);
  4838. exports.ControlFlowStorageNode = ControlFlowStorageNode;
  4839. /***/ }),
  4840. /* 108 */
  4841. /***/ (function(module, exports, __webpack_require__) {
  4842. "use strict";
  4843. var _Object$getPrototypeOf = __webpack_require__(5);
  4844. var _classCallCheck = __webpack_require__(0);
  4845. var _createClass = __webpack_require__(2);
  4846. var _possibleConstructorReturn = __webpack_require__(6);
  4847. var _inherits = __webpack_require__(7);
  4848. Object.defineProperty(exports, "__esModule", {
  4849. value: true
  4850. });
  4851. var tslib_1 = __webpack_require__(4);
  4852. var inversify_1 = __webpack_require__(1);
  4853. var ServiceIdentifiers_1 = __webpack_require__(3);
  4854. var string_template_1 = tslib_1.__importDefault(__webpack_require__(19));
  4855. var ObfuscationTarget_1 = __webpack_require__(21);
  4856. var ConsoleOutputDisableExpressionTemplate_1 = __webpack_require__(109);
  4857. var GlobalVariableNoEvalTemplate_1 = __webpack_require__(44);
  4858. var Initializable_1 = __webpack_require__(10);
  4859. var AbstractCustomNode_1 = __webpack_require__(14);
  4860. var NodeUtils_1 = __webpack_require__(9);
  4861. var ConsoleOutputDisableExpressionNode =
  4862. /*#__PURE__*/
  4863. function (_AbstractCustomNode_) {
  4864. _inherits(ConsoleOutputDisableExpressionNode, _AbstractCustomNode_);
  4865. function ConsoleOutputDisableExpressionNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  4866. _classCallCheck(this, ConsoleOutputDisableExpressionNode);
  4867. return _possibleConstructorReturn(this, (ConsoleOutputDisableExpressionNode.__proto__ || _Object$getPrototypeOf(ConsoleOutputDisableExpressionNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  4868. }
  4869. _createClass(ConsoleOutputDisableExpressionNode, [{
  4870. key: "initialize",
  4871. value: function initialize(callsControllerFunctionName) {
  4872. this.callsControllerFunctionName = callsControllerFunctionName;
  4873. }
  4874. }, {
  4875. key: "getNodeStructure",
  4876. value: function getNodeStructure() {
  4877. return NodeUtils_1.NodeUtils.convertCodeToStructure(this.getTemplate());
  4878. }
  4879. }, {
  4880. key: "getTemplate",
  4881. value: function getTemplate() {
  4882. var globalVariableTemplate = this.options.target !== ObfuscationTarget_1.ObfuscationTarget.Extension ? this.getGlobalVariableTemplate() : GlobalVariableNoEvalTemplate_1.GlobalVariableNoEvalTemplate();
  4883. return string_template_1.default(ConsoleOutputDisableExpressionTemplate_1.ConsoleOutputDisableExpressionTemplate(), {
  4884. consoleLogDisableFunctionName: this.identifierNamesGenerator.generate(),
  4885. globalVariableTemplate: globalVariableTemplate,
  4886. singleNodeCallControllerFunctionName: this.callsControllerFunctionName
  4887. });
  4888. }
  4889. }]);
  4890. return ConsoleOutputDisableExpressionNode;
  4891. }(AbstractCustomNode_1.AbstractCustomNode);
  4892. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], ConsoleOutputDisableExpressionNode.prototype, "callsControllerFunctionName", void 0);
  4893. 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);
  4894. exports.ConsoleOutputDisableExpressionNode = ConsoleOutputDisableExpressionNode;
  4895. /***/ }),
  4896. /* 109 */
  4897. /***/ (function(module, exports, __webpack_require__) {
  4898. "use strict";
  4899. Object.defineProperty(exports, "__esModule", {
  4900. value: true
  4901. });
  4902. function ConsoleOutputDisableExpressionTemplate() {
  4903. 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 ";
  4904. }
  4905. exports.ConsoleOutputDisableExpressionTemplate = ConsoleOutputDisableExpressionTemplate;
  4906. /***/ }),
  4907. /* 110 */
  4908. /***/ (function(module, exports, __webpack_require__) {
  4909. "use strict";
  4910. var _Object$getPrototypeOf = __webpack_require__(5);
  4911. var _classCallCheck = __webpack_require__(0);
  4912. var _createClass = __webpack_require__(2);
  4913. var _possibleConstructorReturn = __webpack_require__(6);
  4914. var _inherits = __webpack_require__(7);
  4915. Object.defineProperty(exports, "__esModule", {
  4916. value: true
  4917. });
  4918. var tslib_1 = __webpack_require__(4);
  4919. var inversify_1 = __webpack_require__(1);
  4920. var ServiceIdentifiers_1 = __webpack_require__(3);
  4921. var string_template_1 = tslib_1.__importDefault(__webpack_require__(19));
  4922. var Initializable_1 = __webpack_require__(10);
  4923. var DebugProtectionFunctionCallTemplate_1 = __webpack_require__(111);
  4924. var AbstractCustomNode_1 = __webpack_require__(14);
  4925. var NodeUtils_1 = __webpack_require__(9);
  4926. var DebugProtectionFunctionCallNode =
  4927. /*#__PURE__*/
  4928. function (_AbstractCustomNode_) {
  4929. _inherits(DebugProtectionFunctionCallNode, _AbstractCustomNode_);
  4930. function DebugProtectionFunctionCallNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  4931. _classCallCheck(this, DebugProtectionFunctionCallNode);
  4932. return _possibleConstructorReturn(this, (DebugProtectionFunctionCallNode.__proto__ || _Object$getPrototypeOf(DebugProtectionFunctionCallNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  4933. }
  4934. _createClass(DebugProtectionFunctionCallNode, [{
  4935. key: "initialize",
  4936. value: function initialize(debugProtectionFunctionName, callsControllerFunctionName) {
  4937. this.debugProtectionFunctionName = debugProtectionFunctionName;
  4938. this.callsControllerFunctionName = callsControllerFunctionName;
  4939. }
  4940. }, {
  4941. key: "getNodeStructure",
  4942. value: function getNodeStructure() {
  4943. return NodeUtils_1.NodeUtils.convertCodeToStructure(this.getTemplate());
  4944. }
  4945. }, {
  4946. key: "getTemplate",
  4947. value: function getTemplate() {
  4948. return string_template_1.default(DebugProtectionFunctionCallTemplate_1.DebugProtectionFunctionCallTemplate(), {
  4949. debugProtectionFunctionName: this.debugProtectionFunctionName,
  4950. singleNodeCallControllerFunctionName: this.callsControllerFunctionName
  4951. });
  4952. }
  4953. }]);
  4954. return DebugProtectionFunctionCallNode;
  4955. }(AbstractCustomNode_1.AbstractCustomNode);
  4956. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], DebugProtectionFunctionCallNode.prototype, "callsControllerFunctionName", void 0);
  4957. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], DebugProtectionFunctionCallNode.prototype, "debugProtectionFunctionName", void 0);
  4958. 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);
  4959. exports.DebugProtectionFunctionCallNode = DebugProtectionFunctionCallNode;
  4960. /***/ }),
  4961. /* 111 */
  4962. /***/ (function(module, exports, __webpack_require__) {
  4963. "use strict";
  4964. Object.defineProperty(exports, "__esModule", {
  4965. value: true
  4966. });
  4967. function DebugProtectionFunctionCallTemplate() {
  4968. 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 ";
  4969. }
  4970. exports.DebugProtectionFunctionCallTemplate = DebugProtectionFunctionCallTemplate;
  4971. /***/ }),
  4972. /* 112 */
  4973. /***/ (function(module, exports, __webpack_require__) {
  4974. "use strict";
  4975. var _Object$getPrototypeOf = __webpack_require__(5);
  4976. var _classCallCheck = __webpack_require__(0);
  4977. var _createClass = __webpack_require__(2);
  4978. var _possibleConstructorReturn = __webpack_require__(6);
  4979. var _inherits = __webpack_require__(7);
  4980. Object.defineProperty(exports, "__esModule", {
  4981. value: true
  4982. });
  4983. var tslib_1 = __webpack_require__(4);
  4984. var inversify_1 = __webpack_require__(1);
  4985. var ServiceIdentifiers_1 = __webpack_require__(3);
  4986. var string_template_1 = tslib_1.__importDefault(__webpack_require__(19));
  4987. var Initializable_1 = __webpack_require__(10);
  4988. var DebugProtectionFunctionIntervalTemplate_1 = __webpack_require__(113);
  4989. var AbstractCustomNode_1 = __webpack_require__(14);
  4990. var NodeUtils_1 = __webpack_require__(9);
  4991. var DebugProtectionFunctionIntervalNode =
  4992. /*#__PURE__*/
  4993. function (_AbstractCustomNode_) {
  4994. _inherits(DebugProtectionFunctionIntervalNode, _AbstractCustomNode_);
  4995. function DebugProtectionFunctionIntervalNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  4996. _classCallCheck(this, DebugProtectionFunctionIntervalNode);
  4997. return _possibleConstructorReturn(this, (DebugProtectionFunctionIntervalNode.__proto__ || _Object$getPrototypeOf(DebugProtectionFunctionIntervalNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  4998. }
  4999. _createClass(DebugProtectionFunctionIntervalNode, [{
  5000. key: "initialize",
  5001. value: function initialize(debugProtectionFunctionName) {
  5002. this.debugProtectionFunctionName = debugProtectionFunctionName;
  5003. }
  5004. }, {
  5005. key: "getNodeStructure",
  5006. value: function getNodeStructure() {
  5007. return NodeUtils_1.NodeUtils.convertCodeToStructure(this.getTemplate());
  5008. }
  5009. }, {
  5010. key: "getTemplate",
  5011. value: function getTemplate() {
  5012. return string_template_1.default(DebugProtectionFunctionIntervalTemplate_1.DebugProtectionFunctionIntervalTemplate(), {
  5013. debugProtectionFunctionName: this.debugProtectionFunctionName
  5014. });
  5015. }
  5016. }]);
  5017. return DebugProtectionFunctionIntervalNode;
  5018. }(AbstractCustomNode_1.AbstractCustomNode);
  5019. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], DebugProtectionFunctionIntervalNode.prototype, "debugProtectionFunctionName", void 0);
  5020. 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);
  5021. exports.DebugProtectionFunctionIntervalNode = DebugProtectionFunctionIntervalNode;
  5022. /***/ }),
  5023. /* 113 */
  5024. /***/ (function(module, exports, __webpack_require__) {
  5025. "use strict";
  5026. Object.defineProperty(exports, "__esModule", {
  5027. value: true
  5028. });
  5029. function DebugProtectionFunctionIntervalTemplate() {
  5030. return "\n setInterval(function () {\n {debugProtectionFunctionName}();\n }, 4000);\n ";
  5031. }
  5032. exports.DebugProtectionFunctionIntervalTemplate = DebugProtectionFunctionIntervalTemplate;
  5033. /***/ }),
  5034. /* 114 */
  5035. /***/ (function(module, exports, __webpack_require__) {
  5036. "use strict";
  5037. var _Object$getPrototypeOf = __webpack_require__(5);
  5038. var _classCallCheck = __webpack_require__(0);
  5039. var _createClass = __webpack_require__(2);
  5040. var _possibleConstructorReturn = __webpack_require__(6);
  5041. var _inherits = __webpack_require__(7);
  5042. Object.defineProperty(exports, "__esModule", {
  5043. value: true
  5044. });
  5045. var tslib_1 = __webpack_require__(4);
  5046. var inversify_1 = __webpack_require__(1);
  5047. var ServiceIdentifiers_1 = __webpack_require__(3);
  5048. var string_template_1 = tslib_1.__importDefault(__webpack_require__(19));
  5049. var ObfuscationTarget_1 = __webpack_require__(21);
  5050. var Initializable_1 = __webpack_require__(10);
  5051. var DebuggerTemplate_1 = __webpack_require__(115);
  5052. var DebuggerTemplateNoEval_1 = __webpack_require__(116);
  5053. var DebugProtectionFunctionTemplate_1 = __webpack_require__(117);
  5054. var AbstractCustomNode_1 = __webpack_require__(14);
  5055. var NodeUtils_1 = __webpack_require__(9);
  5056. var DebugProtectionFunctionNode =
  5057. /*#__PURE__*/
  5058. function (_AbstractCustomNode_) {
  5059. _inherits(DebugProtectionFunctionNode, _AbstractCustomNode_);
  5060. function DebugProtectionFunctionNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  5061. _classCallCheck(this, DebugProtectionFunctionNode);
  5062. return _possibleConstructorReturn(this, (DebugProtectionFunctionNode.__proto__ || _Object$getPrototypeOf(DebugProtectionFunctionNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  5063. }
  5064. _createClass(DebugProtectionFunctionNode, [{
  5065. key: "initialize",
  5066. value: function initialize(debugProtectionFunctionName) {
  5067. this.debugProtectionFunctionName = debugProtectionFunctionName;
  5068. }
  5069. }, {
  5070. key: "getNodeStructure",
  5071. value: function getNodeStructure() {
  5072. return NodeUtils_1.NodeUtils.convertCodeToStructure(this.getTemplate());
  5073. }
  5074. }, {
  5075. key: "getTemplate",
  5076. value: function getTemplate() {
  5077. var debuggerTemplate = this.options.target !== ObfuscationTarget_1.ObfuscationTarget.Extension ? DebuggerTemplate_1.DebuggerTemplate() : DebuggerTemplateNoEval_1.DebuggerTemplateNoEval();
  5078. return string_template_1.default(DebugProtectionFunctionTemplate_1.DebugProtectionFunctionTemplate(), {
  5079. debuggerTemplate: debuggerTemplate,
  5080. debugProtectionFunctionName: this.debugProtectionFunctionName
  5081. });
  5082. }
  5083. }]);
  5084. return DebugProtectionFunctionNode;
  5085. }(AbstractCustomNode_1.AbstractCustomNode);
  5086. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], DebugProtectionFunctionNode.prototype, "debugProtectionFunctionName", void 0);
  5087. 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);
  5088. exports.DebugProtectionFunctionNode = DebugProtectionFunctionNode;
  5089. /***/ }),
  5090. /* 115 */
  5091. /***/ (function(module, exports, __webpack_require__) {
  5092. "use strict";
  5093. Object.defineProperty(exports, "__esModule", {
  5094. value: true
  5095. });
  5096. function DebuggerTemplate() {
  5097. 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 ";
  5098. }
  5099. exports.DebuggerTemplate = DebuggerTemplate;
  5100. /***/ }),
  5101. /* 116 */
  5102. /***/ (function(module, exports, __webpack_require__) {
  5103. "use strict";
  5104. Object.defineProperty(exports, "__esModule", {
  5105. value: true
  5106. });
  5107. function DebuggerTemplateNoEval() {
  5108. 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 ";
  5109. }
  5110. exports.DebuggerTemplateNoEval = DebuggerTemplateNoEval;
  5111. /***/ }),
  5112. /* 117 */
  5113. /***/ (function(module, exports, __webpack_require__) {
  5114. "use strict";
  5115. Object.defineProperty(exports, "__esModule", {
  5116. value: true
  5117. });
  5118. function DebugProtectionFunctionTemplate() {
  5119. 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 ";
  5120. }
  5121. exports.DebugProtectionFunctionTemplate = DebugProtectionFunctionTemplate;
  5122. /***/ }),
  5123. /* 118 */
  5124. /***/ (function(module, exports, __webpack_require__) {
  5125. "use strict";
  5126. var _slicedToArray = __webpack_require__(30);
  5127. var _Object$getPrototypeOf = __webpack_require__(5);
  5128. var _classCallCheck = __webpack_require__(0);
  5129. var _createClass = __webpack_require__(2);
  5130. var _possibleConstructorReturn = __webpack_require__(6);
  5131. var _inherits = __webpack_require__(7);
  5132. Object.defineProperty(exports, "__esModule", {
  5133. value: true
  5134. });
  5135. var tslib_1 = __webpack_require__(4);
  5136. var inversify_1 = __webpack_require__(1);
  5137. var ServiceIdentifiers_1 = __webpack_require__(3);
  5138. var string_template_1 = tslib_1.__importDefault(__webpack_require__(19));
  5139. var ObfuscationTarget_1 = __webpack_require__(21);
  5140. var Initializable_1 = __webpack_require__(10);
  5141. var DomainLockNodeTemplate_1 = __webpack_require__(119);
  5142. var GlobalVariableNoEvalTemplate_1 = __webpack_require__(44);
  5143. var AbstractCustomNode_1 = __webpack_require__(14);
  5144. var NodeUtils_1 = __webpack_require__(9);
  5145. var DomainLockNode =
  5146. /*#__PURE__*/
  5147. function (_AbstractCustomNode_) {
  5148. _inherits(DomainLockNode, _AbstractCustomNode_);
  5149. function DomainLockNode(identifierNamesGeneratorFactory, randomGenerator, cryptUtils, options) {
  5150. var _this;
  5151. _classCallCheck(this, DomainLockNode);
  5152. _this = _possibleConstructorReturn(this, (DomainLockNode.__proto__ || _Object$getPrototypeOf(DomainLockNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  5153. _this.cryptUtils = cryptUtils;
  5154. return _this;
  5155. }
  5156. _createClass(DomainLockNode, [{
  5157. key: "initialize",
  5158. value: function initialize(callsControllerFunctionName) {
  5159. this.callsControllerFunctionName = callsControllerFunctionName;
  5160. }
  5161. }, {
  5162. key: "getNodeStructure",
  5163. value: function getNodeStructure() {
  5164. return NodeUtils_1.NodeUtils.convertCodeToStructure(this.getTemplate());
  5165. }
  5166. }, {
  5167. key: "getTemplate",
  5168. value: function getTemplate() {
  5169. var domainsString = this.options.domainLock.join(';');
  5170. var _cryptUtils$hideStrin = this.cryptUtils.hideString(domainsString, domainsString.length * 3),
  5171. _cryptUtils$hideStrin2 = _slicedToArray(_cryptUtils$hideStrin, 2),
  5172. hiddenDomainsString = _cryptUtils$hideStrin2[0],
  5173. diff = _cryptUtils$hideStrin2[1];
  5174. var globalVariableTemplate = this.options.target !== ObfuscationTarget_1.ObfuscationTarget.Extension ? this.getGlobalVariableTemplate() : GlobalVariableNoEvalTemplate_1.GlobalVariableNoEvalTemplate();
  5175. return string_template_1.default(DomainLockNodeTemplate_1.DomainLockNodeTemplate(), {
  5176. domainLockFunctionName: this.identifierNamesGenerator.generate(),
  5177. diff: diff,
  5178. domains: hiddenDomainsString,
  5179. globalVariableTemplate: globalVariableTemplate,
  5180. singleNodeCallControllerFunctionName: this.callsControllerFunctionName
  5181. });
  5182. }
  5183. }]);
  5184. return DomainLockNode;
  5185. }(AbstractCustomNode_1.AbstractCustomNode);
  5186. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], DomainLockNode.prototype, "callsControllerFunctionName", void 0);
  5187. 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);
  5188. exports.DomainLockNode = DomainLockNode;
  5189. /***/ }),
  5190. /* 119 */
  5191. /***/ (function(module, exports, __webpack_require__) {
  5192. "use strict";
  5193. Object.defineProperty(exports, "__esModule", {
  5194. value: true
  5195. });
  5196. function DomainLockNodeTemplate() {
  5197. 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 ";
  5198. }
  5199. exports.DomainLockNodeTemplate = DomainLockNodeTemplate;
  5200. /***/ }),
  5201. /* 120 */
  5202. /***/ (function(module, exports, __webpack_require__) {
  5203. "use strict";
  5204. var _Object$getPrototypeOf = __webpack_require__(5);
  5205. var _classCallCheck = __webpack_require__(0);
  5206. var _createClass = __webpack_require__(2);
  5207. var _possibleConstructorReturn = __webpack_require__(6);
  5208. var _inherits = __webpack_require__(7);
  5209. Object.defineProperty(exports, "__esModule", {
  5210. value: true
  5211. });
  5212. var tslib_1 = __webpack_require__(4);
  5213. var inversify_1 = __webpack_require__(1);
  5214. var ServiceIdentifiers_1 = __webpack_require__(3);
  5215. var Initializable_1 = __webpack_require__(10);
  5216. var AbstractCustomNode_1 = __webpack_require__(14);
  5217. var Nodes_1 = __webpack_require__(15);
  5218. var NodeUtils_1 = __webpack_require__(9);
  5219. var ExpressionWithOperatorControlFlowStorageCallNode =
  5220. /*#__PURE__*/
  5221. function (_AbstractCustomNode_) {
  5222. _inherits(ExpressionWithOperatorControlFlowStorageCallNode, _AbstractCustomNode_);
  5223. function ExpressionWithOperatorControlFlowStorageCallNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  5224. _classCallCheck(this, ExpressionWithOperatorControlFlowStorageCallNode);
  5225. return _possibleConstructorReturn(this, (ExpressionWithOperatorControlFlowStorageCallNode.__proto__ || _Object$getPrototypeOf(ExpressionWithOperatorControlFlowStorageCallNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  5226. }
  5227. _createClass(ExpressionWithOperatorControlFlowStorageCallNode, [{
  5228. key: "initialize",
  5229. value: function initialize(controlFlowStorageName, controlFlowStorageKey, leftValue, rightValue) {
  5230. this.controlFlowStorageName = controlFlowStorageName;
  5231. this.controlFlowStorageKey = controlFlowStorageKey;
  5232. this.leftValue = leftValue;
  5233. this.rightValue = rightValue;
  5234. }
  5235. }, {
  5236. key: "getNodeStructure",
  5237. value: function getNodeStructure() {
  5238. 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]));
  5239. NodeUtils_1.NodeUtils.parentize(structure);
  5240. return [structure];
  5241. }
  5242. }]);
  5243. return ExpressionWithOperatorControlFlowStorageCallNode;
  5244. }(AbstractCustomNode_1.AbstractCustomNode);
  5245. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], ExpressionWithOperatorControlFlowStorageCallNode.prototype, "controlFlowStorageKey", void 0);
  5246. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], ExpressionWithOperatorControlFlowStorageCallNode.prototype, "controlFlowStorageName", void 0);
  5247. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], ExpressionWithOperatorControlFlowStorageCallNode.prototype, "leftValue", void 0);
  5248. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], ExpressionWithOperatorControlFlowStorageCallNode.prototype, "rightValue", void 0);
  5249. 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);
  5250. exports.ExpressionWithOperatorControlFlowStorageCallNode = ExpressionWithOperatorControlFlowStorageCallNode;
  5251. /***/ }),
  5252. /* 121 */
  5253. /***/ (function(module, exports, __webpack_require__) {
  5254. "use strict";
  5255. var _Object$getPrototypeOf = __webpack_require__(5);
  5256. var _classCallCheck = __webpack_require__(0);
  5257. var _createClass = __webpack_require__(2);
  5258. var _possibleConstructorReturn = __webpack_require__(6);
  5259. var _inherits = __webpack_require__(7);
  5260. Object.defineProperty(exports, "__esModule", {
  5261. value: true
  5262. });
  5263. var tslib_1 = __webpack_require__(4);
  5264. var inversify_1 = __webpack_require__(1);
  5265. var ServiceIdentifiers_1 = __webpack_require__(3);
  5266. var Initializable_1 = __webpack_require__(10);
  5267. var AbstractCustomNode_1 = __webpack_require__(14);
  5268. var Nodes_1 = __webpack_require__(15);
  5269. var NodeUtils_1 = __webpack_require__(9);
  5270. var LogicalExpressionFunctionNode =
  5271. /*#__PURE__*/
  5272. function (_AbstractCustomNode_) {
  5273. _inherits(LogicalExpressionFunctionNode, _AbstractCustomNode_);
  5274. function LogicalExpressionFunctionNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  5275. _classCallCheck(this, LogicalExpressionFunctionNode);
  5276. return _possibleConstructorReturn(this, (LogicalExpressionFunctionNode.__proto__ || _Object$getPrototypeOf(LogicalExpressionFunctionNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  5277. }
  5278. _createClass(LogicalExpressionFunctionNode, [{
  5279. key: "initialize",
  5280. value: function initialize(operator) {
  5281. this.operator = operator;
  5282. }
  5283. }, {
  5284. key: "getNodeStructure",
  5285. value: function getNodeStructure() {
  5286. var structure = Nodes_1.Nodes.getExpressionStatementNode(Nodes_1.Nodes.getFunctionExpressionNode([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')))])));
  5287. NodeUtils_1.NodeUtils.parentize(structure);
  5288. return [structure];
  5289. }
  5290. }]);
  5291. return LogicalExpressionFunctionNode;
  5292. }(AbstractCustomNode_1.AbstractCustomNode);
  5293. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], LogicalExpressionFunctionNode.prototype, "operator", void 0);
  5294. 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);
  5295. exports.LogicalExpressionFunctionNode = LogicalExpressionFunctionNode;
  5296. /***/ }),
  5297. /* 122 */
  5298. /***/ (function(module, exports, __webpack_require__) {
  5299. "use strict";
  5300. var _Object$assign = __webpack_require__(11);
  5301. var _Object$getPrototypeOf = __webpack_require__(5);
  5302. var _classCallCheck = __webpack_require__(0);
  5303. var _createClass = __webpack_require__(2);
  5304. var _possibleConstructorReturn = __webpack_require__(6);
  5305. var _inherits = __webpack_require__(7);
  5306. Object.defineProperty(exports, "__esModule", {
  5307. value: true
  5308. });
  5309. var tslib_1 = __webpack_require__(4);
  5310. var inversify_1 = __webpack_require__(1);
  5311. var ServiceIdentifiers_1 = __webpack_require__(3);
  5312. var string_template_1 = tslib_1.__importDefault(__webpack_require__(19));
  5313. var ObfuscationEvent_1 = __webpack_require__(25);
  5314. var Initializable_1 = __webpack_require__(10);
  5315. var SingleNodeCallControllerTemplate_1 = __webpack_require__(123);
  5316. var NoCustomNodes_1 = __webpack_require__(39);
  5317. var AbstractCustomNode_1 = __webpack_require__(14);
  5318. var JavaScriptObfuscatorFacade_1 = __webpack_require__(27);
  5319. var NodeUtils_1 = __webpack_require__(9);
  5320. var NodeCallsControllerFunctionNode =
  5321. /*#__PURE__*/
  5322. function (_AbstractCustomNode_) {
  5323. _inherits(NodeCallsControllerFunctionNode, _AbstractCustomNode_);
  5324. function NodeCallsControllerFunctionNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  5325. _classCallCheck(this, NodeCallsControllerFunctionNode);
  5326. return _possibleConstructorReturn(this, (NodeCallsControllerFunctionNode.__proto__ || _Object$getPrototypeOf(NodeCallsControllerFunctionNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  5327. }
  5328. _createClass(NodeCallsControllerFunctionNode, [{
  5329. key: "initialize",
  5330. value: function initialize(appendEvent, callsControllerFunctionName) {
  5331. this.appendEvent = appendEvent;
  5332. this.callsControllerFunctionName = callsControllerFunctionName;
  5333. }
  5334. }, {
  5335. key: "getNodeStructure",
  5336. value: function getNodeStructure() {
  5337. return NodeUtils_1.NodeUtils.convertCodeToStructure(this.getTemplate());
  5338. }
  5339. }, {
  5340. key: "getTemplate",
  5341. value: function getTemplate() {
  5342. if (this.appendEvent === ObfuscationEvent_1.ObfuscationEvent.AfterObfuscation) {
  5343. return JavaScriptObfuscatorFacade_1.JavaScriptObfuscator.obfuscate(string_template_1.default(SingleNodeCallControllerTemplate_1.SingleNodeCallControllerTemplate(), {
  5344. singleNodeCallControllerFunctionName: this.callsControllerFunctionName
  5345. }), _Object$assign({}, NoCustomNodes_1.NO_ADDITIONAL_NODES_PRESET, {
  5346. identifierNamesGenerator: this.options.identifierNamesGenerator,
  5347. seed: this.options.seed
  5348. })).getObfuscatedCode();
  5349. }
  5350. return string_template_1.default(SingleNodeCallControllerTemplate_1.SingleNodeCallControllerTemplate(), {
  5351. singleNodeCallControllerFunctionName: this.callsControllerFunctionName
  5352. });
  5353. }
  5354. }]);
  5355. return NodeCallsControllerFunctionNode;
  5356. }(AbstractCustomNode_1.AbstractCustomNode);
  5357. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], NodeCallsControllerFunctionNode.prototype, "callsControllerFunctionName", void 0);
  5358. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], NodeCallsControllerFunctionNode.prototype, "appendEvent", void 0);
  5359. 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);
  5360. exports.NodeCallsControllerFunctionNode = NodeCallsControllerFunctionNode;
  5361. /***/ }),
  5362. /* 123 */
  5363. /***/ (function(module, exports, __webpack_require__) {
  5364. "use strict";
  5365. Object.defineProperty(exports, "__esModule", {
  5366. value: true
  5367. });
  5368. function SingleNodeCallControllerTemplate() {
  5369. 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 ";
  5370. }
  5371. exports.SingleNodeCallControllerTemplate = SingleNodeCallControllerTemplate;
  5372. /***/ }),
  5373. /* 124 */
  5374. /***/ (function(module, exports, __webpack_require__) {
  5375. "use strict";
  5376. var _Object$assign = __webpack_require__(11);
  5377. var _Object$getPrototypeOf = __webpack_require__(5);
  5378. var _classCallCheck = __webpack_require__(0);
  5379. var _createClass = __webpack_require__(2);
  5380. var _possibleConstructorReturn = __webpack_require__(6);
  5381. var _inherits = __webpack_require__(7);
  5382. Object.defineProperty(exports, "__esModule", {
  5383. value: true
  5384. });
  5385. var tslib_1 = __webpack_require__(4);
  5386. var inversify_1 = __webpack_require__(1);
  5387. var ServiceIdentifiers_1 = __webpack_require__(3);
  5388. var string_template_1 = tslib_1.__importDefault(__webpack_require__(19));
  5389. var Initializable_1 = __webpack_require__(10);
  5390. var NoCustomNodes_1 = __webpack_require__(39);
  5391. var SelfDefendingTemplate_1 = __webpack_require__(125);
  5392. var AbstractCustomNode_1 = __webpack_require__(14);
  5393. var JavaScriptObfuscatorFacade_1 = __webpack_require__(27);
  5394. var NodeUtils_1 = __webpack_require__(9);
  5395. var SelfDefendingUnicodeNode =
  5396. /*#__PURE__*/
  5397. function (_AbstractCustomNode_) {
  5398. _inherits(SelfDefendingUnicodeNode, _AbstractCustomNode_);
  5399. function SelfDefendingUnicodeNode(identifierNamesGeneratorFactory, randomGenerator, escapeSequenceEncoder, options) {
  5400. var _this;
  5401. _classCallCheck(this, SelfDefendingUnicodeNode);
  5402. _this = _possibleConstructorReturn(this, (SelfDefendingUnicodeNode.__proto__ || _Object$getPrototypeOf(SelfDefendingUnicodeNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  5403. _this.escapeSequenceEncoder = escapeSequenceEncoder;
  5404. return _this;
  5405. }
  5406. _createClass(SelfDefendingUnicodeNode, [{
  5407. key: "initialize",
  5408. value: function initialize(callsControllerFunctionName) {
  5409. this.callsControllerFunctionName = callsControllerFunctionName;
  5410. }
  5411. }, {
  5412. key: "getNodeStructure",
  5413. value: function getNodeStructure() {
  5414. return NodeUtils_1.NodeUtils.convertCodeToStructure(this.getTemplate());
  5415. }
  5416. }, {
  5417. key: "getTemplate",
  5418. value: function getTemplate() {
  5419. return JavaScriptObfuscatorFacade_1.JavaScriptObfuscator.obfuscate(string_template_1.default(SelfDefendingTemplate_1.SelfDefendingTemplate(this.escapeSequenceEncoder), {
  5420. selfDefendingFunctionName: this.identifierNamesGenerator.generate(),
  5421. singleNodeCallControllerFunctionName: this.callsControllerFunctionName
  5422. }), _Object$assign({}, NoCustomNodes_1.NO_ADDITIONAL_NODES_PRESET, {
  5423. identifierNamesGenerator: this.options.identifierNamesGenerator,
  5424. seed: this.options.seed,
  5425. unicodeEscapeSequence: true
  5426. })).getObfuscatedCode();
  5427. }
  5428. }]);
  5429. return SelfDefendingUnicodeNode;
  5430. }(AbstractCustomNode_1.AbstractCustomNode);
  5431. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], SelfDefendingUnicodeNode.prototype, "callsControllerFunctionName", void 0);
  5432. 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);
  5433. exports.SelfDefendingUnicodeNode = SelfDefendingUnicodeNode;
  5434. /***/ }),
  5435. /* 125 */
  5436. /***/ (function(module, exports, __webpack_require__) {
  5437. "use strict";
  5438. Object.defineProperty(exports, "__esModule", {
  5439. value: true
  5440. });
  5441. function SelfDefendingTemplate(escapeSequenceEncoder) {
  5442. 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('".concat(escapeSequenceEncoder.encode("\\w+ *\\(\\) *{\\w+ *['|\"].+['|\"];? *}", true), "');\n \n return !regExp.test(func1.toString());\n };\n \n var test2 = function () {\n var regExp = new RegExp('").concat(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 ");
  5443. }
  5444. exports.SelfDefendingTemplate = SelfDefendingTemplate;
  5445. /***/ }),
  5446. /* 126 */
  5447. /***/ (function(module, exports, __webpack_require__) {
  5448. "use strict";
  5449. var _Object$assign = __webpack_require__(11);
  5450. var _Object$getPrototypeOf = __webpack_require__(5);
  5451. var _classCallCheck = __webpack_require__(0);
  5452. var _createClass = __webpack_require__(2);
  5453. var _possibleConstructorReturn = __webpack_require__(6);
  5454. var _inherits = __webpack_require__(7);
  5455. Object.defineProperty(exports, "__esModule", {
  5456. value: true
  5457. });
  5458. var tslib_1 = __webpack_require__(4);
  5459. var inversify_1 = __webpack_require__(1);
  5460. var ServiceIdentifiers_1 = __webpack_require__(3);
  5461. var string_template_1 = tslib_1.__importDefault(__webpack_require__(19));
  5462. var ObfuscationTarget_1 = __webpack_require__(21);
  5463. var StringArrayEncoding_1 = __webpack_require__(37);
  5464. var Initializable_1 = __webpack_require__(10);
  5465. var NoCustomNodes_1 = __webpack_require__(39);
  5466. var AtobTemplate_1 = __webpack_require__(127);
  5467. var GlobalVariableNoEvalTemplate_1 = __webpack_require__(44);
  5468. var Rc4Template_1 = __webpack_require__(128);
  5469. var SelfDefendingTemplate_1 = __webpack_require__(129);
  5470. var StringArrayBase64DecodeNodeTemplate_1 = __webpack_require__(130);
  5471. var StringArrayCallsWrapperTemplate_1 = __webpack_require__(131);
  5472. var StringArrayRC4DecodeNodeTemplate_1 = __webpack_require__(132);
  5473. var AbstractCustomNode_1 = __webpack_require__(14);
  5474. var JavaScriptObfuscatorFacade_1 = __webpack_require__(27);
  5475. var NodeUtils_1 = __webpack_require__(9);
  5476. var StringArrayCallsWrapper =
  5477. /*#__PURE__*/
  5478. function (_AbstractCustomNode_) {
  5479. _inherits(StringArrayCallsWrapper, _AbstractCustomNode_);
  5480. function StringArrayCallsWrapper(identifierNamesGeneratorFactory, randomGenerator, escapeSequenceEncoder, options) {
  5481. var _this;
  5482. _classCallCheck(this, StringArrayCallsWrapper);
  5483. _this = _possibleConstructorReturn(this, (StringArrayCallsWrapper.__proto__ || _Object$getPrototypeOf(StringArrayCallsWrapper)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  5484. _this.escapeSequenceEncoder = escapeSequenceEncoder;
  5485. return _this;
  5486. }
  5487. _createClass(StringArrayCallsWrapper, [{
  5488. key: "initialize",
  5489. value: function initialize(stringArrayName, stringArrayCallsWrapperName) {
  5490. this.stringArrayName = stringArrayName;
  5491. this.stringArrayCallsWrapperName = stringArrayCallsWrapperName;
  5492. }
  5493. }, {
  5494. key: "getNodeStructure",
  5495. value: function getNodeStructure() {
  5496. return NodeUtils_1.NodeUtils.convertCodeToStructure(this.getTemplate());
  5497. }
  5498. }, {
  5499. key: "getTemplate",
  5500. value: function getTemplate() {
  5501. var decodeNodeTemplate = this.getDecodeStringArrayTemplate();
  5502. return JavaScriptObfuscatorFacade_1.JavaScriptObfuscator.obfuscate(string_template_1.default(StringArrayCallsWrapperTemplate_1.StringArrayCallsWrapperTemplate(), {
  5503. decodeNodeTemplate: decodeNodeTemplate,
  5504. stringArrayCallsWrapperName: this.stringArrayCallsWrapperName,
  5505. stringArrayName: this.stringArrayName
  5506. }), _Object$assign({}, NoCustomNodes_1.NO_ADDITIONAL_NODES_PRESET, {
  5507. identifierNamesGenerator: this.options.identifierNamesGenerator,
  5508. seed: this.options.seed
  5509. })).getObfuscatedCode();
  5510. }
  5511. }, {
  5512. key: "getDecodeStringArrayTemplate",
  5513. value: function getDecodeStringArrayTemplate() {
  5514. var globalVariableTemplate = this.options.target !== ObfuscationTarget_1.ObfuscationTarget.Extension ? this.getGlobalVariableTemplate() : GlobalVariableNoEvalTemplate_1.GlobalVariableNoEvalTemplate();
  5515. var atobPolyfill = string_template_1.default(AtobTemplate_1.AtobTemplate(), {
  5516. globalVariableTemplate: globalVariableTemplate
  5517. });
  5518. var decodeStringArrayTemplate = '';
  5519. var selfDefendingCode = '';
  5520. if (this.options.selfDefending) {
  5521. selfDefendingCode = string_template_1.default(SelfDefendingTemplate_1.SelfDefendingTemplate(this.randomGenerator, this.escapeSequenceEncoder), {
  5522. stringArrayCallsWrapperName: this.stringArrayCallsWrapperName,
  5523. stringArrayName: this.stringArrayName
  5524. });
  5525. }
  5526. switch (this.options.stringArrayEncoding) {
  5527. case StringArrayEncoding_1.StringArrayEncoding.Rc4:
  5528. decodeStringArrayTemplate = string_template_1.default(StringArrayRC4DecodeNodeTemplate_1.StringArrayRc4DecodeNodeTemplate(this.randomGenerator), {
  5529. atobPolyfill: atobPolyfill,
  5530. rc4Polyfill: Rc4Template_1.Rc4Template(),
  5531. selfDefendingCode: selfDefendingCode,
  5532. stringArrayCallsWrapperName: this.stringArrayCallsWrapperName
  5533. });
  5534. break;
  5535. case StringArrayEncoding_1.StringArrayEncoding.Base64:
  5536. decodeStringArrayTemplate = string_template_1.default(StringArrayBase64DecodeNodeTemplate_1.StringArrayBase64DecodeNodeTemplate(this.randomGenerator), {
  5537. atobPolyfill: atobPolyfill,
  5538. selfDefendingCode: selfDefendingCode,
  5539. stringArrayCallsWrapperName: this.stringArrayCallsWrapperName
  5540. });
  5541. break;
  5542. }
  5543. return decodeStringArrayTemplate;
  5544. }
  5545. }]);
  5546. return StringArrayCallsWrapper;
  5547. }(AbstractCustomNode_1.AbstractCustomNode);
  5548. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], StringArrayCallsWrapper.prototype, "stringArrayName", void 0);
  5549. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], StringArrayCallsWrapper.prototype, "stringArrayCallsWrapperName", void 0);
  5550. 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);
  5551. exports.StringArrayCallsWrapper = StringArrayCallsWrapper;
  5552. /***/ }),
  5553. /* 127 */
  5554. /***/ (function(module, exports, __webpack_require__) {
  5555. "use strict";
  5556. Object.defineProperty(exports, "__esModule", {
  5557. value: true
  5558. });
  5559. function AtobTemplate() {
  5560. 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 ";
  5561. }
  5562. exports.AtobTemplate = AtobTemplate;
  5563. /***/ }),
  5564. /* 128 */
  5565. /***/ (function(module, exports, __webpack_require__) {
  5566. "use strict";
  5567. Object.defineProperty(exports, "__esModule", {
  5568. value: true
  5569. });
  5570. function Rc4Template() {
  5571. 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 ";
  5572. }
  5573. exports.Rc4Template = Rc4Template;
  5574. /***/ }),
  5575. /* 129 */
  5576. /***/ (function(module, exports, __webpack_require__) {
  5577. "use strict";
  5578. Object.defineProperty(exports, "__esModule", {
  5579. value: true
  5580. });
  5581. function SelfDefendingTemplate(randomGenerator, escapeSequenceEncoder) {
  5582. var identifierLength = 6;
  5583. var rc4BytesIdentifier = randomGenerator.getRandomString(identifierLength);
  5584. var statesIdentifier = randomGenerator.getRandomString(identifierLength);
  5585. var newStateIdentifier = randomGenerator.getRandomString(identifierLength);
  5586. var firstStateIdentifier = randomGenerator.getRandomString(identifierLength);
  5587. var secondStateIdentifier = randomGenerator.getRandomString(identifierLength);
  5588. var checkStateIdentifier = randomGenerator.getRandomString(identifierLength);
  5589. var runStateIdentifier = randomGenerator.getRandomString(identifierLength);
  5590. var getStateIdentifier = randomGenerator.getRandomString(identifierLength);
  5591. var stateResultIdentifier = randomGenerator.getRandomString(identifierLength);
  5592. return "\n var StatesClass = function (".concat(rc4BytesIdentifier, ") {\n this.").concat(rc4BytesIdentifier, " = ").concat(rc4BytesIdentifier, ";\n this.").concat(statesIdentifier, " = [1, 0, 0];\n this.").concat(newStateIdentifier, " = function(){return 'newState';};\n this.").concat(firstStateIdentifier, " = '").concat(escapeSequenceEncoder.encode("\\w+ *\\(\\) *{\\w+ *", true), "';\n this.").concat(secondStateIdentifier, " = '").concat(escapeSequenceEncoder.encode("['|\"].+['|\"];? *}", true), "';\n };\n \n StatesClass.prototype.").concat(checkStateIdentifier, " = function () {\n var regExp = new RegExp(this.").concat(firstStateIdentifier, " + this.").concat(secondStateIdentifier, ");\n var expression = regExp.test(this.").concat(newStateIdentifier, ".toString())\n ? --this.").concat(statesIdentifier, "[1]\n : --this.").concat(statesIdentifier, "[0];\n \n return this.").concat(runStateIdentifier, "(expression);\n };\n \n StatesClass.prototype.").concat(runStateIdentifier, " = function (").concat(stateResultIdentifier, ") {\n if (!Boolean(~").concat(stateResultIdentifier, ")) {\n return ").concat(stateResultIdentifier, ";\n }\n \n return this.").concat(getStateIdentifier, "(this.").concat(rc4BytesIdentifier, ");\n };\n\n StatesClass.prototype.").concat(getStateIdentifier, " = function (").concat(rc4BytesIdentifier, ") {\n for (var i = 0, len = this.").concat(statesIdentifier, ".length; i < len; i++) {\n this.").concat(statesIdentifier, ".push(Math.round(Math.random()));\n len = this.").concat(statesIdentifier, ".length;\n }\n \n return ").concat(rc4BytesIdentifier, "(this.").concat(statesIdentifier, "[0]);\n };\n\n new StatesClass({stringArrayCallsWrapperName}).").concat(checkStateIdentifier, "();\n ");
  5593. }
  5594. exports.SelfDefendingTemplate = SelfDefendingTemplate;
  5595. /***/ }),
  5596. /* 130 */
  5597. /***/ (function(module, exports, __webpack_require__) {
  5598. "use strict";
  5599. Object.defineProperty(exports, "__esModule", {
  5600. value: true
  5601. });
  5602. function StringArrayBase64DecodeNodeTemplate(randomGenerator) {
  5603. var identifierLength = 6;
  5604. var initializedIdentifier = randomGenerator.getRandomString(identifierLength);
  5605. var base64DecodeFunctionIdentifier = randomGenerator.getRandomString(identifierLength);
  5606. var dataIdentifier = randomGenerator.getRandomString(identifierLength);
  5607. return "\n if ({stringArrayCallsWrapperName}.".concat(initializedIdentifier, " === undefined) {\n {atobPolyfill}\n \n {stringArrayCallsWrapperName}.").concat(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}.").concat(dataIdentifier, " = {};\n \n {stringArrayCallsWrapperName}.").concat(initializedIdentifier, " = true;\n }\n \n var cachedValue = {stringArrayCallsWrapperName}.").concat(dataIdentifier, "[index];\n \n if (cachedValue === undefined) {\n {selfDefendingCode}\n \n value = {stringArrayCallsWrapperName}.").concat(base64DecodeFunctionIdentifier, "(value);\n {stringArrayCallsWrapperName}.").concat(dataIdentifier, "[index] = value;\n } else {\n value = cachedValue;\n }\n ");
  5608. }
  5609. exports.StringArrayBase64DecodeNodeTemplate = StringArrayBase64DecodeNodeTemplate;
  5610. /***/ }),
  5611. /* 131 */
  5612. /***/ (function(module, exports, __webpack_require__) {
  5613. "use strict";
  5614. Object.defineProperty(exports, "__esModule", {
  5615. value: true
  5616. });
  5617. function StringArrayCallsWrapperTemplate() {
  5618. 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 ";
  5619. }
  5620. exports.StringArrayCallsWrapperTemplate = StringArrayCallsWrapperTemplate;
  5621. /***/ }),
  5622. /* 132 */
  5623. /***/ (function(module, exports, __webpack_require__) {
  5624. "use strict";
  5625. Object.defineProperty(exports, "__esModule", {
  5626. value: true
  5627. });
  5628. function StringArrayRc4DecodeNodeTemplate(randomGenerator) {
  5629. var identifierLength = 6;
  5630. var initializedIdentifier = randomGenerator.getRandomString(identifierLength);
  5631. var rc4Identifier = randomGenerator.getRandomString(identifierLength);
  5632. var dataIdentifier = randomGenerator.getRandomString(identifierLength);
  5633. var onceIdentifier = randomGenerator.getRandomString(identifierLength);
  5634. return "\n if ({stringArrayCallsWrapperName}.".concat(initializedIdentifier, " === undefined) {\n {atobPolyfill}\n \n {rc4Polyfill}\n {stringArrayCallsWrapperName}.").concat(rc4Identifier, " = rc4;\n \n {stringArrayCallsWrapperName}.").concat(dataIdentifier, " = {};\n \n {stringArrayCallsWrapperName}.").concat(initializedIdentifier, " = true;\n }\n \n var cachedValue = {stringArrayCallsWrapperName}.").concat(dataIdentifier, "[index];\n\n if (cachedValue === undefined) {\n if ({stringArrayCallsWrapperName}.").concat(onceIdentifier, " === undefined) {\n {selfDefendingCode}\n \n {stringArrayCallsWrapperName}.").concat(onceIdentifier, " = true;\n }\n \n value = {stringArrayCallsWrapperName}.").concat(rc4Identifier, "(value, key);\n {stringArrayCallsWrapperName}.").concat(dataIdentifier, "[index] = value;\n } else {\n value = cachedValue;\n }\n ");
  5635. }
  5636. exports.StringArrayRc4DecodeNodeTemplate = StringArrayRc4DecodeNodeTemplate;
  5637. /***/ }),
  5638. /* 133 */
  5639. /***/ (function(module, exports, __webpack_require__) {
  5640. "use strict";
  5641. var _Object$getPrototypeOf = __webpack_require__(5);
  5642. var _classCallCheck = __webpack_require__(0);
  5643. var _createClass = __webpack_require__(2);
  5644. var _possibleConstructorReturn = __webpack_require__(6);
  5645. var _get = __webpack_require__(45);
  5646. var _inherits = __webpack_require__(7);
  5647. Object.defineProperty(exports, "__esModule", {
  5648. value: true
  5649. });
  5650. var tslib_1 = __webpack_require__(4);
  5651. var inversify_1 = __webpack_require__(1);
  5652. var ServiceIdentifiers_1 = __webpack_require__(3);
  5653. var string_template_1 = tslib_1.__importDefault(__webpack_require__(19));
  5654. var Initializable_1 = __webpack_require__(10);
  5655. var StringArrayTemplate_1 = __webpack_require__(134);
  5656. var AbstractCustomNode_1 = __webpack_require__(14);
  5657. var NodeUtils_1 = __webpack_require__(9);
  5658. var StringArrayNode =
  5659. /*#__PURE__*/
  5660. function (_AbstractCustomNode_) {
  5661. _inherits(StringArrayNode, _AbstractCustomNode_);
  5662. function StringArrayNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  5663. _classCallCheck(this, StringArrayNode);
  5664. return _possibleConstructorReturn(this, (StringArrayNode.__proto__ || _Object$getPrototypeOf(StringArrayNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  5665. }
  5666. _createClass(StringArrayNode, [{
  5667. key: "initialize",
  5668. value: function initialize(stringArrayStorage, stringArrayName, stringArrayRotateValue) {
  5669. this.stringArrayStorage = stringArrayStorage;
  5670. this.stringArrayName = stringArrayName;
  5671. this.stringArrayRotateValue = stringArrayRotateValue;
  5672. }
  5673. }, {
  5674. key: "getNode",
  5675. value: function getNode() {
  5676. this.stringArrayStorage.rotateArray(this.stringArrayRotateValue);
  5677. return _get(StringArrayNode.prototype.__proto__ || _Object$getPrototypeOf(StringArrayNode.prototype), "getNode", this).call(this);
  5678. }
  5679. }, {
  5680. key: "getNodeStructure",
  5681. value: function getNodeStructure() {
  5682. return NodeUtils_1.NodeUtils.convertCodeToStructure(this.getTemplate());
  5683. }
  5684. }, {
  5685. key: "getTemplate",
  5686. value: function getTemplate() {
  5687. return string_template_1.default(StringArrayTemplate_1.StringArrayTemplate(), {
  5688. stringArrayName: this.stringArrayName,
  5689. stringArray: this.stringArrayStorage.toString()
  5690. });
  5691. }
  5692. }]);
  5693. return StringArrayNode;
  5694. }(AbstractCustomNode_1.AbstractCustomNode);
  5695. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], StringArrayNode.prototype, "stringArrayStorage", void 0);
  5696. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], StringArrayNode.prototype, "stringArrayName", void 0);
  5697. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Number)], StringArrayNode.prototype, "stringArrayRotateValue", void 0);
  5698. 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);
  5699. exports.StringArrayNode = StringArrayNode;
  5700. /***/ }),
  5701. /* 134 */
  5702. /***/ (function(module, exports, __webpack_require__) {
  5703. "use strict";
  5704. Object.defineProperty(exports, "__esModule", {
  5705. value: true
  5706. });
  5707. function StringArrayTemplate() {
  5708. return "\n var {stringArrayName} = [{stringArray}];\n ";
  5709. }
  5710. exports.StringArrayTemplate = StringArrayTemplate;
  5711. /***/ }),
  5712. /* 135 */
  5713. /***/ (function(module, exports, __webpack_require__) {
  5714. "use strict";
  5715. var _Object$assign = __webpack_require__(11);
  5716. var _Object$getPrototypeOf = __webpack_require__(5);
  5717. var _classCallCheck = __webpack_require__(0);
  5718. var _createClass = __webpack_require__(2);
  5719. var _possibleConstructorReturn = __webpack_require__(6);
  5720. var _inherits = __webpack_require__(7);
  5721. Object.defineProperty(exports, "__esModule", {
  5722. value: true
  5723. });
  5724. var tslib_1 = __webpack_require__(4);
  5725. var inversify_1 = __webpack_require__(1);
  5726. var ServiceIdentifiers_1 = __webpack_require__(3);
  5727. var string_template_1 = tslib_1.__importDefault(__webpack_require__(19));
  5728. var Initializable_1 = __webpack_require__(10);
  5729. var NoCustomNodes_1 = __webpack_require__(39);
  5730. var SelfDefendingTemplate_1 = __webpack_require__(136);
  5731. var StringArrayRotateFunctionTemplate_1 = __webpack_require__(137);
  5732. var AbstractCustomNode_1 = __webpack_require__(14);
  5733. var JavaScriptObfuscatorFacade_1 = __webpack_require__(27);
  5734. var NodeUtils_1 = __webpack_require__(9);
  5735. var Utils_1 = __webpack_require__(32);
  5736. var StringArrayRotateFunctionNode =
  5737. /*#__PURE__*/
  5738. function (_AbstractCustomNode_) {
  5739. _inherits(StringArrayRotateFunctionNode, _AbstractCustomNode_);
  5740. function StringArrayRotateFunctionNode(identifierNamesGeneratorFactory, randomGenerator, escapeSequenceEncoder, options) {
  5741. var _this;
  5742. _classCallCheck(this, StringArrayRotateFunctionNode);
  5743. _this = _possibleConstructorReturn(this, (StringArrayRotateFunctionNode.__proto__ || _Object$getPrototypeOf(StringArrayRotateFunctionNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  5744. _this.escapeSequenceEncoder = escapeSequenceEncoder;
  5745. return _this;
  5746. }
  5747. _createClass(StringArrayRotateFunctionNode, [{
  5748. key: "initialize",
  5749. value: function initialize(stringArrayName, stringArrayRotateValue) {
  5750. this.stringArrayName = stringArrayName;
  5751. this.stringArrayRotateValue = stringArrayRotateValue;
  5752. }
  5753. }, {
  5754. key: "getNodeStructure",
  5755. value: function getNodeStructure() {
  5756. return NodeUtils_1.NodeUtils.convertCodeToStructure(this.getTemplate());
  5757. }
  5758. }, {
  5759. key: "getTemplate",
  5760. value: function getTemplate() {
  5761. var timesName = this.identifierNamesGenerator.generate();
  5762. var whileFunctionName = this.identifierNamesGenerator.generate();
  5763. var code = '';
  5764. if (this.options.selfDefending) {
  5765. code = string_template_1.default(SelfDefendingTemplate_1.SelfDefendingTemplate(this.escapeSequenceEncoder), {
  5766. timesName: timesName,
  5767. whileFunctionName: whileFunctionName
  5768. });
  5769. } else {
  5770. code = "".concat(whileFunctionName, "(++").concat(timesName, ")");
  5771. }
  5772. return JavaScriptObfuscatorFacade_1.JavaScriptObfuscator.obfuscate(string_template_1.default(StringArrayRotateFunctionTemplate_1.StringArrayRotateFunctionTemplate(), {
  5773. code: code,
  5774. timesName: timesName,
  5775. stringArrayName: this.stringArrayName,
  5776. stringArrayRotateValue: Utils_1.Utils.decToHex(this.stringArrayRotateValue),
  5777. whileFunctionName: whileFunctionName
  5778. }), _Object$assign({}, NoCustomNodes_1.NO_ADDITIONAL_NODES_PRESET, {
  5779. identifierNamesGenerator: this.options.identifierNamesGenerator,
  5780. seed: this.options.seed
  5781. })).getObfuscatedCode();
  5782. }
  5783. }]);
  5784. return StringArrayRotateFunctionNode;
  5785. }(AbstractCustomNode_1.AbstractCustomNode);
  5786. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], StringArrayRotateFunctionNode.prototype, "stringArrayName", void 0);
  5787. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Number)], StringArrayRotateFunctionNode.prototype, "stringArrayRotateValue", void 0);
  5788. 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);
  5789. exports.StringArrayRotateFunctionNode = StringArrayRotateFunctionNode;
  5790. /***/ }),
  5791. /* 136 */
  5792. /***/ (function(module, exports, __webpack_require__) {
  5793. "use strict";
  5794. Object.defineProperty(exports, "__esModule", {
  5795. value: true
  5796. });
  5797. function SelfDefendingTemplate(escapeSequenceEncoder) {
  5798. 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('".concat(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 ");
  5799. }
  5800. exports.SelfDefendingTemplate = SelfDefendingTemplate;
  5801. /***/ }),
  5802. /* 137 */
  5803. /***/ (function(module, exports, __webpack_require__) {
  5804. "use strict";
  5805. Object.defineProperty(exports, "__esModule", {
  5806. value: true
  5807. });
  5808. function StringArrayRotateFunctionTemplate() {
  5809. 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 ";
  5810. }
  5811. exports.StringArrayRotateFunctionTemplate = StringArrayRotateFunctionTemplate;
  5812. /***/ }),
  5813. /* 138 */
  5814. /***/ (function(module, exports, __webpack_require__) {
  5815. "use strict";
  5816. Object.defineProperty(exports, "__esModule", {
  5817. value: true
  5818. });
  5819. var JSFuck;
  5820. (function (JSFuck) {
  5821. JSFuck["False"] = "![]";
  5822. JSFuck["True"] = "!![]";
  5823. JSFuck["a"] = "(false+\"\")[1]";
  5824. JSFuck["b"] = "([][\"entries\"]()+\"\")[2]";
  5825. JSFuck["c"] = "([][\"fill\"]+\"\")[3]";
  5826. JSFuck["d"] = "(undefined+\"\")[2]";
  5827. JSFuck["e"] = "(true+\"\")[3]";
  5828. JSFuck["f"] = "(false+\"\")[0]";
  5829. JSFuck["g"] = "(false+[0]+String)[20]";
  5830. JSFuck["h"] = "(+(101))[\"toString\"](21)[1]";
  5831. JSFuck["i"] = "([false]+undefined)[10]";
  5832. JSFuck["j"] = "([][\"entries\"]()+\"\")[3]";
  5833. JSFuck["k"] = "(+(20))[\"toString\"](21)";
  5834. JSFuck["l"] = "(false+\"\")[2]";
  5835. JSFuck["m"] = "(Number+\"\")[11]";
  5836. JSFuck["n"] = "(undefined+\"\")[1]";
  5837. JSFuck["o"] = "(true+[][\"fill\"])[10]";
  5838. JSFuck["p"] = "(+(211))[\"toString\"](31)[1]";
  5839. JSFuck["q"] = "(+(212))[\"toString\"](31)[1]";
  5840. JSFuck["r"] = "(true+\"\")[1]";
  5841. JSFuck["s"] = "(false+\"\")[3]";
  5842. JSFuck["t"] = "(true+\"\")[0]";
  5843. JSFuck["u"] = "(undefined+\"\")[0]";
  5844. JSFuck["v"] = "(+(31))[\"toString\"](32)";
  5845. JSFuck["w"] = "(+(32))[\"toString\"](33)";
  5846. JSFuck["x"] = "(+(101))[\"toString\"](34)[1]";
  5847. JSFuck["y"] = "(NaN+[Infinity])[10]";
  5848. JSFuck["z"] = "(+(35))[\"toString\"](36)";
  5849. JSFuck["A"] = "(+[]+Array)[10]";
  5850. JSFuck["B"] = "(+[]+Boolean)[10]";
  5851. JSFuck["C"] = "Function(\"return escape\")()((\"\")[\"italics\"]())[2]";
  5852. JSFuck["D"] = "Function(\"return escape\")()([][\"fill\"])[\"slice\"](\"-1\")";
  5853. JSFuck["E"] = "(RegExp+\"\")[12]";
  5854. JSFuck["F"] = "(+[]+Function)[10]";
  5855. JSFuck["G"] = "(false+Function(\"return Date\")()())[30]";
  5856. JSFuck["H"] = "'H'";
  5857. JSFuck["I"] = "(Infinity+\"\")[0]";
  5858. JSFuck["J"] = "'J'";
  5859. JSFuck["K"] = "'K'";
  5860. JSFuck["L"] = "'L'";
  5861. JSFuck["M"] = "(true+Function(\"return Date\")()())[30]";
  5862. JSFuck["N"] = "(NaN+\"\")[0]";
  5863. JSFuck["O"] = "(NaN+Function(\"return{}\")())[11]";
  5864. JSFuck["P"] = "'P'";
  5865. JSFuck["Q"] = "'Q'";
  5866. JSFuck["R"] = "(+[]+RegExp)[10]";
  5867. JSFuck["S"] = "(+[]+String)[10]";
  5868. JSFuck["T"] = "(NaN+Function(\"return Date\")()())[30]";
  5869. JSFuck["U"] = "(NaN+Function(\"return{}\")()[\"toString\"][\"call\"]())[11]";
  5870. JSFuck["V"] = "'V'";
  5871. JSFuck["W"] = "'W'";
  5872. JSFuck["X"] = "'X'";
  5873. JSFuck["Y"] = "'Y'";
  5874. JSFuck["Z"] = "'Z'";
  5875. })(JSFuck = exports.JSFuck || (exports.JSFuck = {}));
  5876. /***/ }),
  5877. /* 139 */
  5878. /***/ (function(module, exports, __webpack_require__) {
  5879. "use strict";
  5880. var _Object$getPrototypeOf = __webpack_require__(5);
  5881. var _classCallCheck = __webpack_require__(0);
  5882. var _createClass = __webpack_require__(2);
  5883. var _possibleConstructorReturn = __webpack_require__(6);
  5884. var _inherits = __webpack_require__(7);
  5885. Object.defineProperty(exports, "__esModule", {
  5886. value: true
  5887. });
  5888. var tslib_1 = __webpack_require__(4);
  5889. var inversify_1 = __webpack_require__(1);
  5890. var ServiceIdentifiers_1 = __webpack_require__(3);
  5891. var Initializable_1 = __webpack_require__(10);
  5892. var AbstractCustomNode_1 = __webpack_require__(14);
  5893. var Nodes_1 = __webpack_require__(15);
  5894. var NodeUtils_1 = __webpack_require__(9);
  5895. var StringLiteralControlFlowStorageCallNode =
  5896. /*#__PURE__*/
  5897. function (_AbstractCustomNode_) {
  5898. _inherits(StringLiteralControlFlowStorageCallNode, _AbstractCustomNode_);
  5899. function StringLiteralControlFlowStorageCallNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  5900. _classCallCheck(this, StringLiteralControlFlowStorageCallNode);
  5901. return _possibleConstructorReturn(this, (StringLiteralControlFlowStorageCallNode.__proto__ || _Object$getPrototypeOf(StringLiteralControlFlowStorageCallNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  5902. }
  5903. _createClass(StringLiteralControlFlowStorageCallNode, [{
  5904. key: "initialize",
  5905. value: function initialize(controlFlowStorageName, controlFlowStorageKey) {
  5906. this.controlFlowStorageName = controlFlowStorageName;
  5907. this.controlFlowStorageKey = controlFlowStorageKey;
  5908. }
  5909. }, {
  5910. key: "getNodeStructure",
  5911. value: function getNodeStructure() {
  5912. var structure = Nodes_1.Nodes.getExpressionStatementNode(Nodes_1.Nodes.getMemberExpressionNode(Nodes_1.Nodes.getIdentifierNode(this.controlFlowStorageName), Nodes_1.Nodes.getIdentifierNode(this.controlFlowStorageKey)));
  5913. NodeUtils_1.NodeUtils.parentize(structure);
  5914. return [structure];
  5915. }
  5916. }]);
  5917. return StringLiteralControlFlowStorageCallNode;
  5918. }(AbstractCustomNode_1.AbstractCustomNode);
  5919. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], StringLiteralControlFlowStorageCallNode.prototype, "controlFlowStorageKey", void 0);
  5920. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], StringLiteralControlFlowStorageCallNode.prototype, "controlFlowStorageName", void 0);
  5921. 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);
  5922. exports.StringLiteralControlFlowStorageCallNode = StringLiteralControlFlowStorageCallNode;
  5923. /***/ }),
  5924. /* 140 */
  5925. /***/ (function(module, exports, __webpack_require__) {
  5926. "use strict";
  5927. var _Object$getPrototypeOf = __webpack_require__(5);
  5928. var _classCallCheck = __webpack_require__(0);
  5929. var _createClass = __webpack_require__(2);
  5930. var _possibleConstructorReturn = __webpack_require__(6);
  5931. var _inherits = __webpack_require__(7);
  5932. Object.defineProperty(exports, "__esModule", {
  5933. value: true
  5934. });
  5935. var tslib_1 = __webpack_require__(4);
  5936. var inversify_1 = __webpack_require__(1);
  5937. var ServiceIdentifiers_1 = __webpack_require__(3);
  5938. var Initializable_1 = __webpack_require__(10);
  5939. var AbstractCustomNode_1 = __webpack_require__(14);
  5940. var Nodes_1 = __webpack_require__(15);
  5941. var StringLiteralNode =
  5942. /*#__PURE__*/
  5943. function (_AbstractCustomNode_) {
  5944. _inherits(StringLiteralNode, _AbstractCustomNode_);
  5945. function StringLiteralNode(identifierNamesGeneratorFactory, randomGenerator, options) {
  5946. _classCallCheck(this, StringLiteralNode);
  5947. return _possibleConstructorReturn(this, (StringLiteralNode.__proto__ || _Object$getPrototypeOf(StringLiteralNode)).call(this, identifierNamesGeneratorFactory, randomGenerator, options));
  5948. }
  5949. _createClass(StringLiteralNode, [{
  5950. key: "initialize",
  5951. value: function initialize(literalValue) {
  5952. this.literalValue = literalValue;
  5953. }
  5954. }, {
  5955. key: "getNodeStructure",
  5956. value: function getNodeStructure() {
  5957. var structure = Nodes_1.Nodes.getExpressionStatementNode(Nodes_1.Nodes.getLiteralNode(this.literalValue));
  5958. return [structure];
  5959. }
  5960. }]);
  5961. return StringLiteralNode;
  5962. }(AbstractCustomNode_1.AbstractCustomNode);
  5963. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], StringLiteralNode.prototype, "literalValue", void 0);
  5964. 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);
  5965. exports.StringLiteralNode = StringLiteralNode;
  5966. /***/ }),
  5967. /* 141 */
  5968. /***/ (function(module, exports, __webpack_require__) {
  5969. "use strict";
  5970. Object.defineProperty(exports, "__esModule", {
  5971. value: true
  5972. });
  5973. var inversify_1 = __webpack_require__(1);
  5974. exports.finalizingTransformersModule = new inversify_1.ContainerModule(function (bind) {});
  5975. /***/ }),
  5976. /* 142 */
  5977. /***/ (function(module, exports, __webpack_require__) {
  5978. "use strict";
  5979. Object.defineProperty(exports, "__esModule", {
  5980. value: true
  5981. });
  5982. var inversify_1 = __webpack_require__(1);
  5983. var ServiceIdentifiers_1 = __webpack_require__(3);
  5984. var IdentifierNamesGenerator_1 = __webpack_require__(35);
  5985. var HexadecimalIdentifierNamesGenerator_1 = __webpack_require__(143);
  5986. var MangledIdentifierNamesGenerator_1 = __webpack_require__(144);
  5987. exports.generatorsModule = new inversify_1.ContainerModule(function (bind) {
  5988. bind(ServiceIdentifiers_1.ServiceIdentifiers.IIdentifierNamesGenerator).to(HexadecimalIdentifierNamesGenerator_1.HexadecimalIdentifierNamesGenerator).inSingletonScope().whenTargetNamed(IdentifierNamesGenerator_1.IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator);
  5989. bind(ServiceIdentifiers_1.ServiceIdentifiers.IIdentifierNamesGenerator).to(MangledIdentifierNamesGenerator_1.MangledIdentifierNamesGenerator).inSingletonScope().whenTargetNamed(IdentifierNamesGenerator_1.IdentifierNamesGenerator.MangledIdentifierNamesGenerator);
  5990. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator).toFactory(function (context) {
  5991. var cachedIdentifierNamesGenerator = null;
  5992. return function (options) {
  5993. if (cachedIdentifierNamesGenerator) {
  5994. return cachedIdentifierNamesGenerator;
  5995. }
  5996. var identifierNamesGenerator;
  5997. switch (options.identifierNamesGenerator) {
  5998. case IdentifierNamesGenerator_1.IdentifierNamesGenerator.MangledIdentifierNamesGenerator:
  5999. identifierNamesGenerator = context.container.getNamed(ServiceIdentifiers_1.ServiceIdentifiers.IIdentifierNamesGenerator, IdentifierNamesGenerator_1.IdentifierNamesGenerator.MangledIdentifierNamesGenerator);
  6000. break;
  6001. case IdentifierNamesGenerator_1.IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator:
  6002. default:
  6003. identifierNamesGenerator = context.container.getNamed(ServiceIdentifiers_1.ServiceIdentifiers.IIdentifierNamesGenerator, IdentifierNamesGenerator_1.IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator);
  6004. }
  6005. cachedIdentifierNamesGenerator = identifierNamesGenerator;
  6006. return identifierNamesGenerator;
  6007. };
  6008. });
  6009. });
  6010. /***/ }),
  6011. /* 143 */
  6012. /***/ (function(module, exports, __webpack_require__) {
  6013. "use strict";
  6014. var _Set = __webpack_require__(29);
  6015. var _Object$getPrototypeOf = __webpack_require__(5);
  6016. var _classCallCheck = __webpack_require__(0);
  6017. var _createClass = __webpack_require__(2);
  6018. var _possibleConstructorReturn = __webpack_require__(6);
  6019. var _inherits = __webpack_require__(7);
  6020. Object.defineProperty(exports, "__esModule", {
  6021. value: true
  6022. });
  6023. var tslib_1 = __webpack_require__(4);
  6024. var inversify_1 = __webpack_require__(1);
  6025. var ServiceIdentifiers_1 = __webpack_require__(3);
  6026. var AbstractIdentifierNamesGenerator_1 = __webpack_require__(58);
  6027. var Utils_1 = __webpack_require__(32);
  6028. var HexadecimalIdentifierNamesGenerator = HexadecimalIdentifierNamesGenerator_1 =
  6029. /*#__PURE__*/
  6030. function (_AbstractIdentifierNa) {
  6031. _inherits(HexadecimalIdentifierNamesGenerator, _AbstractIdentifierNa);
  6032. function HexadecimalIdentifierNamesGenerator(randomGenerator, options) {
  6033. var _this;
  6034. _classCallCheck(this, HexadecimalIdentifierNamesGenerator);
  6035. _this = _possibleConstructorReturn(this, (HexadecimalIdentifierNamesGenerator.__proto__ || _Object$getPrototypeOf(HexadecimalIdentifierNamesGenerator)).call(this, randomGenerator, options));
  6036. _this.randomVariableNameSet = new _Set();
  6037. return _this;
  6038. }
  6039. _createClass(HexadecimalIdentifierNamesGenerator, [{
  6040. key: "generate",
  6041. value: function generate() {
  6042. var rangeMinInteger = 10000;
  6043. var rangeMaxInteger = 99999999;
  6044. var randomInteger = this.randomGenerator.getRandomInteger(rangeMinInteger, rangeMaxInteger);
  6045. var hexadecimalNumber = Utils_1.Utils.decToHex(randomInteger);
  6046. var baseIdentifierName = hexadecimalNumber.substr(0, HexadecimalIdentifierNamesGenerator_1.baseIdentifierNameLength);
  6047. var identifierName = "_".concat(Utils_1.Utils.hexadecimalPrefix).concat(baseIdentifierName);
  6048. if (this.randomVariableNameSet.has(identifierName)) {
  6049. return this.generate();
  6050. }
  6051. this.randomVariableNameSet.add(identifierName);
  6052. return identifierName;
  6053. }
  6054. }, {
  6055. key: "generateWithPrefix",
  6056. value: function generateWithPrefix() {
  6057. var identifierName = this.generate();
  6058. return "".concat(this.options.identifiersPrefix).concat(identifierName).replace('__', '_');
  6059. }
  6060. }]);
  6061. return HexadecimalIdentifierNamesGenerator;
  6062. }(AbstractIdentifierNamesGenerator_1.AbstractIdentifierNamesGenerator);
  6063. HexadecimalIdentifierNamesGenerator.baseIdentifierNameLength = 6;
  6064. HexadecimalIdentifierNamesGenerator = HexadecimalIdentifierNamesGenerator_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])], HexadecimalIdentifierNamesGenerator);
  6065. exports.HexadecimalIdentifierNamesGenerator = HexadecimalIdentifierNamesGenerator;
  6066. var HexadecimalIdentifierNamesGenerator_1;
  6067. /***/ }),
  6068. /* 144 */
  6069. /***/ (function(module, exports, __webpack_require__) {
  6070. "use strict";
  6071. var _Object$getPrototypeOf = __webpack_require__(5);
  6072. var _classCallCheck = __webpack_require__(0);
  6073. var _createClass = __webpack_require__(2);
  6074. var _possibleConstructorReturn = __webpack_require__(6);
  6075. var _inherits = __webpack_require__(7);
  6076. Object.defineProperty(exports, "__esModule", {
  6077. value: true
  6078. });
  6079. var tslib_1 = __webpack_require__(4);
  6080. var inversify_1 = __webpack_require__(1);
  6081. var ServiceIdentifiers_1 = __webpack_require__(3);
  6082. var AbstractIdentifierNamesGenerator_1 = __webpack_require__(58);
  6083. var MangledIdentifierNamesGenerator = MangledIdentifierNamesGenerator_1 =
  6084. /*#__PURE__*/
  6085. function (_AbstractIdentifierNa) {
  6086. _inherits(MangledIdentifierNamesGenerator, _AbstractIdentifierNa);
  6087. function MangledIdentifierNamesGenerator(randomGenerator, options) {
  6088. var _this;
  6089. _classCallCheck(this, MangledIdentifierNamesGenerator);
  6090. _this = _possibleConstructorReturn(this, (MangledIdentifierNamesGenerator.__proto__ || _Object$getPrototypeOf(MangledIdentifierNamesGenerator)).call(this, randomGenerator, options));
  6091. _this.previousMangledName = MangledIdentifierNamesGenerator_1.initMangledNameCharacter;
  6092. return _this;
  6093. }
  6094. _createClass(MangledIdentifierNamesGenerator, [{
  6095. key: "generate",
  6096. value: function generate() {
  6097. var identifierName = MangledIdentifierNamesGenerator_1.generateNewMangledName(this.previousMangledName);
  6098. this.previousMangledName = identifierName;
  6099. return identifierName;
  6100. }
  6101. }, {
  6102. key: "generateWithPrefix",
  6103. value: function generateWithPrefix() {
  6104. var prefix = this.options.identifiersPrefix ? "".concat(this.options.identifiersPrefix, "_") : '';
  6105. var identifierName = this.generate();
  6106. return "".concat(prefix).concat(identifierName);
  6107. }
  6108. }], [{
  6109. key: "generateNewMangledName",
  6110. value: function generateNewMangledName(previousMangledName) {
  6111. var generateNewMangledName = function generateNewMangledName(name) {
  6112. var nameSequence = MangledIdentifierNamesGenerator_1.nameSequence;
  6113. var nameLength = name.length;
  6114. var zeroSequence = function zeroSequence(num) {
  6115. return '0'.repeat(num);
  6116. };
  6117. var index = nameLength - 1;
  6118. do {
  6119. var character = name.charAt(index);
  6120. var indexInSequence = nameSequence.indexOf(character);
  6121. var lastNameSequenceIndex = nameSequence.length - 1;
  6122. if (indexInSequence !== lastNameSequenceIndex) {
  6123. var previousNamePart = name.substring(0, index);
  6124. var nextCharacter = nameSequence[indexInSequence + 1];
  6125. var zeroSequenceLength = nameLength - (index + 1);
  6126. var zeroSequenceCharacters = zeroSequence(zeroSequenceLength);
  6127. return previousNamePart + nextCharacter + zeroSequenceCharacters;
  6128. }
  6129. --index;
  6130. } while (index >= 0);
  6131. return "a".concat(zeroSequence(nameLength));
  6132. };
  6133. var newMangledName = generateNewMangledName(previousMangledName);
  6134. if (!MangledIdentifierNamesGenerator_1.validateMangledName(newMangledName)) {
  6135. newMangledName = MangledIdentifierNamesGenerator_1.generateNewMangledName(newMangledName);
  6136. }
  6137. return newMangledName;
  6138. }
  6139. }, {
  6140. key: "validateMangledName",
  6141. value: function validateMangledName(mangledName) {
  6142. return !MangledIdentifierNamesGenerator_1.reservedNames.includes(mangledName);
  6143. }
  6144. }]);
  6145. return MangledIdentifierNamesGenerator;
  6146. }(AbstractIdentifierNamesGenerator_1.AbstractIdentifierNamesGenerator);
  6147. MangledIdentifierNamesGenerator.initMangledNameCharacter = '9';
  6148. MangledIdentifierNamesGenerator.nameSequence = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
  6149. MangledIdentifierNamesGenerator.reservedNames = ['byte', 'case', 'char', 'do', 'else', 'enum', 'eval', 'for', 'goto', 'if', 'in', 'int', 'let', 'long', 'new', 'null', 'this', 'true', 'try', 'var', 'void', 'with'];
  6150. 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);
  6151. exports.MangledIdentifierNamesGenerator = MangledIdentifierNamesGenerator;
  6152. var MangledIdentifierNamesGenerator_1;
  6153. /***/ }),
  6154. /* 145 */
  6155. /***/ (function(module, exports, __webpack_require__) {
  6156. "use strict";
  6157. Object.defineProperty(exports, "__esModule", {
  6158. value: true
  6159. });
  6160. var InversifyContainerFacade_1 = __webpack_require__(22);
  6161. var inversify_1 = __webpack_require__(1);
  6162. var ServiceIdentifiers_1 = __webpack_require__(3);
  6163. exports.nodeTransformersModule = new inversify_1.ContainerModule(function (bind) {
  6164. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__INodeTransformer).toFactory(InversifyContainerFacade_1.InversifyContainerFacade.getCacheFactory(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer));
  6165. });
  6166. /***/ }),
  6167. /* 146 */
  6168. /***/ (function(module, exports, __webpack_require__) {
  6169. "use strict";
  6170. Object.defineProperty(exports, "__esModule", {
  6171. value: true
  6172. });
  6173. var InversifyContainerFacade_1 = __webpack_require__(22);
  6174. var inversify_1 = __webpack_require__(1);
  6175. var ServiceIdentifiers_1 = __webpack_require__(3);
  6176. var IdentifierObfuscatingReplacer_1 = __webpack_require__(26);
  6177. var LiteralObfuscatingReplacer_1 = __webpack_require__(59);
  6178. var NodeTransformer_1 = __webpack_require__(28);
  6179. var BaseIdentifierObfuscatingReplacer_1 = __webpack_require__(147);
  6180. var BooleanLiteralObfuscatingReplacer_1 = __webpack_require__(148);
  6181. var CatchClauseTransformer_1 = __webpack_require__(149);
  6182. var ClassDeclarationTransformer_1 = __webpack_require__(150);
  6183. var FunctionDeclarationTransformer_1 = __webpack_require__(151);
  6184. var FunctionTransformer_1 = __webpack_require__(152);
  6185. var LabeledStatementTransformer_1 = __webpack_require__(153);
  6186. var LiteralTransformer_1 = __webpack_require__(154);
  6187. var NumberLiteralObfuscatingReplacer_1 = __webpack_require__(155);
  6188. var ObjectExpressionTransformer_1 = __webpack_require__(156);
  6189. var StringLiteralObfuscatingReplacer_1 = __webpack_require__(157);
  6190. var VariableDeclarationTransformer_1 = __webpack_require__(158);
  6191. exports.obfuscatingTransformersModule = new inversify_1.ContainerModule(function (bind) {
  6192. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(CatchClauseTransformer_1.CatchClauseTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.CatchClauseTransformer);
  6193. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(ClassDeclarationTransformer_1.ClassDeclarationTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.ClassDeclarationTransformer);
  6194. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(FunctionDeclarationTransformer_1.FunctionDeclarationTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.FunctionDeclarationTransformer);
  6195. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(FunctionTransformer_1.FunctionTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.FunctionTransformer);
  6196. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(LabeledStatementTransformer_1.LabeledStatementTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.LabeledStatementTransformer);
  6197. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(LiteralTransformer_1.LiteralTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.LiteralTransformer);
  6198. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(ObjectExpressionTransformer_1.ObjectExpressionTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.ObjectExpressionTransformer);
  6199. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(VariableDeclarationTransformer_1.VariableDeclarationTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.VariableDeclarationTransformer);
  6200. bind(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscatingReplacer).to(BooleanLiteralObfuscatingReplacer_1.BooleanLiteralObfuscatingReplacer).whenTargetNamed(LiteralObfuscatingReplacer_1.LiteralObfuscatingReplacer.BooleanLiteralObfuscatingReplacer);
  6201. bind(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscatingReplacer).to(NumberLiteralObfuscatingReplacer_1.NumberLiteralObfuscatingReplacer).whenTargetNamed(LiteralObfuscatingReplacer_1.LiteralObfuscatingReplacer.NumberLiteralObfuscatingReplacer);
  6202. bind(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscatingReplacer).to(StringLiteralObfuscatingReplacer_1.StringLiteralObfuscatingReplacer).whenTargetNamed(LiteralObfuscatingReplacer_1.LiteralObfuscatingReplacer.StringLiteralObfuscatingReplacer);
  6203. bind(ServiceIdentifiers_1.ServiceIdentifiers.IIdentifierObfuscatingReplacer).to(BaseIdentifierObfuscatingReplacer_1.BaseIdentifierObfuscatingReplacer).whenTargetNamed(IdentifierObfuscatingReplacer_1.IdentifierObfuscatingReplacer.BaseIdentifierObfuscatingReplacer);
  6204. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObfuscatingReplacer).toFactory(InversifyContainerFacade_1.InversifyContainerFacade.getCacheFactory(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscatingReplacer));
  6205. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierObfuscatingReplacer).toFactory(InversifyContainerFacade_1.InversifyContainerFacade.getCacheFactory(ServiceIdentifiers_1.ServiceIdentifiers.IIdentifierObfuscatingReplacer));
  6206. });
  6207. /***/ }),
  6208. /* 147 */
  6209. /***/ (function(module, exports, __webpack_require__) {
  6210. "use strict";
  6211. var _Map = __webpack_require__(16);
  6212. var _Object$getPrototypeOf = __webpack_require__(5);
  6213. var _classCallCheck = __webpack_require__(0);
  6214. var _createClass = __webpack_require__(2);
  6215. var _possibleConstructorReturn = __webpack_require__(6);
  6216. var _inherits = __webpack_require__(7);
  6217. Object.defineProperty(exports, "__esModule", {
  6218. value: true
  6219. });
  6220. var tslib_1 = __webpack_require__(4);
  6221. var inversify_1 = __webpack_require__(1);
  6222. var ServiceIdentifiers_1 = __webpack_require__(3);
  6223. var AbstractObfuscatingReplacer_1 = __webpack_require__(40);
  6224. var Nodes_1 = __webpack_require__(15);
  6225. var BaseIdentifierObfuscatingReplacer =
  6226. /*#__PURE__*/
  6227. function (_AbstractObfuscatingR) {
  6228. _inherits(BaseIdentifierObfuscatingReplacer, _AbstractObfuscatingR);
  6229. function BaseIdentifierObfuscatingReplacer(identifierNamesGeneratorFactory, options) {
  6230. var _this;
  6231. _classCallCheck(this, BaseIdentifierObfuscatingReplacer);
  6232. _this = _possibleConstructorReturn(this, (BaseIdentifierObfuscatingReplacer.__proto__ || _Object$getPrototypeOf(BaseIdentifierObfuscatingReplacer)).call(this, options));
  6233. _this.namesMap = new _Map();
  6234. _this.identifierNamesGenerator = identifierNamesGeneratorFactory(options);
  6235. return _this;
  6236. }
  6237. _createClass(BaseIdentifierObfuscatingReplacer, [{
  6238. key: "replace",
  6239. value: function replace(nodeValue, nodeIdentifier) {
  6240. var mapKey = "".concat(nodeValue, "-").concat(String(nodeIdentifier));
  6241. if (this.namesMap.has(mapKey)) {
  6242. nodeValue = this.namesMap.get(mapKey);
  6243. }
  6244. return Nodes_1.Nodes.getIdentifierNode(nodeValue);
  6245. }
  6246. }, {
  6247. key: "storeGlobalName",
  6248. value: function storeGlobalName(nodeName, nodeIdentifier) {
  6249. if (this.isReservedName(nodeName)) {
  6250. return;
  6251. }
  6252. var identifierName = this.identifierNamesGenerator.generateWithPrefix();
  6253. this.namesMap.set("".concat(nodeName, "-").concat(String(nodeIdentifier)), identifierName);
  6254. }
  6255. }, {
  6256. key: "storeLocalName",
  6257. value: function storeLocalName(nodeName, nodeIdentifier) {
  6258. if (this.isReservedName(nodeName)) {
  6259. return;
  6260. }
  6261. var identifierName = this.identifierNamesGenerator.generate();
  6262. this.namesMap.set("".concat(nodeName, "-").concat(String(nodeIdentifier)), identifierName);
  6263. }
  6264. }, {
  6265. key: "isReservedName",
  6266. value: function isReservedName(name) {
  6267. return this.options.reservedNames.some(function (reservedName) {
  6268. return new RegExp(reservedName, 'g').exec(name) !== null;
  6269. });
  6270. }
  6271. }]);
  6272. return BaseIdentifierObfuscatingReplacer;
  6273. }(AbstractObfuscatingReplacer_1.AbstractObfuscatingReplacer);
  6274. 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);
  6275. exports.BaseIdentifierObfuscatingReplacer = BaseIdentifierObfuscatingReplacer;
  6276. /***/ }),
  6277. /* 148 */
  6278. /***/ (function(module, exports, __webpack_require__) {
  6279. "use strict";
  6280. var _Object$getPrototypeOf = __webpack_require__(5);
  6281. var _classCallCheck = __webpack_require__(0);
  6282. var _createClass = __webpack_require__(2);
  6283. var _possibleConstructorReturn = __webpack_require__(6);
  6284. var _inherits = __webpack_require__(7);
  6285. Object.defineProperty(exports, "__esModule", {
  6286. value: true
  6287. });
  6288. var tslib_1 = __webpack_require__(4);
  6289. var inversify_1 = __webpack_require__(1);
  6290. var ServiceIdentifiers_1 = __webpack_require__(3);
  6291. var AbstractObfuscatingReplacer_1 = __webpack_require__(40);
  6292. var Nodes_1 = __webpack_require__(15);
  6293. var BooleanLiteralObfuscatingReplacer = BooleanLiteralObfuscatingReplacer_1 =
  6294. /*#__PURE__*/
  6295. function (_AbstractObfuscatingR) {
  6296. _inherits(BooleanLiteralObfuscatingReplacer, _AbstractObfuscatingR);
  6297. function BooleanLiteralObfuscatingReplacer(options) {
  6298. _classCallCheck(this, BooleanLiteralObfuscatingReplacer);
  6299. return _possibleConstructorReturn(this, (BooleanLiteralObfuscatingReplacer.__proto__ || _Object$getPrototypeOf(BooleanLiteralObfuscatingReplacer)).call(this, options));
  6300. }
  6301. _createClass(BooleanLiteralObfuscatingReplacer, [{
  6302. key: "replace",
  6303. value: function replace(nodeValue) {
  6304. return nodeValue ? BooleanLiteralObfuscatingReplacer_1.getTrueUnaryExpressionNode() : BooleanLiteralObfuscatingReplacer_1.getFalseUnaryExpressionNode();
  6305. }
  6306. }], [{
  6307. key: "getTrueUnaryExpressionNode",
  6308. value: function getTrueUnaryExpressionNode() {
  6309. return Nodes_1.Nodes.getUnaryExpressionNode('!', BooleanLiteralObfuscatingReplacer_1.getFalseUnaryExpressionNode());
  6310. }
  6311. }, {
  6312. key: "getFalseUnaryExpressionNode",
  6313. value: function getFalseUnaryExpressionNode() {
  6314. return Nodes_1.Nodes.getUnaryExpressionNode('!', Nodes_1.Nodes.getArrayExpressionNode());
  6315. }
  6316. }]);
  6317. return BooleanLiteralObfuscatingReplacer;
  6318. }(AbstractObfuscatingReplacer_1.AbstractObfuscatingReplacer);
  6319. 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);
  6320. exports.BooleanLiteralObfuscatingReplacer = BooleanLiteralObfuscatingReplacer;
  6321. var BooleanLiteralObfuscatingReplacer_1;
  6322. /***/ }),
  6323. /* 149 */
  6324. /***/ (function(module, exports, __webpack_require__) {
  6325. "use strict";
  6326. var _Object$getPrototypeOf = __webpack_require__(5);
  6327. var _classCallCheck = __webpack_require__(0);
  6328. var _createClass = __webpack_require__(2);
  6329. var _possibleConstructorReturn = __webpack_require__(6);
  6330. var _inherits = __webpack_require__(7);
  6331. Object.defineProperty(exports, "__esModule", {
  6332. value: true
  6333. });
  6334. var tslib_1 = __webpack_require__(4);
  6335. var inversify_1 = __webpack_require__(1);
  6336. var ServiceIdentifiers_1 = __webpack_require__(3);
  6337. var estraverse = tslib_1.__importStar(__webpack_require__(17));
  6338. var IdentifierObfuscatingReplacer_1 = __webpack_require__(26);
  6339. var TransformationStage_1 = __webpack_require__(12);
  6340. var AbstractNodeTransformer_1 = __webpack_require__(13);
  6341. var NodeGuards_1 = __webpack_require__(8);
  6342. var CatchClauseTransformer =
  6343. /*#__PURE__*/
  6344. function (_AbstractNodeTransfor) {
  6345. _inherits(CatchClauseTransformer, _AbstractNodeTransfor);
  6346. function CatchClauseTransformer(identifierObfuscatingReplacerFactory, randomGenerator, options) {
  6347. var _this;
  6348. _classCallCheck(this, CatchClauseTransformer);
  6349. _this = _possibleConstructorReturn(this, (CatchClauseTransformer.__proto__ || _Object$getPrototypeOf(CatchClauseTransformer)).call(this, randomGenerator, options));
  6350. _this.identifierObfuscatingReplacer = identifierObfuscatingReplacerFactory(IdentifierObfuscatingReplacer_1.IdentifierObfuscatingReplacer.BaseIdentifierObfuscatingReplacer);
  6351. return _this;
  6352. }
  6353. _createClass(CatchClauseTransformer, [{
  6354. key: "getVisitor",
  6355. value: function getVisitor(transformationStage) {
  6356. var _this2 = this;
  6357. switch (transformationStage) {
  6358. case TransformationStage_1.TransformationStage.Obfuscating:
  6359. return {
  6360. enter: function enter(node, parentNode) {
  6361. if (parentNode && NodeGuards_1.NodeGuards.isCatchClauseNode(node)) {
  6362. return _this2.transformNode(node, parentNode);
  6363. }
  6364. }
  6365. };
  6366. default:
  6367. return null;
  6368. }
  6369. }
  6370. }, {
  6371. key: "transformNode",
  6372. value: function transformNode(catchClauseNode, parentNode) {
  6373. var nodeIdentifier = this.nodeIdentifier++;
  6374. this.storeCatchClauseParam(catchClauseNode, nodeIdentifier);
  6375. this.replaceCatchClauseParam(catchClauseNode, nodeIdentifier);
  6376. return catchClauseNode;
  6377. }
  6378. }, {
  6379. key: "storeCatchClauseParam",
  6380. value: function storeCatchClauseParam(catchClauseNode, nodeIdentifier) {
  6381. if (NodeGuards_1.NodeGuards.isIdentifierNode(catchClauseNode.param)) {
  6382. this.identifierObfuscatingReplacer.storeLocalName(catchClauseNode.param.name, nodeIdentifier);
  6383. }
  6384. }
  6385. }, {
  6386. key: "replaceCatchClauseParam",
  6387. value: function replaceCatchClauseParam(catchClauseNode, nodeIdentifier) {
  6388. var _this3 = this;
  6389. estraverse.replace(catchClauseNode, {
  6390. enter: function enter(node, parentNode) {
  6391. if (parentNode && NodeGuards_1.NodeGuards.isReplaceableIdentifierNode(node, parentNode)) {
  6392. var newIdentifier = _this3.identifierObfuscatingReplacer.replace(node.name, nodeIdentifier);
  6393. var newIdentifierName = newIdentifier.name;
  6394. if (node.name !== newIdentifierName) {
  6395. node.name = newIdentifierName;
  6396. node.obfuscatedNode = true;
  6397. }
  6398. }
  6399. }
  6400. });
  6401. }
  6402. }]);
  6403. return CatchClauseTransformer;
  6404. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  6405. 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);
  6406. exports.CatchClauseTransformer = CatchClauseTransformer;
  6407. /***/ }),
  6408. /* 150 */
  6409. /***/ (function(module, exports, __webpack_require__) {
  6410. "use strict";
  6411. var _Map = __webpack_require__(16);
  6412. var _Object$getPrototypeOf = __webpack_require__(5);
  6413. var _classCallCheck = __webpack_require__(0);
  6414. var _createClass = __webpack_require__(2);
  6415. var _possibleConstructorReturn = __webpack_require__(6);
  6416. var _inherits = __webpack_require__(7);
  6417. Object.defineProperty(exports, "__esModule", {
  6418. value: true
  6419. });
  6420. var tslib_1 = __webpack_require__(4);
  6421. var inversify_1 = __webpack_require__(1);
  6422. var ServiceIdentifiers_1 = __webpack_require__(3);
  6423. var estraverse = tslib_1.__importStar(__webpack_require__(17));
  6424. var IdentifierObfuscatingReplacer_1 = __webpack_require__(26);
  6425. var NodeType_1 = __webpack_require__(18);
  6426. var TransformationStage_1 = __webpack_require__(12);
  6427. var AbstractNodeTransformer_1 = __webpack_require__(13);
  6428. var NodeGuards_1 = __webpack_require__(8);
  6429. var NodeUtils_1 = __webpack_require__(9);
  6430. var ClassDeclarationTransformer =
  6431. /*#__PURE__*/
  6432. function (_AbstractNodeTransfor) {
  6433. _inherits(ClassDeclarationTransformer, _AbstractNodeTransfor);
  6434. function ClassDeclarationTransformer(identifierObfuscatingReplacerFactory, randomGenerator, options) {
  6435. var _this;
  6436. _classCallCheck(this, ClassDeclarationTransformer);
  6437. _this = _possibleConstructorReturn(this, (ClassDeclarationTransformer.__proto__ || _Object$getPrototypeOf(ClassDeclarationTransformer)).call(this, randomGenerator, options));
  6438. _this.replaceableIdentifiers = new _Map();
  6439. _this.identifierObfuscatingReplacer = identifierObfuscatingReplacerFactory(IdentifierObfuscatingReplacer_1.IdentifierObfuscatingReplacer.BaseIdentifierObfuscatingReplacer);
  6440. return _this;
  6441. }
  6442. _createClass(ClassDeclarationTransformer, [{
  6443. key: "getVisitor",
  6444. value: function getVisitor(transformationStage) {
  6445. var _this2 = this;
  6446. switch (transformationStage) {
  6447. case TransformationStage_1.TransformationStage.Obfuscating:
  6448. return {
  6449. enter: function enter(node, parentNode) {
  6450. if (parentNode && NodeGuards_1.NodeGuards.isClassDeclarationNode(node)) {
  6451. return _this2.transformNode(node, parentNode);
  6452. }
  6453. }
  6454. };
  6455. default:
  6456. return null;
  6457. }
  6458. }
  6459. }, {
  6460. key: "transformNode",
  6461. value: function transformNode(classDeclarationNode, parentNode) {
  6462. var nodeIdentifier = this.nodeIdentifier++;
  6463. var blockScopeNode = NodeUtils_1.NodeUtils.getBlockScopesOfNode(classDeclarationNode)[0];
  6464. var isGlobalDeclaration = blockScopeNode.type === NodeType_1.NodeType.Program;
  6465. if (!this.options.renameGlobals && isGlobalDeclaration) {
  6466. return classDeclarationNode;
  6467. }
  6468. this.storeClassName(classDeclarationNode, isGlobalDeclaration, nodeIdentifier);
  6469. if (this.replaceableIdentifiers.has(blockScopeNode)) {
  6470. this.replaceScopeCachedIdentifiers(blockScopeNode, nodeIdentifier);
  6471. } else {
  6472. this.replaceScopeIdentifiers(blockScopeNode, nodeIdentifier);
  6473. }
  6474. return classDeclarationNode;
  6475. }
  6476. }, {
  6477. key: "storeClassName",
  6478. value: function storeClassName(classDeclarationNode, isGlobalDeclaration, nodeIdentifier) {
  6479. if (isGlobalDeclaration) {
  6480. this.identifierObfuscatingReplacer.storeGlobalName(classDeclarationNode.id.name, nodeIdentifier);
  6481. } else {
  6482. this.identifierObfuscatingReplacer.storeLocalName(classDeclarationNode.id.name, nodeIdentifier);
  6483. }
  6484. }
  6485. }, {
  6486. key: "replaceScopeCachedIdentifiers",
  6487. value: function replaceScopeCachedIdentifiers(blockScopeNode, nodeIdentifier) {
  6488. var _this3 = this;
  6489. var cachedReplaceableIdentifiers = this.replaceableIdentifiers.get(blockScopeNode);
  6490. cachedReplaceableIdentifiers.forEach(function (replaceableIdentifier) {
  6491. var newReplaceableIdentifier = _this3.identifierObfuscatingReplacer.replace(replaceableIdentifier.name, nodeIdentifier);
  6492. replaceableIdentifier.name = newReplaceableIdentifier.name;
  6493. });
  6494. }
  6495. }, {
  6496. key: "replaceScopeIdentifiers",
  6497. value: function replaceScopeIdentifiers(blockScopeNode, nodeIdentifier) {
  6498. var _this4 = this;
  6499. var storedReplaceableIdentifiers = [];
  6500. estraverse.replace(blockScopeNode, {
  6501. enter: function enter(node, parentNode) {
  6502. if (parentNode && NodeGuards_1.NodeGuards.isReplaceableIdentifierNode(node, parentNode)) {
  6503. var newIdentifier = _this4.identifierObfuscatingReplacer.replace(node.name, nodeIdentifier);
  6504. var newIdentifierName = newIdentifier.name;
  6505. if (node.name !== newIdentifierName) {
  6506. node.name = newIdentifierName;
  6507. } else {
  6508. storedReplaceableIdentifiers.push(node);
  6509. }
  6510. }
  6511. }
  6512. });
  6513. this.replaceableIdentifiers.set(blockScopeNode, storedReplaceableIdentifiers);
  6514. }
  6515. }]);
  6516. return ClassDeclarationTransformer;
  6517. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  6518. 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);
  6519. exports.ClassDeclarationTransformer = ClassDeclarationTransformer;
  6520. /***/ }),
  6521. /* 151 */
  6522. /***/ (function(module, exports, __webpack_require__) {
  6523. "use strict";
  6524. var _Map = __webpack_require__(16);
  6525. var _Object$getPrototypeOf = __webpack_require__(5);
  6526. var _classCallCheck = __webpack_require__(0);
  6527. var _createClass = __webpack_require__(2);
  6528. var _possibleConstructorReturn = __webpack_require__(6);
  6529. var _inherits = __webpack_require__(7);
  6530. Object.defineProperty(exports, "__esModule", {
  6531. value: true
  6532. });
  6533. var tslib_1 = __webpack_require__(4);
  6534. var inversify_1 = __webpack_require__(1);
  6535. var ServiceIdentifiers_1 = __webpack_require__(3);
  6536. var estraverse = tslib_1.__importStar(__webpack_require__(17));
  6537. var IdentifierObfuscatingReplacer_1 = __webpack_require__(26);
  6538. var NodeType_1 = __webpack_require__(18);
  6539. var TransformationStage_1 = __webpack_require__(12);
  6540. var AbstractNodeTransformer_1 = __webpack_require__(13);
  6541. var NodeGuards_1 = __webpack_require__(8);
  6542. var NodeUtils_1 = __webpack_require__(9);
  6543. var FunctionDeclarationTransformer =
  6544. /*#__PURE__*/
  6545. function (_AbstractNodeTransfor) {
  6546. _inherits(FunctionDeclarationTransformer, _AbstractNodeTransfor);
  6547. function FunctionDeclarationTransformer(identifierObfuscatingReplacerFactory, randomGenerator, options) {
  6548. var _this;
  6549. _classCallCheck(this, FunctionDeclarationTransformer);
  6550. _this = _possibleConstructorReturn(this, (FunctionDeclarationTransformer.__proto__ || _Object$getPrototypeOf(FunctionDeclarationTransformer)).call(this, randomGenerator, options));
  6551. _this.replaceableIdentifiers = new _Map();
  6552. _this.identifierObfuscatingReplacer = identifierObfuscatingReplacerFactory(IdentifierObfuscatingReplacer_1.IdentifierObfuscatingReplacer.BaseIdentifierObfuscatingReplacer);
  6553. return _this;
  6554. }
  6555. _createClass(FunctionDeclarationTransformer, [{
  6556. key: "getVisitor",
  6557. value: function getVisitor(transformationStage) {
  6558. var _this2 = this;
  6559. switch (transformationStage) {
  6560. case TransformationStage_1.TransformationStage.Obfuscating:
  6561. return {
  6562. enter: function enter(node, parentNode) {
  6563. if (parentNode && NodeGuards_1.NodeGuards.isFunctionDeclarationNode(node)) {
  6564. return _this2.transformNode(node, parentNode);
  6565. }
  6566. }
  6567. };
  6568. default:
  6569. return null;
  6570. }
  6571. }
  6572. }, {
  6573. key: "transformNode",
  6574. value: function transformNode(functionDeclarationNode, parentNode) {
  6575. var nodeIdentifier = this.nodeIdentifier++;
  6576. var blockScopeNode = NodeUtils_1.NodeUtils.getBlockScopesOfNode(functionDeclarationNode)[0];
  6577. var isGlobalDeclaration = blockScopeNode.type === NodeType_1.NodeType.Program;
  6578. if (!this.options.renameGlobals && isGlobalDeclaration) {
  6579. return functionDeclarationNode;
  6580. }
  6581. this.storeFunctionName(functionDeclarationNode, isGlobalDeclaration, nodeIdentifier);
  6582. if (this.replaceableIdentifiers.has(blockScopeNode)) {
  6583. this.replaceScopeCachedIdentifiers(functionDeclarationNode, blockScopeNode, nodeIdentifier);
  6584. } else {
  6585. this.replaceScopeIdentifiers(blockScopeNode, nodeIdentifier);
  6586. }
  6587. return functionDeclarationNode;
  6588. }
  6589. }, {
  6590. key: "storeFunctionName",
  6591. value: function storeFunctionName(functionDeclarationNode, isGlobalDeclaration, nodeIdentifier) {
  6592. if (isGlobalDeclaration) {
  6593. this.identifierObfuscatingReplacer.storeGlobalName(functionDeclarationNode.id.name, nodeIdentifier);
  6594. } else {
  6595. this.identifierObfuscatingReplacer.storeLocalName(functionDeclarationNode.id.name, nodeIdentifier);
  6596. }
  6597. }
  6598. }, {
  6599. key: "replaceScopeCachedIdentifiers",
  6600. value: function replaceScopeCachedIdentifiers(functionDeclarationNode, blockScopeNode, nodeIdentifier) {
  6601. var cachedReplaceableIdentifiersNamesMap = this.replaceableIdentifiers.get(blockScopeNode);
  6602. if (!cachedReplaceableIdentifiersNamesMap) {
  6603. return;
  6604. }
  6605. var cachedReplaceableIdentifiers = cachedReplaceableIdentifiersNamesMap.get(functionDeclarationNode.id.name);
  6606. if (!cachedReplaceableIdentifiers) {
  6607. return;
  6608. }
  6609. var cachedReplaceableIdentifierLength = cachedReplaceableIdentifiers.length;
  6610. for (var i = 0; i < cachedReplaceableIdentifierLength; i++) {
  6611. var replaceableIdentifier = cachedReplaceableIdentifiers[i];
  6612. var newReplaceableIdentifier = this.identifierObfuscatingReplacer.replace(replaceableIdentifier.name, nodeIdentifier);
  6613. replaceableIdentifier.name = newReplaceableIdentifier.name;
  6614. }
  6615. }
  6616. }, {
  6617. key: "replaceScopeIdentifiers",
  6618. value: function replaceScopeIdentifiers(blockScopeNode, nodeIdentifier) {
  6619. var _this3 = this;
  6620. var storedReplaceableIdentifiersNamesMap = new _Map();
  6621. estraverse.replace(blockScopeNode, {
  6622. enter: function enter(node, parentNode) {
  6623. if (parentNode && NodeGuards_1.NodeGuards.isReplaceableIdentifierNode(node, parentNode)) {
  6624. var newIdentifier = _this3.identifierObfuscatingReplacer.replace(node.name, nodeIdentifier);
  6625. var newIdentifierName = newIdentifier.name;
  6626. if (node.name !== newIdentifierName) {
  6627. node.name = newIdentifierName;
  6628. } else {
  6629. var storedReplaceableIdentifiers = storedReplaceableIdentifiersNamesMap.get(node.name) || [];
  6630. storedReplaceableIdentifiers.push(node);
  6631. storedReplaceableIdentifiersNamesMap.set(node.name, storedReplaceableIdentifiers);
  6632. }
  6633. }
  6634. }
  6635. });
  6636. this.replaceableIdentifiers.set(blockScopeNode, storedReplaceableIdentifiersNamesMap);
  6637. }
  6638. }]);
  6639. return FunctionDeclarationTransformer;
  6640. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  6641. 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);
  6642. exports.FunctionDeclarationTransformer = FunctionDeclarationTransformer;
  6643. /***/ }),
  6644. /* 152 */
  6645. /***/ (function(module, exports, __webpack_require__) {
  6646. "use strict";
  6647. var _Set = __webpack_require__(29);
  6648. var _Object$getPrototypeOf = __webpack_require__(5);
  6649. var _classCallCheck = __webpack_require__(0);
  6650. var _createClass = __webpack_require__(2);
  6651. var _possibleConstructorReturn = __webpack_require__(6);
  6652. var _inherits = __webpack_require__(7);
  6653. Object.defineProperty(exports, "__esModule", {
  6654. value: true
  6655. });
  6656. var tslib_1 = __webpack_require__(4);
  6657. var inversify_1 = __webpack_require__(1);
  6658. var ServiceIdentifiers_1 = __webpack_require__(3);
  6659. var estraverse = tslib_1.__importStar(__webpack_require__(17));
  6660. var IdentifierObfuscatingReplacer_1 = __webpack_require__(26);
  6661. var TransformationStage_1 = __webpack_require__(12);
  6662. var AbstractNodeTransformer_1 = __webpack_require__(13);
  6663. var NodeGuards_1 = __webpack_require__(8);
  6664. var FunctionTransformer =
  6665. /*#__PURE__*/
  6666. function (_AbstractNodeTransfor) {
  6667. _inherits(FunctionTransformer, _AbstractNodeTransfor);
  6668. function FunctionTransformer(identifierObfuscatingReplacerFactory, randomGenerator, options) {
  6669. var _this;
  6670. _classCallCheck(this, FunctionTransformer);
  6671. _this = _possibleConstructorReturn(this, (FunctionTransformer.__proto__ || _Object$getPrototypeOf(FunctionTransformer)).call(this, randomGenerator, options));
  6672. _this.identifierObfuscatingReplacer = identifierObfuscatingReplacerFactory(IdentifierObfuscatingReplacer_1.IdentifierObfuscatingReplacer.BaseIdentifierObfuscatingReplacer);
  6673. return _this;
  6674. }
  6675. _createClass(FunctionTransformer, [{
  6676. key: "getVisitor",
  6677. value: function getVisitor(transformationStage) {
  6678. var _this2 = this;
  6679. switch (transformationStage) {
  6680. case TransformationStage_1.TransformationStage.Obfuscating:
  6681. return {
  6682. enter: function enter(node, parentNode) {
  6683. if (parentNode && (NodeGuards_1.NodeGuards.isFunctionDeclarationNode(node) || NodeGuards_1.NodeGuards.isFunctionExpressionNode(node) || NodeGuards_1.NodeGuards.isArrowFunctionExpressionNode(node))) {
  6684. return _this2.transformNode(node, parentNode);
  6685. }
  6686. }
  6687. };
  6688. default:
  6689. return null;
  6690. }
  6691. }
  6692. }, {
  6693. key: "transformNode",
  6694. value: function transformNode(functionNode, parentNode) {
  6695. var nodeIdentifier = this.nodeIdentifier++;
  6696. this.storeFunctionParams(functionNode, nodeIdentifier);
  6697. this.replaceFunctionParams(functionNode, nodeIdentifier);
  6698. return functionNode;
  6699. }
  6700. }, {
  6701. key: "storeFunctionParams",
  6702. value: function storeFunctionParams(functionNode, nodeIdentifier) {
  6703. var _this3 = this;
  6704. functionNode.params.forEach(function (paramsNode) {
  6705. if (NodeGuards_1.NodeGuards.isObjectPatternNode(paramsNode)) {
  6706. return estraverse.VisitorOption.Skip;
  6707. }
  6708. estraverse.traverse(paramsNode, {
  6709. enter: function enter(node) {
  6710. if (NodeGuards_1.NodeGuards.isAssignmentPatternNode(node) && NodeGuards_1.NodeGuards.isIdentifierNode(node.left)) {
  6711. _this3.identifierObfuscatingReplacer.storeLocalName(node.left.name, nodeIdentifier);
  6712. return estraverse.VisitorOption.Skip;
  6713. }
  6714. if (NodeGuards_1.NodeGuards.isIdentifierNode(node)) {
  6715. _this3.identifierObfuscatingReplacer.storeLocalName(node.name, nodeIdentifier);
  6716. }
  6717. }
  6718. });
  6719. });
  6720. }
  6721. }, {
  6722. key: "addIdentifiersToIgnoredIdentifierNamesSet",
  6723. value: function addIdentifiersToIgnoredIdentifierNamesSet(properties, ignoredIdentifierNamesSet) {
  6724. properties.forEach(function (property) {
  6725. if (!NodeGuards_1.NodeGuards.isIdentifierNode(property.key)) {
  6726. return;
  6727. }
  6728. ignoredIdentifierNamesSet.add(property.key.name);
  6729. });
  6730. }
  6731. }, {
  6732. key: "replaceFunctionParams",
  6733. value: function replaceFunctionParams(functionNode, nodeIdentifier) {
  6734. var _this4 = this;
  6735. var ignoredIdentifierNamesSet = new _Set();
  6736. var replaceVisitor = {
  6737. enter: function enter(node, parentNode) {
  6738. if (NodeGuards_1.NodeGuards.isObjectPatternNode(node)) {
  6739. _this4.addIdentifiersToIgnoredIdentifierNamesSet(node.properties, ignoredIdentifierNamesSet);
  6740. }
  6741. if (parentNode && NodeGuards_1.NodeGuards.isReplaceableIdentifierNode(node, parentNode) && !ignoredIdentifierNamesSet.has(node.name)) {
  6742. var newIdentifier = _this4.identifierObfuscatingReplacer.replace(node.name, nodeIdentifier);
  6743. var newIdentifierName = newIdentifier.name;
  6744. if (node.name !== newIdentifierName) {
  6745. node.name = newIdentifierName;
  6746. node.obfuscatedNode = true;
  6747. }
  6748. }
  6749. }
  6750. };
  6751. functionNode.params.forEach(function (paramsNode) {
  6752. return estraverse.replace(paramsNode, replaceVisitor);
  6753. });
  6754. estraverse.replace(functionNode.body, replaceVisitor);
  6755. }
  6756. }]);
  6757. return FunctionTransformer;
  6758. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  6759. 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);
  6760. exports.FunctionTransformer = FunctionTransformer;
  6761. /***/ }),
  6762. /* 153 */
  6763. /***/ (function(module, exports, __webpack_require__) {
  6764. "use strict";
  6765. var _Object$getPrototypeOf = __webpack_require__(5);
  6766. var _classCallCheck = __webpack_require__(0);
  6767. var _createClass = __webpack_require__(2);
  6768. var _possibleConstructorReturn = __webpack_require__(6);
  6769. var _inherits = __webpack_require__(7);
  6770. Object.defineProperty(exports, "__esModule", {
  6771. value: true
  6772. });
  6773. var tslib_1 = __webpack_require__(4);
  6774. var inversify_1 = __webpack_require__(1);
  6775. var ServiceIdentifiers_1 = __webpack_require__(3);
  6776. var estraverse = tslib_1.__importStar(__webpack_require__(17));
  6777. var IdentifierObfuscatingReplacer_1 = __webpack_require__(26);
  6778. var TransformationStage_1 = __webpack_require__(12);
  6779. var AbstractNodeTransformer_1 = __webpack_require__(13);
  6780. var NodeGuards_1 = __webpack_require__(8);
  6781. var LabeledStatementTransformer =
  6782. /*#__PURE__*/
  6783. function (_AbstractNodeTransfor) {
  6784. _inherits(LabeledStatementTransformer, _AbstractNodeTransfor);
  6785. function LabeledStatementTransformer(identifierObfuscatingReplacerFactory, randomGenerator, options) {
  6786. var _this;
  6787. _classCallCheck(this, LabeledStatementTransformer);
  6788. _this = _possibleConstructorReturn(this, (LabeledStatementTransformer.__proto__ || _Object$getPrototypeOf(LabeledStatementTransformer)).call(this, randomGenerator, options));
  6789. _this.identifierObfuscatingReplacer = identifierObfuscatingReplacerFactory(IdentifierObfuscatingReplacer_1.IdentifierObfuscatingReplacer.BaseIdentifierObfuscatingReplacer);
  6790. return _this;
  6791. }
  6792. _createClass(LabeledStatementTransformer, [{
  6793. key: "getVisitor",
  6794. value: function getVisitor(transformationStage) {
  6795. var _this2 = this;
  6796. switch (transformationStage) {
  6797. case TransformationStage_1.TransformationStage.Obfuscating:
  6798. return {
  6799. enter: function enter(node, parentNode) {
  6800. if (parentNode && NodeGuards_1.NodeGuards.isLabeledStatementNode(node)) {
  6801. return _this2.transformNode(node, parentNode);
  6802. }
  6803. }
  6804. };
  6805. default:
  6806. return null;
  6807. }
  6808. }
  6809. }, {
  6810. key: "transformNode",
  6811. value: function transformNode(labeledStatementNode, parentNode) {
  6812. var nodeIdentifier = this.nodeIdentifier++;
  6813. this.storeLabeledStatementName(labeledStatementNode, nodeIdentifier);
  6814. this.replaceLabeledStatementName(labeledStatementNode, nodeIdentifier);
  6815. return labeledStatementNode;
  6816. }
  6817. }, {
  6818. key: "storeLabeledStatementName",
  6819. value: function storeLabeledStatementName(labeledStatementNode, nodeIdentifier) {
  6820. this.identifierObfuscatingReplacer.storeLocalName(labeledStatementNode.label.name, nodeIdentifier);
  6821. }
  6822. }, {
  6823. key: "replaceLabeledStatementName",
  6824. value: function replaceLabeledStatementName(labeledStatementNode, nodeIdentifier) {
  6825. var _this3 = this;
  6826. estraverse.replace(labeledStatementNode, {
  6827. enter: function enter(node, parentNode) {
  6828. if (parentNode && NodeGuards_1.NodeGuards.isLabelIdentifierNode(node, parentNode)) {
  6829. var newIdentifier = _this3.identifierObfuscatingReplacer.replace(node.name, nodeIdentifier);
  6830. node.name = newIdentifier.name;
  6831. }
  6832. }
  6833. });
  6834. }
  6835. }]);
  6836. return LabeledStatementTransformer;
  6837. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  6838. 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);
  6839. exports.LabeledStatementTransformer = LabeledStatementTransformer;
  6840. /***/ }),
  6841. /* 154 */
  6842. /***/ (function(module, exports, __webpack_require__) {
  6843. "use strict";
  6844. var _typeof = __webpack_require__(50);
  6845. var _Object$getPrototypeOf = __webpack_require__(5);
  6846. var _classCallCheck = __webpack_require__(0);
  6847. var _createClass = __webpack_require__(2);
  6848. var _possibleConstructorReturn = __webpack_require__(6);
  6849. var _inherits = __webpack_require__(7);
  6850. Object.defineProperty(exports, "__esModule", {
  6851. value: true
  6852. });
  6853. var tslib_1 = __webpack_require__(4);
  6854. var inversify_1 = __webpack_require__(1);
  6855. var ServiceIdentifiers_1 = __webpack_require__(3);
  6856. var LiteralObfuscatingReplacer_1 = __webpack_require__(59);
  6857. var TransformationStage_1 = __webpack_require__(12);
  6858. var AbstractNodeTransformer_1 = __webpack_require__(13);
  6859. var NodeGuards_1 = __webpack_require__(8);
  6860. var LiteralTransformer =
  6861. /*#__PURE__*/
  6862. function (_AbstractNodeTransfor) {
  6863. _inherits(LiteralTransformer, _AbstractNodeTransfor);
  6864. function LiteralTransformer(literalObfuscatingReplacerFactory, randomGenerator, options) {
  6865. var _this;
  6866. _classCallCheck(this, LiteralTransformer);
  6867. _this = _possibleConstructorReturn(this, (LiteralTransformer.__proto__ || _Object$getPrototypeOf(LiteralTransformer)).call(this, randomGenerator, options));
  6868. _this.literalObfuscatingReplacerFactory = literalObfuscatingReplacerFactory;
  6869. return _this;
  6870. }
  6871. _createClass(LiteralTransformer, [{
  6872. key: "getVisitor",
  6873. value: function getVisitor(transformationStage) {
  6874. var _this2 = this;
  6875. switch (transformationStage) {
  6876. case TransformationStage_1.TransformationStage.Obfuscating:
  6877. return {
  6878. enter: function enter(node, parentNode) {
  6879. if (parentNode && NodeGuards_1.NodeGuards.isLiteralNode(node) && !node.obfuscatedNode) {
  6880. return _this2.transformNode(node, parentNode);
  6881. }
  6882. }
  6883. };
  6884. default:
  6885. return null;
  6886. }
  6887. }
  6888. }, {
  6889. key: "transformNode",
  6890. value: function transformNode(literalNode, parentNode) {
  6891. if (parentNode && NodeGuards_1.NodeGuards.isPropertyNode(parentNode) && parentNode.key === literalNode) {
  6892. return literalNode;
  6893. }
  6894. switch (_typeof(literalNode.value)) {
  6895. case 'boolean':
  6896. return this.literalObfuscatingReplacerFactory(LiteralObfuscatingReplacer_1.LiteralObfuscatingReplacer.BooleanLiteralObfuscatingReplacer).replace(literalNode.value);
  6897. case 'number':
  6898. return this.literalObfuscatingReplacerFactory(LiteralObfuscatingReplacer_1.LiteralObfuscatingReplacer.NumberLiteralObfuscatingReplacer).replace(literalNode.value);
  6899. case 'string':
  6900. return this.literalObfuscatingReplacerFactory(LiteralObfuscatingReplacer_1.LiteralObfuscatingReplacer.StringLiteralObfuscatingReplacer).replace(literalNode.value);
  6901. default:
  6902. return literalNode;
  6903. }
  6904. }
  6905. }]);
  6906. return LiteralTransformer;
  6907. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  6908. 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);
  6909. exports.LiteralTransformer = LiteralTransformer;
  6910. /***/ }),
  6911. /* 155 */
  6912. /***/ (function(module, exports, __webpack_require__) {
  6913. "use strict";
  6914. var _Map = __webpack_require__(16);
  6915. var _Object$getPrototypeOf = __webpack_require__(5);
  6916. var _classCallCheck = __webpack_require__(0);
  6917. var _createClass = __webpack_require__(2);
  6918. var _possibleConstructorReturn = __webpack_require__(6);
  6919. var _inherits = __webpack_require__(7);
  6920. Object.defineProperty(exports, "__esModule", {
  6921. value: true
  6922. });
  6923. var tslib_1 = __webpack_require__(4);
  6924. var inversify_1 = __webpack_require__(1);
  6925. var ServiceIdentifiers_1 = __webpack_require__(3);
  6926. var AbstractObfuscatingReplacer_1 = __webpack_require__(40);
  6927. var Nodes_1 = __webpack_require__(15);
  6928. var Utils_1 = __webpack_require__(32);
  6929. var NumberLiteralObfuscatingReplacer =
  6930. /*#__PURE__*/
  6931. function (_AbstractObfuscatingR) {
  6932. _inherits(NumberLiteralObfuscatingReplacer, _AbstractObfuscatingR);
  6933. function NumberLiteralObfuscatingReplacer(options) {
  6934. var _this;
  6935. _classCallCheck(this, NumberLiteralObfuscatingReplacer);
  6936. _this = _possibleConstructorReturn(this, (NumberLiteralObfuscatingReplacer.__proto__ || _Object$getPrototypeOf(NumberLiteralObfuscatingReplacer)).call(this, options));
  6937. _this.numberLiteralCache = new _Map();
  6938. return _this;
  6939. }
  6940. _createClass(NumberLiteralObfuscatingReplacer, [{
  6941. key: "replace",
  6942. value: function replace(nodeValue) {
  6943. var rawValue;
  6944. if (this.numberLiteralCache.has(nodeValue)) {
  6945. rawValue = this.numberLiteralCache.get(nodeValue);
  6946. } else {
  6947. if (!Utils_1.Utils.isCeilNumber(nodeValue)) {
  6948. rawValue = String(nodeValue);
  6949. } else {
  6950. rawValue = "".concat(Utils_1.Utils.hexadecimalPrefix).concat(Utils_1.Utils.decToHex(nodeValue));
  6951. }
  6952. this.numberLiteralCache.set(nodeValue, rawValue);
  6953. }
  6954. return Nodes_1.Nodes.getLiteralNode(nodeValue, rawValue);
  6955. }
  6956. }]);
  6957. return NumberLiteralObfuscatingReplacer;
  6958. }(AbstractObfuscatingReplacer_1.AbstractObfuscatingReplacer);
  6959. 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);
  6960. exports.NumberLiteralObfuscatingReplacer = NumberLiteralObfuscatingReplacer;
  6961. /***/ }),
  6962. /* 156 */
  6963. /***/ (function(module, exports, __webpack_require__) {
  6964. "use strict";
  6965. var _Object$getPrototypeOf = __webpack_require__(5);
  6966. var _classCallCheck = __webpack_require__(0);
  6967. var _createClass = __webpack_require__(2);
  6968. var _possibleConstructorReturn = __webpack_require__(6);
  6969. var _inherits = __webpack_require__(7);
  6970. Object.defineProperty(exports, "__esModule", {
  6971. value: true
  6972. });
  6973. var tslib_1 = __webpack_require__(4);
  6974. var inversify_1 = __webpack_require__(1);
  6975. var ServiceIdentifiers_1 = __webpack_require__(3);
  6976. var NodeType_1 = __webpack_require__(18);
  6977. var TransformationStage_1 = __webpack_require__(12);
  6978. var AbstractNodeTransformer_1 = __webpack_require__(13);
  6979. var NodeGuards_1 = __webpack_require__(8);
  6980. var ObjectExpressionTransformer = ObjectExpressionTransformer_1 =
  6981. /*#__PURE__*/
  6982. function (_AbstractNodeTransfor) {
  6983. _inherits(ObjectExpressionTransformer, _AbstractNodeTransfor);
  6984. function ObjectExpressionTransformer(randomGenerator, options) {
  6985. _classCallCheck(this, ObjectExpressionTransformer);
  6986. return _possibleConstructorReturn(this, (ObjectExpressionTransformer.__proto__ || _Object$getPrototypeOf(ObjectExpressionTransformer)).call(this, randomGenerator, options));
  6987. }
  6988. _createClass(ObjectExpressionTransformer, [{
  6989. key: "getVisitor",
  6990. value: function getVisitor(transformationStage) {
  6991. var _this = this;
  6992. switch (transformationStage) {
  6993. case TransformationStage_1.TransformationStage.Obfuscating:
  6994. return {
  6995. enter: function enter(node, parentNode) {
  6996. if (parentNode && NodeGuards_1.NodeGuards.isObjectExpressionNode(node)) {
  6997. return _this.transformNode(node, parentNode);
  6998. }
  6999. }
  7000. };
  7001. default:
  7002. return null;
  7003. }
  7004. }
  7005. }, {
  7006. key: "transformNode",
  7007. value: function transformNode(objectExpressionNode, parentNode) {
  7008. objectExpressionNode.properties.forEach(function (property) {
  7009. if (property.computed) {
  7010. return;
  7011. }
  7012. if (property.shorthand) {
  7013. property.shorthand = false;
  7014. }
  7015. if (NodeGuards_1.NodeGuards.isIdentifierNode(property.key)) {
  7016. property.key = ObjectExpressionTransformer_1.transformIdentifierPropertyKey(property.key);
  7017. }
  7018. });
  7019. return objectExpressionNode;
  7020. }
  7021. }], [{
  7022. key: "transformIdentifierPropertyKey",
  7023. value: function transformIdentifierPropertyKey(node) {
  7024. return {
  7025. type: NodeType_1.NodeType.Literal,
  7026. value: node.name,
  7027. raw: "'".concat(node.name, "'")
  7028. };
  7029. }
  7030. }]);
  7031. return ObjectExpressionTransformer;
  7032. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  7033. 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);
  7034. exports.ObjectExpressionTransformer = ObjectExpressionTransformer;
  7035. var ObjectExpressionTransformer_1;
  7036. /***/ }),
  7037. /* 157 */
  7038. /***/ (function(module, exports, __webpack_require__) {
  7039. "use strict";
  7040. var _Map = __webpack_require__(16);
  7041. var _Object$getPrototypeOf = __webpack_require__(5);
  7042. var _classCallCheck = __webpack_require__(0);
  7043. var _createClass = __webpack_require__(2);
  7044. var _possibleConstructorReturn = __webpack_require__(6);
  7045. var _inherits = __webpack_require__(7);
  7046. Object.defineProperty(exports, "__esModule", {
  7047. value: true
  7048. });
  7049. var tslib_1 = __webpack_require__(4);
  7050. var inversify_1 = __webpack_require__(1);
  7051. var ServiceIdentifiers_1 = __webpack_require__(3);
  7052. var StringArrayEncoding_1 = __webpack_require__(37);
  7053. var AbstractObfuscatingReplacer_1 = __webpack_require__(40);
  7054. var Nodes_1 = __webpack_require__(15);
  7055. var Utils_1 = __webpack_require__(32);
  7056. var StringLiteralObfuscatingReplacer = StringLiteralObfuscatingReplacer_1 =
  7057. /*#__PURE__*/
  7058. function (_AbstractObfuscatingR) {
  7059. _inherits(StringLiteralObfuscatingReplacer, _AbstractObfuscatingR);
  7060. function StringLiteralObfuscatingReplacer(stringArrayStorage, escapeSequenceEncoder, randomGenerator, cryptUtils, options) {
  7061. var _this;
  7062. _classCallCheck(this, StringLiteralObfuscatingReplacer);
  7063. _this = _possibleConstructorReturn(this, (StringLiteralObfuscatingReplacer.__proto__ || _Object$getPrototypeOf(StringLiteralObfuscatingReplacer)).call(this, options));
  7064. _this.nodesCache = new _Map();
  7065. _this.stringLiteralHexadecimalIndexCache = new _Map();
  7066. _this.stringArrayStorage = stringArrayStorage;
  7067. _this.escapeSequenceEncoder = escapeSequenceEncoder;
  7068. _this.randomGenerator = randomGenerator;
  7069. _this.cryptUtils = cryptUtils;
  7070. _this.rc4Keys = _this.randomGenerator.getRandomGenerator().n(function () {
  7071. return _this.randomGenerator.getRandomGenerator().string({
  7072. length: StringLiteralObfuscatingReplacer_1.rc4KeyLength
  7073. });
  7074. }, StringLiteralObfuscatingReplacer_1.rc4KeysCount);
  7075. return _this;
  7076. }
  7077. _createClass(StringLiteralObfuscatingReplacer, [{
  7078. key: "replace",
  7079. value: function replace(nodeValue) {
  7080. var useStringArray = this.canUseStringArray(nodeValue);
  7081. var cacheKey = "".concat(nodeValue, "-").concat(String(useStringArray));
  7082. var useCacheValue = this.nodesCache.has(cacheKey) && this.options.stringArrayEncoding !== StringArrayEncoding_1.StringArrayEncoding.Rc4;
  7083. if (useCacheValue) {
  7084. return this.nodesCache.get(cacheKey);
  7085. }
  7086. var resultNode = useStringArray ? this.replaceWithStringArrayCallNode(nodeValue) : this.replaceWithLiteralNode(nodeValue);
  7087. this.nodesCache.set(cacheKey, resultNode);
  7088. return resultNode;
  7089. }
  7090. }, {
  7091. key: "canUseStringArray",
  7092. value: function canUseStringArray(nodeValue) {
  7093. return this.options.stringArray && nodeValue.length >= StringLiteralObfuscatingReplacer_1.minimumLengthForStringArray && this.randomGenerator.getMathRandom() <= this.options.stringArrayThreshold;
  7094. }
  7095. }, {
  7096. key: "getStringArrayHexadecimalIndex",
  7097. value: function getStringArrayHexadecimalIndex(value, stringArrayStorageLength) {
  7098. if (this.stringLiteralHexadecimalIndexCache.has(value)) {
  7099. return {
  7100. fromCache: true,
  7101. index: this.stringLiteralHexadecimalIndexCache.get(value)
  7102. };
  7103. }
  7104. var hexadecimalRawIndex = Utils_1.Utils.decToHex(stringArrayStorageLength);
  7105. var hexadecimalIndex = "".concat(Utils_1.Utils.hexadecimalPrefix).concat(hexadecimalRawIndex);
  7106. this.stringLiteralHexadecimalIndexCache.set(value, hexadecimalIndex);
  7107. return {
  7108. fromCache: false,
  7109. index: hexadecimalIndex
  7110. };
  7111. }
  7112. }, {
  7113. key: "getEncodedValue",
  7114. value: function getEncodedValue(value) {
  7115. var encodedValue;
  7116. var key = null;
  7117. switch (this.options.stringArrayEncoding) {
  7118. case StringArrayEncoding_1.StringArrayEncoding.Rc4:
  7119. key = this.randomGenerator.getRandomGenerator().pickone(this.rc4Keys);
  7120. encodedValue = this.cryptUtils.btoa(this.cryptUtils.rc4(value, key));
  7121. break;
  7122. case StringArrayEncoding_1.StringArrayEncoding.Base64:
  7123. encodedValue = this.cryptUtils.btoa(value);
  7124. break;
  7125. default:
  7126. encodedValue = value;
  7127. }
  7128. return {
  7129. encodedValue: encodedValue,
  7130. key: key
  7131. };
  7132. }
  7133. }, {
  7134. key: "replaceWithLiteralNode",
  7135. value: function replaceWithLiteralNode(value) {
  7136. return Nodes_1.Nodes.getLiteralNode(this.escapeSequenceEncoder.encode(value, this.options.unicodeEscapeSequence));
  7137. }
  7138. }, {
  7139. key: "replaceWithStringArrayCallNode",
  7140. value: function replaceWithStringArrayCallNode(value) {
  7141. var _getEncodedValue = this.getEncodedValue(value),
  7142. encodedValue = _getEncodedValue.encodedValue,
  7143. key = _getEncodedValue.key;
  7144. var escapedValue = this.escapeSequenceEncoder.encode(encodedValue, this.options.unicodeEscapeSequence);
  7145. var stringArrayStorageLength = this.stringArrayStorage.getLength();
  7146. var stringArrayStorageCallsWrapperName = this.stringArrayStorage.getStorageId().split('|')[1];
  7147. var _getStringArrayHexade = this.getStringArrayHexadecimalIndex(escapedValue, stringArrayStorageLength),
  7148. fromCache = _getStringArrayHexade.fromCache,
  7149. index = _getStringArrayHexade.index;
  7150. if (!fromCache) {
  7151. this.stringArrayStorage.set(stringArrayStorageLength, escapedValue);
  7152. }
  7153. var callExpressionArgs = [StringLiteralObfuscatingReplacer_1.getHexadecimalLiteralNode(index)];
  7154. if (key) {
  7155. callExpressionArgs.push(StringLiteralObfuscatingReplacer_1.getRc4KeyLiteralNode(this.escapeSequenceEncoder.encode(key, this.options.unicodeEscapeSequence)));
  7156. }
  7157. var stringArrayIdentifierNode = Nodes_1.Nodes.getIdentifierNode(stringArrayStorageCallsWrapperName);
  7158. stringArrayIdentifierNode.obfuscatedNode = true;
  7159. return Nodes_1.Nodes.getCallExpressionNode(stringArrayIdentifierNode, callExpressionArgs);
  7160. }
  7161. }], [{
  7162. key: "getHexadecimalLiteralNode",
  7163. value: function getHexadecimalLiteralNode(hexadecimalIndex) {
  7164. var hexadecimalLiteralNode = Nodes_1.Nodes.getLiteralNode(hexadecimalIndex);
  7165. hexadecimalLiteralNode.obfuscatedNode = true;
  7166. return hexadecimalLiteralNode;
  7167. }
  7168. }, {
  7169. key: "getRc4KeyLiteralNode",
  7170. value: function getRc4KeyLiteralNode(literalValue) {
  7171. var rc4KeyLiteralNode = Nodes_1.Nodes.getLiteralNode(literalValue);
  7172. rc4KeyLiteralNode.obfuscatedNode = true;
  7173. return rc4KeyLiteralNode;
  7174. }
  7175. }]);
  7176. return StringLiteralObfuscatingReplacer;
  7177. }(AbstractObfuscatingReplacer_1.AbstractObfuscatingReplacer);
  7178. StringLiteralObfuscatingReplacer.minimumLengthForStringArray = 3;
  7179. StringLiteralObfuscatingReplacer.rc4KeyLength = 4;
  7180. StringLiteralObfuscatingReplacer.rc4KeysCount = 50;
  7181. 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);
  7182. exports.StringLiteralObfuscatingReplacer = StringLiteralObfuscatingReplacer;
  7183. var StringLiteralObfuscatingReplacer_1;
  7184. /***/ }),
  7185. /* 158 */
  7186. /***/ (function(module, exports, __webpack_require__) {
  7187. "use strict";
  7188. var _Map = __webpack_require__(16);
  7189. var _Object$getPrototypeOf = __webpack_require__(5);
  7190. var _classCallCheck = __webpack_require__(0);
  7191. var _createClass = __webpack_require__(2);
  7192. var _possibleConstructorReturn = __webpack_require__(6);
  7193. var _inherits = __webpack_require__(7);
  7194. Object.defineProperty(exports, "__esModule", {
  7195. value: true
  7196. });
  7197. var tslib_1 = __webpack_require__(4);
  7198. var inversify_1 = __webpack_require__(1);
  7199. var ServiceIdentifiers_1 = __webpack_require__(3);
  7200. var estraverse = tslib_1.__importStar(__webpack_require__(17));
  7201. var IdentifierObfuscatingReplacer_1 = __webpack_require__(26);
  7202. var NodeType_1 = __webpack_require__(18);
  7203. var TransformationStage_1 = __webpack_require__(12);
  7204. var AbstractNodeTransformer_1 = __webpack_require__(13);
  7205. var NodeGuards_1 = __webpack_require__(8);
  7206. var NodeUtils_1 = __webpack_require__(9);
  7207. var VariableDeclarationTransformer =
  7208. /*#__PURE__*/
  7209. function (_AbstractNodeTransfor) {
  7210. _inherits(VariableDeclarationTransformer, _AbstractNodeTransfor);
  7211. function VariableDeclarationTransformer(identifierObfuscatingReplacerFactory, randomGenerator, options) {
  7212. var _this;
  7213. _classCallCheck(this, VariableDeclarationTransformer);
  7214. _this = _possibleConstructorReturn(this, (VariableDeclarationTransformer.__proto__ || _Object$getPrototypeOf(VariableDeclarationTransformer)).call(this, randomGenerator, options));
  7215. _this.replaceableIdentifiers = new _Map();
  7216. _this.identifierObfuscatingReplacer = identifierObfuscatingReplacerFactory(IdentifierObfuscatingReplacer_1.IdentifierObfuscatingReplacer.BaseIdentifierObfuscatingReplacer);
  7217. return _this;
  7218. }
  7219. _createClass(VariableDeclarationTransformer, [{
  7220. key: "getVisitor",
  7221. value: function getVisitor(transformationStage) {
  7222. var _this2 = this;
  7223. switch (transformationStage) {
  7224. case TransformationStage_1.TransformationStage.Obfuscating:
  7225. return {
  7226. enter: function enter(node, parentNode) {
  7227. if (parentNode && NodeGuards_1.NodeGuards.isVariableDeclarationNode(node)) {
  7228. return _this2.transformNode(node, parentNode);
  7229. }
  7230. }
  7231. };
  7232. default:
  7233. return null;
  7234. }
  7235. }
  7236. }, {
  7237. key: "transformNode",
  7238. value: function transformNode(variableDeclarationNode, parentNode) {
  7239. var blockScopeNode = NodeUtils_1.NodeUtils.getBlockScopesOfNode(variableDeclarationNode)[0];
  7240. var isGlobalDeclaration = blockScopeNode.type === NodeType_1.NodeType.Program;
  7241. if (!this.options.renameGlobals && isGlobalDeclaration) {
  7242. return variableDeclarationNode;
  7243. }
  7244. var nodeIdentifier = this.nodeIdentifier++;
  7245. var scopeNode = variableDeclarationNode.kind === 'var' ? blockScopeNode : parentNode;
  7246. this.storeVariableNames(variableDeclarationNode, isGlobalDeclaration, nodeIdentifier);
  7247. if (this.replaceableIdentifiers.has(scopeNode)) {
  7248. this.replaceScopeCachedIdentifiers(variableDeclarationNode, scopeNode, nodeIdentifier);
  7249. } else {
  7250. this.replaceScopeIdentifiers(scopeNode, nodeIdentifier);
  7251. }
  7252. return variableDeclarationNode;
  7253. }
  7254. }, {
  7255. key: "storeVariableNames",
  7256. value: function storeVariableNames(variableDeclarationNode, isGlobalDeclaration, nodeIdentifier) {
  7257. var _this3 = this;
  7258. this.traverseDeclarationIdentifiers(variableDeclarationNode, function (identifierNode) {
  7259. if (isGlobalDeclaration) {
  7260. _this3.identifierObfuscatingReplacer.storeGlobalName(identifierNode.name, nodeIdentifier);
  7261. } else {
  7262. _this3.identifierObfuscatingReplacer.storeLocalName(identifierNode.name, nodeIdentifier);
  7263. }
  7264. });
  7265. }
  7266. }, {
  7267. key: "replaceScopeCachedIdentifiers",
  7268. value: function replaceScopeCachedIdentifiers(variableDeclarationNode, scopeNode, nodeIdentifier) {
  7269. var _this4 = this;
  7270. var cachedReplaceableIdentifiersNamesMap = this.replaceableIdentifiers.get(scopeNode);
  7271. if (!cachedReplaceableIdentifiersNamesMap) {
  7272. return;
  7273. }
  7274. var identifierNames = [];
  7275. this.traverseDeclarationIdentifiers(variableDeclarationNode, function (identifierNode) {
  7276. identifierNames.push(identifierNode.name);
  7277. });
  7278. identifierNames.forEach(function (identifierName) {
  7279. var cachedReplaceableIdentifiers = cachedReplaceableIdentifiersNamesMap.get(identifierName);
  7280. if (!cachedReplaceableIdentifiers) {
  7281. return;
  7282. }
  7283. var cachedReplaceableIdentifierLength = cachedReplaceableIdentifiers.length;
  7284. for (var i = 0; i < cachedReplaceableIdentifierLength; i++) {
  7285. var replaceableIdentifier = cachedReplaceableIdentifiers[i];
  7286. if (identifierName !== replaceableIdentifier.name) {
  7287. continue;
  7288. }
  7289. var newReplaceableIdentifier = _this4.identifierObfuscatingReplacer.replace(replaceableIdentifier.name, nodeIdentifier);
  7290. replaceableIdentifier.name = newReplaceableIdentifier.name;
  7291. }
  7292. });
  7293. }
  7294. }, {
  7295. key: "replaceScopeIdentifiers",
  7296. value: function replaceScopeIdentifiers(blockScopeNode, nodeIdentifier) {
  7297. var _this5 = this;
  7298. var storedReplaceableIdentifiersNamesMap = new _Map();
  7299. estraverse.replace(blockScopeNode, {
  7300. enter: function enter(node, parentNode) {
  7301. if (parentNode && !node.obfuscatedNode && NodeGuards_1.NodeGuards.isReplaceableIdentifierNode(node, parentNode)) {
  7302. var newIdentifier = _this5.identifierObfuscatingReplacer.replace(node.name, nodeIdentifier);
  7303. var newIdentifierName = newIdentifier.name;
  7304. if (node.name !== newIdentifierName) {
  7305. node.name = newIdentifierName;
  7306. } else {
  7307. var storedReplaceableIdentifiers = storedReplaceableIdentifiersNamesMap.get(node.name) || [];
  7308. storedReplaceableIdentifiers.push(node);
  7309. storedReplaceableIdentifiersNamesMap.set(node.name, storedReplaceableIdentifiers);
  7310. }
  7311. }
  7312. }
  7313. });
  7314. this.replaceableIdentifiers.set(blockScopeNode, storedReplaceableIdentifiersNamesMap);
  7315. }
  7316. }, {
  7317. key: "traverseDeclarationIdentifiers",
  7318. value: function traverseDeclarationIdentifiers(variableDeclarationNode, callback) {
  7319. variableDeclarationNode.declarations.forEach(function (declarationNode) {
  7320. if (NodeGuards_1.NodeGuards.isObjectPatternNode(declarationNode.id)) {
  7321. return estraverse.VisitorOption.Skip;
  7322. }
  7323. estraverse.traverse(declarationNode.id, {
  7324. enter: function enter(node) {
  7325. if (NodeGuards_1.NodeGuards.isIdentifierNode(node)) {
  7326. callback(node);
  7327. }
  7328. }
  7329. });
  7330. });
  7331. }
  7332. }]);
  7333. return VariableDeclarationTransformer;
  7334. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  7335. 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);
  7336. exports.VariableDeclarationTransformer = VariableDeclarationTransformer;
  7337. /***/ }),
  7338. /* 159 */
  7339. /***/ (function(module, exports, __webpack_require__) {
  7340. "use strict";
  7341. Object.defineProperty(exports, "__esModule", {
  7342. value: true
  7343. });
  7344. var inversify_1 = __webpack_require__(1);
  7345. var ServiceIdentifiers_1 = __webpack_require__(3);
  7346. var Options_1 = __webpack_require__(160);
  7347. var OptionsNormalizer_1 = __webpack_require__(163);
  7348. exports.optionsModule = new inversify_1.ContainerModule(function (bind) {
  7349. bind(ServiceIdentifiers_1.ServiceIdentifiers.IOptions).to(Options_1.Options).inSingletonScope();
  7350. bind(ServiceIdentifiers_1.ServiceIdentifiers.IOptionsNormalizer).to(OptionsNormalizer_1.OptionsNormalizer).inSingletonScope();
  7351. });
  7352. /***/ }),
  7353. /* 160 */
  7354. /***/ (function(module, exports, __webpack_require__) {
  7355. "use strict";
  7356. var _Object$assign = __webpack_require__(11);
  7357. var _classCallCheck = __webpack_require__(0);
  7358. Object.defineProperty(exports, "__esModule", {
  7359. value: true
  7360. });
  7361. var tslib_1 = __webpack_require__(4);
  7362. var inversify_1 = __webpack_require__(1);
  7363. var ServiceIdentifiers_1 = __webpack_require__(3);
  7364. var class_validator_1 = __webpack_require__(161);
  7365. var IdentifierNamesGenerator_1 = __webpack_require__(35);
  7366. var ObfuscationTarget_1 = __webpack_require__(21);
  7367. var SourceMapMode_1 = __webpack_require__(36);
  7368. var StringArrayEncoding_1 = __webpack_require__(37);
  7369. var Default_1 = __webpack_require__(46);
  7370. var ValidationErrorsFormatter_1 = __webpack_require__(162);
  7371. var Options = Options_1 = function Options(inputOptions, optionsNormalizer) {
  7372. _classCallCheck(this, Options);
  7373. _Object$assign(this, Default_1.DEFAULT_PRESET, inputOptions);
  7374. var errors = class_validator_1.validateSync(this, Options_1.validatorOptions);
  7375. if (errors.length) {
  7376. throw new ReferenceError("Validation failed. errors:\n".concat(ValidationErrorsFormatter_1.ValidationErrorsFormatter.format(errors)));
  7377. }
  7378. _Object$assign(this, optionsNormalizer.normalize(this));
  7379. };
  7380. Options.validatorOptions = {
  7381. validationError: {
  7382. target: false
  7383. }
  7384. };
  7385. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "compact", void 0);
  7386. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "controlFlowFlattening", void 0);
  7387. 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);
  7388. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "deadCodeInjection", void 0);
  7389. tslib_1.__decorate([class_validator_1.IsNumber(), tslib_1.__metadata("design:type", Number)], Options.prototype, "deadCodeInjectionThreshold", void 0);
  7390. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "debugProtection", void 0);
  7391. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "debugProtectionInterval", void 0);
  7392. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "disableConsoleOutput", void 0);
  7393. tslib_1.__decorate([class_validator_1.IsArray(), class_validator_1.ArrayUnique(), class_validator_1.IsString({
  7394. each: true
  7395. }), tslib_1.__metadata("design:type", Array)], Options.prototype, "domainLock", void 0);
  7396. 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);
  7397. tslib_1.__decorate([class_validator_1.IsString(), tslib_1.__metadata("design:type", String)], Options.prototype, "identifiersPrefix", void 0);
  7398. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "log", void 0);
  7399. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "renameGlobals", void 0);
  7400. tslib_1.__decorate([class_validator_1.IsArray(), class_validator_1.ArrayUnique(), class_validator_1.IsString({
  7401. each: true
  7402. }), tslib_1.__metadata("design:type", Array)], Options.prototype, "reservedNames", void 0);
  7403. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "rotateStringArray", void 0);
  7404. tslib_1.__decorate([class_validator_1.IsNumber(), tslib_1.__metadata("design:type", Number)], Options.prototype, "seed", void 0);
  7405. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "selfDefending", void 0);
  7406. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "sourceMap", void 0);
  7407. tslib_1.__decorate([class_validator_1.IsString(), class_validator_1.ValidateIf(function (options) {
  7408. return Boolean(options.sourceMapBaseUrl);
  7409. }), class_validator_1.IsUrl({
  7410. require_protocol: true,
  7411. require_tld: false,
  7412. require_valid_protocol: true
  7413. }), tslib_1.__metadata("design:type", String)], Options.prototype, "sourceMapBaseUrl", void 0);
  7414. tslib_1.__decorate([class_validator_1.IsString(), tslib_1.__metadata("design:type", String)], Options.prototype, "sourceMapFileName", void 0);
  7415. 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);
  7416. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "stringArray", void 0);
  7417. 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);
  7418. 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);
  7419. 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);
  7420. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "transformObjectKeys", void 0);
  7421. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "unicodeEscapeSequence", void 0);
  7422. Options = Options_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.TInputOptions)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptionsNormalizer)), tslib_1.__metadata("design:paramtypes", [Object, Object])], Options);
  7423. exports.Options = Options;
  7424. var Options_1;
  7425. /***/ }),
  7426. /* 161 */
  7427. /***/ (function(module, exports) {
  7428. module.exports = require("class-validator");
  7429. /***/ }),
  7430. /* 162 */
  7431. /***/ (function(module, exports, __webpack_require__) {
  7432. "use strict";
  7433. var _getIterator = __webpack_require__(33);
  7434. var _classCallCheck = __webpack_require__(0);
  7435. var _createClass = __webpack_require__(2);
  7436. Object.defineProperty(exports, "__esModule", {
  7437. value: true
  7438. });
  7439. var ValidationErrorsFormatter =
  7440. /*#__PURE__*/
  7441. function () {
  7442. function ValidationErrorsFormatter() {
  7443. _classCallCheck(this, ValidationErrorsFormatter);
  7444. }
  7445. _createClass(ValidationErrorsFormatter, null, [{
  7446. key: "format",
  7447. value: function format(validationErrors) {
  7448. var errorsArray = [];
  7449. var _iteratorNormalCompletion = true;
  7450. var _didIteratorError = false;
  7451. var _iteratorError = undefined;
  7452. try {
  7453. for (var _iterator = _getIterator(validationErrors), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  7454. var _error = _step.value;
  7455. errorsArray.push(ValidationErrorsFormatter.formatError(_error));
  7456. }
  7457. } catch (err) {
  7458. _didIteratorError = true;
  7459. _iteratorError = err;
  7460. } finally {
  7461. try {
  7462. if (!_iteratorNormalCompletion && _iterator.return != null) {
  7463. _iterator.return();
  7464. }
  7465. } finally {
  7466. if (_didIteratorError) {
  7467. throw _iteratorError;
  7468. }
  7469. }
  7470. }
  7471. return errorsArray.join('\n');
  7472. }
  7473. }, {
  7474. key: "formatError",
  7475. value: function formatError(validationError) {
  7476. var constraints = validationError.constraints;
  7477. var errorString = "`".concat(validationError.property, "` errors:\n");
  7478. for (var constraint in constraints) {
  7479. if (!constraints.hasOwnProperty(constraint)) {
  7480. continue;
  7481. }
  7482. errorString += " - ".concat(constraints[constraint], "\n");
  7483. }
  7484. return errorString;
  7485. }
  7486. }]);
  7487. return ValidationErrorsFormatter;
  7488. }();
  7489. exports.ValidationErrorsFormatter = ValidationErrorsFormatter;
  7490. /***/ }),
  7491. /* 163 */
  7492. /***/ (function(module, exports, __webpack_require__) {
  7493. "use strict";
  7494. var _getIterator = __webpack_require__(33);
  7495. var _Object$assign = __webpack_require__(11);
  7496. var _classCallCheck = __webpack_require__(0);
  7497. var _createClass = __webpack_require__(2);
  7498. Object.defineProperty(exports, "__esModule", {
  7499. value: true
  7500. });
  7501. var tslib_1 = __webpack_require__(4);
  7502. var inversify_1 = __webpack_require__(1);
  7503. var ControlFlowFlatteningThresholdRule_1 = __webpack_require__(164);
  7504. var DeadCodeInjectionRule_1 = __webpack_require__(165);
  7505. var DeadCodeInjectionThresholdRule_1 = __webpack_require__(166);
  7506. var DomainLockRule_1 = __webpack_require__(167);
  7507. var SelfDefendingRule_1 = __webpack_require__(168);
  7508. var SourceMapBaseUrlRule_1 = __webpack_require__(169);
  7509. var SourceMapFileNameRule_1 = __webpack_require__(170);
  7510. var StringArrayRule_1 = __webpack_require__(171);
  7511. var StringArrayEncodingRule_1 = __webpack_require__(172);
  7512. var StringArrayThresholdRule_1 = __webpack_require__(173);
  7513. var OptionsNormalizer = OptionsNormalizer_1 =
  7514. /*#__PURE__*/
  7515. function () {
  7516. function OptionsNormalizer() {
  7517. _classCallCheck(this, OptionsNormalizer);
  7518. }
  7519. _createClass(OptionsNormalizer, [{
  7520. key: "normalize",
  7521. value: function normalize(options) {
  7522. var normalizedOptions = _Object$assign({}, options);
  7523. var _iteratorNormalCompletion = true;
  7524. var _didIteratorError = false;
  7525. var _iteratorError = undefined;
  7526. try {
  7527. for (var _iterator = _getIterator(OptionsNormalizer_1.normalizerRules), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  7528. var _normalizerRule = _step.value;
  7529. normalizedOptions = _normalizerRule(normalizedOptions);
  7530. }
  7531. } catch (err) {
  7532. _didIteratorError = true;
  7533. _iteratorError = err;
  7534. } finally {
  7535. try {
  7536. if (!_iteratorNormalCompletion && _iterator.return != null) {
  7537. _iterator.return();
  7538. }
  7539. } finally {
  7540. if (_didIteratorError) {
  7541. throw _iteratorError;
  7542. }
  7543. }
  7544. }
  7545. return normalizedOptions;
  7546. }
  7547. }]);
  7548. return OptionsNormalizer;
  7549. }();
  7550. 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];
  7551. OptionsNormalizer = OptionsNormalizer_1 = tslib_1.__decorate([inversify_1.injectable()], OptionsNormalizer);
  7552. exports.OptionsNormalizer = OptionsNormalizer;
  7553. var OptionsNormalizer_1;
  7554. /***/ }),
  7555. /* 164 */
  7556. /***/ (function(module, exports, __webpack_require__) {
  7557. "use strict";
  7558. var _Object$assign = __webpack_require__(11);
  7559. Object.defineProperty(exports, "__esModule", {
  7560. value: true
  7561. });
  7562. exports.ControlFlowFlatteningThresholdRule = function (options) {
  7563. if (options.controlFlowFlatteningThreshold === 0) {
  7564. options = _Object$assign({}, options, {
  7565. controlFlowFlattening: false,
  7566. controlFlowFlatteningThreshold: 0
  7567. });
  7568. }
  7569. return options;
  7570. };
  7571. /***/ }),
  7572. /* 165 */
  7573. /***/ (function(module, exports, __webpack_require__) {
  7574. "use strict";
  7575. var _Object$assign = __webpack_require__(11);
  7576. Object.defineProperty(exports, "__esModule", {
  7577. value: true
  7578. });
  7579. var Default_1 = __webpack_require__(46);
  7580. exports.DeadCodeInjectionRule = function (options) {
  7581. if (options.deadCodeInjection) {
  7582. options = _Object$assign({}, options, {
  7583. deadCodeInjection: true,
  7584. stringArray: true
  7585. });
  7586. if (!options.stringArrayThreshold) {
  7587. options = _Object$assign({}, options, {
  7588. stringArray: true,
  7589. stringArrayThreshold: Default_1.DEFAULT_PRESET.stringArrayThreshold
  7590. });
  7591. }
  7592. }
  7593. return options;
  7594. };
  7595. /***/ }),
  7596. /* 166 */
  7597. /***/ (function(module, exports, __webpack_require__) {
  7598. "use strict";
  7599. var _Object$assign = __webpack_require__(11);
  7600. Object.defineProperty(exports, "__esModule", {
  7601. value: true
  7602. });
  7603. exports.DeadCodeInjectionThresholdRule = function (options) {
  7604. if (options.deadCodeInjectionThreshold === 0) {
  7605. options = _Object$assign({}, options, {
  7606. deadCodeInjection: false,
  7607. deadCodeInjectionThreshold: 0
  7608. });
  7609. }
  7610. return options;
  7611. };
  7612. /***/ }),
  7613. /* 167 */
  7614. /***/ (function(module, exports, __webpack_require__) {
  7615. "use strict";
  7616. var _getIterator = __webpack_require__(33);
  7617. var _Object$assign = __webpack_require__(11);
  7618. Object.defineProperty(exports, "__esModule", {
  7619. value: true
  7620. });
  7621. var Utils_1 = __webpack_require__(32);
  7622. exports.DomainLockRule = function (options) {
  7623. if (options.domainLock.length) {
  7624. var normalizedDomains = [];
  7625. var _iteratorNormalCompletion = true;
  7626. var _didIteratorError = false;
  7627. var _iteratorError = undefined;
  7628. try {
  7629. for (var _iterator = _getIterator(options.domainLock), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  7630. var _domain = _step.value;
  7631. normalizedDomains.push(Utils_1.Utils.extractDomainFromUrl(_domain));
  7632. }
  7633. } catch (err) {
  7634. _didIteratorError = true;
  7635. _iteratorError = err;
  7636. } finally {
  7637. try {
  7638. if (!_iteratorNormalCompletion && _iterator.return != null) {
  7639. _iterator.return();
  7640. }
  7641. } finally {
  7642. if (_didIteratorError) {
  7643. throw _iteratorError;
  7644. }
  7645. }
  7646. }
  7647. options = _Object$assign({}, options, {
  7648. domainLock: normalizedDomains
  7649. });
  7650. }
  7651. return options;
  7652. };
  7653. /***/ }),
  7654. /* 168 */
  7655. /***/ (function(module, exports, __webpack_require__) {
  7656. "use strict";
  7657. var _Object$assign = __webpack_require__(11);
  7658. Object.defineProperty(exports, "__esModule", {
  7659. value: true
  7660. });
  7661. exports.SelfDefendingRule = function (options) {
  7662. if (options.selfDefending) {
  7663. options = _Object$assign({}, options, {
  7664. compact: true,
  7665. selfDefending: true
  7666. });
  7667. }
  7668. return options;
  7669. };
  7670. /***/ }),
  7671. /* 169 */
  7672. /***/ (function(module, exports, __webpack_require__) {
  7673. "use strict";
  7674. var _Object$assign = __webpack_require__(11);
  7675. Object.defineProperty(exports, "__esModule", {
  7676. value: true
  7677. });
  7678. exports.SourceMapBaseUrlRule = function (options) {
  7679. var _options = options,
  7680. sourceMapBaseUrl = _options.sourceMapBaseUrl;
  7681. if (!options.sourceMapFileName) {
  7682. options = _Object$assign({}, options, {
  7683. sourceMapBaseUrl: ''
  7684. });
  7685. return options;
  7686. }
  7687. if (sourceMapBaseUrl && !sourceMapBaseUrl.endsWith('/')) {
  7688. options = _Object$assign({}, options, {
  7689. sourceMapBaseUrl: "".concat(sourceMapBaseUrl, "/")
  7690. });
  7691. }
  7692. return options;
  7693. };
  7694. /***/ }),
  7695. /* 170 */
  7696. /***/ (function(module, exports, __webpack_require__) {
  7697. "use strict";
  7698. var _Object$assign = __webpack_require__(11);
  7699. Object.defineProperty(exports, "__esModule", {
  7700. value: true
  7701. });
  7702. exports.SourceMapFileNameRule = function (options) {
  7703. var _options = options,
  7704. sourceMapFileName = _options.sourceMapFileName;
  7705. if (sourceMapFileName) {
  7706. sourceMapFileName = sourceMapFileName.replace(/^\/+/, '').split('.')[0];
  7707. options = _Object$assign({}, options, {
  7708. sourceMapFileName: "".concat(sourceMapFileName, ".js.map")
  7709. });
  7710. }
  7711. return options;
  7712. };
  7713. /***/ }),
  7714. /* 171 */
  7715. /***/ (function(module, exports, __webpack_require__) {
  7716. "use strict";
  7717. var _Object$assign = __webpack_require__(11);
  7718. Object.defineProperty(exports, "__esModule", {
  7719. value: true
  7720. });
  7721. exports.StringArrayRule = function (options) {
  7722. if (!options.stringArray) {
  7723. options = _Object$assign({}, options, {
  7724. rotateStringArray: false,
  7725. stringArray: false,
  7726. stringArrayEncoding: false,
  7727. stringArrayThreshold: 0
  7728. });
  7729. }
  7730. return options;
  7731. };
  7732. /***/ }),
  7733. /* 172 */
  7734. /***/ (function(module, exports, __webpack_require__) {
  7735. "use strict";
  7736. var _Object$assign = __webpack_require__(11);
  7737. Object.defineProperty(exports, "__esModule", {
  7738. value: true
  7739. });
  7740. var StringArrayEncoding_1 = __webpack_require__(37);
  7741. exports.StringArrayEncodingRule = function (options) {
  7742. if (options.stringArrayEncoding === true) {
  7743. options = _Object$assign({}, options, {
  7744. stringArrayEncoding: StringArrayEncoding_1.StringArrayEncoding.Base64
  7745. });
  7746. }
  7747. return options;
  7748. };
  7749. /***/ }),
  7750. /* 173 */
  7751. /***/ (function(module, exports, __webpack_require__) {
  7752. "use strict";
  7753. var _Object$assign = __webpack_require__(11);
  7754. Object.defineProperty(exports, "__esModule", {
  7755. value: true
  7756. });
  7757. exports.StringArrayThresholdRule = function (options) {
  7758. if (options.stringArrayThreshold === 0) {
  7759. options = _Object$assign({}, options, {
  7760. rotateStringArray: false,
  7761. stringArray: false,
  7762. stringArrayEncoding: false,
  7763. stringArrayThreshold: 0
  7764. });
  7765. }
  7766. return options;
  7767. };
  7768. /***/ }),
  7769. /* 174 */
  7770. /***/ (function(module, exports, __webpack_require__) {
  7771. "use strict";
  7772. Object.defineProperty(exports, "__esModule", {
  7773. value: true
  7774. });
  7775. var InversifyContainerFacade_1 = __webpack_require__(22);
  7776. var inversify_1 = __webpack_require__(1);
  7777. var ServiceIdentifiers_1 = __webpack_require__(3);
  7778. var NodeTransformer_1 = __webpack_require__(28);
  7779. var ObfuscatingGuard_1 = __webpack_require__(60);
  7780. var BlackListObfuscatingGuard_1 = __webpack_require__(175);
  7781. var CommentsTransformer_1 = __webpack_require__(176);
  7782. var ConditionalCommentObfuscatingGuard_1 = __webpack_require__(177);
  7783. var CustomNodesTransformer_1 = __webpack_require__(178);
  7784. var EvaCallExpressionTransformer_1 = __webpack_require__(179);
  7785. var ObfuscatingGuardsTransformer_1 = __webpack_require__(181);
  7786. var ParentificationTransformer_1 = __webpack_require__(182);
  7787. exports.preparingTransformersModule = new inversify_1.ContainerModule(function (bind) {
  7788. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(CommentsTransformer_1.CommentsTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.CommentsTransformer);
  7789. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(CustomNodesTransformer_1.CustomNodesTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.CustomNodesTransformer);
  7790. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(EvaCallExpressionTransformer_1.EvalCallExpressionTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.EvalCallExpressionTransformer);
  7791. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(ObfuscatingGuardsTransformer_1.ObfuscatingGuardsTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.ObfuscatingGuardsTransformer);
  7792. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(ParentificationTransformer_1.ParentificationTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.ParentificationTransformer);
  7793. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeGuard).to(BlackListObfuscatingGuard_1.BlackListObfuscatingGuard).inSingletonScope().whenTargetNamed(ObfuscatingGuard_1.ObfuscatingGuard.BlackListNodeGuard);
  7794. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeGuard).to(ConditionalCommentObfuscatingGuard_1.ConditionalCommentObfuscatingGuard).inSingletonScope().whenTargetNamed(ObfuscatingGuard_1.ObfuscatingGuard.ConditionalCommentNodeGuard);
  7795. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__INodeGuard).toFactory(InversifyContainerFacade_1.InversifyContainerFacade.getCacheFactory(ServiceIdentifiers_1.ServiceIdentifiers.INodeGuard));
  7796. });
  7797. /***/ }),
  7798. /* 175 */
  7799. /***/ (function(module, exports, __webpack_require__) {
  7800. "use strict";
  7801. var _classCallCheck = __webpack_require__(0);
  7802. var _createClass = __webpack_require__(2);
  7803. Object.defineProperty(exports, "__esModule", {
  7804. value: true
  7805. });
  7806. var tslib_1 = __webpack_require__(4);
  7807. var inversify_1 = __webpack_require__(1);
  7808. var NodeGuards_1 = __webpack_require__(8);
  7809. var BlackListObfuscatingGuard = BlackListObfuscatingGuard_1 =
  7810. /*#__PURE__*/
  7811. function () {
  7812. function BlackListObfuscatingGuard() {
  7813. _classCallCheck(this, BlackListObfuscatingGuard);
  7814. this.blackListGuardsLength = BlackListObfuscatingGuard_1.blackListGuards.length;
  7815. }
  7816. _createClass(BlackListObfuscatingGuard, [{
  7817. key: "check",
  7818. value: function check(node) {
  7819. for (var i = 0; i < this.blackListGuardsLength; i++) {
  7820. if (BlackListObfuscatingGuard_1.blackListGuards[i](node)) {
  7821. return false;
  7822. }
  7823. }
  7824. return true;
  7825. }
  7826. }]);
  7827. return BlackListObfuscatingGuard;
  7828. }();
  7829. BlackListObfuscatingGuard.blackListGuards = [NodeGuards_1.NodeGuards.isUseStrictOperator];
  7830. BlackListObfuscatingGuard = BlackListObfuscatingGuard_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__metadata("design:paramtypes", [])], BlackListObfuscatingGuard);
  7831. exports.BlackListObfuscatingGuard = BlackListObfuscatingGuard;
  7832. var BlackListObfuscatingGuard_1;
  7833. /***/ }),
  7834. /* 176 */
  7835. /***/ (function(module, exports, __webpack_require__) {
  7836. "use strict";
  7837. var _Object$getPrototypeOf = __webpack_require__(5);
  7838. var _classCallCheck = __webpack_require__(0);
  7839. var _createClass = __webpack_require__(2);
  7840. var _possibleConstructorReturn = __webpack_require__(6);
  7841. var _inherits = __webpack_require__(7);
  7842. Object.defineProperty(exports, "__esModule", {
  7843. value: true
  7844. });
  7845. var tslib_1 = __webpack_require__(4);
  7846. var inversify_1 = __webpack_require__(1);
  7847. var ServiceIdentifiers_1 = __webpack_require__(3);
  7848. var TransformationStage_1 = __webpack_require__(12);
  7849. var AbstractNodeTransformer_1 = __webpack_require__(13);
  7850. var NodeGuards_1 = __webpack_require__(8);
  7851. var CommentsTransformer = CommentsTransformer_1 =
  7852. /*#__PURE__*/
  7853. function (_AbstractNodeTransfor) {
  7854. _inherits(CommentsTransformer, _AbstractNodeTransfor);
  7855. function CommentsTransformer(randomGenerator, options) {
  7856. _classCallCheck(this, CommentsTransformer);
  7857. return _possibleConstructorReturn(this, (CommentsTransformer.__proto__ || _Object$getPrototypeOf(CommentsTransformer)).call(this, randomGenerator, options));
  7858. }
  7859. _createClass(CommentsTransformer, [{
  7860. key: "getVisitor",
  7861. value: function getVisitor(transformationStage) {
  7862. var _this = this;
  7863. switch (transformationStage) {
  7864. case TransformationStage_1.TransformationStage.Preparing:
  7865. return {
  7866. leave: function leave(node, parentNode) {
  7867. if (parentNode && NodeGuards_1.NodeGuards.isNodeWithComments(node)) {
  7868. return _this.transformNode(node, parentNode);
  7869. }
  7870. }
  7871. };
  7872. default:
  7873. return null;
  7874. }
  7875. }
  7876. }, {
  7877. key: "transformNode",
  7878. value: function transformNode(node, parentNode) {
  7879. if (node.leadingComments) {
  7880. node.leadingComments = this.transformComments(node.leadingComments);
  7881. }
  7882. if (node.trailingComments) {
  7883. node.trailingComments = this.transformComments(node.trailingComments);
  7884. }
  7885. return node;
  7886. }
  7887. }, {
  7888. key: "transformComments",
  7889. value: function transformComments(comments) {
  7890. return comments.filter(function (comment) {
  7891. return CommentsTransformer_1.preservedWords.some(function (availableWord) {
  7892. return comment.value.includes(availableWord);
  7893. });
  7894. });
  7895. }
  7896. }]);
  7897. return CommentsTransformer;
  7898. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  7899. CommentsTransformer.preservedWords = ['@license', '@preserve'];
  7900. 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);
  7901. exports.CommentsTransformer = CommentsTransformer;
  7902. var CommentsTransformer_1;
  7903. /***/ }),
  7904. /* 177 */
  7905. /***/ (function(module, exports, __webpack_require__) {
  7906. "use strict";
  7907. var _classCallCheck = __webpack_require__(0);
  7908. var _createClass = __webpack_require__(2);
  7909. Object.defineProperty(exports, "__esModule", {
  7910. value: true
  7911. });
  7912. var tslib_1 = __webpack_require__(4);
  7913. var inversify_1 = __webpack_require__(1);
  7914. var NodeGuards_1 = __webpack_require__(8);
  7915. var ConditionalCommentObfuscatingGuard = ConditionalCommentObfuscatingGuard_1 =
  7916. /*#__PURE__*/
  7917. function () {
  7918. function ConditionalCommentObfuscatingGuard() {
  7919. _classCallCheck(this, ConditionalCommentObfuscatingGuard);
  7920. this.obfuscationAllowedForCurrentNode = true;
  7921. this.obfuscationAllowedForNextNode = null;
  7922. }
  7923. _createClass(ConditionalCommentObfuscatingGuard, [{
  7924. key: "check",
  7925. value: function check(node) {
  7926. if (this.obfuscationAllowedForNextNode) {
  7927. this.obfuscationAllowedForCurrentNode = this.obfuscationAllowedForNextNode;
  7928. this.obfuscationAllowedForNextNode = null;
  7929. }
  7930. if (!NodeGuards_1.NodeGuards.isNodeWithComments(node)) {
  7931. return this.obfuscationAllowedForCurrentNode;
  7932. }
  7933. var leadingComments = node.leadingComments;
  7934. var trailingComments = node.trailingComments;
  7935. if (leadingComments) {
  7936. this.obfuscationAllowedForCurrentNode = this.checkComments(leadingComments);
  7937. }
  7938. if (trailingComments) {
  7939. this.obfuscationAllowedForNextNode = this.checkComments(trailingComments);
  7940. }
  7941. return this.obfuscationAllowedForCurrentNode;
  7942. }
  7943. }, {
  7944. key: "checkComments",
  7945. value: function checkComments(comments) {
  7946. var commentsLength = comments.length;
  7947. var obfuscationAllowed = this.obfuscationAllowedForCurrentNode;
  7948. for (var i = 0; i < commentsLength; i++) {
  7949. var comment = comments[i];
  7950. if (ConditionalCommentObfuscatingGuard_1.obfuscationEnableCommentRegExp.test(comment.value)) {
  7951. obfuscationAllowed = true;
  7952. continue;
  7953. }
  7954. if (ConditionalCommentObfuscatingGuard_1.obfuscationDisableCommentRegExp.test(comment.value)) {
  7955. obfuscationAllowed = false;
  7956. }
  7957. }
  7958. return obfuscationAllowed;
  7959. }
  7960. }]);
  7961. return ConditionalCommentObfuscatingGuard;
  7962. }();
  7963. ConditionalCommentObfuscatingGuard.obfuscationEnableCommentRegExp = new RegExp('javascript-obfuscator *: *enable');
  7964. ConditionalCommentObfuscatingGuard.obfuscationDisableCommentRegExp = new RegExp('javascript-obfuscator *: *disable');
  7965. ConditionalCommentObfuscatingGuard = ConditionalCommentObfuscatingGuard_1 = tslib_1.__decorate([inversify_1.injectable()], ConditionalCommentObfuscatingGuard);
  7966. exports.ConditionalCommentObfuscatingGuard = ConditionalCommentObfuscatingGuard;
  7967. var ConditionalCommentObfuscatingGuard_1;
  7968. /***/ }),
  7969. /* 178 */
  7970. /***/ (function(module, exports, __webpack_require__) {
  7971. "use strict";
  7972. var _Object$getPrototypeOf = __webpack_require__(5);
  7973. var _classCallCheck = __webpack_require__(0);
  7974. var _createClass = __webpack_require__(2);
  7975. var _possibleConstructorReturn = __webpack_require__(6);
  7976. var _inherits = __webpack_require__(7);
  7977. Object.defineProperty(exports, "__esModule", {
  7978. value: true
  7979. });
  7980. var tslib_1 = __webpack_require__(4);
  7981. var inversify_1 = __webpack_require__(1);
  7982. var ServiceIdentifiers_1 = __webpack_require__(3);
  7983. var ObfuscationEvent_1 = __webpack_require__(25);
  7984. var TransformationStage_1 = __webpack_require__(12);
  7985. var AbstractNodeTransformer_1 = __webpack_require__(13);
  7986. var NodeGuards_1 = __webpack_require__(8);
  7987. var CustomNodesTransformer =
  7988. /*#__PURE__*/
  7989. function (_AbstractNodeTransfor) {
  7990. _inherits(CustomNodesTransformer, _AbstractNodeTransfor);
  7991. function CustomNodesTransformer(stackTraceAnalyzer, obfuscationEventEmitter, customNodeGroupStorage, randomGenerator, options) {
  7992. var _this;
  7993. _classCallCheck(this, CustomNodesTransformer);
  7994. _this = _possibleConstructorReturn(this, (CustomNodesTransformer.__proto__ || _Object$getPrototypeOf(CustomNodesTransformer)).call(this, randomGenerator, options));
  7995. _this.stackTraceData = [];
  7996. _this.stackTraceAnalyzer = stackTraceAnalyzer;
  7997. _this.obfuscationEventEmitter = obfuscationEventEmitter;
  7998. _this.customNodeGroupStorage = customNodeGroupStorage;
  7999. return _this;
  8000. }
  8001. _createClass(CustomNodesTransformer, [{
  8002. key: "getVisitor",
  8003. value: function getVisitor(transformationStage) {
  8004. var _this2 = this;
  8005. switch (transformationStage) {
  8006. case TransformationStage_1.TransformationStage.Preparing:
  8007. return {
  8008. leave: function leave(node, parentNode) {
  8009. if (NodeGuards_1.NodeGuards.isProgramNode(node)) {
  8010. _this2.analyzeNode(node, parentNode);
  8011. _this2.appendCustomNodesBeforeObfuscation(node, parentNode);
  8012. return _this2.transformNode(node, parentNode);
  8013. }
  8014. }
  8015. };
  8016. case TransformationStage_1.TransformationStage.Finalizing:
  8017. return {
  8018. leave: function leave(node, parentNode) {
  8019. if (NodeGuards_1.NodeGuards.isProgramNode(node)) {
  8020. _this2.appendCustomNodesAfterObfuscation(node, parentNode);
  8021. }
  8022. }
  8023. };
  8024. default:
  8025. return null;
  8026. }
  8027. }
  8028. }, {
  8029. key: "analyzeNode",
  8030. value: function analyzeNode(node, parentNode) {
  8031. this.stackTraceData = this.stackTraceAnalyzer.analyze(node);
  8032. }
  8033. }, {
  8034. key: "transformNode",
  8035. value: function transformNode(node, parentNode) {
  8036. return node;
  8037. }
  8038. }, {
  8039. key: "appendCustomNodesBeforeObfuscation",
  8040. value: function appendCustomNodesBeforeObfuscation(node, parentNode) {
  8041. var _this3 = this;
  8042. this.customNodeGroupStorage.getStorage().forEach(function (customNodeGroup) {
  8043. customNodeGroup.initialize();
  8044. _this3.obfuscationEventEmitter.once(customNodeGroup.getAppendEvent(), customNodeGroup.appendCustomNodes.bind(customNodeGroup));
  8045. });
  8046. this.obfuscationEventEmitter.emit(ObfuscationEvent_1.ObfuscationEvent.BeforeObfuscation, node, this.stackTraceData);
  8047. }
  8048. }, {
  8049. key: "appendCustomNodesAfterObfuscation",
  8050. value: function appendCustomNodesAfterObfuscation(node, parentNode) {
  8051. this.obfuscationEventEmitter.emit(ObfuscationEvent_1.ObfuscationEvent.AfterObfuscation, node, this.stackTraceData);
  8052. }
  8053. }]);
  8054. return CustomNodesTransformer;
  8055. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  8056. CustomNodesTransformer = 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.IRandomGenerator)), tslib_1.__param(4, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object, Object, Object, Object])], CustomNodesTransformer);
  8057. exports.CustomNodesTransformer = CustomNodesTransformer;
  8058. /***/ }),
  8059. /* 179 */
  8060. /***/ (function(module, exports, __webpack_require__) {
  8061. "use strict";
  8062. var _Set = __webpack_require__(29);
  8063. var _Object$getPrototypeOf = __webpack_require__(5);
  8064. var _classCallCheck = __webpack_require__(0);
  8065. var _createClass = __webpack_require__(2);
  8066. var _possibleConstructorReturn = __webpack_require__(6);
  8067. var _inherits = __webpack_require__(7);
  8068. Object.defineProperty(exports, "__esModule", {
  8069. value: true
  8070. });
  8071. var tslib_1 = __webpack_require__(4);
  8072. var inversify_1 = __webpack_require__(1);
  8073. var ServiceIdentifiers_1 = __webpack_require__(3);
  8074. var js_string_escape_1 = tslib_1.__importDefault(__webpack_require__(180));
  8075. var TransformationStage_1 = __webpack_require__(12);
  8076. var AbstractNodeTransformer_1 = __webpack_require__(13);
  8077. var NodeGuards_1 = __webpack_require__(8);
  8078. var Nodes_1 = __webpack_require__(15);
  8079. var NodeUtils_1 = __webpack_require__(9);
  8080. var EvalCallExpressionTransformer = EvalCallExpressionTransformer_1 =
  8081. /*#__PURE__*/
  8082. function (_AbstractNodeTransfor) {
  8083. _inherits(EvalCallExpressionTransformer, _AbstractNodeTransfor);
  8084. function EvalCallExpressionTransformer(randomGenerator, options) {
  8085. var _this;
  8086. _classCallCheck(this, EvalCallExpressionTransformer);
  8087. _this = _possibleConstructorReturn(this, (EvalCallExpressionTransformer.__proto__ || _Object$getPrototypeOf(EvalCallExpressionTransformer)).call(this, randomGenerator, options));
  8088. _this.evalRootAstHostNodeSet = new _Set();
  8089. return _this;
  8090. }
  8091. _createClass(EvalCallExpressionTransformer, [{
  8092. key: "getVisitor",
  8093. value: function getVisitor(transformationStage) {
  8094. var _this2 = this;
  8095. switch (transformationStage) {
  8096. case TransformationStage_1.TransformationStage.Preparing:
  8097. return {
  8098. enter: function enter(node, parentNode) {
  8099. if (parentNode && NodeGuards_1.NodeGuards.isCallExpressionNode(node) && NodeGuards_1.NodeGuards.isIdentifierNode(node.callee) && node.callee.name === 'eval') {
  8100. return _this2.transformNode(node, parentNode);
  8101. }
  8102. }
  8103. };
  8104. case TransformationStage_1.TransformationStage.Finalizing:
  8105. if (!this.evalRootAstHostNodeSet.size) {
  8106. return null;
  8107. }
  8108. return {
  8109. leave: function leave(node, parentNode) {
  8110. if (parentNode && _this2.isEvalRootAstHostNode(node)) {
  8111. return _this2.restoreNode(node, parentNode);
  8112. }
  8113. }
  8114. };
  8115. default:
  8116. return null;
  8117. }
  8118. }
  8119. }, {
  8120. key: "transformNode",
  8121. value: function transformNode(callExpressionNode, parentNode) {
  8122. var callExpressionFirstArgument = callExpressionNode.arguments[0];
  8123. if (!callExpressionFirstArgument) {
  8124. return callExpressionNode;
  8125. }
  8126. var evalString = EvalCallExpressionTransformer_1.extractEvalStringFromCallExpressionArgument(callExpressionFirstArgument);
  8127. if (!evalString) {
  8128. return callExpressionNode;
  8129. }
  8130. var ast;
  8131. try {
  8132. ast = NodeUtils_1.NodeUtils.convertCodeToStructure(evalString);
  8133. } catch (_a) {
  8134. return callExpressionNode;
  8135. }
  8136. var evalRootAstHostNode = Nodes_1.Nodes.getFunctionExpressionNode([], Nodes_1.Nodes.getBlockStatementNode(ast));
  8137. this.evalRootAstHostNodeSet.add(evalRootAstHostNode);
  8138. return evalRootAstHostNode;
  8139. }
  8140. }, {
  8141. key: "restoreNode",
  8142. value: function restoreNode(evalRootAstHostNode, parentNode) {
  8143. var targetAst = evalRootAstHostNode.body.body;
  8144. var obfuscatedCode = NodeUtils_1.NodeUtils.convertStructureToCode(targetAst);
  8145. return Nodes_1.Nodes.getCallExpressionNode(Nodes_1.Nodes.getIdentifierNode('eval'), [Nodes_1.Nodes.getLiteralNode(js_string_escape_1.default(obfuscatedCode))]);
  8146. }
  8147. }, {
  8148. key: "isEvalRootAstHostNode",
  8149. value: function isEvalRootAstHostNode(node) {
  8150. return NodeGuards_1.NodeGuards.isFunctionExpressionNode(node) && this.evalRootAstHostNodeSet.has(node);
  8151. }
  8152. }], [{
  8153. key: "extractEvalStringFromCallExpressionArgument",
  8154. value: function extractEvalStringFromCallExpressionArgument(node) {
  8155. if (NodeGuards_1.NodeGuards.isLiteralNode(node)) {
  8156. return EvalCallExpressionTransformer_1.extractEvalStringFromLiteralNode(node);
  8157. }
  8158. if (NodeGuards_1.NodeGuards.isTemplateLiteralNode(node)) {
  8159. return EvalCallExpressionTransformer_1.extractEvalStringFromTemplateLiteralNode(node);
  8160. }
  8161. return null;
  8162. }
  8163. }, {
  8164. key: "extractEvalStringFromLiteralNode",
  8165. value: function extractEvalStringFromLiteralNode(node) {
  8166. return typeof node.value === 'string' ? node.value : null;
  8167. }
  8168. }, {
  8169. key: "extractEvalStringFromTemplateLiteralNode",
  8170. value: function extractEvalStringFromTemplateLiteralNode(node) {
  8171. var quasis = node.quasis;
  8172. var allowedQuasisLength = 1;
  8173. if (quasis.length !== allowedQuasisLength || node.expressions.length) {
  8174. return null;
  8175. }
  8176. return quasis[0].value.cooked;
  8177. }
  8178. }]);
  8179. return EvalCallExpressionTransformer;
  8180. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  8181. 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);
  8182. exports.EvalCallExpressionTransformer = EvalCallExpressionTransformer;
  8183. var EvalCallExpressionTransformer_1;
  8184. /***/ }),
  8185. /* 180 */
  8186. /***/ (function(module, exports) {
  8187. module.exports = require("js-string-escape");
  8188. /***/ }),
  8189. /* 181 */
  8190. /***/ (function(module, exports, __webpack_require__) {
  8191. "use strict";
  8192. var _Object$getPrototypeOf = __webpack_require__(5);
  8193. var _classCallCheck = __webpack_require__(0);
  8194. var _createClass = __webpack_require__(2);
  8195. var _possibleConstructorReturn = __webpack_require__(6);
  8196. var _inherits = __webpack_require__(7);
  8197. Object.defineProperty(exports, "__esModule", {
  8198. value: true
  8199. });
  8200. var tslib_1 = __webpack_require__(4);
  8201. var inversify_1 = __webpack_require__(1);
  8202. var ServiceIdentifiers_1 = __webpack_require__(3);
  8203. var ObfuscatingGuard_1 = __webpack_require__(60);
  8204. var TransformationStage_1 = __webpack_require__(12);
  8205. var AbstractNodeTransformer_1 = __webpack_require__(13);
  8206. var ObfuscatingGuardsTransformer = ObfuscatingGuardsTransformer_1 =
  8207. /*#__PURE__*/
  8208. function (_AbstractNodeTransfor) {
  8209. _inherits(ObfuscatingGuardsTransformer, _AbstractNodeTransfor);
  8210. function ObfuscatingGuardsTransformer(obfuscatingGuardFactory, randomGenerator, options) {
  8211. var _this;
  8212. _classCallCheck(this, ObfuscatingGuardsTransformer);
  8213. _this = _possibleConstructorReturn(this, (ObfuscatingGuardsTransformer.__proto__ || _Object$getPrototypeOf(ObfuscatingGuardsTransformer)).call(this, randomGenerator, options));
  8214. _this.obfuscatingGuards = ObfuscatingGuardsTransformer_1.obfuscatingGuardsList.map(obfuscatingGuardFactory);
  8215. return _this;
  8216. }
  8217. _createClass(ObfuscatingGuardsTransformer, [{
  8218. key: "getVisitor",
  8219. value: function getVisitor(transformationStage) {
  8220. var _this2 = this;
  8221. switch (transformationStage) {
  8222. case TransformationStage_1.TransformationStage.Preparing:
  8223. return {
  8224. enter: function enter(node, parentNode) {
  8225. return _this2.transformNode(node, parentNode);
  8226. }
  8227. };
  8228. default:
  8229. return null;
  8230. }
  8231. }
  8232. }, {
  8233. key: "transformNode",
  8234. value: function transformNode(node, parentNode) {
  8235. var obfuscationAllowed = this.obfuscatingGuards.every(function (nodeGuard) {
  8236. return nodeGuard.check(node);
  8237. });
  8238. node.ignoredNode = !obfuscationAllowed;
  8239. return node;
  8240. }
  8241. }]);
  8242. return ObfuscatingGuardsTransformer;
  8243. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  8244. ObfuscatingGuardsTransformer.obfuscatingGuardsList = [ObfuscatingGuard_1.ObfuscatingGuard.BlackListNodeGuard, ObfuscatingGuard_1.ObfuscatingGuard.ConditionalCommentNodeGuard];
  8245. 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);
  8246. exports.ObfuscatingGuardsTransformer = ObfuscatingGuardsTransformer;
  8247. var ObfuscatingGuardsTransformer_1;
  8248. /***/ }),
  8249. /* 182 */
  8250. /***/ (function(module, exports, __webpack_require__) {
  8251. "use strict";
  8252. var _Object$getPrototypeOf = __webpack_require__(5);
  8253. var _classCallCheck = __webpack_require__(0);
  8254. var _createClass = __webpack_require__(2);
  8255. var _possibleConstructorReturn = __webpack_require__(6);
  8256. var _inherits = __webpack_require__(7);
  8257. Object.defineProperty(exports, "__esModule", {
  8258. value: true
  8259. });
  8260. var tslib_1 = __webpack_require__(4);
  8261. var inversify_1 = __webpack_require__(1);
  8262. var ServiceIdentifiers_1 = __webpack_require__(3);
  8263. var TransformationStage_1 = __webpack_require__(12);
  8264. var AbstractNodeTransformer_1 = __webpack_require__(13);
  8265. var NodeUtils_1 = __webpack_require__(9);
  8266. var ParentificationTransformer =
  8267. /*#__PURE__*/
  8268. function (_AbstractNodeTransfor) {
  8269. _inherits(ParentificationTransformer, _AbstractNodeTransfor);
  8270. function ParentificationTransformer(randomGenerator, options) {
  8271. _classCallCheck(this, ParentificationTransformer);
  8272. return _possibleConstructorReturn(this, (ParentificationTransformer.__proto__ || _Object$getPrototypeOf(ParentificationTransformer)).call(this, randomGenerator, options));
  8273. }
  8274. _createClass(ParentificationTransformer, [{
  8275. key: "getVisitor",
  8276. value: function getVisitor(transformationStage) {
  8277. var _this = this;
  8278. switch (transformationStage) {
  8279. case TransformationStage_1.TransformationStage.Preparing:
  8280. return {
  8281. enter: function enter(node, parentNode) {
  8282. return _this.transformNode(node, parentNode);
  8283. }
  8284. };
  8285. default:
  8286. return null;
  8287. }
  8288. }
  8289. }, {
  8290. key: "transformNode",
  8291. value: function transformNode(node, parentNode) {
  8292. return NodeUtils_1.NodeUtils.parentizeNode(node, parentNode);
  8293. }
  8294. }]);
  8295. return ParentificationTransformer;
  8296. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  8297. 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);
  8298. exports.ParentificationTransformer = ParentificationTransformer;
  8299. /***/ }),
  8300. /* 183 */
  8301. /***/ (function(module, exports, __webpack_require__) {
  8302. "use strict";
  8303. Object.defineProperty(exports, "__esModule", {
  8304. value: true
  8305. });
  8306. var inversify_1 = __webpack_require__(1);
  8307. var ServiceIdentifiers_1 = __webpack_require__(3);
  8308. var ControlFlowStorage_1 = __webpack_require__(184);
  8309. var CustomNodeGroupStorage_1 = __webpack_require__(185);
  8310. var StringArrayStorage_1 = __webpack_require__(186);
  8311. exports.storagesModule = new inversify_1.ContainerModule(function (bind) {
  8312. bind(ServiceIdentifiers_1.ServiceIdentifiers.TCustomNodeGroupStorage).to(CustomNodeGroupStorage_1.CustomNodeGroupStorage).inSingletonScope();
  8313. bind(ServiceIdentifiers_1.ServiceIdentifiers.TStringArrayStorage).to(StringArrayStorage_1.StringArrayStorage).inSingletonScope();
  8314. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__TControlFlowStorage).toConstructor(ControlFlowStorage_1.ControlFlowStorage);
  8315. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__TControlFlowStorage).toFactory(function (context) {
  8316. return function () {
  8317. var constructor = context.container.get(ServiceIdentifiers_1.ServiceIdentifiers.Newable__TControlFlowStorage);
  8318. var randomGenerator = context.container.get(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator);
  8319. var options = context.container.get(ServiceIdentifiers_1.ServiceIdentifiers.IOptions);
  8320. var storage = new constructor(randomGenerator, options);
  8321. storage.initialize();
  8322. return storage;
  8323. };
  8324. });
  8325. });
  8326. /***/ }),
  8327. /* 184 */
  8328. /***/ (function(module, exports, __webpack_require__) {
  8329. "use strict";
  8330. var _Object$getPrototypeOf = __webpack_require__(5);
  8331. var _classCallCheck = __webpack_require__(0);
  8332. var _possibleConstructorReturn = __webpack_require__(6);
  8333. var _inherits = __webpack_require__(7);
  8334. Object.defineProperty(exports, "__esModule", {
  8335. value: true
  8336. });
  8337. var tslib_1 = __webpack_require__(4);
  8338. var inversify_1 = __webpack_require__(1);
  8339. var ServiceIdentifiers_1 = __webpack_require__(3);
  8340. var MapStorage_1 = __webpack_require__(61);
  8341. var ControlFlowStorage =
  8342. /*#__PURE__*/
  8343. function (_MapStorage_1$MapStor) {
  8344. _inherits(ControlFlowStorage, _MapStorage_1$MapStor);
  8345. function ControlFlowStorage(randomGenerator, options) {
  8346. _classCallCheck(this, ControlFlowStorage);
  8347. return _possibleConstructorReturn(this, (ControlFlowStorage.__proto__ || _Object$getPrototypeOf(ControlFlowStorage)).call(this, randomGenerator, options));
  8348. }
  8349. return ControlFlowStorage;
  8350. }(MapStorage_1.MapStorage);
  8351. 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);
  8352. exports.ControlFlowStorage = ControlFlowStorage;
  8353. /***/ }),
  8354. /* 185 */
  8355. /***/ (function(module, exports, __webpack_require__) {
  8356. "use strict";
  8357. var _Object$getPrototypeOf = __webpack_require__(5);
  8358. var _classCallCheck = __webpack_require__(0);
  8359. var _createClass = __webpack_require__(2);
  8360. var _possibleConstructorReturn = __webpack_require__(6);
  8361. var _get = __webpack_require__(45);
  8362. var _inherits = __webpack_require__(7);
  8363. Object.defineProperty(exports, "__esModule", {
  8364. value: true
  8365. });
  8366. var tslib_1 = __webpack_require__(4);
  8367. var inversify_1 = __webpack_require__(1);
  8368. var ServiceIdentifiers_1 = __webpack_require__(3);
  8369. var CustomNodeGroup_1 = __webpack_require__(55);
  8370. var MapStorage_1 = __webpack_require__(61);
  8371. var CustomNodeGroupStorage = CustomNodeGroupStorage_1 =
  8372. /*#__PURE__*/
  8373. function (_MapStorage_1$MapStor) {
  8374. _inherits(CustomNodeGroupStorage, _MapStorage_1$MapStor);
  8375. function CustomNodeGroupStorage(customNodeGroupFactory, randomGenerator, options) {
  8376. var _this;
  8377. _classCallCheck(this, CustomNodeGroupStorage);
  8378. _this = _possibleConstructorReturn(this, (CustomNodeGroupStorage.__proto__ || _Object$getPrototypeOf(CustomNodeGroupStorage)).call(this, randomGenerator, options));
  8379. _this.customNodeGroupFactory = customNodeGroupFactory;
  8380. return _this;
  8381. }
  8382. _createClass(CustomNodeGroupStorage, [{
  8383. key: "initialize",
  8384. value: function initialize() {
  8385. var _this2 = this;
  8386. _get(CustomNodeGroupStorage.prototype.__proto__ || _Object$getPrototypeOf(CustomNodeGroupStorage.prototype), "initialize", this).call(this);
  8387. CustomNodeGroupStorage_1.customNodeGroupsList.forEach(function (customNodeGroupName) {
  8388. var customNodeGroup = _this2.customNodeGroupFactory(customNodeGroupName);
  8389. if (!customNodeGroup) {
  8390. return;
  8391. }
  8392. _this2.storage.set(customNodeGroupName, customNodeGroup);
  8393. });
  8394. }
  8395. }]);
  8396. return CustomNodeGroupStorage;
  8397. }(MapStorage_1.MapStorage);
  8398. CustomNodeGroupStorage.customNodeGroupsList = [CustomNodeGroup_1.CustomNodeGroup.ConsoleOutputCustomNodeGroup, CustomNodeGroup_1.CustomNodeGroup.DebugProtectionCustomNodeGroup, CustomNodeGroup_1.CustomNodeGroup.DomainLockCustomNodeGroup, CustomNodeGroup_1.CustomNodeGroup.SelfDefendingCustomNodeGroup, CustomNodeGroup_1.CustomNodeGroup.StringArrayCustomNodeGroup];
  8399. 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);
  8400. 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);
  8401. exports.CustomNodeGroupStorage = CustomNodeGroupStorage;
  8402. var CustomNodeGroupStorage_1;
  8403. /***/ }),
  8404. /* 186 */
  8405. /***/ (function(module, exports, __webpack_require__) {
  8406. "use strict";
  8407. var _Object$getPrototypeOf = __webpack_require__(5);
  8408. var _classCallCheck = __webpack_require__(0);
  8409. var _createClass = __webpack_require__(2);
  8410. var _possibleConstructorReturn = __webpack_require__(6);
  8411. var _get = __webpack_require__(45);
  8412. var _inherits = __webpack_require__(7);
  8413. Object.defineProperty(exports, "__esModule", {
  8414. value: true
  8415. });
  8416. var tslib_1 = __webpack_require__(4);
  8417. var inversify_1 = __webpack_require__(1);
  8418. var ServiceIdentifiers_1 = __webpack_require__(3);
  8419. var ArrayStorage_1 = __webpack_require__(187);
  8420. var StringArrayStorage = StringArrayStorage_1 =
  8421. /*#__PURE__*/
  8422. function (_ArrayStorage_1$Array) {
  8423. _inherits(StringArrayStorage, _ArrayStorage_1$Array);
  8424. function StringArrayStorage(identifierNamesGeneratorFactory, arrayUtils, randomGenerator, options) {
  8425. var _this;
  8426. _classCallCheck(this, StringArrayStorage);
  8427. _this = _possibleConstructorReturn(this, (StringArrayStorage.__proto__ || _Object$getPrototypeOf(StringArrayStorage)).call(this, randomGenerator, options));
  8428. _this.identifierNamesGenerator = identifierNamesGeneratorFactory(options);
  8429. _this.arrayUtils = arrayUtils;
  8430. return _this;
  8431. }
  8432. _createClass(StringArrayStorage, [{
  8433. key: "initialize",
  8434. value: function initialize() {
  8435. _get(StringArrayStorage.prototype.__proto__ || _Object$getPrototypeOf(StringArrayStorage.prototype), "initialize", this).call(this);
  8436. var baseStringArrayName = this.identifierNamesGenerator.generate().slice(0, StringArrayStorage_1.stringArrayNameLength);
  8437. var baseStringArrayCallsWrapperName = this.identifierNamesGenerator.generate().slice(0, StringArrayStorage_1.stringArrayNameLength);
  8438. var stringArrayName = "".concat(this.options.identifiersPrefix).concat(baseStringArrayName);
  8439. var stringArrayCallsWrapperName = "".concat(this.options.identifiersPrefix).concat(baseStringArrayCallsWrapperName);
  8440. this.storageId = "".concat(stringArrayName, "|").concat(stringArrayCallsWrapperName);
  8441. }
  8442. }, {
  8443. key: "rotateArray",
  8444. value: function rotateArray(rotationValue) {
  8445. this.storage = this.arrayUtils.arrayRotate(this.storage, rotationValue);
  8446. }
  8447. }, {
  8448. key: "toString",
  8449. value: function toString() {
  8450. return this.storage.map(function (value) {
  8451. return "'".concat(value, "'");
  8452. }).toString();
  8453. }
  8454. }]);
  8455. return StringArrayStorage;
  8456. }(ArrayStorage_1.ArrayStorage);
  8457. StringArrayStorage.stringArrayNameLength = 7;
  8458. 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);
  8459. StringArrayStorage = StringArrayStorage_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.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);
  8460. exports.StringArrayStorage = StringArrayStorage;
  8461. var StringArrayStorage_1;
  8462. /***/ }),
  8463. /* 187 */
  8464. /***/ (function(module, exports, __webpack_require__) {
  8465. "use strict";
  8466. var _toConsumableArray = __webpack_require__(24);
  8467. var _classCallCheck = __webpack_require__(0);
  8468. var _createClass = __webpack_require__(2);
  8469. Object.defineProperty(exports, "__esModule", {
  8470. value: true
  8471. });
  8472. var tslib_1 = __webpack_require__(4);
  8473. var inversify_1 = __webpack_require__(1);
  8474. var ServiceIdentifiers_1 = __webpack_require__(3);
  8475. var Initializable_1 = __webpack_require__(10);
  8476. var ArrayStorage =
  8477. /*#__PURE__*/
  8478. function () {
  8479. function ArrayStorage(randomGenerator, options) {
  8480. _classCallCheck(this, ArrayStorage);
  8481. this.storageLength = 0;
  8482. this.randomGenerator = randomGenerator;
  8483. this.options = options;
  8484. }
  8485. _createClass(ArrayStorage, [{
  8486. key: "initialize",
  8487. value: function initialize() {
  8488. this.storage = [];
  8489. this.storageId = this.randomGenerator.getRandomString(6);
  8490. }
  8491. }, {
  8492. key: "get",
  8493. value: function get(key) {
  8494. var value = this.storage[key];
  8495. if (!value) {
  8496. throw new Error("No value found in array storage with key `".concat(key, "`"));
  8497. }
  8498. return value;
  8499. }
  8500. }, {
  8501. key: "getKeyOf",
  8502. value: function getKeyOf(value) {
  8503. var key = this.storage.indexOf(value);
  8504. return key >= 0 ? key : null;
  8505. }
  8506. }, {
  8507. key: "getLength",
  8508. value: function getLength() {
  8509. return this.storageLength;
  8510. }
  8511. }, {
  8512. key: "getStorage",
  8513. value: function getStorage() {
  8514. return this.storage;
  8515. }
  8516. }, {
  8517. key: "getStorageId",
  8518. value: function getStorageId() {
  8519. return this.storageId;
  8520. }
  8521. }, {
  8522. key: "mergeWith",
  8523. value: function mergeWith(storage) {
  8524. var mergeId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  8525. this.storage = _toConsumableArray(this.storage).concat(_toConsumableArray(storage.getStorage()));
  8526. if (mergeId) {
  8527. this.storageId = storage.getStorageId();
  8528. }
  8529. }
  8530. }, {
  8531. key: "set",
  8532. value: function set(key, value) {
  8533. if (key === this.storageLength) {
  8534. this.storage.push(value);
  8535. } else {
  8536. this.storage.splice(key, 0, value);
  8537. }
  8538. this.storageLength++;
  8539. }
  8540. }]);
  8541. return ArrayStorage;
  8542. }();
  8543. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Array)], ArrayStorage.prototype, "storage", void 0);
  8544. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], ArrayStorage.prototype, "storageId", void 0);
  8545. 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);
  8546. 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);
  8547. exports.ArrayStorage = ArrayStorage;
  8548. /***/ }),
  8549. /* 188 */
  8550. /***/ (function(module, exports, __webpack_require__) {
  8551. "use strict";
  8552. Object.defineProperty(exports, "__esModule", {
  8553. value: true
  8554. });
  8555. var inversify_1 = __webpack_require__(1);
  8556. var ServiceIdentifiers_1 = __webpack_require__(3);
  8557. var ArrayUtils_1 = __webpack_require__(189);
  8558. var CryptUtils_1 = __webpack_require__(190);
  8559. var EscapeSequenceEncoder_1 = __webpack_require__(193);
  8560. var RandomGenerator_1 = __webpack_require__(62);
  8561. exports.utilsModule = new inversify_1.ContainerModule(function (bind) {
  8562. bind(ServiceIdentifiers_1.ServiceIdentifiers.IArrayUtils).to(ArrayUtils_1.ArrayUtils).inSingletonScope();
  8563. bind(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator).to(RandomGenerator_1.RandomGenerator).inSingletonScope();
  8564. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICryptUtils).to(CryptUtils_1.CryptUtils).inSingletonScope();
  8565. bind(ServiceIdentifiers_1.ServiceIdentifiers.IEscapeSequenceEncoder).to(EscapeSequenceEncoder_1.EscapeSequenceEncoder).inSingletonScope();
  8566. });
  8567. /***/ }),
  8568. /* 189 */
  8569. /***/ (function(module, exports, __webpack_require__) {
  8570. "use strict";
  8571. var _toConsumableArray = __webpack_require__(24);
  8572. var _classCallCheck = __webpack_require__(0);
  8573. var _createClass = __webpack_require__(2);
  8574. Object.defineProperty(exports, "__esModule", {
  8575. value: true
  8576. });
  8577. var tslib_1 = __webpack_require__(4);
  8578. var inversify_1 = __webpack_require__(1);
  8579. var ServiceIdentifiers_1 = __webpack_require__(3);
  8580. var ArrayUtils =
  8581. /*#__PURE__*/
  8582. function () {
  8583. function ArrayUtils(randomGenerator) {
  8584. _classCallCheck(this, ArrayUtils);
  8585. this.randomGenerator = randomGenerator;
  8586. }
  8587. _createClass(ArrayUtils, [{
  8588. key: "arrayRange",
  8589. value: function arrayRange(length) {
  8590. var range = [];
  8591. for (var i = 0; i < length; i++) {
  8592. range.push(i);
  8593. }
  8594. return range;
  8595. }
  8596. }, {
  8597. key: "arrayRotate",
  8598. value: function arrayRotate(array, times) {
  8599. if (!array.length) {
  8600. throw new ReferenceError("Cannot rotate empty array.");
  8601. }
  8602. if (times <= 0) {
  8603. return array;
  8604. }
  8605. var newArray = array;
  8606. var temp;
  8607. while (times--) {
  8608. temp = newArray.pop();
  8609. newArray.unshift(temp);
  8610. }
  8611. return newArray;
  8612. }
  8613. }, {
  8614. key: "arrayShuffle",
  8615. value: function arrayShuffle(array) {
  8616. var shuffledArray = _toConsumableArray(array);
  8617. for (var i = shuffledArray.length; i; i--) {
  8618. var j = Math.floor(this.randomGenerator.getMathRandom() * i);
  8619. var _ref = [shuffledArray[j], shuffledArray[i - 1]];
  8620. shuffledArray[i - 1] = _ref[0];
  8621. shuffledArray[j] = _ref[1];
  8622. }
  8623. return shuffledArray;
  8624. }
  8625. }]);
  8626. return ArrayUtils;
  8627. }();
  8628. 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);
  8629. exports.ArrayUtils = ArrayUtils;
  8630. /***/ }),
  8631. /* 190 */
  8632. /***/ (function(module, exports, __webpack_require__) {
  8633. "use strict";
  8634. var _classCallCheck = __webpack_require__(0);
  8635. var _createClass = __webpack_require__(2);
  8636. Object.defineProperty(exports, "__esModule", {
  8637. value: true
  8638. });
  8639. var tslib_1 = __webpack_require__(4);
  8640. var inversify_1 = __webpack_require__(1);
  8641. var ServiceIdentifiers_1 = __webpack_require__(3);
  8642. var RandomGenerator_1 = __webpack_require__(62);
  8643. var Utils_1 = __webpack_require__(32);
  8644. var CryptUtils =
  8645. /*#__PURE__*/
  8646. function () {
  8647. function CryptUtils(randomGenerator) {
  8648. _classCallCheck(this, CryptUtils);
  8649. this.randomGenerator = randomGenerator;
  8650. }
  8651. _createClass(CryptUtils, [{
  8652. key: "btoa",
  8653. value: function btoa(string) {
  8654. var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  8655. var output = '';
  8656. string = encodeURIComponent(string).replace(/%([0-9A-F]{2})/g, function (match, p1) {
  8657. return String.fromCharCode(parseInt("".concat(Utils_1.Utils.hexadecimalPrefix).concat(p1)));
  8658. });
  8659. for (var block, charCode, idx = 0, map = chars; string.charAt(idx | 0) || (map = '=', idx % 1); output += map.charAt(63 & block >> 8 - idx % 1 * 8)) {
  8660. charCode = string.charCodeAt(idx += 3 / 4);
  8661. if (charCode > 0xFF) {
  8662. throw new Error("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");
  8663. }
  8664. block = block << 8 | charCode;
  8665. }
  8666. return output;
  8667. }
  8668. }, {
  8669. key: "hideString",
  8670. value: function hideString(str, length) {
  8671. var _this = this;
  8672. var escapeRegExp = function escapeRegExp(s) {
  8673. return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
  8674. };
  8675. var randomMerge = function randomMerge(s1, s2) {
  8676. var i1 = -1;
  8677. var i2 = -1;
  8678. var result = '';
  8679. while (i1 < s1.length || i2 < s2.length) {
  8680. if (_this.randomGenerator.getMathRandom() < 0.5 && i2 < s2.length) {
  8681. result += s2.charAt(++i2);
  8682. } else {
  8683. result += s1.charAt(++i1);
  8684. }
  8685. }
  8686. return result;
  8687. };
  8688. var randomString = this.randomGenerator.getRandomGenerator().string({
  8689. length: length,
  8690. pool: RandomGenerator_1.RandomGenerator.randomGeneratorPool
  8691. });
  8692. var randomStringDiff = randomString.replace(new RegExp("[".concat(escapeRegExp(str), "]"), 'g'), '');
  8693. var randomStringDiffArray = randomStringDiff.split('');
  8694. this.randomGenerator.getRandomGenerator().shuffle(randomStringDiffArray);
  8695. randomStringDiff = randomStringDiffArray.join('');
  8696. return [randomMerge(str, randomStringDiff), randomStringDiff];
  8697. }
  8698. }, {
  8699. key: "rc4",
  8700. value: function rc4(string, key) {
  8701. var s = [],
  8702. j = 0,
  8703. x,
  8704. result = '';
  8705. for (var i = 0; i < 256; i++) {
  8706. s[i] = i;
  8707. }
  8708. for (i = 0; i < 256; i++) {
  8709. j = (j + s[i] + key.charCodeAt(i % key.length)) % 256;
  8710. x = s[i];
  8711. s[i] = s[j];
  8712. s[j] = x;
  8713. }
  8714. i = 0;
  8715. j = 0;
  8716. for (var y = 0; y < string.length; y++) {
  8717. i = (i + 1) % 256;
  8718. j = (j + s[i]) % 256;
  8719. x = s[i];
  8720. s[i] = s[j];
  8721. s[j] = x;
  8722. result += String.fromCharCode(string.charCodeAt(y) ^ s[(s[i] + s[j]) % 256]);
  8723. }
  8724. return result;
  8725. }
  8726. }]);
  8727. return CryptUtils;
  8728. }();
  8729. 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);
  8730. exports.CryptUtils = CryptUtils;
  8731. /***/ }),
  8732. /* 191 */
  8733. /***/ (function(module, exports) {
  8734. module.exports = require("md5");
  8735. /***/ }),
  8736. /* 192 */
  8737. /***/ (function(module, exports) {
  8738. module.exports = require("chance");
  8739. /***/ }),
  8740. /* 193 */
  8741. /***/ (function(module, exports, __webpack_require__) {
  8742. "use strict";
  8743. var _Map = __webpack_require__(16);
  8744. var _classCallCheck = __webpack_require__(0);
  8745. var _createClass = __webpack_require__(2);
  8746. Object.defineProperty(exports, "__esModule", {
  8747. value: true
  8748. });
  8749. var tslib_1 = __webpack_require__(4);
  8750. var inversify_1 = __webpack_require__(1);
  8751. var EscapeSequenceEncoder =
  8752. /*#__PURE__*/
  8753. function () {
  8754. function EscapeSequenceEncoder() {
  8755. _classCallCheck(this, EscapeSequenceEncoder);
  8756. this.stringsCache = new _Map();
  8757. }
  8758. _createClass(EscapeSequenceEncoder, [{
  8759. key: "encode",
  8760. value: function encode(string, encodeAllSymbols) {
  8761. var cacheKey = "".concat(string, "-").concat(String(encodeAllSymbols));
  8762. if (this.stringsCache.has(cacheKey)) {
  8763. return this.stringsCache.get(cacheKey);
  8764. }
  8765. var radix = 16;
  8766. var replaceRegExp = new RegExp('[\\s\\S]', 'g');
  8767. var escapeSequenceRegExp = new RegExp('[\'\"\\\\\\s]');
  8768. var regExp = new RegExp('[\\x00-\\x7F]');
  8769. var prefix;
  8770. var template;
  8771. var result = string.replace(replaceRegExp, function (character) {
  8772. if (!encodeAllSymbols && !escapeSequenceRegExp.exec(character)) {
  8773. return character;
  8774. }
  8775. if (regExp.exec(character)) {
  8776. prefix = '\\x';
  8777. template = '00';
  8778. } else {
  8779. prefix = "\\u";
  8780. template = '0000';
  8781. }
  8782. return "".concat(prefix).concat((template + character.charCodeAt(0).toString(radix)).slice(-template.length));
  8783. });
  8784. this.stringsCache.set(cacheKey, result);
  8785. return result;
  8786. }
  8787. }]);
  8788. return EscapeSequenceEncoder;
  8789. }();
  8790. EscapeSequenceEncoder = tslib_1.__decorate([inversify_1.injectable()], EscapeSequenceEncoder);
  8791. exports.EscapeSequenceEncoder = EscapeSequenceEncoder;
  8792. /***/ }),
  8793. /* 194 */
  8794. /***/ (function(module, exports, __webpack_require__) {
  8795. "use strict";
  8796. var _Object$assign = __webpack_require__(11);
  8797. var _classCallCheck = __webpack_require__(0);
  8798. var _createClass = __webpack_require__(2);
  8799. Object.defineProperty(exports, "__esModule", {
  8800. value: true
  8801. });
  8802. var tslib_1 = __webpack_require__(4);
  8803. var inversify_1 = __webpack_require__(1);
  8804. var ServiceIdentifiers_1 = __webpack_require__(3);
  8805. var escodegen = tslib_1.__importStar(__webpack_require__(42));
  8806. var packageJson = tslib_1.__importStar(__webpack_require__(63));
  8807. var LoggingMessage_1 = __webpack_require__(195);
  8808. var NodeTransformer_1 = __webpack_require__(28);
  8809. var TransformationStage_1 = __webpack_require__(12);
  8810. var EsprimaFacade_1 = __webpack_require__(196);
  8811. var NodeGuards_1 = __webpack_require__(8);
  8812. var JavaScriptObfuscator = JavaScriptObfuscator_1 =
  8813. /*#__PURE__*/
  8814. function () {
  8815. function JavaScriptObfuscator(transformersRunner, sourceMapCorrector, randomGenerator, logger, options) {
  8816. _classCallCheck(this, JavaScriptObfuscator);
  8817. this.transformersRunner = transformersRunner;
  8818. this.sourceMapCorrector = sourceMapCorrector;
  8819. this.randomGenerator = randomGenerator;
  8820. this.logger = logger;
  8821. this.options = options;
  8822. }
  8823. _createClass(JavaScriptObfuscator, [{
  8824. key: "obfuscate",
  8825. value: function obfuscate(sourceCode) {
  8826. var timeStart = Date.now();
  8827. this.logger.info(LoggingMessage_1.LoggingMessage.Version, packageJson.version);
  8828. this.logger.info(LoggingMessage_1.LoggingMessage.ObfuscationStarted);
  8829. this.logger.info(LoggingMessage_1.LoggingMessage.RandomGeneratorSeed, this.randomGenerator.getSeed());
  8830. var astTree = this.parseCode(sourceCode);
  8831. var obfuscatedAstTree = this.transformAstTree(astTree);
  8832. var generatorOutput = this.generateCode(sourceCode, obfuscatedAstTree);
  8833. var obfuscationTime = (Date.now() - timeStart) / 1000;
  8834. this.logger.success(LoggingMessage_1.LoggingMessage.ObfuscationCompleted, obfuscationTime);
  8835. return this.getObfuscationResult(generatorOutput);
  8836. }
  8837. }, {
  8838. key: "parseCode",
  8839. value: function parseCode(sourceCode) {
  8840. return EsprimaFacade_1.EsprimaFacade.parse(sourceCode, {
  8841. attachComment: true,
  8842. loc: this.options.sourceMap
  8843. });
  8844. }
  8845. }, {
  8846. key: "transformAstTree",
  8847. value: function transformAstTree(astTree) {
  8848. var isEmptyAstTree = NodeGuards_1.NodeGuards.isProgramNode(astTree) && !astTree.body.length && !astTree.leadingComments;
  8849. if (isEmptyAstTree) {
  8850. this.logger.warn(LoggingMessage_1.LoggingMessage.EmptySourceCode);
  8851. return astTree;
  8852. }
  8853. astTree = this.runTransformationStage(astTree, TransformationStage_1.TransformationStage.Preparing);
  8854. if (this.options.deadCodeInjection) {
  8855. astTree = this.runTransformationStage(astTree, TransformationStage_1.TransformationStage.DeadCodeInjection);
  8856. }
  8857. if (this.options.controlFlowFlattening) {
  8858. astTree = this.runTransformationStage(astTree, TransformationStage_1.TransformationStage.ControlFlowFlattening);
  8859. }
  8860. astTree = this.runTransformationStage(astTree, TransformationStage_1.TransformationStage.Converting);
  8861. astTree = this.runTransformationStage(astTree, TransformationStage_1.TransformationStage.Obfuscating);
  8862. astTree = this.runTransformationStage(astTree, TransformationStage_1.TransformationStage.Finalizing);
  8863. return astTree;
  8864. }
  8865. }, {
  8866. key: "generateCode",
  8867. value: function generateCode(sourceCode, astTree) {
  8868. var escodegenParams = _Object$assign({}, JavaScriptObfuscator_1.escodegenParams);
  8869. if (this.options.sourceMap) {
  8870. escodegenParams.sourceMap = 'sourceMap';
  8871. escodegenParams.sourceContent = sourceCode;
  8872. }
  8873. var generatorOutput = escodegen.generate(astTree, _Object$assign({}, escodegenParams, {
  8874. format: {
  8875. compact: this.options.compact
  8876. }
  8877. }));
  8878. generatorOutput.map = generatorOutput.map ? generatorOutput.map.toString() : '';
  8879. return generatorOutput;
  8880. }
  8881. }, {
  8882. key: "getObfuscationResult",
  8883. value: function getObfuscationResult(generatorOutput) {
  8884. return this.sourceMapCorrector.correct(generatorOutput.code, generatorOutput.map);
  8885. }
  8886. }, {
  8887. key: "runTransformationStage",
  8888. value: function runTransformationStage(astTree, transformationStage) {
  8889. this.logger.info(LoggingMessage_1.LoggingMessage.TransformationStage, transformationStage);
  8890. return this.transformersRunner.transform(astTree, JavaScriptObfuscator_1.transformersList, transformationStage);
  8891. }
  8892. }]);
  8893. return JavaScriptObfuscator;
  8894. }();
  8895. JavaScriptObfuscator.escodegenParams = {
  8896. comment: true,
  8897. verbatim: 'x-verbatim-property',
  8898. sourceMapWithCode: true
  8899. };
  8900. JavaScriptObfuscator.transformersList = [NodeTransformer_1.NodeTransformer.BlockStatementControlFlowTransformer, NodeTransformer_1.NodeTransformer.ClassDeclarationTransformer, NodeTransformer_1.NodeTransformer.CommentsTransformer, NodeTransformer_1.NodeTransformer.CustomNodesTransformer, 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];
  8901. JavaScriptObfuscator = JavaScriptObfuscator_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ITransformersRunner)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ISourceMapCorrector)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ILogger)), tslib_1.__param(4, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object, Object, Object, Object])], JavaScriptObfuscator);
  8902. exports.JavaScriptObfuscator = JavaScriptObfuscator;
  8903. var JavaScriptObfuscator_1;
  8904. /***/ }),
  8905. /* 195 */
  8906. /***/ (function(module, exports, __webpack_require__) {
  8907. "use strict";
  8908. Object.defineProperty(exports, "__esModule", {
  8909. value: true
  8910. });
  8911. var LoggingMessage;
  8912. (function (LoggingMessage) {
  8913. LoggingMessage["EmptySourceCode"] = "Empty source code. Obfuscation canceled...";
  8914. LoggingMessage["ObfuscationCompleted"] = "Obfuscation completed. Total time: %s sec.";
  8915. LoggingMessage["ObfuscationStarted"] = "Obfuscation started...";
  8916. LoggingMessage["RandomGeneratorSeed"] = "Random generator seed: %s...";
  8917. LoggingMessage["TransformationStage"] = "Transformation stage: %s...";
  8918. LoggingMessage["Version"] = "Version: %s";
  8919. })(LoggingMessage = exports.LoggingMessage || (exports.LoggingMessage = {}));
  8920. /***/ }),
  8921. /* 196 */
  8922. /***/ (function(module, exports, __webpack_require__) {
  8923. "use strict";
  8924. var _classCallCheck = __webpack_require__(0);
  8925. var _createClass = __webpack_require__(2);
  8926. Object.defineProperty(exports, "__esModule", {
  8927. value: true
  8928. });
  8929. var tslib_1 = __webpack_require__(4);
  8930. var esprima = tslib_1.__importStar(__webpack_require__(51));
  8931. var chalk_1 = tslib_1.__importDefault(__webpack_require__(64));
  8932. var EsprimaFacade =
  8933. /*#__PURE__*/
  8934. function () {
  8935. function EsprimaFacade() {
  8936. _classCallCheck(this, EsprimaFacade);
  8937. }
  8938. _createClass(EsprimaFacade, null, [{
  8939. key: "parse",
  8940. value: function parse(input, config) {
  8941. var lastMeta = null;
  8942. try {
  8943. return esprima.parseScript(input, config, function (node, meta) {
  8944. return lastMeta = meta;
  8945. });
  8946. } catch (_a) {}
  8947. try {
  8948. return esprima.parseModule(input, config, function (node, meta) {
  8949. return lastMeta = meta;
  8950. });
  8951. } catch (error) {
  8952. return EsprimaFacade.processParsingError(input, error.message, lastMeta);
  8953. }
  8954. }
  8955. }, {
  8956. key: "processParsingError",
  8957. value: function processParsingError(sourceCode, errorMessage, meta) {
  8958. if (!meta || !meta.start || !meta.end || !meta.start.column || !meta.end.column) {
  8959. throw new Error(errorMessage);
  8960. }
  8961. var lineNumberMatch = errorMessage.match(/Line *(\d*)/);
  8962. if (!lineNumberMatch) {
  8963. throw new Error(errorMessage);
  8964. }
  8965. var lineNumber = parseInt(lineNumberMatch[1], 10);
  8966. var sourceCodeLines = sourceCode.split(/\r?\n/);
  8967. var errorLine = sourceCodeLines[lineNumber - 1];
  8968. if (!errorLine) {
  8969. throw new Error(errorMessage);
  8970. }
  8971. var startErrorIndex = Math.max(0, meta.start.column - EsprimaFacade.nearestSymbolsCount);
  8972. var endErrorIndex = Math.min(errorLine.length, meta.end.column + EsprimaFacade.nearestSymbolsCount);
  8973. var formattedPointer = EsprimaFacade.colorError('>');
  8974. var formattedCodeSlice = "...".concat(errorLine.substring(startErrorIndex, endErrorIndex).replace(/^\s+/, ''), "...");
  8975. throw new Error("".concat(errorMessage, "\n").concat(formattedPointer, " ").concat(formattedCodeSlice));
  8976. }
  8977. }]);
  8978. return EsprimaFacade;
  8979. }();
  8980. EsprimaFacade.colorError = chalk_1.default.red;
  8981. EsprimaFacade.nearestSymbolsCount = 10;
  8982. exports.EsprimaFacade = EsprimaFacade;
  8983. /***/ }),
  8984. /* 197 */
  8985. /***/ (function(module, exports, __webpack_require__) {
  8986. "use strict";
  8987. var _Object$getPrototypeOf = __webpack_require__(5);
  8988. var _classCallCheck = __webpack_require__(0);
  8989. var _possibleConstructorReturn = __webpack_require__(6);
  8990. var _inherits = __webpack_require__(7);
  8991. Object.defineProperty(exports, "__esModule", {
  8992. value: true
  8993. });
  8994. var tslib_1 = __webpack_require__(4);
  8995. var inversify_1 = __webpack_require__(1);
  8996. var events_1 = __webpack_require__(198);
  8997. inversify_1.decorate(inversify_1.injectable(), events_1.EventEmitter);
  8998. var ObfuscationEventEmitter =
  8999. /*#__PURE__*/
  9000. function (_events_1$EventEmitte) {
  9001. _inherits(ObfuscationEventEmitter, _events_1$EventEmitte);
  9002. function ObfuscationEventEmitter() {
  9003. _classCallCheck(this, ObfuscationEventEmitter);
  9004. return _possibleConstructorReturn(this, (ObfuscationEventEmitter.__proto__ || _Object$getPrototypeOf(ObfuscationEventEmitter)).apply(this, arguments));
  9005. }
  9006. return ObfuscationEventEmitter;
  9007. }(events_1.EventEmitter);
  9008. ObfuscationEventEmitter = tslib_1.__decorate([inversify_1.injectable()], ObfuscationEventEmitter);
  9009. exports.ObfuscationEventEmitter = ObfuscationEventEmitter;
  9010. /***/ }),
  9011. /* 198 */
  9012. /***/ (function(module, exports) {
  9013. module.exports = require("events");
  9014. /***/ }),
  9015. /* 199 */
  9016. /***/ (function(module, exports, __webpack_require__) {
  9017. "use strict";
  9018. var _classCallCheck = __webpack_require__(0);
  9019. var _createClass = __webpack_require__(2);
  9020. Object.defineProperty(exports, "__esModule", {
  9021. value: true
  9022. });
  9023. var tslib_1 = __webpack_require__(4);
  9024. var inversify_1 = __webpack_require__(1);
  9025. var Initializable_1 = __webpack_require__(10);
  9026. var ObfuscationResult =
  9027. /*#__PURE__*/
  9028. function () {
  9029. function ObfuscationResult() {
  9030. _classCallCheck(this, ObfuscationResult);
  9031. }
  9032. _createClass(ObfuscationResult, [{
  9033. key: "initialize",
  9034. value: function initialize(obfuscatedCode, sourceMap) {
  9035. this.obfuscatedCode = obfuscatedCode;
  9036. this.sourceMap = sourceMap;
  9037. }
  9038. }, {
  9039. key: "getObfuscatedCode",
  9040. value: function getObfuscatedCode() {
  9041. return this.obfuscatedCode;
  9042. }
  9043. }, {
  9044. key: "getSourceMap",
  9045. value: function getSourceMap() {
  9046. return this.sourceMap;
  9047. }
  9048. }, {
  9049. key: "toString",
  9050. value: function toString() {
  9051. return this.obfuscatedCode;
  9052. }
  9053. }]);
  9054. return ObfuscationResult;
  9055. }();
  9056. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], ObfuscationResult.prototype, "obfuscatedCode", void 0);
  9057. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], ObfuscationResult.prototype, "sourceMap", void 0);
  9058. ObfuscationResult = tslib_1.__decorate([inversify_1.injectable()], ObfuscationResult);
  9059. exports.ObfuscationResult = ObfuscationResult;
  9060. /***/ }),
  9061. /* 200 */
  9062. /***/ (function(module, exports, __webpack_require__) {
  9063. "use strict";
  9064. var _classCallCheck = __webpack_require__(0);
  9065. var _createClass = __webpack_require__(2);
  9066. Object.defineProperty(exports, "__esModule", {
  9067. value: true
  9068. });
  9069. var SourceCode =
  9070. /*#__PURE__*/
  9071. function () {
  9072. function SourceCode(sourceCode) {
  9073. _classCallCheck(this, SourceCode);
  9074. this.sourceCode = sourceCode;
  9075. }
  9076. _createClass(SourceCode, [{
  9077. key: "getSourceCode",
  9078. value: function getSourceCode() {
  9079. return this.sourceCode;
  9080. }
  9081. }]);
  9082. return SourceCode;
  9083. }();
  9084. exports.SourceCode = SourceCode;
  9085. /***/ }),
  9086. /* 201 */
  9087. /***/ (function(module, exports, __webpack_require__) {
  9088. "use strict";
  9089. var _classCallCheck = __webpack_require__(0);
  9090. var _createClass = __webpack_require__(2);
  9091. Object.defineProperty(exports, "__esModule", {
  9092. value: true
  9093. });
  9094. var tslib_1 = __webpack_require__(4);
  9095. var inversify_1 = __webpack_require__(1);
  9096. var ServiceIdentifiers_1 = __webpack_require__(3);
  9097. var SourceMapMode_1 = __webpack_require__(36);
  9098. var SourceMapCorrector =
  9099. /*#__PURE__*/
  9100. function () {
  9101. function SourceMapCorrector(obfuscationResultFactory, cryptUtils, options) {
  9102. _classCallCheck(this, SourceMapCorrector);
  9103. this.obfuscationResultFactory = obfuscationResultFactory;
  9104. this.cryptUtils = cryptUtils;
  9105. this.options = options;
  9106. }
  9107. _createClass(SourceMapCorrector, [{
  9108. key: "correct",
  9109. value: function correct(obfuscatedCode, sourceMap) {
  9110. return this.obfuscationResultFactory(this.correctObfuscatedCode(obfuscatedCode, sourceMap), sourceMap);
  9111. }
  9112. }, {
  9113. key: "correctObfuscatedCode",
  9114. value: function correctObfuscatedCode(obfuscatedCode, sourceMap) {
  9115. if (!sourceMap) {
  9116. return obfuscatedCode;
  9117. }
  9118. var sourceMapUrl = this.options.sourceMapBaseUrl + this.options.sourceMapFileName;
  9119. var sourceMappingUrl = '//# sourceMappingURL=';
  9120. switch (this.options.sourceMapMode) {
  9121. case SourceMapMode_1.SourceMapMode.Inline:
  9122. sourceMappingUrl += "data:application/json;base64,".concat(this.cryptUtils.btoa(sourceMap));
  9123. break;
  9124. case SourceMapMode_1.SourceMapMode.Separate:
  9125. default:
  9126. if (!sourceMapUrl) {
  9127. return obfuscatedCode;
  9128. }
  9129. sourceMappingUrl += sourceMapUrl;
  9130. break;
  9131. }
  9132. return "".concat(obfuscatedCode, "\n").concat(sourceMappingUrl);
  9133. }
  9134. }]);
  9135. return SourceMapCorrector;
  9136. }();
  9137. 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);
  9138. exports.SourceMapCorrector = SourceMapCorrector;
  9139. /***/ }),
  9140. /* 202 */
  9141. /***/ (function(module, exports, __webpack_require__) {
  9142. "use strict";
  9143. var _classCallCheck = __webpack_require__(0);
  9144. var _createClass = __webpack_require__(2);
  9145. Object.defineProperty(exports, "__esModule", {
  9146. value: true
  9147. });
  9148. var tslib_1 = __webpack_require__(4);
  9149. var inversify_1 = __webpack_require__(1);
  9150. var ServiceIdentifiers_1 = __webpack_require__(3);
  9151. var estraverse = tslib_1.__importStar(__webpack_require__(17));
  9152. var VisitorDirection_1 = __webpack_require__(203);
  9153. var NodeGuards_1 = __webpack_require__(8);
  9154. var TransformersRunner =
  9155. /*#__PURE__*/
  9156. function () {
  9157. function TransformersRunner(nodeTransformerFactory) {
  9158. _classCallCheck(this, TransformersRunner);
  9159. this.nodeTransformerFactory = nodeTransformerFactory;
  9160. }
  9161. _createClass(TransformersRunner, [{
  9162. key: "transform",
  9163. value: function transform(astTree, nodeTransformers, transformationStage) {
  9164. if (!nodeTransformers.length) {
  9165. return astTree;
  9166. }
  9167. var enterVisitors = [];
  9168. var leaveVisitors = [];
  9169. var nodeTransformersLength = nodeTransformers.length;
  9170. var visitor;
  9171. for (var i = 0; i < nodeTransformersLength; i++) {
  9172. visitor = this.nodeTransformerFactory(nodeTransformers[i]).getVisitor(transformationStage);
  9173. if (!visitor) {
  9174. continue;
  9175. }
  9176. if (visitor.enter) {
  9177. enterVisitors.push({
  9178. enter: visitor.enter
  9179. });
  9180. }
  9181. if (visitor.leave) {
  9182. leaveVisitors.push({
  9183. leave: visitor.leave
  9184. });
  9185. }
  9186. }
  9187. if (!enterVisitors.length && !leaveVisitors.length) {
  9188. return astTree;
  9189. }
  9190. estraverse.replace(astTree, {
  9191. enter: this.mergeVisitorsForDirection(enterVisitors, VisitorDirection_1.VisitorDirection.Enter),
  9192. leave: this.mergeVisitorsForDirection(leaveVisitors, VisitorDirection_1.VisitorDirection.Leave)
  9193. });
  9194. return astTree;
  9195. }
  9196. }, {
  9197. key: "mergeVisitorsForDirection",
  9198. value: function mergeVisitorsForDirection(visitors, direction) {
  9199. var visitorsLength = visitors.length;
  9200. if (!visitorsLength) {
  9201. return function (node, parentNode) {
  9202. return node;
  9203. };
  9204. }
  9205. return function (node, parentNode) {
  9206. if (node.ignoredNode) {
  9207. return estraverse.VisitorOption.Skip;
  9208. }
  9209. for (var i = 0; i < visitorsLength; i++) {
  9210. var visitorFunction = visitors[i][direction];
  9211. if (!visitorFunction) {
  9212. continue;
  9213. }
  9214. var visitorResult = visitorFunction(node, parentNode);
  9215. if (!visitorResult || !NodeGuards_1.NodeGuards.isNode(visitorResult)) {
  9216. continue;
  9217. }
  9218. node = visitorResult;
  9219. }
  9220. return node;
  9221. };
  9222. }
  9223. }]);
  9224. return TransformersRunner;
  9225. }();
  9226. 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);
  9227. exports.TransformersRunner = TransformersRunner;
  9228. /***/ }),
  9229. /* 203 */
  9230. /***/ (function(module, exports, __webpack_require__) {
  9231. "use strict";
  9232. Object.defineProperty(exports, "__esModule", {
  9233. value: true
  9234. });
  9235. var VisitorDirection;
  9236. (function (VisitorDirection) {
  9237. VisitorDirection["Enter"] = "enter";
  9238. VisitorDirection["Leave"] = "leave";
  9239. })(VisitorDirection = exports.VisitorDirection || (exports.VisitorDirection = {}));
  9240. /***/ }),
  9241. /* 204 */
  9242. /***/ (function(module, exports) {
  9243. module.exports = require("commander");
  9244. /***/ }),
  9245. /* 205 */
  9246. /***/ (function(module, exports, __webpack_require__) {
  9247. "use strict";
  9248. Object.defineProperty(exports, "__esModule", {
  9249. value: true
  9250. });
  9251. exports.ArraySanitizer = function (value) {
  9252. if (/,$/.test(value)) {
  9253. throw new SyntaxError("Multiple <list> values should be wrapped inside quotes: --option-name 'value1, value2'");
  9254. }
  9255. return value.split(',').map(function (string) {
  9256. return string.trim();
  9257. });
  9258. };
  9259. /***/ }),
  9260. /* 206 */
  9261. /***/ (function(module, exports, __webpack_require__) {
  9262. "use strict";
  9263. Object.defineProperty(exports, "__esModule", {
  9264. value: true
  9265. });
  9266. exports.BooleanSanitizer = function (value) {
  9267. return value === 'true' || value === '1';
  9268. };
  9269. /***/ }),
  9270. /* 207 */
  9271. /***/ (function(module, exports, __webpack_require__) {
  9272. "use strict";
  9273. var _Object$keys = __webpack_require__(38);
  9274. Object.defineProperty(exports, "__esModule", {
  9275. value: true
  9276. });
  9277. var IdentifierNamesGenerator_1 = __webpack_require__(35);
  9278. exports.IdentifierNamesGeneratorSanitizer = function (value) {
  9279. var isCorrectIdentifierNamesGenerator = _Object$keys(IdentifierNamesGenerator_1.IdentifierNamesGenerator).some(function (key) {
  9280. return IdentifierNamesGenerator_1.IdentifierNamesGenerator[key] === value;
  9281. });
  9282. if (!isCorrectIdentifierNamesGenerator) {
  9283. throw new ReferenceError('Invalid value of `--identifier-names-generator` option');
  9284. }
  9285. return value;
  9286. };
  9287. /***/ }),
  9288. /* 208 */
  9289. /***/ (function(module, exports, __webpack_require__) {
  9290. "use strict";
  9291. var _Object$keys = __webpack_require__(38);
  9292. Object.defineProperty(exports, "__esModule", {
  9293. value: true
  9294. });
  9295. var ObfuscationTarget_1 = __webpack_require__(21);
  9296. exports.ObfuscationTargetSanitizer = function (value) {
  9297. var isCorrectTarget = _Object$keys(ObfuscationTarget_1.ObfuscationTarget).some(function (key) {
  9298. return ObfuscationTarget_1.ObfuscationTarget[key] === value;
  9299. });
  9300. if (!isCorrectTarget) {
  9301. throw new ReferenceError('Invalid value of `--target` option');
  9302. }
  9303. return value;
  9304. };
  9305. /***/ }),
  9306. /* 209 */
  9307. /***/ (function(module, exports, __webpack_require__) {
  9308. "use strict";
  9309. var _Object$keys = __webpack_require__(38);
  9310. Object.defineProperty(exports, "__esModule", {
  9311. value: true
  9312. });
  9313. var SourceMapMode_1 = __webpack_require__(36);
  9314. exports.SourceMapModeSanitizer = function (value) {
  9315. var isCorrectSourceMapMode = _Object$keys(SourceMapMode_1.SourceMapMode).some(function (key) {
  9316. return SourceMapMode_1.SourceMapMode[key] === value;
  9317. });
  9318. if (!isCorrectSourceMapMode) {
  9319. throw new ReferenceError('Invalid value of `--source-map-mode` option');
  9320. }
  9321. return value;
  9322. };
  9323. /***/ }),
  9324. /* 210 */
  9325. /***/ (function(module, exports, __webpack_require__) {
  9326. "use strict";
  9327. Object.defineProperty(exports, "__esModule", {
  9328. value: true
  9329. });
  9330. var StringArrayEncoding_1 = __webpack_require__(37);
  9331. exports.StringArrayEncodingSanitizer = function (value) {
  9332. switch (value) {
  9333. case 'true':
  9334. case '1':
  9335. case StringArrayEncoding_1.StringArrayEncoding.Base64:
  9336. return true;
  9337. case StringArrayEncoding_1.StringArrayEncoding.Rc4:
  9338. return StringArrayEncoding_1.StringArrayEncoding.Rc4;
  9339. default:
  9340. return false;
  9341. }
  9342. };
  9343. /***/ }),
  9344. /* 211 */
  9345. /***/ (function(module, exports, __webpack_require__) {
  9346. "use strict";
  9347. var _classCallCheck = __webpack_require__(0);
  9348. var _createClass = __webpack_require__(2);
  9349. Object.defineProperty(exports, "__esModule", {
  9350. value: true
  9351. });
  9352. var fs = __importStar(__webpack_require__(67));
  9353. var mkdirp = __importStar(__webpack_require__(212));
  9354. var path = __importStar(__webpack_require__(48));
  9355. var JavaScriptObfuscatorCLI_1 = __webpack_require__(47);
  9356. var CLIUtils =
  9357. /*#__PURE__*/
  9358. function () {
  9359. function CLIUtils() {
  9360. _classCallCheck(this, CLIUtils);
  9361. }
  9362. _createClass(CLIUtils, null, [{
  9363. key: "getOutputCodePath",
  9364. value: function getOutputCodePath(inputPath) {
  9365. return path.normalize(inputPath).split('.').map(function (value, index) {
  9366. return index === 0 ? "".concat(value).concat(JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI.obfuscatedFilePrefix) : value;
  9367. }).join('.');
  9368. }
  9369. }, {
  9370. key: "getOutputSourceMapPath",
  9371. value: function getOutputSourceMapPath(outputCodePath) {
  9372. var sourceMapFileName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
  9373. if (sourceMapFileName) {
  9374. outputCodePath = "".concat(outputCodePath.substring(0, outputCodePath.lastIndexOf('/')), "/").concat(sourceMapFileName);
  9375. }
  9376. if (!/\.js\.map$/.test(outputCodePath)) {
  9377. outputCodePath = "".concat(outputCodePath.split('.')[0], ".js.map");
  9378. } else if (/\.js$/.test(outputCodePath)) {
  9379. outputCodePath += '.map';
  9380. }
  9381. return outputCodePath;
  9382. }
  9383. }, {
  9384. key: "getUserConfig",
  9385. value: function getUserConfig(configPath) {
  9386. var config;
  9387. try {
  9388. config = !(function webpackMissingModule() { var e = new Error("Cannot find module \".\""); e.code = 'MODULE_NOT_FOUND'; throw e; }());
  9389. } catch (_a) {
  9390. try {
  9391. config = require(configPath);
  9392. } catch (_b) {
  9393. throw new ReferenceError('Given config path must be a valid `.js` or `.json` file path');
  9394. }
  9395. }
  9396. return config;
  9397. }
  9398. }, {
  9399. key: "writeFile",
  9400. value: function writeFile(outputPath, data) {
  9401. mkdirp.sync(path.dirname(outputPath));
  9402. fs.writeFileSync(outputPath, data, {
  9403. encoding: JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI.encoding
  9404. });
  9405. }
  9406. }]);
  9407. return CLIUtils;
  9408. }();
  9409. exports.CLIUtils = CLIUtils;
  9410. /***/ }),
  9411. /* 212 */
  9412. /***/ (function(module, exports) {
  9413. module.exports = require("mkdirp");
  9414. /***/ }),
  9415. /* 213 */
  9416. /***/ (function(module, exports) {
  9417. function webpackEmptyContext(req) {
  9418. throw new Error("Cannot find module '" + req + "'.");
  9419. }
  9420. webpackEmptyContext.keys = function() { return []; };
  9421. webpackEmptyContext.resolve = webpackEmptyContext;
  9422. module.exports = webpackEmptyContext;
  9423. webpackEmptyContext.id = 213;
  9424. /***/ }),
  9425. /* 214 */
  9426. /***/ (function(module, exports, __webpack_require__) {
  9427. "use strict";
  9428. var _toConsumableArray = __webpack_require__(24);
  9429. var _classCallCheck = __webpack_require__(0);
  9430. var _createClass = __webpack_require__(2);
  9431. Object.defineProperty(exports, "__esModule", {
  9432. value: true
  9433. });
  9434. var fs = __importStar(__webpack_require__(67));
  9435. var path = __importStar(__webpack_require__(48));
  9436. var multimatch_1 = __importDefault(__webpack_require__(215));
  9437. var LoggingPrefix_1 = __webpack_require__(66);
  9438. var JavaScriptObfuscatorCLI_1 = __webpack_require__(47);
  9439. var Logger_1 = __webpack_require__(65);
  9440. var SourceCodeReader =
  9441. /*#__PURE__*/
  9442. function () {
  9443. function SourceCodeReader(options) {
  9444. _classCallCheck(this, SourceCodeReader);
  9445. this.options = options;
  9446. }
  9447. _createClass(SourceCodeReader, [{
  9448. key: "readSourceCode",
  9449. value: function readSourceCode(inputPath) {
  9450. if (SourceCodeReader.isFilePath(inputPath) && this.isValidFile(inputPath)) {
  9451. return this.readFile(inputPath);
  9452. }
  9453. if (SourceCodeReader.isDirectoryPath(inputPath) && this.isValidDirectory(inputPath)) {
  9454. return this.readDirectoryRecursive(inputPath);
  9455. }
  9456. var availableFilePaths = SourceCodeReader.availableInputExtensions.map(function (extension) {
  9457. return "`".concat(extension, "`");
  9458. }).join(', ');
  9459. throw new ReferenceError("Given input path must be a valid ".concat(availableFilePaths, " file or directory path"));
  9460. }
  9461. }, {
  9462. key: "readDirectoryRecursive",
  9463. value: function readDirectoryRecursive(directoryPath) {
  9464. var _this = this;
  9465. var fileData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  9466. fs.readdirSync(directoryPath, JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI.encoding).forEach(function (fileName) {
  9467. var filePath = "".concat(directoryPath, "/").concat(fileName);
  9468. if (SourceCodeReader.isDirectoryPath(filePath) && _this.isValidDirectory(filePath)) {
  9469. fileData.push.apply(fileData, _toConsumableArray(_this.readDirectoryRecursive(filePath)));
  9470. } else if (SourceCodeReader.isFilePath(filePath) && _this.isValidFile(filePath)) {
  9471. var content = _this.readFile(filePath);
  9472. fileData.push({
  9473. filePath: filePath,
  9474. content: content
  9475. });
  9476. }
  9477. });
  9478. return fileData;
  9479. }
  9480. }, {
  9481. key: "readFile",
  9482. value: function readFile(filePath) {
  9483. SourceCodeReader.logFilePath(filePath);
  9484. return fs.readFileSync(filePath, JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI.encoding);
  9485. }
  9486. }, {
  9487. key: "isValidDirectory",
  9488. value: function isValidDirectory(directoryPath) {
  9489. return !SourceCodeReader.isExcludedPath(directoryPath, this.options.exclude);
  9490. }
  9491. }, {
  9492. key: "isValidFile",
  9493. value: function isValidFile(filePath) {
  9494. return SourceCodeReader.availableInputExtensions.includes(path.extname(filePath)) && !filePath.includes(JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI.obfuscatedFilePrefix) && !SourceCodeReader.isExcludedPath(filePath, this.options.exclude);
  9495. }
  9496. }], [{
  9497. key: "isExcludedPath",
  9498. value: function isExcludedPath(filePath) {
  9499. var excludePatterns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  9500. if (!excludePatterns.length) {
  9501. return false;
  9502. }
  9503. var fileName = path.basename(filePath);
  9504. var isExcludedFilePathByGlobPattern = !!multimatch_1.default([filePath], excludePatterns).length;
  9505. var isExcludedFilePathByInclusion = excludePatterns.some(function (excludePattern) {
  9506. return filePath.includes(excludePattern) || fileName.includes(excludePattern);
  9507. });
  9508. return isExcludedFilePathByInclusion || isExcludedFilePathByGlobPattern;
  9509. }
  9510. }, {
  9511. key: "isDirectoryPath",
  9512. value: function isDirectoryPath(filePath) {
  9513. try {
  9514. return fs.statSync(filePath).isDirectory();
  9515. } catch (_a) {
  9516. return false;
  9517. }
  9518. }
  9519. }, {
  9520. key: "isFilePath",
  9521. value: function isFilePath(filePath) {
  9522. try {
  9523. return fs.statSync(filePath).isFile();
  9524. } catch (_a) {
  9525. return false;
  9526. }
  9527. }
  9528. }, {
  9529. key: "logFilePath",
  9530. value: function logFilePath(filePath) {
  9531. var normalizedFilePath = path.normalize(filePath);
  9532. Logger_1.Logger.log(Logger_1.Logger.colorInfo, LoggingPrefix_1.LoggingPrefix.CLI, "Obfuscating file: ".concat(normalizedFilePath, "..."));
  9533. }
  9534. }]);
  9535. return SourceCodeReader;
  9536. }();
  9537. SourceCodeReader.availableInputExtensions = ['.js'];
  9538. exports.SourceCodeReader = SourceCodeReader;
  9539. /***/ }),
  9540. /* 215 */
  9541. /***/ (function(module, exports) {
  9542. module.exports = require("multimatch");
  9543. /***/ })
  9544. /******/ ]);
  9545. //# sourceMappingURL=index.js.map