resources_js_pages_mutation_Report_vue.js 653KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244
  1. (self["webpackChunk"] = self["webpackChunk"] || []).push([["resources_js_pages_mutation_Report_vue"],{
  2. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppButton.vue?vue&type=script&setup=true&lang=js":
  3. /*!**************************************************************************************************************************************************************************************************************!*\
  4. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppButton.vue?vue&type=script&setup=true&lang=js ***!
  5. \**************************************************************************************************************************************************************************************************************/
  6. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  7. "use strict";
  8. __webpack_require__.r(__webpack_exports__);
  9. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  10. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  11. /* harmony export */ });
  12. /* harmony import */ var _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @inertiajs/inertia-vue3 */ "./node_modules/@inertiajs/inertia-vue3/dist/index.js");
  13. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  14. props: {
  15. inertiaLink: {
  16. type: Boolean,
  17. "default": true
  18. },
  19. icon: String,
  20. label: String,
  21. classButton: String
  22. },
  23. setup: function setup(__props, _ref) {
  24. var expose = _ref.expose;
  25. expose();
  26. var __returned__ = {
  27. Link: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_0__.Link
  28. };
  29. Object.defineProperty(__returned__, '__isScriptSetup', {
  30. enumerable: false,
  31. value: true
  32. });
  33. return __returned__;
  34. }
  35. });
  36. /***/ }),
  37. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppMessage.vue?vue&type=script&setup=true&lang=js":
  38. /*!***************************************************************************************************************************************************************************************************************!*\
  39. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppMessage.vue?vue&type=script&setup=true&lang=js ***!
  40. \***************************************************************************************************************************************************************************************************************/
  41. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  42. "use strict";
  43. __webpack_require__.r(__webpack_exports__);
  44. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  45. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  46. /* harmony export */ });
  47. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  48. /* harmony import */ var _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @inertiajs/inertia-vue3 */ "./node_modules/@inertiajs/inertia-vue3/dist/index.js");
  49. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  50. setup: function setup(__props, _ref) {
  51. var expose = _ref.expose;
  52. expose();
  53. var flashMessage = (0,vue__WEBPACK_IMPORTED_MODULE_0__.computed)(function () {
  54. return (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__.usePage)().props.value.flash;
  55. });
  56. var messageDisplay = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)({});
  57. var onClose = function onClose() {
  58. (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__.usePage)().props.value.errors = {};
  59. (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__.usePage)().props.value.flash.success = null;
  60. (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__.usePage)().props.value.flash.error = null;
  61. messageDisplay.value = {
  62. display: 'none'
  63. };
  64. };
  65. (0,vue__WEBPACK_IMPORTED_MODULE_0__.watch)(flashMessage, function () {
  66. messageDisplay.value = {
  67. display: ''
  68. };
  69. }, {
  70. deep: true
  71. });
  72. var __returned__ = {
  73. flashMessage: flashMessage,
  74. messageDisplay: messageDisplay,
  75. onClose: onClose,
  76. ref: vue__WEBPACK_IMPORTED_MODULE_0__.ref,
  77. watch: vue__WEBPACK_IMPORTED_MODULE_0__.watch,
  78. computed: vue__WEBPACK_IMPORTED_MODULE_0__.computed,
  79. usePage: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__.usePage
  80. };
  81. Object.defineProperty(__returned__, '__isScriptSetup', {
  82. enumerable: false,
  83. value: true
  84. });
  85. return __returned__;
  86. }
  87. });
  88. /***/ }),
  89. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppPagination.vue?vue&type=script&setup=true&lang=js":
  90. /*!******************************************************************************************************************************************************************************************************************!*\
  91. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppPagination.vue?vue&type=script&setup=true&lang=js ***!
  92. \******************************************************************************************************************************************************************************************************************/
  93. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  94. "use strict";
  95. __webpack_require__.r(__webpack_exports__);
  96. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  97. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  98. /* harmony export */ });
  99. /* harmony import */ var _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @inertiajs/inertia-vue3 */ "./node_modules/@inertiajs/inertia-vue3/dist/index.js");
  100. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  101. props: {
  102. links: Array
  103. },
  104. setup: function setup(__props, _ref) {
  105. var expose = _ref.expose;
  106. expose();
  107. var __returned__ = {
  108. Link: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_0__.Link
  109. };
  110. Object.defineProperty(__returned__, '__isScriptSetup', {
  111. enumerable: false,
  112. value: true
  113. });
  114. return __returned__;
  115. }
  116. });
  117. /***/ }),
  118. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppSidebar.vue?vue&type=script&setup=true&lang=js":
  119. /*!***************************************************************************************************************************************************************************************************************!*\
  120. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppSidebar.vue?vue&type=script&setup=true&lang=js ***!
  121. \***************************************************************************************************************************************************************************************************************/
  122. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  123. "use strict";
  124. __webpack_require__.r(__webpack_exports__);
  125. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  126. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  127. /* harmony export */ });
  128. /* harmony import */ var _components_AppSubSidebar_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/components/AppSubSidebar.vue */ "./resources/js/components/AppSubSidebar.vue");
  129. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  130. props: {
  131. model: Array
  132. },
  133. emits: ['menuitem-click'],
  134. setup: function setup(__props, _ref) {
  135. var expose = _ref.expose,
  136. emits = _ref.emit;
  137. expose();
  138. var onKeyDown = function onKeyDown(event) {
  139. var nodeElement = event.target;
  140. if (event.code === 'Enter' || event.code === 'Space') {
  141. nodeElement.click();
  142. event.preventDefault();
  143. }
  144. };
  145. var onMenuItemClick = function onMenuItemClick(event) {
  146. emits('menuitem-click', event);
  147. };
  148. var __returned__ = {
  149. emits: emits,
  150. onKeyDown: onKeyDown,
  151. onMenuItemClick: onMenuItemClick,
  152. AppSubSidebar: _components_AppSubSidebar_vue__WEBPACK_IMPORTED_MODULE_0__["default"]
  153. };
  154. Object.defineProperty(__returned__, '__isScriptSetup', {
  155. enumerable: false,
  156. value: true
  157. });
  158. return __returned__;
  159. }
  160. });
  161. /***/ }),
  162. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppSubSidebar.vue?vue&type=script&setup=true&lang=js":
  163. /*!******************************************************************************************************************************************************************************************************************!*\
  164. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppSubSidebar.vue?vue&type=script&setup=true&lang=js ***!
  165. \******************************************************************************************************************************************************************************************************************/
  166. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  167. "use strict";
  168. __webpack_require__.r(__webpack_exports__);
  169. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  170. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  171. /* harmony export */ });
  172. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  173. /* harmony import */ var _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @inertiajs/inertia-vue3 */ "./node_modules/@inertiajs/inertia-vue3/dist/index.js");
  174. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  175. props: {
  176. items: Array,
  177. root: {
  178. type: Boolean,
  179. "default": false
  180. }
  181. },
  182. emits: ['menuitem-click'],
  183. setup: function setup(__props, _ref) {
  184. var expose = _ref.expose,
  185. emits = _ref.emit;
  186. expose();
  187. var activeIndex = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)(null);
  188. var onMenuItemClick = function onMenuItemClick(event, item, index) {
  189. if (item.disabled) {
  190. event.preventDefault();
  191. return;
  192. }
  193. if (!item.to && !item.url) {
  194. event.preventDefault();
  195. }
  196. if (item.command) {
  197. item.command({
  198. originalEvent: event,
  199. item: item
  200. });
  201. }
  202. activeIndex.value = index === activeIndex.value ? null : index;
  203. emits('menuitem-click', {
  204. originalEvent: event,
  205. item: item
  206. });
  207. };
  208. var visible = function visible(item) {
  209. return typeof item.visible === 'function' ? item.visible() : item.visible !== false;
  210. };
  211. var __returned__ = {
  212. emits: emits,
  213. activeIndex: activeIndex,
  214. onMenuItemClick: onMenuItemClick,
  215. visible: visible,
  216. ref: vue__WEBPACK_IMPORTED_MODULE_0__.ref,
  217. Link: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__.Link
  218. };
  219. Object.defineProperty(__returned__, '__isScriptSetup', {
  220. enumerable: false,
  221. value: true
  222. });
  223. return __returned__;
  224. }
  225. });
  226. /***/ }),
  227. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppTopBar.vue?vue&type=script&setup=true&lang=js":
  228. /*!**************************************************************************************************************************************************************************************************************!*\
  229. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppTopBar.vue?vue&type=script&setup=true&lang=js ***!
  230. \**************************************************************************************************************************************************************************************************************/
  231. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  232. "use strict";
  233. __webpack_require__.r(__webpack_exports__);
  234. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  235. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  236. /* harmony export */ });
  237. /* harmony import */ var _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @inertiajs/inertia-vue3 */ "./node_modules/@inertiajs/inertia-vue3/dist/index.js");
  238. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  239. emits: ['menu-toggle'],
  240. setup: function setup(__props, _ref) {
  241. var expose = _ref.expose;
  242. expose();
  243. var __returned__ = {
  244. Link: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_0__.Link
  245. };
  246. Object.defineProperty(__returned__, '__isScriptSetup', {
  247. enumerable: false,
  248. value: true
  249. });
  250. return __returned__;
  251. }
  252. });
  253. /***/ }),
  254. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/layouts/AppLayout.vue?vue&type=script&setup=true&lang=js":
  255. /*!***********************************************************************************************************************************************************************************************************!*\
  256. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/layouts/AppLayout.vue?vue&type=script&setup=true&lang=js ***!
  257. \***********************************************************************************************************************************************************************************************************/
  258. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  259. "use strict";
  260. __webpack_require__.r(__webpack_exports__);
  261. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  262. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  263. /* harmony export */ });
  264. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  265. /* harmony import */ var _components_AppTopBar_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/components/AppTopBar.vue */ "./resources/js/components/AppTopBar.vue");
  266. /* harmony import */ var _components_AppSidebar_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/components/AppSidebar.vue */ "./resources/js/components/AppSidebar.vue");
  267. /* harmony import */ var _components_AppFooter_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/components/AppFooter.vue */ "./resources/js/components/AppFooter.vue");
  268. /* harmony import */ var _components_AppMessage_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/components/AppMessage.vue */ "./resources/js/components/AppMessage.vue");
  269. /* harmony import */ var _utils_menu__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/utils/menu */ "./resources/js/utils/menu.js");
  270. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  271. setup: function setup(__props, _ref) {
  272. var expose = _ref.expose;
  273. expose();
  274. var mobileMenuActive = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)(false);
  275. var staticMenuInactive = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)(false);
  276. var menuClick = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)(false);
  277. var isDesktop = function isDesktop() {
  278. return window.innerWidth >= 992;
  279. };
  280. var addClass = function addClass(element, className) {
  281. if (element.classList) element.classList.add(className);else element.className += ' ' + className;
  282. };
  283. var removeClass = function removeClass(element, className) {
  284. if (element.classList) element.classList.remove(className);else element.className = element.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
  285. };
  286. (0,vue__WEBPACK_IMPORTED_MODULE_0__.onBeforeUpdate)(function () {
  287. if (mobileMenuActive.value) {
  288. addClass(document.body, 'body-overflow-hidden');
  289. } else {
  290. removeClass(document.body, 'body-overflow-hidden');
  291. }
  292. });
  293. var containerClass = (0,vue__WEBPACK_IMPORTED_MODULE_0__.computed)(function () {
  294. return ['layout-wrapper', 'layout-static', {
  295. 'layout-static-sidebar-inactive': staticMenuInactive.value,
  296. 'layout-mobile-sidebar-active': mobileMenuActive.value
  297. }];
  298. });
  299. var onWrapperClick = function onWrapperClick() {
  300. if (!menuClick.value) {
  301. mobileMenuActive.value = false;
  302. }
  303. menuClick.value = false;
  304. };
  305. var onMenuToggle = function onMenuToggle(event) {
  306. menuClick.value = true;
  307. if (isDesktop()) {
  308. staticMenuInactive.value = !staticMenuInactive.value;
  309. } else {
  310. mobileMenuActive.value = !mobileMenuActive.value;
  311. }
  312. event.preventDefault();
  313. };
  314. var onSidebarClick = function onSidebarClick() {
  315. menuClick.value = true;
  316. };
  317. var onMenuItemClick = function onMenuItemClick(event) {
  318. if (event.item && !event.item.items) {
  319. mobileMenuActive.value = false;
  320. }
  321. };
  322. var __returned__ = {
  323. mobileMenuActive: mobileMenuActive,
  324. staticMenuInactive: staticMenuInactive,
  325. menuClick: menuClick,
  326. isDesktop: isDesktop,
  327. addClass: addClass,
  328. removeClass: removeClass,
  329. containerClass: containerClass,
  330. onWrapperClick: onWrapperClick,
  331. onMenuToggle: onMenuToggle,
  332. onSidebarClick: onSidebarClick,
  333. onMenuItemClick: onMenuItemClick,
  334. ref: vue__WEBPACK_IMPORTED_MODULE_0__.ref,
  335. computed: vue__WEBPACK_IMPORTED_MODULE_0__.computed,
  336. onBeforeUpdate: vue__WEBPACK_IMPORTED_MODULE_0__.onBeforeUpdate,
  337. AppTopBar: _components_AppTopBar_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  338. AppSidebar: _components_AppSidebar_vue__WEBPACK_IMPORTED_MODULE_2__["default"],
  339. AppFooter: _components_AppFooter_vue__WEBPACK_IMPORTED_MODULE_3__["default"],
  340. AppMessage: _components_AppMessage_vue__WEBPACK_IMPORTED_MODULE_4__["default"],
  341. menu: _utils_menu__WEBPACK_IMPORTED_MODULE_5__["default"]
  342. };
  343. Object.defineProperty(__returned__, '__isScriptSetup', {
  344. enumerable: false,
  345. value: true
  346. });
  347. return __returned__;
  348. }
  349. });
  350. /***/ }),
  351. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/pages/mutation/Report.vue?vue&type=script&setup=true&lang=js":
  352. /*!***************************************************************************************************************************************************************************************************************!*\
  353. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/pages/mutation/Report.vue?vue&type=script&setup=true&lang=js ***!
  354. \***************************************************************************************************************************************************************************************************************/
  355. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  356. "use strict";
  357. __webpack_require__.r(__webpack_exports__);
  358. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  359. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  360. /* harmony export */ });
  361. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  362. /* harmony import */ var _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @inertiajs/inertia */ "./node_modules/@inertiajs/inertia/dist/index.js");
  363. /* harmony import */ var _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @inertiajs/inertia-vue3 */ "./node_modules/@inertiajs/inertia-vue3/dist/index.js");
  364. /* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! dayjs */ "./node_modules/dayjs/dayjs.min.js");
  365. /* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(dayjs__WEBPACK_IMPORTED_MODULE_3__);
  366. /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  367. /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_4__);
  368. /* harmony import */ var _layouts_AppLayout_vue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/layouts/AppLayout.vue */ "./resources/js/layouts/AppLayout.vue");
  369. /* harmony import */ var _components_AppPagination_vue__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @/components/AppPagination.vue */ "./resources/js/components/AppPagination.vue");
  370. /* harmony import */ var _components_AppButton_vue__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/components/AppButton.vue */ "./resources/js/components/AppButton.vue");
  371. /* harmony import */ var _TableHeader__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./TableHeader */ "./resources/js/pages/mutation/TableHeader.js");
  372. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  373. props: {
  374. mutations: {
  375. type: Object,
  376. "default": {
  377. details: {
  378. data: [],
  379. links: [],
  380. total: 0
  381. }
  382. }
  383. },
  384. filters: Object
  385. },
  386. setup: function setup(__props, _ref) {
  387. var expose = _ref.expose;
  388. expose();
  389. var props = __props;
  390. var filterForm = (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.useForm)({
  391. dates: null,
  392. startDate: props.filters.startDate,
  393. endDate: props.filters.endDate
  394. });
  395. (0,vue__WEBPACK_IMPORTED_MODULE_0__.onMounted)(function () {
  396. if (props.filters.startDate || props.filters.endDate) {
  397. if (props.filters.endDate) {
  398. filterForm.dates = [new Date(props.filters.startDate), new Date(props.filters.endDate)];
  399. } else {
  400. filterForm.dates = [new Date(props.filters.startDate), null];
  401. }
  402. }
  403. });
  404. (0,vue__WEBPACK_IMPORTED_MODULE_0__.watch)(filterForm, function () {
  405. if (filterForm.dates) {
  406. if (filterForm.dates[1]) {
  407. filterForm.startDate = dayjs__WEBPACK_IMPORTED_MODULE_3___default()(filterForm.dates[0]).format('YYYY-MM-DD');
  408. filterForm.endDate = dayjs__WEBPACK_IMPORTED_MODULE_3___default()(filterForm.dates[1]).format('YYYY-MM-DD');
  409. } else {
  410. filterForm.startDate = dayjs__WEBPACK_IMPORTED_MODULE_3___default()(filterForm.dates[0]).format('YYYY-MM-DD');
  411. filterForm.endDate = null;
  412. }
  413. } else {
  414. filterForm.endDate = null;
  415. filterForm.startDate = null;
  416. }
  417. _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_1__.Inertia.reload({
  418. data: (0,lodash__WEBPACK_IMPORTED_MODULE_4__.pickBy)({
  419. startDate: filterForm.startDate,
  420. endDate: filterForm.endDate
  421. }),
  422. only: ['mutations']
  423. });
  424. var params = window.location.search;
  425. exportExcelLink.value = "/reports/mutations/export/excel".concat(params);
  426. });
  427. var filterReset = function filterReset() {
  428. _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_1__.Inertia.get('/reports/mutations');
  429. };
  430. var linkReference = function linkReference(data) {
  431. if (data.topupId) {
  432. return route('top-ups.show', data.topUpId);
  433. } else if (data.expenseId) {
  434. return route('expenses.show', data.expenseId);
  435. } else {
  436. console.info('under construction'); // return route('out-transactions.show', data.outTransactionId)
  437. }
  438. };
  439. var exportExcelLink = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)('/reports/mutations/export/excel');
  440. var __returned__ = {
  441. props: props,
  442. filterForm: filterForm,
  443. filterReset: filterReset,
  444. linkReference: linkReference,
  445. exportExcelLink: exportExcelLink,
  446. watch: vue__WEBPACK_IMPORTED_MODULE_0__.watch,
  447. onMounted: vue__WEBPACK_IMPORTED_MODULE_0__.onMounted,
  448. ref: vue__WEBPACK_IMPORTED_MODULE_0__.ref,
  449. Inertia: _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_1__.Inertia,
  450. Head: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.Head,
  451. useForm: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.useForm,
  452. dayjs: (dayjs__WEBPACK_IMPORTED_MODULE_3___default()),
  453. pickBy: lodash__WEBPACK_IMPORTED_MODULE_4__.pickBy,
  454. AppLayout: _layouts_AppLayout_vue__WEBPACK_IMPORTED_MODULE_5__["default"],
  455. AppPagination: _components_AppPagination_vue__WEBPACK_IMPORTED_MODULE_6__["default"],
  456. AppButton: _components_AppButton_vue__WEBPACK_IMPORTED_MODULE_7__["default"],
  457. TableHeader: _TableHeader__WEBPACK_IMPORTED_MODULE_8__["default"]
  458. };
  459. Object.defineProperty(__returned__, '__isScriptSetup', {
  460. enumerable: false,
  461. value: true
  462. });
  463. return __returned__;
  464. }
  465. });
  466. /***/ }),
  467. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppButton.vue?vue&type=template&id=c9506d50":
  468. /*!*******************************************************************************************************************************************************************************************************************************************************************************!*\
  469. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppButton.vue?vue&type=template&id=c9506d50 ***!
  470. \*******************************************************************************************************************************************************************************************************************************************************************************/
  471. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  472. "use strict";
  473. __webpack_require__.r(__webpack_exports__);
  474. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  475. /* harmony export */ "render": () => (/* binding */ render)
  476. /* harmony export */ });
  477. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  478. var _hoisted_1 = {
  479. key: 1,
  480. "class": "p-button-label"
  481. };
  482. var _hoisted_2 = {
  483. key: 1,
  484. "class": "p-button-label"
  485. };
  486. function render(_ctx, _cache, $props, $setup, $data, $options) {
  487. return $props.inertiaLink ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)($setup["Link"], {
  488. key: 0,
  489. "class": "p-button p-component",
  490. as: "button",
  491. type: "button"
  492. }, {
  493. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  494. return [$props.icon ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("span", {
  495. key: 0,
  496. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(["p-button-icon p-button-icon-left", $props.icon])
  497. }, null, 2
  498. /* CLASS */
  499. )) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), $props.label ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("span", _hoisted_1, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.label), 1
  500. /* TEXT */
  501. )) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)];
  502. }),
  503. _: 1
  504. /* STABLE */
  505. })) : ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("a", {
  506. key: 1,
  507. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)([$props.classButton, "p-button p-component"])
  508. }, [$props.icon ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("span", {
  509. key: 0,
  510. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(["p-button-icon p-button-icon-left", $props.icon])
  511. }, null, 2
  512. /* CLASS */
  513. )) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), $props.label ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("span", _hoisted_2, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.label), 1
  514. /* TEXT */
  515. )) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)], 2
  516. /* CLASS */
  517. ));
  518. }
  519. /***/ }),
  520. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppFooter.vue?vue&type=template&id=4ab6097e":
  521. /*!*******************************************************************************************************************************************************************************************************************************************************************************!*\
  522. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppFooter.vue?vue&type=template&id=4ab6097e ***!
  523. \*******************************************************************************************************************************************************************************************************************************************************************************/
  524. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  525. "use strict";
  526. __webpack_require__.r(__webpack_exports__);
  527. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  528. /* harmony export */ "render": () => (/* binding */ render)
  529. /* harmony export */ });
  530. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  531. var _hoisted_1 = {
  532. "class": "layout-footer"
  533. };
  534. var _hoisted_2 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(" Developed by ");
  535. var _hoisted_3 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("a", {
  536. href: "https://dijitalcode.com",
  537. target: "_blank",
  538. "class": "font-medium ml-2"
  539. }, "DijitalCODE", -1
  540. /* HOISTED */
  541. );
  542. var _hoisted_4 = [_hoisted_2, _hoisted_3];
  543. function render(_ctx, _cache) {
  544. return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", _hoisted_1, _hoisted_4);
  545. }
  546. /***/ }),
  547. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppMessage.vue?vue&type=template&id=07159051":
  548. /*!********************************************************************************************************************************************************************************************************************************************************************************!*\
  549. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppMessage.vue?vue&type=template&id=07159051 ***!
  550. \********************************************************************************************************************************************************************************************************************************************************************************/
  551. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  552. "use strict";
  553. __webpack_require__.r(__webpack_exports__);
  554. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  555. /* harmony export */ "render": () => (/* binding */ render)
  556. /* harmony export */ });
  557. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  558. var _hoisted_1 = {
  559. "class": "grid"
  560. };
  561. var _hoisted_2 = {
  562. "class": "col-12"
  563. };
  564. var _hoisted_3 = {
  565. key: 0
  566. };
  567. var _hoisted_4 = {
  568. key: 1
  569. };
  570. function render(_ctx, _cache, $props, $setup, $data, $options) {
  571. var _component_Message = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Message");
  572. return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", _hoisted_1, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_2, [_ctx.$page.props.flash.success ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_Message, {
  573. key: 0,
  574. severity: "success",
  575. style: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeStyle)($setup.messageDisplay),
  576. onClose: $setup.onClose
  577. }, {
  578. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  579. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)((0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(_ctx.$page.props.flash.success), 1
  580. /* TEXT */
  581. )];
  582. }),
  583. _: 1
  584. /* STABLE */
  585. }, 8
  586. /* PROPS */
  587. , ["style"])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), _ctx.$page.props.flash.error || Object.keys(_ctx.$page.props.errors).length > 0 ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
  588. key: 1
  589. }, [_ctx.$page.props.flash.error ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_Message, {
  590. key: 0,
  591. severity: "error",
  592. style: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeStyle)($setup.messageDisplay),
  593. onClose: $setup.onClose
  594. }, {
  595. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  596. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)((0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(_ctx.$page.props.flash.error), 1
  597. /* TEXT */
  598. )];
  599. }),
  600. _: 1
  601. /* STABLE */
  602. }, 8
  603. /* PROPS */
  604. , ["style"])) : ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_Message, {
  605. key: 1,
  606. severity: "error",
  607. style: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeStyle)($setup.messageDisplay),
  608. onClose: $setup.onClose
  609. }, {
  610. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  611. return [Object.keys(_ctx.$page.props.errors).length === 1 ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", _hoisted_3, "Ditemukan satu error pada form")) : ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", _hoisted_4, "Ditemukan " + (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(Object.keys(_ctx.$page.props.errors).length) + " error pada form", 1
  612. /* TEXT */
  613. ))];
  614. }),
  615. _: 1
  616. /* STABLE */
  617. }, 8
  618. /* PROPS */
  619. , ["style"]))], 2112
  620. /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
  621. )) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)])]);
  622. }
  623. /***/ }),
  624. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppPagination.vue?vue&type=template&id=4da56ec0":
  625. /*!***********************************************************************************************************************************************************************************************************************************************************************************!*\
  626. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppPagination.vue?vue&type=template&id=4da56ec0 ***!
  627. \***********************************************************************************************************************************************************************************************************************************************************************************/
  628. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  629. "use strict";
  630. __webpack_require__.r(__webpack_exports__);
  631. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  632. /* harmony export */ "render": () => (/* binding */ render)
  633. /* harmony export */ });
  634. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  635. var _hoisted_1 = {
  636. key: 0,
  637. "class": "p-paginator p-component flex justify-content-start"
  638. };
  639. var _hoisted_2 = {
  640. "class": "p-paginator-pages"
  641. };
  642. var _hoisted_3 = ["innerHTML"];
  643. function render(_ctx, _cache, $props, $setup, $data, $options) {
  644. return $props.links.length > 3 ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("nav", _hoisted_1, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_2, [((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderList)($props.links, function (link, key) {
  645. return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, [link.url === null ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", {
  646. key: "link-".concat(key),
  647. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(["p-paginator-page p-paginator-element p-link", {
  648. 'p-disabled': link
  649. }]),
  650. innerHTML: link.label
  651. }, null, 10
  652. /* CLASS, PROPS */
  653. , _hoisted_3)) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), link.url !== null ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)($setup["Link"], {
  654. key: "link-".concat(key),
  655. href: link.url,
  656. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)([{
  657. 'p-highlight': link.active
  658. }, "p-paginator-page p-paginator-element p-link"]),
  659. innerHTML: link.label
  660. }, null, 8
  661. /* PROPS */
  662. , ["href", "class", "innerHTML"])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)], 64
  663. /* STABLE_FRAGMENT */
  664. );
  665. }), 256
  666. /* UNKEYED_FRAGMENT */
  667. ))])])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true);
  668. }
  669. /***/ }),
  670. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppSidebar.vue?vue&type=template&id=22a4e926":
  671. /*!********************************************************************************************************************************************************************************************************************************************************************************!*\
  672. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppSidebar.vue?vue&type=template&id=22a4e926 ***!
  673. \********************************************************************************************************************************************************************************************************************************************************************************/
  674. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  675. "use strict";
  676. __webpack_require__.r(__webpack_exports__);
  677. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  678. /* harmony export */ "render": () => (/* binding */ render)
  679. /* harmony export */ });
  680. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  681. var _hoisted_1 = {
  682. "class": "layout-menu-container"
  683. };
  684. function render(_ctx, _cache, $props, $setup, $data, $options) {
  685. return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", _hoisted_1, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppSubSidebar"], {
  686. "class": "layout-menu",
  687. items: $props.model,
  688. root: true,
  689. onKeydown: $setup.onKeyDown,
  690. onMenuitemClick: $setup.onMenuItemClick
  691. }, null, 8
  692. /* PROPS */
  693. , ["items"])]);
  694. }
  695. /***/ }),
  696. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppSubSidebar.vue?vue&type=template&id=0addd9bc":
  697. /*!***********************************************************************************************************************************************************************************************************************************************************************************!*\
  698. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppSubSidebar.vue?vue&type=template&id=0addd9bc ***!
  699. \***********************************************************************************************************************************************************************************************************************************************************************************/
  700. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  701. "use strict";
  702. __webpack_require__.r(__webpack_exports__);
  703. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  704. /* harmony export */ "render": () => (/* binding */ render)
  705. /* harmony export */ });
  706. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  707. var _hoisted_1 = {
  708. key: 0
  709. };
  710. var _hoisted_2 = ["aria-label"];
  711. var _hoisted_3 = {
  712. key: 0,
  713. "class": "pi pi-fw pi-angle-down menuitem-toggle-icon"
  714. };
  715. var _hoisted_4 = ["href", "target", "aria-label", "onClick"];
  716. var _hoisted_5 = {
  717. key: 0,
  718. "class": "pi pi-fw pi-angle-down menuitem-toggle-icon"
  719. };
  720. function render(_ctx, _cache, $props, $setup, $data, $options) {
  721. var _component_AppSubSidebar = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("AppSubSidebar", true);
  722. var _component_Badge = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Badge");
  723. var _directive_ripple = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveDirective)("ripple");
  724. return $props.items ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("ul", _hoisted_1, [((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderList)($props.items, function (item, i) {
  725. return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, [$setup.visible(item) && !item.separator ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("li", {
  726. key: item.label || i,
  727. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)([{
  728. 'layout-menuitem-category': $props.root,
  729. 'active-menuitem': $setup.activeIndex === i && !item.to && !item.disabled
  730. }]),
  731. role: "none"
  732. }, [$props.root ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
  733. key: 0
  734. }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", {
  735. "class": "layout-menuitem-root-text",
  736. "aria-label": item.label
  737. }, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(item.label), 9
  738. /* TEXT, PROPS */
  739. , _hoisted_2), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_AppSubSidebar, {
  740. items: $setup.visible(item) && item.items,
  741. onMenuitemClick: _cache[0] || (_cache[0] = function ($event) {
  742. return _ctx.$emit('menuitem-click', $event);
  743. })
  744. }, null, 8
  745. /* PROPS */
  746. , ["items"])], 64
  747. /* STABLE_FRAGMENT */
  748. )) : ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
  749. key: 1
  750. }, [item.to ? (0,vue__WEBPACK_IMPORTED_MODULE_0__.withDirectives)(((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)($setup["Link"], {
  751. key: 0,
  752. role: "menuitem",
  753. href: item.to,
  754. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)([item["class"], 'p-ripple', {
  755. 'p-disabled': item.disabled,
  756. 'router-link-active': _ctx.$page.component.startsWith(item.component) || _ctx.$page.url.startsWith(item.to),
  757. 'router-link-exact-active': _ctx.$page.component.startsWith(item.component) || _ctx.$page.url.startsWith(item.to)
  758. }]),
  759. style: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeStyle)(item.style),
  760. target: item.target,
  761. "aria-label": item.label,
  762. onClick: function onClick($event) {
  763. return $setup.onMenuItemClick($event, item, i);
  764. }
  765. }, {
  766. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  767. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
  768. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(item.icon)
  769. }, null, 2
  770. /* CLASS */
  771. ), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(item.label), 1
  772. /* TEXT */
  773. ), item.items ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("i", _hoisted_3)) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), item.badge ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_Badge, {
  774. key: 1,
  775. value: item.badge
  776. }, null, 8
  777. /* PROPS */
  778. , ["value"])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)];
  779. }),
  780. _: 2
  781. /* DYNAMIC */
  782. }, 1032
  783. /* PROPS, DYNAMIC_SLOTS */
  784. , ["href", "class", "style", "target", "aria-label", "onClick"])), [[_directive_ripple]]) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), !item.to ? (0,vue__WEBPACK_IMPORTED_MODULE_0__.withDirectives)(((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("a", {
  785. key: 1,
  786. role: "menuitem",
  787. style: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeStyle)(item.style),
  788. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)([item["class"], 'p-ripple', {
  789. 'p-disabled': item.disabled
  790. }]),
  791. href: item.url || '#',
  792. target: item.target,
  793. "aria-label": item.label,
  794. onClick: function onClick($event) {
  795. return $setup.onMenuItemClick($event, item, i);
  796. }
  797. }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
  798. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(item.icon)
  799. }, null, 2
  800. /* CLASS */
  801. ), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(item.label), 1
  802. /* TEXT */
  803. ), item.items ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("i", _hoisted_5)) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), item.badge ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_Badge, {
  804. key: 1,
  805. value: item.badge
  806. }, null, 8
  807. /* PROPS */
  808. , ["value"])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)], 14
  809. /* CLASS, STYLE, PROPS */
  810. , _hoisted_4)), [[_directive_ripple]]) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vue__WEBPACK_IMPORTED_MODULE_0__.Transition, {
  811. name: "layout-submenu-wrapper"
  812. }, {
  813. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  814. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.withDirectives)((0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_AppSubSidebar, {
  815. items: $setup.visible(item) && item.items,
  816. onMenuitemClick: _cache[1] || (_cache[1] = function ($event) {
  817. return _ctx.$emit('menuitem-click', $event);
  818. })
  819. }, null, 8
  820. /* PROPS */
  821. , ["items"]), [[vue__WEBPACK_IMPORTED_MODULE_0__.vShow, $setup.activeIndex === i]])];
  822. }),
  823. _: 2
  824. /* DYNAMIC */
  825. }, 1024
  826. /* DYNAMIC_SLOTS */
  827. )], 64
  828. /* STABLE_FRAGMENT */
  829. ))], 2
  830. /* CLASS */
  831. )) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), $setup.visible(item) && item.separator ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("li", {
  832. "class": "p-menu-separator",
  833. role: "separator",
  834. style: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeStyle)(item.style),
  835. key: 'separator' + i
  836. }, null, 4
  837. /* STYLE */
  838. )) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)], 64
  839. /* STABLE_FRAGMENT */
  840. );
  841. }), 256
  842. /* UNKEYED_FRAGMENT */
  843. ))])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true);
  844. }
  845. /***/ }),
  846. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppTopBar.vue?vue&type=template&id=42bf62a4":
  847. /*!*******************************************************************************************************************************************************************************************************************************************************************************!*\
  848. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppTopBar.vue?vue&type=template&id=42bf62a4 ***!
  849. \*******************************************************************************************************************************************************************************************************************************************************************************/
  850. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  851. "use strict";
  852. __webpack_require__.r(__webpack_exports__);
  853. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  854. /* harmony export */ "render": () => (/* binding */ render)
  855. /* harmony export */ });
  856. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  857. var _hoisted_1 = {
  858. "class": "layout-topbar"
  859. };
  860. var _hoisted_2 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("img", {
  861. alt: "Logo",
  862. src: "/images/logo.svg",
  863. "class": "md:mr-3"
  864. }, null, -1
  865. /* HOISTED */
  866. );
  867. var _hoisted_3 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", null, "Parkirin", -1
  868. /* HOISTED */
  869. );
  870. var _hoisted_4 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
  871. "class": "pi pi-bars"
  872. }, null, -1
  873. /* HOISTED */
  874. );
  875. var _hoisted_5 = [_hoisted_4];
  876. var _hoisted_6 = {
  877. "class": "p-link layout-topbar-menu-button layout-topbar-button"
  878. };
  879. var _hoisted_7 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
  880. "class": "pi pi-ellipsis-v"
  881. }, null, -1
  882. /* HOISTED */
  883. );
  884. var _hoisted_8 = [_hoisted_7];
  885. var _hoisted_9 = {
  886. "class": "layout-topbar-menu hidden lg:flex origin-top"
  887. };
  888. var _hoisted_10 = {
  889. "class": "align-self-center"
  890. };
  891. var _hoisted_11 = {
  892. "class": "hidden lg:inline"
  893. };
  894. var _hoisted_12 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
  895. "class": "pi pi-user"
  896. }, null, -1
  897. /* HOISTED */
  898. );
  899. var _hoisted_13 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", null, "Profil Saya", -1
  900. /* HOISTED */
  901. );
  902. var _hoisted_14 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
  903. "class": "pi pi-sign-out"
  904. }, null, -1
  905. /* HOISTED */
  906. );
  907. var _hoisted_15 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", null, "Sign Out", -1
  908. /* HOISTED */
  909. );
  910. function render(_ctx, _cache, $props, $setup, $data, $options) {
  911. var _directive_styleclass = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveDirective)("styleclass");
  912. return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", _hoisted_1, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["Link"], {
  913. href: "/",
  914. "class": "layout-topbar-logo"
  915. }, {
  916. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  917. return [_hoisted_2, _hoisted_3];
  918. }),
  919. _: 1
  920. /* STABLE */
  921. }), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("button", {
  922. "class": "p-link layout-menu-button layout-topbar-button",
  923. onClick: _cache[0] || (_cache[0] = function ($event) {
  924. return _ctx.$emit('menu-toggle', $event);
  925. })
  926. }, _hoisted_5), (0,vue__WEBPACK_IMPORTED_MODULE_0__.withDirectives)(((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("button", _hoisted_6, _hoisted_8)), [[_directive_styleclass, {
  927. selector: '@next',
  928. enterClass: 'hidden',
  929. enterActiveClass: 'scalein',
  930. leaveToClass: 'hidden',
  931. leaveActiveClass: 'fadeout',
  932. hideOnOutsideClick: true
  933. }]]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("ul", _hoisted_9, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("li", _hoisted_10, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", _hoisted_11, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(_ctx.$page.props.auth.user.name), 1
  934. /* TEXT */
  935. )]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("li", null, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["Link"], {
  936. href: _ctx.route('users.show', _ctx.$page.props.auth.user.id),
  937. "class": "p-link layout-topbar-button"
  938. }, {
  939. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  940. return [_hoisted_12, _hoisted_13];
  941. }),
  942. _: 1
  943. /* STABLE */
  944. }, 8
  945. /* PROPS */
  946. , ["href"])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("li", null, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["Link"], {
  947. href: _ctx.route('logout'),
  948. as: "button",
  949. method: "post",
  950. "class": "p-link layout-topbar-button"
  951. }, {
  952. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  953. return [_hoisted_14, _hoisted_15];
  954. }),
  955. _: 1
  956. /* STABLE */
  957. }, 8
  958. /* PROPS */
  959. , ["href"])])])]);
  960. }
  961. /***/ }),
  962. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/layouts/AppLayout.vue?vue&type=template&id=2cfb4112":
  963. /*!****************************************************************************************************************************************************************************************************************************************************************************!*\
  964. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/layouts/AppLayout.vue?vue&type=template&id=2cfb4112 ***!
  965. \****************************************************************************************************************************************************************************************************************************************************************************/
  966. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  967. "use strict";
  968. __webpack_require__.r(__webpack_exports__);
  969. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  970. /* harmony export */ "render": () => (/* binding */ render)
  971. /* harmony export */ });
  972. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  973. var _hoisted_1 = {
  974. "class": "layout-main-container"
  975. };
  976. var _hoisted_2 = {
  977. "class": "layout-main"
  978. };
  979. var _hoisted_3 = {
  980. key: 0,
  981. "class": "layout-mask p-component-overlay"
  982. };
  983. function render(_ctx, _cache, $props, $setup, $data, $options) {
  984. return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", {
  985. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)($setup.containerClass),
  986. onClick: $setup.onWrapperClick
  987. }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppTopBar"], {
  988. onMenuToggle: $setup.onMenuToggle
  989. }), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", {
  990. "class": "layout-sidebar",
  991. onClick: $setup.onSidebarClick
  992. }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppSidebar"], {
  993. model: $setup.menu[_ctx.$page.props.auth.user.role_id],
  994. onMenuitemClick: $setup.onMenuItemClick
  995. }, null, 8
  996. /* PROPS */
  997. , ["model"])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_1, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_2, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppMessage"]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderSlot)(_ctx.$slots, "default")]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppFooter"])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(vue__WEBPACK_IMPORTED_MODULE_0__.Transition, {
  998. name: "layout-mask"
  999. }, {
  1000. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1001. return [$setup.mobileMenuActive ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", _hoisted_3)) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)];
  1002. }),
  1003. _: 1
  1004. /* STABLE */
  1005. })], 2
  1006. /* CLASS */
  1007. );
  1008. }
  1009. /***/ }),
  1010. /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/pages/mutation/Report.vue?vue&type=template&id=289c9421":
  1011. /*!********************************************************************************************************************************************************************************************************************************************************************************!*\
  1012. !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/pages/mutation/Report.vue?vue&type=template&id=289c9421 ***!
  1013. \********************************************************************************************************************************************************************************************************************************************************************************/
  1014. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1015. "use strict";
  1016. __webpack_require__.r(__webpack_exports__);
  1017. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1018. /* harmony export */ "render": () => (/* binding */ render)
  1019. /* harmony export */ });
  1020. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  1021. var _hoisted_1 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("h1", null, "Laporan Mutasi", -1
  1022. /* HOISTED */
  1023. );
  1024. var _hoisted_2 = {
  1025. "class": "grid"
  1026. };
  1027. var _hoisted_3 = {
  1028. "class": "col-12 md:col-8"
  1029. };
  1030. var _hoisted_4 = {
  1031. "class": "grid"
  1032. };
  1033. var _hoisted_5 = {
  1034. "class": "col-12 md:col-4"
  1035. };
  1036. var _hoisted_6 = {
  1037. "class": "col-auto mt-2 ml-2"
  1038. };
  1039. var _hoisted_7 = {
  1040. "class": "col-12 md:col-4 flex flex-column md:flex-row justify-content-end"
  1041. };
  1042. var _hoisted_8 = {
  1043. key: 0,
  1044. "class": "grid mt-5 ml-1"
  1045. };
  1046. var _hoisted_9 = {
  1047. "class": "col-auto mr-7"
  1048. };
  1049. var _hoisted_10 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", {
  1050. "class": "text-base"
  1051. }, [/*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
  1052. "class": "pi pi-wallet"
  1053. }), /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(" Pendapatan")], -1
  1054. /* HOISTED */
  1055. );
  1056. var _hoisted_11 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("br", null, null, -1
  1057. /* HOISTED */
  1058. );
  1059. var _hoisted_12 = {
  1060. "class": "text-xl font-bold"
  1061. };
  1062. var _hoisted_13 = {
  1063. "class": "col-auto mr-7"
  1064. };
  1065. var _hoisted_14 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", {
  1066. "class": "text-base"
  1067. }, [/*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
  1068. "class": "pi pi-wallet"
  1069. }), /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(" Pengeluaran")], -1
  1070. /* HOISTED */
  1071. );
  1072. var _hoisted_15 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("br", null, null, -1
  1073. /* HOISTED */
  1074. );
  1075. var _hoisted_16 = {
  1076. "class": "text-xl font-bold"
  1077. };
  1078. var _hoisted_17 = {
  1079. "class": "col-auto"
  1080. };
  1081. var _hoisted_18 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", {
  1082. "class": "text-base"
  1083. }, [/*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
  1084. "class": "pi pi-wallet"
  1085. }), /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(" Total ")], -1
  1086. /* HOISTED */
  1087. );
  1088. var _hoisted_19 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("br", null, null, -1
  1089. /* HOISTED */
  1090. );
  1091. var _hoisted_20 = {
  1092. "class": "text-xl font-bold"
  1093. };
  1094. function render(_ctx, _cache, $props, $setup, $data, $options) {
  1095. var _component_Calendar = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Calendar");
  1096. var _component_Button = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Button");
  1097. var _component_Column = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Column");
  1098. var _component_DataTable = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("DataTable");
  1099. return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)($setup["AppLayout"], null, {
  1100. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1101. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["Head"], {
  1102. title: "Laporan Mutasi"
  1103. }), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_DataTable, {
  1104. "responsive-layout": "scroll",
  1105. "column-resize-mode": "expand",
  1106. value: $props.mutations.details.data,
  1107. "row-hover": true,
  1108. "striped-rows": true
  1109. }, {
  1110. header: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1111. return [_hoisted_1, (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_2, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_3, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_4, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_5, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Calendar, {
  1112. "class": "w-full",
  1113. modelValue: $setup.filterForm.dates,
  1114. "onUpdate:modelValue": _cache[0] || (_cache[0] = function ($event) {
  1115. return $setup.filterForm.dates = $event;
  1116. }),
  1117. "selection-mode": "range",
  1118. placeholder: "filter waktu...",
  1119. "date-format": "dd/mm/yy",
  1120. "manual-input": false
  1121. }, null, 8
  1122. /* PROPS */
  1123. , ["modelValue"])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_6, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Button, {
  1124. label: "reset",
  1125. "class": "p-button-link",
  1126. onClick: $setup.filterReset
  1127. })])])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_7, [$props.mutations.details.total ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)($setup["AppButton"], {
  1128. key: 0,
  1129. label: "Export excel",
  1130. "class-button": "p-button-outlined md:w-16rem",
  1131. icon: "pi pi-file-excel",
  1132. "inertia-link": false,
  1133. href: $setup.exportExcelLink
  1134. }, null, 8
  1135. /* PROPS */
  1136. , ["href"])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)])]), $props.mutations.totalAmount ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", _hoisted_8, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_9, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("h2", null, [_hoisted_10, _hoisted_11, (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", _hoisted_12, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.mutations.totalIncome), 1
  1137. /* TEXT */
  1138. )])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_13, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("h2", null, [_hoisted_14, _hoisted_15, (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", _hoisted_16, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.mutations.totalExpense), 1
  1139. /* TEXT */
  1140. )])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_17, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("h2", null, [_hoisted_18, _hoisted_19, (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", _hoisted_20, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.mutations.totalAmount), 1
  1141. /* TEXT */
  1142. )])])])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)];
  1143. }),
  1144. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1145. return [((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderList)($setup.TableHeader, function (tableHeader) {
  1146. return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_Column, {
  1147. field: tableHeader.field,
  1148. header: tableHeader.header,
  1149. key: tableHeader.field
  1150. }, null, 8
  1151. /* PROPS */
  1152. , ["field", "header"]);
  1153. }), 128
  1154. /* KEYED_FRAGMENT */
  1155. )), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Column, null, {
  1156. body: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function (_ref) {
  1157. var data = _ref.data;
  1158. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppButton"], {
  1159. icon: "pi pi-link",
  1160. "class": "p-button-text p-button-icon-only p-button-rounded p-button-text",
  1161. href: $setup.linkReference(data)
  1162. }, null, 8
  1163. /* PROPS */
  1164. , ["href"])];
  1165. }),
  1166. _: 1
  1167. /* STABLE */
  1168. })];
  1169. }),
  1170. _: 1
  1171. /* STABLE */
  1172. }, 8
  1173. /* PROPS */
  1174. , ["value"]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppPagination"], {
  1175. links: $props.mutations.details.links
  1176. }, null, 8
  1177. /* PROPS */
  1178. , ["links"])];
  1179. }),
  1180. _: 1
  1181. /* STABLE */
  1182. });
  1183. }
  1184. /***/ }),
  1185. /***/ "./resources/js/pages/mutation/TableHeader.js":
  1186. /*!****************************************************!*\
  1187. !*** ./resources/js/pages/mutation/TableHeader.js ***!
  1188. \****************************************************/
  1189. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1190. "use strict";
  1191. __webpack_require__.r(__webpack_exports__);
  1192. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1193. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  1194. /* harmony export */ });
  1195. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ([{
  1196. field: 'createdAt',
  1197. header: 'Tanggal'
  1198. }, {
  1199. field: 'type',
  1200. header: 'Tipe'
  1201. }, {
  1202. field: 'amount',
  1203. header: 'Nilai'
  1204. }]);
  1205. /***/ }),
  1206. /***/ "./resources/js/utils/menu.js":
  1207. /*!************************************!*\
  1208. !*** ./resources/js/utils/menu.js ***!
  1209. \************************************/
  1210. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1211. "use strict";
  1212. __webpack_require__.r(__webpack_exports__);
  1213. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1214. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  1215. /* harmony export */ });
  1216. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  1217. // Admin
  1218. 1: [{
  1219. label: 'Home',
  1220. items: [{
  1221. label: 'Dashboard',
  1222. icon: 'pi pi-home',
  1223. to: '/dashboards',
  1224. component: 'home/Index'
  1225. }]
  1226. }, {
  1227. label: 'Master',
  1228. items: [{
  1229. label: 'User',
  1230. icon: 'pi pi-user',
  1231. to: '/users',
  1232. component: 'user/Index'
  1233. }]
  1234. }],
  1235. // Supervisor
  1236. 2: [{
  1237. label: 'Home',
  1238. items: [{
  1239. label: 'Dashboard',
  1240. icon: 'pi pi-home',
  1241. to: '/dashboards',
  1242. component: 'home/Index'
  1243. }]
  1244. }, {
  1245. label: 'Menu',
  1246. items: [{
  1247. label: 'Pengeluaran',
  1248. icon: 'pi pi-wallet',
  1249. to: '/expenses',
  1250. component: 'expense/Index'
  1251. }, {
  1252. label: 'Laporan',
  1253. icon: 'pi pi-book',
  1254. items: [{
  1255. label: 'Mutasi',
  1256. icon: 'pi pi-circle',
  1257. to: '/reports/mutations',
  1258. component: 'mutation/Report'
  1259. }]
  1260. }]
  1261. }, {
  1262. label: 'Master',
  1263. items: [{
  1264. label: 'Jenis Kendaraan',
  1265. icon: 'pi pi-car',
  1266. to: '/type-vehicles',
  1267. component: 'typevehicle/Index'
  1268. }, {
  1269. label: 'Jenis Member',
  1270. icon: 'pi pi-id-card',
  1271. to: '/type-members',
  1272. component: 'typemember/Index'
  1273. }]
  1274. }, {
  1275. label: 'Pengaturan',
  1276. items: [{
  1277. label: 'Tarif Parkir',
  1278. icon: 'pi pi-car',
  1279. to: '/parking-fees/create',
  1280. component: 'parkingfee/Create'
  1281. }]
  1282. }],
  1283. // Operator
  1284. 3: [{
  1285. label: 'Home',
  1286. items: [{
  1287. label: 'Dashboard',
  1288. icon: 'pi pi-home',
  1289. to: '/dashboards',
  1290. component: 'home/Index'
  1291. }]
  1292. }, {
  1293. label: 'Menu',
  1294. items: [{
  1295. label: 'Pengeluaran',
  1296. icon: 'pi pi-wallet',
  1297. to: '/expenses',
  1298. component: 'expense/Index'
  1299. }, {
  1300. label: 'Member',
  1301. icon: 'pi pi-id-card',
  1302. to: '/members',
  1303. component: 'member/Index'
  1304. }, {
  1305. label: 'Top Up',
  1306. icon: 'pi pi-car',
  1307. to: '/top-ups',
  1308. component: 'topup/Index'
  1309. }]
  1310. }]
  1311. });
  1312. /***/ }),
  1313. /***/ "./node_modules/dayjs/dayjs.min.js":
  1314. /*!*****************************************!*\
  1315. !*** ./node_modules/dayjs/dayjs.min.js ***!
  1316. \*****************************************/
  1317. /***/ (function(module) {
  1318. !function(t,e){ true?module.exports=e():0}(this,(function(){"use strict";var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date",$="Invalid Date",l=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},m=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},g={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,f),s=n-i<0,u=e.clone().add(r+(s?-1:1),f);return+(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:f,y:c,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},v="en",D={};D[v]=M;var p=function(t){return t instanceof _},S=function t(e,n,r){var i;if(!e)return v;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else{var a=e.name;D[a]=e,i=a}return!r&&i&&(v=i),i||!r&&v},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},O=g;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t)}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(l);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return O},m.isValid=function(){return!(this.$d.toString()===$)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!O.u(e)||e,h=O.p(t),$=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},l=function(t,e){return O.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,g="set"+(this.$u?"UTC":"");switch(h){case c:return r?$(1,0):$(31,11);case f:return r?$(1,M):$(0,M+1);case o:var v=this.$locale().weekStart||0,D=(y<v?y+7:y)-v;return $(r?m-D:m+(6-D),M);case a:case d:return l(g+"Hours",0);case u:return l(g+"Minutes",1);case s:return l(g+"Seconds",2);case i:return l(g+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=O.p(t),h="set"+(this.$u?"UTC":""),$=(n={},n[a]=h+"Date",n[d]=h+"Date",n[f]=h+"Month",n[c]=h+"FullYear",n[u]=h+"Hours",n[s]=h+"Minutes",n[i]=h+"Seconds",n[r]=h+"Milliseconds",n)[o],l=o===a?this.$D+(e-this.$W):e;if(o===f||o===c){var y=this.clone().set(d,1);y.$d[$](l),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d}else $&&this.$d[$](l);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[O.p(t)]()},m.add=function(r,h){var d,$=this;r=Number(r);var l=O.p(h),y=function(t){var e=w($);return O.w(e.date(e.date()+Math.round(t*r)),$)};if(l===f)return this.set(f,this.$M+r);if(l===c)return this.set(c,this.$y+r);if(l===a)return y(1);if(l===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[l]||1,m=this.$d.getTime()+r*M;return O.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||$;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,f=n.months,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},c=function(t){return O.s(s%12||12,t,"0")},d=n.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},l={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:O.s(a+1,2,"0"),MMM:h(n.monthsShort,a,f,3),MMMM:h(f,a),D:this.$D,DD:O.s(this.$D,2,"0"),d:String(this.$W),dd:h(n.weekdaysMin,this.$W,o,2),ddd:h(n.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:O.s(s,2,"0"),h:c(1),hh:c(2),a:d(s,u,!0),A:d(s,u,!1),m:String(u),mm:O.s(u,2,"0"),s:String(this.$s),ss:O.s(this.$s,2,"0"),SSS:O.s(this.$ms,3,"0"),Z:i};return r.replace(y,(function(t,e){return e||l[t]||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,$){var l,y=O.p(d),M=w(r),m=(M.utcOffset()-this.utcOffset())*e,g=this-M,v=O.m(this,M);return v=(l={},l[c]=v/12,l[f]=v,l[h]=v/3,l[o]=(g-m)/6048e5,l[a]=(g-m)/864e5,l[u]=g/n,l[s]=g/e,l[i]=g/t,l)[y]||g,$?v:O.a(v)},m.daysInMonth=function(){return this.endOf(f).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=S(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return O.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),T=_.prototype;return w.prototype=T,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",f],["$y",c],["$D",d]].forEach((function(t){T[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),w.extend=function(t,e){return t.$i||(t(e,_,w),t.$i=!0),w},w.locale=S,w.isDayjs=p,w.unix=function(t){return w(1e3*t)},w.en=D[v],w.Ls=D,w.p={},w}));
  1319. /***/ }),
  1320. /***/ "./node_modules/lodash/lodash.js":
  1321. /*!***************************************!*\
  1322. !*** ./node_modules/lodash/lodash.js ***!
  1323. \***************************************/
  1324. /***/ (function(module, exports, __webpack_require__) {
  1325. /* module decorator */ module = __webpack_require__.nmd(module);
  1326. var __WEBPACK_AMD_DEFINE_RESULT__;/**
  1327. * @license
  1328. * Lodash <https://lodash.com/>
  1329. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  1330. * Released under MIT license <https://lodash.com/license>
  1331. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  1332. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  1333. */
  1334. ;(function() {
  1335. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  1336. var undefined;
  1337. /** Used as the semantic version number. */
  1338. var VERSION = '4.17.21';
  1339. /** Used as the size to enable large array optimizations. */
  1340. var LARGE_ARRAY_SIZE = 200;
  1341. /** Error message constants. */
  1342. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  1343. FUNC_ERROR_TEXT = 'Expected a function',
  1344. INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`';
  1345. /** Used to stand-in for `undefined` hash values. */
  1346. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  1347. /** Used as the maximum memoize cache size. */
  1348. var MAX_MEMOIZE_SIZE = 500;
  1349. /** Used as the internal argument placeholder. */
  1350. var PLACEHOLDER = '__lodash_placeholder__';
  1351. /** Used to compose bitmasks for cloning. */
  1352. var CLONE_DEEP_FLAG = 1,
  1353. CLONE_FLAT_FLAG = 2,
  1354. CLONE_SYMBOLS_FLAG = 4;
  1355. /** Used to compose bitmasks for value comparisons. */
  1356. var COMPARE_PARTIAL_FLAG = 1,
  1357. COMPARE_UNORDERED_FLAG = 2;
  1358. /** Used to compose bitmasks for function metadata. */
  1359. var WRAP_BIND_FLAG = 1,
  1360. WRAP_BIND_KEY_FLAG = 2,
  1361. WRAP_CURRY_BOUND_FLAG = 4,
  1362. WRAP_CURRY_FLAG = 8,
  1363. WRAP_CURRY_RIGHT_FLAG = 16,
  1364. WRAP_PARTIAL_FLAG = 32,
  1365. WRAP_PARTIAL_RIGHT_FLAG = 64,
  1366. WRAP_ARY_FLAG = 128,
  1367. WRAP_REARG_FLAG = 256,
  1368. WRAP_FLIP_FLAG = 512;
  1369. /** Used as default options for `_.truncate`. */
  1370. var DEFAULT_TRUNC_LENGTH = 30,
  1371. DEFAULT_TRUNC_OMISSION = '...';
  1372. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  1373. var HOT_COUNT = 800,
  1374. HOT_SPAN = 16;
  1375. /** Used to indicate the type of lazy iteratees. */
  1376. var LAZY_FILTER_FLAG = 1,
  1377. LAZY_MAP_FLAG = 2,
  1378. LAZY_WHILE_FLAG = 3;
  1379. /** Used as references for various `Number` constants. */
  1380. var INFINITY = 1 / 0,
  1381. MAX_SAFE_INTEGER = 9007199254740991,
  1382. MAX_INTEGER = 1.7976931348623157e+308,
  1383. NAN = 0 / 0;
  1384. /** Used as references for the maximum length and index of an array. */
  1385. var MAX_ARRAY_LENGTH = 4294967295,
  1386. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  1387. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  1388. /** Used to associate wrap methods with their bit flags. */
  1389. var wrapFlags = [
  1390. ['ary', WRAP_ARY_FLAG],
  1391. ['bind', WRAP_BIND_FLAG],
  1392. ['bindKey', WRAP_BIND_KEY_FLAG],
  1393. ['curry', WRAP_CURRY_FLAG],
  1394. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  1395. ['flip', WRAP_FLIP_FLAG],
  1396. ['partial', WRAP_PARTIAL_FLAG],
  1397. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  1398. ['rearg', WRAP_REARG_FLAG]
  1399. ];
  1400. /** `Object#toString` result references. */
  1401. var argsTag = '[object Arguments]',
  1402. arrayTag = '[object Array]',
  1403. asyncTag = '[object AsyncFunction]',
  1404. boolTag = '[object Boolean]',
  1405. dateTag = '[object Date]',
  1406. domExcTag = '[object DOMException]',
  1407. errorTag = '[object Error]',
  1408. funcTag = '[object Function]',
  1409. genTag = '[object GeneratorFunction]',
  1410. mapTag = '[object Map]',
  1411. numberTag = '[object Number]',
  1412. nullTag = '[object Null]',
  1413. objectTag = '[object Object]',
  1414. promiseTag = '[object Promise]',
  1415. proxyTag = '[object Proxy]',
  1416. regexpTag = '[object RegExp]',
  1417. setTag = '[object Set]',
  1418. stringTag = '[object String]',
  1419. symbolTag = '[object Symbol]',
  1420. undefinedTag = '[object Undefined]',
  1421. weakMapTag = '[object WeakMap]',
  1422. weakSetTag = '[object WeakSet]';
  1423. var arrayBufferTag = '[object ArrayBuffer]',
  1424. dataViewTag = '[object DataView]',
  1425. float32Tag = '[object Float32Array]',
  1426. float64Tag = '[object Float64Array]',
  1427. int8Tag = '[object Int8Array]',
  1428. int16Tag = '[object Int16Array]',
  1429. int32Tag = '[object Int32Array]',
  1430. uint8Tag = '[object Uint8Array]',
  1431. uint8ClampedTag = '[object Uint8ClampedArray]',
  1432. uint16Tag = '[object Uint16Array]',
  1433. uint32Tag = '[object Uint32Array]';
  1434. /** Used to match empty string literals in compiled template source. */
  1435. var reEmptyStringLeading = /\b__p \+= '';/g,
  1436. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  1437. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  1438. /** Used to match HTML entities and HTML characters. */
  1439. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  1440. reUnescapedHtml = /[&<>"']/g,
  1441. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  1442. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  1443. /** Used to match template delimiters. */
  1444. var reEscape = /<%-([\s\S]+?)%>/g,
  1445. reEvaluate = /<%([\s\S]+?)%>/g,
  1446. reInterpolate = /<%=([\s\S]+?)%>/g;
  1447. /** Used to match property names within property paths. */
  1448. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  1449. reIsPlainProp = /^\w*$/,
  1450. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  1451. /**
  1452. * Used to match `RegExp`
  1453. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  1454. */
  1455. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  1456. reHasRegExpChar = RegExp(reRegExpChar.source);
  1457. /** Used to match leading whitespace. */
  1458. var reTrimStart = /^\s+/;
  1459. /** Used to match a single whitespace character. */
  1460. var reWhitespace = /\s/;
  1461. /** Used to match wrap detail comments. */
  1462. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  1463. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  1464. reSplitDetails = /,? & /;
  1465. /** Used to match words composed of alphanumeric characters. */
  1466. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  1467. /**
  1468. * Used to validate the `validate` option in `_.template` variable.
  1469. *
  1470. * Forbids characters which could potentially change the meaning of the function argument definition:
  1471. * - "()," (modification of function parameters)
  1472. * - "=" (default value)
  1473. * - "[]{}" (destructuring of function parameters)
  1474. * - "/" (beginning of a comment)
  1475. * - whitespace
  1476. */
  1477. var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
  1478. /** Used to match backslashes in property paths. */
  1479. var reEscapeChar = /\\(\\)?/g;
  1480. /**
  1481. * Used to match
  1482. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  1483. */
  1484. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  1485. /** Used to match `RegExp` flags from their coerced string values. */
  1486. var reFlags = /\w*$/;
  1487. /** Used to detect bad signed hexadecimal string values. */
  1488. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  1489. /** Used to detect binary string values. */
  1490. var reIsBinary = /^0b[01]+$/i;
  1491. /** Used to detect host constructors (Safari). */
  1492. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  1493. /** Used to detect octal string values. */
  1494. var reIsOctal = /^0o[0-7]+$/i;
  1495. /** Used to detect unsigned integer values. */
  1496. var reIsUint = /^(?:0|[1-9]\d*)$/;
  1497. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  1498. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  1499. /** Used to ensure capturing order of template delimiters. */
  1500. var reNoMatch = /($^)/;
  1501. /** Used to match unescaped characters in compiled string literals. */
  1502. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  1503. /** Used to compose unicode character classes. */
  1504. var rsAstralRange = '\\ud800-\\udfff',
  1505. rsComboMarksRange = '\\u0300-\\u036f',
  1506. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  1507. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  1508. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  1509. rsDingbatRange = '\\u2700-\\u27bf',
  1510. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  1511. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  1512. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  1513. rsPunctuationRange = '\\u2000-\\u206f',
  1514. rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
  1515. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  1516. rsVarRange = '\\ufe0e\\ufe0f',
  1517. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  1518. /** Used to compose unicode capture groups. */
  1519. var rsApos = "['\u2019]",
  1520. rsAstral = '[' + rsAstralRange + ']',
  1521. rsBreak = '[' + rsBreakRange + ']',
  1522. rsCombo = '[' + rsComboRange + ']',
  1523. rsDigits = '\\d+',
  1524. rsDingbat = '[' + rsDingbatRange + ']',
  1525. rsLower = '[' + rsLowerRange + ']',
  1526. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  1527. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  1528. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  1529. rsNonAstral = '[^' + rsAstralRange + ']',
  1530. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  1531. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  1532. rsUpper = '[' + rsUpperRange + ']',
  1533. rsZWJ = '\\u200d';
  1534. /** Used to compose unicode regexes. */
  1535. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  1536. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  1537. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  1538. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  1539. reOptMod = rsModifier + '?',
  1540. rsOptVar = '[' + rsVarRange + ']?',
  1541. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  1542. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  1543. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  1544. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  1545. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  1546. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  1547. /** Used to match apostrophes. */
  1548. var reApos = RegExp(rsApos, 'g');
  1549. /**
  1550. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  1551. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  1552. */
  1553. var reComboMark = RegExp(rsCombo, 'g');
  1554. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  1555. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  1556. /** Used to match complex or compound words. */
  1557. var reUnicodeWord = RegExp([
  1558. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  1559. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  1560. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  1561. rsUpper + '+' + rsOptContrUpper,
  1562. rsOrdUpper,
  1563. rsOrdLower,
  1564. rsDigits,
  1565. rsEmoji
  1566. ].join('|'), 'g');
  1567. /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
  1568. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  1569. /** Used to detect strings that need a more robust regexp to match words. */
  1570. var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
  1571. /** Used to assign default `context` object properties. */
  1572. var contextProps = [
  1573. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  1574. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  1575. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  1576. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  1577. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  1578. ];
  1579. /** Used to make template sourceURLs easier to identify. */
  1580. var templateCounter = -1;
  1581. /** Used to identify `toStringTag` values of typed arrays. */
  1582. var typedArrayTags = {};
  1583. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  1584. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  1585. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  1586. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  1587. typedArrayTags[uint32Tag] = true;
  1588. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  1589. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  1590. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  1591. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  1592. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  1593. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  1594. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  1595. typedArrayTags[weakMapTag] = false;
  1596. /** Used to identify `toStringTag` values supported by `_.clone`. */
  1597. var cloneableTags = {};
  1598. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  1599. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  1600. cloneableTags[boolTag] = cloneableTags[dateTag] =
  1601. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  1602. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  1603. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  1604. cloneableTags[numberTag] = cloneableTags[objectTag] =
  1605. cloneableTags[regexpTag] = cloneableTags[setTag] =
  1606. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  1607. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  1608. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  1609. cloneableTags[errorTag] = cloneableTags[funcTag] =
  1610. cloneableTags[weakMapTag] = false;
  1611. /** Used to map Latin Unicode letters to basic Latin letters. */
  1612. var deburredLetters = {
  1613. // Latin-1 Supplement block.
  1614. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  1615. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  1616. '\xc7': 'C', '\xe7': 'c',
  1617. '\xd0': 'D', '\xf0': 'd',
  1618. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  1619. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  1620. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  1621. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  1622. '\xd1': 'N', '\xf1': 'n',
  1623. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  1624. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  1625. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  1626. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  1627. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  1628. '\xc6': 'Ae', '\xe6': 'ae',
  1629. '\xde': 'Th', '\xfe': 'th',
  1630. '\xdf': 'ss',
  1631. // Latin Extended-A block.
  1632. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  1633. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  1634. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  1635. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  1636. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  1637. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  1638. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  1639. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  1640. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  1641. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  1642. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  1643. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  1644. '\u0134': 'J', '\u0135': 'j',
  1645. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  1646. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  1647. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  1648. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  1649. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  1650. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  1651. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  1652. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  1653. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  1654. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  1655. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  1656. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  1657. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  1658. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  1659. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  1660. '\u0174': 'W', '\u0175': 'w',
  1661. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  1662. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  1663. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  1664. '\u0132': 'IJ', '\u0133': 'ij',
  1665. '\u0152': 'Oe', '\u0153': 'oe',
  1666. '\u0149': "'n", '\u017f': 's'
  1667. };
  1668. /** Used to map characters to HTML entities. */
  1669. var htmlEscapes = {
  1670. '&': '&amp;',
  1671. '<': '&lt;',
  1672. '>': '&gt;',
  1673. '"': '&quot;',
  1674. "'": '&#39;'
  1675. };
  1676. /** Used to map HTML entities to characters. */
  1677. var htmlUnescapes = {
  1678. '&amp;': '&',
  1679. '&lt;': '<',
  1680. '&gt;': '>',
  1681. '&quot;': '"',
  1682. '&#39;': "'"
  1683. };
  1684. /** Used to escape characters for inclusion in compiled string literals. */
  1685. var stringEscapes = {
  1686. '\\': '\\',
  1687. "'": "'",
  1688. '\n': 'n',
  1689. '\r': 'r',
  1690. '\u2028': 'u2028',
  1691. '\u2029': 'u2029'
  1692. };
  1693. /** Built-in method references without a dependency on `root`. */
  1694. var freeParseFloat = parseFloat,
  1695. freeParseInt = parseInt;
  1696. /** Detect free variable `global` from Node.js. */
  1697. var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
  1698. /** Detect free variable `self`. */
  1699. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  1700. /** Used as a reference to the global object. */
  1701. var root = freeGlobal || freeSelf || Function('return this')();
  1702. /** Detect free variable `exports`. */
  1703. var freeExports = true && exports && !exports.nodeType && exports;
  1704. /** Detect free variable `module`. */
  1705. var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module;
  1706. /** Detect the popular CommonJS extension `module.exports`. */
  1707. var moduleExports = freeModule && freeModule.exports === freeExports;
  1708. /** Detect free variable `process` from Node.js. */
  1709. var freeProcess = moduleExports && freeGlobal.process;
  1710. /** Used to access faster Node.js helpers. */
  1711. var nodeUtil = (function() {
  1712. try {
  1713. // Use `util.types` for Node.js 10+.
  1714. var types = freeModule && freeModule.require && freeModule.require('util').types;
  1715. if (types) {
  1716. return types;
  1717. }
  1718. // Legacy `process.binding('util')` for Node.js < 10.
  1719. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  1720. } catch (e) {}
  1721. }());
  1722. /* Node.js helper references. */
  1723. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  1724. nodeIsDate = nodeUtil && nodeUtil.isDate,
  1725. nodeIsMap = nodeUtil && nodeUtil.isMap,
  1726. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  1727. nodeIsSet = nodeUtil && nodeUtil.isSet,
  1728. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  1729. /*--------------------------------------------------------------------------*/
  1730. /**
  1731. * A faster alternative to `Function#apply`, this function invokes `func`
  1732. * with the `this` binding of `thisArg` and the arguments of `args`.
  1733. *
  1734. * @private
  1735. * @param {Function} func The function to invoke.
  1736. * @param {*} thisArg The `this` binding of `func`.
  1737. * @param {Array} args The arguments to invoke `func` with.
  1738. * @returns {*} Returns the result of `func`.
  1739. */
  1740. function apply(func, thisArg, args) {
  1741. switch (args.length) {
  1742. case 0: return func.call(thisArg);
  1743. case 1: return func.call(thisArg, args[0]);
  1744. case 2: return func.call(thisArg, args[0], args[1]);
  1745. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  1746. }
  1747. return func.apply(thisArg, args);
  1748. }
  1749. /**
  1750. * A specialized version of `baseAggregator` for arrays.
  1751. *
  1752. * @private
  1753. * @param {Array} [array] The array to iterate over.
  1754. * @param {Function} setter The function to set `accumulator` values.
  1755. * @param {Function} iteratee The iteratee to transform keys.
  1756. * @param {Object} accumulator The initial aggregated object.
  1757. * @returns {Function} Returns `accumulator`.
  1758. */
  1759. function arrayAggregator(array, setter, iteratee, accumulator) {
  1760. var index = -1,
  1761. length = array == null ? 0 : array.length;
  1762. while (++index < length) {
  1763. var value = array[index];
  1764. setter(accumulator, value, iteratee(value), array);
  1765. }
  1766. return accumulator;
  1767. }
  1768. /**
  1769. * A specialized version of `_.forEach` for arrays without support for
  1770. * iteratee shorthands.
  1771. *
  1772. * @private
  1773. * @param {Array} [array] The array to iterate over.
  1774. * @param {Function} iteratee The function invoked per iteration.
  1775. * @returns {Array} Returns `array`.
  1776. */
  1777. function arrayEach(array, iteratee) {
  1778. var index = -1,
  1779. length = array == null ? 0 : array.length;
  1780. while (++index < length) {
  1781. if (iteratee(array[index], index, array) === false) {
  1782. break;
  1783. }
  1784. }
  1785. return array;
  1786. }
  1787. /**
  1788. * A specialized version of `_.forEachRight` for arrays without support for
  1789. * iteratee shorthands.
  1790. *
  1791. * @private
  1792. * @param {Array} [array] The array to iterate over.
  1793. * @param {Function} iteratee The function invoked per iteration.
  1794. * @returns {Array} Returns `array`.
  1795. */
  1796. function arrayEachRight(array, iteratee) {
  1797. var length = array == null ? 0 : array.length;
  1798. while (length--) {
  1799. if (iteratee(array[length], length, array) === false) {
  1800. break;
  1801. }
  1802. }
  1803. return array;
  1804. }
  1805. /**
  1806. * A specialized version of `_.every` for arrays without support for
  1807. * iteratee shorthands.
  1808. *
  1809. * @private
  1810. * @param {Array} [array] The array to iterate over.
  1811. * @param {Function} predicate The function invoked per iteration.
  1812. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  1813. * else `false`.
  1814. */
  1815. function arrayEvery(array, predicate) {
  1816. var index = -1,
  1817. length = array == null ? 0 : array.length;
  1818. while (++index < length) {
  1819. if (!predicate(array[index], index, array)) {
  1820. return false;
  1821. }
  1822. }
  1823. return true;
  1824. }
  1825. /**
  1826. * A specialized version of `_.filter` for arrays without support for
  1827. * iteratee shorthands.
  1828. *
  1829. * @private
  1830. * @param {Array} [array] The array to iterate over.
  1831. * @param {Function} predicate The function invoked per iteration.
  1832. * @returns {Array} Returns the new filtered array.
  1833. */
  1834. function arrayFilter(array, predicate) {
  1835. var index = -1,
  1836. length = array == null ? 0 : array.length,
  1837. resIndex = 0,
  1838. result = [];
  1839. while (++index < length) {
  1840. var value = array[index];
  1841. if (predicate(value, index, array)) {
  1842. result[resIndex++] = value;
  1843. }
  1844. }
  1845. return result;
  1846. }
  1847. /**
  1848. * A specialized version of `_.includes` for arrays without support for
  1849. * specifying an index to search from.
  1850. *
  1851. * @private
  1852. * @param {Array} [array] The array to inspect.
  1853. * @param {*} target The value to search for.
  1854. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  1855. */
  1856. function arrayIncludes(array, value) {
  1857. var length = array == null ? 0 : array.length;
  1858. return !!length && baseIndexOf(array, value, 0) > -1;
  1859. }
  1860. /**
  1861. * This function is like `arrayIncludes` except that it accepts a comparator.
  1862. *
  1863. * @private
  1864. * @param {Array} [array] The array to inspect.
  1865. * @param {*} target The value to search for.
  1866. * @param {Function} comparator The comparator invoked per element.
  1867. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  1868. */
  1869. function arrayIncludesWith(array, value, comparator) {
  1870. var index = -1,
  1871. length = array == null ? 0 : array.length;
  1872. while (++index < length) {
  1873. if (comparator(value, array[index])) {
  1874. return true;
  1875. }
  1876. }
  1877. return false;
  1878. }
  1879. /**
  1880. * A specialized version of `_.map` for arrays without support for iteratee
  1881. * shorthands.
  1882. *
  1883. * @private
  1884. * @param {Array} [array] The array to iterate over.
  1885. * @param {Function} iteratee The function invoked per iteration.
  1886. * @returns {Array} Returns the new mapped array.
  1887. */
  1888. function arrayMap(array, iteratee) {
  1889. var index = -1,
  1890. length = array == null ? 0 : array.length,
  1891. result = Array(length);
  1892. while (++index < length) {
  1893. result[index] = iteratee(array[index], index, array);
  1894. }
  1895. return result;
  1896. }
  1897. /**
  1898. * Appends the elements of `values` to `array`.
  1899. *
  1900. * @private
  1901. * @param {Array} array The array to modify.
  1902. * @param {Array} values The values to append.
  1903. * @returns {Array} Returns `array`.
  1904. */
  1905. function arrayPush(array, values) {
  1906. var index = -1,
  1907. length = values.length,
  1908. offset = array.length;
  1909. while (++index < length) {
  1910. array[offset + index] = values[index];
  1911. }
  1912. return array;
  1913. }
  1914. /**
  1915. * A specialized version of `_.reduce` for arrays without support for
  1916. * iteratee shorthands.
  1917. *
  1918. * @private
  1919. * @param {Array} [array] The array to iterate over.
  1920. * @param {Function} iteratee The function invoked per iteration.
  1921. * @param {*} [accumulator] The initial value.
  1922. * @param {boolean} [initAccum] Specify using the first element of `array` as
  1923. * the initial value.
  1924. * @returns {*} Returns the accumulated value.
  1925. */
  1926. function arrayReduce(array, iteratee, accumulator, initAccum) {
  1927. var index = -1,
  1928. length = array == null ? 0 : array.length;
  1929. if (initAccum && length) {
  1930. accumulator = array[++index];
  1931. }
  1932. while (++index < length) {
  1933. accumulator = iteratee(accumulator, array[index], index, array);
  1934. }
  1935. return accumulator;
  1936. }
  1937. /**
  1938. * A specialized version of `_.reduceRight` for arrays without support for
  1939. * iteratee shorthands.
  1940. *
  1941. * @private
  1942. * @param {Array} [array] The array to iterate over.
  1943. * @param {Function} iteratee The function invoked per iteration.
  1944. * @param {*} [accumulator] The initial value.
  1945. * @param {boolean} [initAccum] Specify using the last element of `array` as
  1946. * the initial value.
  1947. * @returns {*} Returns the accumulated value.
  1948. */
  1949. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  1950. var length = array == null ? 0 : array.length;
  1951. if (initAccum && length) {
  1952. accumulator = array[--length];
  1953. }
  1954. while (length--) {
  1955. accumulator = iteratee(accumulator, array[length], length, array);
  1956. }
  1957. return accumulator;
  1958. }
  1959. /**
  1960. * A specialized version of `_.some` for arrays without support for iteratee
  1961. * shorthands.
  1962. *
  1963. * @private
  1964. * @param {Array} [array] The array to iterate over.
  1965. * @param {Function} predicate The function invoked per iteration.
  1966. * @returns {boolean} Returns `true` if any element passes the predicate check,
  1967. * else `false`.
  1968. */
  1969. function arraySome(array, predicate) {
  1970. var index = -1,
  1971. length = array == null ? 0 : array.length;
  1972. while (++index < length) {
  1973. if (predicate(array[index], index, array)) {
  1974. return true;
  1975. }
  1976. }
  1977. return false;
  1978. }
  1979. /**
  1980. * Gets the size of an ASCII `string`.
  1981. *
  1982. * @private
  1983. * @param {string} string The string inspect.
  1984. * @returns {number} Returns the string size.
  1985. */
  1986. var asciiSize = baseProperty('length');
  1987. /**
  1988. * Converts an ASCII `string` to an array.
  1989. *
  1990. * @private
  1991. * @param {string} string The string to convert.
  1992. * @returns {Array} Returns the converted array.
  1993. */
  1994. function asciiToArray(string) {
  1995. return string.split('');
  1996. }
  1997. /**
  1998. * Splits an ASCII `string` into an array of its words.
  1999. *
  2000. * @private
  2001. * @param {string} The string to inspect.
  2002. * @returns {Array} Returns the words of `string`.
  2003. */
  2004. function asciiWords(string) {
  2005. return string.match(reAsciiWord) || [];
  2006. }
  2007. /**
  2008. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  2009. * without support for iteratee shorthands, which iterates over `collection`
  2010. * using `eachFunc`.
  2011. *
  2012. * @private
  2013. * @param {Array|Object} collection The collection to inspect.
  2014. * @param {Function} predicate The function invoked per iteration.
  2015. * @param {Function} eachFunc The function to iterate over `collection`.
  2016. * @returns {*} Returns the found element or its key, else `undefined`.
  2017. */
  2018. function baseFindKey(collection, predicate, eachFunc) {
  2019. var result;
  2020. eachFunc(collection, function(value, key, collection) {
  2021. if (predicate(value, key, collection)) {
  2022. result = key;
  2023. return false;
  2024. }
  2025. });
  2026. return result;
  2027. }
  2028. /**
  2029. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  2030. * support for iteratee shorthands.
  2031. *
  2032. * @private
  2033. * @param {Array} array The array to inspect.
  2034. * @param {Function} predicate The function invoked per iteration.
  2035. * @param {number} fromIndex The index to search from.
  2036. * @param {boolean} [fromRight] Specify iterating from right to left.
  2037. * @returns {number} Returns the index of the matched value, else `-1`.
  2038. */
  2039. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  2040. var length = array.length,
  2041. index = fromIndex + (fromRight ? 1 : -1);
  2042. while ((fromRight ? index-- : ++index < length)) {
  2043. if (predicate(array[index], index, array)) {
  2044. return index;
  2045. }
  2046. }
  2047. return -1;
  2048. }
  2049. /**
  2050. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  2051. *
  2052. * @private
  2053. * @param {Array} array The array to inspect.
  2054. * @param {*} value The value to search for.
  2055. * @param {number} fromIndex The index to search from.
  2056. * @returns {number} Returns the index of the matched value, else `-1`.
  2057. */
  2058. function baseIndexOf(array, value, fromIndex) {
  2059. return value === value
  2060. ? strictIndexOf(array, value, fromIndex)
  2061. : baseFindIndex(array, baseIsNaN, fromIndex);
  2062. }
  2063. /**
  2064. * This function is like `baseIndexOf` except that it accepts a comparator.
  2065. *
  2066. * @private
  2067. * @param {Array} array The array to inspect.
  2068. * @param {*} value The value to search for.
  2069. * @param {number} fromIndex The index to search from.
  2070. * @param {Function} comparator The comparator invoked per element.
  2071. * @returns {number} Returns the index of the matched value, else `-1`.
  2072. */
  2073. function baseIndexOfWith(array, value, fromIndex, comparator) {
  2074. var index = fromIndex - 1,
  2075. length = array.length;
  2076. while (++index < length) {
  2077. if (comparator(array[index], value)) {
  2078. return index;
  2079. }
  2080. }
  2081. return -1;
  2082. }
  2083. /**
  2084. * The base implementation of `_.isNaN` without support for number objects.
  2085. *
  2086. * @private
  2087. * @param {*} value The value to check.
  2088. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  2089. */
  2090. function baseIsNaN(value) {
  2091. return value !== value;
  2092. }
  2093. /**
  2094. * The base implementation of `_.mean` and `_.meanBy` without support for
  2095. * iteratee shorthands.
  2096. *
  2097. * @private
  2098. * @param {Array} array The array to iterate over.
  2099. * @param {Function} iteratee The function invoked per iteration.
  2100. * @returns {number} Returns the mean.
  2101. */
  2102. function baseMean(array, iteratee) {
  2103. var length = array == null ? 0 : array.length;
  2104. return length ? (baseSum(array, iteratee) / length) : NAN;
  2105. }
  2106. /**
  2107. * The base implementation of `_.property` without support for deep paths.
  2108. *
  2109. * @private
  2110. * @param {string} key The key of the property to get.
  2111. * @returns {Function} Returns the new accessor function.
  2112. */
  2113. function baseProperty(key) {
  2114. return function(object) {
  2115. return object == null ? undefined : object[key];
  2116. };
  2117. }
  2118. /**
  2119. * The base implementation of `_.propertyOf` without support for deep paths.
  2120. *
  2121. * @private
  2122. * @param {Object} object The object to query.
  2123. * @returns {Function} Returns the new accessor function.
  2124. */
  2125. function basePropertyOf(object) {
  2126. return function(key) {
  2127. return object == null ? undefined : object[key];
  2128. };
  2129. }
  2130. /**
  2131. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  2132. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  2133. *
  2134. * @private
  2135. * @param {Array|Object} collection The collection to iterate over.
  2136. * @param {Function} iteratee The function invoked per iteration.
  2137. * @param {*} accumulator The initial value.
  2138. * @param {boolean} initAccum Specify using the first or last element of
  2139. * `collection` as the initial value.
  2140. * @param {Function} eachFunc The function to iterate over `collection`.
  2141. * @returns {*} Returns the accumulated value.
  2142. */
  2143. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  2144. eachFunc(collection, function(value, index, collection) {
  2145. accumulator = initAccum
  2146. ? (initAccum = false, value)
  2147. : iteratee(accumulator, value, index, collection);
  2148. });
  2149. return accumulator;
  2150. }
  2151. /**
  2152. * The base implementation of `_.sortBy` which uses `comparer` to define the
  2153. * sort order of `array` and replaces criteria objects with their corresponding
  2154. * values.
  2155. *
  2156. * @private
  2157. * @param {Array} array The array to sort.
  2158. * @param {Function} comparer The function to define sort order.
  2159. * @returns {Array} Returns `array`.
  2160. */
  2161. function baseSortBy(array, comparer) {
  2162. var length = array.length;
  2163. array.sort(comparer);
  2164. while (length--) {
  2165. array[length] = array[length].value;
  2166. }
  2167. return array;
  2168. }
  2169. /**
  2170. * The base implementation of `_.sum` and `_.sumBy` without support for
  2171. * iteratee shorthands.
  2172. *
  2173. * @private
  2174. * @param {Array} array The array to iterate over.
  2175. * @param {Function} iteratee The function invoked per iteration.
  2176. * @returns {number} Returns the sum.
  2177. */
  2178. function baseSum(array, iteratee) {
  2179. var result,
  2180. index = -1,
  2181. length = array.length;
  2182. while (++index < length) {
  2183. var current = iteratee(array[index]);
  2184. if (current !== undefined) {
  2185. result = result === undefined ? current : (result + current);
  2186. }
  2187. }
  2188. return result;
  2189. }
  2190. /**
  2191. * The base implementation of `_.times` without support for iteratee shorthands
  2192. * or max array length checks.
  2193. *
  2194. * @private
  2195. * @param {number} n The number of times to invoke `iteratee`.
  2196. * @param {Function} iteratee The function invoked per iteration.
  2197. * @returns {Array} Returns the array of results.
  2198. */
  2199. function baseTimes(n, iteratee) {
  2200. var index = -1,
  2201. result = Array(n);
  2202. while (++index < n) {
  2203. result[index] = iteratee(index);
  2204. }
  2205. return result;
  2206. }
  2207. /**
  2208. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  2209. * of key-value pairs for `object` corresponding to the property names of `props`.
  2210. *
  2211. * @private
  2212. * @param {Object} object The object to query.
  2213. * @param {Array} props The property names to get values for.
  2214. * @returns {Object} Returns the key-value pairs.
  2215. */
  2216. function baseToPairs(object, props) {
  2217. return arrayMap(props, function(key) {
  2218. return [key, object[key]];
  2219. });
  2220. }
  2221. /**
  2222. * The base implementation of `_.trim`.
  2223. *
  2224. * @private
  2225. * @param {string} string The string to trim.
  2226. * @returns {string} Returns the trimmed string.
  2227. */
  2228. function baseTrim(string) {
  2229. return string
  2230. ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
  2231. : string;
  2232. }
  2233. /**
  2234. * The base implementation of `_.unary` without support for storing metadata.
  2235. *
  2236. * @private
  2237. * @param {Function} func The function to cap arguments for.
  2238. * @returns {Function} Returns the new capped function.
  2239. */
  2240. function baseUnary(func) {
  2241. return function(value) {
  2242. return func(value);
  2243. };
  2244. }
  2245. /**
  2246. * The base implementation of `_.values` and `_.valuesIn` which creates an
  2247. * array of `object` property values corresponding to the property names
  2248. * of `props`.
  2249. *
  2250. * @private
  2251. * @param {Object} object The object to query.
  2252. * @param {Array} props The property names to get values for.
  2253. * @returns {Object} Returns the array of property values.
  2254. */
  2255. function baseValues(object, props) {
  2256. return arrayMap(props, function(key) {
  2257. return object[key];
  2258. });
  2259. }
  2260. /**
  2261. * Checks if a `cache` value for `key` exists.
  2262. *
  2263. * @private
  2264. * @param {Object} cache The cache to query.
  2265. * @param {string} key The key of the entry to check.
  2266. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2267. */
  2268. function cacheHas(cache, key) {
  2269. return cache.has(key);
  2270. }
  2271. /**
  2272. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  2273. * that is not found in the character symbols.
  2274. *
  2275. * @private
  2276. * @param {Array} strSymbols The string symbols to inspect.
  2277. * @param {Array} chrSymbols The character symbols to find.
  2278. * @returns {number} Returns the index of the first unmatched string symbol.
  2279. */
  2280. function charsStartIndex(strSymbols, chrSymbols) {
  2281. var index = -1,
  2282. length = strSymbols.length;
  2283. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  2284. return index;
  2285. }
  2286. /**
  2287. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  2288. * that is not found in the character symbols.
  2289. *
  2290. * @private
  2291. * @param {Array} strSymbols The string symbols to inspect.
  2292. * @param {Array} chrSymbols The character symbols to find.
  2293. * @returns {number} Returns the index of the last unmatched string symbol.
  2294. */
  2295. function charsEndIndex(strSymbols, chrSymbols) {
  2296. var index = strSymbols.length;
  2297. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  2298. return index;
  2299. }
  2300. /**
  2301. * Gets the number of `placeholder` occurrences in `array`.
  2302. *
  2303. * @private
  2304. * @param {Array} array The array to inspect.
  2305. * @param {*} placeholder The placeholder to search for.
  2306. * @returns {number} Returns the placeholder count.
  2307. */
  2308. function countHolders(array, placeholder) {
  2309. var length = array.length,
  2310. result = 0;
  2311. while (length--) {
  2312. if (array[length] === placeholder) {
  2313. ++result;
  2314. }
  2315. }
  2316. return result;
  2317. }
  2318. /**
  2319. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  2320. * letters to basic Latin letters.
  2321. *
  2322. * @private
  2323. * @param {string} letter The matched letter to deburr.
  2324. * @returns {string} Returns the deburred letter.
  2325. */
  2326. var deburrLetter = basePropertyOf(deburredLetters);
  2327. /**
  2328. * Used by `_.escape` to convert characters to HTML entities.
  2329. *
  2330. * @private
  2331. * @param {string} chr The matched character to escape.
  2332. * @returns {string} Returns the escaped character.
  2333. */
  2334. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  2335. /**
  2336. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  2337. *
  2338. * @private
  2339. * @param {string} chr The matched character to escape.
  2340. * @returns {string} Returns the escaped character.
  2341. */
  2342. function escapeStringChar(chr) {
  2343. return '\\' + stringEscapes[chr];
  2344. }
  2345. /**
  2346. * Gets the value at `key` of `object`.
  2347. *
  2348. * @private
  2349. * @param {Object} [object] The object to query.
  2350. * @param {string} key The key of the property to get.
  2351. * @returns {*} Returns the property value.
  2352. */
  2353. function getValue(object, key) {
  2354. return object == null ? undefined : object[key];
  2355. }
  2356. /**
  2357. * Checks if `string` contains Unicode symbols.
  2358. *
  2359. * @private
  2360. * @param {string} string The string to inspect.
  2361. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  2362. */
  2363. function hasUnicode(string) {
  2364. return reHasUnicode.test(string);
  2365. }
  2366. /**
  2367. * Checks if `string` contains a word composed of Unicode symbols.
  2368. *
  2369. * @private
  2370. * @param {string} string The string to inspect.
  2371. * @returns {boolean} Returns `true` if a word is found, else `false`.
  2372. */
  2373. function hasUnicodeWord(string) {
  2374. return reHasUnicodeWord.test(string);
  2375. }
  2376. /**
  2377. * Converts `iterator` to an array.
  2378. *
  2379. * @private
  2380. * @param {Object} iterator The iterator to convert.
  2381. * @returns {Array} Returns the converted array.
  2382. */
  2383. function iteratorToArray(iterator) {
  2384. var data,
  2385. result = [];
  2386. while (!(data = iterator.next()).done) {
  2387. result.push(data.value);
  2388. }
  2389. return result;
  2390. }
  2391. /**
  2392. * Converts `map` to its key-value pairs.
  2393. *
  2394. * @private
  2395. * @param {Object} map The map to convert.
  2396. * @returns {Array} Returns the key-value pairs.
  2397. */
  2398. function mapToArray(map) {
  2399. var index = -1,
  2400. result = Array(map.size);
  2401. map.forEach(function(value, key) {
  2402. result[++index] = [key, value];
  2403. });
  2404. return result;
  2405. }
  2406. /**
  2407. * Creates a unary function that invokes `func` with its argument transformed.
  2408. *
  2409. * @private
  2410. * @param {Function} func The function to wrap.
  2411. * @param {Function} transform The argument transform.
  2412. * @returns {Function} Returns the new function.
  2413. */
  2414. function overArg(func, transform) {
  2415. return function(arg) {
  2416. return func(transform(arg));
  2417. };
  2418. }
  2419. /**
  2420. * Replaces all `placeholder` elements in `array` with an internal placeholder
  2421. * and returns an array of their indexes.
  2422. *
  2423. * @private
  2424. * @param {Array} array The array to modify.
  2425. * @param {*} placeholder The placeholder to replace.
  2426. * @returns {Array} Returns the new array of placeholder indexes.
  2427. */
  2428. function replaceHolders(array, placeholder) {
  2429. var index = -1,
  2430. length = array.length,
  2431. resIndex = 0,
  2432. result = [];
  2433. while (++index < length) {
  2434. var value = array[index];
  2435. if (value === placeholder || value === PLACEHOLDER) {
  2436. array[index] = PLACEHOLDER;
  2437. result[resIndex++] = index;
  2438. }
  2439. }
  2440. return result;
  2441. }
  2442. /**
  2443. * Converts `set` to an array of its values.
  2444. *
  2445. * @private
  2446. * @param {Object} set The set to convert.
  2447. * @returns {Array} Returns the values.
  2448. */
  2449. function setToArray(set) {
  2450. var index = -1,
  2451. result = Array(set.size);
  2452. set.forEach(function(value) {
  2453. result[++index] = value;
  2454. });
  2455. return result;
  2456. }
  2457. /**
  2458. * Converts `set` to its value-value pairs.
  2459. *
  2460. * @private
  2461. * @param {Object} set The set to convert.
  2462. * @returns {Array} Returns the value-value pairs.
  2463. */
  2464. function setToPairs(set) {
  2465. var index = -1,
  2466. result = Array(set.size);
  2467. set.forEach(function(value) {
  2468. result[++index] = [value, value];
  2469. });
  2470. return result;
  2471. }
  2472. /**
  2473. * A specialized version of `_.indexOf` which performs strict equality
  2474. * comparisons of values, i.e. `===`.
  2475. *
  2476. * @private
  2477. * @param {Array} array The array to inspect.
  2478. * @param {*} value The value to search for.
  2479. * @param {number} fromIndex The index to search from.
  2480. * @returns {number} Returns the index of the matched value, else `-1`.
  2481. */
  2482. function strictIndexOf(array, value, fromIndex) {
  2483. var index = fromIndex - 1,
  2484. length = array.length;
  2485. while (++index < length) {
  2486. if (array[index] === value) {
  2487. return index;
  2488. }
  2489. }
  2490. return -1;
  2491. }
  2492. /**
  2493. * A specialized version of `_.lastIndexOf` which performs strict equality
  2494. * comparisons of values, i.e. `===`.
  2495. *
  2496. * @private
  2497. * @param {Array} array The array to inspect.
  2498. * @param {*} value The value to search for.
  2499. * @param {number} fromIndex The index to search from.
  2500. * @returns {number} Returns the index of the matched value, else `-1`.
  2501. */
  2502. function strictLastIndexOf(array, value, fromIndex) {
  2503. var index = fromIndex + 1;
  2504. while (index--) {
  2505. if (array[index] === value) {
  2506. return index;
  2507. }
  2508. }
  2509. return index;
  2510. }
  2511. /**
  2512. * Gets the number of symbols in `string`.
  2513. *
  2514. * @private
  2515. * @param {string} string The string to inspect.
  2516. * @returns {number} Returns the string size.
  2517. */
  2518. function stringSize(string) {
  2519. return hasUnicode(string)
  2520. ? unicodeSize(string)
  2521. : asciiSize(string);
  2522. }
  2523. /**
  2524. * Converts `string` to an array.
  2525. *
  2526. * @private
  2527. * @param {string} string The string to convert.
  2528. * @returns {Array} Returns the converted array.
  2529. */
  2530. function stringToArray(string) {
  2531. return hasUnicode(string)
  2532. ? unicodeToArray(string)
  2533. : asciiToArray(string);
  2534. }
  2535. /**
  2536. * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
  2537. * character of `string`.
  2538. *
  2539. * @private
  2540. * @param {string} string The string to inspect.
  2541. * @returns {number} Returns the index of the last non-whitespace character.
  2542. */
  2543. function trimmedEndIndex(string) {
  2544. var index = string.length;
  2545. while (index-- && reWhitespace.test(string.charAt(index))) {}
  2546. return index;
  2547. }
  2548. /**
  2549. * Used by `_.unescape` to convert HTML entities to characters.
  2550. *
  2551. * @private
  2552. * @param {string} chr The matched character to unescape.
  2553. * @returns {string} Returns the unescaped character.
  2554. */
  2555. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  2556. /**
  2557. * Gets the size of a Unicode `string`.
  2558. *
  2559. * @private
  2560. * @param {string} string The string inspect.
  2561. * @returns {number} Returns the string size.
  2562. */
  2563. function unicodeSize(string) {
  2564. var result = reUnicode.lastIndex = 0;
  2565. while (reUnicode.test(string)) {
  2566. ++result;
  2567. }
  2568. return result;
  2569. }
  2570. /**
  2571. * Converts a Unicode `string` to an array.
  2572. *
  2573. * @private
  2574. * @param {string} string The string to convert.
  2575. * @returns {Array} Returns the converted array.
  2576. */
  2577. function unicodeToArray(string) {
  2578. return string.match(reUnicode) || [];
  2579. }
  2580. /**
  2581. * Splits a Unicode `string` into an array of its words.
  2582. *
  2583. * @private
  2584. * @param {string} The string to inspect.
  2585. * @returns {Array} Returns the words of `string`.
  2586. */
  2587. function unicodeWords(string) {
  2588. return string.match(reUnicodeWord) || [];
  2589. }
  2590. /*--------------------------------------------------------------------------*/
  2591. /**
  2592. * Create a new pristine `lodash` function using the `context` object.
  2593. *
  2594. * @static
  2595. * @memberOf _
  2596. * @since 1.1.0
  2597. * @category Util
  2598. * @param {Object} [context=root] The context object.
  2599. * @returns {Function} Returns a new `lodash` function.
  2600. * @example
  2601. *
  2602. * _.mixin({ 'foo': _.constant('foo') });
  2603. *
  2604. * var lodash = _.runInContext();
  2605. * lodash.mixin({ 'bar': lodash.constant('bar') });
  2606. *
  2607. * _.isFunction(_.foo);
  2608. * // => true
  2609. * _.isFunction(_.bar);
  2610. * // => false
  2611. *
  2612. * lodash.isFunction(lodash.foo);
  2613. * // => false
  2614. * lodash.isFunction(lodash.bar);
  2615. * // => true
  2616. *
  2617. * // Create a suped-up `defer` in Node.js.
  2618. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  2619. */
  2620. var runInContext = (function runInContext(context) {
  2621. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  2622. /** Built-in constructor references. */
  2623. var Array = context.Array,
  2624. Date = context.Date,
  2625. Error = context.Error,
  2626. Function = context.Function,
  2627. Math = context.Math,
  2628. Object = context.Object,
  2629. RegExp = context.RegExp,
  2630. String = context.String,
  2631. TypeError = context.TypeError;
  2632. /** Used for built-in method references. */
  2633. var arrayProto = Array.prototype,
  2634. funcProto = Function.prototype,
  2635. objectProto = Object.prototype;
  2636. /** Used to detect overreaching core-js shims. */
  2637. var coreJsData = context['__core-js_shared__'];
  2638. /** Used to resolve the decompiled source of functions. */
  2639. var funcToString = funcProto.toString;
  2640. /** Used to check objects for own properties. */
  2641. var hasOwnProperty = objectProto.hasOwnProperty;
  2642. /** Used to generate unique IDs. */
  2643. var idCounter = 0;
  2644. /** Used to detect methods masquerading as native. */
  2645. var maskSrcKey = (function() {
  2646. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  2647. return uid ? ('Symbol(src)_1.' + uid) : '';
  2648. }());
  2649. /**
  2650. * Used to resolve the
  2651. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  2652. * of values.
  2653. */
  2654. var nativeObjectToString = objectProto.toString;
  2655. /** Used to infer the `Object` constructor. */
  2656. var objectCtorString = funcToString.call(Object);
  2657. /** Used to restore the original `_` reference in `_.noConflict`. */
  2658. var oldDash = root._;
  2659. /** Used to detect if a method is native. */
  2660. var reIsNative = RegExp('^' +
  2661. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  2662. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  2663. );
  2664. /** Built-in value references. */
  2665. var Buffer = moduleExports ? context.Buffer : undefined,
  2666. Symbol = context.Symbol,
  2667. Uint8Array = context.Uint8Array,
  2668. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  2669. getPrototype = overArg(Object.getPrototypeOf, Object),
  2670. objectCreate = Object.create,
  2671. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  2672. splice = arrayProto.splice,
  2673. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  2674. symIterator = Symbol ? Symbol.iterator : undefined,
  2675. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  2676. var defineProperty = (function() {
  2677. try {
  2678. var func = getNative(Object, 'defineProperty');
  2679. func({}, '', {});
  2680. return func;
  2681. } catch (e) {}
  2682. }());
  2683. /** Mocked built-ins. */
  2684. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  2685. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  2686. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  2687. /* Built-in method references for those with the same name as other `lodash` methods. */
  2688. var nativeCeil = Math.ceil,
  2689. nativeFloor = Math.floor,
  2690. nativeGetSymbols = Object.getOwnPropertySymbols,
  2691. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  2692. nativeIsFinite = context.isFinite,
  2693. nativeJoin = arrayProto.join,
  2694. nativeKeys = overArg(Object.keys, Object),
  2695. nativeMax = Math.max,
  2696. nativeMin = Math.min,
  2697. nativeNow = Date.now,
  2698. nativeParseInt = context.parseInt,
  2699. nativeRandom = Math.random,
  2700. nativeReverse = arrayProto.reverse;
  2701. /* Built-in method references that are verified to be native. */
  2702. var DataView = getNative(context, 'DataView'),
  2703. Map = getNative(context, 'Map'),
  2704. Promise = getNative(context, 'Promise'),
  2705. Set = getNative(context, 'Set'),
  2706. WeakMap = getNative(context, 'WeakMap'),
  2707. nativeCreate = getNative(Object, 'create');
  2708. /** Used to store function metadata. */
  2709. var metaMap = WeakMap && new WeakMap;
  2710. /** Used to lookup unminified function names. */
  2711. var realNames = {};
  2712. /** Used to detect maps, sets, and weakmaps. */
  2713. var dataViewCtorString = toSource(DataView),
  2714. mapCtorString = toSource(Map),
  2715. promiseCtorString = toSource(Promise),
  2716. setCtorString = toSource(Set),
  2717. weakMapCtorString = toSource(WeakMap);
  2718. /** Used to convert symbols to primitives and strings. */
  2719. var symbolProto = Symbol ? Symbol.prototype : undefined,
  2720. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  2721. symbolToString = symbolProto ? symbolProto.toString : undefined;
  2722. /*------------------------------------------------------------------------*/
  2723. /**
  2724. * Creates a `lodash` object which wraps `value` to enable implicit method
  2725. * chain sequences. Methods that operate on and return arrays, collections,
  2726. * and functions can be chained together. Methods that retrieve a single value
  2727. * or may return a primitive value will automatically end the chain sequence
  2728. * and return the unwrapped value. Otherwise, the value must be unwrapped
  2729. * with `_#value`.
  2730. *
  2731. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  2732. * enabled using `_.chain`.
  2733. *
  2734. * The execution of chained methods is lazy, that is, it's deferred until
  2735. * `_#value` is implicitly or explicitly called.
  2736. *
  2737. * Lazy evaluation allows several methods to support shortcut fusion.
  2738. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  2739. * the creation of intermediate arrays and can greatly reduce the number of
  2740. * iteratee executions. Sections of a chain sequence qualify for shortcut
  2741. * fusion if the section is applied to an array and iteratees accept only
  2742. * one argument. The heuristic for whether a section qualifies for shortcut
  2743. * fusion is subject to change.
  2744. *
  2745. * Chaining is supported in custom builds as long as the `_#value` method is
  2746. * directly or indirectly included in the build.
  2747. *
  2748. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  2749. *
  2750. * The wrapper `Array` methods are:
  2751. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  2752. *
  2753. * The wrapper `String` methods are:
  2754. * `replace` and `split`
  2755. *
  2756. * The wrapper methods that support shortcut fusion are:
  2757. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  2758. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  2759. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  2760. *
  2761. * The chainable wrapper methods are:
  2762. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  2763. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  2764. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  2765. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  2766. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  2767. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  2768. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  2769. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  2770. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  2771. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  2772. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  2773. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  2774. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  2775. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  2776. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  2777. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  2778. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  2779. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  2780. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  2781. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  2782. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  2783. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  2784. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  2785. * `zipObject`, `zipObjectDeep`, and `zipWith`
  2786. *
  2787. * The wrapper methods that are **not** chainable by default are:
  2788. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  2789. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  2790. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  2791. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  2792. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  2793. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  2794. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  2795. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  2796. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  2797. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  2798. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  2799. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  2800. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  2801. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  2802. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  2803. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  2804. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  2805. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  2806. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  2807. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  2808. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  2809. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  2810. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  2811. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  2812. * `upperFirst`, `value`, and `words`
  2813. *
  2814. * @name _
  2815. * @constructor
  2816. * @category Seq
  2817. * @param {*} value The value to wrap in a `lodash` instance.
  2818. * @returns {Object} Returns the new `lodash` wrapper instance.
  2819. * @example
  2820. *
  2821. * function square(n) {
  2822. * return n * n;
  2823. * }
  2824. *
  2825. * var wrapped = _([1, 2, 3]);
  2826. *
  2827. * // Returns an unwrapped value.
  2828. * wrapped.reduce(_.add);
  2829. * // => 6
  2830. *
  2831. * // Returns a wrapped value.
  2832. * var squares = wrapped.map(square);
  2833. *
  2834. * _.isArray(squares);
  2835. * // => false
  2836. *
  2837. * _.isArray(squares.value());
  2838. * // => true
  2839. */
  2840. function lodash(value) {
  2841. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  2842. if (value instanceof LodashWrapper) {
  2843. return value;
  2844. }
  2845. if (hasOwnProperty.call(value, '__wrapped__')) {
  2846. return wrapperClone(value);
  2847. }
  2848. }
  2849. return new LodashWrapper(value);
  2850. }
  2851. /**
  2852. * The base implementation of `_.create` without support for assigning
  2853. * properties to the created object.
  2854. *
  2855. * @private
  2856. * @param {Object} proto The object to inherit from.
  2857. * @returns {Object} Returns the new object.
  2858. */
  2859. var baseCreate = (function() {
  2860. function object() {}
  2861. return function(proto) {
  2862. if (!isObject(proto)) {
  2863. return {};
  2864. }
  2865. if (objectCreate) {
  2866. return objectCreate(proto);
  2867. }
  2868. object.prototype = proto;
  2869. var result = new object;
  2870. object.prototype = undefined;
  2871. return result;
  2872. };
  2873. }());
  2874. /**
  2875. * The function whose prototype chain sequence wrappers inherit from.
  2876. *
  2877. * @private
  2878. */
  2879. function baseLodash() {
  2880. // No operation performed.
  2881. }
  2882. /**
  2883. * The base constructor for creating `lodash` wrapper objects.
  2884. *
  2885. * @private
  2886. * @param {*} value The value to wrap.
  2887. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  2888. */
  2889. function LodashWrapper(value, chainAll) {
  2890. this.__wrapped__ = value;
  2891. this.__actions__ = [];
  2892. this.__chain__ = !!chainAll;
  2893. this.__index__ = 0;
  2894. this.__values__ = undefined;
  2895. }
  2896. /**
  2897. * By default, the template delimiters used by lodash are like those in
  2898. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  2899. * following template settings to use alternative delimiters.
  2900. *
  2901. * @static
  2902. * @memberOf _
  2903. * @type {Object}
  2904. */
  2905. lodash.templateSettings = {
  2906. /**
  2907. * Used to detect `data` property values to be HTML-escaped.
  2908. *
  2909. * @memberOf _.templateSettings
  2910. * @type {RegExp}
  2911. */
  2912. 'escape': reEscape,
  2913. /**
  2914. * Used to detect code to be evaluated.
  2915. *
  2916. * @memberOf _.templateSettings
  2917. * @type {RegExp}
  2918. */
  2919. 'evaluate': reEvaluate,
  2920. /**
  2921. * Used to detect `data` property values to inject.
  2922. *
  2923. * @memberOf _.templateSettings
  2924. * @type {RegExp}
  2925. */
  2926. 'interpolate': reInterpolate,
  2927. /**
  2928. * Used to reference the data object in the template text.
  2929. *
  2930. * @memberOf _.templateSettings
  2931. * @type {string}
  2932. */
  2933. 'variable': '',
  2934. /**
  2935. * Used to import variables into the compiled template.
  2936. *
  2937. * @memberOf _.templateSettings
  2938. * @type {Object}
  2939. */
  2940. 'imports': {
  2941. /**
  2942. * A reference to the `lodash` function.
  2943. *
  2944. * @memberOf _.templateSettings.imports
  2945. * @type {Function}
  2946. */
  2947. '_': lodash
  2948. }
  2949. };
  2950. // Ensure wrappers are instances of `baseLodash`.
  2951. lodash.prototype = baseLodash.prototype;
  2952. lodash.prototype.constructor = lodash;
  2953. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  2954. LodashWrapper.prototype.constructor = LodashWrapper;
  2955. /*------------------------------------------------------------------------*/
  2956. /**
  2957. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  2958. *
  2959. * @private
  2960. * @constructor
  2961. * @param {*} value The value to wrap.
  2962. */
  2963. function LazyWrapper(value) {
  2964. this.__wrapped__ = value;
  2965. this.__actions__ = [];
  2966. this.__dir__ = 1;
  2967. this.__filtered__ = false;
  2968. this.__iteratees__ = [];
  2969. this.__takeCount__ = MAX_ARRAY_LENGTH;
  2970. this.__views__ = [];
  2971. }
  2972. /**
  2973. * Creates a clone of the lazy wrapper object.
  2974. *
  2975. * @private
  2976. * @name clone
  2977. * @memberOf LazyWrapper
  2978. * @returns {Object} Returns the cloned `LazyWrapper` object.
  2979. */
  2980. function lazyClone() {
  2981. var result = new LazyWrapper(this.__wrapped__);
  2982. result.__actions__ = copyArray(this.__actions__);
  2983. result.__dir__ = this.__dir__;
  2984. result.__filtered__ = this.__filtered__;
  2985. result.__iteratees__ = copyArray(this.__iteratees__);
  2986. result.__takeCount__ = this.__takeCount__;
  2987. result.__views__ = copyArray(this.__views__);
  2988. return result;
  2989. }
  2990. /**
  2991. * Reverses the direction of lazy iteration.
  2992. *
  2993. * @private
  2994. * @name reverse
  2995. * @memberOf LazyWrapper
  2996. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  2997. */
  2998. function lazyReverse() {
  2999. if (this.__filtered__) {
  3000. var result = new LazyWrapper(this);
  3001. result.__dir__ = -1;
  3002. result.__filtered__ = true;
  3003. } else {
  3004. result = this.clone();
  3005. result.__dir__ *= -1;
  3006. }
  3007. return result;
  3008. }
  3009. /**
  3010. * Extracts the unwrapped value from its lazy wrapper.
  3011. *
  3012. * @private
  3013. * @name value
  3014. * @memberOf LazyWrapper
  3015. * @returns {*} Returns the unwrapped value.
  3016. */
  3017. function lazyValue() {
  3018. var array = this.__wrapped__.value(),
  3019. dir = this.__dir__,
  3020. isArr = isArray(array),
  3021. isRight = dir < 0,
  3022. arrLength = isArr ? array.length : 0,
  3023. view = getView(0, arrLength, this.__views__),
  3024. start = view.start,
  3025. end = view.end,
  3026. length = end - start,
  3027. index = isRight ? end : (start - 1),
  3028. iteratees = this.__iteratees__,
  3029. iterLength = iteratees.length,
  3030. resIndex = 0,
  3031. takeCount = nativeMin(length, this.__takeCount__);
  3032. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  3033. return baseWrapperValue(array, this.__actions__);
  3034. }
  3035. var result = [];
  3036. outer:
  3037. while (length-- && resIndex < takeCount) {
  3038. index += dir;
  3039. var iterIndex = -1,
  3040. value = array[index];
  3041. while (++iterIndex < iterLength) {
  3042. var data = iteratees[iterIndex],
  3043. iteratee = data.iteratee,
  3044. type = data.type,
  3045. computed = iteratee(value);
  3046. if (type == LAZY_MAP_FLAG) {
  3047. value = computed;
  3048. } else if (!computed) {
  3049. if (type == LAZY_FILTER_FLAG) {
  3050. continue outer;
  3051. } else {
  3052. break outer;
  3053. }
  3054. }
  3055. }
  3056. result[resIndex++] = value;
  3057. }
  3058. return result;
  3059. }
  3060. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  3061. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  3062. LazyWrapper.prototype.constructor = LazyWrapper;
  3063. /*------------------------------------------------------------------------*/
  3064. /**
  3065. * Creates a hash object.
  3066. *
  3067. * @private
  3068. * @constructor
  3069. * @param {Array} [entries] The key-value pairs to cache.
  3070. */
  3071. function Hash(entries) {
  3072. var index = -1,
  3073. length = entries == null ? 0 : entries.length;
  3074. this.clear();
  3075. while (++index < length) {
  3076. var entry = entries[index];
  3077. this.set(entry[0], entry[1]);
  3078. }
  3079. }
  3080. /**
  3081. * Removes all key-value entries from the hash.
  3082. *
  3083. * @private
  3084. * @name clear
  3085. * @memberOf Hash
  3086. */
  3087. function hashClear() {
  3088. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  3089. this.size = 0;
  3090. }
  3091. /**
  3092. * Removes `key` and its value from the hash.
  3093. *
  3094. * @private
  3095. * @name delete
  3096. * @memberOf Hash
  3097. * @param {Object} hash The hash to modify.
  3098. * @param {string} key The key of the value to remove.
  3099. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3100. */
  3101. function hashDelete(key) {
  3102. var result = this.has(key) && delete this.__data__[key];
  3103. this.size -= result ? 1 : 0;
  3104. return result;
  3105. }
  3106. /**
  3107. * Gets the hash value for `key`.
  3108. *
  3109. * @private
  3110. * @name get
  3111. * @memberOf Hash
  3112. * @param {string} key The key of the value to get.
  3113. * @returns {*} Returns the entry value.
  3114. */
  3115. function hashGet(key) {
  3116. var data = this.__data__;
  3117. if (nativeCreate) {
  3118. var result = data[key];
  3119. return result === HASH_UNDEFINED ? undefined : result;
  3120. }
  3121. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  3122. }
  3123. /**
  3124. * Checks if a hash value for `key` exists.
  3125. *
  3126. * @private
  3127. * @name has
  3128. * @memberOf Hash
  3129. * @param {string} key The key of the entry to check.
  3130. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3131. */
  3132. function hashHas(key) {
  3133. var data = this.__data__;
  3134. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  3135. }
  3136. /**
  3137. * Sets the hash `key` to `value`.
  3138. *
  3139. * @private
  3140. * @name set
  3141. * @memberOf Hash
  3142. * @param {string} key The key of the value to set.
  3143. * @param {*} value The value to set.
  3144. * @returns {Object} Returns the hash instance.
  3145. */
  3146. function hashSet(key, value) {
  3147. var data = this.__data__;
  3148. this.size += this.has(key) ? 0 : 1;
  3149. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  3150. return this;
  3151. }
  3152. // Add methods to `Hash`.
  3153. Hash.prototype.clear = hashClear;
  3154. Hash.prototype['delete'] = hashDelete;
  3155. Hash.prototype.get = hashGet;
  3156. Hash.prototype.has = hashHas;
  3157. Hash.prototype.set = hashSet;
  3158. /*------------------------------------------------------------------------*/
  3159. /**
  3160. * Creates an list cache object.
  3161. *
  3162. * @private
  3163. * @constructor
  3164. * @param {Array} [entries] The key-value pairs to cache.
  3165. */
  3166. function ListCache(entries) {
  3167. var index = -1,
  3168. length = entries == null ? 0 : entries.length;
  3169. this.clear();
  3170. while (++index < length) {
  3171. var entry = entries[index];
  3172. this.set(entry[0], entry[1]);
  3173. }
  3174. }
  3175. /**
  3176. * Removes all key-value entries from the list cache.
  3177. *
  3178. * @private
  3179. * @name clear
  3180. * @memberOf ListCache
  3181. */
  3182. function listCacheClear() {
  3183. this.__data__ = [];
  3184. this.size = 0;
  3185. }
  3186. /**
  3187. * Removes `key` and its value from the list cache.
  3188. *
  3189. * @private
  3190. * @name delete
  3191. * @memberOf ListCache
  3192. * @param {string} key The key of the value to remove.
  3193. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3194. */
  3195. function listCacheDelete(key) {
  3196. var data = this.__data__,
  3197. index = assocIndexOf(data, key);
  3198. if (index < 0) {
  3199. return false;
  3200. }
  3201. var lastIndex = data.length - 1;
  3202. if (index == lastIndex) {
  3203. data.pop();
  3204. } else {
  3205. splice.call(data, index, 1);
  3206. }
  3207. --this.size;
  3208. return true;
  3209. }
  3210. /**
  3211. * Gets the list cache value for `key`.
  3212. *
  3213. * @private
  3214. * @name get
  3215. * @memberOf ListCache
  3216. * @param {string} key The key of the value to get.
  3217. * @returns {*} Returns the entry value.
  3218. */
  3219. function listCacheGet(key) {
  3220. var data = this.__data__,
  3221. index = assocIndexOf(data, key);
  3222. return index < 0 ? undefined : data[index][1];
  3223. }
  3224. /**
  3225. * Checks if a list cache value for `key` exists.
  3226. *
  3227. * @private
  3228. * @name has
  3229. * @memberOf ListCache
  3230. * @param {string} key The key of the entry to check.
  3231. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3232. */
  3233. function listCacheHas(key) {
  3234. return assocIndexOf(this.__data__, key) > -1;
  3235. }
  3236. /**
  3237. * Sets the list cache `key` to `value`.
  3238. *
  3239. * @private
  3240. * @name set
  3241. * @memberOf ListCache
  3242. * @param {string} key The key of the value to set.
  3243. * @param {*} value The value to set.
  3244. * @returns {Object} Returns the list cache instance.
  3245. */
  3246. function listCacheSet(key, value) {
  3247. var data = this.__data__,
  3248. index = assocIndexOf(data, key);
  3249. if (index < 0) {
  3250. ++this.size;
  3251. data.push([key, value]);
  3252. } else {
  3253. data[index][1] = value;
  3254. }
  3255. return this;
  3256. }
  3257. // Add methods to `ListCache`.
  3258. ListCache.prototype.clear = listCacheClear;
  3259. ListCache.prototype['delete'] = listCacheDelete;
  3260. ListCache.prototype.get = listCacheGet;
  3261. ListCache.prototype.has = listCacheHas;
  3262. ListCache.prototype.set = listCacheSet;
  3263. /*------------------------------------------------------------------------*/
  3264. /**
  3265. * Creates a map cache object to store key-value pairs.
  3266. *
  3267. * @private
  3268. * @constructor
  3269. * @param {Array} [entries] The key-value pairs to cache.
  3270. */
  3271. function MapCache(entries) {
  3272. var index = -1,
  3273. length = entries == null ? 0 : entries.length;
  3274. this.clear();
  3275. while (++index < length) {
  3276. var entry = entries[index];
  3277. this.set(entry[0], entry[1]);
  3278. }
  3279. }
  3280. /**
  3281. * Removes all key-value entries from the map.
  3282. *
  3283. * @private
  3284. * @name clear
  3285. * @memberOf MapCache
  3286. */
  3287. function mapCacheClear() {
  3288. this.size = 0;
  3289. this.__data__ = {
  3290. 'hash': new Hash,
  3291. 'map': new (Map || ListCache),
  3292. 'string': new Hash
  3293. };
  3294. }
  3295. /**
  3296. * Removes `key` and its value from the map.
  3297. *
  3298. * @private
  3299. * @name delete
  3300. * @memberOf MapCache
  3301. * @param {string} key The key of the value to remove.
  3302. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3303. */
  3304. function mapCacheDelete(key) {
  3305. var result = getMapData(this, key)['delete'](key);
  3306. this.size -= result ? 1 : 0;
  3307. return result;
  3308. }
  3309. /**
  3310. * Gets the map value for `key`.
  3311. *
  3312. * @private
  3313. * @name get
  3314. * @memberOf MapCache
  3315. * @param {string} key The key of the value to get.
  3316. * @returns {*} Returns the entry value.
  3317. */
  3318. function mapCacheGet(key) {
  3319. return getMapData(this, key).get(key);
  3320. }
  3321. /**
  3322. * Checks if a map value for `key` exists.
  3323. *
  3324. * @private
  3325. * @name has
  3326. * @memberOf MapCache
  3327. * @param {string} key The key of the entry to check.
  3328. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3329. */
  3330. function mapCacheHas(key) {
  3331. return getMapData(this, key).has(key);
  3332. }
  3333. /**
  3334. * Sets the map `key` to `value`.
  3335. *
  3336. * @private
  3337. * @name set
  3338. * @memberOf MapCache
  3339. * @param {string} key The key of the value to set.
  3340. * @param {*} value The value to set.
  3341. * @returns {Object} Returns the map cache instance.
  3342. */
  3343. function mapCacheSet(key, value) {
  3344. var data = getMapData(this, key),
  3345. size = data.size;
  3346. data.set(key, value);
  3347. this.size += data.size == size ? 0 : 1;
  3348. return this;
  3349. }
  3350. // Add methods to `MapCache`.
  3351. MapCache.prototype.clear = mapCacheClear;
  3352. MapCache.prototype['delete'] = mapCacheDelete;
  3353. MapCache.prototype.get = mapCacheGet;
  3354. MapCache.prototype.has = mapCacheHas;
  3355. MapCache.prototype.set = mapCacheSet;
  3356. /*------------------------------------------------------------------------*/
  3357. /**
  3358. *
  3359. * Creates an array cache object to store unique values.
  3360. *
  3361. * @private
  3362. * @constructor
  3363. * @param {Array} [values] The values to cache.
  3364. */
  3365. function SetCache(values) {
  3366. var index = -1,
  3367. length = values == null ? 0 : values.length;
  3368. this.__data__ = new MapCache;
  3369. while (++index < length) {
  3370. this.add(values[index]);
  3371. }
  3372. }
  3373. /**
  3374. * Adds `value` to the array cache.
  3375. *
  3376. * @private
  3377. * @name add
  3378. * @memberOf SetCache
  3379. * @alias push
  3380. * @param {*} value The value to cache.
  3381. * @returns {Object} Returns the cache instance.
  3382. */
  3383. function setCacheAdd(value) {
  3384. this.__data__.set(value, HASH_UNDEFINED);
  3385. return this;
  3386. }
  3387. /**
  3388. * Checks if `value` is in the array cache.
  3389. *
  3390. * @private
  3391. * @name has
  3392. * @memberOf SetCache
  3393. * @param {*} value The value to search for.
  3394. * @returns {number} Returns `true` if `value` is found, else `false`.
  3395. */
  3396. function setCacheHas(value) {
  3397. return this.__data__.has(value);
  3398. }
  3399. // Add methods to `SetCache`.
  3400. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  3401. SetCache.prototype.has = setCacheHas;
  3402. /*------------------------------------------------------------------------*/
  3403. /**
  3404. * Creates a stack cache object to store key-value pairs.
  3405. *
  3406. * @private
  3407. * @constructor
  3408. * @param {Array} [entries] The key-value pairs to cache.
  3409. */
  3410. function Stack(entries) {
  3411. var data = this.__data__ = new ListCache(entries);
  3412. this.size = data.size;
  3413. }
  3414. /**
  3415. * Removes all key-value entries from the stack.
  3416. *
  3417. * @private
  3418. * @name clear
  3419. * @memberOf Stack
  3420. */
  3421. function stackClear() {
  3422. this.__data__ = new ListCache;
  3423. this.size = 0;
  3424. }
  3425. /**
  3426. * Removes `key` and its value from the stack.
  3427. *
  3428. * @private
  3429. * @name delete
  3430. * @memberOf Stack
  3431. * @param {string} key The key of the value to remove.
  3432. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3433. */
  3434. function stackDelete(key) {
  3435. var data = this.__data__,
  3436. result = data['delete'](key);
  3437. this.size = data.size;
  3438. return result;
  3439. }
  3440. /**
  3441. * Gets the stack value for `key`.
  3442. *
  3443. * @private
  3444. * @name get
  3445. * @memberOf Stack
  3446. * @param {string} key The key of the value to get.
  3447. * @returns {*} Returns the entry value.
  3448. */
  3449. function stackGet(key) {
  3450. return this.__data__.get(key);
  3451. }
  3452. /**
  3453. * Checks if a stack value for `key` exists.
  3454. *
  3455. * @private
  3456. * @name has
  3457. * @memberOf Stack
  3458. * @param {string} key The key of the entry to check.
  3459. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3460. */
  3461. function stackHas(key) {
  3462. return this.__data__.has(key);
  3463. }
  3464. /**
  3465. * Sets the stack `key` to `value`.
  3466. *
  3467. * @private
  3468. * @name set
  3469. * @memberOf Stack
  3470. * @param {string} key The key of the value to set.
  3471. * @param {*} value The value to set.
  3472. * @returns {Object} Returns the stack cache instance.
  3473. */
  3474. function stackSet(key, value) {
  3475. var data = this.__data__;
  3476. if (data instanceof ListCache) {
  3477. var pairs = data.__data__;
  3478. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  3479. pairs.push([key, value]);
  3480. this.size = ++data.size;
  3481. return this;
  3482. }
  3483. data = this.__data__ = new MapCache(pairs);
  3484. }
  3485. data.set(key, value);
  3486. this.size = data.size;
  3487. return this;
  3488. }
  3489. // Add methods to `Stack`.
  3490. Stack.prototype.clear = stackClear;
  3491. Stack.prototype['delete'] = stackDelete;
  3492. Stack.prototype.get = stackGet;
  3493. Stack.prototype.has = stackHas;
  3494. Stack.prototype.set = stackSet;
  3495. /*------------------------------------------------------------------------*/
  3496. /**
  3497. * Creates an array of the enumerable property names of the array-like `value`.
  3498. *
  3499. * @private
  3500. * @param {*} value The value to query.
  3501. * @param {boolean} inherited Specify returning inherited property names.
  3502. * @returns {Array} Returns the array of property names.
  3503. */
  3504. function arrayLikeKeys(value, inherited) {
  3505. var isArr = isArray(value),
  3506. isArg = !isArr && isArguments(value),
  3507. isBuff = !isArr && !isArg && isBuffer(value),
  3508. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  3509. skipIndexes = isArr || isArg || isBuff || isType,
  3510. result = skipIndexes ? baseTimes(value.length, String) : [],
  3511. length = result.length;
  3512. for (var key in value) {
  3513. if ((inherited || hasOwnProperty.call(value, key)) &&
  3514. !(skipIndexes && (
  3515. // Safari 9 has enumerable `arguments.length` in strict mode.
  3516. key == 'length' ||
  3517. // Node.js 0.10 has enumerable non-index properties on buffers.
  3518. (isBuff && (key == 'offset' || key == 'parent')) ||
  3519. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  3520. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  3521. // Skip index properties.
  3522. isIndex(key, length)
  3523. ))) {
  3524. result.push(key);
  3525. }
  3526. }
  3527. return result;
  3528. }
  3529. /**
  3530. * A specialized version of `_.sample` for arrays.
  3531. *
  3532. * @private
  3533. * @param {Array} array The array to sample.
  3534. * @returns {*} Returns the random element.
  3535. */
  3536. function arraySample(array) {
  3537. var length = array.length;
  3538. return length ? array[baseRandom(0, length - 1)] : undefined;
  3539. }
  3540. /**
  3541. * A specialized version of `_.sampleSize` for arrays.
  3542. *
  3543. * @private
  3544. * @param {Array} array The array to sample.
  3545. * @param {number} n The number of elements to sample.
  3546. * @returns {Array} Returns the random elements.
  3547. */
  3548. function arraySampleSize(array, n) {
  3549. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  3550. }
  3551. /**
  3552. * A specialized version of `_.shuffle` for arrays.
  3553. *
  3554. * @private
  3555. * @param {Array} array The array to shuffle.
  3556. * @returns {Array} Returns the new shuffled array.
  3557. */
  3558. function arrayShuffle(array) {
  3559. return shuffleSelf(copyArray(array));
  3560. }
  3561. /**
  3562. * This function is like `assignValue` except that it doesn't assign
  3563. * `undefined` values.
  3564. *
  3565. * @private
  3566. * @param {Object} object The object to modify.
  3567. * @param {string} key The key of the property to assign.
  3568. * @param {*} value The value to assign.
  3569. */
  3570. function assignMergeValue(object, key, value) {
  3571. if ((value !== undefined && !eq(object[key], value)) ||
  3572. (value === undefined && !(key in object))) {
  3573. baseAssignValue(object, key, value);
  3574. }
  3575. }
  3576. /**
  3577. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  3578. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  3579. * for equality comparisons.
  3580. *
  3581. * @private
  3582. * @param {Object} object The object to modify.
  3583. * @param {string} key The key of the property to assign.
  3584. * @param {*} value The value to assign.
  3585. */
  3586. function assignValue(object, key, value) {
  3587. var objValue = object[key];
  3588. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  3589. (value === undefined && !(key in object))) {
  3590. baseAssignValue(object, key, value);
  3591. }
  3592. }
  3593. /**
  3594. * Gets the index at which the `key` is found in `array` of key-value pairs.
  3595. *
  3596. * @private
  3597. * @param {Array} array The array to inspect.
  3598. * @param {*} key The key to search for.
  3599. * @returns {number} Returns the index of the matched value, else `-1`.
  3600. */
  3601. function assocIndexOf(array, key) {
  3602. var length = array.length;
  3603. while (length--) {
  3604. if (eq(array[length][0], key)) {
  3605. return length;
  3606. }
  3607. }
  3608. return -1;
  3609. }
  3610. /**
  3611. * Aggregates elements of `collection` on `accumulator` with keys transformed
  3612. * by `iteratee` and values set by `setter`.
  3613. *
  3614. * @private
  3615. * @param {Array|Object} collection The collection to iterate over.
  3616. * @param {Function} setter The function to set `accumulator` values.
  3617. * @param {Function} iteratee The iteratee to transform keys.
  3618. * @param {Object} accumulator The initial aggregated object.
  3619. * @returns {Function} Returns `accumulator`.
  3620. */
  3621. function baseAggregator(collection, setter, iteratee, accumulator) {
  3622. baseEach(collection, function(value, key, collection) {
  3623. setter(accumulator, value, iteratee(value), collection);
  3624. });
  3625. return accumulator;
  3626. }
  3627. /**
  3628. * The base implementation of `_.assign` without support for multiple sources
  3629. * or `customizer` functions.
  3630. *
  3631. * @private
  3632. * @param {Object} object The destination object.
  3633. * @param {Object} source The source object.
  3634. * @returns {Object} Returns `object`.
  3635. */
  3636. function baseAssign(object, source) {
  3637. return object && copyObject(source, keys(source), object);
  3638. }
  3639. /**
  3640. * The base implementation of `_.assignIn` without support for multiple sources
  3641. * or `customizer` functions.
  3642. *
  3643. * @private
  3644. * @param {Object} object The destination object.
  3645. * @param {Object} source The source object.
  3646. * @returns {Object} Returns `object`.
  3647. */
  3648. function baseAssignIn(object, source) {
  3649. return object && copyObject(source, keysIn(source), object);
  3650. }
  3651. /**
  3652. * The base implementation of `assignValue` and `assignMergeValue` without
  3653. * value checks.
  3654. *
  3655. * @private
  3656. * @param {Object} object The object to modify.
  3657. * @param {string} key The key of the property to assign.
  3658. * @param {*} value The value to assign.
  3659. */
  3660. function baseAssignValue(object, key, value) {
  3661. if (key == '__proto__' && defineProperty) {
  3662. defineProperty(object, key, {
  3663. 'configurable': true,
  3664. 'enumerable': true,
  3665. 'value': value,
  3666. 'writable': true
  3667. });
  3668. } else {
  3669. object[key] = value;
  3670. }
  3671. }
  3672. /**
  3673. * The base implementation of `_.at` without support for individual paths.
  3674. *
  3675. * @private
  3676. * @param {Object} object The object to iterate over.
  3677. * @param {string[]} paths The property paths to pick.
  3678. * @returns {Array} Returns the picked elements.
  3679. */
  3680. function baseAt(object, paths) {
  3681. var index = -1,
  3682. length = paths.length,
  3683. result = Array(length),
  3684. skip = object == null;
  3685. while (++index < length) {
  3686. result[index] = skip ? undefined : get(object, paths[index]);
  3687. }
  3688. return result;
  3689. }
  3690. /**
  3691. * The base implementation of `_.clamp` which doesn't coerce arguments.
  3692. *
  3693. * @private
  3694. * @param {number} number The number to clamp.
  3695. * @param {number} [lower] The lower bound.
  3696. * @param {number} upper The upper bound.
  3697. * @returns {number} Returns the clamped number.
  3698. */
  3699. function baseClamp(number, lower, upper) {
  3700. if (number === number) {
  3701. if (upper !== undefined) {
  3702. number = number <= upper ? number : upper;
  3703. }
  3704. if (lower !== undefined) {
  3705. number = number >= lower ? number : lower;
  3706. }
  3707. }
  3708. return number;
  3709. }
  3710. /**
  3711. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  3712. * traversed objects.
  3713. *
  3714. * @private
  3715. * @param {*} value The value to clone.
  3716. * @param {boolean} bitmask The bitmask flags.
  3717. * 1 - Deep clone
  3718. * 2 - Flatten inherited properties
  3719. * 4 - Clone symbols
  3720. * @param {Function} [customizer] The function to customize cloning.
  3721. * @param {string} [key] The key of `value`.
  3722. * @param {Object} [object] The parent object of `value`.
  3723. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  3724. * @returns {*} Returns the cloned value.
  3725. */
  3726. function baseClone(value, bitmask, customizer, key, object, stack) {
  3727. var result,
  3728. isDeep = bitmask & CLONE_DEEP_FLAG,
  3729. isFlat = bitmask & CLONE_FLAT_FLAG,
  3730. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  3731. if (customizer) {
  3732. result = object ? customizer(value, key, object, stack) : customizer(value);
  3733. }
  3734. if (result !== undefined) {
  3735. return result;
  3736. }
  3737. if (!isObject(value)) {
  3738. return value;
  3739. }
  3740. var isArr = isArray(value);
  3741. if (isArr) {
  3742. result = initCloneArray(value);
  3743. if (!isDeep) {
  3744. return copyArray(value, result);
  3745. }
  3746. } else {
  3747. var tag = getTag(value),
  3748. isFunc = tag == funcTag || tag == genTag;
  3749. if (isBuffer(value)) {
  3750. return cloneBuffer(value, isDeep);
  3751. }
  3752. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  3753. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  3754. if (!isDeep) {
  3755. return isFlat
  3756. ? copySymbolsIn(value, baseAssignIn(result, value))
  3757. : copySymbols(value, baseAssign(result, value));
  3758. }
  3759. } else {
  3760. if (!cloneableTags[tag]) {
  3761. return object ? value : {};
  3762. }
  3763. result = initCloneByTag(value, tag, isDeep);
  3764. }
  3765. }
  3766. // Check for circular references and return its corresponding clone.
  3767. stack || (stack = new Stack);
  3768. var stacked = stack.get(value);
  3769. if (stacked) {
  3770. return stacked;
  3771. }
  3772. stack.set(value, result);
  3773. if (isSet(value)) {
  3774. value.forEach(function(subValue) {
  3775. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  3776. });
  3777. } else if (isMap(value)) {
  3778. value.forEach(function(subValue, key) {
  3779. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  3780. });
  3781. }
  3782. var keysFunc = isFull
  3783. ? (isFlat ? getAllKeysIn : getAllKeys)
  3784. : (isFlat ? keysIn : keys);
  3785. var props = isArr ? undefined : keysFunc(value);
  3786. arrayEach(props || value, function(subValue, key) {
  3787. if (props) {
  3788. key = subValue;
  3789. subValue = value[key];
  3790. }
  3791. // Recursively populate clone (susceptible to call stack limits).
  3792. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  3793. });
  3794. return result;
  3795. }
  3796. /**
  3797. * The base implementation of `_.conforms` which doesn't clone `source`.
  3798. *
  3799. * @private
  3800. * @param {Object} source The object of property predicates to conform to.
  3801. * @returns {Function} Returns the new spec function.
  3802. */
  3803. function baseConforms(source) {
  3804. var props = keys(source);
  3805. return function(object) {
  3806. return baseConformsTo(object, source, props);
  3807. };
  3808. }
  3809. /**
  3810. * The base implementation of `_.conformsTo` which accepts `props` to check.
  3811. *
  3812. * @private
  3813. * @param {Object} object The object to inspect.
  3814. * @param {Object} source The object of property predicates to conform to.
  3815. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  3816. */
  3817. function baseConformsTo(object, source, props) {
  3818. var length = props.length;
  3819. if (object == null) {
  3820. return !length;
  3821. }
  3822. object = Object(object);
  3823. while (length--) {
  3824. var key = props[length],
  3825. predicate = source[key],
  3826. value = object[key];
  3827. if ((value === undefined && !(key in object)) || !predicate(value)) {
  3828. return false;
  3829. }
  3830. }
  3831. return true;
  3832. }
  3833. /**
  3834. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  3835. * to provide to `func`.
  3836. *
  3837. * @private
  3838. * @param {Function} func The function to delay.
  3839. * @param {number} wait The number of milliseconds to delay invocation.
  3840. * @param {Array} args The arguments to provide to `func`.
  3841. * @returns {number|Object} Returns the timer id or timeout object.
  3842. */
  3843. function baseDelay(func, wait, args) {
  3844. if (typeof func != 'function') {
  3845. throw new TypeError(FUNC_ERROR_TEXT);
  3846. }
  3847. return setTimeout(function() { func.apply(undefined, args); }, wait);
  3848. }
  3849. /**
  3850. * The base implementation of methods like `_.difference` without support
  3851. * for excluding multiple arrays or iteratee shorthands.
  3852. *
  3853. * @private
  3854. * @param {Array} array The array to inspect.
  3855. * @param {Array} values The values to exclude.
  3856. * @param {Function} [iteratee] The iteratee invoked per element.
  3857. * @param {Function} [comparator] The comparator invoked per element.
  3858. * @returns {Array} Returns the new array of filtered values.
  3859. */
  3860. function baseDifference(array, values, iteratee, comparator) {
  3861. var index = -1,
  3862. includes = arrayIncludes,
  3863. isCommon = true,
  3864. length = array.length,
  3865. result = [],
  3866. valuesLength = values.length;
  3867. if (!length) {
  3868. return result;
  3869. }
  3870. if (iteratee) {
  3871. values = arrayMap(values, baseUnary(iteratee));
  3872. }
  3873. if (comparator) {
  3874. includes = arrayIncludesWith;
  3875. isCommon = false;
  3876. }
  3877. else if (values.length >= LARGE_ARRAY_SIZE) {
  3878. includes = cacheHas;
  3879. isCommon = false;
  3880. values = new SetCache(values);
  3881. }
  3882. outer:
  3883. while (++index < length) {
  3884. var value = array[index],
  3885. computed = iteratee == null ? value : iteratee(value);
  3886. value = (comparator || value !== 0) ? value : 0;
  3887. if (isCommon && computed === computed) {
  3888. var valuesIndex = valuesLength;
  3889. while (valuesIndex--) {
  3890. if (values[valuesIndex] === computed) {
  3891. continue outer;
  3892. }
  3893. }
  3894. result.push(value);
  3895. }
  3896. else if (!includes(values, computed, comparator)) {
  3897. result.push(value);
  3898. }
  3899. }
  3900. return result;
  3901. }
  3902. /**
  3903. * The base implementation of `_.forEach` without support for iteratee shorthands.
  3904. *
  3905. * @private
  3906. * @param {Array|Object} collection The collection to iterate over.
  3907. * @param {Function} iteratee The function invoked per iteration.
  3908. * @returns {Array|Object} Returns `collection`.
  3909. */
  3910. var baseEach = createBaseEach(baseForOwn);
  3911. /**
  3912. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  3913. *
  3914. * @private
  3915. * @param {Array|Object} collection The collection to iterate over.
  3916. * @param {Function} iteratee The function invoked per iteration.
  3917. * @returns {Array|Object} Returns `collection`.
  3918. */
  3919. var baseEachRight = createBaseEach(baseForOwnRight, true);
  3920. /**
  3921. * The base implementation of `_.every` without support for iteratee shorthands.
  3922. *
  3923. * @private
  3924. * @param {Array|Object} collection The collection to iterate over.
  3925. * @param {Function} predicate The function invoked per iteration.
  3926. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  3927. * else `false`
  3928. */
  3929. function baseEvery(collection, predicate) {
  3930. var result = true;
  3931. baseEach(collection, function(value, index, collection) {
  3932. result = !!predicate(value, index, collection);
  3933. return result;
  3934. });
  3935. return result;
  3936. }
  3937. /**
  3938. * The base implementation of methods like `_.max` and `_.min` which accepts a
  3939. * `comparator` to determine the extremum value.
  3940. *
  3941. * @private
  3942. * @param {Array} array The array to iterate over.
  3943. * @param {Function} iteratee The iteratee invoked per iteration.
  3944. * @param {Function} comparator The comparator used to compare values.
  3945. * @returns {*} Returns the extremum value.
  3946. */
  3947. function baseExtremum(array, iteratee, comparator) {
  3948. var index = -1,
  3949. length = array.length;
  3950. while (++index < length) {
  3951. var value = array[index],
  3952. current = iteratee(value);
  3953. if (current != null && (computed === undefined
  3954. ? (current === current && !isSymbol(current))
  3955. : comparator(current, computed)
  3956. )) {
  3957. var computed = current,
  3958. result = value;
  3959. }
  3960. }
  3961. return result;
  3962. }
  3963. /**
  3964. * The base implementation of `_.fill` without an iteratee call guard.
  3965. *
  3966. * @private
  3967. * @param {Array} array The array to fill.
  3968. * @param {*} value The value to fill `array` with.
  3969. * @param {number} [start=0] The start position.
  3970. * @param {number} [end=array.length] The end position.
  3971. * @returns {Array} Returns `array`.
  3972. */
  3973. function baseFill(array, value, start, end) {
  3974. var length = array.length;
  3975. start = toInteger(start);
  3976. if (start < 0) {
  3977. start = -start > length ? 0 : (length + start);
  3978. }
  3979. end = (end === undefined || end > length) ? length : toInteger(end);
  3980. if (end < 0) {
  3981. end += length;
  3982. }
  3983. end = start > end ? 0 : toLength(end);
  3984. while (start < end) {
  3985. array[start++] = value;
  3986. }
  3987. return array;
  3988. }
  3989. /**
  3990. * The base implementation of `_.filter` without support for iteratee shorthands.
  3991. *
  3992. * @private
  3993. * @param {Array|Object} collection The collection to iterate over.
  3994. * @param {Function} predicate The function invoked per iteration.
  3995. * @returns {Array} Returns the new filtered array.
  3996. */
  3997. function baseFilter(collection, predicate) {
  3998. var result = [];
  3999. baseEach(collection, function(value, index, collection) {
  4000. if (predicate(value, index, collection)) {
  4001. result.push(value);
  4002. }
  4003. });
  4004. return result;
  4005. }
  4006. /**
  4007. * The base implementation of `_.flatten` with support for restricting flattening.
  4008. *
  4009. * @private
  4010. * @param {Array} array The array to flatten.
  4011. * @param {number} depth The maximum recursion depth.
  4012. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  4013. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  4014. * @param {Array} [result=[]] The initial result value.
  4015. * @returns {Array} Returns the new flattened array.
  4016. */
  4017. function baseFlatten(array, depth, predicate, isStrict, result) {
  4018. var index = -1,
  4019. length = array.length;
  4020. predicate || (predicate = isFlattenable);
  4021. result || (result = []);
  4022. while (++index < length) {
  4023. var value = array[index];
  4024. if (depth > 0 && predicate(value)) {
  4025. if (depth > 1) {
  4026. // Recursively flatten arrays (susceptible to call stack limits).
  4027. baseFlatten(value, depth - 1, predicate, isStrict, result);
  4028. } else {
  4029. arrayPush(result, value);
  4030. }
  4031. } else if (!isStrict) {
  4032. result[result.length] = value;
  4033. }
  4034. }
  4035. return result;
  4036. }
  4037. /**
  4038. * The base implementation of `baseForOwn` which iterates over `object`
  4039. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  4040. * Iteratee functions may exit iteration early by explicitly returning `false`.
  4041. *
  4042. * @private
  4043. * @param {Object} object The object to iterate over.
  4044. * @param {Function} iteratee The function invoked per iteration.
  4045. * @param {Function} keysFunc The function to get the keys of `object`.
  4046. * @returns {Object} Returns `object`.
  4047. */
  4048. var baseFor = createBaseFor();
  4049. /**
  4050. * This function is like `baseFor` except that it iterates over properties
  4051. * in the opposite order.
  4052. *
  4053. * @private
  4054. * @param {Object} object The object to iterate over.
  4055. * @param {Function} iteratee The function invoked per iteration.
  4056. * @param {Function} keysFunc The function to get the keys of `object`.
  4057. * @returns {Object} Returns `object`.
  4058. */
  4059. var baseForRight = createBaseFor(true);
  4060. /**
  4061. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  4062. *
  4063. * @private
  4064. * @param {Object} object The object to iterate over.
  4065. * @param {Function} iteratee The function invoked per iteration.
  4066. * @returns {Object} Returns `object`.
  4067. */
  4068. function baseForOwn(object, iteratee) {
  4069. return object && baseFor(object, iteratee, keys);
  4070. }
  4071. /**
  4072. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  4073. *
  4074. * @private
  4075. * @param {Object} object The object to iterate over.
  4076. * @param {Function} iteratee The function invoked per iteration.
  4077. * @returns {Object} Returns `object`.
  4078. */
  4079. function baseForOwnRight(object, iteratee) {
  4080. return object && baseForRight(object, iteratee, keys);
  4081. }
  4082. /**
  4083. * The base implementation of `_.functions` which creates an array of
  4084. * `object` function property names filtered from `props`.
  4085. *
  4086. * @private
  4087. * @param {Object} object The object to inspect.
  4088. * @param {Array} props The property names to filter.
  4089. * @returns {Array} Returns the function names.
  4090. */
  4091. function baseFunctions(object, props) {
  4092. return arrayFilter(props, function(key) {
  4093. return isFunction(object[key]);
  4094. });
  4095. }
  4096. /**
  4097. * The base implementation of `_.get` without support for default values.
  4098. *
  4099. * @private
  4100. * @param {Object} object The object to query.
  4101. * @param {Array|string} path The path of the property to get.
  4102. * @returns {*} Returns the resolved value.
  4103. */
  4104. function baseGet(object, path) {
  4105. path = castPath(path, object);
  4106. var index = 0,
  4107. length = path.length;
  4108. while (object != null && index < length) {
  4109. object = object[toKey(path[index++])];
  4110. }
  4111. return (index && index == length) ? object : undefined;
  4112. }
  4113. /**
  4114. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  4115. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  4116. * symbols of `object`.
  4117. *
  4118. * @private
  4119. * @param {Object} object The object to query.
  4120. * @param {Function} keysFunc The function to get the keys of `object`.
  4121. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  4122. * @returns {Array} Returns the array of property names and symbols.
  4123. */
  4124. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  4125. var result = keysFunc(object);
  4126. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  4127. }
  4128. /**
  4129. * The base implementation of `getTag` without fallbacks for buggy environments.
  4130. *
  4131. * @private
  4132. * @param {*} value The value to query.
  4133. * @returns {string} Returns the `toStringTag`.
  4134. */
  4135. function baseGetTag(value) {
  4136. if (value == null) {
  4137. return value === undefined ? undefinedTag : nullTag;
  4138. }
  4139. return (symToStringTag && symToStringTag in Object(value))
  4140. ? getRawTag(value)
  4141. : objectToString(value);
  4142. }
  4143. /**
  4144. * The base implementation of `_.gt` which doesn't coerce arguments.
  4145. *
  4146. * @private
  4147. * @param {*} value The value to compare.
  4148. * @param {*} other The other value to compare.
  4149. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  4150. * else `false`.
  4151. */
  4152. function baseGt(value, other) {
  4153. return value > other;
  4154. }
  4155. /**
  4156. * The base implementation of `_.has` without support for deep paths.
  4157. *
  4158. * @private
  4159. * @param {Object} [object] The object to query.
  4160. * @param {Array|string} key The key to check.
  4161. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  4162. */
  4163. function baseHas(object, key) {
  4164. return object != null && hasOwnProperty.call(object, key);
  4165. }
  4166. /**
  4167. * The base implementation of `_.hasIn` without support for deep paths.
  4168. *
  4169. * @private
  4170. * @param {Object} [object] The object to query.
  4171. * @param {Array|string} key The key to check.
  4172. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  4173. */
  4174. function baseHasIn(object, key) {
  4175. return object != null && key in Object(object);
  4176. }
  4177. /**
  4178. * The base implementation of `_.inRange` which doesn't coerce arguments.
  4179. *
  4180. * @private
  4181. * @param {number} number The number to check.
  4182. * @param {number} start The start of the range.
  4183. * @param {number} end The end of the range.
  4184. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  4185. */
  4186. function baseInRange(number, start, end) {
  4187. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  4188. }
  4189. /**
  4190. * The base implementation of methods like `_.intersection`, without support
  4191. * for iteratee shorthands, that accepts an array of arrays to inspect.
  4192. *
  4193. * @private
  4194. * @param {Array} arrays The arrays to inspect.
  4195. * @param {Function} [iteratee] The iteratee invoked per element.
  4196. * @param {Function} [comparator] The comparator invoked per element.
  4197. * @returns {Array} Returns the new array of shared values.
  4198. */
  4199. function baseIntersection(arrays, iteratee, comparator) {
  4200. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  4201. length = arrays[0].length,
  4202. othLength = arrays.length,
  4203. othIndex = othLength,
  4204. caches = Array(othLength),
  4205. maxLength = Infinity,
  4206. result = [];
  4207. while (othIndex--) {
  4208. var array = arrays[othIndex];
  4209. if (othIndex && iteratee) {
  4210. array = arrayMap(array, baseUnary(iteratee));
  4211. }
  4212. maxLength = nativeMin(array.length, maxLength);
  4213. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  4214. ? new SetCache(othIndex && array)
  4215. : undefined;
  4216. }
  4217. array = arrays[0];
  4218. var index = -1,
  4219. seen = caches[0];
  4220. outer:
  4221. while (++index < length && result.length < maxLength) {
  4222. var value = array[index],
  4223. computed = iteratee ? iteratee(value) : value;
  4224. value = (comparator || value !== 0) ? value : 0;
  4225. if (!(seen
  4226. ? cacheHas(seen, computed)
  4227. : includes(result, computed, comparator)
  4228. )) {
  4229. othIndex = othLength;
  4230. while (--othIndex) {
  4231. var cache = caches[othIndex];
  4232. if (!(cache
  4233. ? cacheHas(cache, computed)
  4234. : includes(arrays[othIndex], computed, comparator))
  4235. ) {
  4236. continue outer;
  4237. }
  4238. }
  4239. if (seen) {
  4240. seen.push(computed);
  4241. }
  4242. result.push(value);
  4243. }
  4244. }
  4245. return result;
  4246. }
  4247. /**
  4248. * The base implementation of `_.invert` and `_.invertBy` which inverts
  4249. * `object` with values transformed by `iteratee` and set by `setter`.
  4250. *
  4251. * @private
  4252. * @param {Object} object The object to iterate over.
  4253. * @param {Function} setter The function to set `accumulator` values.
  4254. * @param {Function} iteratee The iteratee to transform values.
  4255. * @param {Object} accumulator The initial inverted object.
  4256. * @returns {Function} Returns `accumulator`.
  4257. */
  4258. function baseInverter(object, setter, iteratee, accumulator) {
  4259. baseForOwn(object, function(value, key, object) {
  4260. setter(accumulator, iteratee(value), key, object);
  4261. });
  4262. return accumulator;
  4263. }
  4264. /**
  4265. * The base implementation of `_.invoke` without support for individual
  4266. * method arguments.
  4267. *
  4268. * @private
  4269. * @param {Object} object The object to query.
  4270. * @param {Array|string} path The path of the method to invoke.
  4271. * @param {Array} args The arguments to invoke the method with.
  4272. * @returns {*} Returns the result of the invoked method.
  4273. */
  4274. function baseInvoke(object, path, args) {
  4275. path = castPath(path, object);
  4276. object = parent(object, path);
  4277. var func = object == null ? object : object[toKey(last(path))];
  4278. return func == null ? undefined : apply(func, object, args);
  4279. }
  4280. /**
  4281. * The base implementation of `_.isArguments`.
  4282. *
  4283. * @private
  4284. * @param {*} value The value to check.
  4285. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  4286. */
  4287. function baseIsArguments(value) {
  4288. return isObjectLike(value) && baseGetTag(value) == argsTag;
  4289. }
  4290. /**
  4291. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  4292. *
  4293. * @private
  4294. * @param {*} value The value to check.
  4295. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  4296. */
  4297. function baseIsArrayBuffer(value) {
  4298. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  4299. }
  4300. /**
  4301. * The base implementation of `_.isDate` without Node.js optimizations.
  4302. *
  4303. * @private
  4304. * @param {*} value The value to check.
  4305. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  4306. */
  4307. function baseIsDate(value) {
  4308. return isObjectLike(value) && baseGetTag(value) == dateTag;
  4309. }
  4310. /**
  4311. * The base implementation of `_.isEqual` which supports partial comparisons
  4312. * and tracks traversed objects.
  4313. *
  4314. * @private
  4315. * @param {*} value The value to compare.
  4316. * @param {*} other The other value to compare.
  4317. * @param {boolean} bitmask The bitmask flags.
  4318. * 1 - Unordered comparison
  4319. * 2 - Partial comparison
  4320. * @param {Function} [customizer] The function to customize comparisons.
  4321. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  4322. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  4323. */
  4324. function baseIsEqual(value, other, bitmask, customizer, stack) {
  4325. if (value === other) {
  4326. return true;
  4327. }
  4328. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  4329. return value !== value && other !== other;
  4330. }
  4331. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  4332. }
  4333. /**
  4334. * A specialized version of `baseIsEqual` for arrays and objects which performs
  4335. * deep comparisons and tracks traversed objects enabling objects with circular
  4336. * references to be compared.
  4337. *
  4338. * @private
  4339. * @param {Object} object The object to compare.
  4340. * @param {Object} other The other object to compare.
  4341. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  4342. * @param {Function} customizer The function to customize comparisons.
  4343. * @param {Function} equalFunc The function to determine equivalents of values.
  4344. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  4345. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  4346. */
  4347. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  4348. var objIsArr = isArray(object),
  4349. othIsArr = isArray(other),
  4350. objTag = objIsArr ? arrayTag : getTag(object),
  4351. othTag = othIsArr ? arrayTag : getTag(other);
  4352. objTag = objTag == argsTag ? objectTag : objTag;
  4353. othTag = othTag == argsTag ? objectTag : othTag;
  4354. var objIsObj = objTag == objectTag,
  4355. othIsObj = othTag == objectTag,
  4356. isSameTag = objTag == othTag;
  4357. if (isSameTag && isBuffer(object)) {
  4358. if (!isBuffer(other)) {
  4359. return false;
  4360. }
  4361. objIsArr = true;
  4362. objIsObj = false;
  4363. }
  4364. if (isSameTag && !objIsObj) {
  4365. stack || (stack = new Stack);
  4366. return (objIsArr || isTypedArray(object))
  4367. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  4368. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  4369. }
  4370. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  4371. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  4372. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  4373. if (objIsWrapped || othIsWrapped) {
  4374. var objUnwrapped = objIsWrapped ? object.value() : object,
  4375. othUnwrapped = othIsWrapped ? other.value() : other;
  4376. stack || (stack = new Stack);
  4377. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  4378. }
  4379. }
  4380. if (!isSameTag) {
  4381. return false;
  4382. }
  4383. stack || (stack = new Stack);
  4384. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  4385. }
  4386. /**
  4387. * The base implementation of `_.isMap` without Node.js optimizations.
  4388. *
  4389. * @private
  4390. * @param {*} value The value to check.
  4391. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  4392. */
  4393. function baseIsMap(value) {
  4394. return isObjectLike(value) && getTag(value) == mapTag;
  4395. }
  4396. /**
  4397. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  4398. *
  4399. * @private
  4400. * @param {Object} object The object to inspect.
  4401. * @param {Object} source The object of property values to match.
  4402. * @param {Array} matchData The property names, values, and compare flags to match.
  4403. * @param {Function} [customizer] The function to customize comparisons.
  4404. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  4405. */
  4406. function baseIsMatch(object, source, matchData, customizer) {
  4407. var index = matchData.length,
  4408. length = index,
  4409. noCustomizer = !customizer;
  4410. if (object == null) {
  4411. return !length;
  4412. }
  4413. object = Object(object);
  4414. while (index--) {
  4415. var data = matchData[index];
  4416. if ((noCustomizer && data[2])
  4417. ? data[1] !== object[data[0]]
  4418. : !(data[0] in object)
  4419. ) {
  4420. return false;
  4421. }
  4422. }
  4423. while (++index < length) {
  4424. data = matchData[index];
  4425. var key = data[0],
  4426. objValue = object[key],
  4427. srcValue = data[1];
  4428. if (noCustomizer && data[2]) {
  4429. if (objValue === undefined && !(key in object)) {
  4430. return false;
  4431. }
  4432. } else {
  4433. var stack = new Stack;
  4434. if (customizer) {
  4435. var result = customizer(objValue, srcValue, key, object, source, stack);
  4436. }
  4437. if (!(result === undefined
  4438. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  4439. : result
  4440. )) {
  4441. return false;
  4442. }
  4443. }
  4444. }
  4445. return true;
  4446. }
  4447. /**
  4448. * The base implementation of `_.isNative` without bad shim checks.
  4449. *
  4450. * @private
  4451. * @param {*} value The value to check.
  4452. * @returns {boolean} Returns `true` if `value` is a native function,
  4453. * else `false`.
  4454. */
  4455. function baseIsNative(value) {
  4456. if (!isObject(value) || isMasked(value)) {
  4457. return false;
  4458. }
  4459. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  4460. return pattern.test(toSource(value));
  4461. }
  4462. /**
  4463. * The base implementation of `_.isRegExp` without Node.js optimizations.
  4464. *
  4465. * @private
  4466. * @param {*} value The value to check.
  4467. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  4468. */
  4469. function baseIsRegExp(value) {
  4470. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  4471. }
  4472. /**
  4473. * The base implementation of `_.isSet` without Node.js optimizations.
  4474. *
  4475. * @private
  4476. * @param {*} value The value to check.
  4477. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  4478. */
  4479. function baseIsSet(value) {
  4480. return isObjectLike(value) && getTag(value) == setTag;
  4481. }
  4482. /**
  4483. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  4484. *
  4485. * @private
  4486. * @param {*} value The value to check.
  4487. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  4488. */
  4489. function baseIsTypedArray(value) {
  4490. return isObjectLike(value) &&
  4491. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  4492. }
  4493. /**
  4494. * The base implementation of `_.iteratee`.
  4495. *
  4496. * @private
  4497. * @param {*} [value=_.identity] The value to convert to an iteratee.
  4498. * @returns {Function} Returns the iteratee.
  4499. */
  4500. function baseIteratee(value) {
  4501. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  4502. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  4503. if (typeof value == 'function') {
  4504. return value;
  4505. }
  4506. if (value == null) {
  4507. return identity;
  4508. }
  4509. if (typeof value == 'object') {
  4510. return isArray(value)
  4511. ? baseMatchesProperty(value[0], value[1])
  4512. : baseMatches(value);
  4513. }
  4514. return property(value);
  4515. }
  4516. /**
  4517. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  4518. *
  4519. * @private
  4520. * @param {Object} object The object to query.
  4521. * @returns {Array} Returns the array of property names.
  4522. */
  4523. function baseKeys(object) {
  4524. if (!isPrototype(object)) {
  4525. return nativeKeys(object);
  4526. }
  4527. var result = [];
  4528. for (var key in Object(object)) {
  4529. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  4530. result.push(key);
  4531. }
  4532. }
  4533. return result;
  4534. }
  4535. /**
  4536. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  4537. *
  4538. * @private
  4539. * @param {Object} object The object to query.
  4540. * @returns {Array} Returns the array of property names.
  4541. */
  4542. function baseKeysIn(object) {
  4543. if (!isObject(object)) {
  4544. return nativeKeysIn(object);
  4545. }
  4546. var isProto = isPrototype(object),
  4547. result = [];
  4548. for (var key in object) {
  4549. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  4550. result.push(key);
  4551. }
  4552. }
  4553. return result;
  4554. }
  4555. /**
  4556. * The base implementation of `_.lt` which doesn't coerce arguments.
  4557. *
  4558. * @private
  4559. * @param {*} value The value to compare.
  4560. * @param {*} other The other value to compare.
  4561. * @returns {boolean} Returns `true` if `value` is less than `other`,
  4562. * else `false`.
  4563. */
  4564. function baseLt(value, other) {
  4565. return value < other;
  4566. }
  4567. /**
  4568. * The base implementation of `_.map` without support for iteratee shorthands.
  4569. *
  4570. * @private
  4571. * @param {Array|Object} collection The collection to iterate over.
  4572. * @param {Function} iteratee The function invoked per iteration.
  4573. * @returns {Array} Returns the new mapped array.
  4574. */
  4575. function baseMap(collection, iteratee) {
  4576. var index = -1,
  4577. result = isArrayLike(collection) ? Array(collection.length) : [];
  4578. baseEach(collection, function(value, key, collection) {
  4579. result[++index] = iteratee(value, key, collection);
  4580. });
  4581. return result;
  4582. }
  4583. /**
  4584. * The base implementation of `_.matches` which doesn't clone `source`.
  4585. *
  4586. * @private
  4587. * @param {Object} source The object of property values to match.
  4588. * @returns {Function} Returns the new spec function.
  4589. */
  4590. function baseMatches(source) {
  4591. var matchData = getMatchData(source);
  4592. if (matchData.length == 1 && matchData[0][2]) {
  4593. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  4594. }
  4595. return function(object) {
  4596. return object === source || baseIsMatch(object, source, matchData);
  4597. };
  4598. }
  4599. /**
  4600. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  4601. *
  4602. * @private
  4603. * @param {string} path The path of the property to get.
  4604. * @param {*} srcValue The value to match.
  4605. * @returns {Function} Returns the new spec function.
  4606. */
  4607. function baseMatchesProperty(path, srcValue) {
  4608. if (isKey(path) && isStrictComparable(srcValue)) {
  4609. return matchesStrictComparable(toKey(path), srcValue);
  4610. }
  4611. return function(object) {
  4612. var objValue = get(object, path);
  4613. return (objValue === undefined && objValue === srcValue)
  4614. ? hasIn(object, path)
  4615. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  4616. };
  4617. }
  4618. /**
  4619. * The base implementation of `_.merge` without support for multiple sources.
  4620. *
  4621. * @private
  4622. * @param {Object} object The destination object.
  4623. * @param {Object} source The source object.
  4624. * @param {number} srcIndex The index of `source`.
  4625. * @param {Function} [customizer] The function to customize merged values.
  4626. * @param {Object} [stack] Tracks traversed source values and their merged
  4627. * counterparts.
  4628. */
  4629. function baseMerge(object, source, srcIndex, customizer, stack) {
  4630. if (object === source) {
  4631. return;
  4632. }
  4633. baseFor(source, function(srcValue, key) {
  4634. stack || (stack = new Stack);
  4635. if (isObject(srcValue)) {
  4636. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  4637. }
  4638. else {
  4639. var newValue = customizer
  4640. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  4641. : undefined;
  4642. if (newValue === undefined) {
  4643. newValue = srcValue;
  4644. }
  4645. assignMergeValue(object, key, newValue);
  4646. }
  4647. }, keysIn);
  4648. }
  4649. /**
  4650. * A specialized version of `baseMerge` for arrays and objects which performs
  4651. * deep merges and tracks traversed objects enabling objects with circular
  4652. * references to be merged.
  4653. *
  4654. * @private
  4655. * @param {Object} object The destination object.
  4656. * @param {Object} source The source object.
  4657. * @param {string} key The key of the value to merge.
  4658. * @param {number} srcIndex The index of `source`.
  4659. * @param {Function} mergeFunc The function to merge values.
  4660. * @param {Function} [customizer] The function to customize assigned values.
  4661. * @param {Object} [stack] Tracks traversed source values and their merged
  4662. * counterparts.
  4663. */
  4664. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  4665. var objValue = safeGet(object, key),
  4666. srcValue = safeGet(source, key),
  4667. stacked = stack.get(srcValue);
  4668. if (stacked) {
  4669. assignMergeValue(object, key, stacked);
  4670. return;
  4671. }
  4672. var newValue = customizer
  4673. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  4674. : undefined;
  4675. var isCommon = newValue === undefined;
  4676. if (isCommon) {
  4677. var isArr = isArray(srcValue),
  4678. isBuff = !isArr && isBuffer(srcValue),
  4679. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  4680. newValue = srcValue;
  4681. if (isArr || isBuff || isTyped) {
  4682. if (isArray(objValue)) {
  4683. newValue = objValue;
  4684. }
  4685. else if (isArrayLikeObject(objValue)) {
  4686. newValue = copyArray(objValue);
  4687. }
  4688. else if (isBuff) {
  4689. isCommon = false;
  4690. newValue = cloneBuffer(srcValue, true);
  4691. }
  4692. else if (isTyped) {
  4693. isCommon = false;
  4694. newValue = cloneTypedArray(srcValue, true);
  4695. }
  4696. else {
  4697. newValue = [];
  4698. }
  4699. }
  4700. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  4701. newValue = objValue;
  4702. if (isArguments(objValue)) {
  4703. newValue = toPlainObject(objValue);
  4704. }
  4705. else if (!isObject(objValue) || isFunction(objValue)) {
  4706. newValue = initCloneObject(srcValue);
  4707. }
  4708. }
  4709. else {
  4710. isCommon = false;
  4711. }
  4712. }
  4713. if (isCommon) {
  4714. // Recursively merge objects and arrays (susceptible to call stack limits).
  4715. stack.set(srcValue, newValue);
  4716. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  4717. stack['delete'](srcValue);
  4718. }
  4719. assignMergeValue(object, key, newValue);
  4720. }
  4721. /**
  4722. * The base implementation of `_.nth` which doesn't coerce arguments.
  4723. *
  4724. * @private
  4725. * @param {Array} array The array to query.
  4726. * @param {number} n The index of the element to return.
  4727. * @returns {*} Returns the nth element of `array`.
  4728. */
  4729. function baseNth(array, n) {
  4730. var length = array.length;
  4731. if (!length) {
  4732. return;
  4733. }
  4734. n += n < 0 ? length : 0;
  4735. return isIndex(n, length) ? array[n] : undefined;
  4736. }
  4737. /**
  4738. * The base implementation of `_.orderBy` without param guards.
  4739. *
  4740. * @private
  4741. * @param {Array|Object} collection The collection to iterate over.
  4742. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  4743. * @param {string[]} orders The sort orders of `iteratees`.
  4744. * @returns {Array} Returns the new sorted array.
  4745. */
  4746. function baseOrderBy(collection, iteratees, orders) {
  4747. if (iteratees.length) {
  4748. iteratees = arrayMap(iteratees, function(iteratee) {
  4749. if (isArray(iteratee)) {
  4750. return function(value) {
  4751. return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
  4752. }
  4753. }
  4754. return iteratee;
  4755. });
  4756. } else {
  4757. iteratees = [identity];
  4758. }
  4759. var index = -1;
  4760. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  4761. var result = baseMap(collection, function(value, key, collection) {
  4762. var criteria = arrayMap(iteratees, function(iteratee) {
  4763. return iteratee(value);
  4764. });
  4765. return { 'criteria': criteria, 'index': ++index, 'value': value };
  4766. });
  4767. return baseSortBy(result, function(object, other) {
  4768. return compareMultiple(object, other, orders);
  4769. });
  4770. }
  4771. /**
  4772. * The base implementation of `_.pick` without support for individual
  4773. * property identifiers.
  4774. *
  4775. * @private
  4776. * @param {Object} object The source object.
  4777. * @param {string[]} paths The property paths to pick.
  4778. * @returns {Object} Returns the new object.
  4779. */
  4780. function basePick(object, paths) {
  4781. return basePickBy(object, paths, function(value, path) {
  4782. return hasIn(object, path);
  4783. });
  4784. }
  4785. /**
  4786. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  4787. *
  4788. * @private
  4789. * @param {Object} object The source object.
  4790. * @param {string[]} paths The property paths to pick.
  4791. * @param {Function} predicate The function invoked per property.
  4792. * @returns {Object} Returns the new object.
  4793. */
  4794. function basePickBy(object, paths, predicate) {
  4795. var index = -1,
  4796. length = paths.length,
  4797. result = {};
  4798. while (++index < length) {
  4799. var path = paths[index],
  4800. value = baseGet(object, path);
  4801. if (predicate(value, path)) {
  4802. baseSet(result, castPath(path, object), value);
  4803. }
  4804. }
  4805. return result;
  4806. }
  4807. /**
  4808. * A specialized version of `baseProperty` which supports deep paths.
  4809. *
  4810. * @private
  4811. * @param {Array|string} path The path of the property to get.
  4812. * @returns {Function} Returns the new accessor function.
  4813. */
  4814. function basePropertyDeep(path) {
  4815. return function(object) {
  4816. return baseGet(object, path);
  4817. };
  4818. }
  4819. /**
  4820. * The base implementation of `_.pullAllBy` without support for iteratee
  4821. * shorthands.
  4822. *
  4823. * @private
  4824. * @param {Array} array The array to modify.
  4825. * @param {Array} values The values to remove.
  4826. * @param {Function} [iteratee] The iteratee invoked per element.
  4827. * @param {Function} [comparator] The comparator invoked per element.
  4828. * @returns {Array} Returns `array`.
  4829. */
  4830. function basePullAll(array, values, iteratee, comparator) {
  4831. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  4832. index = -1,
  4833. length = values.length,
  4834. seen = array;
  4835. if (array === values) {
  4836. values = copyArray(values);
  4837. }
  4838. if (iteratee) {
  4839. seen = arrayMap(array, baseUnary(iteratee));
  4840. }
  4841. while (++index < length) {
  4842. var fromIndex = 0,
  4843. value = values[index],
  4844. computed = iteratee ? iteratee(value) : value;
  4845. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  4846. if (seen !== array) {
  4847. splice.call(seen, fromIndex, 1);
  4848. }
  4849. splice.call(array, fromIndex, 1);
  4850. }
  4851. }
  4852. return array;
  4853. }
  4854. /**
  4855. * The base implementation of `_.pullAt` without support for individual
  4856. * indexes or capturing the removed elements.
  4857. *
  4858. * @private
  4859. * @param {Array} array The array to modify.
  4860. * @param {number[]} indexes The indexes of elements to remove.
  4861. * @returns {Array} Returns `array`.
  4862. */
  4863. function basePullAt(array, indexes) {
  4864. var length = array ? indexes.length : 0,
  4865. lastIndex = length - 1;
  4866. while (length--) {
  4867. var index = indexes[length];
  4868. if (length == lastIndex || index !== previous) {
  4869. var previous = index;
  4870. if (isIndex(index)) {
  4871. splice.call(array, index, 1);
  4872. } else {
  4873. baseUnset(array, index);
  4874. }
  4875. }
  4876. }
  4877. return array;
  4878. }
  4879. /**
  4880. * The base implementation of `_.random` without support for returning
  4881. * floating-point numbers.
  4882. *
  4883. * @private
  4884. * @param {number} lower The lower bound.
  4885. * @param {number} upper The upper bound.
  4886. * @returns {number} Returns the random number.
  4887. */
  4888. function baseRandom(lower, upper) {
  4889. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  4890. }
  4891. /**
  4892. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  4893. * coerce arguments.
  4894. *
  4895. * @private
  4896. * @param {number} start The start of the range.
  4897. * @param {number} end The end of the range.
  4898. * @param {number} step The value to increment or decrement by.
  4899. * @param {boolean} [fromRight] Specify iterating from right to left.
  4900. * @returns {Array} Returns the range of numbers.
  4901. */
  4902. function baseRange(start, end, step, fromRight) {
  4903. var index = -1,
  4904. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  4905. result = Array(length);
  4906. while (length--) {
  4907. result[fromRight ? length : ++index] = start;
  4908. start += step;
  4909. }
  4910. return result;
  4911. }
  4912. /**
  4913. * The base implementation of `_.repeat` which doesn't coerce arguments.
  4914. *
  4915. * @private
  4916. * @param {string} string The string to repeat.
  4917. * @param {number} n The number of times to repeat the string.
  4918. * @returns {string} Returns the repeated string.
  4919. */
  4920. function baseRepeat(string, n) {
  4921. var result = '';
  4922. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  4923. return result;
  4924. }
  4925. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  4926. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  4927. do {
  4928. if (n % 2) {
  4929. result += string;
  4930. }
  4931. n = nativeFloor(n / 2);
  4932. if (n) {
  4933. string += string;
  4934. }
  4935. } while (n);
  4936. return result;
  4937. }
  4938. /**
  4939. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  4940. *
  4941. * @private
  4942. * @param {Function} func The function to apply a rest parameter to.
  4943. * @param {number} [start=func.length-1] The start position of the rest parameter.
  4944. * @returns {Function} Returns the new function.
  4945. */
  4946. function baseRest(func, start) {
  4947. return setToString(overRest(func, start, identity), func + '');
  4948. }
  4949. /**
  4950. * The base implementation of `_.sample`.
  4951. *
  4952. * @private
  4953. * @param {Array|Object} collection The collection to sample.
  4954. * @returns {*} Returns the random element.
  4955. */
  4956. function baseSample(collection) {
  4957. return arraySample(values(collection));
  4958. }
  4959. /**
  4960. * The base implementation of `_.sampleSize` without param guards.
  4961. *
  4962. * @private
  4963. * @param {Array|Object} collection The collection to sample.
  4964. * @param {number} n The number of elements to sample.
  4965. * @returns {Array} Returns the random elements.
  4966. */
  4967. function baseSampleSize(collection, n) {
  4968. var array = values(collection);
  4969. return shuffleSelf(array, baseClamp(n, 0, array.length));
  4970. }
  4971. /**
  4972. * The base implementation of `_.set`.
  4973. *
  4974. * @private
  4975. * @param {Object} object The object to modify.
  4976. * @param {Array|string} path The path of the property to set.
  4977. * @param {*} value The value to set.
  4978. * @param {Function} [customizer] The function to customize path creation.
  4979. * @returns {Object} Returns `object`.
  4980. */
  4981. function baseSet(object, path, value, customizer) {
  4982. if (!isObject(object)) {
  4983. return object;
  4984. }
  4985. path = castPath(path, object);
  4986. var index = -1,
  4987. length = path.length,
  4988. lastIndex = length - 1,
  4989. nested = object;
  4990. while (nested != null && ++index < length) {
  4991. var key = toKey(path[index]),
  4992. newValue = value;
  4993. if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
  4994. return object;
  4995. }
  4996. if (index != lastIndex) {
  4997. var objValue = nested[key];
  4998. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  4999. if (newValue === undefined) {
  5000. newValue = isObject(objValue)
  5001. ? objValue
  5002. : (isIndex(path[index + 1]) ? [] : {});
  5003. }
  5004. }
  5005. assignValue(nested, key, newValue);
  5006. nested = nested[key];
  5007. }
  5008. return object;
  5009. }
  5010. /**
  5011. * The base implementation of `setData` without support for hot loop shorting.
  5012. *
  5013. * @private
  5014. * @param {Function} func The function to associate metadata with.
  5015. * @param {*} data The metadata.
  5016. * @returns {Function} Returns `func`.
  5017. */
  5018. var baseSetData = !metaMap ? identity : function(func, data) {
  5019. metaMap.set(func, data);
  5020. return func;
  5021. };
  5022. /**
  5023. * The base implementation of `setToString` without support for hot loop shorting.
  5024. *
  5025. * @private
  5026. * @param {Function} func The function to modify.
  5027. * @param {Function} string The `toString` result.
  5028. * @returns {Function} Returns `func`.
  5029. */
  5030. var baseSetToString = !defineProperty ? identity : function(func, string) {
  5031. return defineProperty(func, 'toString', {
  5032. 'configurable': true,
  5033. 'enumerable': false,
  5034. 'value': constant(string),
  5035. 'writable': true
  5036. });
  5037. };
  5038. /**
  5039. * The base implementation of `_.shuffle`.
  5040. *
  5041. * @private
  5042. * @param {Array|Object} collection The collection to shuffle.
  5043. * @returns {Array} Returns the new shuffled array.
  5044. */
  5045. function baseShuffle(collection) {
  5046. return shuffleSelf(values(collection));
  5047. }
  5048. /**
  5049. * The base implementation of `_.slice` without an iteratee call guard.
  5050. *
  5051. * @private
  5052. * @param {Array} array The array to slice.
  5053. * @param {number} [start=0] The start position.
  5054. * @param {number} [end=array.length] The end position.
  5055. * @returns {Array} Returns the slice of `array`.
  5056. */
  5057. function baseSlice(array, start, end) {
  5058. var index = -1,
  5059. length = array.length;
  5060. if (start < 0) {
  5061. start = -start > length ? 0 : (length + start);
  5062. }
  5063. end = end > length ? length : end;
  5064. if (end < 0) {
  5065. end += length;
  5066. }
  5067. length = start > end ? 0 : ((end - start) >>> 0);
  5068. start >>>= 0;
  5069. var result = Array(length);
  5070. while (++index < length) {
  5071. result[index] = array[index + start];
  5072. }
  5073. return result;
  5074. }
  5075. /**
  5076. * The base implementation of `_.some` without support for iteratee shorthands.
  5077. *
  5078. * @private
  5079. * @param {Array|Object} collection The collection to iterate over.
  5080. * @param {Function} predicate The function invoked per iteration.
  5081. * @returns {boolean} Returns `true` if any element passes the predicate check,
  5082. * else `false`.
  5083. */
  5084. function baseSome(collection, predicate) {
  5085. var result;
  5086. baseEach(collection, function(value, index, collection) {
  5087. result = predicate(value, index, collection);
  5088. return !result;
  5089. });
  5090. return !!result;
  5091. }
  5092. /**
  5093. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  5094. * performs a binary search of `array` to determine the index at which `value`
  5095. * should be inserted into `array` in order to maintain its sort order.
  5096. *
  5097. * @private
  5098. * @param {Array} array The sorted array to inspect.
  5099. * @param {*} value The value to evaluate.
  5100. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  5101. * @returns {number} Returns the index at which `value` should be inserted
  5102. * into `array`.
  5103. */
  5104. function baseSortedIndex(array, value, retHighest) {
  5105. var low = 0,
  5106. high = array == null ? low : array.length;
  5107. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  5108. while (low < high) {
  5109. var mid = (low + high) >>> 1,
  5110. computed = array[mid];
  5111. if (computed !== null && !isSymbol(computed) &&
  5112. (retHighest ? (computed <= value) : (computed < value))) {
  5113. low = mid + 1;
  5114. } else {
  5115. high = mid;
  5116. }
  5117. }
  5118. return high;
  5119. }
  5120. return baseSortedIndexBy(array, value, identity, retHighest);
  5121. }
  5122. /**
  5123. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  5124. * which invokes `iteratee` for `value` and each element of `array` to compute
  5125. * their sort ranking. The iteratee is invoked with one argument; (value).
  5126. *
  5127. * @private
  5128. * @param {Array} array The sorted array to inspect.
  5129. * @param {*} value The value to evaluate.
  5130. * @param {Function} iteratee The iteratee invoked per element.
  5131. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  5132. * @returns {number} Returns the index at which `value` should be inserted
  5133. * into `array`.
  5134. */
  5135. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  5136. var low = 0,
  5137. high = array == null ? 0 : array.length;
  5138. if (high === 0) {
  5139. return 0;
  5140. }
  5141. value = iteratee(value);
  5142. var valIsNaN = value !== value,
  5143. valIsNull = value === null,
  5144. valIsSymbol = isSymbol(value),
  5145. valIsUndefined = value === undefined;
  5146. while (low < high) {
  5147. var mid = nativeFloor((low + high) / 2),
  5148. computed = iteratee(array[mid]),
  5149. othIsDefined = computed !== undefined,
  5150. othIsNull = computed === null,
  5151. othIsReflexive = computed === computed,
  5152. othIsSymbol = isSymbol(computed);
  5153. if (valIsNaN) {
  5154. var setLow = retHighest || othIsReflexive;
  5155. } else if (valIsUndefined) {
  5156. setLow = othIsReflexive && (retHighest || othIsDefined);
  5157. } else if (valIsNull) {
  5158. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  5159. } else if (valIsSymbol) {
  5160. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  5161. } else if (othIsNull || othIsSymbol) {
  5162. setLow = false;
  5163. } else {
  5164. setLow = retHighest ? (computed <= value) : (computed < value);
  5165. }
  5166. if (setLow) {
  5167. low = mid + 1;
  5168. } else {
  5169. high = mid;
  5170. }
  5171. }
  5172. return nativeMin(high, MAX_ARRAY_INDEX);
  5173. }
  5174. /**
  5175. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  5176. * support for iteratee shorthands.
  5177. *
  5178. * @private
  5179. * @param {Array} array The array to inspect.
  5180. * @param {Function} [iteratee] The iteratee invoked per element.
  5181. * @returns {Array} Returns the new duplicate free array.
  5182. */
  5183. function baseSortedUniq(array, iteratee) {
  5184. var index = -1,
  5185. length = array.length,
  5186. resIndex = 0,
  5187. result = [];
  5188. while (++index < length) {
  5189. var value = array[index],
  5190. computed = iteratee ? iteratee(value) : value;
  5191. if (!index || !eq(computed, seen)) {
  5192. var seen = computed;
  5193. result[resIndex++] = value === 0 ? 0 : value;
  5194. }
  5195. }
  5196. return result;
  5197. }
  5198. /**
  5199. * The base implementation of `_.toNumber` which doesn't ensure correct
  5200. * conversions of binary, hexadecimal, or octal string values.
  5201. *
  5202. * @private
  5203. * @param {*} value The value to process.
  5204. * @returns {number} Returns the number.
  5205. */
  5206. function baseToNumber(value) {
  5207. if (typeof value == 'number') {
  5208. return value;
  5209. }
  5210. if (isSymbol(value)) {
  5211. return NAN;
  5212. }
  5213. return +value;
  5214. }
  5215. /**
  5216. * The base implementation of `_.toString` which doesn't convert nullish
  5217. * values to empty strings.
  5218. *
  5219. * @private
  5220. * @param {*} value The value to process.
  5221. * @returns {string} Returns the string.
  5222. */
  5223. function baseToString(value) {
  5224. // Exit early for strings to avoid a performance hit in some environments.
  5225. if (typeof value == 'string') {
  5226. return value;
  5227. }
  5228. if (isArray(value)) {
  5229. // Recursively convert values (susceptible to call stack limits).
  5230. return arrayMap(value, baseToString) + '';
  5231. }
  5232. if (isSymbol(value)) {
  5233. return symbolToString ? symbolToString.call(value) : '';
  5234. }
  5235. var result = (value + '');
  5236. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  5237. }
  5238. /**
  5239. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  5240. *
  5241. * @private
  5242. * @param {Array} array The array to inspect.
  5243. * @param {Function} [iteratee] The iteratee invoked per element.
  5244. * @param {Function} [comparator] The comparator invoked per element.
  5245. * @returns {Array} Returns the new duplicate free array.
  5246. */
  5247. function baseUniq(array, iteratee, comparator) {
  5248. var index = -1,
  5249. includes = arrayIncludes,
  5250. length = array.length,
  5251. isCommon = true,
  5252. result = [],
  5253. seen = result;
  5254. if (comparator) {
  5255. isCommon = false;
  5256. includes = arrayIncludesWith;
  5257. }
  5258. else if (length >= LARGE_ARRAY_SIZE) {
  5259. var set = iteratee ? null : createSet(array);
  5260. if (set) {
  5261. return setToArray(set);
  5262. }
  5263. isCommon = false;
  5264. includes = cacheHas;
  5265. seen = new SetCache;
  5266. }
  5267. else {
  5268. seen = iteratee ? [] : result;
  5269. }
  5270. outer:
  5271. while (++index < length) {
  5272. var value = array[index],
  5273. computed = iteratee ? iteratee(value) : value;
  5274. value = (comparator || value !== 0) ? value : 0;
  5275. if (isCommon && computed === computed) {
  5276. var seenIndex = seen.length;
  5277. while (seenIndex--) {
  5278. if (seen[seenIndex] === computed) {
  5279. continue outer;
  5280. }
  5281. }
  5282. if (iteratee) {
  5283. seen.push(computed);
  5284. }
  5285. result.push(value);
  5286. }
  5287. else if (!includes(seen, computed, comparator)) {
  5288. if (seen !== result) {
  5289. seen.push(computed);
  5290. }
  5291. result.push(value);
  5292. }
  5293. }
  5294. return result;
  5295. }
  5296. /**
  5297. * The base implementation of `_.unset`.
  5298. *
  5299. * @private
  5300. * @param {Object} object The object to modify.
  5301. * @param {Array|string} path The property path to unset.
  5302. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  5303. */
  5304. function baseUnset(object, path) {
  5305. path = castPath(path, object);
  5306. object = parent(object, path);
  5307. return object == null || delete object[toKey(last(path))];
  5308. }
  5309. /**
  5310. * The base implementation of `_.update`.
  5311. *
  5312. * @private
  5313. * @param {Object} object The object to modify.
  5314. * @param {Array|string} path The path of the property to update.
  5315. * @param {Function} updater The function to produce the updated value.
  5316. * @param {Function} [customizer] The function to customize path creation.
  5317. * @returns {Object} Returns `object`.
  5318. */
  5319. function baseUpdate(object, path, updater, customizer) {
  5320. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  5321. }
  5322. /**
  5323. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  5324. * without support for iteratee shorthands.
  5325. *
  5326. * @private
  5327. * @param {Array} array The array to query.
  5328. * @param {Function} predicate The function invoked per iteration.
  5329. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  5330. * @param {boolean} [fromRight] Specify iterating from right to left.
  5331. * @returns {Array} Returns the slice of `array`.
  5332. */
  5333. function baseWhile(array, predicate, isDrop, fromRight) {
  5334. var length = array.length,
  5335. index = fromRight ? length : -1;
  5336. while ((fromRight ? index-- : ++index < length) &&
  5337. predicate(array[index], index, array)) {}
  5338. return isDrop
  5339. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  5340. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  5341. }
  5342. /**
  5343. * The base implementation of `wrapperValue` which returns the result of
  5344. * performing a sequence of actions on the unwrapped `value`, where each
  5345. * successive action is supplied the return value of the previous.
  5346. *
  5347. * @private
  5348. * @param {*} value The unwrapped value.
  5349. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  5350. * @returns {*} Returns the resolved value.
  5351. */
  5352. function baseWrapperValue(value, actions) {
  5353. var result = value;
  5354. if (result instanceof LazyWrapper) {
  5355. result = result.value();
  5356. }
  5357. return arrayReduce(actions, function(result, action) {
  5358. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  5359. }, result);
  5360. }
  5361. /**
  5362. * The base implementation of methods like `_.xor`, without support for
  5363. * iteratee shorthands, that accepts an array of arrays to inspect.
  5364. *
  5365. * @private
  5366. * @param {Array} arrays The arrays to inspect.
  5367. * @param {Function} [iteratee] The iteratee invoked per element.
  5368. * @param {Function} [comparator] The comparator invoked per element.
  5369. * @returns {Array} Returns the new array of values.
  5370. */
  5371. function baseXor(arrays, iteratee, comparator) {
  5372. var length = arrays.length;
  5373. if (length < 2) {
  5374. return length ? baseUniq(arrays[0]) : [];
  5375. }
  5376. var index = -1,
  5377. result = Array(length);
  5378. while (++index < length) {
  5379. var array = arrays[index],
  5380. othIndex = -1;
  5381. while (++othIndex < length) {
  5382. if (othIndex != index) {
  5383. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  5384. }
  5385. }
  5386. }
  5387. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  5388. }
  5389. /**
  5390. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  5391. *
  5392. * @private
  5393. * @param {Array} props The property identifiers.
  5394. * @param {Array} values The property values.
  5395. * @param {Function} assignFunc The function to assign values.
  5396. * @returns {Object} Returns the new object.
  5397. */
  5398. function baseZipObject(props, values, assignFunc) {
  5399. var index = -1,
  5400. length = props.length,
  5401. valsLength = values.length,
  5402. result = {};
  5403. while (++index < length) {
  5404. var value = index < valsLength ? values[index] : undefined;
  5405. assignFunc(result, props[index], value);
  5406. }
  5407. return result;
  5408. }
  5409. /**
  5410. * Casts `value` to an empty array if it's not an array like object.
  5411. *
  5412. * @private
  5413. * @param {*} value The value to inspect.
  5414. * @returns {Array|Object} Returns the cast array-like object.
  5415. */
  5416. function castArrayLikeObject(value) {
  5417. return isArrayLikeObject(value) ? value : [];
  5418. }
  5419. /**
  5420. * Casts `value` to `identity` if it's not a function.
  5421. *
  5422. * @private
  5423. * @param {*} value The value to inspect.
  5424. * @returns {Function} Returns cast function.
  5425. */
  5426. function castFunction(value) {
  5427. return typeof value == 'function' ? value : identity;
  5428. }
  5429. /**
  5430. * Casts `value` to a path array if it's not one.
  5431. *
  5432. * @private
  5433. * @param {*} value The value to inspect.
  5434. * @param {Object} [object] The object to query keys on.
  5435. * @returns {Array} Returns the cast property path array.
  5436. */
  5437. function castPath(value, object) {
  5438. if (isArray(value)) {
  5439. return value;
  5440. }
  5441. return isKey(value, object) ? [value] : stringToPath(toString(value));
  5442. }
  5443. /**
  5444. * A `baseRest` alias which can be replaced with `identity` by module
  5445. * replacement plugins.
  5446. *
  5447. * @private
  5448. * @type {Function}
  5449. * @param {Function} func The function to apply a rest parameter to.
  5450. * @returns {Function} Returns the new function.
  5451. */
  5452. var castRest = baseRest;
  5453. /**
  5454. * Casts `array` to a slice if it's needed.
  5455. *
  5456. * @private
  5457. * @param {Array} array The array to inspect.
  5458. * @param {number} start The start position.
  5459. * @param {number} [end=array.length] The end position.
  5460. * @returns {Array} Returns the cast slice.
  5461. */
  5462. function castSlice(array, start, end) {
  5463. var length = array.length;
  5464. end = end === undefined ? length : end;
  5465. return (!start && end >= length) ? array : baseSlice(array, start, end);
  5466. }
  5467. /**
  5468. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  5469. *
  5470. * @private
  5471. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  5472. */
  5473. var clearTimeout = ctxClearTimeout || function(id) {
  5474. return root.clearTimeout(id);
  5475. };
  5476. /**
  5477. * Creates a clone of `buffer`.
  5478. *
  5479. * @private
  5480. * @param {Buffer} buffer The buffer to clone.
  5481. * @param {boolean} [isDeep] Specify a deep clone.
  5482. * @returns {Buffer} Returns the cloned buffer.
  5483. */
  5484. function cloneBuffer(buffer, isDeep) {
  5485. if (isDeep) {
  5486. return buffer.slice();
  5487. }
  5488. var length = buffer.length,
  5489. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  5490. buffer.copy(result);
  5491. return result;
  5492. }
  5493. /**
  5494. * Creates a clone of `arrayBuffer`.
  5495. *
  5496. * @private
  5497. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  5498. * @returns {ArrayBuffer} Returns the cloned array buffer.
  5499. */
  5500. function cloneArrayBuffer(arrayBuffer) {
  5501. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  5502. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  5503. return result;
  5504. }
  5505. /**
  5506. * Creates a clone of `dataView`.
  5507. *
  5508. * @private
  5509. * @param {Object} dataView The data view to clone.
  5510. * @param {boolean} [isDeep] Specify a deep clone.
  5511. * @returns {Object} Returns the cloned data view.
  5512. */
  5513. function cloneDataView(dataView, isDeep) {
  5514. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  5515. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  5516. }
  5517. /**
  5518. * Creates a clone of `regexp`.
  5519. *
  5520. * @private
  5521. * @param {Object} regexp The regexp to clone.
  5522. * @returns {Object} Returns the cloned regexp.
  5523. */
  5524. function cloneRegExp(regexp) {
  5525. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  5526. result.lastIndex = regexp.lastIndex;
  5527. return result;
  5528. }
  5529. /**
  5530. * Creates a clone of the `symbol` object.
  5531. *
  5532. * @private
  5533. * @param {Object} symbol The symbol object to clone.
  5534. * @returns {Object} Returns the cloned symbol object.
  5535. */
  5536. function cloneSymbol(symbol) {
  5537. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  5538. }
  5539. /**
  5540. * Creates a clone of `typedArray`.
  5541. *
  5542. * @private
  5543. * @param {Object} typedArray The typed array to clone.
  5544. * @param {boolean} [isDeep] Specify a deep clone.
  5545. * @returns {Object} Returns the cloned typed array.
  5546. */
  5547. function cloneTypedArray(typedArray, isDeep) {
  5548. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  5549. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  5550. }
  5551. /**
  5552. * Compares values to sort them in ascending order.
  5553. *
  5554. * @private
  5555. * @param {*} value The value to compare.
  5556. * @param {*} other The other value to compare.
  5557. * @returns {number} Returns the sort order indicator for `value`.
  5558. */
  5559. function compareAscending(value, other) {
  5560. if (value !== other) {
  5561. var valIsDefined = value !== undefined,
  5562. valIsNull = value === null,
  5563. valIsReflexive = value === value,
  5564. valIsSymbol = isSymbol(value);
  5565. var othIsDefined = other !== undefined,
  5566. othIsNull = other === null,
  5567. othIsReflexive = other === other,
  5568. othIsSymbol = isSymbol(other);
  5569. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  5570. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  5571. (valIsNull && othIsDefined && othIsReflexive) ||
  5572. (!valIsDefined && othIsReflexive) ||
  5573. !valIsReflexive) {
  5574. return 1;
  5575. }
  5576. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  5577. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  5578. (othIsNull && valIsDefined && valIsReflexive) ||
  5579. (!othIsDefined && valIsReflexive) ||
  5580. !othIsReflexive) {
  5581. return -1;
  5582. }
  5583. }
  5584. return 0;
  5585. }
  5586. /**
  5587. * Used by `_.orderBy` to compare multiple properties of a value to another
  5588. * and stable sort them.
  5589. *
  5590. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  5591. * specify an order of "desc" for descending or "asc" for ascending sort order
  5592. * of corresponding values.
  5593. *
  5594. * @private
  5595. * @param {Object} object The object to compare.
  5596. * @param {Object} other The other object to compare.
  5597. * @param {boolean[]|string[]} orders The order to sort by for each property.
  5598. * @returns {number} Returns the sort order indicator for `object`.
  5599. */
  5600. function compareMultiple(object, other, orders) {
  5601. var index = -1,
  5602. objCriteria = object.criteria,
  5603. othCriteria = other.criteria,
  5604. length = objCriteria.length,
  5605. ordersLength = orders.length;
  5606. while (++index < length) {
  5607. var result = compareAscending(objCriteria[index], othCriteria[index]);
  5608. if (result) {
  5609. if (index >= ordersLength) {
  5610. return result;
  5611. }
  5612. var order = orders[index];
  5613. return result * (order == 'desc' ? -1 : 1);
  5614. }
  5615. }
  5616. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  5617. // that causes it, under certain circumstances, to provide the same value for
  5618. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  5619. // for more details.
  5620. //
  5621. // This also ensures a stable sort in V8 and other engines.
  5622. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  5623. return object.index - other.index;
  5624. }
  5625. /**
  5626. * Creates an array that is the composition of partially applied arguments,
  5627. * placeholders, and provided arguments into a single array of arguments.
  5628. *
  5629. * @private
  5630. * @param {Array} args The provided arguments.
  5631. * @param {Array} partials The arguments to prepend to those provided.
  5632. * @param {Array} holders The `partials` placeholder indexes.
  5633. * @params {boolean} [isCurried] Specify composing for a curried function.
  5634. * @returns {Array} Returns the new array of composed arguments.
  5635. */
  5636. function composeArgs(args, partials, holders, isCurried) {
  5637. var argsIndex = -1,
  5638. argsLength = args.length,
  5639. holdersLength = holders.length,
  5640. leftIndex = -1,
  5641. leftLength = partials.length,
  5642. rangeLength = nativeMax(argsLength - holdersLength, 0),
  5643. result = Array(leftLength + rangeLength),
  5644. isUncurried = !isCurried;
  5645. while (++leftIndex < leftLength) {
  5646. result[leftIndex] = partials[leftIndex];
  5647. }
  5648. while (++argsIndex < holdersLength) {
  5649. if (isUncurried || argsIndex < argsLength) {
  5650. result[holders[argsIndex]] = args[argsIndex];
  5651. }
  5652. }
  5653. while (rangeLength--) {
  5654. result[leftIndex++] = args[argsIndex++];
  5655. }
  5656. return result;
  5657. }
  5658. /**
  5659. * This function is like `composeArgs` except that the arguments composition
  5660. * is tailored for `_.partialRight`.
  5661. *
  5662. * @private
  5663. * @param {Array} args The provided arguments.
  5664. * @param {Array} partials The arguments to append to those provided.
  5665. * @param {Array} holders The `partials` placeholder indexes.
  5666. * @params {boolean} [isCurried] Specify composing for a curried function.
  5667. * @returns {Array} Returns the new array of composed arguments.
  5668. */
  5669. function composeArgsRight(args, partials, holders, isCurried) {
  5670. var argsIndex = -1,
  5671. argsLength = args.length,
  5672. holdersIndex = -1,
  5673. holdersLength = holders.length,
  5674. rightIndex = -1,
  5675. rightLength = partials.length,
  5676. rangeLength = nativeMax(argsLength - holdersLength, 0),
  5677. result = Array(rangeLength + rightLength),
  5678. isUncurried = !isCurried;
  5679. while (++argsIndex < rangeLength) {
  5680. result[argsIndex] = args[argsIndex];
  5681. }
  5682. var offset = argsIndex;
  5683. while (++rightIndex < rightLength) {
  5684. result[offset + rightIndex] = partials[rightIndex];
  5685. }
  5686. while (++holdersIndex < holdersLength) {
  5687. if (isUncurried || argsIndex < argsLength) {
  5688. result[offset + holders[holdersIndex]] = args[argsIndex++];
  5689. }
  5690. }
  5691. return result;
  5692. }
  5693. /**
  5694. * Copies the values of `source` to `array`.
  5695. *
  5696. * @private
  5697. * @param {Array} source The array to copy values from.
  5698. * @param {Array} [array=[]] The array to copy values to.
  5699. * @returns {Array} Returns `array`.
  5700. */
  5701. function copyArray(source, array) {
  5702. var index = -1,
  5703. length = source.length;
  5704. array || (array = Array(length));
  5705. while (++index < length) {
  5706. array[index] = source[index];
  5707. }
  5708. return array;
  5709. }
  5710. /**
  5711. * Copies properties of `source` to `object`.
  5712. *
  5713. * @private
  5714. * @param {Object} source The object to copy properties from.
  5715. * @param {Array} props The property identifiers to copy.
  5716. * @param {Object} [object={}] The object to copy properties to.
  5717. * @param {Function} [customizer] The function to customize copied values.
  5718. * @returns {Object} Returns `object`.
  5719. */
  5720. function copyObject(source, props, object, customizer) {
  5721. var isNew = !object;
  5722. object || (object = {});
  5723. var index = -1,
  5724. length = props.length;
  5725. while (++index < length) {
  5726. var key = props[index];
  5727. var newValue = customizer
  5728. ? customizer(object[key], source[key], key, object, source)
  5729. : undefined;
  5730. if (newValue === undefined) {
  5731. newValue = source[key];
  5732. }
  5733. if (isNew) {
  5734. baseAssignValue(object, key, newValue);
  5735. } else {
  5736. assignValue(object, key, newValue);
  5737. }
  5738. }
  5739. return object;
  5740. }
  5741. /**
  5742. * Copies own symbols of `source` to `object`.
  5743. *
  5744. * @private
  5745. * @param {Object} source The object to copy symbols from.
  5746. * @param {Object} [object={}] The object to copy symbols to.
  5747. * @returns {Object} Returns `object`.
  5748. */
  5749. function copySymbols(source, object) {
  5750. return copyObject(source, getSymbols(source), object);
  5751. }
  5752. /**
  5753. * Copies own and inherited symbols of `source` to `object`.
  5754. *
  5755. * @private
  5756. * @param {Object} source The object to copy symbols from.
  5757. * @param {Object} [object={}] The object to copy symbols to.
  5758. * @returns {Object} Returns `object`.
  5759. */
  5760. function copySymbolsIn(source, object) {
  5761. return copyObject(source, getSymbolsIn(source), object);
  5762. }
  5763. /**
  5764. * Creates a function like `_.groupBy`.
  5765. *
  5766. * @private
  5767. * @param {Function} setter The function to set accumulator values.
  5768. * @param {Function} [initializer] The accumulator object initializer.
  5769. * @returns {Function} Returns the new aggregator function.
  5770. */
  5771. function createAggregator(setter, initializer) {
  5772. return function(collection, iteratee) {
  5773. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  5774. accumulator = initializer ? initializer() : {};
  5775. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  5776. };
  5777. }
  5778. /**
  5779. * Creates a function like `_.assign`.
  5780. *
  5781. * @private
  5782. * @param {Function} assigner The function to assign values.
  5783. * @returns {Function} Returns the new assigner function.
  5784. */
  5785. function createAssigner(assigner) {
  5786. return baseRest(function(object, sources) {
  5787. var index = -1,
  5788. length = sources.length,
  5789. customizer = length > 1 ? sources[length - 1] : undefined,
  5790. guard = length > 2 ? sources[2] : undefined;
  5791. customizer = (assigner.length > 3 && typeof customizer == 'function')
  5792. ? (length--, customizer)
  5793. : undefined;
  5794. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  5795. customizer = length < 3 ? undefined : customizer;
  5796. length = 1;
  5797. }
  5798. object = Object(object);
  5799. while (++index < length) {
  5800. var source = sources[index];
  5801. if (source) {
  5802. assigner(object, source, index, customizer);
  5803. }
  5804. }
  5805. return object;
  5806. });
  5807. }
  5808. /**
  5809. * Creates a `baseEach` or `baseEachRight` function.
  5810. *
  5811. * @private
  5812. * @param {Function} eachFunc The function to iterate over a collection.
  5813. * @param {boolean} [fromRight] Specify iterating from right to left.
  5814. * @returns {Function} Returns the new base function.
  5815. */
  5816. function createBaseEach(eachFunc, fromRight) {
  5817. return function(collection, iteratee) {
  5818. if (collection == null) {
  5819. return collection;
  5820. }
  5821. if (!isArrayLike(collection)) {
  5822. return eachFunc(collection, iteratee);
  5823. }
  5824. var length = collection.length,
  5825. index = fromRight ? length : -1,
  5826. iterable = Object(collection);
  5827. while ((fromRight ? index-- : ++index < length)) {
  5828. if (iteratee(iterable[index], index, iterable) === false) {
  5829. break;
  5830. }
  5831. }
  5832. return collection;
  5833. };
  5834. }
  5835. /**
  5836. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  5837. *
  5838. * @private
  5839. * @param {boolean} [fromRight] Specify iterating from right to left.
  5840. * @returns {Function} Returns the new base function.
  5841. */
  5842. function createBaseFor(fromRight) {
  5843. return function(object, iteratee, keysFunc) {
  5844. var index = -1,
  5845. iterable = Object(object),
  5846. props = keysFunc(object),
  5847. length = props.length;
  5848. while (length--) {
  5849. var key = props[fromRight ? length : ++index];
  5850. if (iteratee(iterable[key], key, iterable) === false) {
  5851. break;
  5852. }
  5853. }
  5854. return object;
  5855. };
  5856. }
  5857. /**
  5858. * Creates a function that wraps `func` to invoke it with the optional `this`
  5859. * binding of `thisArg`.
  5860. *
  5861. * @private
  5862. * @param {Function} func The function to wrap.
  5863. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  5864. * @param {*} [thisArg] The `this` binding of `func`.
  5865. * @returns {Function} Returns the new wrapped function.
  5866. */
  5867. function createBind(func, bitmask, thisArg) {
  5868. var isBind = bitmask & WRAP_BIND_FLAG,
  5869. Ctor = createCtor(func);
  5870. function wrapper() {
  5871. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  5872. return fn.apply(isBind ? thisArg : this, arguments);
  5873. }
  5874. return wrapper;
  5875. }
  5876. /**
  5877. * Creates a function like `_.lowerFirst`.
  5878. *
  5879. * @private
  5880. * @param {string} methodName The name of the `String` case method to use.
  5881. * @returns {Function} Returns the new case function.
  5882. */
  5883. function createCaseFirst(methodName) {
  5884. return function(string) {
  5885. string = toString(string);
  5886. var strSymbols = hasUnicode(string)
  5887. ? stringToArray(string)
  5888. : undefined;
  5889. var chr = strSymbols
  5890. ? strSymbols[0]
  5891. : string.charAt(0);
  5892. var trailing = strSymbols
  5893. ? castSlice(strSymbols, 1).join('')
  5894. : string.slice(1);
  5895. return chr[methodName]() + trailing;
  5896. };
  5897. }
  5898. /**
  5899. * Creates a function like `_.camelCase`.
  5900. *
  5901. * @private
  5902. * @param {Function} callback The function to combine each word.
  5903. * @returns {Function} Returns the new compounder function.
  5904. */
  5905. function createCompounder(callback) {
  5906. return function(string) {
  5907. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  5908. };
  5909. }
  5910. /**
  5911. * Creates a function that produces an instance of `Ctor` regardless of
  5912. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  5913. *
  5914. * @private
  5915. * @param {Function} Ctor The constructor to wrap.
  5916. * @returns {Function} Returns the new wrapped function.
  5917. */
  5918. function createCtor(Ctor) {
  5919. return function() {
  5920. // Use a `switch` statement to work with class constructors. See
  5921. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  5922. // for more details.
  5923. var args = arguments;
  5924. switch (args.length) {
  5925. case 0: return new Ctor;
  5926. case 1: return new Ctor(args[0]);
  5927. case 2: return new Ctor(args[0], args[1]);
  5928. case 3: return new Ctor(args[0], args[1], args[2]);
  5929. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  5930. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  5931. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  5932. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  5933. }
  5934. var thisBinding = baseCreate(Ctor.prototype),
  5935. result = Ctor.apply(thisBinding, args);
  5936. // Mimic the constructor's `return` behavior.
  5937. // See https://es5.github.io/#x13.2.2 for more details.
  5938. return isObject(result) ? result : thisBinding;
  5939. };
  5940. }
  5941. /**
  5942. * Creates a function that wraps `func` to enable currying.
  5943. *
  5944. * @private
  5945. * @param {Function} func The function to wrap.
  5946. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  5947. * @param {number} arity The arity of `func`.
  5948. * @returns {Function} Returns the new wrapped function.
  5949. */
  5950. function createCurry(func, bitmask, arity) {
  5951. var Ctor = createCtor(func);
  5952. function wrapper() {
  5953. var length = arguments.length,
  5954. args = Array(length),
  5955. index = length,
  5956. placeholder = getHolder(wrapper);
  5957. while (index--) {
  5958. args[index] = arguments[index];
  5959. }
  5960. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  5961. ? []
  5962. : replaceHolders(args, placeholder);
  5963. length -= holders.length;
  5964. if (length < arity) {
  5965. return createRecurry(
  5966. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  5967. args, holders, undefined, undefined, arity - length);
  5968. }
  5969. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  5970. return apply(fn, this, args);
  5971. }
  5972. return wrapper;
  5973. }
  5974. /**
  5975. * Creates a `_.find` or `_.findLast` function.
  5976. *
  5977. * @private
  5978. * @param {Function} findIndexFunc The function to find the collection index.
  5979. * @returns {Function} Returns the new find function.
  5980. */
  5981. function createFind(findIndexFunc) {
  5982. return function(collection, predicate, fromIndex) {
  5983. var iterable = Object(collection);
  5984. if (!isArrayLike(collection)) {
  5985. var iteratee = getIteratee(predicate, 3);
  5986. collection = keys(collection);
  5987. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  5988. }
  5989. var index = findIndexFunc(collection, predicate, fromIndex);
  5990. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  5991. };
  5992. }
  5993. /**
  5994. * Creates a `_.flow` or `_.flowRight` function.
  5995. *
  5996. * @private
  5997. * @param {boolean} [fromRight] Specify iterating from right to left.
  5998. * @returns {Function} Returns the new flow function.
  5999. */
  6000. function createFlow(fromRight) {
  6001. return flatRest(function(funcs) {
  6002. var length = funcs.length,
  6003. index = length,
  6004. prereq = LodashWrapper.prototype.thru;
  6005. if (fromRight) {
  6006. funcs.reverse();
  6007. }
  6008. while (index--) {
  6009. var func = funcs[index];
  6010. if (typeof func != 'function') {
  6011. throw new TypeError(FUNC_ERROR_TEXT);
  6012. }
  6013. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  6014. var wrapper = new LodashWrapper([], true);
  6015. }
  6016. }
  6017. index = wrapper ? index : length;
  6018. while (++index < length) {
  6019. func = funcs[index];
  6020. var funcName = getFuncName(func),
  6021. data = funcName == 'wrapper' ? getData(func) : undefined;
  6022. if (data && isLaziable(data[0]) &&
  6023. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  6024. !data[4].length && data[9] == 1
  6025. ) {
  6026. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  6027. } else {
  6028. wrapper = (func.length == 1 && isLaziable(func))
  6029. ? wrapper[funcName]()
  6030. : wrapper.thru(func);
  6031. }
  6032. }
  6033. return function() {
  6034. var args = arguments,
  6035. value = args[0];
  6036. if (wrapper && args.length == 1 && isArray(value)) {
  6037. return wrapper.plant(value).value();
  6038. }
  6039. var index = 0,
  6040. result = length ? funcs[index].apply(this, args) : value;
  6041. while (++index < length) {
  6042. result = funcs[index].call(this, result);
  6043. }
  6044. return result;
  6045. };
  6046. });
  6047. }
  6048. /**
  6049. * Creates a function that wraps `func` to invoke it with optional `this`
  6050. * binding of `thisArg`, partial application, and currying.
  6051. *
  6052. * @private
  6053. * @param {Function|string} func The function or method name to wrap.
  6054. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  6055. * @param {*} [thisArg] The `this` binding of `func`.
  6056. * @param {Array} [partials] The arguments to prepend to those provided to
  6057. * the new function.
  6058. * @param {Array} [holders] The `partials` placeholder indexes.
  6059. * @param {Array} [partialsRight] The arguments to append to those provided
  6060. * to the new function.
  6061. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  6062. * @param {Array} [argPos] The argument positions of the new function.
  6063. * @param {number} [ary] The arity cap of `func`.
  6064. * @param {number} [arity] The arity of `func`.
  6065. * @returns {Function} Returns the new wrapped function.
  6066. */
  6067. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  6068. var isAry = bitmask & WRAP_ARY_FLAG,
  6069. isBind = bitmask & WRAP_BIND_FLAG,
  6070. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  6071. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  6072. isFlip = bitmask & WRAP_FLIP_FLAG,
  6073. Ctor = isBindKey ? undefined : createCtor(func);
  6074. function wrapper() {
  6075. var length = arguments.length,
  6076. args = Array(length),
  6077. index = length;
  6078. while (index--) {
  6079. args[index] = arguments[index];
  6080. }
  6081. if (isCurried) {
  6082. var placeholder = getHolder(wrapper),
  6083. holdersCount = countHolders(args, placeholder);
  6084. }
  6085. if (partials) {
  6086. args = composeArgs(args, partials, holders, isCurried);
  6087. }
  6088. if (partialsRight) {
  6089. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  6090. }
  6091. length -= holdersCount;
  6092. if (isCurried && length < arity) {
  6093. var newHolders = replaceHolders(args, placeholder);
  6094. return createRecurry(
  6095. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  6096. args, newHolders, argPos, ary, arity - length
  6097. );
  6098. }
  6099. var thisBinding = isBind ? thisArg : this,
  6100. fn = isBindKey ? thisBinding[func] : func;
  6101. length = args.length;
  6102. if (argPos) {
  6103. args = reorder(args, argPos);
  6104. } else if (isFlip && length > 1) {
  6105. args.reverse();
  6106. }
  6107. if (isAry && ary < length) {
  6108. args.length = ary;
  6109. }
  6110. if (this && this !== root && this instanceof wrapper) {
  6111. fn = Ctor || createCtor(fn);
  6112. }
  6113. return fn.apply(thisBinding, args);
  6114. }
  6115. return wrapper;
  6116. }
  6117. /**
  6118. * Creates a function like `_.invertBy`.
  6119. *
  6120. * @private
  6121. * @param {Function} setter The function to set accumulator values.
  6122. * @param {Function} toIteratee The function to resolve iteratees.
  6123. * @returns {Function} Returns the new inverter function.
  6124. */
  6125. function createInverter(setter, toIteratee) {
  6126. return function(object, iteratee) {
  6127. return baseInverter(object, setter, toIteratee(iteratee), {});
  6128. };
  6129. }
  6130. /**
  6131. * Creates a function that performs a mathematical operation on two values.
  6132. *
  6133. * @private
  6134. * @param {Function} operator The function to perform the operation.
  6135. * @param {number} [defaultValue] The value used for `undefined` arguments.
  6136. * @returns {Function} Returns the new mathematical operation function.
  6137. */
  6138. function createMathOperation(operator, defaultValue) {
  6139. return function(value, other) {
  6140. var result;
  6141. if (value === undefined && other === undefined) {
  6142. return defaultValue;
  6143. }
  6144. if (value !== undefined) {
  6145. result = value;
  6146. }
  6147. if (other !== undefined) {
  6148. if (result === undefined) {
  6149. return other;
  6150. }
  6151. if (typeof value == 'string' || typeof other == 'string') {
  6152. value = baseToString(value);
  6153. other = baseToString(other);
  6154. } else {
  6155. value = baseToNumber(value);
  6156. other = baseToNumber(other);
  6157. }
  6158. result = operator(value, other);
  6159. }
  6160. return result;
  6161. };
  6162. }
  6163. /**
  6164. * Creates a function like `_.over`.
  6165. *
  6166. * @private
  6167. * @param {Function} arrayFunc The function to iterate over iteratees.
  6168. * @returns {Function} Returns the new over function.
  6169. */
  6170. function createOver(arrayFunc) {
  6171. return flatRest(function(iteratees) {
  6172. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  6173. return baseRest(function(args) {
  6174. var thisArg = this;
  6175. return arrayFunc(iteratees, function(iteratee) {
  6176. return apply(iteratee, thisArg, args);
  6177. });
  6178. });
  6179. });
  6180. }
  6181. /**
  6182. * Creates the padding for `string` based on `length`. The `chars` string
  6183. * is truncated if the number of characters exceeds `length`.
  6184. *
  6185. * @private
  6186. * @param {number} length The padding length.
  6187. * @param {string} [chars=' '] The string used as padding.
  6188. * @returns {string} Returns the padding for `string`.
  6189. */
  6190. function createPadding(length, chars) {
  6191. chars = chars === undefined ? ' ' : baseToString(chars);
  6192. var charsLength = chars.length;
  6193. if (charsLength < 2) {
  6194. return charsLength ? baseRepeat(chars, length) : chars;
  6195. }
  6196. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  6197. return hasUnicode(chars)
  6198. ? castSlice(stringToArray(result), 0, length).join('')
  6199. : result.slice(0, length);
  6200. }
  6201. /**
  6202. * Creates a function that wraps `func` to invoke it with the `this` binding
  6203. * of `thisArg` and `partials` prepended to the arguments it receives.
  6204. *
  6205. * @private
  6206. * @param {Function} func The function to wrap.
  6207. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  6208. * @param {*} thisArg The `this` binding of `func`.
  6209. * @param {Array} partials The arguments to prepend to those provided to
  6210. * the new function.
  6211. * @returns {Function} Returns the new wrapped function.
  6212. */
  6213. function createPartial(func, bitmask, thisArg, partials) {
  6214. var isBind = bitmask & WRAP_BIND_FLAG,
  6215. Ctor = createCtor(func);
  6216. function wrapper() {
  6217. var argsIndex = -1,
  6218. argsLength = arguments.length,
  6219. leftIndex = -1,
  6220. leftLength = partials.length,
  6221. args = Array(leftLength + argsLength),
  6222. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  6223. while (++leftIndex < leftLength) {
  6224. args[leftIndex] = partials[leftIndex];
  6225. }
  6226. while (argsLength--) {
  6227. args[leftIndex++] = arguments[++argsIndex];
  6228. }
  6229. return apply(fn, isBind ? thisArg : this, args);
  6230. }
  6231. return wrapper;
  6232. }
  6233. /**
  6234. * Creates a `_.range` or `_.rangeRight` function.
  6235. *
  6236. * @private
  6237. * @param {boolean} [fromRight] Specify iterating from right to left.
  6238. * @returns {Function} Returns the new range function.
  6239. */
  6240. function createRange(fromRight) {
  6241. return function(start, end, step) {
  6242. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  6243. end = step = undefined;
  6244. }
  6245. // Ensure the sign of `-0` is preserved.
  6246. start = toFinite(start);
  6247. if (end === undefined) {
  6248. end = start;
  6249. start = 0;
  6250. } else {
  6251. end = toFinite(end);
  6252. }
  6253. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  6254. return baseRange(start, end, step, fromRight);
  6255. };
  6256. }
  6257. /**
  6258. * Creates a function that performs a relational operation on two values.
  6259. *
  6260. * @private
  6261. * @param {Function} operator The function to perform the operation.
  6262. * @returns {Function} Returns the new relational operation function.
  6263. */
  6264. function createRelationalOperation(operator) {
  6265. return function(value, other) {
  6266. if (!(typeof value == 'string' && typeof other == 'string')) {
  6267. value = toNumber(value);
  6268. other = toNumber(other);
  6269. }
  6270. return operator(value, other);
  6271. };
  6272. }
  6273. /**
  6274. * Creates a function that wraps `func` to continue currying.
  6275. *
  6276. * @private
  6277. * @param {Function} func The function to wrap.
  6278. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  6279. * @param {Function} wrapFunc The function to create the `func` wrapper.
  6280. * @param {*} placeholder The placeholder value.
  6281. * @param {*} [thisArg] The `this` binding of `func`.
  6282. * @param {Array} [partials] The arguments to prepend to those provided to
  6283. * the new function.
  6284. * @param {Array} [holders] The `partials` placeholder indexes.
  6285. * @param {Array} [argPos] The argument positions of the new function.
  6286. * @param {number} [ary] The arity cap of `func`.
  6287. * @param {number} [arity] The arity of `func`.
  6288. * @returns {Function} Returns the new wrapped function.
  6289. */
  6290. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  6291. var isCurry = bitmask & WRAP_CURRY_FLAG,
  6292. newHolders = isCurry ? holders : undefined,
  6293. newHoldersRight = isCurry ? undefined : holders,
  6294. newPartials = isCurry ? partials : undefined,
  6295. newPartialsRight = isCurry ? undefined : partials;
  6296. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  6297. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  6298. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  6299. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  6300. }
  6301. var newData = [
  6302. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  6303. newHoldersRight, argPos, ary, arity
  6304. ];
  6305. var result = wrapFunc.apply(undefined, newData);
  6306. if (isLaziable(func)) {
  6307. setData(result, newData);
  6308. }
  6309. result.placeholder = placeholder;
  6310. return setWrapToString(result, func, bitmask);
  6311. }
  6312. /**
  6313. * Creates a function like `_.round`.
  6314. *
  6315. * @private
  6316. * @param {string} methodName The name of the `Math` method to use when rounding.
  6317. * @returns {Function} Returns the new round function.
  6318. */
  6319. function createRound(methodName) {
  6320. var func = Math[methodName];
  6321. return function(number, precision) {
  6322. number = toNumber(number);
  6323. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  6324. if (precision && nativeIsFinite(number)) {
  6325. // Shift with exponential notation to avoid floating-point issues.
  6326. // See [MDN](https://mdn.io/round#Examples) for more details.
  6327. var pair = (toString(number) + 'e').split('e'),
  6328. value = func(pair[0] + 'e' + (+pair[1] + precision));
  6329. pair = (toString(value) + 'e').split('e');
  6330. return +(pair[0] + 'e' + (+pair[1] - precision));
  6331. }
  6332. return func(number);
  6333. };
  6334. }
  6335. /**
  6336. * Creates a set object of `values`.
  6337. *
  6338. * @private
  6339. * @param {Array} values The values to add to the set.
  6340. * @returns {Object} Returns the new set.
  6341. */
  6342. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  6343. return new Set(values);
  6344. };
  6345. /**
  6346. * Creates a `_.toPairs` or `_.toPairsIn` function.
  6347. *
  6348. * @private
  6349. * @param {Function} keysFunc The function to get the keys of a given object.
  6350. * @returns {Function} Returns the new pairs function.
  6351. */
  6352. function createToPairs(keysFunc) {
  6353. return function(object) {
  6354. var tag = getTag(object);
  6355. if (tag == mapTag) {
  6356. return mapToArray(object);
  6357. }
  6358. if (tag == setTag) {
  6359. return setToPairs(object);
  6360. }
  6361. return baseToPairs(object, keysFunc(object));
  6362. };
  6363. }
  6364. /**
  6365. * Creates a function that either curries or invokes `func` with optional
  6366. * `this` binding and partially applied arguments.
  6367. *
  6368. * @private
  6369. * @param {Function|string} func The function or method name to wrap.
  6370. * @param {number} bitmask The bitmask flags.
  6371. * 1 - `_.bind`
  6372. * 2 - `_.bindKey`
  6373. * 4 - `_.curry` or `_.curryRight` of a bound function
  6374. * 8 - `_.curry`
  6375. * 16 - `_.curryRight`
  6376. * 32 - `_.partial`
  6377. * 64 - `_.partialRight`
  6378. * 128 - `_.rearg`
  6379. * 256 - `_.ary`
  6380. * 512 - `_.flip`
  6381. * @param {*} [thisArg] The `this` binding of `func`.
  6382. * @param {Array} [partials] The arguments to be partially applied.
  6383. * @param {Array} [holders] The `partials` placeholder indexes.
  6384. * @param {Array} [argPos] The argument positions of the new function.
  6385. * @param {number} [ary] The arity cap of `func`.
  6386. * @param {number} [arity] The arity of `func`.
  6387. * @returns {Function} Returns the new wrapped function.
  6388. */
  6389. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  6390. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  6391. if (!isBindKey && typeof func != 'function') {
  6392. throw new TypeError(FUNC_ERROR_TEXT);
  6393. }
  6394. var length = partials ? partials.length : 0;
  6395. if (!length) {
  6396. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  6397. partials = holders = undefined;
  6398. }
  6399. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  6400. arity = arity === undefined ? arity : toInteger(arity);
  6401. length -= holders ? holders.length : 0;
  6402. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  6403. var partialsRight = partials,
  6404. holdersRight = holders;
  6405. partials = holders = undefined;
  6406. }
  6407. var data = isBindKey ? undefined : getData(func);
  6408. var newData = [
  6409. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  6410. argPos, ary, arity
  6411. ];
  6412. if (data) {
  6413. mergeData(newData, data);
  6414. }
  6415. func = newData[0];
  6416. bitmask = newData[1];
  6417. thisArg = newData[2];
  6418. partials = newData[3];
  6419. holders = newData[4];
  6420. arity = newData[9] = newData[9] === undefined
  6421. ? (isBindKey ? 0 : func.length)
  6422. : nativeMax(newData[9] - length, 0);
  6423. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  6424. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  6425. }
  6426. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  6427. var result = createBind(func, bitmask, thisArg);
  6428. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  6429. result = createCurry(func, bitmask, arity);
  6430. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  6431. result = createPartial(func, bitmask, thisArg, partials);
  6432. } else {
  6433. result = createHybrid.apply(undefined, newData);
  6434. }
  6435. var setter = data ? baseSetData : setData;
  6436. return setWrapToString(setter(result, newData), func, bitmask);
  6437. }
  6438. /**
  6439. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  6440. * of source objects to the destination object for all destination properties
  6441. * that resolve to `undefined`.
  6442. *
  6443. * @private
  6444. * @param {*} objValue The destination value.
  6445. * @param {*} srcValue The source value.
  6446. * @param {string} key The key of the property to assign.
  6447. * @param {Object} object The parent object of `objValue`.
  6448. * @returns {*} Returns the value to assign.
  6449. */
  6450. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  6451. if (objValue === undefined ||
  6452. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  6453. return srcValue;
  6454. }
  6455. return objValue;
  6456. }
  6457. /**
  6458. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  6459. * objects into destination objects that are passed thru.
  6460. *
  6461. * @private
  6462. * @param {*} objValue The destination value.
  6463. * @param {*} srcValue The source value.
  6464. * @param {string} key The key of the property to merge.
  6465. * @param {Object} object The parent object of `objValue`.
  6466. * @param {Object} source The parent object of `srcValue`.
  6467. * @param {Object} [stack] Tracks traversed source values and their merged
  6468. * counterparts.
  6469. * @returns {*} Returns the value to assign.
  6470. */
  6471. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  6472. if (isObject(objValue) && isObject(srcValue)) {
  6473. // Recursively merge objects and arrays (susceptible to call stack limits).
  6474. stack.set(srcValue, objValue);
  6475. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  6476. stack['delete'](srcValue);
  6477. }
  6478. return objValue;
  6479. }
  6480. /**
  6481. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  6482. * objects.
  6483. *
  6484. * @private
  6485. * @param {*} value The value to inspect.
  6486. * @param {string} key The key of the property to inspect.
  6487. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  6488. */
  6489. function customOmitClone(value) {
  6490. return isPlainObject(value) ? undefined : value;
  6491. }
  6492. /**
  6493. * A specialized version of `baseIsEqualDeep` for arrays with support for
  6494. * partial deep comparisons.
  6495. *
  6496. * @private
  6497. * @param {Array} array The array to compare.
  6498. * @param {Array} other The other array to compare.
  6499. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  6500. * @param {Function} customizer The function to customize comparisons.
  6501. * @param {Function} equalFunc The function to determine equivalents of values.
  6502. * @param {Object} stack Tracks traversed `array` and `other` objects.
  6503. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  6504. */
  6505. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  6506. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  6507. arrLength = array.length,
  6508. othLength = other.length;
  6509. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  6510. return false;
  6511. }
  6512. // Check that cyclic values are equal.
  6513. var arrStacked = stack.get(array);
  6514. var othStacked = stack.get(other);
  6515. if (arrStacked && othStacked) {
  6516. return arrStacked == other && othStacked == array;
  6517. }
  6518. var index = -1,
  6519. result = true,
  6520. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  6521. stack.set(array, other);
  6522. stack.set(other, array);
  6523. // Ignore non-index properties.
  6524. while (++index < arrLength) {
  6525. var arrValue = array[index],
  6526. othValue = other[index];
  6527. if (customizer) {
  6528. var compared = isPartial
  6529. ? customizer(othValue, arrValue, index, other, array, stack)
  6530. : customizer(arrValue, othValue, index, array, other, stack);
  6531. }
  6532. if (compared !== undefined) {
  6533. if (compared) {
  6534. continue;
  6535. }
  6536. result = false;
  6537. break;
  6538. }
  6539. // Recursively compare arrays (susceptible to call stack limits).
  6540. if (seen) {
  6541. if (!arraySome(other, function(othValue, othIndex) {
  6542. if (!cacheHas(seen, othIndex) &&
  6543. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  6544. return seen.push(othIndex);
  6545. }
  6546. })) {
  6547. result = false;
  6548. break;
  6549. }
  6550. } else if (!(
  6551. arrValue === othValue ||
  6552. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  6553. )) {
  6554. result = false;
  6555. break;
  6556. }
  6557. }
  6558. stack['delete'](array);
  6559. stack['delete'](other);
  6560. return result;
  6561. }
  6562. /**
  6563. * A specialized version of `baseIsEqualDeep` for comparing objects of
  6564. * the same `toStringTag`.
  6565. *
  6566. * **Note:** This function only supports comparing values with tags of
  6567. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  6568. *
  6569. * @private
  6570. * @param {Object} object The object to compare.
  6571. * @param {Object} other The other object to compare.
  6572. * @param {string} tag The `toStringTag` of the objects to compare.
  6573. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  6574. * @param {Function} customizer The function to customize comparisons.
  6575. * @param {Function} equalFunc The function to determine equivalents of values.
  6576. * @param {Object} stack Tracks traversed `object` and `other` objects.
  6577. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  6578. */
  6579. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  6580. switch (tag) {
  6581. case dataViewTag:
  6582. if ((object.byteLength != other.byteLength) ||
  6583. (object.byteOffset != other.byteOffset)) {
  6584. return false;
  6585. }
  6586. object = object.buffer;
  6587. other = other.buffer;
  6588. case arrayBufferTag:
  6589. if ((object.byteLength != other.byteLength) ||
  6590. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  6591. return false;
  6592. }
  6593. return true;
  6594. case boolTag:
  6595. case dateTag:
  6596. case numberTag:
  6597. // Coerce booleans to `1` or `0` and dates to milliseconds.
  6598. // Invalid dates are coerced to `NaN`.
  6599. return eq(+object, +other);
  6600. case errorTag:
  6601. return object.name == other.name && object.message == other.message;
  6602. case regexpTag:
  6603. case stringTag:
  6604. // Coerce regexes to strings and treat strings, primitives and objects,
  6605. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  6606. // for more details.
  6607. return object == (other + '');
  6608. case mapTag:
  6609. var convert = mapToArray;
  6610. case setTag:
  6611. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  6612. convert || (convert = setToArray);
  6613. if (object.size != other.size && !isPartial) {
  6614. return false;
  6615. }
  6616. // Assume cyclic values are equal.
  6617. var stacked = stack.get(object);
  6618. if (stacked) {
  6619. return stacked == other;
  6620. }
  6621. bitmask |= COMPARE_UNORDERED_FLAG;
  6622. // Recursively compare objects (susceptible to call stack limits).
  6623. stack.set(object, other);
  6624. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  6625. stack['delete'](object);
  6626. return result;
  6627. case symbolTag:
  6628. if (symbolValueOf) {
  6629. return symbolValueOf.call(object) == symbolValueOf.call(other);
  6630. }
  6631. }
  6632. return false;
  6633. }
  6634. /**
  6635. * A specialized version of `baseIsEqualDeep` for objects with support for
  6636. * partial deep comparisons.
  6637. *
  6638. * @private
  6639. * @param {Object} object The object to compare.
  6640. * @param {Object} other The other object to compare.
  6641. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  6642. * @param {Function} customizer The function to customize comparisons.
  6643. * @param {Function} equalFunc The function to determine equivalents of values.
  6644. * @param {Object} stack Tracks traversed `object` and `other` objects.
  6645. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  6646. */
  6647. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  6648. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  6649. objProps = getAllKeys(object),
  6650. objLength = objProps.length,
  6651. othProps = getAllKeys(other),
  6652. othLength = othProps.length;
  6653. if (objLength != othLength && !isPartial) {
  6654. return false;
  6655. }
  6656. var index = objLength;
  6657. while (index--) {
  6658. var key = objProps[index];
  6659. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  6660. return false;
  6661. }
  6662. }
  6663. // Check that cyclic values are equal.
  6664. var objStacked = stack.get(object);
  6665. var othStacked = stack.get(other);
  6666. if (objStacked && othStacked) {
  6667. return objStacked == other && othStacked == object;
  6668. }
  6669. var result = true;
  6670. stack.set(object, other);
  6671. stack.set(other, object);
  6672. var skipCtor = isPartial;
  6673. while (++index < objLength) {
  6674. key = objProps[index];
  6675. var objValue = object[key],
  6676. othValue = other[key];
  6677. if (customizer) {
  6678. var compared = isPartial
  6679. ? customizer(othValue, objValue, key, other, object, stack)
  6680. : customizer(objValue, othValue, key, object, other, stack);
  6681. }
  6682. // Recursively compare objects (susceptible to call stack limits).
  6683. if (!(compared === undefined
  6684. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  6685. : compared
  6686. )) {
  6687. result = false;
  6688. break;
  6689. }
  6690. skipCtor || (skipCtor = key == 'constructor');
  6691. }
  6692. if (result && !skipCtor) {
  6693. var objCtor = object.constructor,
  6694. othCtor = other.constructor;
  6695. // Non `Object` object instances with different constructors are not equal.
  6696. if (objCtor != othCtor &&
  6697. ('constructor' in object && 'constructor' in other) &&
  6698. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  6699. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  6700. result = false;
  6701. }
  6702. }
  6703. stack['delete'](object);
  6704. stack['delete'](other);
  6705. return result;
  6706. }
  6707. /**
  6708. * A specialized version of `baseRest` which flattens the rest array.
  6709. *
  6710. * @private
  6711. * @param {Function} func The function to apply a rest parameter to.
  6712. * @returns {Function} Returns the new function.
  6713. */
  6714. function flatRest(func) {
  6715. return setToString(overRest(func, undefined, flatten), func + '');
  6716. }
  6717. /**
  6718. * Creates an array of own enumerable property names and symbols of `object`.
  6719. *
  6720. * @private
  6721. * @param {Object} object The object to query.
  6722. * @returns {Array} Returns the array of property names and symbols.
  6723. */
  6724. function getAllKeys(object) {
  6725. return baseGetAllKeys(object, keys, getSymbols);
  6726. }
  6727. /**
  6728. * Creates an array of own and inherited enumerable property names and
  6729. * symbols of `object`.
  6730. *
  6731. * @private
  6732. * @param {Object} object The object to query.
  6733. * @returns {Array} Returns the array of property names and symbols.
  6734. */
  6735. function getAllKeysIn(object) {
  6736. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  6737. }
  6738. /**
  6739. * Gets metadata for `func`.
  6740. *
  6741. * @private
  6742. * @param {Function} func The function to query.
  6743. * @returns {*} Returns the metadata for `func`.
  6744. */
  6745. var getData = !metaMap ? noop : function(func) {
  6746. return metaMap.get(func);
  6747. };
  6748. /**
  6749. * Gets the name of `func`.
  6750. *
  6751. * @private
  6752. * @param {Function} func The function to query.
  6753. * @returns {string} Returns the function name.
  6754. */
  6755. function getFuncName(func) {
  6756. var result = (func.name + ''),
  6757. array = realNames[result],
  6758. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  6759. while (length--) {
  6760. var data = array[length],
  6761. otherFunc = data.func;
  6762. if (otherFunc == null || otherFunc == func) {
  6763. return data.name;
  6764. }
  6765. }
  6766. return result;
  6767. }
  6768. /**
  6769. * Gets the argument placeholder value for `func`.
  6770. *
  6771. * @private
  6772. * @param {Function} func The function to inspect.
  6773. * @returns {*} Returns the placeholder value.
  6774. */
  6775. function getHolder(func) {
  6776. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  6777. return object.placeholder;
  6778. }
  6779. /**
  6780. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  6781. * this function returns the custom method, otherwise it returns `baseIteratee`.
  6782. * If arguments are provided, the chosen function is invoked with them and
  6783. * its result is returned.
  6784. *
  6785. * @private
  6786. * @param {*} [value] The value to convert to an iteratee.
  6787. * @param {number} [arity] The arity of the created iteratee.
  6788. * @returns {Function} Returns the chosen function or its result.
  6789. */
  6790. function getIteratee() {
  6791. var result = lodash.iteratee || iteratee;
  6792. result = result === iteratee ? baseIteratee : result;
  6793. return arguments.length ? result(arguments[0], arguments[1]) : result;
  6794. }
  6795. /**
  6796. * Gets the data for `map`.
  6797. *
  6798. * @private
  6799. * @param {Object} map The map to query.
  6800. * @param {string} key The reference key.
  6801. * @returns {*} Returns the map data.
  6802. */
  6803. function getMapData(map, key) {
  6804. var data = map.__data__;
  6805. return isKeyable(key)
  6806. ? data[typeof key == 'string' ? 'string' : 'hash']
  6807. : data.map;
  6808. }
  6809. /**
  6810. * Gets the property names, values, and compare flags of `object`.
  6811. *
  6812. * @private
  6813. * @param {Object} object The object to query.
  6814. * @returns {Array} Returns the match data of `object`.
  6815. */
  6816. function getMatchData(object) {
  6817. var result = keys(object),
  6818. length = result.length;
  6819. while (length--) {
  6820. var key = result[length],
  6821. value = object[key];
  6822. result[length] = [key, value, isStrictComparable(value)];
  6823. }
  6824. return result;
  6825. }
  6826. /**
  6827. * Gets the native function at `key` of `object`.
  6828. *
  6829. * @private
  6830. * @param {Object} object The object to query.
  6831. * @param {string} key The key of the method to get.
  6832. * @returns {*} Returns the function if it's native, else `undefined`.
  6833. */
  6834. function getNative(object, key) {
  6835. var value = getValue(object, key);
  6836. return baseIsNative(value) ? value : undefined;
  6837. }
  6838. /**
  6839. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  6840. *
  6841. * @private
  6842. * @param {*} value The value to query.
  6843. * @returns {string} Returns the raw `toStringTag`.
  6844. */
  6845. function getRawTag(value) {
  6846. var isOwn = hasOwnProperty.call(value, symToStringTag),
  6847. tag = value[symToStringTag];
  6848. try {
  6849. value[symToStringTag] = undefined;
  6850. var unmasked = true;
  6851. } catch (e) {}
  6852. var result = nativeObjectToString.call(value);
  6853. if (unmasked) {
  6854. if (isOwn) {
  6855. value[symToStringTag] = tag;
  6856. } else {
  6857. delete value[symToStringTag];
  6858. }
  6859. }
  6860. return result;
  6861. }
  6862. /**
  6863. * Creates an array of the own enumerable symbols of `object`.
  6864. *
  6865. * @private
  6866. * @param {Object} object The object to query.
  6867. * @returns {Array} Returns the array of symbols.
  6868. */
  6869. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  6870. if (object == null) {
  6871. return [];
  6872. }
  6873. object = Object(object);
  6874. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  6875. return propertyIsEnumerable.call(object, symbol);
  6876. });
  6877. };
  6878. /**
  6879. * Creates an array of the own and inherited enumerable symbols of `object`.
  6880. *
  6881. * @private
  6882. * @param {Object} object The object to query.
  6883. * @returns {Array} Returns the array of symbols.
  6884. */
  6885. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  6886. var result = [];
  6887. while (object) {
  6888. arrayPush(result, getSymbols(object));
  6889. object = getPrototype(object);
  6890. }
  6891. return result;
  6892. };
  6893. /**
  6894. * Gets the `toStringTag` of `value`.
  6895. *
  6896. * @private
  6897. * @param {*} value The value to query.
  6898. * @returns {string} Returns the `toStringTag`.
  6899. */
  6900. var getTag = baseGetTag;
  6901. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  6902. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  6903. (Map && getTag(new Map) != mapTag) ||
  6904. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  6905. (Set && getTag(new Set) != setTag) ||
  6906. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  6907. getTag = function(value) {
  6908. var result = baseGetTag(value),
  6909. Ctor = result == objectTag ? value.constructor : undefined,
  6910. ctorString = Ctor ? toSource(Ctor) : '';
  6911. if (ctorString) {
  6912. switch (ctorString) {
  6913. case dataViewCtorString: return dataViewTag;
  6914. case mapCtorString: return mapTag;
  6915. case promiseCtorString: return promiseTag;
  6916. case setCtorString: return setTag;
  6917. case weakMapCtorString: return weakMapTag;
  6918. }
  6919. }
  6920. return result;
  6921. };
  6922. }
  6923. /**
  6924. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  6925. *
  6926. * @private
  6927. * @param {number} start The start of the view.
  6928. * @param {number} end The end of the view.
  6929. * @param {Array} transforms The transformations to apply to the view.
  6930. * @returns {Object} Returns an object containing the `start` and `end`
  6931. * positions of the view.
  6932. */
  6933. function getView(start, end, transforms) {
  6934. var index = -1,
  6935. length = transforms.length;
  6936. while (++index < length) {
  6937. var data = transforms[index],
  6938. size = data.size;
  6939. switch (data.type) {
  6940. case 'drop': start += size; break;
  6941. case 'dropRight': end -= size; break;
  6942. case 'take': end = nativeMin(end, start + size); break;
  6943. case 'takeRight': start = nativeMax(start, end - size); break;
  6944. }
  6945. }
  6946. return { 'start': start, 'end': end };
  6947. }
  6948. /**
  6949. * Extracts wrapper details from the `source` body comment.
  6950. *
  6951. * @private
  6952. * @param {string} source The source to inspect.
  6953. * @returns {Array} Returns the wrapper details.
  6954. */
  6955. function getWrapDetails(source) {
  6956. var match = source.match(reWrapDetails);
  6957. return match ? match[1].split(reSplitDetails) : [];
  6958. }
  6959. /**
  6960. * Checks if `path` exists on `object`.
  6961. *
  6962. * @private
  6963. * @param {Object} object The object to query.
  6964. * @param {Array|string} path The path to check.
  6965. * @param {Function} hasFunc The function to check properties.
  6966. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  6967. */
  6968. function hasPath(object, path, hasFunc) {
  6969. path = castPath(path, object);
  6970. var index = -1,
  6971. length = path.length,
  6972. result = false;
  6973. while (++index < length) {
  6974. var key = toKey(path[index]);
  6975. if (!(result = object != null && hasFunc(object, key))) {
  6976. break;
  6977. }
  6978. object = object[key];
  6979. }
  6980. if (result || ++index != length) {
  6981. return result;
  6982. }
  6983. length = object == null ? 0 : object.length;
  6984. return !!length && isLength(length) && isIndex(key, length) &&
  6985. (isArray(object) || isArguments(object));
  6986. }
  6987. /**
  6988. * Initializes an array clone.
  6989. *
  6990. * @private
  6991. * @param {Array} array The array to clone.
  6992. * @returns {Array} Returns the initialized clone.
  6993. */
  6994. function initCloneArray(array) {
  6995. var length = array.length,
  6996. result = new array.constructor(length);
  6997. // Add properties assigned by `RegExp#exec`.
  6998. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  6999. result.index = array.index;
  7000. result.input = array.input;
  7001. }
  7002. return result;
  7003. }
  7004. /**
  7005. * Initializes an object clone.
  7006. *
  7007. * @private
  7008. * @param {Object} object The object to clone.
  7009. * @returns {Object} Returns the initialized clone.
  7010. */
  7011. function initCloneObject(object) {
  7012. return (typeof object.constructor == 'function' && !isPrototype(object))
  7013. ? baseCreate(getPrototype(object))
  7014. : {};
  7015. }
  7016. /**
  7017. * Initializes an object clone based on its `toStringTag`.
  7018. *
  7019. * **Note:** This function only supports cloning values with tags of
  7020. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  7021. *
  7022. * @private
  7023. * @param {Object} object The object to clone.
  7024. * @param {string} tag The `toStringTag` of the object to clone.
  7025. * @param {boolean} [isDeep] Specify a deep clone.
  7026. * @returns {Object} Returns the initialized clone.
  7027. */
  7028. function initCloneByTag(object, tag, isDeep) {
  7029. var Ctor = object.constructor;
  7030. switch (tag) {
  7031. case arrayBufferTag:
  7032. return cloneArrayBuffer(object);
  7033. case boolTag:
  7034. case dateTag:
  7035. return new Ctor(+object);
  7036. case dataViewTag:
  7037. return cloneDataView(object, isDeep);
  7038. case float32Tag: case float64Tag:
  7039. case int8Tag: case int16Tag: case int32Tag:
  7040. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  7041. return cloneTypedArray(object, isDeep);
  7042. case mapTag:
  7043. return new Ctor;
  7044. case numberTag:
  7045. case stringTag:
  7046. return new Ctor(object);
  7047. case regexpTag:
  7048. return cloneRegExp(object);
  7049. case setTag:
  7050. return new Ctor;
  7051. case symbolTag:
  7052. return cloneSymbol(object);
  7053. }
  7054. }
  7055. /**
  7056. * Inserts wrapper `details` in a comment at the top of the `source` body.
  7057. *
  7058. * @private
  7059. * @param {string} source The source to modify.
  7060. * @returns {Array} details The details to insert.
  7061. * @returns {string} Returns the modified source.
  7062. */
  7063. function insertWrapDetails(source, details) {
  7064. var length = details.length;
  7065. if (!length) {
  7066. return source;
  7067. }
  7068. var lastIndex = length - 1;
  7069. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  7070. details = details.join(length > 2 ? ', ' : ' ');
  7071. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  7072. }
  7073. /**
  7074. * Checks if `value` is a flattenable `arguments` object or array.
  7075. *
  7076. * @private
  7077. * @param {*} value The value to check.
  7078. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  7079. */
  7080. function isFlattenable(value) {
  7081. return isArray(value) || isArguments(value) ||
  7082. !!(spreadableSymbol && value && value[spreadableSymbol]);
  7083. }
  7084. /**
  7085. * Checks if `value` is a valid array-like index.
  7086. *
  7087. * @private
  7088. * @param {*} value The value to check.
  7089. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  7090. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  7091. */
  7092. function isIndex(value, length) {
  7093. var type = typeof value;
  7094. length = length == null ? MAX_SAFE_INTEGER : length;
  7095. return !!length &&
  7096. (type == 'number' ||
  7097. (type != 'symbol' && reIsUint.test(value))) &&
  7098. (value > -1 && value % 1 == 0 && value < length);
  7099. }
  7100. /**
  7101. * Checks if the given arguments are from an iteratee call.
  7102. *
  7103. * @private
  7104. * @param {*} value The potential iteratee value argument.
  7105. * @param {*} index The potential iteratee index or key argument.
  7106. * @param {*} object The potential iteratee object argument.
  7107. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  7108. * else `false`.
  7109. */
  7110. function isIterateeCall(value, index, object) {
  7111. if (!isObject(object)) {
  7112. return false;
  7113. }
  7114. var type = typeof index;
  7115. if (type == 'number'
  7116. ? (isArrayLike(object) && isIndex(index, object.length))
  7117. : (type == 'string' && index in object)
  7118. ) {
  7119. return eq(object[index], value);
  7120. }
  7121. return false;
  7122. }
  7123. /**
  7124. * Checks if `value` is a property name and not a property path.
  7125. *
  7126. * @private
  7127. * @param {*} value The value to check.
  7128. * @param {Object} [object] The object to query keys on.
  7129. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  7130. */
  7131. function isKey(value, object) {
  7132. if (isArray(value)) {
  7133. return false;
  7134. }
  7135. var type = typeof value;
  7136. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  7137. value == null || isSymbol(value)) {
  7138. return true;
  7139. }
  7140. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  7141. (object != null && value in Object(object));
  7142. }
  7143. /**
  7144. * Checks if `value` is suitable for use as unique object key.
  7145. *
  7146. * @private
  7147. * @param {*} value The value to check.
  7148. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  7149. */
  7150. function isKeyable(value) {
  7151. var type = typeof value;
  7152. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  7153. ? (value !== '__proto__')
  7154. : (value === null);
  7155. }
  7156. /**
  7157. * Checks if `func` has a lazy counterpart.
  7158. *
  7159. * @private
  7160. * @param {Function} func The function to check.
  7161. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  7162. * else `false`.
  7163. */
  7164. function isLaziable(func) {
  7165. var funcName = getFuncName(func),
  7166. other = lodash[funcName];
  7167. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  7168. return false;
  7169. }
  7170. if (func === other) {
  7171. return true;
  7172. }
  7173. var data = getData(other);
  7174. return !!data && func === data[0];
  7175. }
  7176. /**
  7177. * Checks if `func` has its source masked.
  7178. *
  7179. * @private
  7180. * @param {Function} func The function to check.
  7181. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  7182. */
  7183. function isMasked(func) {
  7184. return !!maskSrcKey && (maskSrcKey in func);
  7185. }
  7186. /**
  7187. * Checks if `func` is capable of being masked.
  7188. *
  7189. * @private
  7190. * @param {*} value The value to check.
  7191. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  7192. */
  7193. var isMaskable = coreJsData ? isFunction : stubFalse;
  7194. /**
  7195. * Checks if `value` is likely a prototype object.
  7196. *
  7197. * @private
  7198. * @param {*} value The value to check.
  7199. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  7200. */
  7201. function isPrototype(value) {
  7202. var Ctor = value && value.constructor,
  7203. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  7204. return value === proto;
  7205. }
  7206. /**
  7207. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  7208. *
  7209. * @private
  7210. * @param {*} value The value to check.
  7211. * @returns {boolean} Returns `true` if `value` if suitable for strict
  7212. * equality comparisons, else `false`.
  7213. */
  7214. function isStrictComparable(value) {
  7215. return value === value && !isObject(value);
  7216. }
  7217. /**
  7218. * A specialized version of `matchesProperty` for source values suitable
  7219. * for strict equality comparisons, i.e. `===`.
  7220. *
  7221. * @private
  7222. * @param {string} key The key of the property to get.
  7223. * @param {*} srcValue The value to match.
  7224. * @returns {Function} Returns the new spec function.
  7225. */
  7226. function matchesStrictComparable(key, srcValue) {
  7227. return function(object) {
  7228. if (object == null) {
  7229. return false;
  7230. }
  7231. return object[key] === srcValue &&
  7232. (srcValue !== undefined || (key in Object(object)));
  7233. };
  7234. }
  7235. /**
  7236. * A specialized version of `_.memoize` which clears the memoized function's
  7237. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  7238. *
  7239. * @private
  7240. * @param {Function} func The function to have its output memoized.
  7241. * @returns {Function} Returns the new memoized function.
  7242. */
  7243. function memoizeCapped(func) {
  7244. var result = memoize(func, function(key) {
  7245. if (cache.size === MAX_MEMOIZE_SIZE) {
  7246. cache.clear();
  7247. }
  7248. return key;
  7249. });
  7250. var cache = result.cache;
  7251. return result;
  7252. }
  7253. /**
  7254. * Merges the function metadata of `source` into `data`.
  7255. *
  7256. * Merging metadata reduces the number of wrappers used to invoke a function.
  7257. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  7258. * may be applied regardless of execution order. Methods like `_.ary` and
  7259. * `_.rearg` modify function arguments, making the order in which they are
  7260. * executed important, preventing the merging of metadata. However, we make
  7261. * an exception for a safe combined case where curried functions have `_.ary`
  7262. * and or `_.rearg` applied.
  7263. *
  7264. * @private
  7265. * @param {Array} data The destination metadata.
  7266. * @param {Array} source The source metadata.
  7267. * @returns {Array} Returns `data`.
  7268. */
  7269. function mergeData(data, source) {
  7270. var bitmask = data[1],
  7271. srcBitmask = source[1],
  7272. newBitmask = bitmask | srcBitmask,
  7273. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  7274. var isCombo =
  7275. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  7276. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  7277. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  7278. // Exit early if metadata can't be merged.
  7279. if (!(isCommon || isCombo)) {
  7280. return data;
  7281. }
  7282. // Use source `thisArg` if available.
  7283. if (srcBitmask & WRAP_BIND_FLAG) {
  7284. data[2] = source[2];
  7285. // Set when currying a bound function.
  7286. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  7287. }
  7288. // Compose partial arguments.
  7289. var value = source[3];
  7290. if (value) {
  7291. var partials = data[3];
  7292. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  7293. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  7294. }
  7295. // Compose partial right arguments.
  7296. value = source[5];
  7297. if (value) {
  7298. partials = data[5];
  7299. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  7300. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  7301. }
  7302. // Use source `argPos` if available.
  7303. value = source[7];
  7304. if (value) {
  7305. data[7] = value;
  7306. }
  7307. // Use source `ary` if it's smaller.
  7308. if (srcBitmask & WRAP_ARY_FLAG) {
  7309. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  7310. }
  7311. // Use source `arity` if one is not provided.
  7312. if (data[9] == null) {
  7313. data[9] = source[9];
  7314. }
  7315. // Use source `func` and merge bitmasks.
  7316. data[0] = source[0];
  7317. data[1] = newBitmask;
  7318. return data;
  7319. }
  7320. /**
  7321. * This function is like
  7322. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  7323. * except that it includes inherited enumerable properties.
  7324. *
  7325. * @private
  7326. * @param {Object} object The object to query.
  7327. * @returns {Array} Returns the array of property names.
  7328. */
  7329. function nativeKeysIn(object) {
  7330. var result = [];
  7331. if (object != null) {
  7332. for (var key in Object(object)) {
  7333. result.push(key);
  7334. }
  7335. }
  7336. return result;
  7337. }
  7338. /**
  7339. * Converts `value` to a string using `Object.prototype.toString`.
  7340. *
  7341. * @private
  7342. * @param {*} value The value to convert.
  7343. * @returns {string} Returns the converted string.
  7344. */
  7345. function objectToString(value) {
  7346. return nativeObjectToString.call(value);
  7347. }
  7348. /**
  7349. * A specialized version of `baseRest` which transforms the rest array.
  7350. *
  7351. * @private
  7352. * @param {Function} func The function to apply a rest parameter to.
  7353. * @param {number} [start=func.length-1] The start position of the rest parameter.
  7354. * @param {Function} transform The rest array transform.
  7355. * @returns {Function} Returns the new function.
  7356. */
  7357. function overRest(func, start, transform) {
  7358. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  7359. return function() {
  7360. var args = arguments,
  7361. index = -1,
  7362. length = nativeMax(args.length - start, 0),
  7363. array = Array(length);
  7364. while (++index < length) {
  7365. array[index] = args[start + index];
  7366. }
  7367. index = -1;
  7368. var otherArgs = Array(start + 1);
  7369. while (++index < start) {
  7370. otherArgs[index] = args[index];
  7371. }
  7372. otherArgs[start] = transform(array);
  7373. return apply(func, this, otherArgs);
  7374. };
  7375. }
  7376. /**
  7377. * Gets the parent value at `path` of `object`.
  7378. *
  7379. * @private
  7380. * @param {Object} object The object to query.
  7381. * @param {Array} path The path to get the parent value of.
  7382. * @returns {*} Returns the parent value.
  7383. */
  7384. function parent(object, path) {
  7385. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  7386. }
  7387. /**
  7388. * Reorder `array` according to the specified indexes where the element at
  7389. * the first index is assigned as the first element, the element at
  7390. * the second index is assigned as the second element, and so on.
  7391. *
  7392. * @private
  7393. * @param {Array} array The array to reorder.
  7394. * @param {Array} indexes The arranged array indexes.
  7395. * @returns {Array} Returns `array`.
  7396. */
  7397. function reorder(array, indexes) {
  7398. var arrLength = array.length,
  7399. length = nativeMin(indexes.length, arrLength),
  7400. oldArray = copyArray(array);
  7401. while (length--) {
  7402. var index = indexes[length];
  7403. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  7404. }
  7405. return array;
  7406. }
  7407. /**
  7408. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  7409. *
  7410. * @private
  7411. * @param {Object} object The object to query.
  7412. * @param {string} key The key of the property to get.
  7413. * @returns {*} Returns the property value.
  7414. */
  7415. function safeGet(object, key) {
  7416. if (key === 'constructor' && typeof object[key] === 'function') {
  7417. return;
  7418. }
  7419. if (key == '__proto__') {
  7420. return;
  7421. }
  7422. return object[key];
  7423. }
  7424. /**
  7425. * Sets metadata for `func`.
  7426. *
  7427. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  7428. * period of time, it will trip its breaker and transition to an identity
  7429. * function to avoid garbage collection pauses in V8. See
  7430. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  7431. * for more details.
  7432. *
  7433. * @private
  7434. * @param {Function} func The function to associate metadata with.
  7435. * @param {*} data The metadata.
  7436. * @returns {Function} Returns `func`.
  7437. */
  7438. var setData = shortOut(baseSetData);
  7439. /**
  7440. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  7441. *
  7442. * @private
  7443. * @param {Function} func The function to delay.
  7444. * @param {number} wait The number of milliseconds to delay invocation.
  7445. * @returns {number|Object} Returns the timer id or timeout object.
  7446. */
  7447. var setTimeout = ctxSetTimeout || function(func, wait) {
  7448. return root.setTimeout(func, wait);
  7449. };
  7450. /**
  7451. * Sets the `toString` method of `func` to return `string`.
  7452. *
  7453. * @private
  7454. * @param {Function} func The function to modify.
  7455. * @param {Function} string The `toString` result.
  7456. * @returns {Function} Returns `func`.
  7457. */
  7458. var setToString = shortOut(baseSetToString);
  7459. /**
  7460. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  7461. * with wrapper details in a comment at the top of the source body.
  7462. *
  7463. * @private
  7464. * @param {Function} wrapper The function to modify.
  7465. * @param {Function} reference The reference function.
  7466. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  7467. * @returns {Function} Returns `wrapper`.
  7468. */
  7469. function setWrapToString(wrapper, reference, bitmask) {
  7470. var source = (reference + '');
  7471. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  7472. }
  7473. /**
  7474. * Creates a function that'll short out and invoke `identity` instead
  7475. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  7476. * milliseconds.
  7477. *
  7478. * @private
  7479. * @param {Function} func The function to restrict.
  7480. * @returns {Function} Returns the new shortable function.
  7481. */
  7482. function shortOut(func) {
  7483. var count = 0,
  7484. lastCalled = 0;
  7485. return function() {
  7486. var stamp = nativeNow(),
  7487. remaining = HOT_SPAN - (stamp - lastCalled);
  7488. lastCalled = stamp;
  7489. if (remaining > 0) {
  7490. if (++count >= HOT_COUNT) {
  7491. return arguments[0];
  7492. }
  7493. } else {
  7494. count = 0;
  7495. }
  7496. return func.apply(undefined, arguments);
  7497. };
  7498. }
  7499. /**
  7500. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  7501. *
  7502. * @private
  7503. * @param {Array} array The array to shuffle.
  7504. * @param {number} [size=array.length] The size of `array`.
  7505. * @returns {Array} Returns `array`.
  7506. */
  7507. function shuffleSelf(array, size) {
  7508. var index = -1,
  7509. length = array.length,
  7510. lastIndex = length - 1;
  7511. size = size === undefined ? length : size;
  7512. while (++index < size) {
  7513. var rand = baseRandom(index, lastIndex),
  7514. value = array[rand];
  7515. array[rand] = array[index];
  7516. array[index] = value;
  7517. }
  7518. array.length = size;
  7519. return array;
  7520. }
  7521. /**
  7522. * Converts `string` to a property path array.
  7523. *
  7524. * @private
  7525. * @param {string} string The string to convert.
  7526. * @returns {Array} Returns the property path array.
  7527. */
  7528. var stringToPath = memoizeCapped(function(string) {
  7529. var result = [];
  7530. if (string.charCodeAt(0) === 46 /* . */) {
  7531. result.push('');
  7532. }
  7533. string.replace(rePropName, function(match, number, quote, subString) {
  7534. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  7535. });
  7536. return result;
  7537. });
  7538. /**
  7539. * Converts `value` to a string key if it's not a string or symbol.
  7540. *
  7541. * @private
  7542. * @param {*} value The value to inspect.
  7543. * @returns {string|symbol} Returns the key.
  7544. */
  7545. function toKey(value) {
  7546. if (typeof value == 'string' || isSymbol(value)) {
  7547. return value;
  7548. }
  7549. var result = (value + '');
  7550. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  7551. }
  7552. /**
  7553. * Converts `func` to its source code.
  7554. *
  7555. * @private
  7556. * @param {Function} func The function to convert.
  7557. * @returns {string} Returns the source code.
  7558. */
  7559. function toSource(func) {
  7560. if (func != null) {
  7561. try {
  7562. return funcToString.call(func);
  7563. } catch (e) {}
  7564. try {
  7565. return (func + '');
  7566. } catch (e) {}
  7567. }
  7568. return '';
  7569. }
  7570. /**
  7571. * Updates wrapper `details` based on `bitmask` flags.
  7572. *
  7573. * @private
  7574. * @returns {Array} details The details to modify.
  7575. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  7576. * @returns {Array} Returns `details`.
  7577. */
  7578. function updateWrapDetails(details, bitmask) {
  7579. arrayEach(wrapFlags, function(pair) {
  7580. var value = '_.' + pair[0];
  7581. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  7582. details.push(value);
  7583. }
  7584. });
  7585. return details.sort();
  7586. }
  7587. /**
  7588. * Creates a clone of `wrapper`.
  7589. *
  7590. * @private
  7591. * @param {Object} wrapper The wrapper to clone.
  7592. * @returns {Object} Returns the cloned wrapper.
  7593. */
  7594. function wrapperClone(wrapper) {
  7595. if (wrapper instanceof LazyWrapper) {
  7596. return wrapper.clone();
  7597. }
  7598. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  7599. result.__actions__ = copyArray(wrapper.__actions__);
  7600. result.__index__ = wrapper.__index__;
  7601. result.__values__ = wrapper.__values__;
  7602. return result;
  7603. }
  7604. /*------------------------------------------------------------------------*/
  7605. /**
  7606. * Creates an array of elements split into groups the length of `size`.
  7607. * If `array` can't be split evenly, the final chunk will be the remaining
  7608. * elements.
  7609. *
  7610. * @static
  7611. * @memberOf _
  7612. * @since 3.0.0
  7613. * @category Array
  7614. * @param {Array} array The array to process.
  7615. * @param {number} [size=1] The length of each chunk
  7616. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  7617. * @returns {Array} Returns the new array of chunks.
  7618. * @example
  7619. *
  7620. * _.chunk(['a', 'b', 'c', 'd'], 2);
  7621. * // => [['a', 'b'], ['c', 'd']]
  7622. *
  7623. * _.chunk(['a', 'b', 'c', 'd'], 3);
  7624. * // => [['a', 'b', 'c'], ['d']]
  7625. */
  7626. function chunk(array, size, guard) {
  7627. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  7628. size = 1;
  7629. } else {
  7630. size = nativeMax(toInteger(size), 0);
  7631. }
  7632. var length = array == null ? 0 : array.length;
  7633. if (!length || size < 1) {
  7634. return [];
  7635. }
  7636. var index = 0,
  7637. resIndex = 0,
  7638. result = Array(nativeCeil(length / size));
  7639. while (index < length) {
  7640. result[resIndex++] = baseSlice(array, index, (index += size));
  7641. }
  7642. return result;
  7643. }
  7644. /**
  7645. * Creates an array with all falsey values removed. The values `false`, `null`,
  7646. * `0`, `""`, `undefined`, and `NaN` are falsey.
  7647. *
  7648. * @static
  7649. * @memberOf _
  7650. * @since 0.1.0
  7651. * @category Array
  7652. * @param {Array} array The array to compact.
  7653. * @returns {Array} Returns the new array of filtered values.
  7654. * @example
  7655. *
  7656. * _.compact([0, 1, false, 2, '', 3]);
  7657. * // => [1, 2, 3]
  7658. */
  7659. function compact(array) {
  7660. var index = -1,
  7661. length = array == null ? 0 : array.length,
  7662. resIndex = 0,
  7663. result = [];
  7664. while (++index < length) {
  7665. var value = array[index];
  7666. if (value) {
  7667. result[resIndex++] = value;
  7668. }
  7669. }
  7670. return result;
  7671. }
  7672. /**
  7673. * Creates a new array concatenating `array` with any additional arrays
  7674. * and/or values.
  7675. *
  7676. * @static
  7677. * @memberOf _
  7678. * @since 4.0.0
  7679. * @category Array
  7680. * @param {Array} array The array to concatenate.
  7681. * @param {...*} [values] The values to concatenate.
  7682. * @returns {Array} Returns the new concatenated array.
  7683. * @example
  7684. *
  7685. * var array = [1];
  7686. * var other = _.concat(array, 2, [3], [[4]]);
  7687. *
  7688. * console.log(other);
  7689. * // => [1, 2, 3, [4]]
  7690. *
  7691. * console.log(array);
  7692. * // => [1]
  7693. */
  7694. function concat() {
  7695. var length = arguments.length;
  7696. if (!length) {
  7697. return [];
  7698. }
  7699. var args = Array(length - 1),
  7700. array = arguments[0],
  7701. index = length;
  7702. while (index--) {
  7703. args[index - 1] = arguments[index];
  7704. }
  7705. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  7706. }
  7707. /**
  7708. * Creates an array of `array` values not included in the other given arrays
  7709. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  7710. * for equality comparisons. The order and references of result values are
  7711. * determined by the first array.
  7712. *
  7713. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  7714. *
  7715. * @static
  7716. * @memberOf _
  7717. * @since 0.1.0
  7718. * @category Array
  7719. * @param {Array} array The array to inspect.
  7720. * @param {...Array} [values] The values to exclude.
  7721. * @returns {Array} Returns the new array of filtered values.
  7722. * @see _.without, _.xor
  7723. * @example
  7724. *
  7725. * _.difference([2, 1], [2, 3]);
  7726. * // => [1]
  7727. */
  7728. var difference = baseRest(function(array, values) {
  7729. return isArrayLikeObject(array)
  7730. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  7731. : [];
  7732. });
  7733. /**
  7734. * This method is like `_.difference` except that it accepts `iteratee` which
  7735. * is invoked for each element of `array` and `values` to generate the criterion
  7736. * by which they're compared. The order and references of result values are
  7737. * determined by the first array. The iteratee is invoked with one argument:
  7738. * (value).
  7739. *
  7740. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  7741. *
  7742. * @static
  7743. * @memberOf _
  7744. * @since 4.0.0
  7745. * @category Array
  7746. * @param {Array} array The array to inspect.
  7747. * @param {...Array} [values] The values to exclude.
  7748. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  7749. * @returns {Array} Returns the new array of filtered values.
  7750. * @example
  7751. *
  7752. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  7753. * // => [1.2]
  7754. *
  7755. * // The `_.property` iteratee shorthand.
  7756. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  7757. * // => [{ 'x': 2 }]
  7758. */
  7759. var differenceBy = baseRest(function(array, values) {
  7760. var iteratee = last(values);
  7761. if (isArrayLikeObject(iteratee)) {
  7762. iteratee = undefined;
  7763. }
  7764. return isArrayLikeObject(array)
  7765. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  7766. : [];
  7767. });
  7768. /**
  7769. * This method is like `_.difference` except that it accepts `comparator`
  7770. * which is invoked to compare elements of `array` to `values`. The order and
  7771. * references of result values are determined by the first array. The comparator
  7772. * is invoked with two arguments: (arrVal, othVal).
  7773. *
  7774. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  7775. *
  7776. * @static
  7777. * @memberOf _
  7778. * @since 4.0.0
  7779. * @category Array
  7780. * @param {Array} array The array to inspect.
  7781. * @param {...Array} [values] The values to exclude.
  7782. * @param {Function} [comparator] The comparator invoked per element.
  7783. * @returns {Array} Returns the new array of filtered values.
  7784. * @example
  7785. *
  7786. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  7787. *
  7788. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  7789. * // => [{ 'x': 2, 'y': 1 }]
  7790. */
  7791. var differenceWith = baseRest(function(array, values) {
  7792. var comparator = last(values);
  7793. if (isArrayLikeObject(comparator)) {
  7794. comparator = undefined;
  7795. }
  7796. return isArrayLikeObject(array)
  7797. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  7798. : [];
  7799. });
  7800. /**
  7801. * Creates a slice of `array` with `n` elements dropped from the beginning.
  7802. *
  7803. * @static
  7804. * @memberOf _
  7805. * @since 0.5.0
  7806. * @category Array
  7807. * @param {Array} array The array to query.
  7808. * @param {number} [n=1] The number of elements to drop.
  7809. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  7810. * @returns {Array} Returns the slice of `array`.
  7811. * @example
  7812. *
  7813. * _.drop([1, 2, 3]);
  7814. * // => [2, 3]
  7815. *
  7816. * _.drop([1, 2, 3], 2);
  7817. * // => [3]
  7818. *
  7819. * _.drop([1, 2, 3], 5);
  7820. * // => []
  7821. *
  7822. * _.drop([1, 2, 3], 0);
  7823. * // => [1, 2, 3]
  7824. */
  7825. function drop(array, n, guard) {
  7826. var length = array == null ? 0 : array.length;
  7827. if (!length) {
  7828. return [];
  7829. }
  7830. n = (guard || n === undefined) ? 1 : toInteger(n);
  7831. return baseSlice(array, n < 0 ? 0 : n, length);
  7832. }
  7833. /**
  7834. * Creates a slice of `array` with `n` elements dropped from the end.
  7835. *
  7836. * @static
  7837. * @memberOf _
  7838. * @since 3.0.0
  7839. * @category Array
  7840. * @param {Array} array The array to query.
  7841. * @param {number} [n=1] The number of elements to drop.
  7842. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  7843. * @returns {Array} Returns the slice of `array`.
  7844. * @example
  7845. *
  7846. * _.dropRight([1, 2, 3]);
  7847. * // => [1, 2]
  7848. *
  7849. * _.dropRight([1, 2, 3], 2);
  7850. * // => [1]
  7851. *
  7852. * _.dropRight([1, 2, 3], 5);
  7853. * // => []
  7854. *
  7855. * _.dropRight([1, 2, 3], 0);
  7856. * // => [1, 2, 3]
  7857. */
  7858. function dropRight(array, n, guard) {
  7859. var length = array == null ? 0 : array.length;
  7860. if (!length) {
  7861. return [];
  7862. }
  7863. n = (guard || n === undefined) ? 1 : toInteger(n);
  7864. n = length - n;
  7865. return baseSlice(array, 0, n < 0 ? 0 : n);
  7866. }
  7867. /**
  7868. * Creates a slice of `array` excluding elements dropped from the end.
  7869. * Elements are dropped until `predicate` returns falsey. The predicate is
  7870. * invoked with three arguments: (value, index, array).
  7871. *
  7872. * @static
  7873. * @memberOf _
  7874. * @since 3.0.0
  7875. * @category Array
  7876. * @param {Array} array The array to query.
  7877. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7878. * @returns {Array} Returns the slice of `array`.
  7879. * @example
  7880. *
  7881. * var users = [
  7882. * { 'user': 'barney', 'active': true },
  7883. * { 'user': 'fred', 'active': false },
  7884. * { 'user': 'pebbles', 'active': false }
  7885. * ];
  7886. *
  7887. * _.dropRightWhile(users, function(o) { return !o.active; });
  7888. * // => objects for ['barney']
  7889. *
  7890. * // The `_.matches` iteratee shorthand.
  7891. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  7892. * // => objects for ['barney', 'fred']
  7893. *
  7894. * // The `_.matchesProperty` iteratee shorthand.
  7895. * _.dropRightWhile(users, ['active', false]);
  7896. * // => objects for ['barney']
  7897. *
  7898. * // The `_.property` iteratee shorthand.
  7899. * _.dropRightWhile(users, 'active');
  7900. * // => objects for ['barney', 'fred', 'pebbles']
  7901. */
  7902. function dropRightWhile(array, predicate) {
  7903. return (array && array.length)
  7904. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  7905. : [];
  7906. }
  7907. /**
  7908. * Creates a slice of `array` excluding elements dropped from the beginning.
  7909. * Elements are dropped until `predicate` returns falsey. The predicate is
  7910. * invoked with three arguments: (value, index, array).
  7911. *
  7912. * @static
  7913. * @memberOf _
  7914. * @since 3.0.0
  7915. * @category Array
  7916. * @param {Array} array The array to query.
  7917. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7918. * @returns {Array} Returns the slice of `array`.
  7919. * @example
  7920. *
  7921. * var users = [
  7922. * { 'user': 'barney', 'active': false },
  7923. * { 'user': 'fred', 'active': false },
  7924. * { 'user': 'pebbles', 'active': true }
  7925. * ];
  7926. *
  7927. * _.dropWhile(users, function(o) { return !o.active; });
  7928. * // => objects for ['pebbles']
  7929. *
  7930. * // The `_.matches` iteratee shorthand.
  7931. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  7932. * // => objects for ['fred', 'pebbles']
  7933. *
  7934. * // The `_.matchesProperty` iteratee shorthand.
  7935. * _.dropWhile(users, ['active', false]);
  7936. * // => objects for ['pebbles']
  7937. *
  7938. * // The `_.property` iteratee shorthand.
  7939. * _.dropWhile(users, 'active');
  7940. * // => objects for ['barney', 'fred', 'pebbles']
  7941. */
  7942. function dropWhile(array, predicate) {
  7943. return (array && array.length)
  7944. ? baseWhile(array, getIteratee(predicate, 3), true)
  7945. : [];
  7946. }
  7947. /**
  7948. * Fills elements of `array` with `value` from `start` up to, but not
  7949. * including, `end`.
  7950. *
  7951. * **Note:** This method mutates `array`.
  7952. *
  7953. * @static
  7954. * @memberOf _
  7955. * @since 3.2.0
  7956. * @category Array
  7957. * @param {Array} array The array to fill.
  7958. * @param {*} value The value to fill `array` with.
  7959. * @param {number} [start=0] The start position.
  7960. * @param {number} [end=array.length] The end position.
  7961. * @returns {Array} Returns `array`.
  7962. * @example
  7963. *
  7964. * var array = [1, 2, 3];
  7965. *
  7966. * _.fill(array, 'a');
  7967. * console.log(array);
  7968. * // => ['a', 'a', 'a']
  7969. *
  7970. * _.fill(Array(3), 2);
  7971. * // => [2, 2, 2]
  7972. *
  7973. * _.fill([4, 6, 8, 10], '*', 1, 3);
  7974. * // => [4, '*', '*', 10]
  7975. */
  7976. function fill(array, value, start, end) {
  7977. var length = array == null ? 0 : array.length;
  7978. if (!length) {
  7979. return [];
  7980. }
  7981. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  7982. start = 0;
  7983. end = length;
  7984. }
  7985. return baseFill(array, value, start, end);
  7986. }
  7987. /**
  7988. * This method is like `_.find` except that it returns the index of the first
  7989. * element `predicate` returns truthy for instead of the element itself.
  7990. *
  7991. * @static
  7992. * @memberOf _
  7993. * @since 1.1.0
  7994. * @category Array
  7995. * @param {Array} array The array to inspect.
  7996. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7997. * @param {number} [fromIndex=0] The index to search from.
  7998. * @returns {number} Returns the index of the found element, else `-1`.
  7999. * @example
  8000. *
  8001. * var users = [
  8002. * { 'user': 'barney', 'active': false },
  8003. * { 'user': 'fred', 'active': false },
  8004. * { 'user': 'pebbles', 'active': true }
  8005. * ];
  8006. *
  8007. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  8008. * // => 0
  8009. *
  8010. * // The `_.matches` iteratee shorthand.
  8011. * _.findIndex(users, { 'user': 'fred', 'active': false });
  8012. * // => 1
  8013. *
  8014. * // The `_.matchesProperty` iteratee shorthand.
  8015. * _.findIndex(users, ['active', false]);
  8016. * // => 0
  8017. *
  8018. * // The `_.property` iteratee shorthand.
  8019. * _.findIndex(users, 'active');
  8020. * // => 2
  8021. */
  8022. function findIndex(array, predicate, fromIndex) {
  8023. var length = array == null ? 0 : array.length;
  8024. if (!length) {
  8025. return -1;
  8026. }
  8027. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  8028. if (index < 0) {
  8029. index = nativeMax(length + index, 0);
  8030. }
  8031. return baseFindIndex(array, getIteratee(predicate, 3), index);
  8032. }
  8033. /**
  8034. * This method is like `_.findIndex` except that it iterates over elements
  8035. * of `collection` from right to left.
  8036. *
  8037. * @static
  8038. * @memberOf _
  8039. * @since 2.0.0
  8040. * @category Array
  8041. * @param {Array} array The array to inspect.
  8042. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8043. * @param {number} [fromIndex=array.length-1] The index to search from.
  8044. * @returns {number} Returns the index of the found element, else `-1`.
  8045. * @example
  8046. *
  8047. * var users = [
  8048. * { 'user': 'barney', 'active': true },
  8049. * { 'user': 'fred', 'active': false },
  8050. * { 'user': 'pebbles', 'active': false }
  8051. * ];
  8052. *
  8053. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  8054. * // => 2
  8055. *
  8056. * // The `_.matches` iteratee shorthand.
  8057. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  8058. * // => 0
  8059. *
  8060. * // The `_.matchesProperty` iteratee shorthand.
  8061. * _.findLastIndex(users, ['active', false]);
  8062. * // => 2
  8063. *
  8064. * // The `_.property` iteratee shorthand.
  8065. * _.findLastIndex(users, 'active');
  8066. * // => 0
  8067. */
  8068. function findLastIndex(array, predicate, fromIndex) {
  8069. var length = array == null ? 0 : array.length;
  8070. if (!length) {
  8071. return -1;
  8072. }
  8073. var index = length - 1;
  8074. if (fromIndex !== undefined) {
  8075. index = toInteger(fromIndex);
  8076. index = fromIndex < 0
  8077. ? nativeMax(length + index, 0)
  8078. : nativeMin(index, length - 1);
  8079. }
  8080. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  8081. }
  8082. /**
  8083. * Flattens `array` a single level deep.
  8084. *
  8085. * @static
  8086. * @memberOf _
  8087. * @since 0.1.0
  8088. * @category Array
  8089. * @param {Array} array The array to flatten.
  8090. * @returns {Array} Returns the new flattened array.
  8091. * @example
  8092. *
  8093. * _.flatten([1, [2, [3, [4]], 5]]);
  8094. * // => [1, 2, [3, [4]], 5]
  8095. */
  8096. function flatten(array) {
  8097. var length = array == null ? 0 : array.length;
  8098. return length ? baseFlatten(array, 1) : [];
  8099. }
  8100. /**
  8101. * Recursively flattens `array`.
  8102. *
  8103. * @static
  8104. * @memberOf _
  8105. * @since 3.0.0
  8106. * @category Array
  8107. * @param {Array} array The array to flatten.
  8108. * @returns {Array} Returns the new flattened array.
  8109. * @example
  8110. *
  8111. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  8112. * // => [1, 2, 3, 4, 5]
  8113. */
  8114. function flattenDeep(array) {
  8115. var length = array == null ? 0 : array.length;
  8116. return length ? baseFlatten(array, INFINITY) : [];
  8117. }
  8118. /**
  8119. * Recursively flatten `array` up to `depth` times.
  8120. *
  8121. * @static
  8122. * @memberOf _
  8123. * @since 4.4.0
  8124. * @category Array
  8125. * @param {Array} array The array to flatten.
  8126. * @param {number} [depth=1] The maximum recursion depth.
  8127. * @returns {Array} Returns the new flattened array.
  8128. * @example
  8129. *
  8130. * var array = [1, [2, [3, [4]], 5]];
  8131. *
  8132. * _.flattenDepth(array, 1);
  8133. * // => [1, 2, [3, [4]], 5]
  8134. *
  8135. * _.flattenDepth(array, 2);
  8136. * // => [1, 2, 3, [4], 5]
  8137. */
  8138. function flattenDepth(array, depth) {
  8139. var length = array == null ? 0 : array.length;
  8140. if (!length) {
  8141. return [];
  8142. }
  8143. depth = depth === undefined ? 1 : toInteger(depth);
  8144. return baseFlatten(array, depth);
  8145. }
  8146. /**
  8147. * The inverse of `_.toPairs`; this method returns an object composed
  8148. * from key-value `pairs`.
  8149. *
  8150. * @static
  8151. * @memberOf _
  8152. * @since 4.0.0
  8153. * @category Array
  8154. * @param {Array} pairs The key-value pairs.
  8155. * @returns {Object} Returns the new object.
  8156. * @example
  8157. *
  8158. * _.fromPairs([['a', 1], ['b', 2]]);
  8159. * // => { 'a': 1, 'b': 2 }
  8160. */
  8161. function fromPairs(pairs) {
  8162. var index = -1,
  8163. length = pairs == null ? 0 : pairs.length,
  8164. result = {};
  8165. while (++index < length) {
  8166. var pair = pairs[index];
  8167. result[pair[0]] = pair[1];
  8168. }
  8169. return result;
  8170. }
  8171. /**
  8172. * Gets the first element of `array`.
  8173. *
  8174. * @static
  8175. * @memberOf _
  8176. * @since 0.1.0
  8177. * @alias first
  8178. * @category Array
  8179. * @param {Array} array The array to query.
  8180. * @returns {*} Returns the first element of `array`.
  8181. * @example
  8182. *
  8183. * _.head([1, 2, 3]);
  8184. * // => 1
  8185. *
  8186. * _.head([]);
  8187. * // => undefined
  8188. */
  8189. function head(array) {
  8190. return (array && array.length) ? array[0] : undefined;
  8191. }
  8192. /**
  8193. * Gets the index at which the first occurrence of `value` is found in `array`
  8194. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8195. * for equality comparisons. If `fromIndex` is negative, it's used as the
  8196. * offset from the end of `array`.
  8197. *
  8198. * @static
  8199. * @memberOf _
  8200. * @since 0.1.0
  8201. * @category Array
  8202. * @param {Array} array The array to inspect.
  8203. * @param {*} value The value to search for.
  8204. * @param {number} [fromIndex=0] The index to search from.
  8205. * @returns {number} Returns the index of the matched value, else `-1`.
  8206. * @example
  8207. *
  8208. * _.indexOf([1, 2, 1, 2], 2);
  8209. * // => 1
  8210. *
  8211. * // Search from the `fromIndex`.
  8212. * _.indexOf([1, 2, 1, 2], 2, 2);
  8213. * // => 3
  8214. */
  8215. function indexOf(array, value, fromIndex) {
  8216. var length = array == null ? 0 : array.length;
  8217. if (!length) {
  8218. return -1;
  8219. }
  8220. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  8221. if (index < 0) {
  8222. index = nativeMax(length + index, 0);
  8223. }
  8224. return baseIndexOf(array, value, index);
  8225. }
  8226. /**
  8227. * Gets all but the last element of `array`.
  8228. *
  8229. * @static
  8230. * @memberOf _
  8231. * @since 0.1.0
  8232. * @category Array
  8233. * @param {Array} array The array to query.
  8234. * @returns {Array} Returns the slice of `array`.
  8235. * @example
  8236. *
  8237. * _.initial([1, 2, 3]);
  8238. * // => [1, 2]
  8239. */
  8240. function initial(array) {
  8241. var length = array == null ? 0 : array.length;
  8242. return length ? baseSlice(array, 0, -1) : [];
  8243. }
  8244. /**
  8245. * Creates an array of unique values that are included in all given arrays
  8246. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8247. * for equality comparisons. The order and references of result values are
  8248. * determined by the first array.
  8249. *
  8250. * @static
  8251. * @memberOf _
  8252. * @since 0.1.0
  8253. * @category Array
  8254. * @param {...Array} [arrays] The arrays to inspect.
  8255. * @returns {Array} Returns the new array of intersecting values.
  8256. * @example
  8257. *
  8258. * _.intersection([2, 1], [2, 3]);
  8259. * // => [2]
  8260. */
  8261. var intersection = baseRest(function(arrays) {
  8262. var mapped = arrayMap(arrays, castArrayLikeObject);
  8263. return (mapped.length && mapped[0] === arrays[0])
  8264. ? baseIntersection(mapped)
  8265. : [];
  8266. });
  8267. /**
  8268. * This method is like `_.intersection` except that it accepts `iteratee`
  8269. * which is invoked for each element of each `arrays` to generate the criterion
  8270. * by which they're compared. The order and references of result values are
  8271. * determined by the first array. The iteratee is invoked with one argument:
  8272. * (value).
  8273. *
  8274. * @static
  8275. * @memberOf _
  8276. * @since 4.0.0
  8277. * @category Array
  8278. * @param {...Array} [arrays] The arrays to inspect.
  8279. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8280. * @returns {Array} Returns the new array of intersecting values.
  8281. * @example
  8282. *
  8283. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  8284. * // => [2.1]
  8285. *
  8286. * // The `_.property` iteratee shorthand.
  8287. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  8288. * // => [{ 'x': 1 }]
  8289. */
  8290. var intersectionBy = baseRest(function(arrays) {
  8291. var iteratee = last(arrays),
  8292. mapped = arrayMap(arrays, castArrayLikeObject);
  8293. if (iteratee === last(mapped)) {
  8294. iteratee = undefined;
  8295. } else {
  8296. mapped.pop();
  8297. }
  8298. return (mapped.length && mapped[0] === arrays[0])
  8299. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  8300. : [];
  8301. });
  8302. /**
  8303. * This method is like `_.intersection` except that it accepts `comparator`
  8304. * which is invoked to compare elements of `arrays`. The order and references
  8305. * of result values are determined by the first array. The comparator is
  8306. * invoked with two arguments: (arrVal, othVal).
  8307. *
  8308. * @static
  8309. * @memberOf _
  8310. * @since 4.0.0
  8311. * @category Array
  8312. * @param {...Array} [arrays] The arrays to inspect.
  8313. * @param {Function} [comparator] The comparator invoked per element.
  8314. * @returns {Array} Returns the new array of intersecting values.
  8315. * @example
  8316. *
  8317. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  8318. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  8319. *
  8320. * _.intersectionWith(objects, others, _.isEqual);
  8321. * // => [{ 'x': 1, 'y': 2 }]
  8322. */
  8323. var intersectionWith = baseRest(function(arrays) {
  8324. var comparator = last(arrays),
  8325. mapped = arrayMap(arrays, castArrayLikeObject);
  8326. comparator = typeof comparator == 'function' ? comparator : undefined;
  8327. if (comparator) {
  8328. mapped.pop();
  8329. }
  8330. return (mapped.length && mapped[0] === arrays[0])
  8331. ? baseIntersection(mapped, undefined, comparator)
  8332. : [];
  8333. });
  8334. /**
  8335. * Converts all elements in `array` into a string separated by `separator`.
  8336. *
  8337. * @static
  8338. * @memberOf _
  8339. * @since 4.0.0
  8340. * @category Array
  8341. * @param {Array} array The array to convert.
  8342. * @param {string} [separator=','] The element separator.
  8343. * @returns {string} Returns the joined string.
  8344. * @example
  8345. *
  8346. * _.join(['a', 'b', 'c'], '~');
  8347. * // => 'a~b~c'
  8348. */
  8349. function join(array, separator) {
  8350. return array == null ? '' : nativeJoin.call(array, separator);
  8351. }
  8352. /**
  8353. * Gets the last element of `array`.
  8354. *
  8355. * @static
  8356. * @memberOf _
  8357. * @since 0.1.0
  8358. * @category Array
  8359. * @param {Array} array The array to query.
  8360. * @returns {*} Returns the last element of `array`.
  8361. * @example
  8362. *
  8363. * _.last([1, 2, 3]);
  8364. * // => 3
  8365. */
  8366. function last(array) {
  8367. var length = array == null ? 0 : array.length;
  8368. return length ? array[length - 1] : undefined;
  8369. }
  8370. /**
  8371. * This method is like `_.indexOf` except that it iterates over elements of
  8372. * `array` from right to left.
  8373. *
  8374. * @static
  8375. * @memberOf _
  8376. * @since 0.1.0
  8377. * @category Array
  8378. * @param {Array} array The array to inspect.
  8379. * @param {*} value The value to search for.
  8380. * @param {number} [fromIndex=array.length-1] The index to search from.
  8381. * @returns {number} Returns the index of the matched value, else `-1`.
  8382. * @example
  8383. *
  8384. * _.lastIndexOf([1, 2, 1, 2], 2);
  8385. * // => 3
  8386. *
  8387. * // Search from the `fromIndex`.
  8388. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  8389. * // => 1
  8390. */
  8391. function lastIndexOf(array, value, fromIndex) {
  8392. var length = array == null ? 0 : array.length;
  8393. if (!length) {
  8394. return -1;
  8395. }
  8396. var index = length;
  8397. if (fromIndex !== undefined) {
  8398. index = toInteger(fromIndex);
  8399. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  8400. }
  8401. return value === value
  8402. ? strictLastIndexOf(array, value, index)
  8403. : baseFindIndex(array, baseIsNaN, index, true);
  8404. }
  8405. /**
  8406. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  8407. * element from the end is returned.
  8408. *
  8409. * @static
  8410. * @memberOf _
  8411. * @since 4.11.0
  8412. * @category Array
  8413. * @param {Array} array The array to query.
  8414. * @param {number} [n=0] The index of the element to return.
  8415. * @returns {*} Returns the nth element of `array`.
  8416. * @example
  8417. *
  8418. * var array = ['a', 'b', 'c', 'd'];
  8419. *
  8420. * _.nth(array, 1);
  8421. * // => 'b'
  8422. *
  8423. * _.nth(array, -2);
  8424. * // => 'c';
  8425. */
  8426. function nth(array, n) {
  8427. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  8428. }
  8429. /**
  8430. * Removes all given values from `array` using
  8431. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8432. * for equality comparisons.
  8433. *
  8434. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  8435. * to remove elements from an array by predicate.
  8436. *
  8437. * @static
  8438. * @memberOf _
  8439. * @since 2.0.0
  8440. * @category Array
  8441. * @param {Array} array The array to modify.
  8442. * @param {...*} [values] The values to remove.
  8443. * @returns {Array} Returns `array`.
  8444. * @example
  8445. *
  8446. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  8447. *
  8448. * _.pull(array, 'a', 'c');
  8449. * console.log(array);
  8450. * // => ['b', 'b']
  8451. */
  8452. var pull = baseRest(pullAll);
  8453. /**
  8454. * This method is like `_.pull` except that it accepts an array of values to remove.
  8455. *
  8456. * **Note:** Unlike `_.difference`, this method mutates `array`.
  8457. *
  8458. * @static
  8459. * @memberOf _
  8460. * @since 4.0.0
  8461. * @category Array
  8462. * @param {Array} array The array to modify.
  8463. * @param {Array} values The values to remove.
  8464. * @returns {Array} Returns `array`.
  8465. * @example
  8466. *
  8467. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  8468. *
  8469. * _.pullAll(array, ['a', 'c']);
  8470. * console.log(array);
  8471. * // => ['b', 'b']
  8472. */
  8473. function pullAll(array, values) {
  8474. return (array && array.length && values && values.length)
  8475. ? basePullAll(array, values)
  8476. : array;
  8477. }
  8478. /**
  8479. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  8480. * invoked for each element of `array` and `values` to generate the criterion
  8481. * by which they're compared. The iteratee is invoked with one argument: (value).
  8482. *
  8483. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  8484. *
  8485. * @static
  8486. * @memberOf _
  8487. * @since 4.0.0
  8488. * @category Array
  8489. * @param {Array} array The array to modify.
  8490. * @param {Array} values The values to remove.
  8491. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8492. * @returns {Array} Returns `array`.
  8493. * @example
  8494. *
  8495. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  8496. *
  8497. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  8498. * console.log(array);
  8499. * // => [{ 'x': 2 }]
  8500. */
  8501. function pullAllBy(array, values, iteratee) {
  8502. return (array && array.length && values && values.length)
  8503. ? basePullAll(array, values, getIteratee(iteratee, 2))
  8504. : array;
  8505. }
  8506. /**
  8507. * This method is like `_.pullAll` except that it accepts `comparator` which
  8508. * is invoked to compare elements of `array` to `values`. The comparator is
  8509. * invoked with two arguments: (arrVal, othVal).
  8510. *
  8511. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  8512. *
  8513. * @static
  8514. * @memberOf _
  8515. * @since 4.6.0
  8516. * @category Array
  8517. * @param {Array} array The array to modify.
  8518. * @param {Array} values The values to remove.
  8519. * @param {Function} [comparator] The comparator invoked per element.
  8520. * @returns {Array} Returns `array`.
  8521. * @example
  8522. *
  8523. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  8524. *
  8525. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  8526. * console.log(array);
  8527. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  8528. */
  8529. function pullAllWith(array, values, comparator) {
  8530. return (array && array.length && values && values.length)
  8531. ? basePullAll(array, values, undefined, comparator)
  8532. : array;
  8533. }
  8534. /**
  8535. * Removes elements from `array` corresponding to `indexes` and returns an
  8536. * array of removed elements.
  8537. *
  8538. * **Note:** Unlike `_.at`, this method mutates `array`.
  8539. *
  8540. * @static
  8541. * @memberOf _
  8542. * @since 3.0.0
  8543. * @category Array
  8544. * @param {Array} array The array to modify.
  8545. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  8546. * @returns {Array} Returns the new array of removed elements.
  8547. * @example
  8548. *
  8549. * var array = ['a', 'b', 'c', 'd'];
  8550. * var pulled = _.pullAt(array, [1, 3]);
  8551. *
  8552. * console.log(array);
  8553. * // => ['a', 'c']
  8554. *
  8555. * console.log(pulled);
  8556. * // => ['b', 'd']
  8557. */
  8558. var pullAt = flatRest(function(array, indexes) {
  8559. var length = array == null ? 0 : array.length,
  8560. result = baseAt(array, indexes);
  8561. basePullAt(array, arrayMap(indexes, function(index) {
  8562. return isIndex(index, length) ? +index : index;
  8563. }).sort(compareAscending));
  8564. return result;
  8565. });
  8566. /**
  8567. * Removes all elements from `array` that `predicate` returns truthy for
  8568. * and returns an array of the removed elements. The predicate is invoked
  8569. * with three arguments: (value, index, array).
  8570. *
  8571. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  8572. * to pull elements from an array by value.
  8573. *
  8574. * @static
  8575. * @memberOf _
  8576. * @since 2.0.0
  8577. * @category Array
  8578. * @param {Array} array The array to modify.
  8579. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8580. * @returns {Array} Returns the new array of removed elements.
  8581. * @example
  8582. *
  8583. * var array = [1, 2, 3, 4];
  8584. * var evens = _.remove(array, function(n) {
  8585. * return n % 2 == 0;
  8586. * });
  8587. *
  8588. * console.log(array);
  8589. * // => [1, 3]
  8590. *
  8591. * console.log(evens);
  8592. * // => [2, 4]
  8593. */
  8594. function remove(array, predicate) {
  8595. var result = [];
  8596. if (!(array && array.length)) {
  8597. return result;
  8598. }
  8599. var index = -1,
  8600. indexes = [],
  8601. length = array.length;
  8602. predicate = getIteratee(predicate, 3);
  8603. while (++index < length) {
  8604. var value = array[index];
  8605. if (predicate(value, index, array)) {
  8606. result.push(value);
  8607. indexes.push(index);
  8608. }
  8609. }
  8610. basePullAt(array, indexes);
  8611. return result;
  8612. }
  8613. /**
  8614. * Reverses `array` so that the first element becomes the last, the second
  8615. * element becomes the second to last, and so on.
  8616. *
  8617. * **Note:** This method mutates `array` and is based on
  8618. * [`Array#reverse`](https://mdn.io/Array/reverse).
  8619. *
  8620. * @static
  8621. * @memberOf _
  8622. * @since 4.0.0
  8623. * @category Array
  8624. * @param {Array} array The array to modify.
  8625. * @returns {Array} Returns `array`.
  8626. * @example
  8627. *
  8628. * var array = [1, 2, 3];
  8629. *
  8630. * _.reverse(array);
  8631. * // => [3, 2, 1]
  8632. *
  8633. * console.log(array);
  8634. * // => [3, 2, 1]
  8635. */
  8636. function reverse(array) {
  8637. return array == null ? array : nativeReverse.call(array);
  8638. }
  8639. /**
  8640. * Creates a slice of `array` from `start` up to, but not including, `end`.
  8641. *
  8642. * **Note:** This method is used instead of
  8643. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  8644. * returned.
  8645. *
  8646. * @static
  8647. * @memberOf _
  8648. * @since 3.0.0
  8649. * @category Array
  8650. * @param {Array} array The array to slice.
  8651. * @param {number} [start=0] The start position.
  8652. * @param {number} [end=array.length] The end position.
  8653. * @returns {Array} Returns the slice of `array`.
  8654. */
  8655. function slice(array, start, end) {
  8656. var length = array == null ? 0 : array.length;
  8657. if (!length) {
  8658. return [];
  8659. }
  8660. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  8661. start = 0;
  8662. end = length;
  8663. }
  8664. else {
  8665. start = start == null ? 0 : toInteger(start);
  8666. end = end === undefined ? length : toInteger(end);
  8667. }
  8668. return baseSlice(array, start, end);
  8669. }
  8670. /**
  8671. * Uses a binary search to determine the lowest index at which `value`
  8672. * should be inserted into `array` in order to maintain its sort order.
  8673. *
  8674. * @static
  8675. * @memberOf _
  8676. * @since 0.1.0
  8677. * @category Array
  8678. * @param {Array} array The sorted array to inspect.
  8679. * @param {*} value The value to evaluate.
  8680. * @returns {number} Returns the index at which `value` should be inserted
  8681. * into `array`.
  8682. * @example
  8683. *
  8684. * _.sortedIndex([30, 50], 40);
  8685. * // => 1
  8686. */
  8687. function sortedIndex(array, value) {
  8688. return baseSortedIndex(array, value);
  8689. }
  8690. /**
  8691. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  8692. * which is invoked for `value` and each element of `array` to compute their
  8693. * sort ranking. The iteratee is invoked with one argument: (value).
  8694. *
  8695. * @static
  8696. * @memberOf _
  8697. * @since 4.0.0
  8698. * @category Array
  8699. * @param {Array} array The sorted array to inspect.
  8700. * @param {*} value The value to evaluate.
  8701. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8702. * @returns {number} Returns the index at which `value` should be inserted
  8703. * into `array`.
  8704. * @example
  8705. *
  8706. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  8707. *
  8708. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  8709. * // => 0
  8710. *
  8711. * // The `_.property` iteratee shorthand.
  8712. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  8713. * // => 0
  8714. */
  8715. function sortedIndexBy(array, value, iteratee) {
  8716. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  8717. }
  8718. /**
  8719. * This method is like `_.indexOf` except that it performs a binary
  8720. * search on a sorted `array`.
  8721. *
  8722. * @static
  8723. * @memberOf _
  8724. * @since 4.0.0
  8725. * @category Array
  8726. * @param {Array} array The array to inspect.
  8727. * @param {*} value The value to search for.
  8728. * @returns {number} Returns the index of the matched value, else `-1`.
  8729. * @example
  8730. *
  8731. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  8732. * // => 1
  8733. */
  8734. function sortedIndexOf(array, value) {
  8735. var length = array == null ? 0 : array.length;
  8736. if (length) {
  8737. var index = baseSortedIndex(array, value);
  8738. if (index < length && eq(array[index], value)) {
  8739. return index;
  8740. }
  8741. }
  8742. return -1;
  8743. }
  8744. /**
  8745. * This method is like `_.sortedIndex` except that it returns the highest
  8746. * index at which `value` should be inserted into `array` in order to
  8747. * maintain its sort order.
  8748. *
  8749. * @static
  8750. * @memberOf _
  8751. * @since 3.0.0
  8752. * @category Array
  8753. * @param {Array} array The sorted array to inspect.
  8754. * @param {*} value The value to evaluate.
  8755. * @returns {number} Returns the index at which `value` should be inserted
  8756. * into `array`.
  8757. * @example
  8758. *
  8759. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  8760. * // => 4
  8761. */
  8762. function sortedLastIndex(array, value) {
  8763. return baseSortedIndex(array, value, true);
  8764. }
  8765. /**
  8766. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  8767. * which is invoked for `value` and each element of `array` to compute their
  8768. * sort ranking. The iteratee is invoked with one argument: (value).
  8769. *
  8770. * @static
  8771. * @memberOf _
  8772. * @since 4.0.0
  8773. * @category Array
  8774. * @param {Array} array The sorted array to inspect.
  8775. * @param {*} value The value to evaluate.
  8776. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8777. * @returns {number} Returns the index at which `value` should be inserted
  8778. * into `array`.
  8779. * @example
  8780. *
  8781. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  8782. *
  8783. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  8784. * // => 1
  8785. *
  8786. * // The `_.property` iteratee shorthand.
  8787. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  8788. * // => 1
  8789. */
  8790. function sortedLastIndexBy(array, value, iteratee) {
  8791. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  8792. }
  8793. /**
  8794. * This method is like `_.lastIndexOf` except that it performs a binary
  8795. * search on a sorted `array`.
  8796. *
  8797. * @static
  8798. * @memberOf _
  8799. * @since 4.0.0
  8800. * @category Array
  8801. * @param {Array} array The array to inspect.
  8802. * @param {*} value The value to search for.
  8803. * @returns {number} Returns the index of the matched value, else `-1`.
  8804. * @example
  8805. *
  8806. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  8807. * // => 3
  8808. */
  8809. function sortedLastIndexOf(array, value) {
  8810. var length = array == null ? 0 : array.length;
  8811. if (length) {
  8812. var index = baseSortedIndex(array, value, true) - 1;
  8813. if (eq(array[index], value)) {
  8814. return index;
  8815. }
  8816. }
  8817. return -1;
  8818. }
  8819. /**
  8820. * This method is like `_.uniq` except that it's designed and optimized
  8821. * for sorted arrays.
  8822. *
  8823. * @static
  8824. * @memberOf _
  8825. * @since 4.0.0
  8826. * @category Array
  8827. * @param {Array} array The array to inspect.
  8828. * @returns {Array} Returns the new duplicate free array.
  8829. * @example
  8830. *
  8831. * _.sortedUniq([1, 1, 2]);
  8832. * // => [1, 2]
  8833. */
  8834. function sortedUniq(array) {
  8835. return (array && array.length)
  8836. ? baseSortedUniq(array)
  8837. : [];
  8838. }
  8839. /**
  8840. * This method is like `_.uniqBy` except that it's designed and optimized
  8841. * for sorted arrays.
  8842. *
  8843. * @static
  8844. * @memberOf _
  8845. * @since 4.0.0
  8846. * @category Array
  8847. * @param {Array} array The array to inspect.
  8848. * @param {Function} [iteratee] The iteratee invoked per element.
  8849. * @returns {Array} Returns the new duplicate free array.
  8850. * @example
  8851. *
  8852. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  8853. * // => [1.1, 2.3]
  8854. */
  8855. function sortedUniqBy(array, iteratee) {
  8856. return (array && array.length)
  8857. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  8858. : [];
  8859. }
  8860. /**
  8861. * Gets all but the first element of `array`.
  8862. *
  8863. * @static
  8864. * @memberOf _
  8865. * @since 4.0.0
  8866. * @category Array
  8867. * @param {Array} array The array to query.
  8868. * @returns {Array} Returns the slice of `array`.
  8869. * @example
  8870. *
  8871. * _.tail([1, 2, 3]);
  8872. * // => [2, 3]
  8873. */
  8874. function tail(array) {
  8875. var length = array == null ? 0 : array.length;
  8876. return length ? baseSlice(array, 1, length) : [];
  8877. }
  8878. /**
  8879. * Creates a slice of `array` with `n` elements taken from the beginning.
  8880. *
  8881. * @static
  8882. * @memberOf _
  8883. * @since 0.1.0
  8884. * @category Array
  8885. * @param {Array} array The array to query.
  8886. * @param {number} [n=1] The number of elements to take.
  8887. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8888. * @returns {Array} Returns the slice of `array`.
  8889. * @example
  8890. *
  8891. * _.take([1, 2, 3]);
  8892. * // => [1]
  8893. *
  8894. * _.take([1, 2, 3], 2);
  8895. * // => [1, 2]
  8896. *
  8897. * _.take([1, 2, 3], 5);
  8898. * // => [1, 2, 3]
  8899. *
  8900. * _.take([1, 2, 3], 0);
  8901. * // => []
  8902. */
  8903. function take(array, n, guard) {
  8904. if (!(array && array.length)) {
  8905. return [];
  8906. }
  8907. n = (guard || n === undefined) ? 1 : toInteger(n);
  8908. return baseSlice(array, 0, n < 0 ? 0 : n);
  8909. }
  8910. /**
  8911. * Creates a slice of `array` with `n` elements taken from the end.
  8912. *
  8913. * @static
  8914. * @memberOf _
  8915. * @since 3.0.0
  8916. * @category Array
  8917. * @param {Array} array The array to query.
  8918. * @param {number} [n=1] The number of elements to take.
  8919. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8920. * @returns {Array} Returns the slice of `array`.
  8921. * @example
  8922. *
  8923. * _.takeRight([1, 2, 3]);
  8924. * // => [3]
  8925. *
  8926. * _.takeRight([1, 2, 3], 2);
  8927. * // => [2, 3]
  8928. *
  8929. * _.takeRight([1, 2, 3], 5);
  8930. * // => [1, 2, 3]
  8931. *
  8932. * _.takeRight([1, 2, 3], 0);
  8933. * // => []
  8934. */
  8935. function takeRight(array, n, guard) {
  8936. var length = array == null ? 0 : array.length;
  8937. if (!length) {
  8938. return [];
  8939. }
  8940. n = (guard || n === undefined) ? 1 : toInteger(n);
  8941. n = length - n;
  8942. return baseSlice(array, n < 0 ? 0 : n, length);
  8943. }
  8944. /**
  8945. * Creates a slice of `array` with elements taken from the end. Elements are
  8946. * taken until `predicate` returns falsey. The predicate is invoked with
  8947. * three arguments: (value, index, array).
  8948. *
  8949. * @static
  8950. * @memberOf _
  8951. * @since 3.0.0
  8952. * @category Array
  8953. * @param {Array} array The array to query.
  8954. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8955. * @returns {Array} Returns the slice of `array`.
  8956. * @example
  8957. *
  8958. * var users = [
  8959. * { 'user': 'barney', 'active': true },
  8960. * { 'user': 'fred', 'active': false },
  8961. * { 'user': 'pebbles', 'active': false }
  8962. * ];
  8963. *
  8964. * _.takeRightWhile(users, function(o) { return !o.active; });
  8965. * // => objects for ['fred', 'pebbles']
  8966. *
  8967. * // The `_.matches` iteratee shorthand.
  8968. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  8969. * // => objects for ['pebbles']
  8970. *
  8971. * // The `_.matchesProperty` iteratee shorthand.
  8972. * _.takeRightWhile(users, ['active', false]);
  8973. * // => objects for ['fred', 'pebbles']
  8974. *
  8975. * // The `_.property` iteratee shorthand.
  8976. * _.takeRightWhile(users, 'active');
  8977. * // => []
  8978. */
  8979. function takeRightWhile(array, predicate) {
  8980. return (array && array.length)
  8981. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  8982. : [];
  8983. }
  8984. /**
  8985. * Creates a slice of `array` with elements taken from the beginning. Elements
  8986. * are taken until `predicate` returns falsey. The predicate is invoked with
  8987. * three arguments: (value, index, array).
  8988. *
  8989. * @static
  8990. * @memberOf _
  8991. * @since 3.0.0
  8992. * @category Array
  8993. * @param {Array} array The array to query.
  8994. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8995. * @returns {Array} Returns the slice of `array`.
  8996. * @example
  8997. *
  8998. * var users = [
  8999. * { 'user': 'barney', 'active': false },
  9000. * { 'user': 'fred', 'active': false },
  9001. * { 'user': 'pebbles', 'active': true }
  9002. * ];
  9003. *
  9004. * _.takeWhile(users, function(o) { return !o.active; });
  9005. * // => objects for ['barney', 'fred']
  9006. *
  9007. * // The `_.matches` iteratee shorthand.
  9008. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  9009. * // => objects for ['barney']
  9010. *
  9011. * // The `_.matchesProperty` iteratee shorthand.
  9012. * _.takeWhile(users, ['active', false]);
  9013. * // => objects for ['barney', 'fred']
  9014. *
  9015. * // The `_.property` iteratee shorthand.
  9016. * _.takeWhile(users, 'active');
  9017. * // => []
  9018. */
  9019. function takeWhile(array, predicate) {
  9020. return (array && array.length)
  9021. ? baseWhile(array, getIteratee(predicate, 3))
  9022. : [];
  9023. }
  9024. /**
  9025. * Creates an array of unique values, in order, from all given arrays using
  9026. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  9027. * for equality comparisons.
  9028. *
  9029. * @static
  9030. * @memberOf _
  9031. * @since 0.1.0
  9032. * @category Array
  9033. * @param {...Array} [arrays] The arrays to inspect.
  9034. * @returns {Array} Returns the new array of combined values.
  9035. * @example
  9036. *
  9037. * _.union([2], [1, 2]);
  9038. * // => [2, 1]
  9039. */
  9040. var union = baseRest(function(arrays) {
  9041. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  9042. });
  9043. /**
  9044. * This method is like `_.union` except that it accepts `iteratee` which is
  9045. * invoked for each element of each `arrays` to generate the criterion by
  9046. * which uniqueness is computed. Result values are chosen from the first
  9047. * array in which the value occurs. The iteratee is invoked with one argument:
  9048. * (value).
  9049. *
  9050. * @static
  9051. * @memberOf _
  9052. * @since 4.0.0
  9053. * @category Array
  9054. * @param {...Array} [arrays] The arrays to inspect.
  9055. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  9056. * @returns {Array} Returns the new array of combined values.
  9057. * @example
  9058. *
  9059. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  9060. * // => [2.1, 1.2]
  9061. *
  9062. * // The `_.property` iteratee shorthand.
  9063. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  9064. * // => [{ 'x': 1 }, { 'x': 2 }]
  9065. */
  9066. var unionBy = baseRest(function(arrays) {
  9067. var iteratee = last(arrays);
  9068. if (isArrayLikeObject(iteratee)) {
  9069. iteratee = undefined;
  9070. }
  9071. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  9072. });
  9073. /**
  9074. * This method is like `_.union` except that it accepts `comparator` which
  9075. * is invoked to compare elements of `arrays`. Result values are chosen from
  9076. * the first array in which the value occurs. The comparator is invoked
  9077. * with two arguments: (arrVal, othVal).
  9078. *
  9079. * @static
  9080. * @memberOf _
  9081. * @since 4.0.0
  9082. * @category Array
  9083. * @param {...Array} [arrays] The arrays to inspect.
  9084. * @param {Function} [comparator] The comparator invoked per element.
  9085. * @returns {Array} Returns the new array of combined values.
  9086. * @example
  9087. *
  9088. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  9089. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  9090. *
  9091. * _.unionWith(objects, others, _.isEqual);
  9092. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  9093. */
  9094. var unionWith = baseRest(function(arrays) {
  9095. var comparator = last(arrays);
  9096. comparator = typeof comparator == 'function' ? comparator : undefined;
  9097. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  9098. });
  9099. /**
  9100. * Creates a duplicate-free version of an array, using
  9101. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  9102. * for equality comparisons, in which only the first occurrence of each element
  9103. * is kept. The order of result values is determined by the order they occur
  9104. * in the array.
  9105. *
  9106. * @static
  9107. * @memberOf _
  9108. * @since 0.1.0
  9109. * @category Array
  9110. * @param {Array} array The array to inspect.
  9111. * @returns {Array} Returns the new duplicate free array.
  9112. * @example
  9113. *
  9114. * _.uniq([2, 1, 2]);
  9115. * // => [2, 1]
  9116. */
  9117. function uniq(array) {
  9118. return (array && array.length) ? baseUniq(array) : [];
  9119. }
  9120. /**
  9121. * This method is like `_.uniq` except that it accepts `iteratee` which is
  9122. * invoked for each element in `array` to generate the criterion by which
  9123. * uniqueness is computed. The order of result values is determined by the
  9124. * order they occur in the array. The iteratee is invoked with one argument:
  9125. * (value).
  9126. *
  9127. * @static
  9128. * @memberOf _
  9129. * @since 4.0.0
  9130. * @category Array
  9131. * @param {Array} array The array to inspect.
  9132. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  9133. * @returns {Array} Returns the new duplicate free array.
  9134. * @example
  9135. *
  9136. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  9137. * // => [2.1, 1.2]
  9138. *
  9139. * // The `_.property` iteratee shorthand.
  9140. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  9141. * // => [{ 'x': 1 }, { 'x': 2 }]
  9142. */
  9143. function uniqBy(array, iteratee) {
  9144. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  9145. }
  9146. /**
  9147. * This method is like `_.uniq` except that it accepts `comparator` which
  9148. * is invoked to compare elements of `array`. The order of result values is
  9149. * determined by the order they occur in the array.The comparator is invoked
  9150. * with two arguments: (arrVal, othVal).
  9151. *
  9152. * @static
  9153. * @memberOf _
  9154. * @since 4.0.0
  9155. * @category Array
  9156. * @param {Array} array The array to inspect.
  9157. * @param {Function} [comparator] The comparator invoked per element.
  9158. * @returns {Array} Returns the new duplicate free array.
  9159. * @example
  9160. *
  9161. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  9162. *
  9163. * _.uniqWith(objects, _.isEqual);
  9164. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  9165. */
  9166. function uniqWith(array, comparator) {
  9167. comparator = typeof comparator == 'function' ? comparator : undefined;
  9168. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  9169. }
  9170. /**
  9171. * This method is like `_.zip` except that it accepts an array of grouped
  9172. * elements and creates an array regrouping the elements to their pre-zip
  9173. * configuration.
  9174. *
  9175. * @static
  9176. * @memberOf _
  9177. * @since 1.2.0
  9178. * @category Array
  9179. * @param {Array} array The array of grouped elements to process.
  9180. * @returns {Array} Returns the new array of regrouped elements.
  9181. * @example
  9182. *
  9183. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  9184. * // => [['a', 1, true], ['b', 2, false]]
  9185. *
  9186. * _.unzip(zipped);
  9187. * // => [['a', 'b'], [1, 2], [true, false]]
  9188. */
  9189. function unzip(array) {
  9190. if (!(array && array.length)) {
  9191. return [];
  9192. }
  9193. var length = 0;
  9194. array = arrayFilter(array, function(group) {
  9195. if (isArrayLikeObject(group)) {
  9196. length = nativeMax(group.length, length);
  9197. return true;
  9198. }
  9199. });
  9200. return baseTimes(length, function(index) {
  9201. return arrayMap(array, baseProperty(index));
  9202. });
  9203. }
  9204. /**
  9205. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  9206. * how regrouped values should be combined. The iteratee is invoked with the
  9207. * elements of each group: (...group).
  9208. *
  9209. * @static
  9210. * @memberOf _
  9211. * @since 3.8.0
  9212. * @category Array
  9213. * @param {Array} array The array of grouped elements to process.
  9214. * @param {Function} [iteratee=_.identity] The function to combine
  9215. * regrouped values.
  9216. * @returns {Array} Returns the new array of regrouped elements.
  9217. * @example
  9218. *
  9219. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  9220. * // => [[1, 10, 100], [2, 20, 200]]
  9221. *
  9222. * _.unzipWith(zipped, _.add);
  9223. * // => [3, 30, 300]
  9224. */
  9225. function unzipWith(array, iteratee) {
  9226. if (!(array && array.length)) {
  9227. return [];
  9228. }
  9229. var result = unzip(array);
  9230. if (iteratee == null) {
  9231. return result;
  9232. }
  9233. return arrayMap(result, function(group) {
  9234. return apply(iteratee, undefined, group);
  9235. });
  9236. }
  9237. /**
  9238. * Creates an array excluding all given values using
  9239. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  9240. * for equality comparisons.
  9241. *
  9242. * **Note:** Unlike `_.pull`, this method returns a new array.
  9243. *
  9244. * @static
  9245. * @memberOf _
  9246. * @since 0.1.0
  9247. * @category Array
  9248. * @param {Array} array The array to inspect.
  9249. * @param {...*} [values] The values to exclude.
  9250. * @returns {Array} Returns the new array of filtered values.
  9251. * @see _.difference, _.xor
  9252. * @example
  9253. *
  9254. * _.without([2, 1, 2, 3], 1, 2);
  9255. * // => [3]
  9256. */
  9257. var without = baseRest(function(array, values) {
  9258. return isArrayLikeObject(array)
  9259. ? baseDifference(array, values)
  9260. : [];
  9261. });
  9262. /**
  9263. * Creates an array of unique values that is the
  9264. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  9265. * of the given arrays. The order of result values is determined by the order
  9266. * they occur in the arrays.
  9267. *
  9268. * @static
  9269. * @memberOf _
  9270. * @since 2.4.0
  9271. * @category Array
  9272. * @param {...Array} [arrays] The arrays to inspect.
  9273. * @returns {Array} Returns the new array of filtered values.
  9274. * @see _.difference, _.without
  9275. * @example
  9276. *
  9277. * _.xor([2, 1], [2, 3]);
  9278. * // => [1, 3]
  9279. */
  9280. var xor = baseRest(function(arrays) {
  9281. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  9282. });
  9283. /**
  9284. * This method is like `_.xor` except that it accepts `iteratee` which is
  9285. * invoked for each element of each `arrays` to generate the criterion by
  9286. * which by which they're compared. The order of result values is determined
  9287. * by the order they occur in the arrays. The iteratee is invoked with one
  9288. * argument: (value).
  9289. *
  9290. * @static
  9291. * @memberOf _
  9292. * @since 4.0.0
  9293. * @category Array
  9294. * @param {...Array} [arrays] The arrays to inspect.
  9295. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  9296. * @returns {Array} Returns the new array of filtered values.
  9297. * @example
  9298. *
  9299. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  9300. * // => [1.2, 3.4]
  9301. *
  9302. * // The `_.property` iteratee shorthand.
  9303. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  9304. * // => [{ 'x': 2 }]
  9305. */
  9306. var xorBy = baseRest(function(arrays) {
  9307. var iteratee = last(arrays);
  9308. if (isArrayLikeObject(iteratee)) {
  9309. iteratee = undefined;
  9310. }
  9311. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  9312. });
  9313. /**
  9314. * This method is like `_.xor` except that it accepts `comparator` which is
  9315. * invoked to compare elements of `arrays`. The order of result values is
  9316. * determined by the order they occur in the arrays. The comparator is invoked
  9317. * with two arguments: (arrVal, othVal).
  9318. *
  9319. * @static
  9320. * @memberOf _
  9321. * @since 4.0.0
  9322. * @category Array
  9323. * @param {...Array} [arrays] The arrays to inspect.
  9324. * @param {Function} [comparator] The comparator invoked per element.
  9325. * @returns {Array} Returns the new array of filtered values.
  9326. * @example
  9327. *
  9328. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  9329. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  9330. *
  9331. * _.xorWith(objects, others, _.isEqual);
  9332. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  9333. */
  9334. var xorWith = baseRest(function(arrays) {
  9335. var comparator = last(arrays);
  9336. comparator = typeof comparator == 'function' ? comparator : undefined;
  9337. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  9338. });
  9339. /**
  9340. * Creates an array of grouped elements, the first of which contains the
  9341. * first elements of the given arrays, the second of which contains the
  9342. * second elements of the given arrays, and so on.
  9343. *
  9344. * @static
  9345. * @memberOf _
  9346. * @since 0.1.0
  9347. * @category Array
  9348. * @param {...Array} [arrays] The arrays to process.
  9349. * @returns {Array} Returns the new array of grouped elements.
  9350. * @example
  9351. *
  9352. * _.zip(['a', 'b'], [1, 2], [true, false]);
  9353. * // => [['a', 1, true], ['b', 2, false]]
  9354. */
  9355. var zip = baseRest(unzip);
  9356. /**
  9357. * This method is like `_.fromPairs` except that it accepts two arrays,
  9358. * one of property identifiers and one of corresponding values.
  9359. *
  9360. * @static
  9361. * @memberOf _
  9362. * @since 0.4.0
  9363. * @category Array
  9364. * @param {Array} [props=[]] The property identifiers.
  9365. * @param {Array} [values=[]] The property values.
  9366. * @returns {Object} Returns the new object.
  9367. * @example
  9368. *
  9369. * _.zipObject(['a', 'b'], [1, 2]);
  9370. * // => { 'a': 1, 'b': 2 }
  9371. */
  9372. function zipObject(props, values) {
  9373. return baseZipObject(props || [], values || [], assignValue);
  9374. }
  9375. /**
  9376. * This method is like `_.zipObject` except that it supports property paths.
  9377. *
  9378. * @static
  9379. * @memberOf _
  9380. * @since 4.1.0
  9381. * @category Array
  9382. * @param {Array} [props=[]] The property identifiers.
  9383. * @param {Array} [values=[]] The property values.
  9384. * @returns {Object} Returns the new object.
  9385. * @example
  9386. *
  9387. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  9388. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  9389. */
  9390. function zipObjectDeep(props, values) {
  9391. return baseZipObject(props || [], values || [], baseSet);
  9392. }
  9393. /**
  9394. * This method is like `_.zip` except that it accepts `iteratee` to specify
  9395. * how grouped values should be combined. The iteratee is invoked with the
  9396. * elements of each group: (...group).
  9397. *
  9398. * @static
  9399. * @memberOf _
  9400. * @since 3.8.0
  9401. * @category Array
  9402. * @param {...Array} [arrays] The arrays to process.
  9403. * @param {Function} [iteratee=_.identity] The function to combine
  9404. * grouped values.
  9405. * @returns {Array} Returns the new array of grouped elements.
  9406. * @example
  9407. *
  9408. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  9409. * return a + b + c;
  9410. * });
  9411. * // => [111, 222]
  9412. */
  9413. var zipWith = baseRest(function(arrays) {
  9414. var length = arrays.length,
  9415. iteratee = length > 1 ? arrays[length - 1] : undefined;
  9416. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  9417. return unzipWith(arrays, iteratee);
  9418. });
  9419. /*------------------------------------------------------------------------*/
  9420. /**
  9421. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  9422. * chain sequences enabled. The result of such sequences must be unwrapped
  9423. * with `_#value`.
  9424. *
  9425. * @static
  9426. * @memberOf _
  9427. * @since 1.3.0
  9428. * @category Seq
  9429. * @param {*} value The value to wrap.
  9430. * @returns {Object} Returns the new `lodash` wrapper instance.
  9431. * @example
  9432. *
  9433. * var users = [
  9434. * { 'user': 'barney', 'age': 36 },
  9435. * { 'user': 'fred', 'age': 40 },
  9436. * { 'user': 'pebbles', 'age': 1 }
  9437. * ];
  9438. *
  9439. * var youngest = _
  9440. * .chain(users)
  9441. * .sortBy('age')
  9442. * .map(function(o) {
  9443. * return o.user + ' is ' + o.age;
  9444. * })
  9445. * .head()
  9446. * .value();
  9447. * // => 'pebbles is 1'
  9448. */
  9449. function chain(value) {
  9450. var result = lodash(value);
  9451. result.__chain__ = true;
  9452. return result;
  9453. }
  9454. /**
  9455. * This method invokes `interceptor` and returns `value`. The interceptor
  9456. * is invoked with one argument; (value). The purpose of this method is to
  9457. * "tap into" a method chain sequence in order to modify intermediate results.
  9458. *
  9459. * @static
  9460. * @memberOf _
  9461. * @since 0.1.0
  9462. * @category Seq
  9463. * @param {*} value The value to provide to `interceptor`.
  9464. * @param {Function} interceptor The function to invoke.
  9465. * @returns {*} Returns `value`.
  9466. * @example
  9467. *
  9468. * _([1, 2, 3])
  9469. * .tap(function(array) {
  9470. * // Mutate input array.
  9471. * array.pop();
  9472. * })
  9473. * .reverse()
  9474. * .value();
  9475. * // => [2, 1]
  9476. */
  9477. function tap(value, interceptor) {
  9478. interceptor(value);
  9479. return value;
  9480. }
  9481. /**
  9482. * This method is like `_.tap` except that it returns the result of `interceptor`.
  9483. * The purpose of this method is to "pass thru" values replacing intermediate
  9484. * results in a method chain sequence.
  9485. *
  9486. * @static
  9487. * @memberOf _
  9488. * @since 3.0.0
  9489. * @category Seq
  9490. * @param {*} value The value to provide to `interceptor`.
  9491. * @param {Function} interceptor The function to invoke.
  9492. * @returns {*} Returns the result of `interceptor`.
  9493. * @example
  9494. *
  9495. * _(' abc ')
  9496. * .chain()
  9497. * .trim()
  9498. * .thru(function(value) {
  9499. * return [value];
  9500. * })
  9501. * .value();
  9502. * // => ['abc']
  9503. */
  9504. function thru(value, interceptor) {
  9505. return interceptor(value);
  9506. }
  9507. /**
  9508. * This method is the wrapper version of `_.at`.
  9509. *
  9510. * @name at
  9511. * @memberOf _
  9512. * @since 1.0.0
  9513. * @category Seq
  9514. * @param {...(string|string[])} [paths] The property paths to pick.
  9515. * @returns {Object} Returns the new `lodash` wrapper instance.
  9516. * @example
  9517. *
  9518. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  9519. *
  9520. * _(object).at(['a[0].b.c', 'a[1]']).value();
  9521. * // => [3, 4]
  9522. */
  9523. var wrapperAt = flatRest(function(paths) {
  9524. var length = paths.length,
  9525. start = length ? paths[0] : 0,
  9526. value = this.__wrapped__,
  9527. interceptor = function(object) { return baseAt(object, paths); };
  9528. if (length > 1 || this.__actions__.length ||
  9529. !(value instanceof LazyWrapper) || !isIndex(start)) {
  9530. return this.thru(interceptor);
  9531. }
  9532. value = value.slice(start, +start + (length ? 1 : 0));
  9533. value.__actions__.push({
  9534. 'func': thru,
  9535. 'args': [interceptor],
  9536. 'thisArg': undefined
  9537. });
  9538. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  9539. if (length && !array.length) {
  9540. array.push(undefined);
  9541. }
  9542. return array;
  9543. });
  9544. });
  9545. /**
  9546. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  9547. *
  9548. * @name chain
  9549. * @memberOf _
  9550. * @since 0.1.0
  9551. * @category Seq
  9552. * @returns {Object} Returns the new `lodash` wrapper instance.
  9553. * @example
  9554. *
  9555. * var users = [
  9556. * { 'user': 'barney', 'age': 36 },
  9557. * { 'user': 'fred', 'age': 40 }
  9558. * ];
  9559. *
  9560. * // A sequence without explicit chaining.
  9561. * _(users).head();
  9562. * // => { 'user': 'barney', 'age': 36 }
  9563. *
  9564. * // A sequence with explicit chaining.
  9565. * _(users)
  9566. * .chain()
  9567. * .head()
  9568. * .pick('user')
  9569. * .value();
  9570. * // => { 'user': 'barney' }
  9571. */
  9572. function wrapperChain() {
  9573. return chain(this);
  9574. }
  9575. /**
  9576. * Executes the chain sequence and returns the wrapped result.
  9577. *
  9578. * @name commit
  9579. * @memberOf _
  9580. * @since 3.2.0
  9581. * @category Seq
  9582. * @returns {Object} Returns the new `lodash` wrapper instance.
  9583. * @example
  9584. *
  9585. * var array = [1, 2];
  9586. * var wrapped = _(array).push(3);
  9587. *
  9588. * console.log(array);
  9589. * // => [1, 2]
  9590. *
  9591. * wrapped = wrapped.commit();
  9592. * console.log(array);
  9593. * // => [1, 2, 3]
  9594. *
  9595. * wrapped.last();
  9596. * // => 3
  9597. *
  9598. * console.log(array);
  9599. * // => [1, 2, 3]
  9600. */
  9601. function wrapperCommit() {
  9602. return new LodashWrapper(this.value(), this.__chain__);
  9603. }
  9604. /**
  9605. * Gets the next value on a wrapped object following the
  9606. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  9607. *
  9608. * @name next
  9609. * @memberOf _
  9610. * @since 4.0.0
  9611. * @category Seq
  9612. * @returns {Object} Returns the next iterator value.
  9613. * @example
  9614. *
  9615. * var wrapped = _([1, 2]);
  9616. *
  9617. * wrapped.next();
  9618. * // => { 'done': false, 'value': 1 }
  9619. *
  9620. * wrapped.next();
  9621. * // => { 'done': false, 'value': 2 }
  9622. *
  9623. * wrapped.next();
  9624. * // => { 'done': true, 'value': undefined }
  9625. */
  9626. function wrapperNext() {
  9627. if (this.__values__ === undefined) {
  9628. this.__values__ = toArray(this.value());
  9629. }
  9630. var done = this.__index__ >= this.__values__.length,
  9631. value = done ? undefined : this.__values__[this.__index__++];
  9632. return { 'done': done, 'value': value };
  9633. }
  9634. /**
  9635. * Enables the wrapper to be iterable.
  9636. *
  9637. * @name Symbol.iterator
  9638. * @memberOf _
  9639. * @since 4.0.0
  9640. * @category Seq
  9641. * @returns {Object} Returns the wrapper object.
  9642. * @example
  9643. *
  9644. * var wrapped = _([1, 2]);
  9645. *
  9646. * wrapped[Symbol.iterator]() === wrapped;
  9647. * // => true
  9648. *
  9649. * Array.from(wrapped);
  9650. * // => [1, 2]
  9651. */
  9652. function wrapperToIterator() {
  9653. return this;
  9654. }
  9655. /**
  9656. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  9657. *
  9658. * @name plant
  9659. * @memberOf _
  9660. * @since 3.2.0
  9661. * @category Seq
  9662. * @param {*} value The value to plant.
  9663. * @returns {Object} Returns the new `lodash` wrapper instance.
  9664. * @example
  9665. *
  9666. * function square(n) {
  9667. * return n * n;
  9668. * }
  9669. *
  9670. * var wrapped = _([1, 2]).map(square);
  9671. * var other = wrapped.plant([3, 4]);
  9672. *
  9673. * other.value();
  9674. * // => [9, 16]
  9675. *
  9676. * wrapped.value();
  9677. * // => [1, 4]
  9678. */
  9679. function wrapperPlant(value) {
  9680. var result,
  9681. parent = this;
  9682. while (parent instanceof baseLodash) {
  9683. var clone = wrapperClone(parent);
  9684. clone.__index__ = 0;
  9685. clone.__values__ = undefined;
  9686. if (result) {
  9687. previous.__wrapped__ = clone;
  9688. } else {
  9689. result = clone;
  9690. }
  9691. var previous = clone;
  9692. parent = parent.__wrapped__;
  9693. }
  9694. previous.__wrapped__ = value;
  9695. return result;
  9696. }
  9697. /**
  9698. * This method is the wrapper version of `_.reverse`.
  9699. *
  9700. * **Note:** This method mutates the wrapped array.
  9701. *
  9702. * @name reverse
  9703. * @memberOf _
  9704. * @since 0.1.0
  9705. * @category Seq
  9706. * @returns {Object} Returns the new `lodash` wrapper instance.
  9707. * @example
  9708. *
  9709. * var array = [1, 2, 3];
  9710. *
  9711. * _(array).reverse().value()
  9712. * // => [3, 2, 1]
  9713. *
  9714. * console.log(array);
  9715. * // => [3, 2, 1]
  9716. */
  9717. function wrapperReverse() {
  9718. var value = this.__wrapped__;
  9719. if (value instanceof LazyWrapper) {
  9720. var wrapped = value;
  9721. if (this.__actions__.length) {
  9722. wrapped = new LazyWrapper(this);
  9723. }
  9724. wrapped = wrapped.reverse();
  9725. wrapped.__actions__.push({
  9726. 'func': thru,
  9727. 'args': [reverse],
  9728. 'thisArg': undefined
  9729. });
  9730. return new LodashWrapper(wrapped, this.__chain__);
  9731. }
  9732. return this.thru(reverse);
  9733. }
  9734. /**
  9735. * Executes the chain sequence to resolve the unwrapped value.
  9736. *
  9737. * @name value
  9738. * @memberOf _
  9739. * @since 0.1.0
  9740. * @alias toJSON, valueOf
  9741. * @category Seq
  9742. * @returns {*} Returns the resolved unwrapped value.
  9743. * @example
  9744. *
  9745. * _([1, 2, 3]).value();
  9746. * // => [1, 2, 3]
  9747. */
  9748. function wrapperValue() {
  9749. return baseWrapperValue(this.__wrapped__, this.__actions__);
  9750. }
  9751. /*------------------------------------------------------------------------*/
  9752. /**
  9753. * Creates an object composed of keys generated from the results of running
  9754. * each element of `collection` thru `iteratee`. The corresponding value of
  9755. * each key is the number of times the key was returned by `iteratee`. The
  9756. * iteratee is invoked with one argument: (value).
  9757. *
  9758. * @static
  9759. * @memberOf _
  9760. * @since 0.5.0
  9761. * @category Collection
  9762. * @param {Array|Object} collection The collection to iterate over.
  9763. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  9764. * @returns {Object} Returns the composed aggregate object.
  9765. * @example
  9766. *
  9767. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  9768. * // => { '4': 1, '6': 2 }
  9769. *
  9770. * // The `_.property` iteratee shorthand.
  9771. * _.countBy(['one', 'two', 'three'], 'length');
  9772. * // => { '3': 2, '5': 1 }
  9773. */
  9774. var countBy = createAggregator(function(result, value, key) {
  9775. if (hasOwnProperty.call(result, key)) {
  9776. ++result[key];
  9777. } else {
  9778. baseAssignValue(result, key, 1);
  9779. }
  9780. });
  9781. /**
  9782. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  9783. * Iteration is stopped once `predicate` returns falsey. The predicate is
  9784. * invoked with three arguments: (value, index|key, collection).
  9785. *
  9786. * **Note:** This method returns `true` for
  9787. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  9788. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  9789. * elements of empty collections.
  9790. *
  9791. * @static
  9792. * @memberOf _
  9793. * @since 0.1.0
  9794. * @category Collection
  9795. * @param {Array|Object} collection The collection to iterate over.
  9796. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9797. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  9798. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  9799. * else `false`.
  9800. * @example
  9801. *
  9802. * _.every([true, 1, null, 'yes'], Boolean);
  9803. * // => false
  9804. *
  9805. * var users = [
  9806. * { 'user': 'barney', 'age': 36, 'active': false },
  9807. * { 'user': 'fred', 'age': 40, 'active': false }
  9808. * ];
  9809. *
  9810. * // The `_.matches` iteratee shorthand.
  9811. * _.every(users, { 'user': 'barney', 'active': false });
  9812. * // => false
  9813. *
  9814. * // The `_.matchesProperty` iteratee shorthand.
  9815. * _.every(users, ['active', false]);
  9816. * // => true
  9817. *
  9818. * // The `_.property` iteratee shorthand.
  9819. * _.every(users, 'active');
  9820. * // => false
  9821. */
  9822. function every(collection, predicate, guard) {
  9823. var func = isArray(collection) ? arrayEvery : baseEvery;
  9824. if (guard && isIterateeCall(collection, predicate, guard)) {
  9825. predicate = undefined;
  9826. }
  9827. return func(collection, getIteratee(predicate, 3));
  9828. }
  9829. /**
  9830. * Iterates over elements of `collection`, returning an array of all elements
  9831. * `predicate` returns truthy for. The predicate is invoked with three
  9832. * arguments: (value, index|key, collection).
  9833. *
  9834. * **Note:** Unlike `_.remove`, this method returns a new array.
  9835. *
  9836. * @static
  9837. * @memberOf _
  9838. * @since 0.1.0
  9839. * @category Collection
  9840. * @param {Array|Object} collection The collection to iterate over.
  9841. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9842. * @returns {Array} Returns the new filtered array.
  9843. * @see _.reject
  9844. * @example
  9845. *
  9846. * var users = [
  9847. * { 'user': 'barney', 'age': 36, 'active': true },
  9848. * { 'user': 'fred', 'age': 40, 'active': false }
  9849. * ];
  9850. *
  9851. * _.filter(users, function(o) { return !o.active; });
  9852. * // => objects for ['fred']
  9853. *
  9854. * // The `_.matches` iteratee shorthand.
  9855. * _.filter(users, { 'age': 36, 'active': true });
  9856. * // => objects for ['barney']
  9857. *
  9858. * // The `_.matchesProperty` iteratee shorthand.
  9859. * _.filter(users, ['active', false]);
  9860. * // => objects for ['fred']
  9861. *
  9862. * // The `_.property` iteratee shorthand.
  9863. * _.filter(users, 'active');
  9864. * // => objects for ['barney']
  9865. *
  9866. * // Combining several predicates using `_.overEvery` or `_.overSome`.
  9867. * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));
  9868. * // => objects for ['fred', 'barney']
  9869. */
  9870. function filter(collection, predicate) {
  9871. var func = isArray(collection) ? arrayFilter : baseFilter;
  9872. return func(collection, getIteratee(predicate, 3));
  9873. }
  9874. /**
  9875. * Iterates over elements of `collection`, returning the first element
  9876. * `predicate` returns truthy for. The predicate is invoked with three
  9877. * arguments: (value, index|key, collection).
  9878. *
  9879. * @static
  9880. * @memberOf _
  9881. * @since 0.1.0
  9882. * @category Collection
  9883. * @param {Array|Object} collection The collection to inspect.
  9884. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9885. * @param {number} [fromIndex=0] The index to search from.
  9886. * @returns {*} Returns the matched element, else `undefined`.
  9887. * @example
  9888. *
  9889. * var users = [
  9890. * { 'user': 'barney', 'age': 36, 'active': true },
  9891. * { 'user': 'fred', 'age': 40, 'active': false },
  9892. * { 'user': 'pebbles', 'age': 1, 'active': true }
  9893. * ];
  9894. *
  9895. * _.find(users, function(o) { return o.age < 40; });
  9896. * // => object for 'barney'
  9897. *
  9898. * // The `_.matches` iteratee shorthand.
  9899. * _.find(users, { 'age': 1, 'active': true });
  9900. * // => object for 'pebbles'
  9901. *
  9902. * // The `_.matchesProperty` iteratee shorthand.
  9903. * _.find(users, ['active', false]);
  9904. * // => object for 'fred'
  9905. *
  9906. * // The `_.property` iteratee shorthand.
  9907. * _.find(users, 'active');
  9908. * // => object for 'barney'
  9909. */
  9910. var find = createFind(findIndex);
  9911. /**
  9912. * This method is like `_.find` except that it iterates over elements of
  9913. * `collection` from right to left.
  9914. *
  9915. * @static
  9916. * @memberOf _
  9917. * @since 2.0.0
  9918. * @category Collection
  9919. * @param {Array|Object} collection The collection to inspect.
  9920. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9921. * @param {number} [fromIndex=collection.length-1] The index to search from.
  9922. * @returns {*} Returns the matched element, else `undefined`.
  9923. * @example
  9924. *
  9925. * _.findLast([1, 2, 3, 4], function(n) {
  9926. * return n % 2 == 1;
  9927. * });
  9928. * // => 3
  9929. */
  9930. var findLast = createFind(findLastIndex);
  9931. /**
  9932. * Creates a flattened array of values by running each element in `collection`
  9933. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  9934. * with three arguments: (value, index|key, collection).
  9935. *
  9936. * @static
  9937. * @memberOf _
  9938. * @since 4.0.0
  9939. * @category Collection
  9940. * @param {Array|Object} collection The collection to iterate over.
  9941. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9942. * @returns {Array} Returns the new flattened array.
  9943. * @example
  9944. *
  9945. * function duplicate(n) {
  9946. * return [n, n];
  9947. * }
  9948. *
  9949. * _.flatMap([1, 2], duplicate);
  9950. * // => [1, 1, 2, 2]
  9951. */
  9952. function flatMap(collection, iteratee) {
  9953. return baseFlatten(map(collection, iteratee), 1);
  9954. }
  9955. /**
  9956. * This method is like `_.flatMap` except that it recursively flattens the
  9957. * mapped results.
  9958. *
  9959. * @static
  9960. * @memberOf _
  9961. * @since 4.7.0
  9962. * @category Collection
  9963. * @param {Array|Object} collection The collection to iterate over.
  9964. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9965. * @returns {Array} Returns the new flattened array.
  9966. * @example
  9967. *
  9968. * function duplicate(n) {
  9969. * return [[[n, n]]];
  9970. * }
  9971. *
  9972. * _.flatMapDeep([1, 2], duplicate);
  9973. * // => [1, 1, 2, 2]
  9974. */
  9975. function flatMapDeep(collection, iteratee) {
  9976. return baseFlatten(map(collection, iteratee), INFINITY);
  9977. }
  9978. /**
  9979. * This method is like `_.flatMap` except that it recursively flattens the
  9980. * mapped results up to `depth` times.
  9981. *
  9982. * @static
  9983. * @memberOf _
  9984. * @since 4.7.0
  9985. * @category Collection
  9986. * @param {Array|Object} collection The collection to iterate over.
  9987. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9988. * @param {number} [depth=1] The maximum recursion depth.
  9989. * @returns {Array} Returns the new flattened array.
  9990. * @example
  9991. *
  9992. * function duplicate(n) {
  9993. * return [[[n, n]]];
  9994. * }
  9995. *
  9996. * _.flatMapDepth([1, 2], duplicate, 2);
  9997. * // => [[1, 1], [2, 2]]
  9998. */
  9999. function flatMapDepth(collection, iteratee, depth) {
  10000. depth = depth === undefined ? 1 : toInteger(depth);
  10001. return baseFlatten(map(collection, iteratee), depth);
  10002. }
  10003. /**
  10004. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  10005. * The iteratee is invoked with three arguments: (value, index|key, collection).
  10006. * Iteratee functions may exit iteration early by explicitly returning `false`.
  10007. *
  10008. * **Note:** As with other "Collections" methods, objects with a "length"
  10009. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  10010. * or `_.forOwn` for object iteration.
  10011. *
  10012. * @static
  10013. * @memberOf _
  10014. * @since 0.1.0
  10015. * @alias each
  10016. * @category Collection
  10017. * @param {Array|Object} collection The collection to iterate over.
  10018. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10019. * @returns {Array|Object} Returns `collection`.
  10020. * @see _.forEachRight
  10021. * @example
  10022. *
  10023. * _.forEach([1, 2], function(value) {
  10024. * console.log(value);
  10025. * });
  10026. * // => Logs `1` then `2`.
  10027. *
  10028. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  10029. * console.log(key);
  10030. * });
  10031. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  10032. */
  10033. function forEach(collection, iteratee) {
  10034. var func = isArray(collection) ? arrayEach : baseEach;
  10035. return func(collection, getIteratee(iteratee, 3));
  10036. }
  10037. /**
  10038. * This method is like `_.forEach` except that it iterates over elements of
  10039. * `collection` from right to left.
  10040. *
  10041. * @static
  10042. * @memberOf _
  10043. * @since 2.0.0
  10044. * @alias eachRight
  10045. * @category Collection
  10046. * @param {Array|Object} collection The collection to iterate over.
  10047. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10048. * @returns {Array|Object} Returns `collection`.
  10049. * @see _.forEach
  10050. * @example
  10051. *
  10052. * _.forEachRight([1, 2], function(value) {
  10053. * console.log(value);
  10054. * });
  10055. * // => Logs `2` then `1`.
  10056. */
  10057. function forEachRight(collection, iteratee) {
  10058. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  10059. return func(collection, getIteratee(iteratee, 3));
  10060. }
  10061. /**
  10062. * Creates an object composed of keys generated from the results of running
  10063. * each element of `collection` thru `iteratee`. The order of grouped values
  10064. * is determined by the order they occur in `collection`. The corresponding
  10065. * value of each key is an array of elements responsible for generating the
  10066. * key. The iteratee is invoked with one argument: (value).
  10067. *
  10068. * @static
  10069. * @memberOf _
  10070. * @since 0.1.0
  10071. * @category Collection
  10072. * @param {Array|Object} collection The collection to iterate over.
  10073. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  10074. * @returns {Object} Returns the composed aggregate object.
  10075. * @example
  10076. *
  10077. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  10078. * // => { '4': [4.2], '6': [6.1, 6.3] }
  10079. *
  10080. * // The `_.property` iteratee shorthand.
  10081. * _.groupBy(['one', 'two', 'three'], 'length');
  10082. * // => { '3': ['one', 'two'], '5': ['three'] }
  10083. */
  10084. var groupBy = createAggregator(function(result, value, key) {
  10085. if (hasOwnProperty.call(result, key)) {
  10086. result[key].push(value);
  10087. } else {
  10088. baseAssignValue(result, key, [value]);
  10089. }
  10090. });
  10091. /**
  10092. * Checks if `value` is in `collection`. If `collection` is a string, it's
  10093. * checked for a substring of `value`, otherwise
  10094. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  10095. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  10096. * the offset from the end of `collection`.
  10097. *
  10098. * @static
  10099. * @memberOf _
  10100. * @since 0.1.0
  10101. * @category Collection
  10102. * @param {Array|Object|string} collection The collection to inspect.
  10103. * @param {*} value The value to search for.
  10104. * @param {number} [fromIndex=0] The index to search from.
  10105. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  10106. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  10107. * @example
  10108. *
  10109. * _.includes([1, 2, 3], 1);
  10110. * // => true
  10111. *
  10112. * _.includes([1, 2, 3], 1, 2);
  10113. * // => false
  10114. *
  10115. * _.includes({ 'a': 1, 'b': 2 }, 1);
  10116. * // => true
  10117. *
  10118. * _.includes('abcd', 'bc');
  10119. * // => true
  10120. */
  10121. function includes(collection, value, fromIndex, guard) {
  10122. collection = isArrayLike(collection) ? collection : values(collection);
  10123. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  10124. var length = collection.length;
  10125. if (fromIndex < 0) {
  10126. fromIndex = nativeMax(length + fromIndex, 0);
  10127. }
  10128. return isString(collection)
  10129. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  10130. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  10131. }
  10132. /**
  10133. * Invokes the method at `path` of each element in `collection`, returning
  10134. * an array of the results of each invoked method. Any additional arguments
  10135. * are provided to each invoked method. If `path` is a function, it's invoked
  10136. * for, and `this` bound to, each element in `collection`.
  10137. *
  10138. * @static
  10139. * @memberOf _
  10140. * @since 4.0.0
  10141. * @category Collection
  10142. * @param {Array|Object} collection The collection to iterate over.
  10143. * @param {Array|Function|string} path The path of the method to invoke or
  10144. * the function invoked per iteration.
  10145. * @param {...*} [args] The arguments to invoke each method with.
  10146. * @returns {Array} Returns the array of results.
  10147. * @example
  10148. *
  10149. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  10150. * // => [[1, 5, 7], [1, 2, 3]]
  10151. *
  10152. * _.invokeMap([123, 456], String.prototype.split, '');
  10153. * // => [['1', '2', '3'], ['4', '5', '6']]
  10154. */
  10155. var invokeMap = baseRest(function(collection, path, args) {
  10156. var index = -1,
  10157. isFunc = typeof path == 'function',
  10158. result = isArrayLike(collection) ? Array(collection.length) : [];
  10159. baseEach(collection, function(value) {
  10160. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  10161. });
  10162. return result;
  10163. });
  10164. /**
  10165. * Creates an object composed of keys generated from the results of running
  10166. * each element of `collection` thru `iteratee`. The corresponding value of
  10167. * each key is the last element responsible for generating the key. The
  10168. * iteratee is invoked with one argument: (value).
  10169. *
  10170. * @static
  10171. * @memberOf _
  10172. * @since 4.0.0
  10173. * @category Collection
  10174. * @param {Array|Object} collection The collection to iterate over.
  10175. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  10176. * @returns {Object} Returns the composed aggregate object.
  10177. * @example
  10178. *
  10179. * var array = [
  10180. * { 'dir': 'left', 'code': 97 },
  10181. * { 'dir': 'right', 'code': 100 }
  10182. * ];
  10183. *
  10184. * _.keyBy(array, function(o) {
  10185. * return String.fromCharCode(o.code);
  10186. * });
  10187. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  10188. *
  10189. * _.keyBy(array, 'dir');
  10190. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  10191. */
  10192. var keyBy = createAggregator(function(result, value, key) {
  10193. baseAssignValue(result, key, value);
  10194. });
  10195. /**
  10196. * Creates an array of values by running each element in `collection` thru
  10197. * `iteratee`. The iteratee is invoked with three arguments:
  10198. * (value, index|key, collection).
  10199. *
  10200. * Many lodash methods are guarded to work as iteratees for methods like
  10201. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  10202. *
  10203. * The guarded methods are:
  10204. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  10205. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  10206. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  10207. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  10208. *
  10209. * @static
  10210. * @memberOf _
  10211. * @since 0.1.0
  10212. * @category Collection
  10213. * @param {Array|Object} collection The collection to iterate over.
  10214. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10215. * @returns {Array} Returns the new mapped array.
  10216. * @example
  10217. *
  10218. * function square(n) {
  10219. * return n * n;
  10220. * }
  10221. *
  10222. * _.map([4, 8], square);
  10223. * // => [16, 64]
  10224. *
  10225. * _.map({ 'a': 4, 'b': 8 }, square);
  10226. * // => [16, 64] (iteration order is not guaranteed)
  10227. *
  10228. * var users = [
  10229. * { 'user': 'barney' },
  10230. * { 'user': 'fred' }
  10231. * ];
  10232. *
  10233. * // The `_.property` iteratee shorthand.
  10234. * _.map(users, 'user');
  10235. * // => ['barney', 'fred']
  10236. */
  10237. function map(collection, iteratee) {
  10238. var func = isArray(collection) ? arrayMap : baseMap;
  10239. return func(collection, getIteratee(iteratee, 3));
  10240. }
  10241. /**
  10242. * This method is like `_.sortBy` except that it allows specifying the sort
  10243. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  10244. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  10245. * descending or "asc" for ascending sort order of corresponding values.
  10246. *
  10247. * @static
  10248. * @memberOf _
  10249. * @since 4.0.0
  10250. * @category Collection
  10251. * @param {Array|Object} collection The collection to iterate over.
  10252. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  10253. * The iteratees to sort by.
  10254. * @param {string[]} [orders] The sort orders of `iteratees`.
  10255. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  10256. * @returns {Array} Returns the new sorted array.
  10257. * @example
  10258. *
  10259. * var users = [
  10260. * { 'user': 'fred', 'age': 48 },
  10261. * { 'user': 'barney', 'age': 34 },
  10262. * { 'user': 'fred', 'age': 40 },
  10263. * { 'user': 'barney', 'age': 36 }
  10264. * ];
  10265. *
  10266. * // Sort by `user` in ascending order and by `age` in descending order.
  10267. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  10268. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  10269. */
  10270. function orderBy(collection, iteratees, orders, guard) {
  10271. if (collection == null) {
  10272. return [];
  10273. }
  10274. if (!isArray(iteratees)) {
  10275. iteratees = iteratees == null ? [] : [iteratees];
  10276. }
  10277. orders = guard ? undefined : orders;
  10278. if (!isArray(orders)) {
  10279. orders = orders == null ? [] : [orders];
  10280. }
  10281. return baseOrderBy(collection, iteratees, orders);
  10282. }
  10283. /**
  10284. * Creates an array of elements split into two groups, the first of which
  10285. * contains elements `predicate` returns truthy for, the second of which
  10286. * contains elements `predicate` returns falsey for. The predicate is
  10287. * invoked with one argument: (value).
  10288. *
  10289. * @static
  10290. * @memberOf _
  10291. * @since 3.0.0
  10292. * @category Collection
  10293. * @param {Array|Object} collection The collection to iterate over.
  10294. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  10295. * @returns {Array} Returns the array of grouped elements.
  10296. * @example
  10297. *
  10298. * var users = [
  10299. * { 'user': 'barney', 'age': 36, 'active': false },
  10300. * { 'user': 'fred', 'age': 40, 'active': true },
  10301. * { 'user': 'pebbles', 'age': 1, 'active': false }
  10302. * ];
  10303. *
  10304. * _.partition(users, function(o) { return o.active; });
  10305. * // => objects for [['fred'], ['barney', 'pebbles']]
  10306. *
  10307. * // The `_.matches` iteratee shorthand.
  10308. * _.partition(users, { 'age': 1, 'active': false });
  10309. * // => objects for [['pebbles'], ['barney', 'fred']]
  10310. *
  10311. * // The `_.matchesProperty` iteratee shorthand.
  10312. * _.partition(users, ['active', false]);
  10313. * // => objects for [['barney', 'pebbles'], ['fred']]
  10314. *
  10315. * // The `_.property` iteratee shorthand.
  10316. * _.partition(users, 'active');
  10317. * // => objects for [['fred'], ['barney', 'pebbles']]
  10318. */
  10319. var partition = createAggregator(function(result, value, key) {
  10320. result[key ? 0 : 1].push(value);
  10321. }, function() { return [[], []]; });
  10322. /**
  10323. * Reduces `collection` to a value which is the accumulated result of running
  10324. * each element in `collection` thru `iteratee`, where each successive
  10325. * invocation is supplied the return value of the previous. If `accumulator`
  10326. * is not given, the first element of `collection` is used as the initial
  10327. * value. The iteratee is invoked with four arguments:
  10328. * (accumulator, value, index|key, collection).
  10329. *
  10330. * Many lodash methods are guarded to work as iteratees for methods like
  10331. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  10332. *
  10333. * The guarded methods are:
  10334. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  10335. * and `sortBy`
  10336. *
  10337. * @static
  10338. * @memberOf _
  10339. * @since 0.1.0
  10340. * @category Collection
  10341. * @param {Array|Object} collection The collection to iterate over.
  10342. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10343. * @param {*} [accumulator] The initial value.
  10344. * @returns {*} Returns the accumulated value.
  10345. * @see _.reduceRight
  10346. * @example
  10347. *
  10348. * _.reduce([1, 2], function(sum, n) {
  10349. * return sum + n;
  10350. * }, 0);
  10351. * // => 3
  10352. *
  10353. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  10354. * (result[value] || (result[value] = [])).push(key);
  10355. * return result;
  10356. * }, {});
  10357. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  10358. */
  10359. function reduce(collection, iteratee, accumulator) {
  10360. var func = isArray(collection) ? arrayReduce : baseReduce,
  10361. initAccum = arguments.length < 3;
  10362. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  10363. }
  10364. /**
  10365. * This method is like `_.reduce` except that it iterates over elements of
  10366. * `collection` from right to left.
  10367. *
  10368. * @static
  10369. * @memberOf _
  10370. * @since 0.1.0
  10371. * @category Collection
  10372. * @param {Array|Object} collection The collection to iterate over.
  10373. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10374. * @param {*} [accumulator] The initial value.
  10375. * @returns {*} Returns the accumulated value.
  10376. * @see _.reduce
  10377. * @example
  10378. *
  10379. * var array = [[0, 1], [2, 3], [4, 5]];
  10380. *
  10381. * _.reduceRight(array, function(flattened, other) {
  10382. * return flattened.concat(other);
  10383. * }, []);
  10384. * // => [4, 5, 2, 3, 0, 1]
  10385. */
  10386. function reduceRight(collection, iteratee, accumulator) {
  10387. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  10388. initAccum = arguments.length < 3;
  10389. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  10390. }
  10391. /**
  10392. * The opposite of `_.filter`; this method returns the elements of `collection`
  10393. * that `predicate` does **not** return truthy for.
  10394. *
  10395. * @static
  10396. * @memberOf _
  10397. * @since 0.1.0
  10398. * @category Collection
  10399. * @param {Array|Object} collection The collection to iterate over.
  10400. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  10401. * @returns {Array} Returns the new filtered array.
  10402. * @see _.filter
  10403. * @example
  10404. *
  10405. * var users = [
  10406. * { 'user': 'barney', 'age': 36, 'active': false },
  10407. * { 'user': 'fred', 'age': 40, 'active': true }
  10408. * ];
  10409. *
  10410. * _.reject(users, function(o) { return !o.active; });
  10411. * // => objects for ['fred']
  10412. *
  10413. * // The `_.matches` iteratee shorthand.
  10414. * _.reject(users, { 'age': 40, 'active': true });
  10415. * // => objects for ['barney']
  10416. *
  10417. * // The `_.matchesProperty` iteratee shorthand.
  10418. * _.reject(users, ['active', false]);
  10419. * // => objects for ['fred']
  10420. *
  10421. * // The `_.property` iteratee shorthand.
  10422. * _.reject(users, 'active');
  10423. * // => objects for ['barney']
  10424. */
  10425. function reject(collection, predicate) {
  10426. var func = isArray(collection) ? arrayFilter : baseFilter;
  10427. return func(collection, negate(getIteratee(predicate, 3)));
  10428. }
  10429. /**
  10430. * Gets a random element from `collection`.
  10431. *
  10432. * @static
  10433. * @memberOf _
  10434. * @since 2.0.0
  10435. * @category Collection
  10436. * @param {Array|Object} collection The collection to sample.
  10437. * @returns {*} Returns the random element.
  10438. * @example
  10439. *
  10440. * _.sample([1, 2, 3, 4]);
  10441. * // => 2
  10442. */
  10443. function sample(collection) {
  10444. var func = isArray(collection) ? arraySample : baseSample;
  10445. return func(collection);
  10446. }
  10447. /**
  10448. * Gets `n` random elements at unique keys from `collection` up to the
  10449. * size of `collection`.
  10450. *
  10451. * @static
  10452. * @memberOf _
  10453. * @since 4.0.0
  10454. * @category Collection
  10455. * @param {Array|Object} collection The collection to sample.
  10456. * @param {number} [n=1] The number of elements to sample.
  10457. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10458. * @returns {Array} Returns the random elements.
  10459. * @example
  10460. *
  10461. * _.sampleSize([1, 2, 3], 2);
  10462. * // => [3, 1]
  10463. *
  10464. * _.sampleSize([1, 2, 3], 4);
  10465. * // => [2, 3, 1]
  10466. */
  10467. function sampleSize(collection, n, guard) {
  10468. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  10469. n = 1;
  10470. } else {
  10471. n = toInteger(n);
  10472. }
  10473. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  10474. return func(collection, n);
  10475. }
  10476. /**
  10477. * Creates an array of shuffled values, using a version of the
  10478. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  10479. *
  10480. * @static
  10481. * @memberOf _
  10482. * @since 0.1.0
  10483. * @category Collection
  10484. * @param {Array|Object} collection The collection to shuffle.
  10485. * @returns {Array} Returns the new shuffled array.
  10486. * @example
  10487. *
  10488. * _.shuffle([1, 2, 3, 4]);
  10489. * // => [4, 1, 3, 2]
  10490. */
  10491. function shuffle(collection) {
  10492. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  10493. return func(collection);
  10494. }
  10495. /**
  10496. * Gets the size of `collection` by returning its length for array-like
  10497. * values or the number of own enumerable string keyed properties for objects.
  10498. *
  10499. * @static
  10500. * @memberOf _
  10501. * @since 0.1.0
  10502. * @category Collection
  10503. * @param {Array|Object|string} collection The collection to inspect.
  10504. * @returns {number} Returns the collection size.
  10505. * @example
  10506. *
  10507. * _.size([1, 2, 3]);
  10508. * // => 3
  10509. *
  10510. * _.size({ 'a': 1, 'b': 2 });
  10511. * // => 2
  10512. *
  10513. * _.size('pebbles');
  10514. * // => 7
  10515. */
  10516. function size(collection) {
  10517. if (collection == null) {
  10518. return 0;
  10519. }
  10520. if (isArrayLike(collection)) {
  10521. return isString(collection) ? stringSize(collection) : collection.length;
  10522. }
  10523. var tag = getTag(collection);
  10524. if (tag == mapTag || tag == setTag) {
  10525. return collection.size;
  10526. }
  10527. return baseKeys(collection).length;
  10528. }
  10529. /**
  10530. * Checks if `predicate` returns truthy for **any** element of `collection`.
  10531. * Iteration is stopped once `predicate` returns truthy. The predicate is
  10532. * invoked with three arguments: (value, index|key, collection).
  10533. *
  10534. * @static
  10535. * @memberOf _
  10536. * @since 0.1.0
  10537. * @category Collection
  10538. * @param {Array|Object} collection The collection to iterate over.
  10539. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  10540. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10541. * @returns {boolean} Returns `true` if any element passes the predicate check,
  10542. * else `false`.
  10543. * @example
  10544. *
  10545. * _.some([null, 0, 'yes', false], Boolean);
  10546. * // => true
  10547. *
  10548. * var users = [
  10549. * { 'user': 'barney', 'active': true },
  10550. * { 'user': 'fred', 'active': false }
  10551. * ];
  10552. *
  10553. * // The `_.matches` iteratee shorthand.
  10554. * _.some(users, { 'user': 'barney', 'active': false });
  10555. * // => false
  10556. *
  10557. * // The `_.matchesProperty` iteratee shorthand.
  10558. * _.some(users, ['active', false]);
  10559. * // => true
  10560. *
  10561. * // The `_.property` iteratee shorthand.
  10562. * _.some(users, 'active');
  10563. * // => true
  10564. */
  10565. function some(collection, predicate, guard) {
  10566. var func = isArray(collection) ? arraySome : baseSome;
  10567. if (guard && isIterateeCall(collection, predicate, guard)) {
  10568. predicate = undefined;
  10569. }
  10570. return func(collection, getIteratee(predicate, 3));
  10571. }
  10572. /**
  10573. * Creates an array of elements, sorted in ascending order by the results of
  10574. * running each element in a collection thru each iteratee. This method
  10575. * performs a stable sort, that is, it preserves the original sort order of
  10576. * equal elements. The iteratees are invoked with one argument: (value).
  10577. *
  10578. * @static
  10579. * @memberOf _
  10580. * @since 0.1.0
  10581. * @category Collection
  10582. * @param {Array|Object} collection The collection to iterate over.
  10583. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  10584. * The iteratees to sort by.
  10585. * @returns {Array} Returns the new sorted array.
  10586. * @example
  10587. *
  10588. * var users = [
  10589. * { 'user': 'fred', 'age': 48 },
  10590. * { 'user': 'barney', 'age': 36 },
  10591. * { 'user': 'fred', 'age': 30 },
  10592. * { 'user': 'barney', 'age': 34 }
  10593. * ];
  10594. *
  10595. * _.sortBy(users, [function(o) { return o.user; }]);
  10596. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
  10597. *
  10598. * _.sortBy(users, ['user', 'age']);
  10599. * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
  10600. */
  10601. var sortBy = baseRest(function(collection, iteratees) {
  10602. if (collection == null) {
  10603. return [];
  10604. }
  10605. var length = iteratees.length;
  10606. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  10607. iteratees = [];
  10608. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  10609. iteratees = [iteratees[0]];
  10610. }
  10611. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  10612. });
  10613. /*------------------------------------------------------------------------*/
  10614. /**
  10615. * Gets the timestamp of the number of milliseconds that have elapsed since
  10616. * the Unix epoch (1 January 1970 00:00:00 UTC).
  10617. *
  10618. * @static
  10619. * @memberOf _
  10620. * @since 2.4.0
  10621. * @category Date
  10622. * @returns {number} Returns the timestamp.
  10623. * @example
  10624. *
  10625. * _.defer(function(stamp) {
  10626. * console.log(_.now() - stamp);
  10627. * }, _.now());
  10628. * // => Logs the number of milliseconds it took for the deferred invocation.
  10629. */
  10630. var now = ctxNow || function() {
  10631. return root.Date.now();
  10632. };
  10633. /*------------------------------------------------------------------------*/
  10634. /**
  10635. * The opposite of `_.before`; this method creates a function that invokes
  10636. * `func` once it's called `n` or more times.
  10637. *
  10638. * @static
  10639. * @memberOf _
  10640. * @since 0.1.0
  10641. * @category Function
  10642. * @param {number} n The number of calls before `func` is invoked.
  10643. * @param {Function} func The function to restrict.
  10644. * @returns {Function} Returns the new restricted function.
  10645. * @example
  10646. *
  10647. * var saves = ['profile', 'settings'];
  10648. *
  10649. * var done = _.after(saves.length, function() {
  10650. * console.log('done saving!');
  10651. * });
  10652. *
  10653. * _.forEach(saves, function(type) {
  10654. * asyncSave({ 'type': type, 'complete': done });
  10655. * });
  10656. * // => Logs 'done saving!' after the two async saves have completed.
  10657. */
  10658. function after(n, func) {
  10659. if (typeof func != 'function') {
  10660. throw new TypeError(FUNC_ERROR_TEXT);
  10661. }
  10662. n = toInteger(n);
  10663. return function() {
  10664. if (--n < 1) {
  10665. return func.apply(this, arguments);
  10666. }
  10667. };
  10668. }
  10669. /**
  10670. * Creates a function that invokes `func`, with up to `n` arguments,
  10671. * ignoring any additional arguments.
  10672. *
  10673. * @static
  10674. * @memberOf _
  10675. * @since 3.0.0
  10676. * @category Function
  10677. * @param {Function} func The function to cap arguments for.
  10678. * @param {number} [n=func.length] The arity cap.
  10679. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10680. * @returns {Function} Returns the new capped function.
  10681. * @example
  10682. *
  10683. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  10684. * // => [6, 8, 10]
  10685. */
  10686. function ary(func, n, guard) {
  10687. n = guard ? undefined : n;
  10688. n = (func && n == null) ? func.length : n;
  10689. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  10690. }
  10691. /**
  10692. * Creates a function that invokes `func`, with the `this` binding and arguments
  10693. * of the created function, while it's called less than `n` times. Subsequent
  10694. * calls to the created function return the result of the last `func` invocation.
  10695. *
  10696. * @static
  10697. * @memberOf _
  10698. * @since 3.0.0
  10699. * @category Function
  10700. * @param {number} n The number of calls at which `func` is no longer invoked.
  10701. * @param {Function} func The function to restrict.
  10702. * @returns {Function} Returns the new restricted function.
  10703. * @example
  10704. *
  10705. * jQuery(element).on('click', _.before(5, addContactToList));
  10706. * // => Allows adding up to 4 contacts to the list.
  10707. */
  10708. function before(n, func) {
  10709. var result;
  10710. if (typeof func != 'function') {
  10711. throw new TypeError(FUNC_ERROR_TEXT);
  10712. }
  10713. n = toInteger(n);
  10714. return function() {
  10715. if (--n > 0) {
  10716. result = func.apply(this, arguments);
  10717. }
  10718. if (n <= 1) {
  10719. func = undefined;
  10720. }
  10721. return result;
  10722. };
  10723. }
  10724. /**
  10725. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  10726. * and `partials` prepended to the arguments it receives.
  10727. *
  10728. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  10729. * may be used as a placeholder for partially applied arguments.
  10730. *
  10731. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  10732. * property of bound functions.
  10733. *
  10734. * @static
  10735. * @memberOf _
  10736. * @since 0.1.0
  10737. * @category Function
  10738. * @param {Function} func The function to bind.
  10739. * @param {*} thisArg The `this` binding of `func`.
  10740. * @param {...*} [partials] The arguments to be partially applied.
  10741. * @returns {Function} Returns the new bound function.
  10742. * @example
  10743. *
  10744. * function greet(greeting, punctuation) {
  10745. * return greeting + ' ' + this.user + punctuation;
  10746. * }
  10747. *
  10748. * var object = { 'user': 'fred' };
  10749. *
  10750. * var bound = _.bind(greet, object, 'hi');
  10751. * bound('!');
  10752. * // => 'hi fred!'
  10753. *
  10754. * // Bound with placeholders.
  10755. * var bound = _.bind(greet, object, _, '!');
  10756. * bound('hi');
  10757. * // => 'hi fred!'
  10758. */
  10759. var bind = baseRest(function(func, thisArg, partials) {
  10760. var bitmask = WRAP_BIND_FLAG;
  10761. if (partials.length) {
  10762. var holders = replaceHolders(partials, getHolder(bind));
  10763. bitmask |= WRAP_PARTIAL_FLAG;
  10764. }
  10765. return createWrap(func, bitmask, thisArg, partials, holders);
  10766. });
  10767. /**
  10768. * Creates a function that invokes the method at `object[key]` with `partials`
  10769. * prepended to the arguments it receives.
  10770. *
  10771. * This method differs from `_.bind` by allowing bound functions to reference
  10772. * methods that may be redefined or don't yet exist. See
  10773. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  10774. * for more details.
  10775. *
  10776. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  10777. * builds, may be used as a placeholder for partially applied arguments.
  10778. *
  10779. * @static
  10780. * @memberOf _
  10781. * @since 0.10.0
  10782. * @category Function
  10783. * @param {Object} object The object to invoke the method on.
  10784. * @param {string} key The key of the method.
  10785. * @param {...*} [partials] The arguments to be partially applied.
  10786. * @returns {Function} Returns the new bound function.
  10787. * @example
  10788. *
  10789. * var object = {
  10790. * 'user': 'fred',
  10791. * 'greet': function(greeting, punctuation) {
  10792. * return greeting + ' ' + this.user + punctuation;
  10793. * }
  10794. * };
  10795. *
  10796. * var bound = _.bindKey(object, 'greet', 'hi');
  10797. * bound('!');
  10798. * // => 'hi fred!'
  10799. *
  10800. * object.greet = function(greeting, punctuation) {
  10801. * return greeting + 'ya ' + this.user + punctuation;
  10802. * };
  10803. *
  10804. * bound('!');
  10805. * // => 'hiya fred!'
  10806. *
  10807. * // Bound with placeholders.
  10808. * var bound = _.bindKey(object, 'greet', _, '!');
  10809. * bound('hi');
  10810. * // => 'hiya fred!'
  10811. */
  10812. var bindKey = baseRest(function(object, key, partials) {
  10813. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  10814. if (partials.length) {
  10815. var holders = replaceHolders(partials, getHolder(bindKey));
  10816. bitmask |= WRAP_PARTIAL_FLAG;
  10817. }
  10818. return createWrap(key, bitmask, object, partials, holders);
  10819. });
  10820. /**
  10821. * Creates a function that accepts arguments of `func` and either invokes
  10822. * `func` returning its result, if at least `arity` number of arguments have
  10823. * been provided, or returns a function that accepts the remaining `func`
  10824. * arguments, and so on. The arity of `func` may be specified if `func.length`
  10825. * is not sufficient.
  10826. *
  10827. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  10828. * may be used as a placeholder for provided arguments.
  10829. *
  10830. * **Note:** This method doesn't set the "length" property of curried functions.
  10831. *
  10832. * @static
  10833. * @memberOf _
  10834. * @since 2.0.0
  10835. * @category Function
  10836. * @param {Function} func The function to curry.
  10837. * @param {number} [arity=func.length] The arity of `func`.
  10838. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10839. * @returns {Function} Returns the new curried function.
  10840. * @example
  10841. *
  10842. * var abc = function(a, b, c) {
  10843. * return [a, b, c];
  10844. * };
  10845. *
  10846. * var curried = _.curry(abc);
  10847. *
  10848. * curried(1)(2)(3);
  10849. * // => [1, 2, 3]
  10850. *
  10851. * curried(1, 2)(3);
  10852. * // => [1, 2, 3]
  10853. *
  10854. * curried(1, 2, 3);
  10855. * // => [1, 2, 3]
  10856. *
  10857. * // Curried with placeholders.
  10858. * curried(1)(_, 3)(2);
  10859. * // => [1, 2, 3]
  10860. */
  10861. function curry(func, arity, guard) {
  10862. arity = guard ? undefined : arity;
  10863. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  10864. result.placeholder = curry.placeholder;
  10865. return result;
  10866. }
  10867. /**
  10868. * This method is like `_.curry` except that arguments are applied to `func`
  10869. * in the manner of `_.partialRight` instead of `_.partial`.
  10870. *
  10871. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  10872. * builds, may be used as a placeholder for provided arguments.
  10873. *
  10874. * **Note:** This method doesn't set the "length" property of curried functions.
  10875. *
  10876. * @static
  10877. * @memberOf _
  10878. * @since 3.0.0
  10879. * @category Function
  10880. * @param {Function} func The function to curry.
  10881. * @param {number} [arity=func.length] The arity of `func`.
  10882. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10883. * @returns {Function} Returns the new curried function.
  10884. * @example
  10885. *
  10886. * var abc = function(a, b, c) {
  10887. * return [a, b, c];
  10888. * };
  10889. *
  10890. * var curried = _.curryRight(abc);
  10891. *
  10892. * curried(3)(2)(1);
  10893. * // => [1, 2, 3]
  10894. *
  10895. * curried(2, 3)(1);
  10896. * // => [1, 2, 3]
  10897. *
  10898. * curried(1, 2, 3);
  10899. * // => [1, 2, 3]
  10900. *
  10901. * // Curried with placeholders.
  10902. * curried(3)(1, _)(2);
  10903. * // => [1, 2, 3]
  10904. */
  10905. function curryRight(func, arity, guard) {
  10906. arity = guard ? undefined : arity;
  10907. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  10908. result.placeholder = curryRight.placeholder;
  10909. return result;
  10910. }
  10911. /**
  10912. * Creates a debounced function that delays invoking `func` until after `wait`
  10913. * milliseconds have elapsed since the last time the debounced function was
  10914. * invoked. The debounced function comes with a `cancel` method to cancel
  10915. * delayed `func` invocations and a `flush` method to immediately invoke them.
  10916. * Provide `options` to indicate whether `func` should be invoked on the
  10917. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  10918. * with the last arguments provided to the debounced function. Subsequent
  10919. * calls to the debounced function return the result of the last `func`
  10920. * invocation.
  10921. *
  10922. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  10923. * invoked on the trailing edge of the timeout only if the debounced function
  10924. * is invoked more than once during the `wait` timeout.
  10925. *
  10926. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  10927. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  10928. *
  10929. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  10930. * for details over the differences between `_.debounce` and `_.throttle`.
  10931. *
  10932. * @static
  10933. * @memberOf _
  10934. * @since 0.1.0
  10935. * @category Function
  10936. * @param {Function} func The function to debounce.
  10937. * @param {number} [wait=0] The number of milliseconds to delay.
  10938. * @param {Object} [options={}] The options object.
  10939. * @param {boolean} [options.leading=false]
  10940. * Specify invoking on the leading edge of the timeout.
  10941. * @param {number} [options.maxWait]
  10942. * The maximum time `func` is allowed to be delayed before it's invoked.
  10943. * @param {boolean} [options.trailing=true]
  10944. * Specify invoking on the trailing edge of the timeout.
  10945. * @returns {Function} Returns the new debounced function.
  10946. * @example
  10947. *
  10948. * // Avoid costly calculations while the window size is in flux.
  10949. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  10950. *
  10951. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  10952. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  10953. * 'leading': true,
  10954. * 'trailing': false
  10955. * }));
  10956. *
  10957. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  10958. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  10959. * var source = new EventSource('/stream');
  10960. * jQuery(source).on('message', debounced);
  10961. *
  10962. * // Cancel the trailing debounced invocation.
  10963. * jQuery(window).on('popstate', debounced.cancel);
  10964. */
  10965. function debounce(func, wait, options) {
  10966. var lastArgs,
  10967. lastThis,
  10968. maxWait,
  10969. result,
  10970. timerId,
  10971. lastCallTime,
  10972. lastInvokeTime = 0,
  10973. leading = false,
  10974. maxing = false,
  10975. trailing = true;
  10976. if (typeof func != 'function') {
  10977. throw new TypeError(FUNC_ERROR_TEXT);
  10978. }
  10979. wait = toNumber(wait) || 0;
  10980. if (isObject(options)) {
  10981. leading = !!options.leading;
  10982. maxing = 'maxWait' in options;
  10983. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  10984. trailing = 'trailing' in options ? !!options.trailing : trailing;
  10985. }
  10986. function invokeFunc(time) {
  10987. var args = lastArgs,
  10988. thisArg = lastThis;
  10989. lastArgs = lastThis = undefined;
  10990. lastInvokeTime = time;
  10991. result = func.apply(thisArg, args);
  10992. return result;
  10993. }
  10994. function leadingEdge(time) {
  10995. // Reset any `maxWait` timer.
  10996. lastInvokeTime = time;
  10997. // Start the timer for the trailing edge.
  10998. timerId = setTimeout(timerExpired, wait);
  10999. // Invoke the leading edge.
  11000. return leading ? invokeFunc(time) : result;
  11001. }
  11002. function remainingWait(time) {
  11003. var timeSinceLastCall = time - lastCallTime,
  11004. timeSinceLastInvoke = time - lastInvokeTime,
  11005. timeWaiting = wait - timeSinceLastCall;
  11006. return maxing
  11007. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  11008. : timeWaiting;
  11009. }
  11010. function shouldInvoke(time) {
  11011. var timeSinceLastCall = time - lastCallTime,
  11012. timeSinceLastInvoke = time - lastInvokeTime;
  11013. // Either this is the first call, activity has stopped and we're at the
  11014. // trailing edge, the system time has gone backwards and we're treating
  11015. // it as the trailing edge, or we've hit the `maxWait` limit.
  11016. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  11017. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  11018. }
  11019. function timerExpired() {
  11020. var time = now();
  11021. if (shouldInvoke(time)) {
  11022. return trailingEdge(time);
  11023. }
  11024. // Restart the timer.
  11025. timerId = setTimeout(timerExpired, remainingWait(time));
  11026. }
  11027. function trailingEdge(time) {
  11028. timerId = undefined;
  11029. // Only invoke if we have `lastArgs` which means `func` has been
  11030. // debounced at least once.
  11031. if (trailing && lastArgs) {
  11032. return invokeFunc(time);
  11033. }
  11034. lastArgs = lastThis = undefined;
  11035. return result;
  11036. }
  11037. function cancel() {
  11038. if (timerId !== undefined) {
  11039. clearTimeout(timerId);
  11040. }
  11041. lastInvokeTime = 0;
  11042. lastArgs = lastCallTime = lastThis = timerId = undefined;
  11043. }
  11044. function flush() {
  11045. return timerId === undefined ? result : trailingEdge(now());
  11046. }
  11047. function debounced() {
  11048. var time = now(),
  11049. isInvoking = shouldInvoke(time);
  11050. lastArgs = arguments;
  11051. lastThis = this;
  11052. lastCallTime = time;
  11053. if (isInvoking) {
  11054. if (timerId === undefined) {
  11055. return leadingEdge(lastCallTime);
  11056. }
  11057. if (maxing) {
  11058. // Handle invocations in a tight loop.
  11059. clearTimeout(timerId);
  11060. timerId = setTimeout(timerExpired, wait);
  11061. return invokeFunc(lastCallTime);
  11062. }
  11063. }
  11064. if (timerId === undefined) {
  11065. timerId = setTimeout(timerExpired, wait);
  11066. }
  11067. return result;
  11068. }
  11069. debounced.cancel = cancel;
  11070. debounced.flush = flush;
  11071. return debounced;
  11072. }
  11073. /**
  11074. * Defers invoking the `func` until the current call stack has cleared. Any
  11075. * additional arguments are provided to `func` when it's invoked.
  11076. *
  11077. * @static
  11078. * @memberOf _
  11079. * @since 0.1.0
  11080. * @category Function
  11081. * @param {Function} func The function to defer.
  11082. * @param {...*} [args] The arguments to invoke `func` with.
  11083. * @returns {number} Returns the timer id.
  11084. * @example
  11085. *
  11086. * _.defer(function(text) {
  11087. * console.log(text);
  11088. * }, 'deferred');
  11089. * // => Logs 'deferred' after one millisecond.
  11090. */
  11091. var defer = baseRest(function(func, args) {
  11092. return baseDelay(func, 1, args);
  11093. });
  11094. /**
  11095. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  11096. * provided to `func` when it's invoked.
  11097. *
  11098. * @static
  11099. * @memberOf _
  11100. * @since 0.1.0
  11101. * @category Function
  11102. * @param {Function} func The function to delay.
  11103. * @param {number} wait The number of milliseconds to delay invocation.
  11104. * @param {...*} [args] The arguments to invoke `func` with.
  11105. * @returns {number} Returns the timer id.
  11106. * @example
  11107. *
  11108. * _.delay(function(text) {
  11109. * console.log(text);
  11110. * }, 1000, 'later');
  11111. * // => Logs 'later' after one second.
  11112. */
  11113. var delay = baseRest(function(func, wait, args) {
  11114. return baseDelay(func, toNumber(wait) || 0, args);
  11115. });
  11116. /**
  11117. * Creates a function that invokes `func` with arguments reversed.
  11118. *
  11119. * @static
  11120. * @memberOf _
  11121. * @since 4.0.0
  11122. * @category Function
  11123. * @param {Function} func The function to flip arguments for.
  11124. * @returns {Function} Returns the new flipped function.
  11125. * @example
  11126. *
  11127. * var flipped = _.flip(function() {
  11128. * return _.toArray(arguments);
  11129. * });
  11130. *
  11131. * flipped('a', 'b', 'c', 'd');
  11132. * // => ['d', 'c', 'b', 'a']
  11133. */
  11134. function flip(func) {
  11135. return createWrap(func, WRAP_FLIP_FLAG);
  11136. }
  11137. /**
  11138. * Creates a function that memoizes the result of `func`. If `resolver` is
  11139. * provided, it determines the cache key for storing the result based on the
  11140. * arguments provided to the memoized function. By default, the first argument
  11141. * provided to the memoized function is used as the map cache key. The `func`
  11142. * is invoked with the `this` binding of the memoized function.
  11143. *
  11144. * **Note:** The cache is exposed as the `cache` property on the memoized
  11145. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  11146. * constructor with one whose instances implement the
  11147. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  11148. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  11149. *
  11150. * @static
  11151. * @memberOf _
  11152. * @since 0.1.0
  11153. * @category Function
  11154. * @param {Function} func The function to have its output memoized.
  11155. * @param {Function} [resolver] The function to resolve the cache key.
  11156. * @returns {Function} Returns the new memoized function.
  11157. * @example
  11158. *
  11159. * var object = { 'a': 1, 'b': 2 };
  11160. * var other = { 'c': 3, 'd': 4 };
  11161. *
  11162. * var values = _.memoize(_.values);
  11163. * values(object);
  11164. * // => [1, 2]
  11165. *
  11166. * values(other);
  11167. * // => [3, 4]
  11168. *
  11169. * object.a = 2;
  11170. * values(object);
  11171. * // => [1, 2]
  11172. *
  11173. * // Modify the result cache.
  11174. * values.cache.set(object, ['a', 'b']);
  11175. * values(object);
  11176. * // => ['a', 'b']
  11177. *
  11178. * // Replace `_.memoize.Cache`.
  11179. * _.memoize.Cache = WeakMap;
  11180. */
  11181. function memoize(func, resolver) {
  11182. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  11183. throw new TypeError(FUNC_ERROR_TEXT);
  11184. }
  11185. var memoized = function() {
  11186. var args = arguments,
  11187. key = resolver ? resolver.apply(this, args) : args[0],
  11188. cache = memoized.cache;
  11189. if (cache.has(key)) {
  11190. return cache.get(key);
  11191. }
  11192. var result = func.apply(this, args);
  11193. memoized.cache = cache.set(key, result) || cache;
  11194. return result;
  11195. };
  11196. memoized.cache = new (memoize.Cache || MapCache);
  11197. return memoized;
  11198. }
  11199. // Expose `MapCache`.
  11200. memoize.Cache = MapCache;
  11201. /**
  11202. * Creates a function that negates the result of the predicate `func`. The
  11203. * `func` predicate is invoked with the `this` binding and arguments of the
  11204. * created function.
  11205. *
  11206. * @static
  11207. * @memberOf _
  11208. * @since 3.0.0
  11209. * @category Function
  11210. * @param {Function} predicate The predicate to negate.
  11211. * @returns {Function} Returns the new negated function.
  11212. * @example
  11213. *
  11214. * function isEven(n) {
  11215. * return n % 2 == 0;
  11216. * }
  11217. *
  11218. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  11219. * // => [1, 3, 5]
  11220. */
  11221. function negate(predicate) {
  11222. if (typeof predicate != 'function') {
  11223. throw new TypeError(FUNC_ERROR_TEXT);
  11224. }
  11225. return function() {
  11226. var args = arguments;
  11227. switch (args.length) {
  11228. case 0: return !predicate.call(this);
  11229. case 1: return !predicate.call(this, args[0]);
  11230. case 2: return !predicate.call(this, args[0], args[1]);
  11231. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  11232. }
  11233. return !predicate.apply(this, args);
  11234. };
  11235. }
  11236. /**
  11237. * Creates a function that is restricted to invoking `func` once. Repeat calls
  11238. * to the function return the value of the first invocation. The `func` is
  11239. * invoked with the `this` binding and arguments of the created function.
  11240. *
  11241. * @static
  11242. * @memberOf _
  11243. * @since 0.1.0
  11244. * @category Function
  11245. * @param {Function} func The function to restrict.
  11246. * @returns {Function} Returns the new restricted function.
  11247. * @example
  11248. *
  11249. * var initialize = _.once(createApplication);
  11250. * initialize();
  11251. * initialize();
  11252. * // => `createApplication` is invoked once
  11253. */
  11254. function once(func) {
  11255. return before(2, func);
  11256. }
  11257. /**
  11258. * Creates a function that invokes `func` with its arguments transformed.
  11259. *
  11260. * @static
  11261. * @since 4.0.0
  11262. * @memberOf _
  11263. * @category Function
  11264. * @param {Function} func The function to wrap.
  11265. * @param {...(Function|Function[])} [transforms=[_.identity]]
  11266. * The argument transforms.
  11267. * @returns {Function} Returns the new function.
  11268. * @example
  11269. *
  11270. * function doubled(n) {
  11271. * return n * 2;
  11272. * }
  11273. *
  11274. * function square(n) {
  11275. * return n * n;
  11276. * }
  11277. *
  11278. * var func = _.overArgs(function(x, y) {
  11279. * return [x, y];
  11280. * }, [square, doubled]);
  11281. *
  11282. * func(9, 3);
  11283. * // => [81, 6]
  11284. *
  11285. * func(10, 5);
  11286. * // => [100, 10]
  11287. */
  11288. var overArgs = castRest(function(func, transforms) {
  11289. transforms = (transforms.length == 1 && isArray(transforms[0]))
  11290. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  11291. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  11292. var funcsLength = transforms.length;
  11293. return baseRest(function(args) {
  11294. var index = -1,
  11295. length = nativeMin(args.length, funcsLength);
  11296. while (++index < length) {
  11297. args[index] = transforms[index].call(this, args[index]);
  11298. }
  11299. return apply(func, this, args);
  11300. });
  11301. });
  11302. /**
  11303. * Creates a function that invokes `func` with `partials` prepended to the
  11304. * arguments it receives. This method is like `_.bind` except it does **not**
  11305. * alter the `this` binding.
  11306. *
  11307. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  11308. * builds, may be used as a placeholder for partially applied arguments.
  11309. *
  11310. * **Note:** This method doesn't set the "length" property of partially
  11311. * applied functions.
  11312. *
  11313. * @static
  11314. * @memberOf _
  11315. * @since 0.2.0
  11316. * @category Function
  11317. * @param {Function} func The function to partially apply arguments to.
  11318. * @param {...*} [partials] The arguments to be partially applied.
  11319. * @returns {Function} Returns the new partially applied function.
  11320. * @example
  11321. *
  11322. * function greet(greeting, name) {
  11323. * return greeting + ' ' + name;
  11324. * }
  11325. *
  11326. * var sayHelloTo = _.partial(greet, 'hello');
  11327. * sayHelloTo('fred');
  11328. * // => 'hello fred'
  11329. *
  11330. * // Partially applied with placeholders.
  11331. * var greetFred = _.partial(greet, _, 'fred');
  11332. * greetFred('hi');
  11333. * // => 'hi fred'
  11334. */
  11335. var partial = baseRest(function(func, partials) {
  11336. var holders = replaceHolders(partials, getHolder(partial));
  11337. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  11338. });
  11339. /**
  11340. * This method is like `_.partial` except that partially applied arguments
  11341. * are appended to the arguments it receives.
  11342. *
  11343. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  11344. * builds, may be used as a placeholder for partially applied arguments.
  11345. *
  11346. * **Note:** This method doesn't set the "length" property of partially
  11347. * applied functions.
  11348. *
  11349. * @static
  11350. * @memberOf _
  11351. * @since 1.0.0
  11352. * @category Function
  11353. * @param {Function} func The function to partially apply arguments to.
  11354. * @param {...*} [partials] The arguments to be partially applied.
  11355. * @returns {Function} Returns the new partially applied function.
  11356. * @example
  11357. *
  11358. * function greet(greeting, name) {
  11359. * return greeting + ' ' + name;
  11360. * }
  11361. *
  11362. * var greetFred = _.partialRight(greet, 'fred');
  11363. * greetFred('hi');
  11364. * // => 'hi fred'
  11365. *
  11366. * // Partially applied with placeholders.
  11367. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  11368. * sayHelloTo('fred');
  11369. * // => 'hello fred'
  11370. */
  11371. var partialRight = baseRest(function(func, partials) {
  11372. var holders = replaceHolders(partials, getHolder(partialRight));
  11373. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  11374. });
  11375. /**
  11376. * Creates a function that invokes `func` with arguments arranged according
  11377. * to the specified `indexes` where the argument value at the first index is
  11378. * provided as the first argument, the argument value at the second index is
  11379. * provided as the second argument, and so on.
  11380. *
  11381. * @static
  11382. * @memberOf _
  11383. * @since 3.0.0
  11384. * @category Function
  11385. * @param {Function} func The function to rearrange arguments for.
  11386. * @param {...(number|number[])} indexes The arranged argument indexes.
  11387. * @returns {Function} Returns the new function.
  11388. * @example
  11389. *
  11390. * var rearged = _.rearg(function(a, b, c) {
  11391. * return [a, b, c];
  11392. * }, [2, 0, 1]);
  11393. *
  11394. * rearged('b', 'c', 'a')
  11395. * // => ['a', 'b', 'c']
  11396. */
  11397. var rearg = flatRest(function(func, indexes) {
  11398. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  11399. });
  11400. /**
  11401. * Creates a function that invokes `func` with the `this` binding of the
  11402. * created function and arguments from `start` and beyond provided as
  11403. * an array.
  11404. *
  11405. * **Note:** This method is based on the
  11406. * [rest parameter](https://mdn.io/rest_parameters).
  11407. *
  11408. * @static
  11409. * @memberOf _
  11410. * @since 4.0.0
  11411. * @category Function
  11412. * @param {Function} func The function to apply a rest parameter to.
  11413. * @param {number} [start=func.length-1] The start position of the rest parameter.
  11414. * @returns {Function} Returns the new function.
  11415. * @example
  11416. *
  11417. * var say = _.rest(function(what, names) {
  11418. * return what + ' ' + _.initial(names).join(', ') +
  11419. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  11420. * });
  11421. *
  11422. * say('hello', 'fred', 'barney', 'pebbles');
  11423. * // => 'hello fred, barney, & pebbles'
  11424. */
  11425. function rest(func, start) {
  11426. if (typeof func != 'function') {
  11427. throw new TypeError(FUNC_ERROR_TEXT);
  11428. }
  11429. start = start === undefined ? start : toInteger(start);
  11430. return baseRest(func, start);
  11431. }
  11432. /**
  11433. * Creates a function that invokes `func` with the `this` binding of the
  11434. * create function and an array of arguments much like
  11435. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  11436. *
  11437. * **Note:** This method is based on the
  11438. * [spread operator](https://mdn.io/spread_operator).
  11439. *
  11440. * @static
  11441. * @memberOf _
  11442. * @since 3.2.0
  11443. * @category Function
  11444. * @param {Function} func The function to spread arguments over.
  11445. * @param {number} [start=0] The start position of the spread.
  11446. * @returns {Function} Returns the new function.
  11447. * @example
  11448. *
  11449. * var say = _.spread(function(who, what) {
  11450. * return who + ' says ' + what;
  11451. * });
  11452. *
  11453. * say(['fred', 'hello']);
  11454. * // => 'fred says hello'
  11455. *
  11456. * var numbers = Promise.all([
  11457. * Promise.resolve(40),
  11458. * Promise.resolve(36)
  11459. * ]);
  11460. *
  11461. * numbers.then(_.spread(function(x, y) {
  11462. * return x + y;
  11463. * }));
  11464. * // => a Promise of 76
  11465. */
  11466. function spread(func, start) {
  11467. if (typeof func != 'function') {
  11468. throw new TypeError(FUNC_ERROR_TEXT);
  11469. }
  11470. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  11471. return baseRest(function(args) {
  11472. var array = args[start],
  11473. otherArgs = castSlice(args, 0, start);
  11474. if (array) {
  11475. arrayPush(otherArgs, array);
  11476. }
  11477. return apply(func, this, otherArgs);
  11478. });
  11479. }
  11480. /**
  11481. * Creates a throttled function that only invokes `func` at most once per
  11482. * every `wait` milliseconds. The throttled function comes with a `cancel`
  11483. * method to cancel delayed `func` invocations and a `flush` method to
  11484. * immediately invoke them. Provide `options` to indicate whether `func`
  11485. * should be invoked on the leading and/or trailing edge of the `wait`
  11486. * timeout. The `func` is invoked with the last arguments provided to the
  11487. * throttled function. Subsequent calls to the throttled function return the
  11488. * result of the last `func` invocation.
  11489. *
  11490. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  11491. * invoked on the trailing edge of the timeout only if the throttled function
  11492. * is invoked more than once during the `wait` timeout.
  11493. *
  11494. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  11495. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  11496. *
  11497. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  11498. * for details over the differences between `_.throttle` and `_.debounce`.
  11499. *
  11500. * @static
  11501. * @memberOf _
  11502. * @since 0.1.0
  11503. * @category Function
  11504. * @param {Function} func The function to throttle.
  11505. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  11506. * @param {Object} [options={}] The options object.
  11507. * @param {boolean} [options.leading=true]
  11508. * Specify invoking on the leading edge of the timeout.
  11509. * @param {boolean} [options.trailing=true]
  11510. * Specify invoking on the trailing edge of the timeout.
  11511. * @returns {Function} Returns the new throttled function.
  11512. * @example
  11513. *
  11514. * // Avoid excessively updating the position while scrolling.
  11515. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  11516. *
  11517. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  11518. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  11519. * jQuery(element).on('click', throttled);
  11520. *
  11521. * // Cancel the trailing throttled invocation.
  11522. * jQuery(window).on('popstate', throttled.cancel);
  11523. */
  11524. function throttle(func, wait, options) {
  11525. var leading = true,
  11526. trailing = true;
  11527. if (typeof func != 'function') {
  11528. throw new TypeError(FUNC_ERROR_TEXT);
  11529. }
  11530. if (isObject(options)) {
  11531. leading = 'leading' in options ? !!options.leading : leading;
  11532. trailing = 'trailing' in options ? !!options.trailing : trailing;
  11533. }
  11534. return debounce(func, wait, {
  11535. 'leading': leading,
  11536. 'maxWait': wait,
  11537. 'trailing': trailing
  11538. });
  11539. }
  11540. /**
  11541. * Creates a function that accepts up to one argument, ignoring any
  11542. * additional arguments.
  11543. *
  11544. * @static
  11545. * @memberOf _
  11546. * @since 4.0.0
  11547. * @category Function
  11548. * @param {Function} func The function to cap arguments for.
  11549. * @returns {Function} Returns the new capped function.
  11550. * @example
  11551. *
  11552. * _.map(['6', '8', '10'], _.unary(parseInt));
  11553. * // => [6, 8, 10]
  11554. */
  11555. function unary(func) {
  11556. return ary(func, 1);
  11557. }
  11558. /**
  11559. * Creates a function that provides `value` to `wrapper` as its first
  11560. * argument. Any additional arguments provided to the function are appended
  11561. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  11562. * binding of the created function.
  11563. *
  11564. * @static
  11565. * @memberOf _
  11566. * @since 0.1.0
  11567. * @category Function
  11568. * @param {*} value The value to wrap.
  11569. * @param {Function} [wrapper=identity] The wrapper function.
  11570. * @returns {Function} Returns the new function.
  11571. * @example
  11572. *
  11573. * var p = _.wrap(_.escape, function(func, text) {
  11574. * return '<p>' + func(text) + '</p>';
  11575. * });
  11576. *
  11577. * p('fred, barney, & pebbles');
  11578. * // => '<p>fred, barney, &amp; pebbles</p>'
  11579. */
  11580. function wrap(value, wrapper) {
  11581. return partial(castFunction(wrapper), value);
  11582. }
  11583. /*------------------------------------------------------------------------*/
  11584. /**
  11585. * Casts `value` as an array if it's not one.
  11586. *
  11587. * @static
  11588. * @memberOf _
  11589. * @since 4.4.0
  11590. * @category Lang
  11591. * @param {*} value The value to inspect.
  11592. * @returns {Array} Returns the cast array.
  11593. * @example
  11594. *
  11595. * _.castArray(1);
  11596. * // => [1]
  11597. *
  11598. * _.castArray({ 'a': 1 });
  11599. * // => [{ 'a': 1 }]
  11600. *
  11601. * _.castArray('abc');
  11602. * // => ['abc']
  11603. *
  11604. * _.castArray(null);
  11605. * // => [null]
  11606. *
  11607. * _.castArray(undefined);
  11608. * // => [undefined]
  11609. *
  11610. * _.castArray();
  11611. * // => []
  11612. *
  11613. * var array = [1, 2, 3];
  11614. * console.log(_.castArray(array) === array);
  11615. * // => true
  11616. */
  11617. function castArray() {
  11618. if (!arguments.length) {
  11619. return [];
  11620. }
  11621. var value = arguments[0];
  11622. return isArray(value) ? value : [value];
  11623. }
  11624. /**
  11625. * Creates a shallow clone of `value`.
  11626. *
  11627. * **Note:** This method is loosely based on the
  11628. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  11629. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  11630. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  11631. * arrays. The own enumerable properties of `arguments` objects are cloned
  11632. * as plain objects. An empty object is returned for uncloneable values such
  11633. * as error objects, functions, DOM nodes, and WeakMaps.
  11634. *
  11635. * @static
  11636. * @memberOf _
  11637. * @since 0.1.0
  11638. * @category Lang
  11639. * @param {*} value The value to clone.
  11640. * @returns {*} Returns the cloned value.
  11641. * @see _.cloneDeep
  11642. * @example
  11643. *
  11644. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  11645. *
  11646. * var shallow = _.clone(objects);
  11647. * console.log(shallow[0] === objects[0]);
  11648. * // => true
  11649. */
  11650. function clone(value) {
  11651. return baseClone(value, CLONE_SYMBOLS_FLAG);
  11652. }
  11653. /**
  11654. * This method is like `_.clone` except that it accepts `customizer` which
  11655. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  11656. * cloning is handled by the method instead. The `customizer` is invoked with
  11657. * up to four arguments; (value [, index|key, object, stack]).
  11658. *
  11659. * @static
  11660. * @memberOf _
  11661. * @since 4.0.0
  11662. * @category Lang
  11663. * @param {*} value The value to clone.
  11664. * @param {Function} [customizer] The function to customize cloning.
  11665. * @returns {*} Returns the cloned value.
  11666. * @see _.cloneDeepWith
  11667. * @example
  11668. *
  11669. * function customizer(value) {
  11670. * if (_.isElement(value)) {
  11671. * return value.cloneNode(false);
  11672. * }
  11673. * }
  11674. *
  11675. * var el = _.cloneWith(document.body, customizer);
  11676. *
  11677. * console.log(el === document.body);
  11678. * // => false
  11679. * console.log(el.nodeName);
  11680. * // => 'BODY'
  11681. * console.log(el.childNodes.length);
  11682. * // => 0
  11683. */
  11684. function cloneWith(value, customizer) {
  11685. customizer = typeof customizer == 'function' ? customizer : undefined;
  11686. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  11687. }
  11688. /**
  11689. * This method is like `_.clone` except that it recursively clones `value`.
  11690. *
  11691. * @static
  11692. * @memberOf _
  11693. * @since 1.0.0
  11694. * @category Lang
  11695. * @param {*} value The value to recursively clone.
  11696. * @returns {*} Returns the deep cloned value.
  11697. * @see _.clone
  11698. * @example
  11699. *
  11700. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  11701. *
  11702. * var deep = _.cloneDeep(objects);
  11703. * console.log(deep[0] === objects[0]);
  11704. * // => false
  11705. */
  11706. function cloneDeep(value) {
  11707. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  11708. }
  11709. /**
  11710. * This method is like `_.cloneWith` except that it recursively clones `value`.
  11711. *
  11712. * @static
  11713. * @memberOf _
  11714. * @since 4.0.0
  11715. * @category Lang
  11716. * @param {*} value The value to recursively clone.
  11717. * @param {Function} [customizer] The function to customize cloning.
  11718. * @returns {*} Returns the deep cloned value.
  11719. * @see _.cloneWith
  11720. * @example
  11721. *
  11722. * function customizer(value) {
  11723. * if (_.isElement(value)) {
  11724. * return value.cloneNode(true);
  11725. * }
  11726. * }
  11727. *
  11728. * var el = _.cloneDeepWith(document.body, customizer);
  11729. *
  11730. * console.log(el === document.body);
  11731. * // => false
  11732. * console.log(el.nodeName);
  11733. * // => 'BODY'
  11734. * console.log(el.childNodes.length);
  11735. * // => 20
  11736. */
  11737. function cloneDeepWith(value, customizer) {
  11738. customizer = typeof customizer == 'function' ? customizer : undefined;
  11739. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  11740. }
  11741. /**
  11742. * Checks if `object` conforms to `source` by invoking the predicate
  11743. * properties of `source` with the corresponding property values of `object`.
  11744. *
  11745. * **Note:** This method is equivalent to `_.conforms` when `source` is
  11746. * partially applied.
  11747. *
  11748. * @static
  11749. * @memberOf _
  11750. * @since 4.14.0
  11751. * @category Lang
  11752. * @param {Object} object The object to inspect.
  11753. * @param {Object} source The object of property predicates to conform to.
  11754. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  11755. * @example
  11756. *
  11757. * var object = { 'a': 1, 'b': 2 };
  11758. *
  11759. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  11760. * // => true
  11761. *
  11762. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  11763. * // => false
  11764. */
  11765. function conformsTo(object, source) {
  11766. return source == null || baseConformsTo(object, source, keys(source));
  11767. }
  11768. /**
  11769. * Performs a
  11770. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  11771. * comparison between two values to determine if they are equivalent.
  11772. *
  11773. * @static
  11774. * @memberOf _
  11775. * @since 4.0.0
  11776. * @category Lang
  11777. * @param {*} value The value to compare.
  11778. * @param {*} other The other value to compare.
  11779. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  11780. * @example
  11781. *
  11782. * var object = { 'a': 1 };
  11783. * var other = { 'a': 1 };
  11784. *
  11785. * _.eq(object, object);
  11786. * // => true
  11787. *
  11788. * _.eq(object, other);
  11789. * // => false
  11790. *
  11791. * _.eq('a', 'a');
  11792. * // => true
  11793. *
  11794. * _.eq('a', Object('a'));
  11795. * // => false
  11796. *
  11797. * _.eq(NaN, NaN);
  11798. * // => true
  11799. */
  11800. function eq(value, other) {
  11801. return value === other || (value !== value && other !== other);
  11802. }
  11803. /**
  11804. * Checks if `value` is greater than `other`.
  11805. *
  11806. * @static
  11807. * @memberOf _
  11808. * @since 3.9.0
  11809. * @category Lang
  11810. * @param {*} value The value to compare.
  11811. * @param {*} other The other value to compare.
  11812. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  11813. * else `false`.
  11814. * @see _.lt
  11815. * @example
  11816. *
  11817. * _.gt(3, 1);
  11818. * // => true
  11819. *
  11820. * _.gt(3, 3);
  11821. * // => false
  11822. *
  11823. * _.gt(1, 3);
  11824. * // => false
  11825. */
  11826. var gt = createRelationalOperation(baseGt);
  11827. /**
  11828. * Checks if `value` is greater than or equal to `other`.
  11829. *
  11830. * @static
  11831. * @memberOf _
  11832. * @since 3.9.0
  11833. * @category Lang
  11834. * @param {*} value The value to compare.
  11835. * @param {*} other The other value to compare.
  11836. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  11837. * `other`, else `false`.
  11838. * @see _.lte
  11839. * @example
  11840. *
  11841. * _.gte(3, 1);
  11842. * // => true
  11843. *
  11844. * _.gte(3, 3);
  11845. * // => true
  11846. *
  11847. * _.gte(1, 3);
  11848. * // => false
  11849. */
  11850. var gte = createRelationalOperation(function(value, other) {
  11851. return value >= other;
  11852. });
  11853. /**
  11854. * Checks if `value` is likely an `arguments` object.
  11855. *
  11856. * @static
  11857. * @memberOf _
  11858. * @since 0.1.0
  11859. * @category Lang
  11860. * @param {*} value The value to check.
  11861. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  11862. * else `false`.
  11863. * @example
  11864. *
  11865. * _.isArguments(function() { return arguments; }());
  11866. * // => true
  11867. *
  11868. * _.isArguments([1, 2, 3]);
  11869. * // => false
  11870. */
  11871. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  11872. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  11873. !propertyIsEnumerable.call(value, 'callee');
  11874. };
  11875. /**
  11876. * Checks if `value` is classified as an `Array` object.
  11877. *
  11878. * @static
  11879. * @memberOf _
  11880. * @since 0.1.0
  11881. * @category Lang
  11882. * @param {*} value The value to check.
  11883. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  11884. * @example
  11885. *
  11886. * _.isArray([1, 2, 3]);
  11887. * // => true
  11888. *
  11889. * _.isArray(document.body.children);
  11890. * // => false
  11891. *
  11892. * _.isArray('abc');
  11893. * // => false
  11894. *
  11895. * _.isArray(_.noop);
  11896. * // => false
  11897. */
  11898. var isArray = Array.isArray;
  11899. /**
  11900. * Checks if `value` is classified as an `ArrayBuffer` object.
  11901. *
  11902. * @static
  11903. * @memberOf _
  11904. * @since 4.3.0
  11905. * @category Lang
  11906. * @param {*} value The value to check.
  11907. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  11908. * @example
  11909. *
  11910. * _.isArrayBuffer(new ArrayBuffer(2));
  11911. * // => true
  11912. *
  11913. * _.isArrayBuffer(new Array(2));
  11914. * // => false
  11915. */
  11916. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  11917. /**
  11918. * Checks if `value` is array-like. A value is considered array-like if it's
  11919. * not a function and has a `value.length` that's an integer greater than or
  11920. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  11921. *
  11922. * @static
  11923. * @memberOf _
  11924. * @since 4.0.0
  11925. * @category Lang
  11926. * @param {*} value The value to check.
  11927. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  11928. * @example
  11929. *
  11930. * _.isArrayLike([1, 2, 3]);
  11931. * // => true
  11932. *
  11933. * _.isArrayLike(document.body.children);
  11934. * // => true
  11935. *
  11936. * _.isArrayLike('abc');
  11937. * // => true
  11938. *
  11939. * _.isArrayLike(_.noop);
  11940. * // => false
  11941. */
  11942. function isArrayLike(value) {
  11943. return value != null && isLength(value.length) && !isFunction(value);
  11944. }
  11945. /**
  11946. * This method is like `_.isArrayLike` except that it also checks if `value`
  11947. * is an object.
  11948. *
  11949. * @static
  11950. * @memberOf _
  11951. * @since 4.0.0
  11952. * @category Lang
  11953. * @param {*} value The value to check.
  11954. * @returns {boolean} Returns `true` if `value` is an array-like object,
  11955. * else `false`.
  11956. * @example
  11957. *
  11958. * _.isArrayLikeObject([1, 2, 3]);
  11959. * // => true
  11960. *
  11961. * _.isArrayLikeObject(document.body.children);
  11962. * // => true
  11963. *
  11964. * _.isArrayLikeObject('abc');
  11965. * // => false
  11966. *
  11967. * _.isArrayLikeObject(_.noop);
  11968. * // => false
  11969. */
  11970. function isArrayLikeObject(value) {
  11971. return isObjectLike(value) && isArrayLike(value);
  11972. }
  11973. /**
  11974. * Checks if `value` is classified as a boolean primitive or object.
  11975. *
  11976. * @static
  11977. * @memberOf _
  11978. * @since 0.1.0
  11979. * @category Lang
  11980. * @param {*} value The value to check.
  11981. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  11982. * @example
  11983. *
  11984. * _.isBoolean(false);
  11985. * // => true
  11986. *
  11987. * _.isBoolean(null);
  11988. * // => false
  11989. */
  11990. function isBoolean(value) {
  11991. return value === true || value === false ||
  11992. (isObjectLike(value) && baseGetTag(value) == boolTag);
  11993. }
  11994. /**
  11995. * Checks if `value` is a buffer.
  11996. *
  11997. * @static
  11998. * @memberOf _
  11999. * @since 4.3.0
  12000. * @category Lang
  12001. * @param {*} value The value to check.
  12002. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  12003. * @example
  12004. *
  12005. * _.isBuffer(new Buffer(2));
  12006. * // => true
  12007. *
  12008. * _.isBuffer(new Uint8Array(2));
  12009. * // => false
  12010. */
  12011. var isBuffer = nativeIsBuffer || stubFalse;
  12012. /**
  12013. * Checks if `value` is classified as a `Date` object.
  12014. *
  12015. * @static
  12016. * @memberOf _
  12017. * @since 0.1.0
  12018. * @category Lang
  12019. * @param {*} value The value to check.
  12020. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  12021. * @example
  12022. *
  12023. * _.isDate(new Date);
  12024. * // => true
  12025. *
  12026. * _.isDate('Mon April 23 2012');
  12027. * // => false
  12028. */
  12029. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  12030. /**
  12031. * Checks if `value` is likely a DOM element.
  12032. *
  12033. * @static
  12034. * @memberOf _
  12035. * @since 0.1.0
  12036. * @category Lang
  12037. * @param {*} value The value to check.
  12038. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  12039. * @example
  12040. *
  12041. * _.isElement(document.body);
  12042. * // => true
  12043. *
  12044. * _.isElement('<body>');
  12045. * // => false
  12046. */
  12047. function isElement(value) {
  12048. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  12049. }
  12050. /**
  12051. * Checks if `value` is an empty object, collection, map, or set.
  12052. *
  12053. * Objects are considered empty if they have no own enumerable string keyed
  12054. * properties.
  12055. *
  12056. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  12057. * jQuery-like collections are considered empty if they have a `length` of `0`.
  12058. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  12059. *
  12060. * @static
  12061. * @memberOf _
  12062. * @since 0.1.0
  12063. * @category Lang
  12064. * @param {*} value The value to check.
  12065. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  12066. * @example
  12067. *
  12068. * _.isEmpty(null);
  12069. * // => true
  12070. *
  12071. * _.isEmpty(true);
  12072. * // => true
  12073. *
  12074. * _.isEmpty(1);
  12075. * // => true
  12076. *
  12077. * _.isEmpty([1, 2, 3]);
  12078. * // => false
  12079. *
  12080. * _.isEmpty({ 'a': 1 });
  12081. * // => false
  12082. */
  12083. function isEmpty(value) {
  12084. if (value == null) {
  12085. return true;
  12086. }
  12087. if (isArrayLike(value) &&
  12088. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  12089. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  12090. return !value.length;
  12091. }
  12092. var tag = getTag(value);
  12093. if (tag == mapTag || tag == setTag) {
  12094. return !value.size;
  12095. }
  12096. if (isPrototype(value)) {
  12097. return !baseKeys(value).length;
  12098. }
  12099. for (var key in value) {
  12100. if (hasOwnProperty.call(value, key)) {
  12101. return false;
  12102. }
  12103. }
  12104. return true;
  12105. }
  12106. /**
  12107. * Performs a deep comparison between two values to determine if they are
  12108. * equivalent.
  12109. *
  12110. * **Note:** This method supports comparing arrays, array buffers, booleans,
  12111. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  12112. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  12113. * by their own, not inherited, enumerable properties. Functions and DOM
  12114. * nodes are compared by strict equality, i.e. `===`.
  12115. *
  12116. * @static
  12117. * @memberOf _
  12118. * @since 0.1.0
  12119. * @category Lang
  12120. * @param {*} value The value to compare.
  12121. * @param {*} other The other value to compare.
  12122. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  12123. * @example
  12124. *
  12125. * var object = { 'a': 1 };
  12126. * var other = { 'a': 1 };
  12127. *
  12128. * _.isEqual(object, other);
  12129. * // => true
  12130. *
  12131. * object === other;
  12132. * // => false
  12133. */
  12134. function isEqual(value, other) {
  12135. return baseIsEqual(value, other);
  12136. }
  12137. /**
  12138. * This method is like `_.isEqual` except that it accepts `customizer` which
  12139. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  12140. * are handled by the method instead. The `customizer` is invoked with up to
  12141. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  12142. *
  12143. * @static
  12144. * @memberOf _
  12145. * @since 4.0.0
  12146. * @category Lang
  12147. * @param {*} value The value to compare.
  12148. * @param {*} other The other value to compare.
  12149. * @param {Function} [customizer] The function to customize comparisons.
  12150. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  12151. * @example
  12152. *
  12153. * function isGreeting(value) {
  12154. * return /^h(?:i|ello)$/.test(value);
  12155. * }
  12156. *
  12157. * function customizer(objValue, othValue) {
  12158. * if (isGreeting(objValue) && isGreeting(othValue)) {
  12159. * return true;
  12160. * }
  12161. * }
  12162. *
  12163. * var array = ['hello', 'goodbye'];
  12164. * var other = ['hi', 'goodbye'];
  12165. *
  12166. * _.isEqualWith(array, other, customizer);
  12167. * // => true
  12168. */
  12169. function isEqualWith(value, other, customizer) {
  12170. customizer = typeof customizer == 'function' ? customizer : undefined;
  12171. var result = customizer ? customizer(value, other) : undefined;
  12172. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  12173. }
  12174. /**
  12175. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  12176. * `SyntaxError`, `TypeError`, or `URIError` object.
  12177. *
  12178. * @static
  12179. * @memberOf _
  12180. * @since 3.0.0
  12181. * @category Lang
  12182. * @param {*} value The value to check.
  12183. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  12184. * @example
  12185. *
  12186. * _.isError(new Error);
  12187. * // => true
  12188. *
  12189. * _.isError(Error);
  12190. * // => false
  12191. */
  12192. function isError(value) {
  12193. if (!isObjectLike(value)) {
  12194. return false;
  12195. }
  12196. var tag = baseGetTag(value);
  12197. return tag == errorTag || tag == domExcTag ||
  12198. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  12199. }
  12200. /**
  12201. * Checks if `value` is a finite primitive number.
  12202. *
  12203. * **Note:** This method is based on
  12204. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  12205. *
  12206. * @static
  12207. * @memberOf _
  12208. * @since 0.1.0
  12209. * @category Lang
  12210. * @param {*} value The value to check.
  12211. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  12212. * @example
  12213. *
  12214. * _.isFinite(3);
  12215. * // => true
  12216. *
  12217. * _.isFinite(Number.MIN_VALUE);
  12218. * // => true
  12219. *
  12220. * _.isFinite(Infinity);
  12221. * // => false
  12222. *
  12223. * _.isFinite('3');
  12224. * // => false
  12225. */
  12226. function isFinite(value) {
  12227. return typeof value == 'number' && nativeIsFinite(value);
  12228. }
  12229. /**
  12230. * Checks if `value` is classified as a `Function` object.
  12231. *
  12232. * @static
  12233. * @memberOf _
  12234. * @since 0.1.0
  12235. * @category Lang
  12236. * @param {*} value The value to check.
  12237. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  12238. * @example
  12239. *
  12240. * _.isFunction(_);
  12241. * // => true
  12242. *
  12243. * _.isFunction(/abc/);
  12244. * // => false
  12245. */
  12246. function isFunction(value) {
  12247. if (!isObject(value)) {
  12248. return false;
  12249. }
  12250. // The use of `Object#toString` avoids issues with the `typeof` operator
  12251. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  12252. var tag = baseGetTag(value);
  12253. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  12254. }
  12255. /**
  12256. * Checks if `value` is an integer.
  12257. *
  12258. * **Note:** This method is based on
  12259. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  12260. *
  12261. * @static
  12262. * @memberOf _
  12263. * @since 4.0.0
  12264. * @category Lang
  12265. * @param {*} value The value to check.
  12266. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  12267. * @example
  12268. *
  12269. * _.isInteger(3);
  12270. * // => true
  12271. *
  12272. * _.isInteger(Number.MIN_VALUE);
  12273. * // => false
  12274. *
  12275. * _.isInteger(Infinity);
  12276. * // => false
  12277. *
  12278. * _.isInteger('3');
  12279. * // => false
  12280. */
  12281. function isInteger(value) {
  12282. return typeof value == 'number' && value == toInteger(value);
  12283. }
  12284. /**
  12285. * Checks if `value` is a valid array-like length.
  12286. *
  12287. * **Note:** This method is loosely based on
  12288. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  12289. *
  12290. * @static
  12291. * @memberOf _
  12292. * @since 4.0.0
  12293. * @category Lang
  12294. * @param {*} value The value to check.
  12295. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  12296. * @example
  12297. *
  12298. * _.isLength(3);
  12299. * // => true
  12300. *
  12301. * _.isLength(Number.MIN_VALUE);
  12302. * // => false
  12303. *
  12304. * _.isLength(Infinity);
  12305. * // => false
  12306. *
  12307. * _.isLength('3');
  12308. * // => false
  12309. */
  12310. function isLength(value) {
  12311. return typeof value == 'number' &&
  12312. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  12313. }
  12314. /**
  12315. * Checks if `value` is the
  12316. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  12317. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  12318. *
  12319. * @static
  12320. * @memberOf _
  12321. * @since 0.1.0
  12322. * @category Lang
  12323. * @param {*} value The value to check.
  12324. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  12325. * @example
  12326. *
  12327. * _.isObject({});
  12328. * // => true
  12329. *
  12330. * _.isObject([1, 2, 3]);
  12331. * // => true
  12332. *
  12333. * _.isObject(_.noop);
  12334. * // => true
  12335. *
  12336. * _.isObject(null);
  12337. * // => false
  12338. */
  12339. function isObject(value) {
  12340. var type = typeof value;
  12341. return value != null && (type == 'object' || type == 'function');
  12342. }
  12343. /**
  12344. * Checks if `value` is object-like. A value is object-like if it's not `null`
  12345. * and has a `typeof` result of "object".
  12346. *
  12347. * @static
  12348. * @memberOf _
  12349. * @since 4.0.0
  12350. * @category Lang
  12351. * @param {*} value The value to check.
  12352. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  12353. * @example
  12354. *
  12355. * _.isObjectLike({});
  12356. * // => true
  12357. *
  12358. * _.isObjectLike([1, 2, 3]);
  12359. * // => true
  12360. *
  12361. * _.isObjectLike(_.noop);
  12362. * // => false
  12363. *
  12364. * _.isObjectLike(null);
  12365. * // => false
  12366. */
  12367. function isObjectLike(value) {
  12368. return value != null && typeof value == 'object';
  12369. }
  12370. /**
  12371. * Checks if `value` is classified as a `Map` object.
  12372. *
  12373. * @static
  12374. * @memberOf _
  12375. * @since 4.3.0
  12376. * @category Lang
  12377. * @param {*} value The value to check.
  12378. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  12379. * @example
  12380. *
  12381. * _.isMap(new Map);
  12382. * // => true
  12383. *
  12384. * _.isMap(new WeakMap);
  12385. * // => false
  12386. */
  12387. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  12388. /**
  12389. * Performs a partial deep comparison between `object` and `source` to
  12390. * determine if `object` contains equivalent property values.
  12391. *
  12392. * **Note:** This method is equivalent to `_.matches` when `source` is
  12393. * partially applied.
  12394. *
  12395. * Partial comparisons will match empty array and empty object `source`
  12396. * values against any array or object value, respectively. See `_.isEqual`
  12397. * for a list of supported value comparisons.
  12398. *
  12399. * @static
  12400. * @memberOf _
  12401. * @since 3.0.0
  12402. * @category Lang
  12403. * @param {Object} object The object to inspect.
  12404. * @param {Object} source The object of property values to match.
  12405. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  12406. * @example
  12407. *
  12408. * var object = { 'a': 1, 'b': 2 };
  12409. *
  12410. * _.isMatch(object, { 'b': 2 });
  12411. * // => true
  12412. *
  12413. * _.isMatch(object, { 'b': 1 });
  12414. * // => false
  12415. */
  12416. function isMatch(object, source) {
  12417. return object === source || baseIsMatch(object, source, getMatchData(source));
  12418. }
  12419. /**
  12420. * This method is like `_.isMatch` except that it accepts `customizer` which
  12421. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  12422. * are handled by the method instead. The `customizer` is invoked with five
  12423. * arguments: (objValue, srcValue, index|key, object, source).
  12424. *
  12425. * @static
  12426. * @memberOf _
  12427. * @since 4.0.0
  12428. * @category Lang
  12429. * @param {Object} object The object to inspect.
  12430. * @param {Object} source The object of property values to match.
  12431. * @param {Function} [customizer] The function to customize comparisons.
  12432. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  12433. * @example
  12434. *
  12435. * function isGreeting(value) {
  12436. * return /^h(?:i|ello)$/.test(value);
  12437. * }
  12438. *
  12439. * function customizer(objValue, srcValue) {
  12440. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  12441. * return true;
  12442. * }
  12443. * }
  12444. *
  12445. * var object = { 'greeting': 'hello' };
  12446. * var source = { 'greeting': 'hi' };
  12447. *
  12448. * _.isMatchWith(object, source, customizer);
  12449. * // => true
  12450. */
  12451. function isMatchWith(object, source, customizer) {
  12452. customizer = typeof customizer == 'function' ? customizer : undefined;
  12453. return baseIsMatch(object, source, getMatchData(source), customizer);
  12454. }
  12455. /**
  12456. * Checks if `value` is `NaN`.
  12457. *
  12458. * **Note:** This method is based on
  12459. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  12460. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  12461. * `undefined` and other non-number values.
  12462. *
  12463. * @static
  12464. * @memberOf _
  12465. * @since 0.1.0
  12466. * @category Lang
  12467. * @param {*} value The value to check.
  12468. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  12469. * @example
  12470. *
  12471. * _.isNaN(NaN);
  12472. * // => true
  12473. *
  12474. * _.isNaN(new Number(NaN));
  12475. * // => true
  12476. *
  12477. * isNaN(undefined);
  12478. * // => true
  12479. *
  12480. * _.isNaN(undefined);
  12481. * // => false
  12482. */
  12483. function isNaN(value) {
  12484. // An `NaN` primitive is the only value that is not equal to itself.
  12485. // Perform the `toStringTag` check first to avoid errors with some
  12486. // ActiveX objects in IE.
  12487. return isNumber(value) && value != +value;
  12488. }
  12489. /**
  12490. * Checks if `value` is a pristine native function.
  12491. *
  12492. * **Note:** This method can't reliably detect native functions in the presence
  12493. * of the core-js package because core-js circumvents this kind of detection.
  12494. * Despite multiple requests, the core-js maintainer has made it clear: any
  12495. * attempt to fix the detection will be obstructed. As a result, we're left
  12496. * with little choice but to throw an error. Unfortunately, this also affects
  12497. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  12498. * which rely on core-js.
  12499. *
  12500. * @static
  12501. * @memberOf _
  12502. * @since 3.0.0
  12503. * @category Lang
  12504. * @param {*} value The value to check.
  12505. * @returns {boolean} Returns `true` if `value` is a native function,
  12506. * else `false`.
  12507. * @example
  12508. *
  12509. * _.isNative(Array.prototype.push);
  12510. * // => true
  12511. *
  12512. * _.isNative(_);
  12513. * // => false
  12514. */
  12515. function isNative(value) {
  12516. if (isMaskable(value)) {
  12517. throw new Error(CORE_ERROR_TEXT);
  12518. }
  12519. return baseIsNative(value);
  12520. }
  12521. /**
  12522. * Checks if `value` is `null`.
  12523. *
  12524. * @static
  12525. * @memberOf _
  12526. * @since 0.1.0
  12527. * @category Lang
  12528. * @param {*} value The value to check.
  12529. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  12530. * @example
  12531. *
  12532. * _.isNull(null);
  12533. * // => true
  12534. *
  12535. * _.isNull(void 0);
  12536. * // => false
  12537. */
  12538. function isNull(value) {
  12539. return value === null;
  12540. }
  12541. /**
  12542. * Checks if `value` is `null` or `undefined`.
  12543. *
  12544. * @static
  12545. * @memberOf _
  12546. * @since 4.0.0
  12547. * @category Lang
  12548. * @param {*} value The value to check.
  12549. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  12550. * @example
  12551. *
  12552. * _.isNil(null);
  12553. * // => true
  12554. *
  12555. * _.isNil(void 0);
  12556. * // => true
  12557. *
  12558. * _.isNil(NaN);
  12559. * // => false
  12560. */
  12561. function isNil(value) {
  12562. return value == null;
  12563. }
  12564. /**
  12565. * Checks if `value` is classified as a `Number` primitive or object.
  12566. *
  12567. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  12568. * classified as numbers, use the `_.isFinite` method.
  12569. *
  12570. * @static
  12571. * @memberOf _
  12572. * @since 0.1.0
  12573. * @category Lang
  12574. * @param {*} value The value to check.
  12575. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  12576. * @example
  12577. *
  12578. * _.isNumber(3);
  12579. * // => true
  12580. *
  12581. * _.isNumber(Number.MIN_VALUE);
  12582. * // => true
  12583. *
  12584. * _.isNumber(Infinity);
  12585. * // => true
  12586. *
  12587. * _.isNumber('3');
  12588. * // => false
  12589. */
  12590. function isNumber(value) {
  12591. return typeof value == 'number' ||
  12592. (isObjectLike(value) && baseGetTag(value) == numberTag);
  12593. }
  12594. /**
  12595. * Checks if `value` is a plain object, that is, an object created by the
  12596. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  12597. *
  12598. * @static
  12599. * @memberOf _
  12600. * @since 0.8.0
  12601. * @category Lang
  12602. * @param {*} value The value to check.
  12603. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  12604. * @example
  12605. *
  12606. * function Foo() {
  12607. * this.a = 1;
  12608. * }
  12609. *
  12610. * _.isPlainObject(new Foo);
  12611. * // => false
  12612. *
  12613. * _.isPlainObject([1, 2, 3]);
  12614. * // => false
  12615. *
  12616. * _.isPlainObject({ 'x': 0, 'y': 0 });
  12617. * // => true
  12618. *
  12619. * _.isPlainObject(Object.create(null));
  12620. * // => true
  12621. */
  12622. function isPlainObject(value) {
  12623. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  12624. return false;
  12625. }
  12626. var proto = getPrototype(value);
  12627. if (proto === null) {
  12628. return true;
  12629. }
  12630. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  12631. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  12632. funcToString.call(Ctor) == objectCtorString;
  12633. }
  12634. /**
  12635. * Checks if `value` is classified as a `RegExp` object.
  12636. *
  12637. * @static
  12638. * @memberOf _
  12639. * @since 0.1.0
  12640. * @category Lang
  12641. * @param {*} value The value to check.
  12642. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  12643. * @example
  12644. *
  12645. * _.isRegExp(/abc/);
  12646. * // => true
  12647. *
  12648. * _.isRegExp('/abc/');
  12649. * // => false
  12650. */
  12651. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  12652. /**
  12653. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  12654. * double precision number which isn't the result of a rounded unsafe integer.
  12655. *
  12656. * **Note:** This method is based on
  12657. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  12658. *
  12659. * @static
  12660. * @memberOf _
  12661. * @since 4.0.0
  12662. * @category Lang
  12663. * @param {*} value The value to check.
  12664. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  12665. * @example
  12666. *
  12667. * _.isSafeInteger(3);
  12668. * // => true
  12669. *
  12670. * _.isSafeInteger(Number.MIN_VALUE);
  12671. * // => false
  12672. *
  12673. * _.isSafeInteger(Infinity);
  12674. * // => false
  12675. *
  12676. * _.isSafeInteger('3');
  12677. * // => false
  12678. */
  12679. function isSafeInteger(value) {
  12680. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  12681. }
  12682. /**
  12683. * Checks if `value` is classified as a `Set` object.
  12684. *
  12685. * @static
  12686. * @memberOf _
  12687. * @since 4.3.0
  12688. * @category Lang
  12689. * @param {*} value The value to check.
  12690. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  12691. * @example
  12692. *
  12693. * _.isSet(new Set);
  12694. * // => true
  12695. *
  12696. * _.isSet(new WeakSet);
  12697. * // => false
  12698. */
  12699. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  12700. /**
  12701. * Checks if `value` is classified as a `String` primitive or object.
  12702. *
  12703. * @static
  12704. * @since 0.1.0
  12705. * @memberOf _
  12706. * @category Lang
  12707. * @param {*} value The value to check.
  12708. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  12709. * @example
  12710. *
  12711. * _.isString('abc');
  12712. * // => true
  12713. *
  12714. * _.isString(1);
  12715. * // => false
  12716. */
  12717. function isString(value) {
  12718. return typeof value == 'string' ||
  12719. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  12720. }
  12721. /**
  12722. * Checks if `value` is classified as a `Symbol` primitive or object.
  12723. *
  12724. * @static
  12725. * @memberOf _
  12726. * @since 4.0.0
  12727. * @category Lang
  12728. * @param {*} value The value to check.
  12729. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  12730. * @example
  12731. *
  12732. * _.isSymbol(Symbol.iterator);
  12733. * // => true
  12734. *
  12735. * _.isSymbol('abc');
  12736. * // => false
  12737. */
  12738. function isSymbol(value) {
  12739. return typeof value == 'symbol' ||
  12740. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  12741. }
  12742. /**
  12743. * Checks if `value` is classified as a typed array.
  12744. *
  12745. * @static
  12746. * @memberOf _
  12747. * @since 3.0.0
  12748. * @category Lang
  12749. * @param {*} value The value to check.
  12750. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  12751. * @example
  12752. *
  12753. * _.isTypedArray(new Uint8Array);
  12754. * // => true
  12755. *
  12756. * _.isTypedArray([]);
  12757. * // => false
  12758. */
  12759. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  12760. /**
  12761. * Checks if `value` is `undefined`.
  12762. *
  12763. * @static
  12764. * @since 0.1.0
  12765. * @memberOf _
  12766. * @category Lang
  12767. * @param {*} value The value to check.
  12768. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  12769. * @example
  12770. *
  12771. * _.isUndefined(void 0);
  12772. * // => true
  12773. *
  12774. * _.isUndefined(null);
  12775. * // => false
  12776. */
  12777. function isUndefined(value) {
  12778. return value === undefined;
  12779. }
  12780. /**
  12781. * Checks if `value` is classified as a `WeakMap` object.
  12782. *
  12783. * @static
  12784. * @memberOf _
  12785. * @since 4.3.0
  12786. * @category Lang
  12787. * @param {*} value The value to check.
  12788. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  12789. * @example
  12790. *
  12791. * _.isWeakMap(new WeakMap);
  12792. * // => true
  12793. *
  12794. * _.isWeakMap(new Map);
  12795. * // => false
  12796. */
  12797. function isWeakMap(value) {
  12798. return isObjectLike(value) && getTag(value) == weakMapTag;
  12799. }
  12800. /**
  12801. * Checks if `value` is classified as a `WeakSet` object.
  12802. *
  12803. * @static
  12804. * @memberOf _
  12805. * @since 4.3.0
  12806. * @category Lang
  12807. * @param {*} value The value to check.
  12808. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  12809. * @example
  12810. *
  12811. * _.isWeakSet(new WeakSet);
  12812. * // => true
  12813. *
  12814. * _.isWeakSet(new Set);
  12815. * // => false
  12816. */
  12817. function isWeakSet(value) {
  12818. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  12819. }
  12820. /**
  12821. * Checks if `value` is less than `other`.
  12822. *
  12823. * @static
  12824. * @memberOf _
  12825. * @since 3.9.0
  12826. * @category Lang
  12827. * @param {*} value The value to compare.
  12828. * @param {*} other The other value to compare.
  12829. * @returns {boolean} Returns `true` if `value` is less than `other`,
  12830. * else `false`.
  12831. * @see _.gt
  12832. * @example
  12833. *
  12834. * _.lt(1, 3);
  12835. * // => true
  12836. *
  12837. * _.lt(3, 3);
  12838. * // => false
  12839. *
  12840. * _.lt(3, 1);
  12841. * // => false
  12842. */
  12843. var lt = createRelationalOperation(baseLt);
  12844. /**
  12845. * Checks if `value` is less than or equal to `other`.
  12846. *
  12847. * @static
  12848. * @memberOf _
  12849. * @since 3.9.0
  12850. * @category Lang
  12851. * @param {*} value The value to compare.
  12852. * @param {*} other The other value to compare.
  12853. * @returns {boolean} Returns `true` if `value` is less than or equal to
  12854. * `other`, else `false`.
  12855. * @see _.gte
  12856. * @example
  12857. *
  12858. * _.lte(1, 3);
  12859. * // => true
  12860. *
  12861. * _.lte(3, 3);
  12862. * // => true
  12863. *
  12864. * _.lte(3, 1);
  12865. * // => false
  12866. */
  12867. var lte = createRelationalOperation(function(value, other) {
  12868. return value <= other;
  12869. });
  12870. /**
  12871. * Converts `value` to an array.
  12872. *
  12873. * @static
  12874. * @since 0.1.0
  12875. * @memberOf _
  12876. * @category Lang
  12877. * @param {*} value The value to convert.
  12878. * @returns {Array} Returns the converted array.
  12879. * @example
  12880. *
  12881. * _.toArray({ 'a': 1, 'b': 2 });
  12882. * // => [1, 2]
  12883. *
  12884. * _.toArray('abc');
  12885. * // => ['a', 'b', 'c']
  12886. *
  12887. * _.toArray(1);
  12888. * // => []
  12889. *
  12890. * _.toArray(null);
  12891. * // => []
  12892. */
  12893. function toArray(value) {
  12894. if (!value) {
  12895. return [];
  12896. }
  12897. if (isArrayLike(value)) {
  12898. return isString(value) ? stringToArray(value) : copyArray(value);
  12899. }
  12900. if (symIterator && value[symIterator]) {
  12901. return iteratorToArray(value[symIterator]());
  12902. }
  12903. var tag = getTag(value),
  12904. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  12905. return func(value);
  12906. }
  12907. /**
  12908. * Converts `value` to a finite number.
  12909. *
  12910. * @static
  12911. * @memberOf _
  12912. * @since 4.12.0
  12913. * @category Lang
  12914. * @param {*} value The value to convert.
  12915. * @returns {number} Returns the converted number.
  12916. * @example
  12917. *
  12918. * _.toFinite(3.2);
  12919. * // => 3.2
  12920. *
  12921. * _.toFinite(Number.MIN_VALUE);
  12922. * // => 5e-324
  12923. *
  12924. * _.toFinite(Infinity);
  12925. * // => 1.7976931348623157e+308
  12926. *
  12927. * _.toFinite('3.2');
  12928. * // => 3.2
  12929. */
  12930. function toFinite(value) {
  12931. if (!value) {
  12932. return value === 0 ? value : 0;
  12933. }
  12934. value = toNumber(value);
  12935. if (value === INFINITY || value === -INFINITY) {
  12936. var sign = (value < 0 ? -1 : 1);
  12937. return sign * MAX_INTEGER;
  12938. }
  12939. return value === value ? value : 0;
  12940. }
  12941. /**
  12942. * Converts `value` to an integer.
  12943. *
  12944. * **Note:** This method is loosely based on
  12945. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  12946. *
  12947. * @static
  12948. * @memberOf _
  12949. * @since 4.0.0
  12950. * @category Lang
  12951. * @param {*} value The value to convert.
  12952. * @returns {number} Returns the converted integer.
  12953. * @example
  12954. *
  12955. * _.toInteger(3.2);
  12956. * // => 3
  12957. *
  12958. * _.toInteger(Number.MIN_VALUE);
  12959. * // => 0
  12960. *
  12961. * _.toInteger(Infinity);
  12962. * // => 1.7976931348623157e+308
  12963. *
  12964. * _.toInteger('3.2');
  12965. * // => 3
  12966. */
  12967. function toInteger(value) {
  12968. var result = toFinite(value),
  12969. remainder = result % 1;
  12970. return result === result ? (remainder ? result - remainder : result) : 0;
  12971. }
  12972. /**
  12973. * Converts `value` to an integer suitable for use as the length of an
  12974. * array-like object.
  12975. *
  12976. * **Note:** This method is based on
  12977. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  12978. *
  12979. * @static
  12980. * @memberOf _
  12981. * @since 4.0.0
  12982. * @category Lang
  12983. * @param {*} value The value to convert.
  12984. * @returns {number} Returns the converted integer.
  12985. * @example
  12986. *
  12987. * _.toLength(3.2);
  12988. * // => 3
  12989. *
  12990. * _.toLength(Number.MIN_VALUE);
  12991. * // => 0
  12992. *
  12993. * _.toLength(Infinity);
  12994. * // => 4294967295
  12995. *
  12996. * _.toLength('3.2');
  12997. * // => 3
  12998. */
  12999. function toLength(value) {
  13000. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  13001. }
  13002. /**
  13003. * Converts `value` to a number.
  13004. *
  13005. * @static
  13006. * @memberOf _
  13007. * @since 4.0.0
  13008. * @category Lang
  13009. * @param {*} value The value to process.
  13010. * @returns {number} Returns the number.
  13011. * @example
  13012. *
  13013. * _.toNumber(3.2);
  13014. * // => 3.2
  13015. *
  13016. * _.toNumber(Number.MIN_VALUE);
  13017. * // => 5e-324
  13018. *
  13019. * _.toNumber(Infinity);
  13020. * // => Infinity
  13021. *
  13022. * _.toNumber('3.2');
  13023. * // => 3.2
  13024. */
  13025. function toNumber(value) {
  13026. if (typeof value == 'number') {
  13027. return value;
  13028. }
  13029. if (isSymbol(value)) {
  13030. return NAN;
  13031. }
  13032. if (isObject(value)) {
  13033. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  13034. value = isObject(other) ? (other + '') : other;
  13035. }
  13036. if (typeof value != 'string') {
  13037. return value === 0 ? value : +value;
  13038. }
  13039. value = baseTrim(value);
  13040. var isBinary = reIsBinary.test(value);
  13041. return (isBinary || reIsOctal.test(value))
  13042. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  13043. : (reIsBadHex.test(value) ? NAN : +value);
  13044. }
  13045. /**
  13046. * Converts `value` to a plain object flattening inherited enumerable string
  13047. * keyed properties of `value` to own properties of the plain object.
  13048. *
  13049. * @static
  13050. * @memberOf _
  13051. * @since 3.0.0
  13052. * @category Lang
  13053. * @param {*} value The value to convert.
  13054. * @returns {Object} Returns the converted plain object.
  13055. * @example
  13056. *
  13057. * function Foo() {
  13058. * this.b = 2;
  13059. * }
  13060. *
  13061. * Foo.prototype.c = 3;
  13062. *
  13063. * _.assign({ 'a': 1 }, new Foo);
  13064. * // => { 'a': 1, 'b': 2 }
  13065. *
  13066. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  13067. * // => { 'a': 1, 'b': 2, 'c': 3 }
  13068. */
  13069. function toPlainObject(value) {
  13070. return copyObject(value, keysIn(value));
  13071. }
  13072. /**
  13073. * Converts `value` to a safe integer. A safe integer can be compared and
  13074. * represented correctly.
  13075. *
  13076. * @static
  13077. * @memberOf _
  13078. * @since 4.0.0
  13079. * @category Lang
  13080. * @param {*} value The value to convert.
  13081. * @returns {number} Returns the converted integer.
  13082. * @example
  13083. *
  13084. * _.toSafeInteger(3.2);
  13085. * // => 3
  13086. *
  13087. * _.toSafeInteger(Number.MIN_VALUE);
  13088. * // => 0
  13089. *
  13090. * _.toSafeInteger(Infinity);
  13091. * // => 9007199254740991
  13092. *
  13093. * _.toSafeInteger('3.2');
  13094. * // => 3
  13095. */
  13096. function toSafeInteger(value) {
  13097. return value
  13098. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  13099. : (value === 0 ? value : 0);
  13100. }
  13101. /**
  13102. * Converts `value` to a string. An empty string is returned for `null`
  13103. * and `undefined` values. The sign of `-0` is preserved.
  13104. *
  13105. * @static
  13106. * @memberOf _
  13107. * @since 4.0.0
  13108. * @category Lang
  13109. * @param {*} value The value to convert.
  13110. * @returns {string} Returns the converted string.
  13111. * @example
  13112. *
  13113. * _.toString(null);
  13114. * // => ''
  13115. *
  13116. * _.toString(-0);
  13117. * // => '-0'
  13118. *
  13119. * _.toString([1, 2, 3]);
  13120. * // => '1,2,3'
  13121. */
  13122. function toString(value) {
  13123. return value == null ? '' : baseToString(value);
  13124. }
  13125. /*------------------------------------------------------------------------*/
  13126. /**
  13127. * Assigns own enumerable string keyed properties of source objects to the
  13128. * destination object. Source objects are applied from left to right.
  13129. * Subsequent sources overwrite property assignments of previous sources.
  13130. *
  13131. * **Note:** This method mutates `object` and is loosely based on
  13132. * [`Object.assign`](https://mdn.io/Object/assign).
  13133. *
  13134. * @static
  13135. * @memberOf _
  13136. * @since 0.10.0
  13137. * @category Object
  13138. * @param {Object} object The destination object.
  13139. * @param {...Object} [sources] The source objects.
  13140. * @returns {Object} Returns `object`.
  13141. * @see _.assignIn
  13142. * @example
  13143. *
  13144. * function Foo() {
  13145. * this.a = 1;
  13146. * }
  13147. *
  13148. * function Bar() {
  13149. * this.c = 3;
  13150. * }
  13151. *
  13152. * Foo.prototype.b = 2;
  13153. * Bar.prototype.d = 4;
  13154. *
  13155. * _.assign({ 'a': 0 }, new Foo, new Bar);
  13156. * // => { 'a': 1, 'c': 3 }
  13157. */
  13158. var assign = createAssigner(function(object, source) {
  13159. if (isPrototype(source) || isArrayLike(source)) {
  13160. copyObject(source, keys(source), object);
  13161. return;
  13162. }
  13163. for (var key in source) {
  13164. if (hasOwnProperty.call(source, key)) {
  13165. assignValue(object, key, source[key]);
  13166. }
  13167. }
  13168. });
  13169. /**
  13170. * This method is like `_.assign` except that it iterates over own and
  13171. * inherited source properties.
  13172. *
  13173. * **Note:** This method mutates `object`.
  13174. *
  13175. * @static
  13176. * @memberOf _
  13177. * @since 4.0.0
  13178. * @alias extend
  13179. * @category Object
  13180. * @param {Object} object The destination object.
  13181. * @param {...Object} [sources] The source objects.
  13182. * @returns {Object} Returns `object`.
  13183. * @see _.assign
  13184. * @example
  13185. *
  13186. * function Foo() {
  13187. * this.a = 1;
  13188. * }
  13189. *
  13190. * function Bar() {
  13191. * this.c = 3;
  13192. * }
  13193. *
  13194. * Foo.prototype.b = 2;
  13195. * Bar.prototype.d = 4;
  13196. *
  13197. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  13198. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  13199. */
  13200. var assignIn = createAssigner(function(object, source) {
  13201. copyObject(source, keysIn(source), object);
  13202. });
  13203. /**
  13204. * This method is like `_.assignIn` except that it accepts `customizer`
  13205. * which is invoked to produce the assigned values. If `customizer` returns
  13206. * `undefined`, assignment is handled by the method instead. The `customizer`
  13207. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  13208. *
  13209. * **Note:** This method mutates `object`.
  13210. *
  13211. * @static
  13212. * @memberOf _
  13213. * @since 4.0.0
  13214. * @alias extendWith
  13215. * @category Object
  13216. * @param {Object} object The destination object.
  13217. * @param {...Object} sources The source objects.
  13218. * @param {Function} [customizer] The function to customize assigned values.
  13219. * @returns {Object} Returns `object`.
  13220. * @see _.assignWith
  13221. * @example
  13222. *
  13223. * function customizer(objValue, srcValue) {
  13224. * return _.isUndefined(objValue) ? srcValue : objValue;
  13225. * }
  13226. *
  13227. * var defaults = _.partialRight(_.assignInWith, customizer);
  13228. *
  13229. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  13230. * // => { 'a': 1, 'b': 2 }
  13231. */
  13232. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  13233. copyObject(source, keysIn(source), object, customizer);
  13234. });
  13235. /**
  13236. * This method is like `_.assign` except that it accepts `customizer`
  13237. * which is invoked to produce the assigned values. If `customizer` returns
  13238. * `undefined`, assignment is handled by the method instead. The `customizer`
  13239. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  13240. *
  13241. * **Note:** This method mutates `object`.
  13242. *
  13243. * @static
  13244. * @memberOf _
  13245. * @since 4.0.0
  13246. * @category Object
  13247. * @param {Object} object The destination object.
  13248. * @param {...Object} sources The source objects.
  13249. * @param {Function} [customizer] The function to customize assigned values.
  13250. * @returns {Object} Returns `object`.
  13251. * @see _.assignInWith
  13252. * @example
  13253. *
  13254. * function customizer(objValue, srcValue) {
  13255. * return _.isUndefined(objValue) ? srcValue : objValue;
  13256. * }
  13257. *
  13258. * var defaults = _.partialRight(_.assignWith, customizer);
  13259. *
  13260. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  13261. * // => { 'a': 1, 'b': 2 }
  13262. */
  13263. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  13264. copyObject(source, keys(source), object, customizer);
  13265. });
  13266. /**
  13267. * Creates an array of values corresponding to `paths` of `object`.
  13268. *
  13269. * @static
  13270. * @memberOf _
  13271. * @since 1.0.0
  13272. * @category Object
  13273. * @param {Object} object The object to iterate over.
  13274. * @param {...(string|string[])} [paths] The property paths to pick.
  13275. * @returns {Array} Returns the picked values.
  13276. * @example
  13277. *
  13278. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  13279. *
  13280. * _.at(object, ['a[0].b.c', 'a[1]']);
  13281. * // => [3, 4]
  13282. */
  13283. var at = flatRest(baseAt);
  13284. /**
  13285. * Creates an object that inherits from the `prototype` object. If a
  13286. * `properties` object is given, its own enumerable string keyed properties
  13287. * are assigned to the created object.
  13288. *
  13289. * @static
  13290. * @memberOf _
  13291. * @since 2.3.0
  13292. * @category Object
  13293. * @param {Object} prototype The object to inherit from.
  13294. * @param {Object} [properties] The properties to assign to the object.
  13295. * @returns {Object} Returns the new object.
  13296. * @example
  13297. *
  13298. * function Shape() {
  13299. * this.x = 0;
  13300. * this.y = 0;
  13301. * }
  13302. *
  13303. * function Circle() {
  13304. * Shape.call(this);
  13305. * }
  13306. *
  13307. * Circle.prototype = _.create(Shape.prototype, {
  13308. * 'constructor': Circle
  13309. * });
  13310. *
  13311. * var circle = new Circle;
  13312. * circle instanceof Circle;
  13313. * // => true
  13314. *
  13315. * circle instanceof Shape;
  13316. * // => true
  13317. */
  13318. function create(prototype, properties) {
  13319. var result = baseCreate(prototype);
  13320. return properties == null ? result : baseAssign(result, properties);
  13321. }
  13322. /**
  13323. * Assigns own and inherited enumerable string keyed properties of source
  13324. * objects to the destination object for all destination properties that
  13325. * resolve to `undefined`. Source objects are applied from left to right.
  13326. * Once a property is set, additional values of the same property are ignored.
  13327. *
  13328. * **Note:** This method mutates `object`.
  13329. *
  13330. * @static
  13331. * @since 0.1.0
  13332. * @memberOf _
  13333. * @category Object
  13334. * @param {Object} object The destination object.
  13335. * @param {...Object} [sources] The source objects.
  13336. * @returns {Object} Returns `object`.
  13337. * @see _.defaultsDeep
  13338. * @example
  13339. *
  13340. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  13341. * // => { 'a': 1, 'b': 2 }
  13342. */
  13343. var defaults = baseRest(function(object, sources) {
  13344. object = Object(object);
  13345. var index = -1;
  13346. var length = sources.length;
  13347. var guard = length > 2 ? sources[2] : undefined;
  13348. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  13349. length = 1;
  13350. }
  13351. while (++index < length) {
  13352. var source = sources[index];
  13353. var props = keysIn(source);
  13354. var propsIndex = -1;
  13355. var propsLength = props.length;
  13356. while (++propsIndex < propsLength) {
  13357. var key = props[propsIndex];
  13358. var value = object[key];
  13359. if (value === undefined ||
  13360. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  13361. object[key] = source[key];
  13362. }
  13363. }
  13364. }
  13365. return object;
  13366. });
  13367. /**
  13368. * This method is like `_.defaults` except that it recursively assigns
  13369. * default properties.
  13370. *
  13371. * **Note:** This method mutates `object`.
  13372. *
  13373. * @static
  13374. * @memberOf _
  13375. * @since 3.10.0
  13376. * @category Object
  13377. * @param {Object} object The destination object.
  13378. * @param {...Object} [sources] The source objects.
  13379. * @returns {Object} Returns `object`.
  13380. * @see _.defaults
  13381. * @example
  13382. *
  13383. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  13384. * // => { 'a': { 'b': 2, 'c': 3 } }
  13385. */
  13386. var defaultsDeep = baseRest(function(args) {
  13387. args.push(undefined, customDefaultsMerge);
  13388. return apply(mergeWith, undefined, args);
  13389. });
  13390. /**
  13391. * This method is like `_.find` except that it returns the key of the first
  13392. * element `predicate` returns truthy for instead of the element itself.
  13393. *
  13394. * @static
  13395. * @memberOf _
  13396. * @since 1.1.0
  13397. * @category Object
  13398. * @param {Object} object The object to inspect.
  13399. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  13400. * @returns {string|undefined} Returns the key of the matched element,
  13401. * else `undefined`.
  13402. * @example
  13403. *
  13404. * var users = {
  13405. * 'barney': { 'age': 36, 'active': true },
  13406. * 'fred': { 'age': 40, 'active': false },
  13407. * 'pebbles': { 'age': 1, 'active': true }
  13408. * };
  13409. *
  13410. * _.findKey(users, function(o) { return o.age < 40; });
  13411. * // => 'barney' (iteration order is not guaranteed)
  13412. *
  13413. * // The `_.matches` iteratee shorthand.
  13414. * _.findKey(users, { 'age': 1, 'active': true });
  13415. * // => 'pebbles'
  13416. *
  13417. * // The `_.matchesProperty` iteratee shorthand.
  13418. * _.findKey(users, ['active', false]);
  13419. * // => 'fred'
  13420. *
  13421. * // The `_.property` iteratee shorthand.
  13422. * _.findKey(users, 'active');
  13423. * // => 'barney'
  13424. */
  13425. function findKey(object, predicate) {
  13426. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  13427. }
  13428. /**
  13429. * This method is like `_.findKey` except that it iterates over elements of
  13430. * a collection in the opposite order.
  13431. *
  13432. * @static
  13433. * @memberOf _
  13434. * @since 2.0.0
  13435. * @category Object
  13436. * @param {Object} object The object to inspect.
  13437. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  13438. * @returns {string|undefined} Returns the key of the matched element,
  13439. * else `undefined`.
  13440. * @example
  13441. *
  13442. * var users = {
  13443. * 'barney': { 'age': 36, 'active': true },
  13444. * 'fred': { 'age': 40, 'active': false },
  13445. * 'pebbles': { 'age': 1, 'active': true }
  13446. * };
  13447. *
  13448. * _.findLastKey(users, function(o) { return o.age < 40; });
  13449. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  13450. *
  13451. * // The `_.matches` iteratee shorthand.
  13452. * _.findLastKey(users, { 'age': 36, 'active': true });
  13453. * // => 'barney'
  13454. *
  13455. * // The `_.matchesProperty` iteratee shorthand.
  13456. * _.findLastKey(users, ['active', false]);
  13457. * // => 'fred'
  13458. *
  13459. * // The `_.property` iteratee shorthand.
  13460. * _.findLastKey(users, 'active');
  13461. * // => 'pebbles'
  13462. */
  13463. function findLastKey(object, predicate) {
  13464. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  13465. }
  13466. /**
  13467. * Iterates over own and inherited enumerable string keyed properties of an
  13468. * object and invokes `iteratee` for each property. The iteratee is invoked
  13469. * with three arguments: (value, key, object). Iteratee functions may exit
  13470. * iteration early by explicitly returning `false`.
  13471. *
  13472. * @static
  13473. * @memberOf _
  13474. * @since 0.3.0
  13475. * @category Object
  13476. * @param {Object} object The object to iterate over.
  13477. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13478. * @returns {Object} Returns `object`.
  13479. * @see _.forInRight
  13480. * @example
  13481. *
  13482. * function Foo() {
  13483. * this.a = 1;
  13484. * this.b = 2;
  13485. * }
  13486. *
  13487. * Foo.prototype.c = 3;
  13488. *
  13489. * _.forIn(new Foo, function(value, key) {
  13490. * console.log(key);
  13491. * });
  13492. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  13493. */
  13494. function forIn(object, iteratee) {
  13495. return object == null
  13496. ? object
  13497. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  13498. }
  13499. /**
  13500. * This method is like `_.forIn` except that it iterates over properties of
  13501. * `object` in the opposite order.
  13502. *
  13503. * @static
  13504. * @memberOf _
  13505. * @since 2.0.0
  13506. * @category Object
  13507. * @param {Object} object The object to iterate over.
  13508. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13509. * @returns {Object} Returns `object`.
  13510. * @see _.forIn
  13511. * @example
  13512. *
  13513. * function Foo() {
  13514. * this.a = 1;
  13515. * this.b = 2;
  13516. * }
  13517. *
  13518. * Foo.prototype.c = 3;
  13519. *
  13520. * _.forInRight(new Foo, function(value, key) {
  13521. * console.log(key);
  13522. * });
  13523. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  13524. */
  13525. function forInRight(object, iteratee) {
  13526. return object == null
  13527. ? object
  13528. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  13529. }
  13530. /**
  13531. * Iterates over own enumerable string keyed properties of an object and
  13532. * invokes `iteratee` for each property. The iteratee is invoked with three
  13533. * arguments: (value, key, object). Iteratee functions may exit iteration
  13534. * early by explicitly returning `false`.
  13535. *
  13536. * @static
  13537. * @memberOf _
  13538. * @since 0.3.0
  13539. * @category Object
  13540. * @param {Object} object The object to iterate over.
  13541. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13542. * @returns {Object} Returns `object`.
  13543. * @see _.forOwnRight
  13544. * @example
  13545. *
  13546. * function Foo() {
  13547. * this.a = 1;
  13548. * this.b = 2;
  13549. * }
  13550. *
  13551. * Foo.prototype.c = 3;
  13552. *
  13553. * _.forOwn(new Foo, function(value, key) {
  13554. * console.log(key);
  13555. * });
  13556. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  13557. */
  13558. function forOwn(object, iteratee) {
  13559. return object && baseForOwn(object, getIteratee(iteratee, 3));
  13560. }
  13561. /**
  13562. * This method is like `_.forOwn` except that it iterates over properties of
  13563. * `object` in the opposite order.
  13564. *
  13565. * @static
  13566. * @memberOf _
  13567. * @since 2.0.0
  13568. * @category Object
  13569. * @param {Object} object The object to iterate over.
  13570. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13571. * @returns {Object} Returns `object`.
  13572. * @see _.forOwn
  13573. * @example
  13574. *
  13575. * function Foo() {
  13576. * this.a = 1;
  13577. * this.b = 2;
  13578. * }
  13579. *
  13580. * Foo.prototype.c = 3;
  13581. *
  13582. * _.forOwnRight(new Foo, function(value, key) {
  13583. * console.log(key);
  13584. * });
  13585. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  13586. */
  13587. function forOwnRight(object, iteratee) {
  13588. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  13589. }
  13590. /**
  13591. * Creates an array of function property names from own enumerable properties
  13592. * of `object`.
  13593. *
  13594. * @static
  13595. * @since 0.1.0
  13596. * @memberOf _
  13597. * @category Object
  13598. * @param {Object} object The object to inspect.
  13599. * @returns {Array} Returns the function names.
  13600. * @see _.functionsIn
  13601. * @example
  13602. *
  13603. * function Foo() {
  13604. * this.a = _.constant('a');
  13605. * this.b = _.constant('b');
  13606. * }
  13607. *
  13608. * Foo.prototype.c = _.constant('c');
  13609. *
  13610. * _.functions(new Foo);
  13611. * // => ['a', 'b']
  13612. */
  13613. function functions(object) {
  13614. return object == null ? [] : baseFunctions(object, keys(object));
  13615. }
  13616. /**
  13617. * Creates an array of function property names from own and inherited
  13618. * enumerable properties of `object`.
  13619. *
  13620. * @static
  13621. * @memberOf _
  13622. * @since 4.0.0
  13623. * @category Object
  13624. * @param {Object} object The object to inspect.
  13625. * @returns {Array} Returns the function names.
  13626. * @see _.functions
  13627. * @example
  13628. *
  13629. * function Foo() {
  13630. * this.a = _.constant('a');
  13631. * this.b = _.constant('b');
  13632. * }
  13633. *
  13634. * Foo.prototype.c = _.constant('c');
  13635. *
  13636. * _.functionsIn(new Foo);
  13637. * // => ['a', 'b', 'c']
  13638. */
  13639. function functionsIn(object) {
  13640. return object == null ? [] : baseFunctions(object, keysIn(object));
  13641. }
  13642. /**
  13643. * Gets the value at `path` of `object`. If the resolved value is
  13644. * `undefined`, the `defaultValue` is returned in its place.
  13645. *
  13646. * @static
  13647. * @memberOf _
  13648. * @since 3.7.0
  13649. * @category Object
  13650. * @param {Object} object The object to query.
  13651. * @param {Array|string} path The path of the property to get.
  13652. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  13653. * @returns {*} Returns the resolved value.
  13654. * @example
  13655. *
  13656. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  13657. *
  13658. * _.get(object, 'a[0].b.c');
  13659. * // => 3
  13660. *
  13661. * _.get(object, ['a', '0', 'b', 'c']);
  13662. * // => 3
  13663. *
  13664. * _.get(object, 'a.b.c', 'default');
  13665. * // => 'default'
  13666. */
  13667. function get(object, path, defaultValue) {
  13668. var result = object == null ? undefined : baseGet(object, path);
  13669. return result === undefined ? defaultValue : result;
  13670. }
  13671. /**
  13672. * Checks if `path` is a direct property of `object`.
  13673. *
  13674. * @static
  13675. * @since 0.1.0
  13676. * @memberOf _
  13677. * @category Object
  13678. * @param {Object} object The object to query.
  13679. * @param {Array|string} path The path to check.
  13680. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  13681. * @example
  13682. *
  13683. * var object = { 'a': { 'b': 2 } };
  13684. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  13685. *
  13686. * _.has(object, 'a');
  13687. * // => true
  13688. *
  13689. * _.has(object, 'a.b');
  13690. * // => true
  13691. *
  13692. * _.has(object, ['a', 'b']);
  13693. * // => true
  13694. *
  13695. * _.has(other, 'a');
  13696. * // => false
  13697. */
  13698. function has(object, path) {
  13699. return object != null && hasPath(object, path, baseHas);
  13700. }
  13701. /**
  13702. * Checks if `path` is a direct or inherited property of `object`.
  13703. *
  13704. * @static
  13705. * @memberOf _
  13706. * @since 4.0.0
  13707. * @category Object
  13708. * @param {Object} object The object to query.
  13709. * @param {Array|string} path The path to check.
  13710. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  13711. * @example
  13712. *
  13713. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  13714. *
  13715. * _.hasIn(object, 'a');
  13716. * // => true
  13717. *
  13718. * _.hasIn(object, 'a.b');
  13719. * // => true
  13720. *
  13721. * _.hasIn(object, ['a', 'b']);
  13722. * // => true
  13723. *
  13724. * _.hasIn(object, 'b');
  13725. * // => false
  13726. */
  13727. function hasIn(object, path) {
  13728. return object != null && hasPath(object, path, baseHasIn);
  13729. }
  13730. /**
  13731. * Creates an object composed of the inverted keys and values of `object`.
  13732. * If `object` contains duplicate values, subsequent values overwrite
  13733. * property assignments of previous values.
  13734. *
  13735. * @static
  13736. * @memberOf _
  13737. * @since 0.7.0
  13738. * @category Object
  13739. * @param {Object} object The object to invert.
  13740. * @returns {Object} Returns the new inverted object.
  13741. * @example
  13742. *
  13743. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  13744. *
  13745. * _.invert(object);
  13746. * // => { '1': 'c', '2': 'b' }
  13747. */
  13748. var invert = createInverter(function(result, value, key) {
  13749. if (value != null &&
  13750. typeof value.toString != 'function') {
  13751. value = nativeObjectToString.call(value);
  13752. }
  13753. result[value] = key;
  13754. }, constant(identity));
  13755. /**
  13756. * This method is like `_.invert` except that the inverted object is generated
  13757. * from the results of running each element of `object` thru `iteratee`. The
  13758. * corresponding inverted value of each inverted key is an array of keys
  13759. * responsible for generating the inverted value. The iteratee is invoked
  13760. * with one argument: (value).
  13761. *
  13762. * @static
  13763. * @memberOf _
  13764. * @since 4.1.0
  13765. * @category Object
  13766. * @param {Object} object The object to invert.
  13767. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  13768. * @returns {Object} Returns the new inverted object.
  13769. * @example
  13770. *
  13771. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  13772. *
  13773. * _.invertBy(object);
  13774. * // => { '1': ['a', 'c'], '2': ['b'] }
  13775. *
  13776. * _.invertBy(object, function(value) {
  13777. * return 'group' + value;
  13778. * });
  13779. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  13780. */
  13781. var invertBy = createInverter(function(result, value, key) {
  13782. if (value != null &&
  13783. typeof value.toString != 'function') {
  13784. value = nativeObjectToString.call(value);
  13785. }
  13786. if (hasOwnProperty.call(result, value)) {
  13787. result[value].push(key);
  13788. } else {
  13789. result[value] = [key];
  13790. }
  13791. }, getIteratee);
  13792. /**
  13793. * Invokes the method at `path` of `object`.
  13794. *
  13795. * @static
  13796. * @memberOf _
  13797. * @since 4.0.0
  13798. * @category Object
  13799. * @param {Object} object The object to query.
  13800. * @param {Array|string} path The path of the method to invoke.
  13801. * @param {...*} [args] The arguments to invoke the method with.
  13802. * @returns {*} Returns the result of the invoked method.
  13803. * @example
  13804. *
  13805. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  13806. *
  13807. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  13808. * // => [2, 3]
  13809. */
  13810. var invoke = baseRest(baseInvoke);
  13811. /**
  13812. * Creates an array of the own enumerable property names of `object`.
  13813. *
  13814. * **Note:** Non-object values are coerced to objects. See the
  13815. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  13816. * for more details.
  13817. *
  13818. * @static
  13819. * @since 0.1.0
  13820. * @memberOf _
  13821. * @category Object
  13822. * @param {Object} object The object to query.
  13823. * @returns {Array} Returns the array of property names.
  13824. * @example
  13825. *
  13826. * function Foo() {
  13827. * this.a = 1;
  13828. * this.b = 2;
  13829. * }
  13830. *
  13831. * Foo.prototype.c = 3;
  13832. *
  13833. * _.keys(new Foo);
  13834. * // => ['a', 'b'] (iteration order is not guaranteed)
  13835. *
  13836. * _.keys('hi');
  13837. * // => ['0', '1']
  13838. */
  13839. function keys(object) {
  13840. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  13841. }
  13842. /**
  13843. * Creates an array of the own and inherited enumerable property names of `object`.
  13844. *
  13845. * **Note:** Non-object values are coerced to objects.
  13846. *
  13847. * @static
  13848. * @memberOf _
  13849. * @since 3.0.0
  13850. * @category Object
  13851. * @param {Object} object The object to query.
  13852. * @returns {Array} Returns the array of property names.
  13853. * @example
  13854. *
  13855. * function Foo() {
  13856. * this.a = 1;
  13857. * this.b = 2;
  13858. * }
  13859. *
  13860. * Foo.prototype.c = 3;
  13861. *
  13862. * _.keysIn(new Foo);
  13863. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  13864. */
  13865. function keysIn(object) {
  13866. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  13867. }
  13868. /**
  13869. * The opposite of `_.mapValues`; this method creates an object with the
  13870. * same values as `object` and keys generated by running each own enumerable
  13871. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  13872. * with three arguments: (value, key, object).
  13873. *
  13874. * @static
  13875. * @memberOf _
  13876. * @since 3.8.0
  13877. * @category Object
  13878. * @param {Object} object The object to iterate over.
  13879. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13880. * @returns {Object} Returns the new mapped object.
  13881. * @see _.mapValues
  13882. * @example
  13883. *
  13884. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  13885. * return key + value;
  13886. * });
  13887. * // => { 'a1': 1, 'b2': 2 }
  13888. */
  13889. function mapKeys(object, iteratee) {
  13890. var result = {};
  13891. iteratee = getIteratee(iteratee, 3);
  13892. baseForOwn(object, function(value, key, object) {
  13893. baseAssignValue(result, iteratee(value, key, object), value);
  13894. });
  13895. return result;
  13896. }
  13897. /**
  13898. * Creates an object with the same keys as `object` and values generated
  13899. * by running each own enumerable string keyed property of `object` thru
  13900. * `iteratee`. The iteratee is invoked with three arguments:
  13901. * (value, key, object).
  13902. *
  13903. * @static
  13904. * @memberOf _
  13905. * @since 2.4.0
  13906. * @category Object
  13907. * @param {Object} object The object to iterate over.
  13908. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13909. * @returns {Object} Returns the new mapped object.
  13910. * @see _.mapKeys
  13911. * @example
  13912. *
  13913. * var users = {
  13914. * 'fred': { 'user': 'fred', 'age': 40 },
  13915. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  13916. * };
  13917. *
  13918. * _.mapValues(users, function(o) { return o.age; });
  13919. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  13920. *
  13921. * // The `_.property` iteratee shorthand.
  13922. * _.mapValues(users, 'age');
  13923. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  13924. */
  13925. function mapValues(object, iteratee) {
  13926. var result = {};
  13927. iteratee = getIteratee(iteratee, 3);
  13928. baseForOwn(object, function(value, key, object) {
  13929. baseAssignValue(result, key, iteratee(value, key, object));
  13930. });
  13931. return result;
  13932. }
  13933. /**
  13934. * This method is like `_.assign` except that it recursively merges own and
  13935. * inherited enumerable string keyed properties of source objects into the
  13936. * destination object. Source properties that resolve to `undefined` are
  13937. * skipped if a destination value exists. Array and plain object properties
  13938. * are merged recursively. Other objects and value types are overridden by
  13939. * assignment. Source objects are applied from left to right. Subsequent
  13940. * sources overwrite property assignments of previous sources.
  13941. *
  13942. * **Note:** This method mutates `object`.
  13943. *
  13944. * @static
  13945. * @memberOf _
  13946. * @since 0.5.0
  13947. * @category Object
  13948. * @param {Object} object The destination object.
  13949. * @param {...Object} [sources] The source objects.
  13950. * @returns {Object} Returns `object`.
  13951. * @example
  13952. *
  13953. * var object = {
  13954. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  13955. * };
  13956. *
  13957. * var other = {
  13958. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  13959. * };
  13960. *
  13961. * _.merge(object, other);
  13962. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  13963. */
  13964. var merge = createAssigner(function(object, source, srcIndex) {
  13965. baseMerge(object, source, srcIndex);
  13966. });
  13967. /**
  13968. * This method is like `_.merge` except that it accepts `customizer` which
  13969. * is invoked to produce the merged values of the destination and source
  13970. * properties. If `customizer` returns `undefined`, merging is handled by the
  13971. * method instead. The `customizer` is invoked with six arguments:
  13972. * (objValue, srcValue, key, object, source, stack).
  13973. *
  13974. * **Note:** This method mutates `object`.
  13975. *
  13976. * @static
  13977. * @memberOf _
  13978. * @since 4.0.0
  13979. * @category Object
  13980. * @param {Object} object The destination object.
  13981. * @param {...Object} sources The source objects.
  13982. * @param {Function} customizer The function to customize assigned values.
  13983. * @returns {Object} Returns `object`.
  13984. * @example
  13985. *
  13986. * function customizer(objValue, srcValue) {
  13987. * if (_.isArray(objValue)) {
  13988. * return objValue.concat(srcValue);
  13989. * }
  13990. * }
  13991. *
  13992. * var object = { 'a': [1], 'b': [2] };
  13993. * var other = { 'a': [3], 'b': [4] };
  13994. *
  13995. * _.mergeWith(object, other, customizer);
  13996. * // => { 'a': [1, 3], 'b': [2, 4] }
  13997. */
  13998. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  13999. baseMerge(object, source, srcIndex, customizer);
  14000. });
  14001. /**
  14002. * The opposite of `_.pick`; this method creates an object composed of the
  14003. * own and inherited enumerable property paths of `object` that are not omitted.
  14004. *
  14005. * **Note:** This method is considerably slower than `_.pick`.
  14006. *
  14007. * @static
  14008. * @since 0.1.0
  14009. * @memberOf _
  14010. * @category Object
  14011. * @param {Object} object The source object.
  14012. * @param {...(string|string[])} [paths] The property paths to omit.
  14013. * @returns {Object} Returns the new object.
  14014. * @example
  14015. *
  14016. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  14017. *
  14018. * _.omit(object, ['a', 'c']);
  14019. * // => { 'b': '2' }
  14020. */
  14021. var omit = flatRest(function(object, paths) {
  14022. var result = {};
  14023. if (object == null) {
  14024. return result;
  14025. }
  14026. var isDeep = false;
  14027. paths = arrayMap(paths, function(path) {
  14028. path = castPath(path, object);
  14029. isDeep || (isDeep = path.length > 1);
  14030. return path;
  14031. });
  14032. copyObject(object, getAllKeysIn(object), result);
  14033. if (isDeep) {
  14034. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  14035. }
  14036. var length = paths.length;
  14037. while (length--) {
  14038. baseUnset(result, paths[length]);
  14039. }
  14040. return result;
  14041. });
  14042. /**
  14043. * The opposite of `_.pickBy`; this method creates an object composed of
  14044. * the own and inherited enumerable string keyed properties of `object` that
  14045. * `predicate` doesn't return truthy for. The predicate is invoked with two
  14046. * arguments: (value, key).
  14047. *
  14048. * @static
  14049. * @memberOf _
  14050. * @since 4.0.0
  14051. * @category Object
  14052. * @param {Object} object The source object.
  14053. * @param {Function} [predicate=_.identity] The function invoked per property.
  14054. * @returns {Object} Returns the new object.
  14055. * @example
  14056. *
  14057. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  14058. *
  14059. * _.omitBy(object, _.isNumber);
  14060. * // => { 'b': '2' }
  14061. */
  14062. function omitBy(object, predicate) {
  14063. return pickBy(object, negate(getIteratee(predicate)));
  14064. }
  14065. /**
  14066. * Creates an object composed of the picked `object` properties.
  14067. *
  14068. * @static
  14069. * @since 0.1.0
  14070. * @memberOf _
  14071. * @category Object
  14072. * @param {Object} object The source object.
  14073. * @param {...(string|string[])} [paths] The property paths to pick.
  14074. * @returns {Object} Returns the new object.
  14075. * @example
  14076. *
  14077. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  14078. *
  14079. * _.pick(object, ['a', 'c']);
  14080. * // => { 'a': 1, 'c': 3 }
  14081. */
  14082. var pick = flatRest(function(object, paths) {
  14083. return object == null ? {} : basePick(object, paths);
  14084. });
  14085. /**
  14086. * Creates an object composed of the `object` properties `predicate` returns
  14087. * truthy for. The predicate is invoked with two arguments: (value, key).
  14088. *
  14089. * @static
  14090. * @memberOf _
  14091. * @since 4.0.0
  14092. * @category Object
  14093. * @param {Object} object The source object.
  14094. * @param {Function} [predicate=_.identity] The function invoked per property.
  14095. * @returns {Object} Returns the new object.
  14096. * @example
  14097. *
  14098. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  14099. *
  14100. * _.pickBy(object, _.isNumber);
  14101. * // => { 'a': 1, 'c': 3 }
  14102. */
  14103. function pickBy(object, predicate) {
  14104. if (object == null) {
  14105. return {};
  14106. }
  14107. var props = arrayMap(getAllKeysIn(object), function(prop) {
  14108. return [prop];
  14109. });
  14110. predicate = getIteratee(predicate);
  14111. return basePickBy(object, props, function(value, path) {
  14112. return predicate(value, path[0]);
  14113. });
  14114. }
  14115. /**
  14116. * This method is like `_.get` except that if the resolved value is a
  14117. * function it's invoked with the `this` binding of its parent object and
  14118. * its result is returned.
  14119. *
  14120. * @static
  14121. * @since 0.1.0
  14122. * @memberOf _
  14123. * @category Object
  14124. * @param {Object} object The object to query.
  14125. * @param {Array|string} path The path of the property to resolve.
  14126. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  14127. * @returns {*} Returns the resolved value.
  14128. * @example
  14129. *
  14130. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  14131. *
  14132. * _.result(object, 'a[0].b.c1');
  14133. * // => 3
  14134. *
  14135. * _.result(object, 'a[0].b.c2');
  14136. * // => 4
  14137. *
  14138. * _.result(object, 'a[0].b.c3', 'default');
  14139. * // => 'default'
  14140. *
  14141. * _.result(object, 'a[0].b.c3', _.constant('default'));
  14142. * // => 'default'
  14143. */
  14144. function result(object, path, defaultValue) {
  14145. path = castPath(path, object);
  14146. var index = -1,
  14147. length = path.length;
  14148. // Ensure the loop is entered when path is empty.
  14149. if (!length) {
  14150. length = 1;
  14151. object = undefined;
  14152. }
  14153. while (++index < length) {
  14154. var value = object == null ? undefined : object[toKey(path[index])];
  14155. if (value === undefined) {
  14156. index = length;
  14157. value = defaultValue;
  14158. }
  14159. object = isFunction(value) ? value.call(object) : value;
  14160. }
  14161. return object;
  14162. }
  14163. /**
  14164. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  14165. * it's created. Arrays are created for missing index properties while objects
  14166. * are created for all other missing properties. Use `_.setWith` to customize
  14167. * `path` creation.
  14168. *
  14169. * **Note:** This method mutates `object`.
  14170. *
  14171. * @static
  14172. * @memberOf _
  14173. * @since 3.7.0
  14174. * @category Object
  14175. * @param {Object} object The object to modify.
  14176. * @param {Array|string} path The path of the property to set.
  14177. * @param {*} value The value to set.
  14178. * @returns {Object} Returns `object`.
  14179. * @example
  14180. *
  14181. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  14182. *
  14183. * _.set(object, 'a[0].b.c', 4);
  14184. * console.log(object.a[0].b.c);
  14185. * // => 4
  14186. *
  14187. * _.set(object, ['x', '0', 'y', 'z'], 5);
  14188. * console.log(object.x[0].y.z);
  14189. * // => 5
  14190. */
  14191. function set(object, path, value) {
  14192. return object == null ? object : baseSet(object, path, value);
  14193. }
  14194. /**
  14195. * This method is like `_.set` except that it accepts `customizer` which is
  14196. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  14197. * path creation is handled by the method instead. The `customizer` is invoked
  14198. * with three arguments: (nsValue, key, nsObject).
  14199. *
  14200. * **Note:** This method mutates `object`.
  14201. *
  14202. * @static
  14203. * @memberOf _
  14204. * @since 4.0.0
  14205. * @category Object
  14206. * @param {Object} object The object to modify.
  14207. * @param {Array|string} path The path of the property to set.
  14208. * @param {*} value The value to set.
  14209. * @param {Function} [customizer] The function to customize assigned values.
  14210. * @returns {Object} Returns `object`.
  14211. * @example
  14212. *
  14213. * var object = {};
  14214. *
  14215. * _.setWith(object, '[0][1]', 'a', Object);
  14216. * // => { '0': { '1': 'a' } }
  14217. */
  14218. function setWith(object, path, value, customizer) {
  14219. customizer = typeof customizer == 'function' ? customizer : undefined;
  14220. return object == null ? object : baseSet(object, path, value, customizer);
  14221. }
  14222. /**
  14223. * Creates an array of own enumerable string keyed-value pairs for `object`
  14224. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  14225. * entries are returned.
  14226. *
  14227. * @static
  14228. * @memberOf _
  14229. * @since 4.0.0
  14230. * @alias entries
  14231. * @category Object
  14232. * @param {Object} object The object to query.
  14233. * @returns {Array} Returns the key-value pairs.
  14234. * @example
  14235. *
  14236. * function Foo() {
  14237. * this.a = 1;
  14238. * this.b = 2;
  14239. * }
  14240. *
  14241. * Foo.prototype.c = 3;
  14242. *
  14243. * _.toPairs(new Foo);
  14244. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  14245. */
  14246. var toPairs = createToPairs(keys);
  14247. /**
  14248. * Creates an array of own and inherited enumerable string keyed-value pairs
  14249. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  14250. * or set, its entries are returned.
  14251. *
  14252. * @static
  14253. * @memberOf _
  14254. * @since 4.0.0
  14255. * @alias entriesIn
  14256. * @category Object
  14257. * @param {Object} object The object to query.
  14258. * @returns {Array} Returns the key-value pairs.
  14259. * @example
  14260. *
  14261. * function Foo() {
  14262. * this.a = 1;
  14263. * this.b = 2;
  14264. * }
  14265. *
  14266. * Foo.prototype.c = 3;
  14267. *
  14268. * _.toPairsIn(new Foo);
  14269. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  14270. */
  14271. var toPairsIn = createToPairs(keysIn);
  14272. /**
  14273. * An alternative to `_.reduce`; this method transforms `object` to a new
  14274. * `accumulator` object which is the result of running each of its own
  14275. * enumerable string keyed properties thru `iteratee`, with each invocation
  14276. * potentially mutating the `accumulator` object. If `accumulator` is not
  14277. * provided, a new object with the same `[[Prototype]]` will be used. The
  14278. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  14279. * Iteratee functions may exit iteration early by explicitly returning `false`.
  14280. *
  14281. * @static
  14282. * @memberOf _
  14283. * @since 1.3.0
  14284. * @category Object
  14285. * @param {Object} object The object to iterate over.
  14286. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  14287. * @param {*} [accumulator] The custom accumulator value.
  14288. * @returns {*} Returns the accumulated value.
  14289. * @example
  14290. *
  14291. * _.transform([2, 3, 4], function(result, n) {
  14292. * result.push(n *= n);
  14293. * return n % 2 == 0;
  14294. * }, []);
  14295. * // => [4, 9]
  14296. *
  14297. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  14298. * (result[value] || (result[value] = [])).push(key);
  14299. * }, {});
  14300. * // => { '1': ['a', 'c'], '2': ['b'] }
  14301. */
  14302. function transform(object, iteratee, accumulator) {
  14303. var isArr = isArray(object),
  14304. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  14305. iteratee = getIteratee(iteratee, 4);
  14306. if (accumulator == null) {
  14307. var Ctor = object && object.constructor;
  14308. if (isArrLike) {
  14309. accumulator = isArr ? new Ctor : [];
  14310. }
  14311. else if (isObject(object)) {
  14312. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  14313. }
  14314. else {
  14315. accumulator = {};
  14316. }
  14317. }
  14318. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  14319. return iteratee(accumulator, value, index, object);
  14320. });
  14321. return accumulator;
  14322. }
  14323. /**
  14324. * Removes the property at `path` of `object`.
  14325. *
  14326. * **Note:** This method mutates `object`.
  14327. *
  14328. * @static
  14329. * @memberOf _
  14330. * @since 4.0.0
  14331. * @category Object
  14332. * @param {Object} object The object to modify.
  14333. * @param {Array|string} path The path of the property to unset.
  14334. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  14335. * @example
  14336. *
  14337. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  14338. * _.unset(object, 'a[0].b.c');
  14339. * // => true
  14340. *
  14341. * console.log(object);
  14342. * // => { 'a': [{ 'b': {} }] };
  14343. *
  14344. * _.unset(object, ['a', '0', 'b', 'c']);
  14345. * // => true
  14346. *
  14347. * console.log(object);
  14348. * // => { 'a': [{ 'b': {} }] };
  14349. */
  14350. function unset(object, path) {
  14351. return object == null ? true : baseUnset(object, path);
  14352. }
  14353. /**
  14354. * This method is like `_.set` except that accepts `updater` to produce the
  14355. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  14356. * is invoked with one argument: (value).
  14357. *
  14358. * **Note:** This method mutates `object`.
  14359. *
  14360. * @static
  14361. * @memberOf _
  14362. * @since 4.6.0
  14363. * @category Object
  14364. * @param {Object} object The object to modify.
  14365. * @param {Array|string} path The path of the property to set.
  14366. * @param {Function} updater The function to produce the updated value.
  14367. * @returns {Object} Returns `object`.
  14368. * @example
  14369. *
  14370. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  14371. *
  14372. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  14373. * console.log(object.a[0].b.c);
  14374. * // => 9
  14375. *
  14376. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  14377. * console.log(object.x[0].y.z);
  14378. * // => 0
  14379. */
  14380. function update(object, path, updater) {
  14381. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  14382. }
  14383. /**
  14384. * This method is like `_.update` except that it accepts `customizer` which is
  14385. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  14386. * path creation is handled by the method instead. The `customizer` is invoked
  14387. * with three arguments: (nsValue, key, nsObject).
  14388. *
  14389. * **Note:** This method mutates `object`.
  14390. *
  14391. * @static
  14392. * @memberOf _
  14393. * @since 4.6.0
  14394. * @category Object
  14395. * @param {Object} object The object to modify.
  14396. * @param {Array|string} path The path of the property to set.
  14397. * @param {Function} updater The function to produce the updated value.
  14398. * @param {Function} [customizer] The function to customize assigned values.
  14399. * @returns {Object} Returns `object`.
  14400. * @example
  14401. *
  14402. * var object = {};
  14403. *
  14404. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  14405. * // => { '0': { '1': 'a' } }
  14406. */
  14407. function updateWith(object, path, updater, customizer) {
  14408. customizer = typeof customizer == 'function' ? customizer : undefined;
  14409. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  14410. }
  14411. /**
  14412. * Creates an array of the own enumerable string keyed property values of `object`.
  14413. *
  14414. * **Note:** Non-object values are coerced to objects.
  14415. *
  14416. * @static
  14417. * @since 0.1.0
  14418. * @memberOf _
  14419. * @category Object
  14420. * @param {Object} object The object to query.
  14421. * @returns {Array} Returns the array of property values.
  14422. * @example
  14423. *
  14424. * function Foo() {
  14425. * this.a = 1;
  14426. * this.b = 2;
  14427. * }
  14428. *
  14429. * Foo.prototype.c = 3;
  14430. *
  14431. * _.values(new Foo);
  14432. * // => [1, 2] (iteration order is not guaranteed)
  14433. *
  14434. * _.values('hi');
  14435. * // => ['h', 'i']
  14436. */
  14437. function values(object) {
  14438. return object == null ? [] : baseValues(object, keys(object));
  14439. }
  14440. /**
  14441. * Creates an array of the own and inherited enumerable string keyed property
  14442. * values of `object`.
  14443. *
  14444. * **Note:** Non-object values are coerced to objects.
  14445. *
  14446. * @static
  14447. * @memberOf _
  14448. * @since 3.0.0
  14449. * @category Object
  14450. * @param {Object} object The object to query.
  14451. * @returns {Array} Returns the array of property values.
  14452. * @example
  14453. *
  14454. * function Foo() {
  14455. * this.a = 1;
  14456. * this.b = 2;
  14457. * }
  14458. *
  14459. * Foo.prototype.c = 3;
  14460. *
  14461. * _.valuesIn(new Foo);
  14462. * // => [1, 2, 3] (iteration order is not guaranteed)
  14463. */
  14464. function valuesIn(object) {
  14465. return object == null ? [] : baseValues(object, keysIn(object));
  14466. }
  14467. /*------------------------------------------------------------------------*/
  14468. /**
  14469. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  14470. *
  14471. * @static
  14472. * @memberOf _
  14473. * @since 4.0.0
  14474. * @category Number
  14475. * @param {number} number The number to clamp.
  14476. * @param {number} [lower] The lower bound.
  14477. * @param {number} upper The upper bound.
  14478. * @returns {number} Returns the clamped number.
  14479. * @example
  14480. *
  14481. * _.clamp(-10, -5, 5);
  14482. * // => -5
  14483. *
  14484. * _.clamp(10, -5, 5);
  14485. * // => 5
  14486. */
  14487. function clamp(number, lower, upper) {
  14488. if (upper === undefined) {
  14489. upper = lower;
  14490. lower = undefined;
  14491. }
  14492. if (upper !== undefined) {
  14493. upper = toNumber(upper);
  14494. upper = upper === upper ? upper : 0;
  14495. }
  14496. if (lower !== undefined) {
  14497. lower = toNumber(lower);
  14498. lower = lower === lower ? lower : 0;
  14499. }
  14500. return baseClamp(toNumber(number), lower, upper);
  14501. }
  14502. /**
  14503. * Checks if `n` is between `start` and up to, but not including, `end`. If
  14504. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  14505. * If `start` is greater than `end` the params are swapped to support
  14506. * negative ranges.
  14507. *
  14508. * @static
  14509. * @memberOf _
  14510. * @since 3.3.0
  14511. * @category Number
  14512. * @param {number} number The number to check.
  14513. * @param {number} [start=0] The start of the range.
  14514. * @param {number} end The end of the range.
  14515. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  14516. * @see _.range, _.rangeRight
  14517. * @example
  14518. *
  14519. * _.inRange(3, 2, 4);
  14520. * // => true
  14521. *
  14522. * _.inRange(4, 8);
  14523. * // => true
  14524. *
  14525. * _.inRange(4, 2);
  14526. * // => false
  14527. *
  14528. * _.inRange(2, 2);
  14529. * // => false
  14530. *
  14531. * _.inRange(1.2, 2);
  14532. * // => true
  14533. *
  14534. * _.inRange(5.2, 4);
  14535. * // => false
  14536. *
  14537. * _.inRange(-3, -2, -6);
  14538. * // => true
  14539. */
  14540. function inRange(number, start, end) {
  14541. start = toFinite(start);
  14542. if (end === undefined) {
  14543. end = start;
  14544. start = 0;
  14545. } else {
  14546. end = toFinite(end);
  14547. }
  14548. number = toNumber(number);
  14549. return baseInRange(number, start, end);
  14550. }
  14551. /**
  14552. * Produces a random number between the inclusive `lower` and `upper` bounds.
  14553. * If only one argument is provided a number between `0` and the given number
  14554. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  14555. * floats, a floating-point number is returned instead of an integer.
  14556. *
  14557. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  14558. * floating-point values which can produce unexpected results.
  14559. *
  14560. * @static
  14561. * @memberOf _
  14562. * @since 0.7.0
  14563. * @category Number
  14564. * @param {number} [lower=0] The lower bound.
  14565. * @param {number} [upper=1] The upper bound.
  14566. * @param {boolean} [floating] Specify returning a floating-point number.
  14567. * @returns {number} Returns the random number.
  14568. * @example
  14569. *
  14570. * _.random(0, 5);
  14571. * // => an integer between 0 and 5
  14572. *
  14573. * _.random(5);
  14574. * // => also an integer between 0 and 5
  14575. *
  14576. * _.random(5, true);
  14577. * // => a floating-point number between 0 and 5
  14578. *
  14579. * _.random(1.2, 5.2);
  14580. * // => a floating-point number between 1.2 and 5.2
  14581. */
  14582. function random(lower, upper, floating) {
  14583. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  14584. upper = floating = undefined;
  14585. }
  14586. if (floating === undefined) {
  14587. if (typeof upper == 'boolean') {
  14588. floating = upper;
  14589. upper = undefined;
  14590. }
  14591. else if (typeof lower == 'boolean') {
  14592. floating = lower;
  14593. lower = undefined;
  14594. }
  14595. }
  14596. if (lower === undefined && upper === undefined) {
  14597. lower = 0;
  14598. upper = 1;
  14599. }
  14600. else {
  14601. lower = toFinite(lower);
  14602. if (upper === undefined) {
  14603. upper = lower;
  14604. lower = 0;
  14605. } else {
  14606. upper = toFinite(upper);
  14607. }
  14608. }
  14609. if (lower > upper) {
  14610. var temp = lower;
  14611. lower = upper;
  14612. upper = temp;
  14613. }
  14614. if (floating || lower % 1 || upper % 1) {
  14615. var rand = nativeRandom();
  14616. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  14617. }
  14618. return baseRandom(lower, upper);
  14619. }
  14620. /*------------------------------------------------------------------------*/
  14621. /**
  14622. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  14623. *
  14624. * @static
  14625. * @memberOf _
  14626. * @since 3.0.0
  14627. * @category String
  14628. * @param {string} [string=''] The string to convert.
  14629. * @returns {string} Returns the camel cased string.
  14630. * @example
  14631. *
  14632. * _.camelCase('Foo Bar');
  14633. * // => 'fooBar'
  14634. *
  14635. * _.camelCase('--foo-bar--');
  14636. * // => 'fooBar'
  14637. *
  14638. * _.camelCase('__FOO_BAR__');
  14639. * // => 'fooBar'
  14640. */
  14641. var camelCase = createCompounder(function(result, word, index) {
  14642. word = word.toLowerCase();
  14643. return result + (index ? capitalize(word) : word);
  14644. });
  14645. /**
  14646. * Converts the first character of `string` to upper case and the remaining
  14647. * to lower case.
  14648. *
  14649. * @static
  14650. * @memberOf _
  14651. * @since 3.0.0
  14652. * @category String
  14653. * @param {string} [string=''] The string to capitalize.
  14654. * @returns {string} Returns the capitalized string.
  14655. * @example
  14656. *
  14657. * _.capitalize('FRED');
  14658. * // => 'Fred'
  14659. */
  14660. function capitalize(string) {
  14661. return upperFirst(toString(string).toLowerCase());
  14662. }
  14663. /**
  14664. * Deburrs `string` by converting
  14665. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  14666. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  14667. * letters to basic Latin letters and removing
  14668. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  14669. *
  14670. * @static
  14671. * @memberOf _
  14672. * @since 3.0.0
  14673. * @category String
  14674. * @param {string} [string=''] The string to deburr.
  14675. * @returns {string} Returns the deburred string.
  14676. * @example
  14677. *
  14678. * _.deburr('déjà vu');
  14679. * // => 'deja vu'
  14680. */
  14681. function deburr(string) {
  14682. string = toString(string);
  14683. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  14684. }
  14685. /**
  14686. * Checks if `string` ends with the given target string.
  14687. *
  14688. * @static
  14689. * @memberOf _
  14690. * @since 3.0.0
  14691. * @category String
  14692. * @param {string} [string=''] The string to inspect.
  14693. * @param {string} [target] The string to search for.
  14694. * @param {number} [position=string.length] The position to search up to.
  14695. * @returns {boolean} Returns `true` if `string` ends with `target`,
  14696. * else `false`.
  14697. * @example
  14698. *
  14699. * _.endsWith('abc', 'c');
  14700. * // => true
  14701. *
  14702. * _.endsWith('abc', 'b');
  14703. * // => false
  14704. *
  14705. * _.endsWith('abc', 'b', 2);
  14706. * // => true
  14707. */
  14708. function endsWith(string, target, position) {
  14709. string = toString(string);
  14710. target = baseToString(target);
  14711. var length = string.length;
  14712. position = position === undefined
  14713. ? length
  14714. : baseClamp(toInteger(position), 0, length);
  14715. var end = position;
  14716. position -= target.length;
  14717. return position >= 0 && string.slice(position, end) == target;
  14718. }
  14719. /**
  14720. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  14721. * corresponding HTML entities.
  14722. *
  14723. * **Note:** No other characters are escaped. To escape additional
  14724. * characters use a third-party library like [_he_](https://mths.be/he).
  14725. *
  14726. * Though the ">" character is escaped for symmetry, characters like
  14727. * ">" and "/" don't need escaping in HTML and have no special meaning
  14728. * unless they're part of a tag or unquoted attribute value. See
  14729. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  14730. * (under "semi-related fun fact") for more details.
  14731. *
  14732. * When working with HTML you should always
  14733. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  14734. * XSS vectors.
  14735. *
  14736. * @static
  14737. * @since 0.1.0
  14738. * @memberOf _
  14739. * @category String
  14740. * @param {string} [string=''] The string to escape.
  14741. * @returns {string} Returns the escaped string.
  14742. * @example
  14743. *
  14744. * _.escape('fred, barney, & pebbles');
  14745. * // => 'fred, barney, &amp; pebbles'
  14746. */
  14747. function escape(string) {
  14748. string = toString(string);
  14749. return (string && reHasUnescapedHtml.test(string))
  14750. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  14751. : string;
  14752. }
  14753. /**
  14754. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  14755. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  14756. *
  14757. * @static
  14758. * @memberOf _
  14759. * @since 3.0.0
  14760. * @category String
  14761. * @param {string} [string=''] The string to escape.
  14762. * @returns {string} Returns the escaped string.
  14763. * @example
  14764. *
  14765. * _.escapeRegExp('[lodash](https://lodash.com/)');
  14766. * // => '\[lodash\]\(https://lodash\.com/\)'
  14767. */
  14768. function escapeRegExp(string) {
  14769. string = toString(string);
  14770. return (string && reHasRegExpChar.test(string))
  14771. ? string.replace(reRegExpChar, '\\$&')
  14772. : string;
  14773. }
  14774. /**
  14775. * Converts `string` to
  14776. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  14777. *
  14778. * @static
  14779. * @memberOf _
  14780. * @since 3.0.0
  14781. * @category String
  14782. * @param {string} [string=''] The string to convert.
  14783. * @returns {string} Returns the kebab cased string.
  14784. * @example
  14785. *
  14786. * _.kebabCase('Foo Bar');
  14787. * // => 'foo-bar'
  14788. *
  14789. * _.kebabCase('fooBar');
  14790. * // => 'foo-bar'
  14791. *
  14792. * _.kebabCase('__FOO_BAR__');
  14793. * // => 'foo-bar'
  14794. */
  14795. var kebabCase = createCompounder(function(result, word, index) {
  14796. return result + (index ? '-' : '') + word.toLowerCase();
  14797. });
  14798. /**
  14799. * Converts `string`, as space separated words, to lower case.
  14800. *
  14801. * @static
  14802. * @memberOf _
  14803. * @since 4.0.0
  14804. * @category String
  14805. * @param {string} [string=''] The string to convert.
  14806. * @returns {string} Returns the lower cased string.
  14807. * @example
  14808. *
  14809. * _.lowerCase('--Foo-Bar--');
  14810. * // => 'foo bar'
  14811. *
  14812. * _.lowerCase('fooBar');
  14813. * // => 'foo bar'
  14814. *
  14815. * _.lowerCase('__FOO_BAR__');
  14816. * // => 'foo bar'
  14817. */
  14818. var lowerCase = createCompounder(function(result, word, index) {
  14819. return result + (index ? ' ' : '') + word.toLowerCase();
  14820. });
  14821. /**
  14822. * Converts the first character of `string` to lower case.
  14823. *
  14824. * @static
  14825. * @memberOf _
  14826. * @since 4.0.0
  14827. * @category String
  14828. * @param {string} [string=''] The string to convert.
  14829. * @returns {string} Returns the converted string.
  14830. * @example
  14831. *
  14832. * _.lowerFirst('Fred');
  14833. * // => 'fred'
  14834. *
  14835. * _.lowerFirst('FRED');
  14836. * // => 'fRED'
  14837. */
  14838. var lowerFirst = createCaseFirst('toLowerCase');
  14839. /**
  14840. * Pads `string` on the left and right sides if it's shorter than `length`.
  14841. * Padding characters are truncated if they can't be evenly divided by `length`.
  14842. *
  14843. * @static
  14844. * @memberOf _
  14845. * @since 3.0.0
  14846. * @category String
  14847. * @param {string} [string=''] The string to pad.
  14848. * @param {number} [length=0] The padding length.
  14849. * @param {string} [chars=' '] The string used as padding.
  14850. * @returns {string} Returns the padded string.
  14851. * @example
  14852. *
  14853. * _.pad('abc', 8);
  14854. * // => ' abc '
  14855. *
  14856. * _.pad('abc', 8, '_-');
  14857. * // => '_-abc_-_'
  14858. *
  14859. * _.pad('abc', 3);
  14860. * // => 'abc'
  14861. */
  14862. function pad(string, length, chars) {
  14863. string = toString(string);
  14864. length = toInteger(length);
  14865. var strLength = length ? stringSize(string) : 0;
  14866. if (!length || strLength >= length) {
  14867. return string;
  14868. }
  14869. var mid = (length - strLength) / 2;
  14870. return (
  14871. createPadding(nativeFloor(mid), chars) +
  14872. string +
  14873. createPadding(nativeCeil(mid), chars)
  14874. );
  14875. }
  14876. /**
  14877. * Pads `string` on the right side if it's shorter than `length`. Padding
  14878. * characters are truncated if they exceed `length`.
  14879. *
  14880. * @static
  14881. * @memberOf _
  14882. * @since 4.0.0
  14883. * @category String
  14884. * @param {string} [string=''] The string to pad.
  14885. * @param {number} [length=0] The padding length.
  14886. * @param {string} [chars=' '] The string used as padding.
  14887. * @returns {string} Returns the padded string.
  14888. * @example
  14889. *
  14890. * _.padEnd('abc', 6);
  14891. * // => 'abc '
  14892. *
  14893. * _.padEnd('abc', 6, '_-');
  14894. * // => 'abc_-_'
  14895. *
  14896. * _.padEnd('abc', 3);
  14897. * // => 'abc'
  14898. */
  14899. function padEnd(string, length, chars) {
  14900. string = toString(string);
  14901. length = toInteger(length);
  14902. var strLength = length ? stringSize(string) : 0;
  14903. return (length && strLength < length)
  14904. ? (string + createPadding(length - strLength, chars))
  14905. : string;
  14906. }
  14907. /**
  14908. * Pads `string` on the left side if it's shorter than `length`. Padding
  14909. * characters are truncated if they exceed `length`.
  14910. *
  14911. * @static
  14912. * @memberOf _
  14913. * @since 4.0.0
  14914. * @category String
  14915. * @param {string} [string=''] The string to pad.
  14916. * @param {number} [length=0] The padding length.
  14917. * @param {string} [chars=' '] The string used as padding.
  14918. * @returns {string} Returns the padded string.
  14919. * @example
  14920. *
  14921. * _.padStart('abc', 6);
  14922. * // => ' abc'
  14923. *
  14924. * _.padStart('abc', 6, '_-');
  14925. * // => '_-_abc'
  14926. *
  14927. * _.padStart('abc', 3);
  14928. * // => 'abc'
  14929. */
  14930. function padStart(string, length, chars) {
  14931. string = toString(string);
  14932. length = toInteger(length);
  14933. var strLength = length ? stringSize(string) : 0;
  14934. return (length && strLength < length)
  14935. ? (createPadding(length - strLength, chars) + string)
  14936. : string;
  14937. }
  14938. /**
  14939. * Converts `string` to an integer of the specified radix. If `radix` is
  14940. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  14941. * hexadecimal, in which case a `radix` of `16` is used.
  14942. *
  14943. * **Note:** This method aligns with the
  14944. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  14945. *
  14946. * @static
  14947. * @memberOf _
  14948. * @since 1.1.0
  14949. * @category String
  14950. * @param {string} string The string to convert.
  14951. * @param {number} [radix=10] The radix to interpret `value` by.
  14952. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14953. * @returns {number} Returns the converted integer.
  14954. * @example
  14955. *
  14956. * _.parseInt('08');
  14957. * // => 8
  14958. *
  14959. * _.map(['6', '08', '10'], _.parseInt);
  14960. * // => [6, 8, 10]
  14961. */
  14962. function parseInt(string, radix, guard) {
  14963. if (guard || radix == null) {
  14964. radix = 0;
  14965. } else if (radix) {
  14966. radix = +radix;
  14967. }
  14968. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  14969. }
  14970. /**
  14971. * Repeats the given string `n` times.
  14972. *
  14973. * @static
  14974. * @memberOf _
  14975. * @since 3.0.0
  14976. * @category String
  14977. * @param {string} [string=''] The string to repeat.
  14978. * @param {number} [n=1] The number of times to repeat the string.
  14979. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14980. * @returns {string} Returns the repeated string.
  14981. * @example
  14982. *
  14983. * _.repeat('*', 3);
  14984. * // => '***'
  14985. *
  14986. * _.repeat('abc', 2);
  14987. * // => 'abcabc'
  14988. *
  14989. * _.repeat('abc', 0);
  14990. * // => ''
  14991. */
  14992. function repeat(string, n, guard) {
  14993. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  14994. n = 1;
  14995. } else {
  14996. n = toInteger(n);
  14997. }
  14998. return baseRepeat(toString(string), n);
  14999. }
  15000. /**
  15001. * Replaces matches for `pattern` in `string` with `replacement`.
  15002. *
  15003. * **Note:** This method is based on
  15004. * [`String#replace`](https://mdn.io/String/replace).
  15005. *
  15006. * @static
  15007. * @memberOf _
  15008. * @since 4.0.0
  15009. * @category String
  15010. * @param {string} [string=''] The string to modify.
  15011. * @param {RegExp|string} pattern The pattern to replace.
  15012. * @param {Function|string} replacement The match replacement.
  15013. * @returns {string} Returns the modified string.
  15014. * @example
  15015. *
  15016. * _.replace('Hi Fred', 'Fred', 'Barney');
  15017. * // => 'Hi Barney'
  15018. */
  15019. function replace() {
  15020. var args = arguments,
  15021. string = toString(args[0]);
  15022. return args.length < 3 ? string : string.replace(args[1], args[2]);
  15023. }
  15024. /**
  15025. * Converts `string` to
  15026. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  15027. *
  15028. * @static
  15029. * @memberOf _
  15030. * @since 3.0.0
  15031. * @category String
  15032. * @param {string} [string=''] The string to convert.
  15033. * @returns {string} Returns the snake cased string.
  15034. * @example
  15035. *
  15036. * _.snakeCase('Foo Bar');
  15037. * // => 'foo_bar'
  15038. *
  15039. * _.snakeCase('fooBar');
  15040. * // => 'foo_bar'
  15041. *
  15042. * _.snakeCase('--FOO-BAR--');
  15043. * // => 'foo_bar'
  15044. */
  15045. var snakeCase = createCompounder(function(result, word, index) {
  15046. return result + (index ? '_' : '') + word.toLowerCase();
  15047. });
  15048. /**
  15049. * Splits `string` by `separator`.
  15050. *
  15051. * **Note:** This method is based on
  15052. * [`String#split`](https://mdn.io/String/split).
  15053. *
  15054. * @static
  15055. * @memberOf _
  15056. * @since 4.0.0
  15057. * @category String
  15058. * @param {string} [string=''] The string to split.
  15059. * @param {RegExp|string} separator The separator pattern to split by.
  15060. * @param {number} [limit] The length to truncate results to.
  15061. * @returns {Array} Returns the string segments.
  15062. * @example
  15063. *
  15064. * _.split('a-b-c', '-', 2);
  15065. * // => ['a', 'b']
  15066. */
  15067. function split(string, separator, limit) {
  15068. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  15069. separator = limit = undefined;
  15070. }
  15071. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  15072. if (!limit) {
  15073. return [];
  15074. }
  15075. string = toString(string);
  15076. if (string && (
  15077. typeof separator == 'string' ||
  15078. (separator != null && !isRegExp(separator))
  15079. )) {
  15080. separator = baseToString(separator);
  15081. if (!separator && hasUnicode(string)) {
  15082. return castSlice(stringToArray(string), 0, limit);
  15083. }
  15084. }
  15085. return string.split(separator, limit);
  15086. }
  15087. /**
  15088. * Converts `string` to
  15089. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  15090. *
  15091. * @static
  15092. * @memberOf _
  15093. * @since 3.1.0
  15094. * @category String
  15095. * @param {string} [string=''] The string to convert.
  15096. * @returns {string} Returns the start cased string.
  15097. * @example
  15098. *
  15099. * _.startCase('--foo-bar--');
  15100. * // => 'Foo Bar'
  15101. *
  15102. * _.startCase('fooBar');
  15103. * // => 'Foo Bar'
  15104. *
  15105. * _.startCase('__FOO_BAR__');
  15106. * // => 'FOO BAR'
  15107. */
  15108. var startCase = createCompounder(function(result, word, index) {
  15109. return result + (index ? ' ' : '') + upperFirst(word);
  15110. });
  15111. /**
  15112. * Checks if `string` starts with the given target string.
  15113. *
  15114. * @static
  15115. * @memberOf _
  15116. * @since 3.0.0
  15117. * @category String
  15118. * @param {string} [string=''] The string to inspect.
  15119. * @param {string} [target] The string to search for.
  15120. * @param {number} [position=0] The position to search from.
  15121. * @returns {boolean} Returns `true` if `string` starts with `target`,
  15122. * else `false`.
  15123. * @example
  15124. *
  15125. * _.startsWith('abc', 'a');
  15126. * // => true
  15127. *
  15128. * _.startsWith('abc', 'b');
  15129. * // => false
  15130. *
  15131. * _.startsWith('abc', 'b', 1);
  15132. * // => true
  15133. */
  15134. function startsWith(string, target, position) {
  15135. string = toString(string);
  15136. position = position == null
  15137. ? 0
  15138. : baseClamp(toInteger(position), 0, string.length);
  15139. target = baseToString(target);
  15140. return string.slice(position, position + target.length) == target;
  15141. }
  15142. /**
  15143. * Creates a compiled template function that can interpolate data properties
  15144. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  15145. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  15146. * properties may be accessed as free variables in the template. If a setting
  15147. * object is given, it takes precedence over `_.templateSettings` values.
  15148. *
  15149. * **Note:** In the development build `_.template` utilizes
  15150. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  15151. * for easier debugging.
  15152. *
  15153. * For more information on precompiling templates see
  15154. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  15155. *
  15156. * For more information on Chrome extension sandboxes see
  15157. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  15158. *
  15159. * @static
  15160. * @since 0.1.0
  15161. * @memberOf _
  15162. * @category String
  15163. * @param {string} [string=''] The template string.
  15164. * @param {Object} [options={}] The options object.
  15165. * @param {RegExp} [options.escape=_.templateSettings.escape]
  15166. * The HTML "escape" delimiter.
  15167. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  15168. * The "evaluate" delimiter.
  15169. * @param {Object} [options.imports=_.templateSettings.imports]
  15170. * An object to import into the template as free variables.
  15171. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  15172. * The "interpolate" delimiter.
  15173. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  15174. * The sourceURL of the compiled template.
  15175. * @param {string} [options.variable='obj']
  15176. * The data object variable name.
  15177. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15178. * @returns {Function} Returns the compiled template function.
  15179. * @example
  15180. *
  15181. * // Use the "interpolate" delimiter to create a compiled template.
  15182. * var compiled = _.template('hello <%= user %>!');
  15183. * compiled({ 'user': 'fred' });
  15184. * // => 'hello fred!'
  15185. *
  15186. * // Use the HTML "escape" delimiter to escape data property values.
  15187. * var compiled = _.template('<b><%- value %></b>');
  15188. * compiled({ 'value': '<script>' });
  15189. * // => '<b>&lt;script&gt;</b>'
  15190. *
  15191. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  15192. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  15193. * compiled({ 'users': ['fred', 'barney'] });
  15194. * // => '<li>fred</li><li>barney</li>'
  15195. *
  15196. * // Use the internal `print` function in "evaluate" delimiters.
  15197. * var compiled = _.template('<% print("hello " + user); %>!');
  15198. * compiled({ 'user': 'barney' });
  15199. * // => 'hello barney!'
  15200. *
  15201. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  15202. * // Disable support by replacing the "interpolate" delimiter.
  15203. * var compiled = _.template('hello ${ user }!');
  15204. * compiled({ 'user': 'pebbles' });
  15205. * // => 'hello pebbles!'
  15206. *
  15207. * // Use backslashes to treat delimiters as plain text.
  15208. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  15209. * compiled({ 'value': 'ignored' });
  15210. * // => '<%- value %>'
  15211. *
  15212. * // Use the `imports` option to import `jQuery` as `jq`.
  15213. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  15214. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  15215. * compiled({ 'users': ['fred', 'barney'] });
  15216. * // => '<li>fred</li><li>barney</li>'
  15217. *
  15218. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  15219. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  15220. * compiled(data);
  15221. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  15222. *
  15223. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  15224. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  15225. * compiled.source;
  15226. * // => function(data) {
  15227. * // var __t, __p = '';
  15228. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  15229. * // return __p;
  15230. * // }
  15231. *
  15232. * // Use custom template delimiters.
  15233. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  15234. * var compiled = _.template('hello {{ user }}!');
  15235. * compiled({ 'user': 'mustache' });
  15236. * // => 'hello mustache!'
  15237. *
  15238. * // Use the `source` property to inline compiled templates for meaningful
  15239. * // line numbers in error messages and stack traces.
  15240. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  15241. * var JST = {\
  15242. * "main": ' + _.template(mainText).source + '\
  15243. * };\
  15244. * ');
  15245. */
  15246. function template(string, options, guard) {
  15247. // Based on John Resig's `tmpl` implementation
  15248. // (http://ejohn.org/blog/javascript-micro-templating/)
  15249. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  15250. var settings = lodash.templateSettings;
  15251. if (guard && isIterateeCall(string, options, guard)) {
  15252. options = undefined;
  15253. }
  15254. string = toString(string);
  15255. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  15256. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  15257. importsKeys = keys(imports),
  15258. importsValues = baseValues(imports, importsKeys);
  15259. var isEscaping,
  15260. isEvaluating,
  15261. index = 0,
  15262. interpolate = options.interpolate || reNoMatch,
  15263. source = "__p += '";
  15264. // Compile the regexp to match each delimiter.
  15265. var reDelimiters = RegExp(
  15266. (options.escape || reNoMatch).source + '|' +
  15267. interpolate.source + '|' +
  15268. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  15269. (options.evaluate || reNoMatch).source + '|$'
  15270. , 'g');
  15271. // Use a sourceURL for easier debugging.
  15272. // The sourceURL gets injected into the source that's eval-ed, so be careful
  15273. // to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in
  15274. // and escape the comment, thus injecting code that gets evaled.
  15275. var sourceURL = '//# sourceURL=' +
  15276. (hasOwnProperty.call(options, 'sourceURL')
  15277. ? (options.sourceURL + '').replace(/\s/g, ' ')
  15278. : ('lodash.templateSources[' + (++templateCounter) + ']')
  15279. ) + '\n';
  15280. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  15281. interpolateValue || (interpolateValue = esTemplateValue);
  15282. // Escape characters that can't be included in string literals.
  15283. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  15284. // Replace delimiters with snippets.
  15285. if (escapeValue) {
  15286. isEscaping = true;
  15287. source += "' +\n__e(" + escapeValue + ") +\n'";
  15288. }
  15289. if (evaluateValue) {
  15290. isEvaluating = true;
  15291. source += "';\n" + evaluateValue + ";\n__p += '";
  15292. }
  15293. if (interpolateValue) {
  15294. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  15295. }
  15296. index = offset + match.length;
  15297. // The JS engine embedded in Adobe products needs `match` returned in
  15298. // order to produce the correct `offset` value.
  15299. return match;
  15300. });
  15301. source += "';\n";
  15302. // If `variable` is not specified wrap a with-statement around the generated
  15303. // code to add the data object to the top of the scope chain.
  15304. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  15305. if (!variable) {
  15306. source = 'with (obj) {\n' + source + '\n}\n';
  15307. }
  15308. // Throw an error if a forbidden character was found in `variable`, to prevent
  15309. // potential command injection attacks.
  15310. else if (reForbiddenIdentifierChars.test(variable)) {
  15311. throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);
  15312. }
  15313. // Cleanup code by stripping empty strings.
  15314. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  15315. .replace(reEmptyStringMiddle, '$1')
  15316. .replace(reEmptyStringTrailing, '$1;');
  15317. // Frame code as the function body.
  15318. source = 'function(' + (variable || 'obj') + ') {\n' +
  15319. (variable
  15320. ? ''
  15321. : 'obj || (obj = {});\n'
  15322. ) +
  15323. "var __t, __p = ''" +
  15324. (isEscaping
  15325. ? ', __e = _.escape'
  15326. : ''
  15327. ) +
  15328. (isEvaluating
  15329. ? ', __j = Array.prototype.join;\n' +
  15330. "function print() { __p += __j.call(arguments, '') }\n"
  15331. : ';\n'
  15332. ) +
  15333. source +
  15334. 'return __p\n}';
  15335. var result = attempt(function() {
  15336. return Function(importsKeys, sourceURL + 'return ' + source)
  15337. .apply(undefined, importsValues);
  15338. });
  15339. // Provide the compiled function's source by its `toString` method or
  15340. // the `source` property as a convenience for inlining compiled templates.
  15341. result.source = source;
  15342. if (isError(result)) {
  15343. throw result;
  15344. }
  15345. return result;
  15346. }
  15347. /**
  15348. * Converts `string`, as a whole, to lower case just like
  15349. * [String#toLowerCase](https://mdn.io/toLowerCase).
  15350. *
  15351. * @static
  15352. * @memberOf _
  15353. * @since 4.0.0
  15354. * @category String
  15355. * @param {string} [string=''] The string to convert.
  15356. * @returns {string} Returns the lower cased string.
  15357. * @example
  15358. *
  15359. * _.toLower('--Foo-Bar--');
  15360. * // => '--foo-bar--'
  15361. *
  15362. * _.toLower('fooBar');
  15363. * // => 'foobar'
  15364. *
  15365. * _.toLower('__FOO_BAR__');
  15366. * // => '__foo_bar__'
  15367. */
  15368. function toLower(value) {
  15369. return toString(value).toLowerCase();
  15370. }
  15371. /**
  15372. * Converts `string`, as a whole, to upper case just like
  15373. * [String#toUpperCase](https://mdn.io/toUpperCase).
  15374. *
  15375. * @static
  15376. * @memberOf _
  15377. * @since 4.0.0
  15378. * @category String
  15379. * @param {string} [string=''] The string to convert.
  15380. * @returns {string} Returns the upper cased string.
  15381. * @example
  15382. *
  15383. * _.toUpper('--foo-bar--');
  15384. * // => '--FOO-BAR--'
  15385. *
  15386. * _.toUpper('fooBar');
  15387. * // => 'FOOBAR'
  15388. *
  15389. * _.toUpper('__foo_bar__');
  15390. * // => '__FOO_BAR__'
  15391. */
  15392. function toUpper(value) {
  15393. return toString(value).toUpperCase();
  15394. }
  15395. /**
  15396. * Removes leading and trailing whitespace or specified characters from `string`.
  15397. *
  15398. * @static
  15399. * @memberOf _
  15400. * @since 3.0.0
  15401. * @category String
  15402. * @param {string} [string=''] The string to trim.
  15403. * @param {string} [chars=whitespace] The characters to trim.
  15404. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15405. * @returns {string} Returns the trimmed string.
  15406. * @example
  15407. *
  15408. * _.trim(' abc ');
  15409. * // => 'abc'
  15410. *
  15411. * _.trim('-_-abc-_-', '_-');
  15412. * // => 'abc'
  15413. *
  15414. * _.map([' foo ', ' bar '], _.trim);
  15415. * // => ['foo', 'bar']
  15416. */
  15417. function trim(string, chars, guard) {
  15418. string = toString(string);
  15419. if (string && (guard || chars === undefined)) {
  15420. return baseTrim(string);
  15421. }
  15422. if (!string || !(chars = baseToString(chars))) {
  15423. return string;
  15424. }
  15425. var strSymbols = stringToArray(string),
  15426. chrSymbols = stringToArray(chars),
  15427. start = charsStartIndex(strSymbols, chrSymbols),
  15428. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  15429. return castSlice(strSymbols, start, end).join('');
  15430. }
  15431. /**
  15432. * Removes trailing whitespace or specified characters from `string`.
  15433. *
  15434. * @static
  15435. * @memberOf _
  15436. * @since 4.0.0
  15437. * @category String
  15438. * @param {string} [string=''] The string to trim.
  15439. * @param {string} [chars=whitespace] The characters to trim.
  15440. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15441. * @returns {string} Returns the trimmed string.
  15442. * @example
  15443. *
  15444. * _.trimEnd(' abc ');
  15445. * // => ' abc'
  15446. *
  15447. * _.trimEnd('-_-abc-_-', '_-');
  15448. * // => '-_-abc'
  15449. */
  15450. function trimEnd(string, chars, guard) {
  15451. string = toString(string);
  15452. if (string && (guard || chars === undefined)) {
  15453. return string.slice(0, trimmedEndIndex(string) + 1);
  15454. }
  15455. if (!string || !(chars = baseToString(chars))) {
  15456. return string;
  15457. }
  15458. var strSymbols = stringToArray(string),
  15459. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  15460. return castSlice(strSymbols, 0, end).join('');
  15461. }
  15462. /**
  15463. * Removes leading whitespace or specified characters from `string`.
  15464. *
  15465. * @static
  15466. * @memberOf _
  15467. * @since 4.0.0
  15468. * @category String
  15469. * @param {string} [string=''] The string to trim.
  15470. * @param {string} [chars=whitespace] The characters to trim.
  15471. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15472. * @returns {string} Returns the trimmed string.
  15473. * @example
  15474. *
  15475. * _.trimStart(' abc ');
  15476. * // => 'abc '
  15477. *
  15478. * _.trimStart('-_-abc-_-', '_-');
  15479. * // => 'abc-_-'
  15480. */
  15481. function trimStart(string, chars, guard) {
  15482. string = toString(string);
  15483. if (string && (guard || chars === undefined)) {
  15484. return string.replace(reTrimStart, '');
  15485. }
  15486. if (!string || !(chars = baseToString(chars))) {
  15487. return string;
  15488. }
  15489. var strSymbols = stringToArray(string),
  15490. start = charsStartIndex(strSymbols, stringToArray(chars));
  15491. return castSlice(strSymbols, start).join('');
  15492. }
  15493. /**
  15494. * Truncates `string` if it's longer than the given maximum string length.
  15495. * The last characters of the truncated string are replaced with the omission
  15496. * string which defaults to "...".
  15497. *
  15498. * @static
  15499. * @memberOf _
  15500. * @since 4.0.0
  15501. * @category String
  15502. * @param {string} [string=''] The string to truncate.
  15503. * @param {Object} [options={}] The options object.
  15504. * @param {number} [options.length=30] The maximum string length.
  15505. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  15506. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  15507. * @returns {string} Returns the truncated string.
  15508. * @example
  15509. *
  15510. * _.truncate('hi-diddly-ho there, neighborino');
  15511. * // => 'hi-diddly-ho there, neighbo...'
  15512. *
  15513. * _.truncate('hi-diddly-ho there, neighborino', {
  15514. * 'length': 24,
  15515. * 'separator': ' '
  15516. * });
  15517. * // => 'hi-diddly-ho there,...'
  15518. *
  15519. * _.truncate('hi-diddly-ho there, neighborino', {
  15520. * 'length': 24,
  15521. * 'separator': /,? +/
  15522. * });
  15523. * // => 'hi-diddly-ho there...'
  15524. *
  15525. * _.truncate('hi-diddly-ho there, neighborino', {
  15526. * 'omission': ' [...]'
  15527. * });
  15528. * // => 'hi-diddly-ho there, neig [...]'
  15529. */
  15530. function truncate(string, options) {
  15531. var length = DEFAULT_TRUNC_LENGTH,
  15532. omission = DEFAULT_TRUNC_OMISSION;
  15533. if (isObject(options)) {
  15534. var separator = 'separator' in options ? options.separator : separator;
  15535. length = 'length' in options ? toInteger(options.length) : length;
  15536. omission = 'omission' in options ? baseToString(options.omission) : omission;
  15537. }
  15538. string = toString(string);
  15539. var strLength = string.length;
  15540. if (hasUnicode(string)) {
  15541. var strSymbols = stringToArray(string);
  15542. strLength = strSymbols.length;
  15543. }
  15544. if (length >= strLength) {
  15545. return string;
  15546. }
  15547. var end = length - stringSize(omission);
  15548. if (end < 1) {
  15549. return omission;
  15550. }
  15551. var result = strSymbols
  15552. ? castSlice(strSymbols, 0, end).join('')
  15553. : string.slice(0, end);
  15554. if (separator === undefined) {
  15555. return result + omission;
  15556. }
  15557. if (strSymbols) {
  15558. end += (result.length - end);
  15559. }
  15560. if (isRegExp(separator)) {
  15561. if (string.slice(end).search(separator)) {
  15562. var match,
  15563. substring = result;
  15564. if (!separator.global) {
  15565. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  15566. }
  15567. separator.lastIndex = 0;
  15568. while ((match = separator.exec(substring))) {
  15569. var newEnd = match.index;
  15570. }
  15571. result = result.slice(0, newEnd === undefined ? end : newEnd);
  15572. }
  15573. } else if (string.indexOf(baseToString(separator), end) != end) {
  15574. var index = result.lastIndexOf(separator);
  15575. if (index > -1) {
  15576. result = result.slice(0, index);
  15577. }
  15578. }
  15579. return result + omission;
  15580. }
  15581. /**
  15582. * The inverse of `_.escape`; this method converts the HTML entities
  15583. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  15584. * their corresponding characters.
  15585. *
  15586. * **Note:** No other HTML entities are unescaped. To unescape additional
  15587. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  15588. *
  15589. * @static
  15590. * @memberOf _
  15591. * @since 0.6.0
  15592. * @category String
  15593. * @param {string} [string=''] The string to unescape.
  15594. * @returns {string} Returns the unescaped string.
  15595. * @example
  15596. *
  15597. * _.unescape('fred, barney, &amp; pebbles');
  15598. * // => 'fred, barney, & pebbles'
  15599. */
  15600. function unescape(string) {
  15601. string = toString(string);
  15602. return (string && reHasEscapedHtml.test(string))
  15603. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  15604. : string;
  15605. }
  15606. /**
  15607. * Converts `string`, as space separated words, to upper case.
  15608. *
  15609. * @static
  15610. * @memberOf _
  15611. * @since 4.0.0
  15612. * @category String
  15613. * @param {string} [string=''] The string to convert.
  15614. * @returns {string} Returns the upper cased string.
  15615. * @example
  15616. *
  15617. * _.upperCase('--foo-bar');
  15618. * // => 'FOO BAR'
  15619. *
  15620. * _.upperCase('fooBar');
  15621. * // => 'FOO BAR'
  15622. *
  15623. * _.upperCase('__foo_bar__');
  15624. * // => 'FOO BAR'
  15625. */
  15626. var upperCase = createCompounder(function(result, word, index) {
  15627. return result + (index ? ' ' : '') + word.toUpperCase();
  15628. });
  15629. /**
  15630. * Converts the first character of `string` to upper case.
  15631. *
  15632. * @static
  15633. * @memberOf _
  15634. * @since 4.0.0
  15635. * @category String
  15636. * @param {string} [string=''] The string to convert.
  15637. * @returns {string} Returns the converted string.
  15638. * @example
  15639. *
  15640. * _.upperFirst('fred');
  15641. * // => 'Fred'
  15642. *
  15643. * _.upperFirst('FRED');
  15644. * // => 'FRED'
  15645. */
  15646. var upperFirst = createCaseFirst('toUpperCase');
  15647. /**
  15648. * Splits `string` into an array of its words.
  15649. *
  15650. * @static
  15651. * @memberOf _
  15652. * @since 3.0.0
  15653. * @category String
  15654. * @param {string} [string=''] The string to inspect.
  15655. * @param {RegExp|string} [pattern] The pattern to match words.
  15656. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15657. * @returns {Array} Returns the words of `string`.
  15658. * @example
  15659. *
  15660. * _.words('fred, barney, & pebbles');
  15661. * // => ['fred', 'barney', 'pebbles']
  15662. *
  15663. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  15664. * // => ['fred', 'barney', '&', 'pebbles']
  15665. */
  15666. function words(string, pattern, guard) {
  15667. string = toString(string);
  15668. pattern = guard ? undefined : pattern;
  15669. if (pattern === undefined) {
  15670. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  15671. }
  15672. return string.match(pattern) || [];
  15673. }
  15674. /*------------------------------------------------------------------------*/
  15675. /**
  15676. * Attempts to invoke `func`, returning either the result or the caught error
  15677. * object. Any additional arguments are provided to `func` when it's invoked.
  15678. *
  15679. * @static
  15680. * @memberOf _
  15681. * @since 3.0.0
  15682. * @category Util
  15683. * @param {Function} func The function to attempt.
  15684. * @param {...*} [args] The arguments to invoke `func` with.
  15685. * @returns {*} Returns the `func` result or error object.
  15686. * @example
  15687. *
  15688. * // Avoid throwing errors for invalid selectors.
  15689. * var elements = _.attempt(function(selector) {
  15690. * return document.querySelectorAll(selector);
  15691. * }, '>_>');
  15692. *
  15693. * if (_.isError(elements)) {
  15694. * elements = [];
  15695. * }
  15696. */
  15697. var attempt = baseRest(function(func, args) {
  15698. try {
  15699. return apply(func, undefined, args);
  15700. } catch (e) {
  15701. return isError(e) ? e : new Error(e);
  15702. }
  15703. });
  15704. /**
  15705. * Binds methods of an object to the object itself, overwriting the existing
  15706. * method.
  15707. *
  15708. * **Note:** This method doesn't set the "length" property of bound functions.
  15709. *
  15710. * @static
  15711. * @since 0.1.0
  15712. * @memberOf _
  15713. * @category Util
  15714. * @param {Object} object The object to bind and assign the bound methods to.
  15715. * @param {...(string|string[])} methodNames The object method names to bind.
  15716. * @returns {Object} Returns `object`.
  15717. * @example
  15718. *
  15719. * var view = {
  15720. * 'label': 'docs',
  15721. * 'click': function() {
  15722. * console.log('clicked ' + this.label);
  15723. * }
  15724. * };
  15725. *
  15726. * _.bindAll(view, ['click']);
  15727. * jQuery(element).on('click', view.click);
  15728. * // => Logs 'clicked docs' when clicked.
  15729. */
  15730. var bindAll = flatRest(function(object, methodNames) {
  15731. arrayEach(methodNames, function(key) {
  15732. key = toKey(key);
  15733. baseAssignValue(object, key, bind(object[key], object));
  15734. });
  15735. return object;
  15736. });
  15737. /**
  15738. * Creates a function that iterates over `pairs` and invokes the corresponding
  15739. * function of the first predicate to return truthy. The predicate-function
  15740. * pairs are invoked with the `this` binding and arguments of the created
  15741. * function.
  15742. *
  15743. * @static
  15744. * @memberOf _
  15745. * @since 4.0.0
  15746. * @category Util
  15747. * @param {Array} pairs The predicate-function pairs.
  15748. * @returns {Function} Returns the new composite function.
  15749. * @example
  15750. *
  15751. * var func = _.cond([
  15752. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  15753. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  15754. * [_.stubTrue, _.constant('no match')]
  15755. * ]);
  15756. *
  15757. * func({ 'a': 1, 'b': 2 });
  15758. * // => 'matches A'
  15759. *
  15760. * func({ 'a': 0, 'b': 1 });
  15761. * // => 'matches B'
  15762. *
  15763. * func({ 'a': '1', 'b': '2' });
  15764. * // => 'no match'
  15765. */
  15766. function cond(pairs) {
  15767. var length = pairs == null ? 0 : pairs.length,
  15768. toIteratee = getIteratee();
  15769. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  15770. if (typeof pair[1] != 'function') {
  15771. throw new TypeError(FUNC_ERROR_TEXT);
  15772. }
  15773. return [toIteratee(pair[0]), pair[1]];
  15774. });
  15775. return baseRest(function(args) {
  15776. var index = -1;
  15777. while (++index < length) {
  15778. var pair = pairs[index];
  15779. if (apply(pair[0], this, args)) {
  15780. return apply(pair[1], this, args);
  15781. }
  15782. }
  15783. });
  15784. }
  15785. /**
  15786. * Creates a function that invokes the predicate properties of `source` with
  15787. * the corresponding property values of a given object, returning `true` if
  15788. * all predicates return truthy, else `false`.
  15789. *
  15790. * **Note:** The created function is equivalent to `_.conformsTo` with
  15791. * `source` partially applied.
  15792. *
  15793. * @static
  15794. * @memberOf _
  15795. * @since 4.0.0
  15796. * @category Util
  15797. * @param {Object} source The object of property predicates to conform to.
  15798. * @returns {Function} Returns the new spec function.
  15799. * @example
  15800. *
  15801. * var objects = [
  15802. * { 'a': 2, 'b': 1 },
  15803. * { 'a': 1, 'b': 2 }
  15804. * ];
  15805. *
  15806. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  15807. * // => [{ 'a': 1, 'b': 2 }]
  15808. */
  15809. function conforms(source) {
  15810. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  15811. }
  15812. /**
  15813. * Creates a function that returns `value`.
  15814. *
  15815. * @static
  15816. * @memberOf _
  15817. * @since 2.4.0
  15818. * @category Util
  15819. * @param {*} value The value to return from the new function.
  15820. * @returns {Function} Returns the new constant function.
  15821. * @example
  15822. *
  15823. * var objects = _.times(2, _.constant({ 'a': 1 }));
  15824. *
  15825. * console.log(objects);
  15826. * // => [{ 'a': 1 }, { 'a': 1 }]
  15827. *
  15828. * console.log(objects[0] === objects[1]);
  15829. * // => true
  15830. */
  15831. function constant(value) {
  15832. return function() {
  15833. return value;
  15834. };
  15835. }
  15836. /**
  15837. * Checks `value` to determine whether a default value should be returned in
  15838. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  15839. * or `undefined`.
  15840. *
  15841. * @static
  15842. * @memberOf _
  15843. * @since 4.14.0
  15844. * @category Util
  15845. * @param {*} value The value to check.
  15846. * @param {*} defaultValue The default value.
  15847. * @returns {*} Returns the resolved value.
  15848. * @example
  15849. *
  15850. * _.defaultTo(1, 10);
  15851. * // => 1
  15852. *
  15853. * _.defaultTo(undefined, 10);
  15854. * // => 10
  15855. */
  15856. function defaultTo(value, defaultValue) {
  15857. return (value == null || value !== value) ? defaultValue : value;
  15858. }
  15859. /**
  15860. * Creates a function that returns the result of invoking the given functions
  15861. * with the `this` binding of the created function, where each successive
  15862. * invocation is supplied the return value of the previous.
  15863. *
  15864. * @static
  15865. * @memberOf _
  15866. * @since 3.0.0
  15867. * @category Util
  15868. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  15869. * @returns {Function} Returns the new composite function.
  15870. * @see _.flowRight
  15871. * @example
  15872. *
  15873. * function square(n) {
  15874. * return n * n;
  15875. * }
  15876. *
  15877. * var addSquare = _.flow([_.add, square]);
  15878. * addSquare(1, 2);
  15879. * // => 9
  15880. */
  15881. var flow = createFlow();
  15882. /**
  15883. * This method is like `_.flow` except that it creates a function that
  15884. * invokes the given functions from right to left.
  15885. *
  15886. * @static
  15887. * @since 3.0.0
  15888. * @memberOf _
  15889. * @category Util
  15890. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  15891. * @returns {Function} Returns the new composite function.
  15892. * @see _.flow
  15893. * @example
  15894. *
  15895. * function square(n) {
  15896. * return n * n;
  15897. * }
  15898. *
  15899. * var addSquare = _.flowRight([square, _.add]);
  15900. * addSquare(1, 2);
  15901. * // => 9
  15902. */
  15903. var flowRight = createFlow(true);
  15904. /**
  15905. * This method returns the first argument it receives.
  15906. *
  15907. * @static
  15908. * @since 0.1.0
  15909. * @memberOf _
  15910. * @category Util
  15911. * @param {*} value Any value.
  15912. * @returns {*} Returns `value`.
  15913. * @example
  15914. *
  15915. * var object = { 'a': 1 };
  15916. *
  15917. * console.log(_.identity(object) === object);
  15918. * // => true
  15919. */
  15920. function identity(value) {
  15921. return value;
  15922. }
  15923. /**
  15924. * Creates a function that invokes `func` with the arguments of the created
  15925. * function. If `func` is a property name, the created function returns the
  15926. * property value for a given element. If `func` is an array or object, the
  15927. * created function returns `true` for elements that contain the equivalent
  15928. * source properties, otherwise it returns `false`.
  15929. *
  15930. * @static
  15931. * @since 4.0.0
  15932. * @memberOf _
  15933. * @category Util
  15934. * @param {*} [func=_.identity] The value to convert to a callback.
  15935. * @returns {Function} Returns the callback.
  15936. * @example
  15937. *
  15938. * var users = [
  15939. * { 'user': 'barney', 'age': 36, 'active': true },
  15940. * { 'user': 'fred', 'age': 40, 'active': false }
  15941. * ];
  15942. *
  15943. * // The `_.matches` iteratee shorthand.
  15944. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  15945. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  15946. *
  15947. * // The `_.matchesProperty` iteratee shorthand.
  15948. * _.filter(users, _.iteratee(['user', 'fred']));
  15949. * // => [{ 'user': 'fred', 'age': 40 }]
  15950. *
  15951. * // The `_.property` iteratee shorthand.
  15952. * _.map(users, _.iteratee('user'));
  15953. * // => ['barney', 'fred']
  15954. *
  15955. * // Create custom iteratee shorthands.
  15956. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  15957. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  15958. * return func.test(string);
  15959. * };
  15960. * });
  15961. *
  15962. * _.filter(['abc', 'def'], /ef/);
  15963. * // => ['def']
  15964. */
  15965. function iteratee(func) {
  15966. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  15967. }
  15968. /**
  15969. * Creates a function that performs a partial deep comparison between a given
  15970. * object and `source`, returning `true` if the given object has equivalent
  15971. * property values, else `false`.
  15972. *
  15973. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  15974. * partially applied.
  15975. *
  15976. * Partial comparisons will match empty array and empty object `source`
  15977. * values against any array or object value, respectively. See `_.isEqual`
  15978. * for a list of supported value comparisons.
  15979. *
  15980. * **Note:** Multiple values can be checked by combining several matchers
  15981. * using `_.overSome`
  15982. *
  15983. * @static
  15984. * @memberOf _
  15985. * @since 3.0.0
  15986. * @category Util
  15987. * @param {Object} source The object of property values to match.
  15988. * @returns {Function} Returns the new spec function.
  15989. * @example
  15990. *
  15991. * var objects = [
  15992. * { 'a': 1, 'b': 2, 'c': 3 },
  15993. * { 'a': 4, 'b': 5, 'c': 6 }
  15994. * ];
  15995. *
  15996. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  15997. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  15998. *
  15999. * // Checking for several possible values
  16000. * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));
  16001. * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
  16002. */
  16003. function matches(source) {
  16004. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  16005. }
  16006. /**
  16007. * Creates a function that performs a partial deep comparison between the
  16008. * value at `path` of a given object to `srcValue`, returning `true` if the
  16009. * object value is equivalent, else `false`.
  16010. *
  16011. * **Note:** Partial comparisons will match empty array and empty object
  16012. * `srcValue` values against any array or object value, respectively. See
  16013. * `_.isEqual` for a list of supported value comparisons.
  16014. *
  16015. * **Note:** Multiple values can be checked by combining several matchers
  16016. * using `_.overSome`
  16017. *
  16018. * @static
  16019. * @memberOf _
  16020. * @since 3.2.0
  16021. * @category Util
  16022. * @param {Array|string} path The path of the property to get.
  16023. * @param {*} srcValue The value to match.
  16024. * @returns {Function} Returns the new spec function.
  16025. * @example
  16026. *
  16027. * var objects = [
  16028. * { 'a': 1, 'b': 2, 'c': 3 },
  16029. * { 'a': 4, 'b': 5, 'c': 6 }
  16030. * ];
  16031. *
  16032. * _.find(objects, _.matchesProperty('a', 4));
  16033. * // => { 'a': 4, 'b': 5, 'c': 6 }
  16034. *
  16035. * // Checking for several possible values
  16036. * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)]));
  16037. * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
  16038. */
  16039. function matchesProperty(path, srcValue) {
  16040. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  16041. }
  16042. /**
  16043. * Creates a function that invokes the method at `path` of a given object.
  16044. * Any additional arguments are provided to the invoked method.
  16045. *
  16046. * @static
  16047. * @memberOf _
  16048. * @since 3.7.0
  16049. * @category Util
  16050. * @param {Array|string} path The path of the method to invoke.
  16051. * @param {...*} [args] The arguments to invoke the method with.
  16052. * @returns {Function} Returns the new invoker function.
  16053. * @example
  16054. *
  16055. * var objects = [
  16056. * { 'a': { 'b': _.constant(2) } },
  16057. * { 'a': { 'b': _.constant(1) } }
  16058. * ];
  16059. *
  16060. * _.map(objects, _.method('a.b'));
  16061. * // => [2, 1]
  16062. *
  16063. * _.map(objects, _.method(['a', 'b']));
  16064. * // => [2, 1]
  16065. */
  16066. var method = baseRest(function(path, args) {
  16067. return function(object) {
  16068. return baseInvoke(object, path, args);
  16069. };
  16070. });
  16071. /**
  16072. * The opposite of `_.method`; this method creates a function that invokes
  16073. * the method at a given path of `object`. Any additional arguments are
  16074. * provided to the invoked method.
  16075. *
  16076. * @static
  16077. * @memberOf _
  16078. * @since 3.7.0
  16079. * @category Util
  16080. * @param {Object} object The object to query.
  16081. * @param {...*} [args] The arguments to invoke the method with.
  16082. * @returns {Function} Returns the new invoker function.
  16083. * @example
  16084. *
  16085. * var array = _.times(3, _.constant),
  16086. * object = { 'a': array, 'b': array, 'c': array };
  16087. *
  16088. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  16089. * // => [2, 0]
  16090. *
  16091. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  16092. * // => [2, 0]
  16093. */
  16094. var methodOf = baseRest(function(object, args) {
  16095. return function(path) {
  16096. return baseInvoke(object, path, args);
  16097. };
  16098. });
  16099. /**
  16100. * Adds all own enumerable string keyed function properties of a source
  16101. * object to the destination object. If `object` is a function, then methods
  16102. * are added to its prototype as well.
  16103. *
  16104. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  16105. * avoid conflicts caused by modifying the original.
  16106. *
  16107. * @static
  16108. * @since 0.1.0
  16109. * @memberOf _
  16110. * @category Util
  16111. * @param {Function|Object} [object=lodash] The destination object.
  16112. * @param {Object} source The object of functions to add.
  16113. * @param {Object} [options={}] The options object.
  16114. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  16115. * @returns {Function|Object} Returns `object`.
  16116. * @example
  16117. *
  16118. * function vowels(string) {
  16119. * return _.filter(string, function(v) {
  16120. * return /[aeiou]/i.test(v);
  16121. * });
  16122. * }
  16123. *
  16124. * _.mixin({ 'vowels': vowels });
  16125. * _.vowels('fred');
  16126. * // => ['e']
  16127. *
  16128. * _('fred').vowels().value();
  16129. * // => ['e']
  16130. *
  16131. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  16132. * _('fred').vowels();
  16133. * // => ['e']
  16134. */
  16135. function mixin(object, source, options) {
  16136. var props = keys(source),
  16137. methodNames = baseFunctions(source, props);
  16138. if (options == null &&
  16139. !(isObject(source) && (methodNames.length || !props.length))) {
  16140. options = source;
  16141. source = object;
  16142. object = this;
  16143. methodNames = baseFunctions(source, keys(source));
  16144. }
  16145. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  16146. isFunc = isFunction(object);
  16147. arrayEach(methodNames, function(methodName) {
  16148. var func = source[methodName];
  16149. object[methodName] = func;
  16150. if (isFunc) {
  16151. object.prototype[methodName] = function() {
  16152. var chainAll = this.__chain__;
  16153. if (chain || chainAll) {
  16154. var result = object(this.__wrapped__),
  16155. actions = result.__actions__ = copyArray(this.__actions__);
  16156. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  16157. result.__chain__ = chainAll;
  16158. return result;
  16159. }
  16160. return func.apply(object, arrayPush([this.value()], arguments));
  16161. };
  16162. }
  16163. });
  16164. return object;
  16165. }
  16166. /**
  16167. * Reverts the `_` variable to its previous value and returns a reference to
  16168. * the `lodash` function.
  16169. *
  16170. * @static
  16171. * @since 0.1.0
  16172. * @memberOf _
  16173. * @category Util
  16174. * @returns {Function} Returns the `lodash` function.
  16175. * @example
  16176. *
  16177. * var lodash = _.noConflict();
  16178. */
  16179. function noConflict() {
  16180. if (root._ === this) {
  16181. root._ = oldDash;
  16182. }
  16183. return this;
  16184. }
  16185. /**
  16186. * This method returns `undefined`.
  16187. *
  16188. * @static
  16189. * @memberOf _
  16190. * @since 2.3.0
  16191. * @category Util
  16192. * @example
  16193. *
  16194. * _.times(2, _.noop);
  16195. * // => [undefined, undefined]
  16196. */
  16197. function noop() {
  16198. // No operation performed.
  16199. }
  16200. /**
  16201. * Creates a function that gets the argument at index `n`. If `n` is negative,
  16202. * the nth argument from the end is returned.
  16203. *
  16204. * @static
  16205. * @memberOf _
  16206. * @since 4.0.0
  16207. * @category Util
  16208. * @param {number} [n=0] The index of the argument to return.
  16209. * @returns {Function} Returns the new pass-thru function.
  16210. * @example
  16211. *
  16212. * var func = _.nthArg(1);
  16213. * func('a', 'b', 'c', 'd');
  16214. * // => 'b'
  16215. *
  16216. * var func = _.nthArg(-2);
  16217. * func('a', 'b', 'c', 'd');
  16218. * // => 'c'
  16219. */
  16220. function nthArg(n) {
  16221. n = toInteger(n);
  16222. return baseRest(function(args) {
  16223. return baseNth(args, n);
  16224. });
  16225. }
  16226. /**
  16227. * Creates a function that invokes `iteratees` with the arguments it receives
  16228. * and returns their results.
  16229. *
  16230. * @static
  16231. * @memberOf _
  16232. * @since 4.0.0
  16233. * @category Util
  16234. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  16235. * The iteratees to invoke.
  16236. * @returns {Function} Returns the new function.
  16237. * @example
  16238. *
  16239. * var func = _.over([Math.max, Math.min]);
  16240. *
  16241. * func(1, 2, 3, 4);
  16242. * // => [4, 1]
  16243. */
  16244. var over = createOver(arrayMap);
  16245. /**
  16246. * Creates a function that checks if **all** of the `predicates` return
  16247. * truthy when invoked with the arguments it receives.
  16248. *
  16249. * Following shorthands are possible for providing predicates.
  16250. * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
  16251. * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
  16252. *
  16253. * @static
  16254. * @memberOf _
  16255. * @since 4.0.0
  16256. * @category Util
  16257. * @param {...(Function|Function[])} [predicates=[_.identity]]
  16258. * The predicates to check.
  16259. * @returns {Function} Returns the new function.
  16260. * @example
  16261. *
  16262. * var func = _.overEvery([Boolean, isFinite]);
  16263. *
  16264. * func('1');
  16265. * // => true
  16266. *
  16267. * func(null);
  16268. * // => false
  16269. *
  16270. * func(NaN);
  16271. * // => false
  16272. */
  16273. var overEvery = createOver(arrayEvery);
  16274. /**
  16275. * Creates a function that checks if **any** of the `predicates` return
  16276. * truthy when invoked with the arguments it receives.
  16277. *
  16278. * Following shorthands are possible for providing predicates.
  16279. * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
  16280. * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
  16281. *
  16282. * @static
  16283. * @memberOf _
  16284. * @since 4.0.0
  16285. * @category Util
  16286. * @param {...(Function|Function[])} [predicates=[_.identity]]
  16287. * The predicates to check.
  16288. * @returns {Function} Returns the new function.
  16289. * @example
  16290. *
  16291. * var func = _.overSome([Boolean, isFinite]);
  16292. *
  16293. * func('1');
  16294. * // => true
  16295. *
  16296. * func(null);
  16297. * // => true
  16298. *
  16299. * func(NaN);
  16300. * // => false
  16301. *
  16302. * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }])
  16303. * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]])
  16304. */
  16305. var overSome = createOver(arraySome);
  16306. /**
  16307. * Creates a function that returns the value at `path` of a given object.
  16308. *
  16309. * @static
  16310. * @memberOf _
  16311. * @since 2.4.0
  16312. * @category Util
  16313. * @param {Array|string} path The path of the property to get.
  16314. * @returns {Function} Returns the new accessor function.
  16315. * @example
  16316. *
  16317. * var objects = [
  16318. * { 'a': { 'b': 2 } },
  16319. * { 'a': { 'b': 1 } }
  16320. * ];
  16321. *
  16322. * _.map(objects, _.property('a.b'));
  16323. * // => [2, 1]
  16324. *
  16325. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  16326. * // => [1, 2]
  16327. */
  16328. function property(path) {
  16329. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  16330. }
  16331. /**
  16332. * The opposite of `_.property`; this method creates a function that returns
  16333. * the value at a given path of `object`.
  16334. *
  16335. * @static
  16336. * @memberOf _
  16337. * @since 3.0.0
  16338. * @category Util
  16339. * @param {Object} object The object to query.
  16340. * @returns {Function} Returns the new accessor function.
  16341. * @example
  16342. *
  16343. * var array = [0, 1, 2],
  16344. * object = { 'a': array, 'b': array, 'c': array };
  16345. *
  16346. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  16347. * // => [2, 0]
  16348. *
  16349. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  16350. * // => [2, 0]
  16351. */
  16352. function propertyOf(object) {
  16353. return function(path) {
  16354. return object == null ? undefined : baseGet(object, path);
  16355. };
  16356. }
  16357. /**
  16358. * Creates an array of numbers (positive and/or negative) progressing from
  16359. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  16360. * `start` is specified without an `end` or `step`. If `end` is not specified,
  16361. * it's set to `start` with `start` then set to `0`.
  16362. *
  16363. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  16364. * floating-point values which can produce unexpected results.
  16365. *
  16366. * @static
  16367. * @since 0.1.0
  16368. * @memberOf _
  16369. * @category Util
  16370. * @param {number} [start=0] The start of the range.
  16371. * @param {number} end The end of the range.
  16372. * @param {number} [step=1] The value to increment or decrement by.
  16373. * @returns {Array} Returns the range of numbers.
  16374. * @see _.inRange, _.rangeRight
  16375. * @example
  16376. *
  16377. * _.range(4);
  16378. * // => [0, 1, 2, 3]
  16379. *
  16380. * _.range(-4);
  16381. * // => [0, -1, -2, -3]
  16382. *
  16383. * _.range(1, 5);
  16384. * // => [1, 2, 3, 4]
  16385. *
  16386. * _.range(0, 20, 5);
  16387. * // => [0, 5, 10, 15]
  16388. *
  16389. * _.range(0, -4, -1);
  16390. * // => [0, -1, -2, -3]
  16391. *
  16392. * _.range(1, 4, 0);
  16393. * // => [1, 1, 1]
  16394. *
  16395. * _.range(0);
  16396. * // => []
  16397. */
  16398. var range = createRange();
  16399. /**
  16400. * This method is like `_.range` except that it populates values in
  16401. * descending order.
  16402. *
  16403. * @static
  16404. * @memberOf _
  16405. * @since 4.0.0
  16406. * @category Util
  16407. * @param {number} [start=0] The start of the range.
  16408. * @param {number} end The end of the range.
  16409. * @param {number} [step=1] The value to increment or decrement by.
  16410. * @returns {Array} Returns the range of numbers.
  16411. * @see _.inRange, _.range
  16412. * @example
  16413. *
  16414. * _.rangeRight(4);
  16415. * // => [3, 2, 1, 0]
  16416. *
  16417. * _.rangeRight(-4);
  16418. * // => [-3, -2, -1, 0]
  16419. *
  16420. * _.rangeRight(1, 5);
  16421. * // => [4, 3, 2, 1]
  16422. *
  16423. * _.rangeRight(0, 20, 5);
  16424. * // => [15, 10, 5, 0]
  16425. *
  16426. * _.rangeRight(0, -4, -1);
  16427. * // => [-3, -2, -1, 0]
  16428. *
  16429. * _.rangeRight(1, 4, 0);
  16430. * // => [1, 1, 1]
  16431. *
  16432. * _.rangeRight(0);
  16433. * // => []
  16434. */
  16435. var rangeRight = createRange(true);
  16436. /**
  16437. * This method returns a new empty array.
  16438. *
  16439. * @static
  16440. * @memberOf _
  16441. * @since 4.13.0
  16442. * @category Util
  16443. * @returns {Array} Returns the new empty array.
  16444. * @example
  16445. *
  16446. * var arrays = _.times(2, _.stubArray);
  16447. *
  16448. * console.log(arrays);
  16449. * // => [[], []]
  16450. *
  16451. * console.log(arrays[0] === arrays[1]);
  16452. * // => false
  16453. */
  16454. function stubArray() {
  16455. return [];
  16456. }
  16457. /**
  16458. * This method returns `false`.
  16459. *
  16460. * @static
  16461. * @memberOf _
  16462. * @since 4.13.0
  16463. * @category Util
  16464. * @returns {boolean} Returns `false`.
  16465. * @example
  16466. *
  16467. * _.times(2, _.stubFalse);
  16468. * // => [false, false]
  16469. */
  16470. function stubFalse() {
  16471. return false;
  16472. }
  16473. /**
  16474. * This method returns a new empty object.
  16475. *
  16476. * @static
  16477. * @memberOf _
  16478. * @since 4.13.0
  16479. * @category Util
  16480. * @returns {Object} Returns the new empty object.
  16481. * @example
  16482. *
  16483. * var objects = _.times(2, _.stubObject);
  16484. *
  16485. * console.log(objects);
  16486. * // => [{}, {}]
  16487. *
  16488. * console.log(objects[0] === objects[1]);
  16489. * // => false
  16490. */
  16491. function stubObject() {
  16492. return {};
  16493. }
  16494. /**
  16495. * This method returns an empty string.
  16496. *
  16497. * @static
  16498. * @memberOf _
  16499. * @since 4.13.0
  16500. * @category Util
  16501. * @returns {string} Returns the empty string.
  16502. * @example
  16503. *
  16504. * _.times(2, _.stubString);
  16505. * // => ['', '']
  16506. */
  16507. function stubString() {
  16508. return '';
  16509. }
  16510. /**
  16511. * This method returns `true`.
  16512. *
  16513. * @static
  16514. * @memberOf _
  16515. * @since 4.13.0
  16516. * @category Util
  16517. * @returns {boolean} Returns `true`.
  16518. * @example
  16519. *
  16520. * _.times(2, _.stubTrue);
  16521. * // => [true, true]
  16522. */
  16523. function stubTrue() {
  16524. return true;
  16525. }
  16526. /**
  16527. * Invokes the iteratee `n` times, returning an array of the results of
  16528. * each invocation. The iteratee is invoked with one argument; (index).
  16529. *
  16530. * @static
  16531. * @since 0.1.0
  16532. * @memberOf _
  16533. * @category Util
  16534. * @param {number} n The number of times to invoke `iteratee`.
  16535. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  16536. * @returns {Array} Returns the array of results.
  16537. * @example
  16538. *
  16539. * _.times(3, String);
  16540. * // => ['0', '1', '2']
  16541. *
  16542. * _.times(4, _.constant(0));
  16543. * // => [0, 0, 0, 0]
  16544. */
  16545. function times(n, iteratee) {
  16546. n = toInteger(n);
  16547. if (n < 1 || n > MAX_SAFE_INTEGER) {
  16548. return [];
  16549. }
  16550. var index = MAX_ARRAY_LENGTH,
  16551. length = nativeMin(n, MAX_ARRAY_LENGTH);
  16552. iteratee = getIteratee(iteratee);
  16553. n -= MAX_ARRAY_LENGTH;
  16554. var result = baseTimes(length, iteratee);
  16555. while (++index < n) {
  16556. iteratee(index);
  16557. }
  16558. return result;
  16559. }
  16560. /**
  16561. * Converts `value` to a property path array.
  16562. *
  16563. * @static
  16564. * @memberOf _
  16565. * @since 4.0.0
  16566. * @category Util
  16567. * @param {*} value The value to convert.
  16568. * @returns {Array} Returns the new property path array.
  16569. * @example
  16570. *
  16571. * _.toPath('a.b.c');
  16572. * // => ['a', 'b', 'c']
  16573. *
  16574. * _.toPath('a[0].b.c');
  16575. * // => ['a', '0', 'b', 'c']
  16576. */
  16577. function toPath(value) {
  16578. if (isArray(value)) {
  16579. return arrayMap(value, toKey);
  16580. }
  16581. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  16582. }
  16583. /**
  16584. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  16585. *
  16586. * @static
  16587. * @since 0.1.0
  16588. * @memberOf _
  16589. * @category Util
  16590. * @param {string} [prefix=''] The value to prefix the ID with.
  16591. * @returns {string} Returns the unique ID.
  16592. * @example
  16593. *
  16594. * _.uniqueId('contact_');
  16595. * // => 'contact_104'
  16596. *
  16597. * _.uniqueId();
  16598. * // => '105'
  16599. */
  16600. function uniqueId(prefix) {
  16601. var id = ++idCounter;
  16602. return toString(prefix) + id;
  16603. }
  16604. /*------------------------------------------------------------------------*/
  16605. /**
  16606. * Adds two numbers.
  16607. *
  16608. * @static
  16609. * @memberOf _
  16610. * @since 3.4.0
  16611. * @category Math
  16612. * @param {number} augend The first number in an addition.
  16613. * @param {number} addend The second number in an addition.
  16614. * @returns {number} Returns the total.
  16615. * @example
  16616. *
  16617. * _.add(6, 4);
  16618. * // => 10
  16619. */
  16620. var add = createMathOperation(function(augend, addend) {
  16621. return augend + addend;
  16622. }, 0);
  16623. /**
  16624. * Computes `number` rounded up to `precision`.
  16625. *
  16626. * @static
  16627. * @memberOf _
  16628. * @since 3.10.0
  16629. * @category Math
  16630. * @param {number} number The number to round up.
  16631. * @param {number} [precision=0] The precision to round up to.
  16632. * @returns {number} Returns the rounded up number.
  16633. * @example
  16634. *
  16635. * _.ceil(4.006);
  16636. * // => 5
  16637. *
  16638. * _.ceil(6.004, 2);
  16639. * // => 6.01
  16640. *
  16641. * _.ceil(6040, -2);
  16642. * // => 6100
  16643. */
  16644. var ceil = createRound('ceil');
  16645. /**
  16646. * Divide two numbers.
  16647. *
  16648. * @static
  16649. * @memberOf _
  16650. * @since 4.7.0
  16651. * @category Math
  16652. * @param {number} dividend The first number in a division.
  16653. * @param {number} divisor The second number in a division.
  16654. * @returns {number} Returns the quotient.
  16655. * @example
  16656. *
  16657. * _.divide(6, 4);
  16658. * // => 1.5
  16659. */
  16660. var divide = createMathOperation(function(dividend, divisor) {
  16661. return dividend / divisor;
  16662. }, 1);
  16663. /**
  16664. * Computes `number` rounded down to `precision`.
  16665. *
  16666. * @static
  16667. * @memberOf _
  16668. * @since 3.10.0
  16669. * @category Math
  16670. * @param {number} number The number to round down.
  16671. * @param {number} [precision=0] The precision to round down to.
  16672. * @returns {number} Returns the rounded down number.
  16673. * @example
  16674. *
  16675. * _.floor(4.006);
  16676. * // => 4
  16677. *
  16678. * _.floor(0.046, 2);
  16679. * // => 0.04
  16680. *
  16681. * _.floor(4060, -2);
  16682. * // => 4000
  16683. */
  16684. var floor = createRound('floor');
  16685. /**
  16686. * Computes the maximum value of `array`. If `array` is empty or falsey,
  16687. * `undefined` is returned.
  16688. *
  16689. * @static
  16690. * @since 0.1.0
  16691. * @memberOf _
  16692. * @category Math
  16693. * @param {Array} array The array to iterate over.
  16694. * @returns {*} Returns the maximum value.
  16695. * @example
  16696. *
  16697. * _.max([4, 2, 8, 6]);
  16698. * // => 8
  16699. *
  16700. * _.max([]);
  16701. * // => undefined
  16702. */
  16703. function max(array) {
  16704. return (array && array.length)
  16705. ? baseExtremum(array, identity, baseGt)
  16706. : undefined;
  16707. }
  16708. /**
  16709. * This method is like `_.max` except that it accepts `iteratee` which is
  16710. * invoked for each element in `array` to generate the criterion by which
  16711. * the value is ranked. The iteratee is invoked with one argument: (value).
  16712. *
  16713. * @static
  16714. * @memberOf _
  16715. * @since 4.0.0
  16716. * @category Math
  16717. * @param {Array} array The array to iterate over.
  16718. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16719. * @returns {*} Returns the maximum value.
  16720. * @example
  16721. *
  16722. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  16723. *
  16724. * _.maxBy(objects, function(o) { return o.n; });
  16725. * // => { 'n': 2 }
  16726. *
  16727. * // The `_.property` iteratee shorthand.
  16728. * _.maxBy(objects, 'n');
  16729. * // => { 'n': 2 }
  16730. */
  16731. function maxBy(array, iteratee) {
  16732. return (array && array.length)
  16733. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  16734. : undefined;
  16735. }
  16736. /**
  16737. * Computes the mean of the values in `array`.
  16738. *
  16739. * @static
  16740. * @memberOf _
  16741. * @since 4.0.0
  16742. * @category Math
  16743. * @param {Array} array The array to iterate over.
  16744. * @returns {number} Returns the mean.
  16745. * @example
  16746. *
  16747. * _.mean([4, 2, 8, 6]);
  16748. * // => 5
  16749. */
  16750. function mean(array) {
  16751. return baseMean(array, identity);
  16752. }
  16753. /**
  16754. * This method is like `_.mean` except that it accepts `iteratee` which is
  16755. * invoked for each element in `array` to generate the value to be averaged.
  16756. * The iteratee is invoked with one argument: (value).
  16757. *
  16758. * @static
  16759. * @memberOf _
  16760. * @since 4.7.0
  16761. * @category Math
  16762. * @param {Array} array The array to iterate over.
  16763. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16764. * @returns {number} Returns the mean.
  16765. * @example
  16766. *
  16767. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  16768. *
  16769. * _.meanBy(objects, function(o) { return o.n; });
  16770. * // => 5
  16771. *
  16772. * // The `_.property` iteratee shorthand.
  16773. * _.meanBy(objects, 'n');
  16774. * // => 5
  16775. */
  16776. function meanBy(array, iteratee) {
  16777. return baseMean(array, getIteratee(iteratee, 2));
  16778. }
  16779. /**
  16780. * Computes the minimum value of `array`. If `array` is empty or falsey,
  16781. * `undefined` is returned.
  16782. *
  16783. * @static
  16784. * @since 0.1.0
  16785. * @memberOf _
  16786. * @category Math
  16787. * @param {Array} array The array to iterate over.
  16788. * @returns {*} Returns the minimum value.
  16789. * @example
  16790. *
  16791. * _.min([4, 2, 8, 6]);
  16792. * // => 2
  16793. *
  16794. * _.min([]);
  16795. * // => undefined
  16796. */
  16797. function min(array) {
  16798. return (array && array.length)
  16799. ? baseExtremum(array, identity, baseLt)
  16800. : undefined;
  16801. }
  16802. /**
  16803. * This method is like `_.min` except that it accepts `iteratee` which is
  16804. * invoked for each element in `array` to generate the criterion by which
  16805. * the value is ranked. The iteratee is invoked with one argument: (value).
  16806. *
  16807. * @static
  16808. * @memberOf _
  16809. * @since 4.0.0
  16810. * @category Math
  16811. * @param {Array} array The array to iterate over.
  16812. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16813. * @returns {*} Returns the minimum value.
  16814. * @example
  16815. *
  16816. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  16817. *
  16818. * _.minBy(objects, function(o) { return o.n; });
  16819. * // => { 'n': 1 }
  16820. *
  16821. * // The `_.property` iteratee shorthand.
  16822. * _.minBy(objects, 'n');
  16823. * // => { 'n': 1 }
  16824. */
  16825. function minBy(array, iteratee) {
  16826. return (array && array.length)
  16827. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  16828. : undefined;
  16829. }
  16830. /**
  16831. * Multiply two numbers.
  16832. *
  16833. * @static
  16834. * @memberOf _
  16835. * @since 4.7.0
  16836. * @category Math
  16837. * @param {number} multiplier The first number in a multiplication.
  16838. * @param {number} multiplicand The second number in a multiplication.
  16839. * @returns {number} Returns the product.
  16840. * @example
  16841. *
  16842. * _.multiply(6, 4);
  16843. * // => 24
  16844. */
  16845. var multiply = createMathOperation(function(multiplier, multiplicand) {
  16846. return multiplier * multiplicand;
  16847. }, 1);
  16848. /**
  16849. * Computes `number` rounded to `precision`.
  16850. *
  16851. * @static
  16852. * @memberOf _
  16853. * @since 3.10.0
  16854. * @category Math
  16855. * @param {number} number The number to round.
  16856. * @param {number} [precision=0] The precision to round to.
  16857. * @returns {number} Returns the rounded number.
  16858. * @example
  16859. *
  16860. * _.round(4.006);
  16861. * // => 4
  16862. *
  16863. * _.round(4.006, 2);
  16864. * // => 4.01
  16865. *
  16866. * _.round(4060, -2);
  16867. * // => 4100
  16868. */
  16869. var round = createRound('round');
  16870. /**
  16871. * Subtract two numbers.
  16872. *
  16873. * @static
  16874. * @memberOf _
  16875. * @since 4.0.0
  16876. * @category Math
  16877. * @param {number} minuend The first number in a subtraction.
  16878. * @param {number} subtrahend The second number in a subtraction.
  16879. * @returns {number} Returns the difference.
  16880. * @example
  16881. *
  16882. * _.subtract(6, 4);
  16883. * // => 2
  16884. */
  16885. var subtract = createMathOperation(function(minuend, subtrahend) {
  16886. return minuend - subtrahend;
  16887. }, 0);
  16888. /**
  16889. * Computes the sum of the values in `array`.
  16890. *
  16891. * @static
  16892. * @memberOf _
  16893. * @since 3.4.0
  16894. * @category Math
  16895. * @param {Array} array The array to iterate over.
  16896. * @returns {number} Returns the sum.
  16897. * @example
  16898. *
  16899. * _.sum([4, 2, 8, 6]);
  16900. * // => 20
  16901. */
  16902. function sum(array) {
  16903. return (array && array.length)
  16904. ? baseSum(array, identity)
  16905. : 0;
  16906. }
  16907. /**
  16908. * This method is like `_.sum` except that it accepts `iteratee` which is
  16909. * invoked for each element in `array` to generate the value to be summed.
  16910. * The iteratee is invoked with one argument: (value).
  16911. *
  16912. * @static
  16913. * @memberOf _
  16914. * @since 4.0.0
  16915. * @category Math
  16916. * @param {Array} array The array to iterate over.
  16917. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16918. * @returns {number} Returns the sum.
  16919. * @example
  16920. *
  16921. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  16922. *
  16923. * _.sumBy(objects, function(o) { return o.n; });
  16924. * // => 20
  16925. *
  16926. * // The `_.property` iteratee shorthand.
  16927. * _.sumBy(objects, 'n');
  16928. * // => 20
  16929. */
  16930. function sumBy(array, iteratee) {
  16931. return (array && array.length)
  16932. ? baseSum(array, getIteratee(iteratee, 2))
  16933. : 0;
  16934. }
  16935. /*------------------------------------------------------------------------*/
  16936. // Add methods that return wrapped values in chain sequences.
  16937. lodash.after = after;
  16938. lodash.ary = ary;
  16939. lodash.assign = assign;
  16940. lodash.assignIn = assignIn;
  16941. lodash.assignInWith = assignInWith;
  16942. lodash.assignWith = assignWith;
  16943. lodash.at = at;
  16944. lodash.before = before;
  16945. lodash.bind = bind;
  16946. lodash.bindAll = bindAll;
  16947. lodash.bindKey = bindKey;
  16948. lodash.castArray = castArray;
  16949. lodash.chain = chain;
  16950. lodash.chunk = chunk;
  16951. lodash.compact = compact;
  16952. lodash.concat = concat;
  16953. lodash.cond = cond;
  16954. lodash.conforms = conforms;
  16955. lodash.constant = constant;
  16956. lodash.countBy = countBy;
  16957. lodash.create = create;
  16958. lodash.curry = curry;
  16959. lodash.curryRight = curryRight;
  16960. lodash.debounce = debounce;
  16961. lodash.defaults = defaults;
  16962. lodash.defaultsDeep = defaultsDeep;
  16963. lodash.defer = defer;
  16964. lodash.delay = delay;
  16965. lodash.difference = difference;
  16966. lodash.differenceBy = differenceBy;
  16967. lodash.differenceWith = differenceWith;
  16968. lodash.drop = drop;
  16969. lodash.dropRight = dropRight;
  16970. lodash.dropRightWhile = dropRightWhile;
  16971. lodash.dropWhile = dropWhile;
  16972. lodash.fill = fill;
  16973. lodash.filter = filter;
  16974. lodash.flatMap = flatMap;
  16975. lodash.flatMapDeep = flatMapDeep;
  16976. lodash.flatMapDepth = flatMapDepth;
  16977. lodash.flatten = flatten;
  16978. lodash.flattenDeep = flattenDeep;
  16979. lodash.flattenDepth = flattenDepth;
  16980. lodash.flip = flip;
  16981. lodash.flow = flow;
  16982. lodash.flowRight = flowRight;
  16983. lodash.fromPairs = fromPairs;
  16984. lodash.functions = functions;
  16985. lodash.functionsIn = functionsIn;
  16986. lodash.groupBy = groupBy;
  16987. lodash.initial = initial;
  16988. lodash.intersection = intersection;
  16989. lodash.intersectionBy = intersectionBy;
  16990. lodash.intersectionWith = intersectionWith;
  16991. lodash.invert = invert;
  16992. lodash.invertBy = invertBy;
  16993. lodash.invokeMap = invokeMap;
  16994. lodash.iteratee = iteratee;
  16995. lodash.keyBy = keyBy;
  16996. lodash.keys = keys;
  16997. lodash.keysIn = keysIn;
  16998. lodash.map = map;
  16999. lodash.mapKeys = mapKeys;
  17000. lodash.mapValues = mapValues;
  17001. lodash.matches = matches;
  17002. lodash.matchesProperty = matchesProperty;
  17003. lodash.memoize = memoize;
  17004. lodash.merge = merge;
  17005. lodash.mergeWith = mergeWith;
  17006. lodash.method = method;
  17007. lodash.methodOf = methodOf;
  17008. lodash.mixin = mixin;
  17009. lodash.negate = negate;
  17010. lodash.nthArg = nthArg;
  17011. lodash.omit = omit;
  17012. lodash.omitBy = omitBy;
  17013. lodash.once = once;
  17014. lodash.orderBy = orderBy;
  17015. lodash.over = over;
  17016. lodash.overArgs = overArgs;
  17017. lodash.overEvery = overEvery;
  17018. lodash.overSome = overSome;
  17019. lodash.partial = partial;
  17020. lodash.partialRight = partialRight;
  17021. lodash.partition = partition;
  17022. lodash.pick = pick;
  17023. lodash.pickBy = pickBy;
  17024. lodash.property = property;
  17025. lodash.propertyOf = propertyOf;
  17026. lodash.pull = pull;
  17027. lodash.pullAll = pullAll;
  17028. lodash.pullAllBy = pullAllBy;
  17029. lodash.pullAllWith = pullAllWith;
  17030. lodash.pullAt = pullAt;
  17031. lodash.range = range;
  17032. lodash.rangeRight = rangeRight;
  17033. lodash.rearg = rearg;
  17034. lodash.reject = reject;
  17035. lodash.remove = remove;
  17036. lodash.rest = rest;
  17037. lodash.reverse = reverse;
  17038. lodash.sampleSize = sampleSize;
  17039. lodash.set = set;
  17040. lodash.setWith = setWith;
  17041. lodash.shuffle = shuffle;
  17042. lodash.slice = slice;
  17043. lodash.sortBy = sortBy;
  17044. lodash.sortedUniq = sortedUniq;
  17045. lodash.sortedUniqBy = sortedUniqBy;
  17046. lodash.split = split;
  17047. lodash.spread = spread;
  17048. lodash.tail = tail;
  17049. lodash.take = take;
  17050. lodash.takeRight = takeRight;
  17051. lodash.takeRightWhile = takeRightWhile;
  17052. lodash.takeWhile = takeWhile;
  17053. lodash.tap = tap;
  17054. lodash.throttle = throttle;
  17055. lodash.thru = thru;
  17056. lodash.toArray = toArray;
  17057. lodash.toPairs = toPairs;
  17058. lodash.toPairsIn = toPairsIn;
  17059. lodash.toPath = toPath;
  17060. lodash.toPlainObject = toPlainObject;
  17061. lodash.transform = transform;
  17062. lodash.unary = unary;
  17063. lodash.union = union;
  17064. lodash.unionBy = unionBy;
  17065. lodash.unionWith = unionWith;
  17066. lodash.uniq = uniq;
  17067. lodash.uniqBy = uniqBy;
  17068. lodash.uniqWith = uniqWith;
  17069. lodash.unset = unset;
  17070. lodash.unzip = unzip;
  17071. lodash.unzipWith = unzipWith;
  17072. lodash.update = update;
  17073. lodash.updateWith = updateWith;
  17074. lodash.values = values;
  17075. lodash.valuesIn = valuesIn;
  17076. lodash.without = without;
  17077. lodash.words = words;
  17078. lodash.wrap = wrap;
  17079. lodash.xor = xor;
  17080. lodash.xorBy = xorBy;
  17081. lodash.xorWith = xorWith;
  17082. lodash.zip = zip;
  17083. lodash.zipObject = zipObject;
  17084. lodash.zipObjectDeep = zipObjectDeep;
  17085. lodash.zipWith = zipWith;
  17086. // Add aliases.
  17087. lodash.entries = toPairs;
  17088. lodash.entriesIn = toPairsIn;
  17089. lodash.extend = assignIn;
  17090. lodash.extendWith = assignInWith;
  17091. // Add methods to `lodash.prototype`.
  17092. mixin(lodash, lodash);
  17093. /*------------------------------------------------------------------------*/
  17094. // Add methods that return unwrapped values in chain sequences.
  17095. lodash.add = add;
  17096. lodash.attempt = attempt;
  17097. lodash.camelCase = camelCase;
  17098. lodash.capitalize = capitalize;
  17099. lodash.ceil = ceil;
  17100. lodash.clamp = clamp;
  17101. lodash.clone = clone;
  17102. lodash.cloneDeep = cloneDeep;
  17103. lodash.cloneDeepWith = cloneDeepWith;
  17104. lodash.cloneWith = cloneWith;
  17105. lodash.conformsTo = conformsTo;
  17106. lodash.deburr = deburr;
  17107. lodash.defaultTo = defaultTo;
  17108. lodash.divide = divide;
  17109. lodash.endsWith = endsWith;
  17110. lodash.eq = eq;
  17111. lodash.escape = escape;
  17112. lodash.escapeRegExp = escapeRegExp;
  17113. lodash.every = every;
  17114. lodash.find = find;
  17115. lodash.findIndex = findIndex;
  17116. lodash.findKey = findKey;
  17117. lodash.findLast = findLast;
  17118. lodash.findLastIndex = findLastIndex;
  17119. lodash.findLastKey = findLastKey;
  17120. lodash.floor = floor;
  17121. lodash.forEach = forEach;
  17122. lodash.forEachRight = forEachRight;
  17123. lodash.forIn = forIn;
  17124. lodash.forInRight = forInRight;
  17125. lodash.forOwn = forOwn;
  17126. lodash.forOwnRight = forOwnRight;
  17127. lodash.get = get;
  17128. lodash.gt = gt;
  17129. lodash.gte = gte;
  17130. lodash.has = has;
  17131. lodash.hasIn = hasIn;
  17132. lodash.head = head;
  17133. lodash.identity = identity;
  17134. lodash.includes = includes;
  17135. lodash.indexOf = indexOf;
  17136. lodash.inRange = inRange;
  17137. lodash.invoke = invoke;
  17138. lodash.isArguments = isArguments;
  17139. lodash.isArray = isArray;
  17140. lodash.isArrayBuffer = isArrayBuffer;
  17141. lodash.isArrayLike = isArrayLike;
  17142. lodash.isArrayLikeObject = isArrayLikeObject;
  17143. lodash.isBoolean = isBoolean;
  17144. lodash.isBuffer = isBuffer;
  17145. lodash.isDate = isDate;
  17146. lodash.isElement = isElement;
  17147. lodash.isEmpty = isEmpty;
  17148. lodash.isEqual = isEqual;
  17149. lodash.isEqualWith = isEqualWith;
  17150. lodash.isError = isError;
  17151. lodash.isFinite = isFinite;
  17152. lodash.isFunction = isFunction;
  17153. lodash.isInteger = isInteger;
  17154. lodash.isLength = isLength;
  17155. lodash.isMap = isMap;
  17156. lodash.isMatch = isMatch;
  17157. lodash.isMatchWith = isMatchWith;
  17158. lodash.isNaN = isNaN;
  17159. lodash.isNative = isNative;
  17160. lodash.isNil = isNil;
  17161. lodash.isNull = isNull;
  17162. lodash.isNumber = isNumber;
  17163. lodash.isObject = isObject;
  17164. lodash.isObjectLike = isObjectLike;
  17165. lodash.isPlainObject = isPlainObject;
  17166. lodash.isRegExp = isRegExp;
  17167. lodash.isSafeInteger = isSafeInteger;
  17168. lodash.isSet = isSet;
  17169. lodash.isString = isString;
  17170. lodash.isSymbol = isSymbol;
  17171. lodash.isTypedArray = isTypedArray;
  17172. lodash.isUndefined = isUndefined;
  17173. lodash.isWeakMap = isWeakMap;
  17174. lodash.isWeakSet = isWeakSet;
  17175. lodash.join = join;
  17176. lodash.kebabCase = kebabCase;
  17177. lodash.last = last;
  17178. lodash.lastIndexOf = lastIndexOf;
  17179. lodash.lowerCase = lowerCase;
  17180. lodash.lowerFirst = lowerFirst;
  17181. lodash.lt = lt;
  17182. lodash.lte = lte;
  17183. lodash.max = max;
  17184. lodash.maxBy = maxBy;
  17185. lodash.mean = mean;
  17186. lodash.meanBy = meanBy;
  17187. lodash.min = min;
  17188. lodash.minBy = minBy;
  17189. lodash.stubArray = stubArray;
  17190. lodash.stubFalse = stubFalse;
  17191. lodash.stubObject = stubObject;
  17192. lodash.stubString = stubString;
  17193. lodash.stubTrue = stubTrue;
  17194. lodash.multiply = multiply;
  17195. lodash.nth = nth;
  17196. lodash.noConflict = noConflict;
  17197. lodash.noop = noop;
  17198. lodash.now = now;
  17199. lodash.pad = pad;
  17200. lodash.padEnd = padEnd;
  17201. lodash.padStart = padStart;
  17202. lodash.parseInt = parseInt;
  17203. lodash.random = random;
  17204. lodash.reduce = reduce;
  17205. lodash.reduceRight = reduceRight;
  17206. lodash.repeat = repeat;
  17207. lodash.replace = replace;
  17208. lodash.result = result;
  17209. lodash.round = round;
  17210. lodash.runInContext = runInContext;
  17211. lodash.sample = sample;
  17212. lodash.size = size;
  17213. lodash.snakeCase = snakeCase;
  17214. lodash.some = some;
  17215. lodash.sortedIndex = sortedIndex;
  17216. lodash.sortedIndexBy = sortedIndexBy;
  17217. lodash.sortedIndexOf = sortedIndexOf;
  17218. lodash.sortedLastIndex = sortedLastIndex;
  17219. lodash.sortedLastIndexBy = sortedLastIndexBy;
  17220. lodash.sortedLastIndexOf = sortedLastIndexOf;
  17221. lodash.startCase = startCase;
  17222. lodash.startsWith = startsWith;
  17223. lodash.subtract = subtract;
  17224. lodash.sum = sum;
  17225. lodash.sumBy = sumBy;
  17226. lodash.template = template;
  17227. lodash.times = times;
  17228. lodash.toFinite = toFinite;
  17229. lodash.toInteger = toInteger;
  17230. lodash.toLength = toLength;
  17231. lodash.toLower = toLower;
  17232. lodash.toNumber = toNumber;
  17233. lodash.toSafeInteger = toSafeInteger;
  17234. lodash.toString = toString;
  17235. lodash.toUpper = toUpper;
  17236. lodash.trim = trim;
  17237. lodash.trimEnd = trimEnd;
  17238. lodash.trimStart = trimStart;
  17239. lodash.truncate = truncate;
  17240. lodash.unescape = unescape;
  17241. lodash.uniqueId = uniqueId;
  17242. lodash.upperCase = upperCase;
  17243. lodash.upperFirst = upperFirst;
  17244. // Add aliases.
  17245. lodash.each = forEach;
  17246. lodash.eachRight = forEachRight;
  17247. lodash.first = head;
  17248. mixin(lodash, (function() {
  17249. var source = {};
  17250. baseForOwn(lodash, function(func, methodName) {
  17251. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  17252. source[methodName] = func;
  17253. }
  17254. });
  17255. return source;
  17256. }()), { 'chain': false });
  17257. /*------------------------------------------------------------------------*/
  17258. /**
  17259. * The semantic version number.
  17260. *
  17261. * @static
  17262. * @memberOf _
  17263. * @type {string}
  17264. */
  17265. lodash.VERSION = VERSION;
  17266. // Assign default placeholders.
  17267. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  17268. lodash[methodName].placeholder = lodash;
  17269. });
  17270. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  17271. arrayEach(['drop', 'take'], function(methodName, index) {
  17272. LazyWrapper.prototype[methodName] = function(n) {
  17273. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  17274. var result = (this.__filtered__ && !index)
  17275. ? new LazyWrapper(this)
  17276. : this.clone();
  17277. if (result.__filtered__) {
  17278. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  17279. } else {
  17280. result.__views__.push({
  17281. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  17282. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  17283. });
  17284. }
  17285. return result;
  17286. };
  17287. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  17288. return this.reverse()[methodName](n).reverse();
  17289. };
  17290. });
  17291. // Add `LazyWrapper` methods that accept an `iteratee` value.
  17292. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  17293. var type = index + 1,
  17294. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  17295. LazyWrapper.prototype[methodName] = function(iteratee) {
  17296. var result = this.clone();
  17297. result.__iteratees__.push({
  17298. 'iteratee': getIteratee(iteratee, 3),
  17299. 'type': type
  17300. });
  17301. result.__filtered__ = result.__filtered__ || isFilter;
  17302. return result;
  17303. };
  17304. });
  17305. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  17306. arrayEach(['head', 'last'], function(methodName, index) {
  17307. var takeName = 'take' + (index ? 'Right' : '');
  17308. LazyWrapper.prototype[methodName] = function() {
  17309. return this[takeName](1).value()[0];
  17310. };
  17311. });
  17312. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  17313. arrayEach(['initial', 'tail'], function(methodName, index) {
  17314. var dropName = 'drop' + (index ? '' : 'Right');
  17315. LazyWrapper.prototype[methodName] = function() {
  17316. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  17317. };
  17318. });
  17319. LazyWrapper.prototype.compact = function() {
  17320. return this.filter(identity);
  17321. };
  17322. LazyWrapper.prototype.find = function(predicate) {
  17323. return this.filter(predicate).head();
  17324. };
  17325. LazyWrapper.prototype.findLast = function(predicate) {
  17326. return this.reverse().find(predicate);
  17327. };
  17328. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  17329. if (typeof path == 'function') {
  17330. return new LazyWrapper(this);
  17331. }
  17332. return this.map(function(value) {
  17333. return baseInvoke(value, path, args);
  17334. });
  17335. });
  17336. LazyWrapper.prototype.reject = function(predicate) {
  17337. return this.filter(negate(getIteratee(predicate)));
  17338. };
  17339. LazyWrapper.prototype.slice = function(start, end) {
  17340. start = toInteger(start);
  17341. var result = this;
  17342. if (result.__filtered__ && (start > 0 || end < 0)) {
  17343. return new LazyWrapper(result);
  17344. }
  17345. if (start < 0) {
  17346. result = result.takeRight(-start);
  17347. } else if (start) {
  17348. result = result.drop(start);
  17349. }
  17350. if (end !== undefined) {
  17351. end = toInteger(end);
  17352. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  17353. }
  17354. return result;
  17355. };
  17356. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  17357. return this.reverse().takeWhile(predicate).reverse();
  17358. };
  17359. LazyWrapper.prototype.toArray = function() {
  17360. return this.take(MAX_ARRAY_LENGTH);
  17361. };
  17362. // Add `LazyWrapper` methods to `lodash.prototype`.
  17363. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  17364. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  17365. isTaker = /^(?:head|last)$/.test(methodName),
  17366. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  17367. retUnwrapped = isTaker || /^find/.test(methodName);
  17368. if (!lodashFunc) {
  17369. return;
  17370. }
  17371. lodash.prototype[methodName] = function() {
  17372. var value = this.__wrapped__,
  17373. args = isTaker ? [1] : arguments,
  17374. isLazy = value instanceof LazyWrapper,
  17375. iteratee = args[0],
  17376. useLazy = isLazy || isArray(value);
  17377. var interceptor = function(value) {
  17378. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  17379. return (isTaker && chainAll) ? result[0] : result;
  17380. };
  17381. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  17382. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  17383. isLazy = useLazy = false;
  17384. }
  17385. var chainAll = this.__chain__,
  17386. isHybrid = !!this.__actions__.length,
  17387. isUnwrapped = retUnwrapped && !chainAll,
  17388. onlyLazy = isLazy && !isHybrid;
  17389. if (!retUnwrapped && useLazy) {
  17390. value = onlyLazy ? value : new LazyWrapper(this);
  17391. var result = func.apply(value, args);
  17392. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  17393. return new LodashWrapper(result, chainAll);
  17394. }
  17395. if (isUnwrapped && onlyLazy) {
  17396. return func.apply(this, args);
  17397. }
  17398. result = this.thru(interceptor);
  17399. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  17400. };
  17401. });
  17402. // Add `Array` methods to `lodash.prototype`.
  17403. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  17404. var func = arrayProto[methodName],
  17405. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  17406. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  17407. lodash.prototype[methodName] = function() {
  17408. var args = arguments;
  17409. if (retUnwrapped && !this.__chain__) {
  17410. var value = this.value();
  17411. return func.apply(isArray(value) ? value : [], args);
  17412. }
  17413. return this[chainName](function(value) {
  17414. return func.apply(isArray(value) ? value : [], args);
  17415. });
  17416. };
  17417. });
  17418. // Map minified method names to their real names.
  17419. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  17420. var lodashFunc = lodash[methodName];
  17421. if (lodashFunc) {
  17422. var key = lodashFunc.name + '';
  17423. if (!hasOwnProperty.call(realNames, key)) {
  17424. realNames[key] = [];
  17425. }
  17426. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  17427. }
  17428. });
  17429. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  17430. 'name': 'wrapper',
  17431. 'func': undefined
  17432. }];
  17433. // Add methods to `LazyWrapper`.
  17434. LazyWrapper.prototype.clone = lazyClone;
  17435. LazyWrapper.prototype.reverse = lazyReverse;
  17436. LazyWrapper.prototype.value = lazyValue;
  17437. // Add chain sequence methods to the `lodash` wrapper.
  17438. lodash.prototype.at = wrapperAt;
  17439. lodash.prototype.chain = wrapperChain;
  17440. lodash.prototype.commit = wrapperCommit;
  17441. lodash.prototype.next = wrapperNext;
  17442. lodash.prototype.plant = wrapperPlant;
  17443. lodash.prototype.reverse = wrapperReverse;
  17444. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  17445. // Add lazy aliases.
  17446. lodash.prototype.first = lodash.prototype.head;
  17447. if (symIterator) {
  17448. lodash.prototype[symIterator] = wrapperToIterator;
  17449. }
  17450. return lodash;
  17451. });
  17452. /*--------------------------------------------------------------------------*/
  17453. // Export lodash.
  17454. var _ = runInContext();
  17455. // Some AMD build optimizers, like r.js, check for condition patterns like:
  17456. if (true) {
  17457. // Expose Lodash on the global object to prevent errors when Lodash is
  17458. // loaded by a script tag in the presence of an AMD loader.
  17459. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  17460. // Use `_.noConflict` to remove Lodash from the global object.
  17461. root._ = _;
  17462. // Define as an anonymous module so, through path mapping, it can be
  17463. // referenced as the "underscore" module.
  17464. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  17465. return _;
  17466. }).call(exports, __webpack_require__, exports, module),
  17467. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17468. }
  17469. // Check for `exports` after `define` in case a build optimizer adds it.
  17470. else {}
  17471. }.call(this));
  17472. /***/ }),
  17473. /***/ "./node_modules/vue-loader/dist/exportHelper.js":
  17474. /*!******************************************************!*\
  17475. !*** ./node_modules/vue-loader/dist/exportHelper.js ***!
  17476. \******************************************************/
  17477. /***/ ((__unused_webpack_module, exports) => {
  17478. "use strict";
  17479. Object.defineProperty(exports, "__esModule", ({ value: true }));
  17480. // runtime helper for setting properties on components
  17481. // in a tree-shakable way
  17482. exports["default"] = (sfc, props) => {
  17483. const target = sfc.__vccOpts || sfc;
  17484. for (const [key, val] of props) {
  17485. target[key] = val;
  17486. }
  17487. return target;
  17488. };
  17489. /***/ }),
  17490. /***/ "./resources/js/components/AppButton.vue":
  17491. /*!***********************************************!*\
  17492. !*** ./resources/js/components/AppButton.vue ***!
  17493. \***********************************************/
  17494. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17495. "use strict";
  17496. __webpack_require__.r(__webpack_exports__);
  17497. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17498. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17499. /* harmony export */ });
  17500. /* harmony import */ var _AppButton_vue_vue_type_template_id_c9506d50__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AppButton.vue?vue&type=template&id=c9506d50 */ "./resources/js/components/AppButton.vue?vue&type=template&id=c9506d50");
  17501. /* harmony import */ var _AppButton_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AppButton.vue?vue&type=script&setup=true&lang=js */ "./resources/js/components/AppButton.vue?vue&type=script&setup=true&lang=js");
  17502. /* harmony import */ var _home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js");
  17503. ;
  17504. const __exports__ = /*#__PURE__*/(0,_home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_AppButton_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_AppButton_vue_vue_type_template_id_c9506d50__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/AppButton.vue"]])
  17505. /* hot reload */
  17506. if (false) {}
  17507. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17508. /***/ }),
  17509. /***/ "./resources/js/components/AppFooter.vue":
  17510. /*!***********************************************!*\
  17511. !*** ./resources/js/components/AppFooter.vue ***!
  17512. \***********************************************/
  17513. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17514. "use strict";
  17515. __webpack_require__.r(__webpack_exports__);
  17516. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17517. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17518. /* harmony export */ });
  17519. /* harmony import */ var _AppFooter_vue_vue_type_template_id_4ab6097e__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AppFooter.vue?vue&type=template&id=4ab6097e */ "./resources/js/components/AppFooter.vue?vue&type=template&id=4ab6097e");
  17520. /* harmony import */ var _home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js");
  17521. const script = {}
  17522. ;
  17523. const __exports__ = /*#__PURE__*/(0,_home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_1__["default"])(script, [['render',_AppFooter_vue_vue_type_template_id_4ab6097e__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/AppFooter.vue"]])
  17524. /* hot reload */
  17525. if (false) {}
  17526. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17527. /***/ }),
  17528. /***/ "./resources/js/components/AppMessage.vue":
  17529. /*!************************************************!*\
  17530. !*** ./resources/js/components/AppMessage.vue ***!
  17531. \************************************************/
  17532. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17533. "use strict";
  17534. __webpack_require__.r(__webpack_exports__);
  17535. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17536. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17537. /* harmony export */ });
  17538. /* harmony import */ var _AppMessage_vue_vue_type_template_id_07159051__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AppMessage.vue?vue&type=template&id=07159051 */ "./resources/js/components/AppMessage.vue?vue&type=template&id=07159051");
  17539. /* harmony import */ var _AppMessage_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AppMessage.vue?vue&type=script&setup=true&lang=js */ "./resources/js/components/AppMessage.vue?vue&type=script&setup=true&lang=js");
  17540. /* harmony import */ var _home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js");
  17541. ;
  17542. const __exports__ = /*#__PURE__*/(0,_home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_AppMessage_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_AppMessage_vue_vue_type_template_id_07159051__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/AppMessage.vue"]])
  17543. /* hot reload */
  17544. if (false) {}
  17545. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17546. /***/ }),
  17547. /***/ "./resources/js/components/AppPagination.vue":
  17548. /*!***************************************************!*\
  17549. !*** ./resources/js/components/AppPagination.vue ***!
  17550. \***************************************************/
  17551. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17552. "use strict";
  17553. __webpack_require__.r(__webpack_exports__);
  17554. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17555. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17556. /* harmony export */ });
  17557. /* harmony import */ var _AppPagination_vue_vue_type_template_id_4da56ec0__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AppPagination.vue?vue&type=template&id=4da56ec0 */ "./resources/js/components/AppPagination.vue?vue&type=template&id=4da56ec0");
  17558. /* harmony import */ var _AppPagination_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AppPagination.vue?vue&type=script&setup=true&lang=js */ "./resources/js/components/AppPagination.vue?vue&type=script&setup=true&lang=js");
  17559. /* harmony import */ var _home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js");
  17560. ;
  17561. const __exports__ = /*#__PURE__*/(0,_home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_AppPagination_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_AppPagination_vue_vue_type_template_id_4da56ec0__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/AppPagination.vue"]])
  17562. /* hot reload */
  17563. if (false) {}
  17564. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17565. /***/ }),
  17566. /***/ "./resources/js/components/AppSidebar.vue":
  17567. /*!************************************************!*\
  17568. !*** ./resources/js/components/AppSidebar.vue ***!
  17569. \************************************************/
  17570. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17571. "use strict";
  17572. __webpack_require__.r(__webpack_exports__);
  17573. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17574. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17575. /* harmony export */ });
  17576. /* harmony import */ var _AppSidebar_vue_vue_type_template_id_22a4e926__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AppSidebar.vue?vue&type=template&id=22a4e926 */ "./resources/js/components/AppSidebar.vue?vue&type=template&id=22a4e926");
  17577. /* harmony import */ var _AppSidebar_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AppSidebar.vue?vue&type=script&setup=true&lang=js */ "./resources/js/components/AppSidebar.vue?vue&type=script&setup=true&lang=js");
  17578. /* harmony import */ var _home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js");
  17579. ;
  17580. const __exports__ = /*#__PURE__*/(0,_home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_AppSidebar_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_AppSidebar_vue_vue_type_template_id_22a4e926__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/AppSidebar.vue"]])
  17581. /* hot reload */
  17582. if (false) {}
  17583. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17584. /***/ }),
  17585. /***/ "./resources/js/components/AppSubSidebar.vue":
  17586. /*!***************************************************!*\
  17587. !*** ./resources/js/components/AppSubSidebar.vue ***!
  17588. \***************************************************/
  17589. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17590. "use strict";
  17591. __webpack_require__.r(__webpack_exports__);
  17592. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17593. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17594. /* harmony export */ });
  17595. /* harmony import */ var _AppSubSidebar_vue_vue_type_template_id_0addd9bc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AppSubSidebar.vue?vue&type=template&id=0addd9bc */ "./resources/js/components/AppSubSidebar.vue?vue&type=template&id=0addd9bc");
  17596. /* harmony import */ var _AppSubSidebar_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AppSubSidebar.vue?vue&type=script&setup=true&lang=js */ "./resources/js/components/AppSubSidebar.vue?vue&type=script&setup=true&lang=js");
  17597. /* harmony import */ var _home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js");
  17598. ;
  17599. const __exports__ = /*#__PURE__*/(0,_home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_AppSubSidebar_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_AppSubSidebar_vue_vue_type_template_id_0addd9bc__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/AppSubSidebar.vue"]])
  17600. /* hot reload */
  17601. if (false) {}
  17602. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17603. /***/ }),
  17604. /***/ "./resources/js/components/AppTopBar.vue":
  17605. /*!***********************************************!*\
  17606. !*** ./resources/js/components/AppTopBar.vue ***!
  17607. \***********************************************/
  17608. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17609. "use strict";
  17610. __webpack_require__.r(__webpack_exports__);
  17611. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17612. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17613. /* harmony export */ });
  17614. /* harmony import */ var _AppTopBar_vue_vue_type_template_id_42bf62a4__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AppTopBar.vue?vue&type=template&id=42bf62a4 */ "./resources/js/components/AppTopBar.vue?vue&type=template&id=42bf62a4");
  17615. /* harmony import */ var _AppTopBar_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AppTopBar.vue?vue&type=script&setup=true&lang=js */ "./resources/js/components/AppTopBar.vue?vue&type=script&setup=true&lang=js");
  17616. /* harmony import */ var _home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js");
  17617. ;
  17618. const __exports__ = /*#__PURE__*/(0,_home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_AppTopBar_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_AppTopBar_vue_vue_type_template_id_42bf62a4__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/AppTopBar.vue"]])
  17619. /* hot reload */
  17620. if (false) {}
  17621. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17622. /***/ }),
  17623. /***/ "./resources/js/layouts/AppLayout.vue":
  17624. /*!********************************************!*\
  17625. !*** ./resources/js/layouts/AppLayout.vue ***!
  17626. \********************************************/
  17627. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17628. "use strict";
  17629. __webpack_require__.r(__webpack_exports__);
  17630. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17631. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17632. /* harmony export */ });
  17633. /* harmony import */ var _AppLayout_vue_vue_type_template_id_2cfb4112__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AppLayout.vue?vue&type=template&id=2cfb4112 */ "./resources/js/layouts/AppLayout.vue?vue&type=template&id=2cfb4112");
  17634. /* harmony import */ var _AppLayout_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AppLayout.vue?vue&type=script&setup=true&lang=js */ "./resources/js/layouts/AppLayout.vue?vue&type=script&setup=true&lang=js");
  17635. /* harmony import */ var _home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js");
  17636. ;
  17637. const __exports__ = /*#__PURE__*/(0,_home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_AppLayout_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_AppLayout_vue_vue_type_template_id_2cfb4112__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/layouts/AppLayout.vue"]])
  17638. /* hot reload */
  17639. if (false) {}
  17640. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17641. /***/ }),
  17642. /***/ "./resources/js/pages/mutation/Report.vue":
  17643. /*!************************************************!*\
  17644. !*** ./resources/js/pages/mutation/Report.vue ***!
  17645. \************************************************/
  17646. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17647. "use strict";
  17648. __webpack_require__.r(__webpack_exports__);
  17649. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17650. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17651. /* harmony export */ });
  17652. /* harmony import */ var _Report_vue_vue_type_template_id_289c9421__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Report.vue?vue&type=template&id=289c9421 */ "./resources/js/pages/mutation/Report.vue?vue&type=template&id=289c9421");
  17653. /* harmony import */ var _Report_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Report.vue?vue&type=script&setup=true&lang=js */ "./resources/js/pages/mutation/Report.vue?vue&type=script&setup=true&lang=js");
  17654. /* harmony import */ var _home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js");
  17655. ;
  17656. const __exports__ = /*#__PURE__*/(0,_home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_Report_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_Report_vue_vue_type_template_id_289c9421__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/pages/mutation/Report.vue"]])
  17657. /* hot reload */
  17658. if (false) {}
  17659. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17660. /***/ }),
  17661. /***/ "./resources/js/components/AppButton.vue?vue&type=script&setup=true&lang=js":
  17662. /*!**********************************************************************************!*\
  17663. !*** ./resources/js/components/AppButton.vue?vue&type=script&setup=true&lang=js ***!
  17664. \**********************************************************************************/
  17665. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17666. "use strict";
  17667. __webpack_require__.r(__webpack_exports__);
  17668. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17669. /* harmony export */ "default": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppButton_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__["default"])
  17670. /* harmony export */ });
  17671. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppButton_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./AppButton.vue?vue&type=script&setup=true&lang=js */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppButton.vue?vue&type=script&setup=true&lang=js");
  17672. /***/ }),
  17673. /***/ "./resources/js/components/AppMessage.vue?vue&type=script&setup=true&lang=js":
  17674. /*!***********************************************************************************!*\
  17675. !*** ./resources/js/components/AppMessage.vue?vue&type=script&setup=true&lang=js ***!
  17676. \***********************************************************************************/
  17677. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17678. "use strict";
  17679. __webpack_require__.r(__webpack_exports__);
  17680. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17681. /* harmony export */ "default": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppMessage_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__["default"])
  17682. /* harmony export */ });
  17683. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppMessage_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./AppMessage.vue?vue&type=script&setup=true&lang=js */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppMessage.vue?vue&type=script&setup=true&lang=js");
  17684. /***/ }),
  17685. /***/ "./resources/js/components/AppPagination.vue?vue&type=script&setup=true&lang=js":
  17686. /*!**************************************************************************************!*\
  17687. !*** ./resources/js/components/AppPagination.vue?vue&type=script&setup=true&lang=js ***!
  17688. \**************************************************************************************/
  17689. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17690. "use strict";
  17691. __webpack_require__.r(__webpack_exports__);
  17692. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17693. /* harmony export */ "default": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppPagination_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__["default"])
  17694. /* harmony export */ });
  17695. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppPagination_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./AppPagination.vue?vue&type=script&setup=true&lang=js */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppPagination.vue?vue&type=script&setup=true&lang=js");
  17696. /***/ }),
  17697. /***/ "./resources/js/components/AppSidebar.vue?vue&type=script&setup=true&lang=js":
  17698. /*!***********************************************************************************!*\
  17699. !*** ./resources/js/components/AppSidebar.vue?vue&type=script&setup=true&lang=js ***!
  17700. \***********************************************************************************/
  17701. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17702. "use strict";
  17703. __webpack_require__.r(__webpack_exports__);
  17704. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17705. /* harmony export */ "default": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppSidebar_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__["default"])
  17706. /* harmony export */ });
  17707. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppSidebar_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./AppSidebar.vue?vue&type=script&setup=true&lang=js */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppSidebar.vue?vue&type=script&setup=true&lang=js");
  17708. /***/ }),
  17709. /***/ "./resources/js/components/AppSubSidebar.vue?vue&type=script&setup=true&lang=js":
  17710. /*!**************************************************************************************!*\
  17711. !*** ./resources/js/components/AppSubSidebar.vue?vue&type=script&setup=true&lang=js ***!
  17712. \**************************************************************************************/
  17713. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17714. "use strict";
  17715. __webpack_require__.r(__webpack_exports__);
  17716. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17717. /* harmony export */ "default": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppSubSidebar_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__["default"])
  17718. /* harmony export */ });
  17719. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppSubSidebar_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./AppSubSidebar.vue?vue&type=script&setup=true&lang=js */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppSubSidebar.vue?vue&type=script&setup=true&lang=js");
  17720. /***/ }),
  17721. /***/ "./resources/js/components/AppTopBar.vue?vue&type=script&setup=true&lang=js":
  17722. /*!**********************************************************************************!*\
  17723. !*** ./resources/js/components/AppTopBar.vue?vue&type=script&setup=true&lang=js ***!
  17724. \**********************************************************************************/
  17725. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17726. "use strict";
  17727. __webpack_require__.r(__webpack_exports__);
  17728. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17729. /* harmony export */ "default": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppTopBar_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__["default"])
  17730. /* harmony export */ });
  17731. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppTopBar_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./AppTopBar.vue?vue&type=script&setup=true&lang=js */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppTopBar.vue?vue&type=script&setup=true&lang=js");
  17732. /***/ }),
  17733. /***/ "./resources/js/layouts/AppLayout.vue?vue&type=script&setup=true&lang=js":
  17734. /*!*******************************************************************************!*\
  17735. !*** ./resources/js/layouts/AppLayout.vue?vue&type=script&setup=true&lang=js ***!
  17736. \*******************************************************************************/
  17737. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17738. "use strict";
  17739. __webpack_require__.r(__webpack_exports__);
  17740. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17741. /* harmony export */ "default": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppLayout_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__["default"])
  17742. /* harmony export */ });
  17743. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppLayout_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./AppLayout.vue?vue&type=script&setup=true&lang=js */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/layouts/AppLayout.vue?vue&type=script&setup=true&lang=js");
  17744. /***/ }),
  17745. /***/ "./resources/js/pages/mutation/Report.vue?vue&type=script&setup=true&lang=js":
  17746. /*!***********************************************************************************!*\
  17747. !*** ./resources/js/pages/mutation/Report.vue?vue&type=script&setup=true&lang=js ***!
  17748. \***********************************************************************************/
  17749. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17750. "use strict";
  17751. __webpack_require__.r(__webpack_exports__);
  17752. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17753. /* harmony export */ "default": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_Report_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__["default"])
  17754. /* harmony export */ });
  17755. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_Report_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./Report.vue?vue&type=script&setup=true&lang=js */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/pages/mutation/Report.vue?vue&type=script&setup=true&lang=js");
  17756. /***/ }),
  17757. /***/ "./resources/js/components/AppButton.vue?vue&type=template&id=c9506d50":
  17758. /*!*****************************************************************************!*\
  17759. !*** ./resources/js/components/AppButton.vue?vue&type=template&id=c9506d50 ***!
  17760. \*****************************************************************************/
  17761. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17762. "use strict";
  17763. __webpack_require__.r(__webpack_exports__);
  17764. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17765. /* harmony export */ "render": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppButton_vue_vue_type_template_id_c9506d50__WEBPACK_IMPORTED_MODULE_0__.render)
  17766. /* harmony export */ });
  17767. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppButton_vue_vue_type_template_id_c9506d50__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./AppButton.vue?vue&type=template&id=c9506d50 */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppButton.vue?vue&type=template&id=c9506d50");
  17768. /***/ }),
  17769. /***/ "./resources/js/components/AppFooter.vue?vue&type=template&id=4ab6097e":
  17770. /*!*****************************************************************************!*\
  17771. !*** ./resources/js/components/AppFooter.vue?vue&type=template&id=4ab6097e ***!
  17772. \*****************************************************************************/
  17773. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17774. "use strict";
  17775. __webpack_require__.r(__webpack_exports__);
  17776. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17777. /* harmony export */ "render": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppFooter_vue_vue_type_template_id_4ab6097e__WEBPACK_IMPORTED_MODULE_0__.render)
  17778. /* harmony export */ });
  17779. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppFooter_vue_vue_type_template_id_4ab6097e__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./AppFooter.vue?vue&type=template&id=4ab6097e */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppFooter.vue?vue&type=template&id=4ab6097e");
  17780. /***/ }),
  17781. /***/ "./resources/js/components/AppMessage.vue?vue&type=template&id=07159051":
  17782. /*!******************************************************************************!*\
  17783. !*** ./resources/js/components/AppMessage.vue?vue&type=template&id=07159051 ***!
  17784. \******************************************************************************/
  17785. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17786. "use strict";
  17787. __webpack_require__.r(__webpack_exports__);
  17788. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17789. /* harmony export */ "render": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppMessage_vue_vue_type_template_id_07159051__WEBPACK_IMPORTED_MODULE_0__.render)
  17790. /* harmony export */ });
  17791. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppMessage_vue_vue_type_template_id_07159051__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./AppMessage.vue?vue&type=template&id=07159051 */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppMessage.vue?vue&type=template&id=07159051");
  17792. /***/ }),
  17793. /***/ "./resources/js/components/AppPagination.vue?vue&type=template&id=4da56ec0":
  17794. /*!*********************************************************************************!*\
  17795. !*** ./resources/js/components/AppPagination.vue?vue&type=template&id=4da56ec0 ***!
  17796. \*********************************************************************************/
  17797. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17798. "use strict";
  17799. __webpack_require__.r(__webpack_exports__);
  17800. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17801. /* harmony export */ "render": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppPagination_vue_vue_type_template_id_4da56ec0__WEBPACK_IMPORTED_MODULE_0__.render)
  17802. /* harmony export */ });
  17803. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppPagination_vue_vue_type_template_id_4da56ec0__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./AppPagination.vue?vue&type=template&id=4da56ec0 */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppPagination.vue?vue&type=template&id=4da56ec0");
  17804. /***/ }),
  17805. /***/ "./resources/js/components/AppSidebar.vue?vue&type=template&id=22a4e926":
  17806. /*!******************************************************************************!*\
  17807. !*** ./resources/js/components/AppSidebar.vue?vue&type=template&id=22a4e926 ***!
  17808. \******************************************************************************/
  17809. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17810. "use strict";
  17811. __webpack_require__.r(__webpack_exports__);
  17812. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17813. /* harmony export */ "render": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppSidebar_vue_vue_type_template_id_22a4e926__WEBPACK_IMPORTED_MODULE_0__.render)
  17814. /* harmony export */ });
  17815. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppSidebar_vue_vue_type_template_id_22a4e926__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./AppSidebar.vue?vue&type=template&id=22a4e926 */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppSidebar.vue?vue&type=template&id=22a4e926");
  17816. /***/ }),
  17817. /***/ "./resources/js/components/AppSubSidebar.vue?vue&type=template&id=0addd9bc":
  17818. /*!*********************************************************************************!*\
  17819. !*** ./resources/js/components/AppSubSidebar.vue?vue&type=template&id=0addd9bc ***!
  17820. \*********************************************************************************/
  17821. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17822. "use strict";
  17823. __webpack_require__.r(__webpack_exports__);
  17824. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17825. /* harmony export */ "render": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppSubSidebar_vue_vue_type_template_id_0addd9bc__WEBPACK_IMPORTED_MODULE_0__.render)
  17826. /* harmony export */ });
  17827. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppSubSidebar_vue_vue_type_template_id_0addd9bc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./AppSubSidebar.vue?vue&type=template&id=0addd9bc */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppSubSidebar.vue?vue&type=template&id=0addd9bc");
  17828. /***/ }),
  17829. /***/ "./resources/js/components/AppTopBar.vue?vue&type=template&id=42bf62a4":
  17830. /*!*****************************************************************************!*\
  17831. !*** ./resources/js/components/AppTopBar.vue?vue&type=template&id=42bf62a4 ***!
  17832. \*****************************************************************************/
  17833. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17834. "use strict";
  17835. __webpack_require__.r(__webpack_exports__);
  17836. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17837. /* harmony export */ "render": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppTopBar_vue_vue_type_template_id_42bf62a4__WEBPACK_IMPORTED_MODULE_0__.render)
  17838. /* harmony export */ });
  17839. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppTopBar_vue_vue_type_template_id_42bf62a4__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./AppTopBar.vue?vue&type=template&id=42bf62a4 */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/AppTopBar.vue?vue&type=template&id=42bf62a4");
  17840. /***/ }),
  17841. /***/ "./resources/js/layouts/AppLayout.vue?vue&type=template&id=2cfb4112":
  17842. /*!**************************************************************************!*\
  17843. !*** ./resources/js/layouts/AppLayout.vue?vue&type=template&id=2cfb4112 ***!
  17844. \**************************************************************************/
  17845. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17846. "use strict";
  17847. __webpack_require__.r(__webpack_exports__);
  17848. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17849. /* harmony export */ "render": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppLayout_vue_vue_type_template_id_2cfb4112__WEBPACK_IMPORTED_MODULE_0__.render)
  17850. /* harmony export */ });
  17851. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_AppLayout_vue_vue_type_template_id_2cfb4112__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./AppLayout.vue?vue&type=template&id=2cfb4112 */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/layouts/AppLayout.vue?vue&type=template&id=2cfb4112");
  17852. /***/ }),
  17853. /***/ "./resources/js/pages/mutation/Report.vue?vue&type=template&id=289c9421":
  17854. /*!******************************************************************************!*\
  17855. !*** ./resources/js/pages/mutation/Report.vue?vue&type=template&id=289c9421 ***!
  17856. \******************************************************************************/
  17857. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17858. "use strict";
  17859. __webpack_require__.r(__webpack_exports__);
  17860. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17861. /* harmony export */ "render": () => (/* reexport safe */ _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_Report_vue_vue_type_template_id_289c9421__WEBPACK_IMPORTED_MODULE_0__.render)
  17862. /* harmony export */ });
  17863. /* harmony import */ var _node_modules_babel_loader_lib_index_js_clonedRuleSet_5_use_0_node_modules_vue_loader_dist_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_dist_index_js_ruleSet_0_use_0_Report_vue_vue_type_template_id_289c9421__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../../node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!../../../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./Report.vue?vue&type=template&id=289c9421 */ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/pages/mutation/Report.vue?vue&type=template&id=289c9421");
  17864. /***/ })
  17865. }]);