resources_js_pages_member_Edit_vue.js 659KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617
  1. (self["webpackChunk"] = self["webpackChunk"] || []).push([["resources_js_pages_member_Edit_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/AppDropdown.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/AppDropdown.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 vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  13. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  14. props: {
  15. label: {
  16. type: String,
  17. required: true
  18. },
  19. optionLabel: {
  20. type: String,
  21. "default": 'label'
  22. },
  23. optionValue: {
  24. type: String,
  25. "default": 'value'
  26. },
  27. optionDisabled: {
  28. type: String,
  29. "default": 'disabled'
  30. },
  31. options: {
  32. type: Array,
  33. required: true
  34. },
  35. placeholder: {
  36. type: String,
  37. required: true
  38. },
  39. disabled: {
  40. type: Boolean,
  41. "default": false
  42. },
  43. error: {
  44. type: String,
  45. "default": null
  46. },
  47. modelValue: null
  48. },
  49. emits: ['update:modelValue'],
  50. setup: function setup(__props, _ref) {
  51. var expose = _ref.expose;
  52. expose();
  53. var props = __props;
  54. var isError = (0,vue__WEBPACK_IMPORTED_MODULE_0__.computed)(function () {
  55. return props.error ? true : false;
  56. });
  57. var forLabel = (0,vue__WEBPACK_IMPORTED_MODULE_0__.computed)(function () {
  58. return props.label ? props.label.toLowerCase().replace(/\s+/g, '-') : null;
  59. });
  60. var ariaDescribedbyLabel = (0,vue__WEBPACK_IMPORTED_MODULE_0__.computed)(function () {
  61. return props.label ? props.label.toLowerCase().replace(/\s+/g, '-') + '-help' : null;
  62. });
  63. var selectedDropdownLabel = function selectedDropdownLabel(value) {
  64. var result = props.options.find(function (option) {
  65. return option[props.optionValue] == value;
  66. });
  67. if (result) {
  68. return result[props.optionLabel];
  69. }
  70. };
  71. var __returned__ = {
  72. props: props,
  73. isError: isError,
  74. forLabel: forLabel,
  75. ariaDescribedbyLabel: ariaDescribedbyLabel,
  76. selectedDropdownLabel: selectedDropdownLabel,
  77. computed: vue__WEBPACK_IMPORTED_MODULE_0__.computed
  78. };
  79. Object.defineProperty(__returned__, '__isScriptSetup', {
  80. enumerable: false,
  81. value: true
  82. });
  83. return __returned__;
  84. }
  85. });
  86. /***/ }),
  87. /***/ "./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/AppInputText.vue?vue&type=script&setup=true&lang=js":
  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/AppInputText.vue?vue&type=script&setup=true&lang=js ***!
  90. \*****************************************************************************************************************************************************************************************************************/
  91. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  92. "use strict";
  93. __webpack_require__.r(__webpack_exports__);
  94. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  95. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  96. /* harmony export */ });
  97. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  98. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  99. props: {
  100. type: {
  101. type: String,
  102. "default": 'text'
  103. },
  104. label: {
  105. type: String,
  106. required: true
  107. },
  108. disabled: {
  109. type: Boolean,
  110. "default": false
  111. },
  112. placeholder: {
  113. type: String,
  114. required: true
  115. },
  116. error: {
  117. type: String,
  118. "default": null
  119. },
  120. modelValue: null
  121. },
  122. emits: ['update:modelValue'],
  123. setup: function setup(__props, _ref) {
  124. var expose = _ref.expose;
  125. expose();
  126. var props = __props;
  127. var isError = (0,vue__WEBPACK_IMPORTED_MODULE_0__.computed)(function () {
  128. return props.error ? true : false;
  129. });
  130. var forLabel = (0,vue__WEBPACK_IMPORTED_MODULE_0__.computed)(function () {
  131. return props.label.toLowerCase().replace(/\s+/g, '-');
  132. });
  133. var ariaDescribedbyLabel = (0,vue__WEBPACK_IMPORTED_MODULE_0__.computed)(function () {
  134. return props.label.toLowerCase().replace(/\s+/g, '-') + '-help';
  135. });
  136. var __returned__ = {
  137. props: props,
  138. isError: isError,
  139. forLabel: forLabel,
  140. ariaDescribedbyLabel: ariaDescribedbyLabel,
  141. computed: vue__WEBPACK_IMPORTED_MODULE_0__.computed
  142. };
  143. Object.defineProperty(__returned__, '__isScriptSetup', {
  144. enumerable: false,
  145. value: true
  146. });
  147. return __returned__;
  148. }
  149. });
  150. /***/ }),
  151. /***/ "./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":
  152. /*!***************************************************************************************************************************************************************************************************************!*\
  153. !*** ./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 ***!
  154. \***************************************************************************************************************************************************************************************************************/
  155. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  156. "use strict";
  157. __webpack_require__.r(__webpack_exports__);
  158. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  159. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  160. /* harmony export */ });
  161. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  162. /* harmony import */ var _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @inertiajs/inertia-vue3 */ "./node_modules/@inertiajs/inertia-vue3/dist/index.js");
  163. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  164. setup: function setup(__props, _ref) {
  165. var expose = _ref.expose;
  166. expose();
  167. var flashMessage = (0,vue__WEBPACK_IMPORTED_MODULE_0__.computed)(function () {
  168. return (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__.usePage)().props.value.flash;
  169. });
  170. var messageDisplay = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)({});
  171. var onClose = function onClose() {
  172. (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__.usePage)().props.value.errors = {};
  173. (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__.usePage)().props.value.flash.success = null;
  174. (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__.usePage)().props.value.flash.error = null;
  175. messageDisplay.value = {
  176. display: 'none'
  177. };
  178. };
  179. (0,vue__WEBPACK_IMPORTED_MODULE_0__.watch)(flashMessage, function () {
  180. messageDisplay.value = {
  181. display: ''
  182. };
  183. }, {
  184. deep: true
  185. });
  186. var __returned__ = {
  187. flashMessage: flashMessage,
  188. messageDisplay: messageDisplay,
  189. onClose: onClose,
  190. ref: vue__WEBPACK_IMPORTED_MODULE_0__.ref,
  191. watch: vue__WEBPACK_IMPORTED_MODULE_0__.watch,
  192. computed: vue__WEBPACK_IMPORTED_MODULE_0__.computed,
  193. usePage: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__.usePage
  194. };
  195. Object.defineProperty(__returned__, '__isScriptSetup', {
  196. enumerable: false,
  197. value: true
  198. });
  199. return __returned__;
  200. }
  201. });
  202. /***/ }),
  203. /***/ "./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":
  204. /*!***************************************************************************************************************************************************************************************************************!*\
  205. !*** ./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 ***!
  206. \***************************************************************************************************************************************************************************************************************/
  207. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  208. "use strict";
  209. __webpack_require__.r(__webpack_exports__);
  210. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  211. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  212. /* harmony export */ });
  213. /* harmony import */ var _components_AppSubSidebar_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/components/AppSubSidebar.vue */ "./resources/js/components/AppSubSidebar.vue");
  214. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  215. props: {
  216. model: Array
  217. },
  218. emits: ['menuitem-click'],
  219. setup: function setup(__props, _ref) {
  220. var expose = _ref.expose,
  221. emits = _ref.emit;
  222. expose();
  223. var onKeyDown = function onKeyDown(event) {
  224. var nodeElement = event.target;
  225. if (event.code === 'Enter' || event.code === 'Space') {
  226. nodeElement.click();
  227. event.preventDefault();
  228. }
  229. };
  230. var onMenuItemClick = function onMenuItemClick(event) {
  231. emits('menuitem-click', event);
  232. };
  233. var __returned__ = {
  234. emits: emits,
  235. onKeyDown: onKeyDown,
  236. onMenuItemClick: onMenuItemClick,
  237. AppSubSidebar: _components_AppSubSidebar_vue__WEBPACK_IMPORTED_MODULE_0__["default"]
  238. };
  239. Object.defineProperty(__returned__, '__isScriptSetup', {
  240. enumerable: false,
  241. value: true
  242. });
  243. return __returned__;
  244. }
  245. });
  246. /***/ }),
  247. /***/ "./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":
  248. /*!******************************************************************************************************************************************************************************************************************!*\
  249. !*** ./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 ***!
  250. \******************************************************************************************************************************************************************************************************************/
  251. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  252. "use strict";
  253. __webpack_require__.r(__webpack_exports__);
  254. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  255. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  256. /* harmony export */ });
  257. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  258. /* harmony import */ var _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @inertiajs/inertia-vue3 */ "./node_modules/@inertiajs/inertia-vue3/dist/index.js");
  259. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  260. props: {
  261. items: Array,
  262. root: {
  263. type: Boolean,
  264. "default": false
  265. }
  266. },
  267. emits: ['menuitem-click'],
  268. setup: function setup(__props, _ref) {
  269. var expose = _ref.expose,
  270. emits = _ref.emit;
  271. expose();
  272. var activeIndex = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)(null);
  273. var onMenuItemClick = function onMenuItemClick(event, item, index) {
  274. if (item.disabled) {
  275. event.preventDefault();
  276. return;
  277. }
  278. if (!item.to && !item.url) {
  279. event.preventDefault();
  280. }
  281. if (item.command) {
  282. item.command({
  283. originalEvent: event,
  284. item: item
  285. });
  286. }
  287. activeIndex.value = index === activeIndex.value ? null : index;
  288. emits('menuitem-click', {
  289. originalEvent: event,
  290. item: item
  291. });
  292. };
  293. var visible = function visible(item) {
  294. return typeof item.visible === 'function' ? item.visible() : item.visible !== false;
  295. };
  296. var __returned__ = {
  297. emits: emits,
  298. activeIndex: activeIndex,
  299. onMenuItemClick: onMenuItemClick,
  300. visible: visible,
  301. ref: vue__WEBPACK_IMPORTED_MODULE_0__.ref,
  302. Link: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__.Link
  303. };
  304. Object.defineProperty(__returned__, '__isScriptSetup', {
  305. enumerable: false,
  306. value: true
  307. });
  308. return __returned__;
  309. }
  310. });
  311. /***/ }),
  312. /***/ "./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":
  313. /*!**************************************************************************************************************************************************************************************************************!*\
  314. !*** ./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 ***!
  315. \**************************************************************************************************************************************************************************************************************/
  316. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  317. "use strict";
  318. __webpack_require__.r(__webpack_exports__);
  319. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  320. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  321. /* harmony export */ });
  322. /* harmony import */ var _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @inertiajs/inertia-vue3 */ "./node_modules/@inertiajs/inertia-vue3/dist/index.js");
  323. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  324. emits: ['menu-toggle'],
  325. setup: function setup(__props, _ref) {
  326. var expose = _ref.expose;
  327. expose();
  328. var __returned__ = {
  329. Link: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_0__.Link
  330. };
  331. Object.defineProperty(__returned__, '__isScriptSetup', {
  332. enumerable: false,
  333. value: true
  334. });
  335. return __returned__;
  336. }
  337. });
  338. /***/ }),
  339. /***/ "./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":
  340. /*!***********************************************************************************************************************************************************************************************************!*\
  341. !*** ./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 ***!
  342. \***********************************************************************************************************************************************************************************************************/
  343. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  344. "use strict";
  345. __webpack_require__.r(__webpack_exports__);
  346. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  347. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  348. /* harmony export */ });
  349. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  350. /* harmony import */ var _components_AppTopBar_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/components/AppTopBar.vue */ "./resources/js/components/AppTopBar.vue");
  351. /* harmony import */ var _components_AppSidebar_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/components/AppSidebar.vue */ "./resources/js/components/AppSidebar.vue");
  352. /* harmony import */ var _components_AppFooter_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/components/AppFooter.vue */ "./resources/js/components/AppFooter.vue");
  353. /* harmony import */ var _components_AppMessage_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/components/AppMessage.vue */ "./resources/js/components/AppMessage.vue");
  354. /* harmony import */ var _utils_menu__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/utils/menu */ "./resources/js/utils/menu.js");
  355. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  356. setup: function setup(__props, _ref) {
  357. var expose = _ref.expose;
  358. expose();
  359. var mobileMenuActive = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)(false);
  360. var staticMenuInactive = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)(false);
  361. var menuClick = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)(false);
  362. var isDesktop = function isDesktop() {
  363. return window.innerWidth >= 992;
  364. };
  365. var addClass = function addClass(element, className) {
  366. if (element.classList) element.classList.add(className);else element.className += ' ' + className;
  367. };
  368. var removeClass = function removeClass(element, className) {
  369. if (element.classList) element.classList.remove(className);else element.className = element.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
  370. };
  371. (0,vue__WEBPACK_IMPORTED_MODULE_0__.onBeforeUpdate)(function () {
  372. if (mobileMenuActive.value) {
  373. addClass(document.body, 'body-overflow-hidden');
  374. } else {
  375. removeClass(document.body, 'body-overflow-hidden');
  376. }
  377. });
  378. var containerClass = (0,vue__WEBPACK_IMPORTED_MODULE_0__.computed)(function () {
  379. return ['layout-wrapper', 'layout-static', {
  380. 'layout-static-sidebar-inactive': staticMenuInactive.value,
  381. 'layout-mobile-sidebar-active': mobileMenuActive.value
  382. }];
  383. });
  384. var onWrapperClick = function onWrapperClick() {
  385. if (!menuClick.value) {
  386. mobileMenuActive.value = false;
  387. }
  388. menuClick.value = false;
  389. };
  390. var onMenuToggle = function onMenuToggle(event) {
  391. menuClick.value = true;
  392. if (isDesktop()) {
  393. staticMenuInactive.value = !staticMenuInactive.value;
  394. } else {
  395. mobileMenuActive.value = !mobileMenuActive.value;
  396. }
  397. event.preventDefault();
  398. };
  399. var onSidebarClick = function onSidebarClick() {
  400. menuClick.value = true;
  401. };
  402. var onMenuItemClick = function onMenuItemClick(event) {
  403. if (event.item && !event.item.items) {
  404. mobileMenuActive.value = false;
  405. }
  406. };
  407. var __returned__ = {
  408. mobileMenuActive: mobileMenuActive,
  409. staticMenuInactive: staticMenuInactive,
  410. menuClick: menuClick,
  411. isDesktop: isDesktop,
  412. addClass: addClass,
  413. removeClass: removeClass,
  414. containerClass: containerClass,
  415. onWrapperClick: onWrapperClick,
  416. onMenuToggle: onMenuToggle,
  417. onSidebarClick: onSidebarClick,
  418. onMenuItemClick: onMenuItemClick,
  419. ref: vue__WEBPACK_IMPORTED_MODULE_0__.ref,
  420. computed: vue__WEBPACK_IMPORTED_MODULE_0__.computed,
  421. onBeforeUpdate: vue__WEBPACK_IMPORTED_MODULE_0__.onBeforeUpdate,
  422. AppTopBar: _components_AppTopBar_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  423. AppSidebar: _components_AppSidebar_vue__WEBPACK_IMPORTED_MODULE_2__["default"],
  424. AppFooter: _components_AppFooter_vue__WEBPACK_IMPORTED_MODULE_3__["default"],
  425. AppMessage: _components_AppMessage_vue__WEBPACK_IMPORTED_MODULE_4__["default"],
  426. menu: _utils_menu__WEBPACK_IMPORTED_MODULE_5__["default"]
  427. };
  428. Object.defineProperty(__returned__, '__isScriptSetup', {
  429. enumerable: false,
  430. value: true
  431. });
  432. return __returned__;
  433. }
  434. });
  435. /***/ }),
  436. /***/ "./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/member/Edit.vue?vue&type=script&setup=true&lang=js":
  437. /*!***********************************************************************************************************************************************************************************************************!*\
  438. !*** ./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/member/Edit.vue?vue&type=script&setup=true&lang=js ***!
  439. \***********************************************************************************************************************************************************************************************************/
  440. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  441. "use strict";
  442. __webpack_require__.r(__webpack_exports__);
  443. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  444. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  445. /* harmony export */ });
  446. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  447. /* harmony import */ var _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @inertiajs/inertia */ "./node_modules/@inertiajs/inertia/dist/index.js");
  448. /* harmony import */ var _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @inertiajs/inertia-vue3 */ "./node_modules/@inertiajs/inertia-vue3/dist/index.js");
  449. /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  450. /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_3__);
  451. /* harmony import */ var primevue_useconfirm__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! primevue/useconfirm */ "./node_modules/primevue/useconfirm/useconfirm.esm.js");
  452. /* harmony import */ var _layouts_AppLayout_vue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/layouts/AppLayout.vue */ "./resources/js/layouts/AppLayout.vue");
  453. /* harmony import */ var _components_AppDropdown_vue__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @/components/AppDropdown.vue */ "./resources/js/components/AppDropdown.vue");
  454. /* harmony import */ var _components_AppInputText_vue__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/components/AppInputText.vue */ "./resources/js/components/AppInputText.vue");
  455. /* harmony import */ var _TableHeader__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./TableHeader */ "./resources/js/pages/member/TableHeader.js");
  456. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  457. props: {
  458. member: Object,
  459. typeMembers: Array,
  460. typeMember: Object
  461. },
  462. setup: function setup(__props, _ref) {
  463. var expose = _ref.expose;
  464. expose();
  465. var props = __props;
  466. var errors = (0,vue__WEBPACK_IMPORTED_MODULE_0__.computed)(function () {
  467. return (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.usePage)().props.value.errors;
  468. });
  469. (0,vue__WEBPACK_IMPORTED_MODULE_0__.watch)(errors, function () {
  470. form.clearErrors();
  471. });
  472. var listPlatNumber = (0,vue__WEBPACK_IMPORTED_MODULE_0__.reactive)([]);
  473. (0,vue__WEBPACK_IMPORTED_MODULE_0__.onMounted)(function () {
  474. props.member.vehicles.forEach(function (val) {
  475. return listPlatNumber.push(val);
  476. });
  477. });
  478. var listPlatNumberClear = function listPlatNumberClear() {
  479. listPlatNumber.splice(0);
  480. };
  481. var listPlatNumberOnDelete = function listPlatNumberOnDelete(index) {
  482. listPlatNumber.splice(index, 1);
  483. (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.usePage)().props.value.errors = {};
  484. };
  485. var addPlatNumberValidation = function addPlatNumberValidation() {
  486. if (!form.plat_number) {
  487. form.setError('plat_number', 'Plat kendaraan tidak boleh kosong');
  488. return {
  489. error: true
  490. };
  491. }
  492. if (!form.max_vehicle_id) {
  493. form.setError('max_vehicle_id', 'Tidak boleh kosong');
  494. return {
  495. error: true
  496. };
  497. }
  498. var listPlatNumberExist = listPlatNumber.filter(function (val) {
  499. return val.platNumber === form.plat_number.toUpperCase();
  500. });
  501. if (listPlatNumberExist.length) {
  502. form.setError('plat_number', 'Nomor plat kendaraan tidak boleh sama');
  503. return {
  504. error: true
  505. };
  506. }
  507. var maxVehicles = listPlatNumber.filter(function (val) {
  508. return val.maxVehicleId === form.max_vehicle_id;
  509. });
  510. if (maxVehicles.length) {
  511. if (maxVehicles.length + 1 > maxVehicles[0].maxVehicle) {
  512. form.setError('plat_number', 'Melibihi batas maksimal kendaraan');
  513. return {
  514. error: true
  515. };
  516. }
  517. }
  518. return {
  519. error: false
  520. };
  521. };
  522. var addPlatNumber = function addPlatNumber() {
  523. form.clearErrors('plat_number', 'max_vehicle_id');
  524. var validation = addPlatNumberValidation();
  525. if (validation.error) {
  526. return;
  527. }
  528. var typeVehicle = props.typeMember.maxVehicles.filter(function (val) {
  529. return val.value === form.max_vehicle_id;
  530. })[0];
  531. listPlatNumber.push({
  532. platNumber: form.plat_number.toUpperCase(),
  533. typeVehicle: typeVehicle.label,
  534. typeVehicleId: typeVehicle.typeVehicleId,
  535. maxVehicleId: typeVehicle.value,
  536. maxVehicle: typeVehicle.maxVehicle
  537. });
  538. form.reset('plat_number', 'max_vehicle_id');
  539. };
  540. var form = (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.useForm)({
  541. name: props.member.name,
  542. phone: props.member.phone,
  543. plat_number: null,
  544. max_vehicle_id: null,
  545. type_member_id: props.member.typeMemberId
  546. });
  547. (0,vue__WEBPACK_IMPORTED_MODULE_0__.watch)(function () {
  548. return form.type_member_id;
  549. }, function () {
  550. listPlatNumberClear();
  551. form.reset('plat_number', 'max_vehicle_id');
  552. _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_1__.Inertia.reload({
  553. only: ['typeMember'],
  554. data: {
  555. id: form.type_member_id
  556. }
  557. });
  558. });
  559. var errorSubmitVisible = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)(false);
  560. var errorSubmitText = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)();
  561. var submitValidation = function submitValidation() {
  562. var listPlatNumberGroup = (0,lodash__WEBPACK_IMPORTED_MODULE_3__.groupBy)(listPlatNumber, 'typeVehicleId');
  563. var listVehicles = [];
  564. var error = (0,vue__WEBPACK_IMPORTED_MODULE_0__.ref)(false);
  565. for (var key in listPlatNumberGroup) {
  566. listVehicles.push({
  567. typeVehicleId: listPlatNumberGroup[key][0]['typeVehicleId'],
  568. maxVehicle: listPlatNumberGroup[key][0]['maxVehicle'],
  569. count: listPlatNumberGroup[key].length
  570. });
  571. }
  572. listVehicles.forEach(function (val) {
  573. if (val.count > val.maxVehicle) {
  574. errorSubmitVisible.value = true;
  575. errorSubmitText.value = 'Ada perubahan pada batas maksimal kendaraan';
  576. error.value = true;
  577. }
  578. });
  579. if (error.value) {
  580. return {
  581. error: true
  582. };
  583. } else {
  584. return {
  585. error: false
  586. };
  587. }
  588. };
  589. var confirm = (0,primevue_useconfirm__WEBPACK_IMPORTED_MODULE_4__.useConfirm)();
  590. var formSent = function formSent() {
  591. form.transform(function (data) {
  592. return {
  593. name: data.name,
  594. phone: data.phone,
  595. vehicles: listPlatNumber,
  596. type_member_id: data.type_member_id
  597. };
  598. }).put(route('members.update', props.member.id));
  599. };
  600. var submit = function submit() {
  601. var validation = submitValidation();
  602. if (validation.error) {
  603. return;
  604. }
  605. if (props.member.typeMemberId != form.type_member_id) {
  606. confirm.require({
  607. message: "Tagihan dikenakan untuk jenis member yang berbeda sebesar ".concat(props.typeMember.price),
  608. header: 'Tagihan',
  609. acceptLabel: 'Bayar dan simpan',
  610. rejectLabel: 'Batalkan',
  611. accept: function accept() {
  612. formSent();
  613. },
  614. reject: function reject() {
  615. console.info('transaksi digagalkan');
  616. }
  617. });
  618. } else {
  619. formSent();
  620. }
  621. };
  622. var __returned__ = {
  623. props: props,
  624. errors: errors,
  625. listPlatNumber: listPlatNumber,
  626. listPlatNumberClear: listPlatNumberClear,
  627. listPlatNumberOnDelete: listPlatNumberOnDelete,
  628. addPlatNumberValidation: addPlatNumberValidation,
  629. addPlatNumber: addPlatNumber,
  630. form: form,
  631. errorSubmitVisible: errorSubmitVisible,
  632. errorSubmitText: errorSubmitText,
  633. submitValidation: submitValidation,
  634. confirm: confirm,
  635. formSent: formSent,
  636. submit: submit,
  637. computed: vue__WEBPACK_IMPORTED_MODULE_0__.computed,
  638. watch: vue__WEBPACK_IMPORTED_MODULE_0__.watch,
  639. reactive: vue__WEBPACK_IMPORTED_MODULE_0__.reactive,
  640. ref: vue__WEBPACK_IMPORTED_MODULE_0__.ref,
  641. onMounted: vue__WEBPACK_IMPORTED_MODULE_0__.onMounted,
  642. Inertia: _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_1__.Inertia,
  643. Head: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.Head,
  644. useForm: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.useForm,
  645. usePage: _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_2__.usePage,
  646. groupBy: lodash__WEBPACK_IMPORTED_MODULE_3__.groupBy,
  647. useConfirm: primevue_useconfirm__WEBPACK_IMPORTED_MODULE_4__.useConfirm,
  648. AppLayout: _layouts_AppLayout_vue__WEBPACK_IMPORTED_MODULE_5__["default"],
  649. AppDropdown: _components_AppDropdown_vue__WEBPACK_IMPORTED_MODULE_6__["default"],
  650. AppInputText: _components_AppInputText_vue__WEBPACK_IMPORTED_MODULE_7__["default"],
  651. PlatNumberTable: _TableHeader__WEBPACK_IMPORTED_MODULE_8__.PlatNumberTable
  652. };
  653. Object.defineProperty(__returned__, '__isScriptSetup', {
  654. enumerable: false,
  655. value: true
  656. });
  657. return __returned__;
  658. }
  659. });
  660. /***/ }),
  661. /***/ "./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/AppDropdown.vue?vue&type=template&id=ce0d1992":
  662. /*!*********************************************************************************************************************************************************************************************************************************************************************************!*\
  663. !*** ./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/AppDropdown.vue?vue&type=template&id=ce0d1992 ***!
  664. \*********************************************************************************************************************************************************************************************************************************************************************************/
  665. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  666. "use strict";
  667. __webpack_require__.r(__webpack_exports__);
  668. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  669. /* harmony export */ "render": () => (/* binding */ render)
  670. /* harmony export */ });
  671. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  672. var _hoisted_1 = {
  673. "class": "field"
  674. };
  675. var _hoisted_2 = ["for"];
  676. var _hoisted_3 = {
  677. key: 0
  678. };
  679. var _hoisted_4 = {
  680. key: 1
  681. };
  682. var _hoisted_5 = ["id"];
  683. function render(_ctx, _cache, $props, $setup, $data, $options) {
  684. var _component_Dropdown = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Dropdown");
  685. return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", _hoisted_1, [$props.label ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("label", {
  686. key: 0,
  687. "for": $setup.forLabel
  688. }, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.label), 9
  689. /* TEXT, PROPS */
  690. , _hoisted_2)) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Dropdown, {
  691. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(["w-full", {
  692. 'p-invalid': $setup.isError
  693. }]),
  694. id: $setup.forLabel,
  695. "aria-describedby": $setup.ariaDescribedbyLabel,
  696. "option-disabled": $props.optionDisabled,
  697. "option-label": $props.optionLabel,
  698. "option-value": $props.optionValue,
  699. placeholder: $props.placeholder,
  700. options: $props.options,
  701. "model-value": $props.modelValue,
  702. disabled: $props.disabled,
  703. onChange: _cache[0] || (_cache[0] = function ($event) {
  704. return _ctx.$emit('update:modelValue', $event.value);
  705. })
  706. }, {
  707. value: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function (slotProps) {
  708. return [slotProps.value ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", _hoisted_3, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($setup.selectedDropdownLabel(slotProps.value)), 1
  709. /* TEXT */
  710. )) : ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", _hoisted_4, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(slotProps.placeholder), 1
  711. /* TEXT */
  712. ))];
  713. }),
  714. option: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function (_ref) {
  715. var option = _ref.option,
  716. index = _ref.index;
  717. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.renderSlot)(_ctx.$slots, "option", {
  718. option: option,
  719. index: index
  720. })];
  721. }),
  722. _: 3
  723. /* FORWARDED */
  724. }, 8
  725. /* PROPS */
  726. , ["class", "id", "aria-describedby", "option-disabled", "option-label", "option-value", "placeholder", "options", "model-value", "disabled"]), $props.error ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("small", {
  727. key: 1,
  728. id: $setup.ariaDescribedbyLabel,
  729. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)({
  730. 'p-error': $setup.isError
  731. })
  732. }, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.error), 11
  733. /* TEXT, CLASS, PROPS */
  734. , _hoisted_5)) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)]);
  735. }
  736. /***/ }),
  737. /***/ "./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":
  738. /*!*******************************************************************************************************************************************************************************************************************************************************************************!*\
  739. !*** ./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 ***!
  740. \*******************************************************************************************************************************************************************************************************************************************************************************/
  741. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  742. "use strict";
  743. __webpack_require__.r(__webpack_exports__);
  744. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  745. /* harmony export */ "render": () => (/* binding */ render)
  746. /* harmony export */ });
  747. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  748. var _hoisted_1 = {
  749. "class": "layout-footer"
  750. };
  751. var _hoisted_2 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(" Developed by ");
  752. var _hoisted_3 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("a", {
  753. href: "https://dijitalcode.com",
  754. target: "_blank",
  755. "class": "font-medium ml-2"
  756. }, "DijitalCODE", -1
  757. /* HOISTED */
  758. );
  759. var _hoisted_4 = [_hoisted_2, _hoisted_3];
  760. function render(_ctx, _cache) {
  761. return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", _hoisted_1, _hoisted_4);
  762. }
  763. /***/ }),
  764. /***/ "./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/AppInputText.vue?vue&type=template&id=16729fe1":
  765. /*!**********************************************************************************************************************************************************************************************************************************************************************************!*\
  766. !*** ./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/AppInputText.vue?vue&type=template&id=16729fe1 ***!
  767. \**********************************************************************************************************************************************************************************************************************************************************************************/
  768. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  769. "use strict";
  770. __webpack_require__.r(__webpack_exports__);
  771. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  772. /* harmony export */ "render": () => (/* binding */ render)
  773. /* harmony export */ });
  774. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  775. var _hoisted_1 = {
  776. "class": "field"
  777. };
  778. var _hoisted_2 = ["for"];
  779. var _hoisted_3 = ["id"];
  780. function render(_ctx, _cache, $props, $setup, $data, $options) {
  781. var _component_InputText = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("InputText");
  782. 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)("label", {
  783. "for": $setup.forLabel
  784. }, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.label), 9
  785. /* TEXT, PROPS */
  786. , _hoisted_2), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_InputText, {
  787. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(["w-full", {
  788. 'p-invalid': $setup.isError
  789. }]),
  790. id: $setup.forLabel,
  791. "aria-describedby": $setup.ariaDescribedbyLabel,
  792. "model-value": $props.modelValue,
  793. type: $props.type,
  794. placeholder: $props.placeholder,
  795. value: $props.modelValue,
  796. disabled: $props.disabled,
  797. onInput: _cache[0] || (_cache[0] = function ($event) {
  798. return _ctx.$emit('update:modelValue', $event.target.value);
  799. })
  800. }, null, 8
  801. /* PROPS */
  802. , ["class", "id", "aria-describedby", "model-value", "type", "placeholder", "value", "disabled"]), $props.error ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("small", {
  803. key: 0,
  804. id: $setup.ariaDescribedbyLabel,
  805. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)({
  806. 'p-error': $setup.isError
  807. })
  808. }, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.error), 11
  809. /* TEXT, CLASS, PROPS */
  810. , _hoisted_3)) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)]);
  811. }
  812. /***/ }),
  813. /***/ "./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":
  814. /*!********************************************************************************************************************************************************************************************************************************************************************************!*\
  815. !*** ./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 ***!
  816. \********************************************************************************************************************************************************************************************************************************************************************************/
  817. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  818. "use strict";
  819. __webpack_require__.r(__webpack_exports__);
  820. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  821. /* harmony export */ "render": () => (/* binding */ render)
  822. /* harmony export */ });
  823. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  824. var _hoisted_1 = {
  825. "class": "grid"
  826. };
  827. var _hoisted_2 = {
  828. "class": "col-12"
  829. };
  830. var _hoisted_3 = {
  831. key: 0
  832. };
  833. var _hoisted_4 = {
  834. key: 1
  835. };
  836. function render(_ctx, _cache, $props, $setup, $data, $options) {
  837. var _component_Message = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Message");
  838. 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, {
  839. key: 0,
  840. severity: "success",
  841. style: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeStyle)($setup.messageDisplay),
  842. onClose: $setup.onClose
  843. }, {
  844. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  845. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)((0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(_ctx.$page.props.flash.success), 1
  846. /* TEXT */
  847. )];
  848. }),
  849. _: 1
  850. /* STABLE */
  851. }, 8
  852. /* PROPS */
  853. , ["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, {
  854. key: 1
  855. }, [_ctx.$page.props.flash.error ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_Message, {
  856. key: 0,
  857. severity: "error",
  858. style: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeStyle)($setup.messageDisplay),
  859. onClose: $setup.onClose
  860. }, {
  861. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  862. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)((0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(_ctx.$page.props.flash.error), 1
  863. /* TEXT */
  864. )];
  865. }),
  866. _: 1
  867. /* STABLE */
  868. }, 8
  869. /* PROPS */
  870. , ["style"])) : ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_Message, {
  871. key: 1,
  872. severity: "error",
  873. style: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeStyle)($setup.messageDisplay),
  874. onClose: $setup.onClose
  875. }, {
  876. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  877. 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
  878. /* TEXT */
  879. ))];
  880. }),
  881. _: 1
  882. /* STABLE */
  883. }, 8
  884. /* PROPS */
  885. , ["style"]))], 2112
  886. /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
  887. )) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)])]);
  888. }
  889. /***/ }),
  890. /***/ "./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":
  891. /*!********************************************************************************************************************************************************************************************************************************************************************************!*\
  892. !*** ./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 ***!
  893. \********************************************************************************************************************************************************************************************************************************************************************************/
  894. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  895. "use strict";
  896. __webpack_require__.r(__webpack_exports__);
  897. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  898. /* harmony export */ "render": () => (/* binding */ render)
  899. /* harmony export */ });
  900. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  901. var _hoisted_1 = {
  902. "class": "layout-menu-container"
  903. };
  904. function render(_ctx, _cache, $props, $setup, $data, $options) {
  905. 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"], {
  906. "class": "layout-menu",
  907. items: $props.model,
  908. root: true,
  909. onKeydown: $setup.onKeyDown,
  910. onMenuitemClick: $setup.onMenuItemClick
  911. }, null, 8
  912. /* PROPS */
  913. , ["items"])]);
  914. }
  915. /***/ }),
  916. /***/ "./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":
  917. /*!***********************************************************************************************************************************************************************************************************************************************************************************!*\
  918. !*** ./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 ***!
  919. \***********************************************************************************************************************************************************************************************************************************************************************************/
  920. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  921. "use strict";
  922. __webpack_require__.r(__webpack_exports__);
  923. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  924. /* harmony export */ "render": () => (/* binding */ render)
  925. /* harmony export */ });
  926. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  927. var _hoisted_1 = {
  928. key: 0
  929. };
  930. var _hoisted_2 = ["aria-label"];
  931. var _hoisted_3 = {
  932. key: 0,
  933. "class": "pi pi-fw pi-angle-down menuitem-toggle-icon"
  934. };
  935. var _hoisted_4 = ["href", "target", "aria-label", "onClick"];
  936. var _hoisted_5 = {
  937. key: 0,
  938. "class": "pi pi-fw pi-angle-down menuitem-toggle-icon"
  939. };
  940. function render(_ctx, _cache, $props, $setup, $data, $options) {
  941. var _component_AppSubSidebar = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("AppSubSidebar", true);
  942. var _component_Badge = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Badge");
  943. var _directive_ripple = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveDirective)("ripple");
  944. 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) {
  945. 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", {
  946. key: item.label || i,
  947. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)([{
  948. 'layout-menuitem-category': $props.root,
  949. 'active-menuitem': $setup.activeIndex === i && !item.to && !item.disabled
  950. }]),
  951. role: "none"
  952. }, [$props.root ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
  953. key: 0
  954. }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", {
  955. "class": "layout-menuitem-root-text",
  956. "aria-label": item.label
  957. }, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(item.label), 9
  958. /* TEXT, PROPS */
  959. , _hoisted_2), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_AppSubSidebar, {
  960. items: $setup.visible(item) && item.items,
  961. onMenuitemClick: _cache[0] || (_cache[0] = function ($event) {
  962. return _ctx.$emit('menuitem-click', $event);
  963. })
  964. }, null, 8
  965. /* PROPS */
  966. , ["items"])], 64
  967. /* STABLE_FRAGMENT */
  968. )) : ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
  969. key: 1
  970. }, [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"], {
  971. key: 0,
  972. role: "menuitem",
  973. href: item.to,
  974. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)([item["class"], 'p-ripple', {
  975. 'p-disabled': item.disabled,
  976. 'router-link-active': _ctx.$page.component.startsWith(item.component) || _ctx.$page.url.startsWith(item.to),
  977. 'router-link-exact-active': _ctx.$page.component.startsWith(item.component) || _ctx.$page.url.startsWith(item.to)
  978. }]),
  979. style: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeStyle)(item.style),
  980. target: item.target,
  981. "aria-label": item.label,
  982. onClick: function onClick($event) {
  983. return $setup.onMenuItemClick($event, item, i);
  984. }
  985. }, {
  986. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  987. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
  988. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(item.icon)
  989. }, null, 2
  990. /* CLASS */
  991. ), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(item.label), 1
  992. /* TEXT */
  993. ), 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, {
  994. key: 1,
  995. value: item.badge
  996. }, null, 8
  997. /* PROPS */
  998. , ["value"])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)];
  999. }),
  1000. _: 2
  1001. /* DYNAMIC */
  1002. }, 1032
  1003. /* PROPS, DYNAMIC_SLOTS */
  1004. , ["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", {
  1005. key: 1,
  1006. role: "menuitem",
  1007. style: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeStyle)(item.style),
  1008. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)([item["class"], 'p-ripple', {
  1009. 'p-disabled': item.disabled
  1010. }]),
  1011. href: item.url || '#',
  1012. target: item.target,
  1013. "aria-label": item.label,
  1014. onClick: function onClick($event) {
  1015. return $setup.onMenuItemClick($event, item, i);
  1016. }
  1017. }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
  1018. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(item.icon)
  1019. }, null, 2
  1020. /* CLASS */
  1021. ), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(item.label), 1
  1022. /* TEXT */
  1023. ), 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, {
  1024. key: 1,
  1025. value: item.badge
  1026. }, null, 8
  1027. /* PROPS */
  1028. , ["value"])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)], 14
  1029. /* CLASS, STYLE, PROPS */
  1030. , _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, {
  1031. name: "layout-submenu-wrapper"
  1032. }, {
  1033. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1034. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.withDirectives)((0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_AppSubSidebar, {
  1035. items: $setup.visible(item) && item.items,
  1036. onMenuitemClick: _cache[1] || (_cache[1] = function ($event) {
  1037. return _ctx.$emit('menuitem-click', $event);
  1038. })
  1039. }, null, 8
  1040. /* PROPS */
  1041. , ["items"]), [[vue__WEBPACK_IMPORTED_MODULE_0__.vShow, $setup.activeIndex === i]])];
  1042. }),
  1043. _: 2
  1044. /* DYNAMIC */
  1045. }, 1024
  1046. /* DYNAMIC_SLOTS */
  1047. )], 64
  1048. /* STABLE_FRAGMENT */
  1049. ))], 2
  1050. /* CLASS */
  1051. )) : (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", {
  1052. "class": "p-menu-separator",
  1053. role: "separator",
  1054. style: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeStyle)(item.style),
  1055. key: 'separator' + i
  1056. }, null, 4
  1057. /* STYLE */
  1058. )) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)], 64
  1059. /* STABLE_FRAGMENT */
  1060. );
  1061. }), 256
  1062. /* UNKEYED_FRAGMENT */
  1063. ))])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true);
  1064. }
  1065. /***/ }),
  1066. /***/ "./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":
  1067. /*!*******************************************************************************************************************************************************************************************************************************************************************************!*\
  1068. !*** ./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 ***!
  1069. \*******************************************************************************************************************************************************************************************************************************************************************************/
  1070. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1071. "use strict";
  1072. __webpack_require__.r(__webpack_exports__);
  1073. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1074. /* harmony export */ "render": () => (/* binding */ render)
  1075. /* harmony export */ });
  1076. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  1077. var _hoisted_1 = {
  1078. "class": "layout-topbar"
  1079. };
  1080. var _hoisted_2 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("img", {
  1081. alt: "Logo",
  1082. src: "/images/logo.svg",
  1083. "class": "md:mr-3"
  1084. }, null, -1
  1085. /* HOISTED */
  1086. );
  1087. var _hoisted_3 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", null, "Parkirin", -1
  1088. /* HOISTED */
  1089. );
  1090. var _hoisted_4 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
  1091. "class": "pi pi-bars"
  1092. }, null, -1
  1093. /* HOISTED */
  1094. );
  1095. var _hoisted_5 = [_hoisted_4];
  1096. var _hoisted_6 = {
  1097. "class": "p-link layout-topbar-menu-button layout-topbar-button"
  1098. };
  1099. var _hoisted_7 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
  1100. "class": "pi pi-ellipsis-v"
  1101. }, null, -1
  1102. /* HOISTED */
  1103. );
  1104. var _hoisted_8 = [_hoisted_7];
  1105. var _hoisted_9 = {
  1106. "class": "layout-topbar-menu hidden lg:flex origin-top"
  1107. };
  1108. var _hoisted_10 = {
  1109. "class": "align-self-center"
  1110. };
  1111. var _hoisted_11 = {
  1112. "class": "hidden lg:inline"
  1113. };
  1114. var _hoisted_12 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
  1115. "class": "pi pi-user"
  1116. }, null, -1
  1117. /* HOISTED */
  1118. );
  1119. var _hoisted_13 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", null, "Profil Saya", -1
  1120. /* HOISTED */
  1121. );
  1122. var _hoisted_14 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("i", {
  1123. "class": "pi pi-sign-out"
  1124. }, null, -1
  1125. /* HOISTED */
  1126. );
  1127. var _hoisted_15 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", null, "Sign Out", -1
  1128. /* HOISTED */
  1129. );
  1130. function render(_ctx, _cache, $props, $setup, $data, $options) {
  1131. var _directive_styleclass = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveDirective)("styleclass");
  1132. 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"], {
  1133. href: "/",
  1134. "class": "layout-topbar-logo"
  1135. }, {
  1136. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1137. return [_hoisted_2, _hoisted_3];
  1138. }),
  1139. _: 1
  1140. /* STABLE */
  1141. }), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("button", {
  1142. "class": "p-link layout-menu-button layout-topbar-button",
  1143. onClick: _cache[0] || (_cache[0] = function ($event) {
  1144. return _ctx.$emit('menu-toggle', $event);
  1145. })
  1146. }, _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, {
  1147. selector: '@next',
  1148. enterClass: 'hidden',
  1149. enterActiveClass: 'scalein',
  1150. leaveToClass: 'hidden',
  1151. leaveActiveClass: 'fadeout',
  1152. hideOnOutsideClick: true
  1153. }]]), (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
  1154. /* TEXT */
  1155. )]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("li", null, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["Link"], {
  1156. href: _ctx.route('users.show', _ctx.$page.props.auth.user.id),
  1157. "class": "p-link layout-topbar-button"
  1158. }, {
  1159. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1160. return [_hoisted_12, _hoisted_13];
  1161. }),
  1162. _: 1
  1163. /* STABLE */
  1164. }, 8
  1165. /* PROPS */
  1166. , ["href"])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("li", null, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["Link"], {
  1167. href: _ctx.route('logout'),
  1168. as: "button",
  1169. method: "post",
  1170. "class": "p-link layout-topbar-button"
  1171. }, {
  1172. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1173. return [_hoisted_14, _hoisted_15];
  1174. }),
  1175. _: 1
  1176. /* STABLE */
  1177. }, 8
  1178. /* PROPS */
  1179. , ["href"])])])]);
  1180. }
  1181. /***/ }),
  1182. /***/ "./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":
  1183. /*!****************************************************************************************************************************************************************************************************************************************************************************!*\
  1184. !*** ./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 ***!
  1185. \****************************************************************************************************************************************************************************************************************************************************************************/
  1186. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1187. "use strict";
  1188. __webpack_require__.r(__webpack_exports__);
  1189. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1190. /* harmony export */ "render": () => (/* binding */ render)
  1191. /* harmony export */ });
  1192. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  1193. var _hoisted_1 = {
  1194. "class": "layout-main-container"
  1195. };
  1196. var _hoisted_2 = {
  1197. "class": "layout-main"
  1198. };
  1199. var _hoisted_3 = {
  1200. key: 0,
  1201. "class": "layout-mask p-component-overlay"
  1202. };
  1203. function render(_ctx, _cache, $props, $setup, $data, $options) {
  1204. return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", {
  1205. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)($setup.containerClass),
  1206. onClick: $setup.onWrapperClick
  1207. }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppTopBar"], {
  1208. onMenuToggle: $setup.onMenuToggle
  1209. }), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", {
  1210. "class": "layout-sidebar",
  1211. onClick: $setup.onSidebarClick
  1212. }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppSidebar"], {
  1213. model: $setup.menu[_ctx.$page.props.auth.user.role_id],
  1214. onMenuitemClick: $setup.onMenuItemClick
  1215. }, null, 8
  1216. /* PROPS */
  1217. , ["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, {
  1218. name: "layout-mask"
  1219. }, {
  1220. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1221. 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)];
  1222. }),
  1223. _: 1
  1224. /* STABLE */
  1225. })], 2
  1226. /* CLASS */
  1227. );
  1228. }
  1229. /***/ }),
  1230. /***/ "./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/member/Edit.vue?vue&type=template&id=1a9fb226":
  1231. /*!****************************************************************************************************************************************************************************************************************************************************************************!*\
  1232. !*** ./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/member/Edit.vue?vue&type=template&id=1a9fb226 ***!
  1233. \****************************************************************************************************************************************************************************************************************************************************************************/
  1234. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1235. "use strict";
  1236. __webpack_require__.r(__webpack_exports__);
  1237. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1238. /* harmony export */ "render": () => (/* binding */ render)
  1239. /* harmony export */ });
  1240. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
  1241. var _hoisted_1 = {
  1242. "class": "grid"
  1243. };
  1244. var _hoisted_2 = {
  1245. "class": "col-12 md:col-8"
  1246. };
  1247. var _hoisted_3 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(" Ubah Member ");
  1248. var _hoisted_4 = {
  1249. "class": "grid"
  1250. };
  1251. var _hoisted_5 = {
  1252. "class": "col-12 md:col-6"
  1253. };
  1254. var _hoisted_6 = {
  1255. "class": "col-12 md:col-6"
  1256. };
  1257. var _hoisted_7 = {
  1258. "class": "col-12 md:col-6"
  1259. };
  1260. var _hoisted_8 = {
  1261. "class": "grid"
  1262. };
  1263. var _hoisted_9 = {
  1264. "class": "col-12 md:col-8"
  1265. };
  1266. var _hoisted_10 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)("Detail Harga");
  1267. var _hoisted_11 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("h3", {
  1268. "class": "text-base font-bold mb-0"
  1269. }, "Jenis Member", -1
  1270. /* HOISTED */
  1271. );
  1272. var _hoisted_12 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("h3", {
  1273. "class": "text-base font-bold mb-0"
  1274. }, "Batas Maksimal Kendaraan", -1
  1275. /* HOISTED */
  1276. );
  1277. var _hoisted_13 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("h3", {
  1278. "class": "text-base font-bold mb-0"
  1279. }, "Keterangan", -1
  1280. /* HOISTED */
  1281. );
  1282. var _hoisted_14 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("h3", {
  1283. "class": "text-base font-bold mb-0"
  1284. }, "Tarif Member", -1
  1285. /* HOISTED */
  1286. );
  1287. var _hoisted_15 = {
  1288. key: 0,
  1289. "class": "grid"
  1290. };
  1291. var _hoisted_16 = {
  1292. "class": "col-12 md:col-8"
  1293. };
  1294. var _hoisted_17 = {
  1295. "class": "grid"
  1296. };
  1297. var _hoisted_18 = {
  1298. "class": "col-12 md:col-6"
  1299. };
  1300. var _hoisted_19 = {
  1301. "class": "col-12 md:col-6"
  1302. };
  1303. var _hoisted_20 = {
  1304. "class": "col-12 mb-3 md:mb-0"
  1305. };
  1306. var _hoisted_21 = {
  1307. "class": "flex flex-column md:flex-row md:align-items-center justify-content-end"
  1308. };
  1309. var _hoisted_22 = {
  1310. "class": "col-12"
  1311. };
  1312. var _hoisted_23 = {
  1313. style: {
  1314. "color": "#b71c1c"
  1315. }
  1316. };
  1317. var _hoisted_24 = {
  1318. "class": "flex justify-content-end"
  1319. };
  1320. var _hoisted_25 = {
  1321. "class": "grid"
  1322. };
  1323. var _hoisted_26 = {
  1324. "class": "col-12 flex flex-column md:flex-row justify-content-center md:justify-content-end"
  1325. };
  1326. function render(_ctx, _cache, $props, $setup, $data, $options) {
  1327. var _component_ConfirmDialog = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("ConfirmDialog");
  1328. var _component_Card = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Card");
  1329. var _component_Button = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Button");
  1330. var _component_Column = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Column");
  1331. var _component_DataTable = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("DataTable");
  1332. var _component_Dialog = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Dialog");
  1333. return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["Head"], {
  1334. title: "Ubah Member"
  1335. }), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppLayout"], null, {
  1336. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1337. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_ConfirmDialog), (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)(_component_Card, null, {
  1338. title: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1339. return [_hoisted_3];
  1340. }),
  1341. content: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1342. return [(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)($setup["AppInputText"], {
  1343. modelValue: $setup.form.name,
  1344. "onUpdate:modelValue": _cache[0] || (_cache[0] = function ($event) {
  1345. return $setup.form.name = $event;
  1346. }),
  1347. label: "Nama",
  1348. placeholder: "nama",
  1349. error: $setup.form.errors.name
  1350. }, null, 8
  1351. /* PROPS */
  1352. , ["modelValue", "error"])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_6, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppInputText"], {
  1353. modelValue: $setup.form.phone,
  1354. "onUpdate:modelValue": _cache[1] || (_cache[1] = function ($event) {
  1355. return $setup.form.phone = $event;
  1356. }),
  1357. label: "Nomor HP",
  1358. placeholder: "nomor hp",
  1359. error: $setup.form.errors.phone
  1360. }, null, 8
  1361. /* PROPS */
  1362. , ["modelValue", "error"])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_7, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppDropdown"], {
  1363. label: "Jenis member",
  1364. placeholder: "pilih satu",
  1365. modelValue: $setup.form.type_member_id,
  1366. "onUpdate:modelValue": _cache[2] || (_cache[2] = function ($event) {
  1367. return $setup.form.type_member_id = $event;
  1368. }),
  1369. options: $props.typeMembers,
  1370. error: $setup.form.errors.type_member_id
  1371. }, null, 8
  1372. /* PROPS */
  1373. , ["modelValue", "options", "error"])])])];
  1374. }),
  1375. _: 1
  1376. /* STABLE */
  1377. })])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_8, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_9, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Card, {
  1378. "class": "bg-primary"
  1379. }, (0,vue__WEBPACK_IMPORTED_MODULE_0__.createSlots)({
  1380. title: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1381. return [_hoisted_10];
  1382. }),
  1383. _: 2
  1384. /* DYNAMIC */
  1385. }, [$props.typeMember ? {
  1386. name: "content",
  1387. fn: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1388. return [_hoisted_11, (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("p", null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.typeMember.type), 1
  1389. /* TEXT */
  1390. ), _hoisted_12, (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("p", null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.typeMember.max), 1
  1391. /* TEXT */
  1392. ), _hoisted_13, (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("p", null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.typeMember.description), 1
  1393. /* TEXT */
  1394. ), _hoisted_14, (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("p", null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.typeMember.price), 1
  1395. /* TEXT */
  1396. )];
  1397. })
  1398. } : undefined]), 1024
  1399. /* DYNAMIC_SLOTS */
  1400. )])]), $props.typeMember ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", _hoisted_15, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_16, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Card, null, {
  1401. content: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1402. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_17, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_18, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppInputText"], {
  1403. modelValue: $setup.form.plat_number,
  1404. "onUpdate:modelValue": _cache[3] || (_cache[3] = function ($event) {
  1405. return $setup.form.plat_number = $event;
  1406. }),
  1407. label: "Plat Kendaraan",
  1408. placeholder: "plat kendaraan",
  1409. disabled: !$setup.form.type_member_id,
  1410. error: $setup.form.errors.plat_number
  1411. }, null, 8
  1412. /* PROPS */
  1413. , ["modelValue", "disabled", "error"])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_19, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppDropdown"], {
  1414. modelValue: $setup.form.max_vehicle_id,
  1415. "onUpdate:modelValue": _cache[4] || (_cache[4] = function ($event) {
  1416. return $setup.form.max_vehicle_id = $event;
  1417. }),
  1418. label: "Jenis Kendaraan",
  1419. placeholder: "jenis kendaraan",
  1420. disabled: !$setup.form.type_member_id,
  1421. options: $props.typeMember.maxVehicles,
  1422. error: $setup.form.errors.max_vehicle_id
  1423. }, null, 8
  1424. /* PROPS */
  1425. , ["modelValue", "disabled", "options", "error"])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_20, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_21, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Button, {
  1426. label: "Tambah",
  1427. "class": "p-button-outlined",
  1428. icon: "pi pi-car",
  1429. disabled: !$setup.form.type_member_id,
  1430. onClick: $setup.addPlatNumber
  1431. }, null, 8
  1432. /* PROPS */
  1433. , ["disabled"])])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_22, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_DataTable, {
  1434. "striped-rows": "",
  1435. "row-hover": "",
  1436. "responsive-layout": "scroll",
  1437. "column-resize-mode": "expand",
  1438. "edit-mode": "cell",
  1439. value: $setup.listPlatNumber
  1440. }, {
  1441. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1442. 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.PlatNumberTable, function (platNumberTable) {
  1443. return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_Column, {
  1444. field: platNumberTable.field,
  1445. header: platNumberTable.header,
  1446. key: platNumberTable.field
  1447. }, null, 8
  1448. /* PROPS */
  1449. , ["field", "header"]);
  1450. }), 128
  1451. /* KEYED_FRAGMENT */
  1452. )), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Column, null, {
  1453. body: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function (_ref) {
  1454. var index = _ref.index;
  1455. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("span", _hoisted_23, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(_ctx.$page.props.errors["vehicles.".concat(index, ".platNumber")]), 1
  1456. /* TEXT */
  1457. )];
  1458. }),
  1459. _: 1
  1460. /* STABLE */
  1461. }), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Column, null, {
  1462. body: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function (_ref2) {
  1463. var index = _ref2.index;
  1464. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_24, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Button, {
  1465. icon: "pi pi-trash",
  1466. "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(["p-button-rounded p-button-text", {
  1467. 'p-button-danger': _ctx.$page.props.errors["vehicles.".concat(index, ".platNumber")]
  1468. }]),
  1469. onClick: function onClick($event) {
  1470. return $setup.listPlatNumberOnDelete(index);
  1471. }
  1472. }, null, 8
  1473. /* PROPS */
  1474. , ["class", "onClick"])])];
  1475. }),
  1476. _: 1
  1477. /* STABLE */
  1478. })];
  1479. }),
  1480. _: 1
  1481. /* STABLE */
  1482. }, 8
  1483. /* PROPS */
  1484. , ["value"])])])];
  1485. }),
  1486. footer: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1487. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_25, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_26, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Button, {
  1488. label: "Simpan",
  1489. icon: "pi pi-check",
  1490. "class": "p-button-outlined",
  1491. disabled: $setup.form.processing,
  1492. onClick: $setup.submit
  1493. }, null, 8
  1494. /* PROPS */
  1495. , ["disabled"])])])];
  1496. }),
  1497. _: 1
  1498. /* STABLE */
  1499. })])])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Dialog, {
  1500. header: "Error",
  1501. visible: $setup.errorSubmitVisible,
  1502. "onUpdate:visible": _cache[5] || (_cache[5] = function ($event) {
  1503. return $setup.errorSubmitVisible = $event;
  1504. }),
  1505. style: {
  1506. width: '40vw'
  1507. },
  1508. contentStyle: "color: #b71c1c"
  1509. }, {
  1510. "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
  1511. return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("p", null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($setup.errorSubmitText), 1
  1512. /* TEXT */
  1513. )];
  1514. }),
  1515. _: 1
  1516. /* STABLE */
  1517. }, 8
  1518. /* PROPS */
  1519. , ["visible"])];
  1520. }),
  1521. _: 1
  1522. /* STABLE */
  1523. })], 64
  1524. /* STABLE_FRAGMENT */
  1525. );
  1526. }
  1527. /***/ }),
  1528. /***/ "./resources/js/pages/member/TableHeader.js":
  1529. /*!**************************************************!*\
  1530. !*** ./resources/js/pages/member/TableHeader.js ***!
  1531. \**************************************************/
  1532. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1533. "use strict";
  1534. __webpack_require__.r(__webpack_exports__);
  1535. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1536. /* harmony export */ "IndexTable": () => (/* binding */ IndexTable),
  1537. /* harmony export */ "PlatNumberTable": () => (/* binding */ PlatNumberTable)
  1538. /* harmony export */ });
  1539. var IndexTable = [{
  1540. field: 'updatedAt',
  1541. header: 'Diperbaharui'
  1542. }, {
  1543. field: 'name',
  1544. header: 'Nama'
  1545. }, {
  1546. field: 'phone',
  1547. header: 'Nomor HP'
  1548. }, {
  1549. field: 'platNumber',
  1550. header: 'Plat Kendaraan'
  1551. }, {
  1552. field: 'type',
  1553. header: 'Jenis Member'
  1554. }, {
  1555. field: 'price',
  1556. header: 'Tarif Member'
  1557. }, {
  1558. field: 'expDate',
  1559. header: 'Berakhir'
  1560. }];
  1561. var PlatNumberTable = [{
  1562. field: 'platNumber',
  1563. header: 'Plat Kendaraan'
  1564. }, {
  1565. field: 'typeVehicle',
  1566. header: 'Jenis Kendaraan'
  1567. }];
  1568. /***/ }),
  1569. /***/ "./resources/js/utils/menu.js":
  1570. /*!************************************!*\
  1571. !*** ./resources/js/utils/menu.js ***!
  1572. \************************************/
  1573. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1574. "use strict";
  1575. __webpack_require__.r(__webpack_exports__);
  1576. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1577. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  1578. /* harmony export */ });
  1579. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  1580. // Admin
  1581. 1: [{
  1582. label: 'Home',
  1583. items: [{
  1584. label: 'Dashboard',
  1585. icon: 'pi pi-home',
  1586. to: '/dashboards',
  1587. component: 'home/Index'
  1588. }]
  1589. }, {
  1590. label: 'Master',
  1591. items: [{
  1592. label: 'User',
  1593. icon: 'pi pi-user',
  1594. to: '/users',
  1595. component: 'user/Index'
  1596. }]
  1597. }],
  1598. // Supervisor
  1599. 2: [{
  1600. label: 'Home',
  1601. items: [{
  1602. label: 'Dashboard',
  1603. icon: 'pi pi-home',
  1604. to: '/dashboards',
  1605. component: 'home/Index'
  1606. }]
  1607. }, {
  1608. label: 'Menu',
  1609. items: [{
  1610. label: 'Pengeluaran',
  1611. icon: 'pi pi-wallet',
  1612. to: '/expenses',
  1613. component: 'expense/Index'
  1614. }, {
  1615. label: 'Laporan',
  1616. icon: 'pi pi-book',
  1617. items: [{
  1618. label: 'Mutasi',
  1619. icon: 'pi pi-circle',
  1620. to: '/reports/mutations',
  1621. component: 'mutation/Report'
  1622. }]
  1623. }]
  1624. }, {
  1625. label: 'Master',
  1626. items: [{
  1627. label: 'Jenis Kendaraan',
  1628. icon: 'pi pi-car',
  1629. to: '/type-vehicles',
  1630. component: 'typevehicle/Index'
  1631. }, {
  1632. label: 'Jenis Member',
  1633. icon: 'pi pi-id-card',
  1634. to: '/type-members',
  1635. component: 'typemember/Index'
  1636. }]
  1637. }],
  1638. // Operator
  1639. 3: [{
  1640. label: 'Home',
  1641. items: [{
  1642. label: 'Dashboard',
  1643. icon: 'pi pi-home',
  1644. to: '/dashboards',
  1645. component: 'home/Index'
  1646. }]
  1647. }, {
  1648. label: 'Menu',
  1649. items: [{
  1650. label: 'Pengeluaran',
  1651. icon: 'pi pi-wallet',
  1652. to: '/expenses',
  1653. component: 'expense/Index'
  1654. }, {
  1655. label: 'Member',
  1656. icon: 'pi pi-id-card',
  1657. to: '/members',
  1658. component: 'member/Index'
  1659. }, {
  1660. label: 'Top Up',
  1661. icon: 'pi pi-wallet',
  1662. to: '/top-ups',
  1663. component: 'topup/Index'
  1664. }]
  1665. }]
  1666. });
  1667. /***/ }),
  1668. /***/ "./node_modules/lodash/lodash.js":
  1669. /*!***************************************!*\
  1670. !*** ./node_modules/lodash/lodash.js ***!
  1671. \***************************************/
  1672. /***/ (function(module, exports, __webpack_require__) {
  1673. /* module decorator */ module = __webpack_require__.nmd(module);
  1674. var __WEBPACK_AMD_DEFINE_RESULT__;/**
  1675. * @license
  1676. * Lodash <https://lodash.com/>
  1677. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  1678. * Released under MIT license <https://lodash.com/license>
  1679. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  1680. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  1681. */
  1682. ;(function() {
  1683. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  1684. var undefined;
  1685. /** Used as the semantic version number. */
  1686. var VERSION = '4.17.21';
  1687. /** Used as the size to enable large array optimizations. */
  1688. var LARGE_ARRAY_SIZE = 200;
  1689. /** Error message constants. */
  1690. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  1691. FUNC_ERROR_TEXT = 'Expected a function',
  1692. INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`';
  1693. /** Used to stand-in for `undefined` hash values. */
  1694. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  1695. /** Used as the maximum memoize cache size. */
  1696. var MAX_MEMOIZE_SIZE = 500;
  1697. /** Used as the internal argument placeholder. */
  1698. var PLACEHOLDER = '__lodash_placeholder__';
  1699. /** Used to compose bitmasks for cloning. */
  1700. var CLONE_DEEP_FLAG = 1,
  1701. CLONE_FLAT_FLAG = 2,
  1702. CLONE_SYMBOLS_FLAG = 4;
  1703. /** Used to compose bitmasks for value comparisons. */
  1704. var COMPARE_PARTIAL_FLAG = 1,
  1705. COMPARE_UNORDERED_FLAG = 2;
  1706. /** Used to compose bitmasks for function metadata. */
  1707. var WRAP_BIND_FLAG = 1,
  1708. WRAP_BIND_KEY_FLAG = 2,
  1709. WRAP_CURRY_BOUND_FLAG = 4,
  1710. WRAP_CURRY_FLAG = 8,
  1711. WRAP_CURRY_RIGHT_FLAG = 16,
  1712. WRAP_PARTIAL_FLAG = 32,
  1713. WRAP_PARTIAL_RIGHT_FLAG = 64,
  1714. WRAP_ARY_FLAG = 128,
  1715. WRAP_REARG_FLAG = 256,
  1716. WRAP_FLIP_FLAG = 512;
  1717. /** Used as default options for `_.truncate`. */
  1718. var DEFAULT_TRUNC_LENGTH = 30,
  1719. DEFAULT_TRUNC_OMISSION = '...';
  1720. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  1721. var HOT_COUNT = 800,
  1722. HOT_SPAN = 16;
  1723. /** Used to indicate the type of lazy iteratees. */
  1724. var LAZY_FILTER_FLAG = 1,
  1725. LAZY_MAP_FLAG = 2,
  1726. LAZY_WHILE_FLAG = 3;
  1727. /** Used as references for various `Number` constants. */
  1728. var INFINITY = 1 / 0,
  1729. MAX_SAFE_INTEGER = 9007199254740991,
  1730. MAX_INTEGER = 1.7976931348623157e+308,
  1731. NAN = 0 / 0;
  1732. /** Used as references for the maximum length and index of an array. */
  1733. var MAX_ARRAY_LENGTH = 4294967295,
  1734. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  1735. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  1736. /** Used to associate wrap methods with their bit flags. */
  1737. var wrapFlags = [
  1738. ['ary', WRAP_ARY_FLAG],
  1739. ['bind', WRAP_BIND_FLAG],
  1740. ['bindKey', WRAP_BIND_KEY_FLAG],
  1741. ['curry', WRAP_CURRY_FLAG],
  1742. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  1743. ['flip', WRAP_FLIP_FLAG],
  1744. ['partial', WRAP_PARTIAL_FLAG],
  1745. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  1746. ['rearg', WRAP_REARG_FLAG]
  1747. ];
  1748. /** `Object#toString` result references. */
  1749. var argsTag = '[object Arguments]',
  1750. arrayTag = '[object Array]',
  1751. asyncTag = '[object AsyncFunction]',
  1752. boolTag = '[object Boolean]',
  1753. dateTag = '[object Date]',
  1754. domExcTag = '[object DOMException]',
  1755. errorTag = '[object Error]',
  1756. funcTag = '[object Function]',
  1757. genTag = '[object GeneratorFunction]',
  1758. mapTag = '[object Map]',
  1759. numberTag = '[object Number]',
  1760. nullTag = '[object Null]',
  1761. objectTag = '[object Object]',
  1762. promiseTag = '[object Promise]',
  1763. proxyTag = '[object Proxy]',
  1764. regexpTag = '[object RegExp]',
  1765. setTag = '[object Set]',
  1766. stringTag = '[object String]',
  1767. symbolTag = '[object Symbol]',
  1768. undefinedTag = '[object Undefined]',
  1769. weakMapTag = '[object WeakMap]',
  1770. weakSetTag = '[object WeakSet]';
  1771. var arrayBufferTag = '[object ArrayBuffer]',
  1772. dataViewTag = '[object DataView]',
  1773. float32Tag = '[object Float32Array]',
  1774. float64Tag = '[object Float64Array]',
  1775. int8Tag = '[object Int8Array]',
  1776. int16Tag = '[object Int16Array]',
  1777. int32Tag = '[object Int32Array]',
  1778. uint8Tag = '[object Uint8Array]',
  1779. uint8ClampedTag = '[object Uint8ClampedArray]',
  1780. uint16Tag = '[object Uint16Array]',
  1781. uint32Tag = '[object Uint32Array]';
  1782. /** Used to match empty string literals in compiled template source. */
  1783. var reEmptyStringLeading = /\b__p \+= '';/g,
  1784. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  1785. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  1786. /** Used to match HTML entities and HTML characters. */
  1787. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  1788. reUnescapedHtml = /[&<>"']/g,
  1789. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  1790. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  1791. /** Used to match template delimiters. */
  1792. var reEscape = /<%-([\s\S]+?)%>/g,
  1793. reEvaluate = /<%([\s\S]+?)%>/g,
  1794. reInterpolate = /<%=([\s\S]+?)%>/g;
  1795. /** Used to match property names within property paths. */
  1796. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  1797. reIsPlainProp = /^\w*$/,
  1798. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  1799. /**
  1800. * Used to match `RegExp`
  1801. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  1802. */
  1803. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  1804. reHasRegExpChar = RegExp(reRegExpChar.source);
  1805. /** Used to match leading whitespace. */
  1806. var reTrimStart = /^\s+/;
  1807. /** Used to match a single whitespace character. */
  1808. var reWhitespace = /\s/;
  1809. /** Used to match wrap detail comments. */
  1810. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  1811. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  1812. reSplitDetails = /,? & /;
  1813. /** Used to match words composed of alphanumeric characters. */
  1814. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  1815. /**
  1816. * Used to validate the `validate` option in `_.template` variable.
  1817. *
  1818. * Forbids characters which could potentially change the meaning of the function argument definition:
  1819. * - "()," (modification of function parameters)
  1820. * - "=" (default value)
  1821. * - "[]{}" (destructuring of function parameters)
  1822. * - "/" (beginning of a comment)
  1823. * - whitespace
  1824. */
  1825. var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
  1826. /** Used to match backslashes in property paths. */
  1827. var reEscapeChar = /\\(\\)?/g;
  1828. /**
  1829. * Used to match
  1830. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  1831. */
  1832. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  1833. /** Used to match `RegExp` flags from their coerced string values. */
  1834. var reFlags = /\w*$/;
  1835. /** Used to detect bad signed hexadecimal string values. */
  1836. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  1837. /** Used to detect binary string values. */
  1838. var reIsBinary = /^0b[01]+$/i;
  1839. /** Used to detect host constructors (Safari). */
  1840. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  1841. /** Used to detect octal string values. */
  1842. var reIsOctal = /^0o[0-7]+$/i;
  1843. /** Used to detect unsigned integer values. */
  1844. var reIsUint = /^(?:0|[1-9]\d*)$/;
  1845. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  1846. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  1847. /** Used to ensure capturing order of template delimiters. */
  1848. var reNoMatch = /($^)/;
  1849. /** Used to match unescaped characters in compiled string literals. */
  1850. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  1851. /** Used to compose unicode character classes. */
  1852. var rsAstralRange = '\\ud800-\\udfff',
  1853. rsComboMarksRange = '\\u0300-\\u036f',
  1854. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  1855. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  1856. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  1857. rsDingbatRange = '\\u2700-\\u27bf',
  1858. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  1859. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  1860. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  1861. rsPunctuationRange = '\\u2000-\\u206f',
  1862. 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',
  1863. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  1864. rsVarRange = '\\ufe0e\\ufe0f',
  1865. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  1866. /** Used to compose unicode capture groups. */
  1867. var rsApos = "['\u2019]",
  1868. rsAstral = '[' + rsAstralRange + ']',
  1869. rsBreak = '[' + rsBreakRange + ']',
  1870. rsCombo = '[' + rsComboRange + ']',
  1871. rsDigits = '\\d+',
  1872. rsDingbat = '[' + rsDingbatRange + ']',
  1873. rsLower = '[' + rsLowerRange + ']',
  1874. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  1875. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  1876. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  1877. rsNonAstral = '[^' + rsAstralRange + ']',
  1878. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  1879. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  1880. rsUpper = '[' + rsUpperRange + ']',
  1881. rsZWJ = '\\u200d';
  1882. /** Used to compose unicode regexes. */
  1883. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  1884. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  1885. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  1886. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  1887. reOptMod = rsModifier + '?',
  1888. rsOptVar = '[' + rsVarRange + ']?',
  1889. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  1890. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  1891. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  1892. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  1893. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  1894. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  1895. /** Used to match apostrophes. */
  1896. var reApos = RegExp(rsApos, 'g');
  1897. /**
  1898. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  1899. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  1900. */
  1901. var reComboMark = RegExp(rsCombo, 'g');
  1902. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  1903. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  1904. /** Used to match complex or compound words. */
  1905. var reUnicodeWord = RegExp([
  1906. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  1907. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  1908. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  1909. rsUpper + '+' + rsOptContrUpper,
  1910. rsOrdUpper,
  1911. rsOrdLower,
  1912. rsDigits,
  1913. rsEmoji
  1914. ].join('|'), 'g');
  1915. /** 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/). */
  1916. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  1917. /** Used to detect strings that need a more robust regexp to match words. */
  1918. 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 ]/;
  1919. /** Used to assign default `context` object properties. */
  1920. var contextProps = [
  1921. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  1922. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  1923. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  1924. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  1925. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  1926. ];
  1927. /** Used to make template sourceURLs easier to identify. */
  1928. var templateCounter = -1;
  1929. /** Used to identify `toStringTag` values of typed arrays. */
  1930. var typedArrayTags = {};
  1931. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  1932. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  1933. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  1934. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  1935. typedArrayTags[uint32Tag] = true;
  1936. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  1937. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  1938. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  1939. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  1940. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  1941. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  1942. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  1943. typedArrayTags[weakMapTag] = false;
  1944. /** Used to identify `toStringTag` values supported by `_.clone`. */
  1945. var cloneableTags = {};
  1946. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  1947. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  1948. cloneableTags[boolTag] = cloneableTags[dateTag] =
  1949. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  1950. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  1951. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  1952. cloneableTags[numberTag] = cloneableTags[objectTag] =
  1953. cloneableTags[regexpTag] = cloneableTags[setTag] =
  1954. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  1955. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  1956. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  1957. cloneableTags[errorTag] = cloneableTags[funcTag] =
  1958. cloneableTags[weakMapTag] = false;
  1959. /** Used to map Latin Unicode letters to basic Latin letters. */
  1960. var deburredLetters = {
  1961. // Latin-1 Supplement block.
  1962. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  1963. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  1964. '\xc7': 'C', '\xe7': 'c',
  1965. '\xd0': 'D', '\xf0': 'd',
  1966. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  1967. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  1968. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  1969. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  1970. '\xd1': 'N', '\xf1': 'n',
  1971. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  1972. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  1973. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  1974. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  1975. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  1976. '\xc6': 'Ae', '\xe6': 'ae',
  1977. '\xde': 'Th', '\xfe': 'th',
  1978. '\xdf': 'ss',
  1979. // Latin Extended-A block.
  1980. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  1981. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  1982. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  1983. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  1984. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  1985. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  1986. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  1987. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  1988. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  1989. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  1990. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  1991. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  1992. '\u0134': 'J', '\u0135': 'j',
  1993. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  1994. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  1995. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  1996. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  1997. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  1998. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  1999. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  2000. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  2001. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  2002. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  2003. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  2004. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  2005. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  2006. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  2007. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  2008. '\u0174': 'W', '\u0175': 'w',
  2009. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  2010. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  2011. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  2012. '\u0132': 'IJ', '\u0133': 'ij',
  2013. '\u0152': 'Oe', '\u0153': 'oe',
  2014. '\u0149': "'n", '\u017f': 's'
  2015. };
  2016. /** Used to map characters to HTML entities. */
  2017. var htmlEscapes = {
  2018. '&': '&amp;',
  2019. '<': '&lt;',
  2020. '>': '&gt;',
  2021. '"': '&quot;',
  2022. "'": '&#39;'
  2023. };
  2024. /** Used to map HTML entities to characters. */
  2025. var htmlUnescapes = {
  2026. '&amp;': '&',
  2027. '&lt;': '<',
  2028. '&gt;': '>',
  2029. '&quot;': '"',
  2030. '&#39;': "'"
  2031. };
  2032. /** Used to escape characters for inclusion in compiled string literals. */
  2033. var stringEscapes = {
  2034. '\\': '\\',
  2035. "'": "'",
  2036. '\n': 'n',
  2037. '\r': 'r',
  2038. '\u2028': 'u2028',
  2039. '\u2029': 'u2029'
  2040. };
  2041. /** Built-in method references without a dependency on `root`. */
  2042. var freeParseFloat = parseFloat,
  2043. freeParseInt = parseInt;
  2044. /** Detect free variable `global` from Node.js. */
  2045. var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
  2046. /** Detect free variable `self`. */
  2047. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  2048. /** Used as a reference to the global object. */
  2049. var root = freeGlobal || freeSelf || Function('return this')();
  2050. /** Detect free variable `exports`. */
  2051. var freeExports = true && exports && !exports.nodeType && exports;
  2052. /** Detect free variable `module`. */
  2053. var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module;
  2054. /** Detect the popular CommonJS extension `module.exports`. */
  2055. var moduleExports = freeModule && freeModule.exports === freeExports;
  2056. /** Detect free variable `process` from Node.js. */
  2057. var freeProcess = moduleExports && freeGlobal.process;
  2058. /** Used to access faster Node.js helpers. */
  2059. var nodeUtil = (function() {
  2060. try {
  2061. // Use `util.types` for Node.js 10+.
  2062. var types = freeModule && freeModule.require && freeModule.require('util').types;
  2063. if (types) {
  2064. return types;
  2065. }
  2066. // Legacy `process.binding('util')` for Node.js < 10.
  2067. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  2068. } catch (e) {}
  2069. }());
  2070. /* Node.js helper references. */
  2071. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  2072. nodeIsDate = nodeUtil && nodeUtil.isDate,
  2073. nodeIsMap = nodeUtil && nodeUtil.isMap,
  2074. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  2075. nodeIsSet = nodeUtil && nodeUtil.isSet,
  2076. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  2077. /*--------------------------------------------------------------------------*/
  2078. /**
  2079. * A faster alternative to `Function#apply`, this function invokes `func`
  2080. * with the `this` binding of `thisArg` and the arguments of `args`.
  2081. *
  2082. * @private
  2083. * @param {Function} func The function to invoke.
  2084. * @param {*} thisArg The `this` binding of `func`.
  2085. * @param {Array} args The arguments to invoke `func` with.
  2086. * @returns {*} Returns the result of `func`.
  2087. */
  2088. function apply(func, thisArg, args) {
  2089. switch (args.length) {
  2090. case 0: return func.call(thisArg);
  2091. case 1: return func.call(thisArg, args[0]);
  2092. case 2: return func.call(thisArg, args[0], args[1]);
  2093. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  2094. }
  2095. return func.apply(thisArg, args);
  2096. }
  2097. /**
  2098. * A specialized version of `baseAggregator` for arrays.
  2099. *
  2100. * @private
  2101. * @param {Array} [array] The array to iterate over.
  2102. * @param {Function} setter The function to set `accumulator` values.
  2103. * @param {Function} iteratee The iteratee to transform keys.
  2104. * @param {Object} accumulator The initial aggregated object.
  2105. * @returns {Function} Returns `accumulator`.
  2106. */
  2107. function arrayAggregator(array, setter, iteratee, accumulator) {
  2108. var index = -1,
  2109. length = array == null ? 0 : array.length;
  2110. while (++index < length) {
  2111. var value = array[index];
  2112. setter(accumulator, value, iteratee(value), array);
  2113. }
  2114. return accumulator;
  2115. }
  2116. /**
  2117. * A specialized version of `_.forEach` for arrays without support for
  2118. * iteratee shorthands.
  2119. *
  2120. * @private
  2121. * @param {Array} [array] The array to iterate over.
  2122. * @param {Function} iteratee The function invoked per iteration.
  2123. * @returns {Array} Returns `array`.
  2124. */
  2125. function arrayEach(array, iteratee) {
  2126. var index = -1,
  2127. length = array == null ? 0 : array.length;
  2128. while (++index < length) {
  2129. if (iteratee(array[index], index, array) === false) {
  2130. break;
  2131. }
  2132. }
  2133. return array;
  2134. }
  2135. /**
  2136. * A specialized version of `_.forEachRight` for arrays without support for
  2137. * iteratee shorthands.
  2138. *
  2139. * @private
  2140. * @param {Array} [array] The array to iterate over.
  2141. * @param {Function} iteratee The function invoked per iteration.
  2142. * @returns {Array} Returns `array`.
  2143. */
  2144. function arrayEachRight(array, iteratee) {
  2145. var length = array == null ? 0 : array.length;
  2146. while (length--) {
  2147. if (iteratee(array[length], length, array) === false) {
  2148. break;
  2149. }
  2150. }
  2151. return array;
  2152. }
  2153. /**
  2154. * A specialized version of `_.every` for arrays without support for
  2155. * iteratee shorthands.
  2156. *
  2157. * @private
  2158. * @param {Array} [array] The array to iterate over.
  2159. * @param {Function} predicate The function invoked per iteration.
  2160. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  2161. * else `false`.
  2162. */
  2163. function arrayEvery(array, predicate) {
  2164. var index = -1,
  2165. length = array == null ? 0 : array.length;
  2166. while (++index < length) {
  2167. if (!predicate(array[index], index, array)) {
  2168. return false;
  2169. }
  2170. }
  2171. return true;
  2172. }
  2173. /**
  2174. * A specialized version of `_.filter` for arrays without support for
  2175. * iteratee shorthands.
  2176. *
  2177. * @private
  2178. * @param {Array} [array] The array to iterate over.
  2179. * @param {Function} predicate The function invoked per iteration.
  2180. * @returns {Array} Returns the new filtered array.
  2181. */
  2182. function arrayFilter(array, predicate) {
  2183. var index = -1,
  2184. length = array == null ? 0 : array.length,
  2185. resIndex = 0,
  2186. result = [];
  2187. while (++index < length) {
  2188. var value = array[index];
  2189. if (predicate(value, index, array)) {
  2190. result[resIndex++] = value;
  2191. }
  2192. }
  2193. return result;
  2194. }
  2195. /**
  2196. * A specialized version of `_.includes` for arrays without support for
  2197. * specifying an index to search from.
  2198. *
  2199. * @private
  2200. * @param {Array} [array] The array to inspect.
  2201. * @param {*} target The value to search for.
  2202. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  2203. */
  2204. function arrayIncludes(array, value) {
  2205. var length = array == null ? 0 : array.length;
  2206. return !!length && baseIndexOf(array, value, 0) > -1;
  2207. }
  2208. /**
  2209. * This function is like `arrayIncludes` except that it accepts a comparator.
  2210. *
  2211. * @private
  2212. * @param {Array} [array] The array to inspect.
  2213. * @param {*} target The value to search for.
  2214. * @param {Function} comparator The comparator invoked per element.
  2215. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  2216. */
  2217. function arrayIncludesWith(array, value, comparator) {
  2218. var index = -1,
  2219. length = array == null ? 0 : array.length;
  2220. while (++index < length) {
  2221. if (comparator(value, array[index])) {
  2222. return true;
  2223. }
  2224. }
  2225. return false;
  2226. }
  2227. /**
  2228. * A specialized version of `_.map` for arrays without support for iteratee
  2229. * shorthands.
  2230. *
  2231. * @private
  2232. * @param {Array} [array] The array to iterate over.
  2233. * @param {Function} iteratee The function invoked per iteration.
  2234. * @returns {Array} Returns the new mapped array.
  2235. */
  2236. function arrayMap(array, iteratee) {
  2237. var index = -1,
  2238. length = array == null ? 0 : array.length,
  2239. result = Array(length);
  2240. while (++index < length) {
  2241. result[index] = iteratee(array[index], index, array);
  2242. }
  2243. return result;
  2244. }
  2245. /**
  2246. * Appends the elements of `values` to `array`.
  2247. *
  2248. * @private
  2249. * @param {Array} array The array to modify.
  2250. * @param {Array} values The values to append.
  2251. * @returns {Array} Returns `array`.
  2252. */
  2253. function arrayPush(array, values) {
  2254. var index = -1,
  2255. length = values.length,
  2256. offset = array.length;
  2257. while (++index < length) {
  2258. array[offset + index] = values[index];
  2259. }
  2260. return array;
  2261. }
  2262. /**
  2263. * A specialized version of `_.reduce` for arrays without support for
  2264. * iteratee shorthands.
  2265. *
  2266. * @private
  2267. * @param {Array} [array] The array to iterate over.
  2268. * @param {Function} iteratee The function invoked per iteration.
  2269. * @param {*} [accumulator] The initial value.
  2270. * @param {boolean} [initAccum] Specify using the first element of `array` as
  2271. * the initial value.
  2272. * @returns {*} Returns the accumulated value.
  2273. */
  2274. function arrayReduce(array, iteratee, accumulator, initAccum) {
  2275. var index = -1,
  2276. length = array == null ? 0 : array.length;
  2277. if (initAccum && length) {
  2278. accumulator = array[++index];
  2279. }
  2280. while (++index < length) {
  2281. accumulator = iteratee(accumulator, array[index], index, array);
  2282. }
  2283. return accumulator;
  2284. }
  2285. /**
  2286. * A specialized version of `_.reduceRight` for arrays without support for
  2287. * iteratee shorthands.
  2288. *
  2289. * @private
  2290. * @param {Array} [array] The array to iterate over.
  2291. * @param {Function} iteratee The function invoked per iteration.
  2292. * @param {*} [accumulator] The initial value.
  2293. * @param {boolean} [initAccum] Specify using the last element of `array` as
  2294. * the initial value.
  2295. * @returns {*} Returns the accumulated value.
  2296. */
  2297. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  2298. var length = array == null ? 0 : array.length;
  2299. if (initAccum && length) {
  2300. accumulator = array[--length];
  2301. }
  2302. while (length--) {
  2303. accumulator = iteratee(accumulator, array[length], length, array);
  2304. }
  2305. return accumulator;
  2306. }
  2307. /**
  2308. * A specialized version of `_.some` for arrays without support for iteratee
  2309. * shorthands.
  2310. *
  2311. * @private
  2312. * @param {Array} [array] The array to iterate over.
  2313. * @param {Function} predicate The function invoked per iteration.
  2314. * @returns {boolean} Returns `true` if any element passes the predicate check,
  2315. * else `false`.
  2316. */
  2317. function arraySome(array, predicate) {
  2318. var index = -1,
  2319. length = array == null ? 0 : array.length;
  2320. while (++index < length) {
  2321. if (predicate(array[index], index, array)) {
  2322. return true;
  2323. }
  2324. }
  2325. return false;
  2326. }
  2327. /**
  2328. * Gets the size of an ASCII `string`.
  2329. *
  2330. * @private
  2331. * @param {string} string The string inspect.
  2332. * @returns {number} Returns the string size.
  2333. */
  2334. var asciiSize = baseProperty('length');
  2335. /**
  2336. * Converts an ASCII `string` to an array.
  2337. *
  2338. * @private
  2339. * @param {string} string The string to convert.
  2340. * @returns {Array} Returns the converted array.
  2341. */
  2342. function asciiToArray(string) {
  2343. return string.split('');
  2344. }
  2345. /**
  2346. * Splits an ASCII `string` into an array of its words.
  2347. *
  2348. * @private
  2349. * @param {string} The string to inspect.
  2350. * @returns {Array} Returns the words of `string`.
  2351. */
  2352. function asciiWords(string) {
  2353. return string.match(reAsciiWord) || [];
  2354. }
  2355. /**
  2356. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  2357. * without support for iteratee shorthands, which iterates over `collection`
  2358. * using `eachFunc`.
  2359. *
  2360. * @private
  2361. * @param {Array|Object} collection The collection to inspect.
  2362. * @param {Function} predicate The function invoked per iteration.
  2363. * @param {Function} eachFunc The function to iterate over `collection`.
  2364. * @returns {*} Returns the found element or its key, else `undefined`.
  2365. */
  2366. function baseFindKey(collection, predicate, eachFunc) {
  2367. var result;
  2368. eachFunc(collection, function(value, key, collection) {
  2369. if (predicate(value, key, collection)) {
  2370. result = key;
  2371. return false;
  2372. }
  2373. });
  2374. return result;
  2375. }
  2376. /**
  2377. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  2378. * support for iteratee shorthands.
  2379. *
  2380. * @private
  2381. * @param {Array} array The array to inspect.
  2382. * @param {Function} predicate The function invoked per iteration.
  2383. * @param {number} fromIndex The index to search from.
  2384. * @param {boolean} [fromRight] Specify iterating from right to left.
  2385. * @returns {number} Returns the index of the matched value, else `-1`.
  2386. */
  2387. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  2388. var length = array.length,
  2389. index = fromIndex + (fromRight ? 1 : -1);
  2390. while ((fromRight ? index-- : ++index < length)) {
  2391. if (predicate(array[index], index, array)) {
  2392. return index;
  2393. }
  2394. }
  2395. return -1;
  2396. }
  2397. /**
  2398. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  2399. *
  2400. * @private
  2401. * @param {Array} array The array to inspect.
  2402. * @param {*} value The value to search for.
  2403. * @param {number} fromIndex The index to search from.
  2404. * @returns {number} Returns the index of the matched value, else `-1`.
  2405. */
  2406. function baseIndexOf(array, value, fromIndex) {
  2407. return value === value
  2408. ? strictIndexOf(array, value, fromIndex)
  2409. : baseFindIndex(array, baseIsNaN, fromIndex);
  2410. }
  2411. /**
  2412. * This function is like `baseIndexOf` except that it accepts a comparator.
  2413. *
  2414. * @private
  2415. * @param {Array} array The array to inspect.
  2416. * @param {*} value The value to search for.
  2417. * @param {number} fromIndex The index to search from.
  2418. * @param {Function} comparator The comparator invoked per element.
  2419. * @returns {number} Returns the index of the matched value, else `-1`.
  2420. */
  2421. function baseIndexOfWith(array, value, fromIndex, comparator) {
  2422. var index = fromIndex - 1,
  2423. length = array.length;
  2424. while (++index < length) {
  2425. if (comparator(array[index], value)) {
  2426. return index;
  2427. }
  2428. }
  2429. return -1;
  2430. }
  2431. /**
  2432. * The base implementation of `_.isNaN` without support for number objects.
  2433. *
  2434. * @private
  2435. * @param {*} value The value to check.
  2436. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  2437. */
  2438. function baseIsNaN(value) {
  2439. return value !== value;
  2440. }
  2441. /**
  2442. * The base implementation of `_.mean` and `_.meanBy` without support for
  2443. * iteratee shorthands.
  2444. *
  2445. * @private
  2446. * @param {Array} array The array to iterate over.
  2447. * @param {Function} iteratee The function invoked per iteration.
  2448. * @returns {number} Returns the mean.
  2449. */
  2450. function baseMean(array, iteratee) {
  2451. var length = array == null ? 0 : array.length;
  2452. return length ? (baseSum(array, iteratee) / length) : NAN;
  2453. }
  2454. /**
  2455. * The base implementation of `_.property` without support for deep paths.
  2456. *
  2457. * @private
  2458. * @param {string} key The key of the property to get.
  2459. * @returns {Function} Returns the new accessor function.
  2460. */
  2461. function baseProperty(key) {
  2462. return function(object) {
  2463. return object == null ? undefined : object[key];
  2464. };
  2465. }
  2466. /**
  2467. * The base implementation of `_.propertyOf` without support for deep paths.
  2468. *
  2469. * @private
  2470. * @param {Object} object The object to query.
  2471. * @returns {Function} Returns the new accessor function.
  2472. */
  2473. function basePropertyOf(object) {
  2474. return function(key) {
  2475. return object == null ? undefined : object[key];
  2476. };
  2477. }
  2478. /**
  2479. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  2480. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  2481. *
  2482. * @private
  2483. * @param {Array|Object} collection The collection to iterate over.
  2484. * @param {Function} iteratee The function invoked per iteration.
  2485. * @param {*} accumulator The initial value.
  2486. * @param {boolean} initAccum Specify using the first or last element of
  2487. * `collection` as the initial value.
  2488. * @param {Function} eachFunc The function to iterate over `collection`.
  2489. * @returns {*} Returns the accumulated value.
  2490. */
  2491. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  2492. eachFunc(collection, function(value, index, collection) {
  2493. accumulator = initAccum
  2494. ? (initAccum = false, value)
  2495. : iteratee(accumulator, value, index, collection);
  2496. });
  2497. return accumulator;
  2498. }
  2499. /**
  2500. * The base implementation of `_.sortBy` which uses `comparer` to define the
  2501. * sort order of `array` and replaces criteria objects with their corresponding
  2502. * values.
  2503. *
  2504. * @private
  2505. * @param {Array} array The array to sort.
  2506. * @param {Function} comparer The function to define sort order.
  2507. * @returns {Array} Returns `array`.
  2508. */
  2509. function baseSortBy(array, comparer) {
  2510. var length = array.length;
  2511. array.sort(comparer);
  2512. while (length--) {
  2513. array[length] = array[length].value;
  2514. }
  2515. return array;
  2516. }
  2517. /**
  2518. * The base implementation of `_.sum` and `_.sumBy` without support for
  2519. * iteratee shorthands.
  2520. *
  2521. * @private
  2522. * @param {Array} array The array to iterate over.
  2523. * @param {Function} iteratee The function invoked per iteration.
  2524. * @returns {number} Returns the sum.
  2525. */
  2526. function baseSum(array, iteratee) {
  2527. var result,
  2528. index = -1,
  2529. length = array.length;
  2530. while (++index < length) {
  2531. var current = iteratee(array[index]);
  2532. if (current !== undefined) {
  2533. result = result === undefined ? current : (result + current);
  2534. }
  2535. }
  2536. return result;
  2537. }
  2538. /**
  2539. * The base implementation of `_.times` without support for iteratee shorthands
  2540. * or max array length checks.
  2541. *
  2542. * @private
  2543. * @param {number} n The number of times to invoke `iteratee`.
  2544. * @param {Function} iteratee The function invoked per iteration.
  2545. * @returns {Array} Returns the array of results.
  2546. */
  2547. function baseTimes(n, iteratee) {
  2548. var index = -1,
  2549. result = Array(n);
  2550. while (++index < n) {
  2551. result[index] = iteratee(index);
  2552. }
  2553. return result;
  2554. }
  2555. /**
  2556. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  2557. * of key-value pairs for `object` corresponding to the property names of `props`.
  2558. *
  2559. * @private
  2560. * @param {Object} object The object to query.
  2561. * @param {Array} props The property names to get values for.
  2562. * @returns {Object} Returns the key-value pairs.
  2563. */
  2564. function baseToPairs(object, props) {
  2565. return arrayMap(props, function(key) {
  2566. return [key, object[key]];
  2567. });
  2568. }
  2569. /**
  2570. * The base implementation of `_.trim`.
  2571. *
  2572. * @private
  2573. * @param {string} string The string to trim.
  2574. * @returns {string} Returns the trimmed string.
  2575. */
  2576. function baseTrim(string) {
  2577. return string
  2578. ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
  2579. : string;
  2580. }
  2581. /**
  2582. * The base implementation of `_.unary` without support for storing metadata.
  2583. *
  2584. * @private
  2585. * @param {Function} func The function to cap arguments for.
  2586. * @returns {Function} Returns the new capped function.
  2587. */
  2588. function baseUnary(func) {
  2589. return function(value) {
  2590. return func(value);
  2591. };
  2592. }
  2593. /**
  2594. * The base implementation of `_.values` and `_.valuesIn` which creates an
  2595. * array of `object` property values corresponding to the property names
  2596. * of `props`.
  2597. *
  2598. * @private
  2599. * @param {Object} object The object to query.
  2600. * @param {Array} props The property names to get values for.
  2601. * @returns {Object} Returns the array of property values.
  2602. */
  2603. function baseValues(object, props) {
  2604. return arrayMap(props, function(key) {
  2605. return object[key];
  2606. });
  2607. }
  2608. /**
  2609. * Checks if a `cache` value for `key` exists.
  2610. *
  2611. * @private
  2612. * @param {Object} cache The cache to query.
  2613. * @param {string} key The key of the entry to check.
  2614. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2615. */
  2616. function cacheHas(cache, key) {
  2617. return cache.has(key);
  2618. }
  2619. /**
  2620. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  2621. * that is not found in the character symbols.
  2622. *
  2623. * @private
  2624. * @param {Array} strSymbols The string symbols to inspect.
  2625. * @param {Array} chrSymbols The character symbols to find.
  2626. * @returns {number} Returns the index of the first unmatched string symbol.
  2627. */
  2628. function charsStartIndex(strSymbols, chrSymbols) {
  2629. var index = -1,
  2630. length = strSymbols.length;
  2631. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  2632. return index;
  2633. }
  2634. /**
  2635. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  2636. * that is not found in the character symbols.
  2637. *
  2638. * @private
  2639. * @param {Array} strSymbols The string symbols to inspect.
  2640. * @param {Array} chrSymbols The character symbols to find.
  2641. * @returns {number} Returns the index of the last unmatched string symbol.
  2642. */
  2643. function charsEndIndex(strSymbols, chrSymbols) {
  2644. var index = strSymbols.length;
  2645. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  2646. return index;
  2647. }
  2648. /**
  2649. * Gets the number of `placeholder` occurrences in `array`.
  2650. *
  2651. * @private
  2652. * @param {Array} array The array to inspect.
  2653. * @param {*} placeholder The placeholder to search for.
  2654. * @returns {number} Returns the placeholder count.
  2655. */
  2656. function countHolders(array, placeholder) {
  2657. var length = array.length,
  2658. result = 0;
  2659. while (length--) {
  2660. if (array[length] === placeholder) {
  2661. ++result;
  2662. }
  2663. }
  2664. return result;
  2665. }
  2666. /**
  2667. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  2668. * letters to basic Latin letters.
  2669. *
  2670. * @private
  2671. * @param {string} letter The matched letter to deburr.
  2672. * @returns {string} Returns the deburred letter.
  2673. */
  2674. var deburrLetter = basePropertyOf(deburredLetters);
  2675. /**
  2676. * Used by `_.escape` to convert characters to HTML entities.
  2677. *
  2678. * @private
  2679. * @param {string} chr The matched character to escape.
  2680. * @returns {string} Returns the escaped character.
  2681. */
  2682. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  2683. /**
  2684. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  2685. *
  2686. * @private
  2687. * @param {string} chr The matched character to escape.
  2688. * @returns {string} Returns the escaped character.
  2689. */
  2690. function escapeStringChar(chr) {
  2691. return '\\' + stringEscapes[chr];
  2692. }
  2693. /**
  2694. * Gets the value at `key` of `object`.
  2695. *
  2696. * @private
  2697. * @param {Object} [object] The object to query.
  2698. * @param {string} key The key of the property to get.
  2699. * @returns {*} Returns the property value.
  2700. */
  2701. function getValue(object, key) {
  2702. return object == null ? undefined : object[key];
  2703. }
  2704. /**
  2705. * Checks if `string` contains Unicode symbols.
  2706. *
  2707. * @private
  2708. * @param {string} string The string to inspect.
  2709. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  2710. */
  2711. function hasUnicode(string) {
  2712. return reHasUnicode.test(string);
  2713. }
  2714. /**
  2715. * Checks if `string` contains a word composed of Unicode symbols.
  2716. *
  2717. * @private
  2718. * @param {string} string The string to inspect.
  2719. * @returns {boolean} Returns `true` if a word is found, else `false`.
  2720. */
  2721. function hasUnicodeWord(string) {
  2722. return reHasUnicodeWord.test(string);
  2723. }
  2724. /**
  2725. * Converts `iterator` to an array.
  2726. *
  2727. * @private
  2728. * @param {Object} iterator The iterator to convert.
  2729. * @returns {Array} Returns the converted array.
  2730. */
  2731. function iteratorToArray(iterator) {
  2732. var data,
  2733. result = [];
  2734. while (!(data = iterator.next()).done) {
  2735. result.push(data.value);
  2736. }
  2737. return result;
  2738. }
  2739. /**
  2740. * Converts `map` to its key-value pairs.
  2741. *
  2742. * @private
  2743. * @param {Object} map The map to convert.
  2744. * @returns {Array} Returns the key-value pairs.
  2745. */
  2746. function mapToArray(map) {
  2747. var index = -1,
  2748. result = Array(map.size);
  2749. map.forEach(function(value, key) {
  2750. result[++index] = [key, value];
  2751. });
  2752. return result;
  2753. }
  2754. /**
  2755. * Creates a unary function that invokes `func` with its argument transformed.
  2756. *
  2757. * @private
  2758. * @param {Function} func The function to wrap.
  2759. * @param {Function} transform The argument transform.
  2760. * @returns {Function} Returns the new function.
  2761. */
  2762. function overArg(func, transform) {
  2763. return function(arg) {
  2764. return func(transform(arg));
  2765. };
  2766. }
  2767. /**
  2768. * Replaces all `placeholder` elements in `array` with an internal placeholder
  2769. * and returns an array of their indexes.
  2770. *
  2771. * @private
  2772. * @param {Array} array The array to modify.
  2773. * @param {*} placeholder The placeholder to replace.
  2774. * @returns {Array} Returns the new array of placeholder indexes.
  2775. */
  2776. function replaceHolders(array, placeholder) {
  2777. var index = -1,
  2778. length = array.length,
  2779. resIndex = 0,
  2780. result = [];
  2781. while (++index < length) {
  2782. var value = array[index];
  2783. if (value === placeholder || value === PLACEHOLDER) {
  2784. array[index] = PLACEHOLDER;
  2785. result[resIndex++] = index;
  2786. }
  2787. }
  2788. return result;
  2789. }
  2790. /**
  2791. * Converts `set` to an array of its values.
  2792. *
  2793. * @private
  2794. * @param {Object} set The set to convert.
  2795. * @returns {Array} Returns the values.
  2796. */
  2797. function setToArray(set) {
  2798. var index = -1,
  2799. result = Array(set.size);
  2800. set.forEach(function(value) {
  2801. result[++index] = value;
  2802. });
  2803. return result;
  2804. }
  2805. /**
  2806. * Converts `set` to its value-value pairs.
  2807. *
  2808. * @private
  2809. * @param {Object} set The set to convert.
  2810. * @returns {Array} Returns the value-value pairs.
  2811. */
  2812. function setToPairs(set) {
  2813. var index = -1,
  2814. result = Array(set.size);
  2815. set.forEach(function(value) {
  2816. result[++index] = [value, value];
  2817. });
  2818. return result;
  2819. }
  2820. /**
  2821. * A specialized version of `_.indexOf` which performs strict equality
  2822. * comparisons of values, i.e. `===`.
  2823. *
  2824. * @private
  2825. * @param {Array} array The array to inspect.
  2826. * @param {*} value The value to search for.
  2827. * @param {number} fromIndex The index to search from.
  2828. * @returns {number} Returns the index of the matched value, else `-1`.
  2829. */
  2830. function strictIndexOf(array, value, fromIndex) {
  2831. var index = fromIndex - 1,
  2832. length = array.length;
  2833. while (++index < length) {
  2834. if (array[index] === value) {
  2835. return index;
  2836. }
  2837. }
  2838. return -1;
  2839. }
  2840. /**
  2841. * A specialized version of `_.lastIndexOf` which performs strict equality
  2842. * comparisons of values, i.e. `===`.
  2843. *
  2844. * @private
  2845. * @param {Array} array The array to inspect.
  2846. * @param {*} value The value to search for.
  2847. * @param {number} fromIndex The index to search from.
  2848. * @returns {number} Returns the index of the matched value, else `-1`.
  2849. */
  2850. function strictLastIndexOf(array, value, fromIndex) {
  2851. var index = fromIndex + 1;
  2852. while (index--) {
  2853. if (array[index] === value) {
  2854. return index;
  2855. }
  2856. }
  2857. return index;
  2858. }
  2859. /**
  2860. * Gets the number of symbols in `string`.
  2861. *
  2862. * @private
  2863. * @param {string} string The string to inspect.
  2864. * @returns {number} Returns the string size.
  2865. */
  2866. function stringSize(string) {
  2867. return hasUnicode(string)
  2868. ? unicodeSize(string)
  2869. : asciiSize(string);
  2870. }
  2871. /**
  2872. * Converts `string` to an array.
  2873. *
  2874. * @private
  2875. * @param {string} string The string to convert.
  2876. * @returns {Array} Returns the converted array.
  2877. */
  2878. function stringToArray(string) {
  2879. return hasUnicode(string)
  2880. ? unicodeToArray(string)
  2881. : asciiToArray(string);
  2882. }
  2883. /**
  2884. * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
  2885. * character of `string`.
  2886. *
  2887. * @private
  2888. * @param {string} string The string to inspect.
  2889. * @returns {number} Returns the index of the last non-whitespace character.
  2890. */
  2891. function trimmedEndIndex(string) {
  2892. var index = string.length;
  2893. while (index-- && reWhitespace.test(string.charAt(index))) {}
  2894. return index;
  2895. }
  2896. /**
  2897. * Used by `_.unescape` to convert HTML entities to characters.
  2898. *
  2899. * @private
  2900. * @param {string} chr The matched character to unescape.
  2901. * @returns {string} Returns the unescaped character.
  2902. */
  2903. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  2904. /**
  2905. * Gets the size of a Unicode `string`.
  2906. *
  2907. * @private
  2908. * @param {string} string The string inspect.
  2909. * @returns {number} Returns the string size.
  2910. */
  2911. function unicodeSize(string) {
  2912. var result = reUnicode.lastIndex = 0;
  2913. while (reUnicode.test(string)) {
  2914. ++result;
  2915. }
  2916. return result;
  2917. }
  2918. /**
  2919. * Converts a Unicode `string` to an array.
  2920. *
  2921. * @private
  2922. * @param {string} string The string to convert.
  2923. * @returns {Array} Returns the converted array.
  2924. */
  2925. function unicodeToArray(string) {
  2926. return string.match(reUnicode) || [];
  2927. }
  2928. /**
  2929. * Splits a Unicode `string` into an array of its words.
  2930. *
  2931. * @private
  2932. * @param {string} The string to inspect.
  2933. * @returns {Array} Returns the words of `string`.
  2934. */
  2935. function unicodeWords(string) {
  2936. return string.match(reUnicodeWord) || [];
  2937. }
  2938. /*--------------------------------------------------------------------------*/
  2939. /**
  2940. * Create a new pristine `lodash` function using the `context` object.
  2941. *
  2942. * @static
  2943. * @memberOf _
  2944. * @since 1.1.0
  2945. * @category Util
  2946. * @param {Object} [context=root] The context object.
  2947. * @returns {Function} Returns a new `lodash` function.
  2948. * @example
  2949. *
  2950. * _.mixin({ 'foo': _.constant('foo') });
  2951. *
  2952. * var lodash = _.runInContext();
  2953. * lodash.mixin({ 'bar': lodash.constant('bar') });
  2954. *
  2955. * _.isFunction(_.foo);
  2956. * // => true
  2957. * _.isFunction(_.bar);
  2958. * // => false
  2959. *
  2960. * lodash.isFunction(lodash.foo);
  2961. * // => false
  2962. * lodash.isFunction(lodash.bar);
  2963. * // => true
  2964. *
  2965. * // Create a suped-up `defer` in Node.js.
  2966. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  2967. */
  2968. var runInContext = (function runInContext(context) {
  2969. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  2970. /** Built-in constructor references. */
  2971. var Array = context.Array,
  2972. Date = context.Date,
  2973. Error = context.Error,
  2974. Function = context.Function,
  2975. Math = context.Math,
  2976. Object = context.Object,
  2977. RegExp = context.RegExp,
  2978. String = context.String,
  2979. TypeError = context.TypeError;
  2980. /** Used for built-in method references. */
  2981. var arrayProto = Array.prototype,
  2982. funcProto = Function.prototype,
  2983. objectProto = Object.prototype;
  2984. /** Used to detect overreaching core-js shims. */
  2985. var coreJsData = context['__core-js_shared__'];
  2986. /** Used to resolve the decompiled source of functions. */
  2987. var funcToString = funcProto.toString;
  2988. /** Used to check objects for own properties. */
  2989. var hasOwnProperty = objectProto.hasOwnProperty;
  2990. /** Used to generate unique IDs. */
  2991. var idCounter = 0;
  2992. /** Used to detect methods masquerading as native. */
  2993. var maskSrcKey = (function() {
  2994. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  2995. return uid ? ('Symbol(src)_1.' + uid) : '';
  2996. }());
  2997. /**
  2998. * Used to resolve the
  2999. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  3000. * of values.
  3001. */
  3002. var nativeObjectToString = objectProto.toString;
  3003. /** Used to infer the `Object` constructor. */
  3004. var objectCtorString = funcToString.call(Object);
  3005. /** Used to restore the original `_` reference in `_.noConflict`. */
  3006. var oldDash = root._;
  3007. /** Used to detect if a method is native. */
  3008. var reIsNative = RegExp('^' +
  3009. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  3010. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  3011. );
  3012. /** Built-in value references. */
  3013. var Buffer = moduleExports ? context.Buffer : undefined,
  3014. Symbol = context.Symbol,
  3015. Uint8Array = context.Uint8Array,
  3016. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  3017. getPrototype = overArg(Object.getPrototypeOf, Object),
  3018. objectCreate = Object.create,
  3019. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  3020. splice = arrayProto.splice,
  3021. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  3022. symIterator = Symbol ? Symbol.iterator : undefined,
  3023. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  3024. var defineProperty = (function() {
  3025. try {
  3026. var func = getNative(Object, 'defineProperty');
  3027. func({}, '', {});
  3028. return func;
  3029. } catch (e) {}
  3030. }());
  3031. /** Mocked built-ins. */
  3032. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  3033. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  3034. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  3035. /* Built-in method references for those with the same name as other `lodash` methods. */
  3036. var nativeCeil = Math.ceil,
  3037. nativeFloor = Math.floor,
  3038. nativeGetSymbols = Object.getOwnPropertySymbols,
  3039. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  3040. nativeIsFinite = context.isFinite,
  3041. nativeJoin = arrayProto.join,
  3042. nativeKeys = overArg(Object.keys, Object),
  3043. nativeMax = Math.max,
  3044. nativeMin = Math.min,
  3045. nativeNow = Date.now,
  3046. nativeParseInt = context.parseInt,
  3047. nativeRandom = Math.random,
  3048. nativeReverse = arrayProto.reverse;
  3049. /* Built-in method references that are verified to be native. */
  3050. var DataView = getNative(context, 'DataView'),
  3051. Map = getNative(context, 'Map'),
  3052. Promise = getNative(context, 'Promise'),
  3053. Set = getNative(context, 'Set'),
  3054. WeakMap = getNative(context, 'WeakMap'),
  3055. nativeCreate = getNative(Object, 'create');
  3056. /** Used to store function metadata. */
  3057. var metaMap = WeakMap && new WeakMap;
  3058. /** Used to lookup unminified function names. */
  3059. var realNames = {};
  3060. /** Used to detect maps, sets, and weakmaps. */
  3061. var dataViewCtorString = toSource(DataView),
  3062. mapCtorString = toSource(Map),
  3063. promiseCtorString = toSource(Promise),
  3064. setCtorString = toSource(Set),
  3065. weakMapCtorString = toSource(WeakMap);
  3066. /** Used to convert symbols to primitives and strings. */
  3067. var symbolProto = Symbol ? Symbol.prototype : undefined,
  3068. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  3069. symbolToString = symbolProto ? symbolProto.toString : undefined;
  3070. /*------------------------------------------------------------------------*/
  3071. /**
  3072. * Creates a `lodash` object which wraps `value` to enable implicit method
  3073. * chain sequences. Methods that operate on and return arrays, collections,
  3074. * and functions can be chained together. Methods that retrieve a single value
  3075. * or may return a primitive value will automatically end the chain sequence
  3076. * and return the unwrapped value. Otherwise, the value must be unwrapped
  3077. * with `_#value`.
  3078. *
  3079. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  3080. * enabled using `_.chain`.
  3081. *
  3082. * The execution of chained methods is lazy, that is, it's deferred until
  3083. * `_#value` is implicitly or explicitly called.
  3084. *
  3085. * Lazy evaluation allows several methods to support shortcut fusion.
  3086. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  3087. * the creation of intermediate arrays and can greatly reduce the number of
  3088. * iteratee executions. Sections of a chain sequence qualify for shortcut
  3089. * fusion if the section is applied to an array and iteratees accept only
  3090. * one argument. The heuristic for whether a section qualifies for shortcut
  3091. * fusion is subject to change.
  3092. *
  3093. * Chaining is supported in custom builds as long as the `_#value` method is
  3094. * directly or indirectly included in the build.
  3095. *
  3096. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  3097. *
  3098. * The wrapper `Array` methods are:
  3099. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  3100. *
  3101. * The wrapper `String` methods are:
  3102. * `replace` and `split`
  3103. *
  3104. * The wrapper methods that support shortcut fusion are:
  3105. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  3106. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  3107. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  3108. *
  3109. * The chainable wrapper methods are:
  3110. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  3111. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  3112. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  3113. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  3114. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  3115. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  3116. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  3117. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  3118. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  3119. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  3120. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  3121. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  3122. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  3123. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  3124. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  3125. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  3126. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  3127. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  3128. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  3129. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  3130. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  3131. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  3132. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  3133. * `zipObject`, `zipObjectDeep`, and `zipWith`
  3134. *
  3135. * The wrapper methods that are **not** chainable by default are:
  3136. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  3137. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  3138. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  3139. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  3140. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  3141. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  3142. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  3143. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  3144. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  3145. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  3146. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  3147. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  3148. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  3149. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  3150. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  3151. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  3152. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  3153. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  3154. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  3155. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  3156. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  3157. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  3158. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  3159. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  3160. * `upperFirst`, `value`, and `words`
  3161. *
  3162. * @name _
  3163. * @constructor
  3164. * @category Seq
  3165. * @param {*} value The value to wrap in a `lodash` instance.
  3166. * @returns {Object} Returns the new `lodash` wrapper instance.
  3167. * @example
  3168. *
  3169. * function square(n) {
  3170. * return n * n;
  3171. * }
  3172. *
  3173. * var wrapped = _([1, 2, 3]);
  3174. *
  3175. * // Returns an unwrapped value.
  3176. * wrapped.reduce(_.add);
  3177. * // => 6
  3178. *
  3179. * // Returns a wrapped value.
  3180. * var squares = wrapped.map(square);
  3181. *
  3182. * _.isArray(squares);
  3183. * // => false
  3184. *
  3185. * _.isArray(squares.value());
  3186. * // => true
  3187. */
  3188. function lodash(value) {
  3189. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  3190. if (value instanceof LodashWrapper) {
  3191. return value;
  3192. }
  3193. if (hasOwnProperty.call(value, '__wrapped__')) {
  3194. return wrapperClone(value);
  3195. }
  3196. }
  3197. return new LodashWrapper(value);
  3198. }
  3199. /**
  3200. * The base implementation of `_.create` without support for assigning
  3201. * properties to the created object.
  3202. *
  3203. * @private
  3204. * @param {Object} proto The object to inherit from.
  3205. * @returns {Object} Returns the new object.
  3206. */
  3207. var baseCreate = (function() {
  3208. function object() {}
  3209. return function(proto) {
  3210. if (!isObject(proto)) {
  3211. return {};
  3212. }
  3213. if (objectCreate) {
  3214. return objectCreate(proto);
  3215. }
  3216. object.prototype = proto;
  3217. var result = new object;
  3218. object.prototype = undefined;
  3219. return result;
  3220. };
  3221. }());
  3222. /**
  3223. * The function whose prototype chain sequence wrappers inherit from.
  3224. *
  3225. * @private
  3226. */
  3227. function baseLodash() {
  3228. // No operation performed.
  3229. }
  3230. /**
  3231. * The base constructor for creating `lodash` wrapper objects.
  3232. *
  3233. * @private
  3234. * @param {*} value The value to wrap.
  3235. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  3236. */
  3237. function LodashWrapper(value, chainAll) {
  3238. this.__wrapped__ = value;
  3239. this.__actions__ = [];
  3240. this.__chain__ = !!chainAll;
  3241. this.__index__ = 0;
  3242. this.__values__ = undefined;
  3243. }
  3244. /**
  3245. * By default, the template delimiters used by lodash are like those in
  3246. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  3247. * following template settings to use alternative delimiters.
  3248. *
  3249. * @static
  3250. * @memberOf _
  3251. * @type {Object}
  3252. */
  3253. lodash.templateSettings = {
  3254. /**
  3255. * Used to detect `data` property values to be HTML-escaped.
  3256. *
  3257. * @memberOf _.templateSettings
  3258. * @type {RegExp}
  3259. */
  3260. 'escape': reEscape,
  3261. /**
  3262. * Used to detect code to be evaluated.
  3263. *
  3264. * @memberOf _.templateSettings
  3265. * @type {RegExp}
  3266. */
  3267. 'evaluate': reEvaluate,
  3268. /**
  3269. * Used to detect `data` property values to inject.
  3270. *
  3271. * @memberOf _.templateSettings
  3272. * @type {RegExp}
  3273. */
  3274. 'interpolate': reInterpolate,
  3275. /**
  3276. * Used to reference the data object in the template text.
  3277. *
  3278. * @memberOf _.templateSettings
  3279. * @type {string}
  3280. */
  3281. 'variable': '',
  3282. /**
  3283. * Used to import variables into the compiled template.
  3284. *
  3285. * @memberOf _.templateSettings
  3286. * @type {Object}
  3287. */
  3288. 'imports': {
  3289. /**
  3290. * A reference to the `lodash` function.
  3291. *
  3292. * @memberOf _.templateSettings.imports
  3293. * @type {Function}
  3294. */
  3295. '_': lodash
  3296. }
  3297. };
  3298. // Ensure wrappers are instances of `baseLodash`.
  3299. lodash.prototype = baseLodash.prototype;
  3300. lodash.prototype.constructor = lodash;
  3301. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  3302. LodashWrapper.prototype.constructor = LodashWrapper;
  3303. /*------------------------------------------------------------------------*/
  3304. /**
  3305. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  3306. *
  3307. * @private
  3308. * @constructor
  3309. * @param {*} value The value to wrap.
  3310. */
  3311. function LazyWrapper(value) {
  3312. this.__wrapped__ = value;
  3313. this.__actions__ = [];
  3314. this.__dir__ = 1;
  3315. this.__filtered__ = false;
  3316. this.__iteratees__ = [];
  3317. this.__takeCount__ = MAX_ARRAY_LENGTH;
  3318. this.__views__ = [];
  3319. }
  3320. /**
  3321. * Creates a clone of the lazy wrapper object.
  3322. *
  3323. * @private
  3324. * @name clone
  3325. * @memberOf LazyWrapper
  3326. * @returns {Object} Returns the cloned `LazyWrapper` object.
  3327. */
  3328. function lazyClone() {
  3329. var result = new LazyWrapper(this.__wrapped__);
  3330. result.__actions__ = copyArray(this.__actions__);
  3331. result.__dir__ = this.__dir__;
  3332. result.__filtered__ = this.__filtered__;
  3333. result.__iteratees__ = copyArray(this.__iteratees__);
  3334. result.__takeCount__ = this.__takeCount__;
  3335. result.__views__ = copyArray(this.__views__);
  3336. return result;
  3337. }
  3338. /**
  3339. * Reverses the direction of lazy iteration.
  3340. *
  3341. * @private
  3342. * @name reverse
  3343. * @memberOf LazyWrapper
  3344. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  3345. */
  3346. function lazyReverse() {
  3347. if (this.__filtered__) {
  3348. var result = new LazyWrapper(this);
  3349. result.__dir__ = -1;
  3350. result.__filtered__ = true;
  3351. } else {
  3352. result = this.clone();
  3353. result.__dir__ *= -1;
  3354. }
  3355. return result;
  3356. }
  3357. /**
  3358. * Extracts the unwrapped value from its lazy wrapper.
  3359. *
  3360. * @private
  3361. * @name value
  3362. * @memberOf LazyWrapper
  3363. * @returns {*} Returns the unwrapped value.
  3364. */
  3365. function lazyValue() {
  3366. var array = this.__wrapped__.value(),
  3367. dir = this.__dir__,
  3368. isArr = isArray(array),
  3369. isRight = dir < 0,
  3370. arrLength = isArr ? array.length : 0,
  3371. view = getView(0, arrLength, this.__views__),
  3372. start = view.start,
  3373. end = view.end,
  3374. length = end - start,
  3375. index = isRight ? end : (start - 1),
  3376. iteratees = this.__iteratees__,
  3377. iterLength = iteratees.length,
  3378. resIndex = 0,
  3379. takeCount = nativeMin(length, this.__takeCount__);
  3380. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  3381. return baseWrapperValue(array, this.__actions__);
  3382. }
  3383. var result = [];
  3384. outer:
  3385. while (length-- && resIndex < takeCount) {
  3386. index += dir;
  3387. var iterIndex = -1,
  3388. value = array[index];
  3389. while (++iterIndex < iterLength) {
  3390. var data = iteratees[iterIndex],
  3391. iteratee = data.iteratee,
  3392. type = data.type,
  3393. computed = iteratee(value);
  3394. if (type == LAZY_MAP_FLAG) {
  3395. value = computed;
  3396. } else if (!computed) {
  3397. if (type == LAZY_FILTER_FLAG) {
  3398. continue outer;
  3399. } else {
  3400. break outer;
  3401. }
  3402. }
  3403. }
  3404. result[resIndex++] = value;
  3405. }
  3406. return result;
  3407. }
  3408. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  3409. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  3410. LazyWrapper.prototype.constructor = LazyWrapper;
  3411. /*------------------------------------------------------------------------*/
  3412. /**
  3413. * Creates a hash object.
  3414. *
  3415. * @private
  3416. * @constructor
  3417. * @param {Array} [entries] The key-value pairs to cache.
  3418. */
  3419. function Hash(entries) {
  3420. var index = -1,
  3421. length = entries == null ? 0 : entries.length;
  3422. this.clear();
  3423. while (++index < length) {
  3424. var entry = entries[index];
  3425. this.set(entry[0], entry[1]);
  3426. }
  3427. }
  3428. /**
  3429. * Removes all key-value entries from the hash.
  3430. *
  3431. * @private
  3432. * @name clear
  3433. * @memberOf Hash
  3434. */
  3435. function hashClear() {
  3436. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  3437. this.size = 0;
  3438. }
  3439. /**
  3440. * Removes `key` and its value from the hash.
  3441. *
  3442. * @private
  3443. * @name delete
  3444. * @memberOf Hash
  3445. * @param {Object} hash The hash to modify.
  3446. * @param {string} key The key of the value to remove.
  3447. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3448. */
  3449. function hashDelete(key) {
  3450. var result = this.has(key) && delete this.__data__[key];
  3451. this.size -= result ? 1 : 0;
  3452. return result;
  3453. }
  3454. /**
  3455. * Gets the hash value for `key`.
  3456. *
  3457. * @private
  3458. * @name get
  3459. * @memberOf Hash
  3460. * @param {string} key The key of the value to get.
  3461. * @returns {*} Returns the entry value.
  3462. */
  3463. function hashGet(key) {
  3464. var data = this.__data__;
  3465. if (nativeCreate) {
  3466. var result = data[key];
  3467. return result === HASH_UNDEFINED ? undefined : result;
  3468. }
  3469. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  3470. }
  3471. /**
  3472. * Checks if a hash value for `key` exists.
  3473. *
  3474. * @private
  3475. * @name has
  3476. * @memberOf Hash
  3477. * @param {string} key The key of the entry to check.
  3478. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3479. */
  3480. function hashHas(key) {
  3481. var data = this.__data__;
  3482. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  3483. }
  3484. /**
  3485. * Sets the hash `key` to `value`.
  3486. *
  3487. * @private
  3488. * @name set
  3489. * @memberOf Hash
  3490. * @param {string} key The key of the value to set.
  3491. * @param {*} value The value to set.
  3492. * @returns {Object} Returns the hash instance.
  3493. */
  3494. function hashSet(key, value) {
  3495. var data = this.__data__;
  3496. this.size += this.has(key) ? 0 : 1;
  3497. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  3498. return this;
  3499. }
  3500. // Add methods to `Hash`.
  3501. Hash.prototype.clear = hashClear;
  3502. Hash.prototype['delete'] = hashDelete;
  3503. Hash.prototype.get = hashGet;
  3504. Hash.prototype.has = hashHas;
  3505. Hash.prototype.set = hashSet;
  3506. /*------------------------------------------------------------------------*/
  3507. /**
  3508. * Creates an list cache object.
  3509. *
  3510. * @private
  3511. * @constructor
  3512. * @param {Array} [entries] The key-value pairs to cache.
  3513. */
  3514. function ListCache(entries) {
  3515. var index = -1,
  3516. length = entries == null ? 0 : entries.length;
  3517. this.clear();
  3518. while (++index < length) {
  3519. var entry = entries[index];
  3520. this.set(entry[0], entry[1]);
  3521. }
  3522. }
  3523. /**
  3524. * Removes all key-value entries from the list cache.
  3525. *
  3526. * @private
  3527. * @name clear
  3528. * @memberOf ListCache
  3529. */
  3530. function listCacheClear() {
  3531. this.__data__ = [];
  3532. this.size = 0;
  3533. }
  3534. /**
  3535. * Removes `key` and its value from the list cache.
  3536. *
  3537. * @private
  3538. * @name delete
  3539. * @memberOf ListCache
  3540. * @param {string} key The key of the value to remove.
  3541. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3542. */
  3543. function listCacheDelete(key) {
  3544. var data = this.__data__,
  3545. index = assocIndexOf(data, key);
  3546. if (index < 0) {
  3547. return false;
  3548. }
  3549. var lastIndex = data.length - 1;
  3550. if (index == lastIndex) {
  3551. data.pop();
  3552. } else {
  3553. splice.call(data, index, 1);
  3554. }
  3555. --this.size;
  3556. return true;
  3557. }
  3558. /**
  3559. * Gets the list cache value for `key`.
  3560. *
  3561. * @private
  3562. * @name get
  3563. * @memberOf ListCache
  3564. * @param {string} key The key of the value to get.
  3565. * @returns {*} Returns the entry value.
  3566. */
  3567. function listCacheGet(key) {
  3568. var data = this.__data__,
  3569. index = assocIndexOf(data, key);
  3570. return index < 0 ? undefined : data[index][1];
  3571. }
  3572. /**
  3573. * Checks if a list cache value for `key` exists.
  3574. *
  3575. * @private
  3576. * @name has
  3577. * @memberOf ListCache
  3578. * @param {string} key The key of the entry to check.
  3579. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3580. */
  3581. function listCacheHas(key) {
  3582. return assocIndexOf(this.__data__, key) > -1;
  3583. }
  3584. /**
  3585. * Sets the list cache `key` to `value`.
  3586. *
  3587. * @private
  3588. * @name set
  3589. * @memberOf ListCache
  3590. * @param {string} key The key of the value to set.
  3591. * @param {*} value The value to set.
  3592. * @returns {Object} Returns the list cache instance.
  3593. */
  3594. function listCacheSet(key, value) {
  3595. var data = this.__data__,
  3596. index = assocIndexOf(data, key);
  3597. if (index < 0) {
  3598. ++this.size;
  3599. data.push([key, value]);
  3600. } else {
  3601. data[index][1] = value;
  3602. }
  3603. return this;
  3604. }
  3605. // Add methods to `ListCache`.
  3606. ListCache.prototype.clear = listCacheClear;
  3607. ListCache.prototype['delete'] = listCacheDelete;
  3608. ListCache.prototype.get = listCacheGet;
  3609. ListCache.prototype.has = listCacheHas;
  3610. ListCache.prototype.set = listCacheSet;
  3611. /*------------------------------------------------------------------------*/
  3612. /**
  3613. * Creates a map cache object to store key-value pairs.
  3614. *
  3615. * @private
  3616. * @constructor
  3617. * @param {Array} [entries] The key-value pairs to cache.
  3618. */
  3619. function MapCache(entries) {
  3620. var index = -1,
  3621. length = entries == null ? 0 : entries.length;
  3622. this.clear();
  3623. while (++index < length) {
  3624. var entry = entries[index];
  3625. this.set(entry[0], entry[1]);
  3626. }
  3627. }
  3628. /**
  3629. * Removes all key-value entries from the map.
  3630. *
  3631. * @private
  3632. * @name clear
  3633. * @memberOf MapCache
  3634. */
  3635. function mapCacheClear() {
  3636. this.size = 0;
  3637. this.__data__ = {
  3638. 'hash': new Hash,
  3639. 'map': new (Map || ListCache),
  3640. 'string': new Hash
  3641. };
  3642. }
  3643. /**
  3644. * Removes `key` and its value from the map.
  3645. *
  3646. * @private
  3647. * @name delete
  3648. * @memberOf MapCache
  3649. * @param {string} key The key of the value to remove.
  3650. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3651. */
  3652. function mapCacheDelete(key) {
  3653. var result = getMapData(this, key)['delete'](key);
  3654. this.size -= result ? 1 : 0;
  3655. return result;
  3656. }
  3657. /**
  3658. * Gets the map value for `key`.
  3659. *
  3660. * @private
  3661. * @name get
  3662. * @memberOf MapCache
  3663. * @param {string} key The key of the value to get.
  3664. * @returns {*} Returns the entry value.
  3665. */
  3666. function mapCacheGet(key) {
  3667. return getMapData(this, key).get(key);
  3668. }
  3669. /**
  3670. * Checks if a map value for `key` exists.
  3671. *
  3672. * @private
  3673. * @name has
  3674. * @memberOf MapCache
  3675. * @param {string} key The key of the entry to check.
  3676. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3677. */
  3678. function mapCacheHas(key) {
  3679. return getMapData(this, key).has(key);
  3680. }
  3681. /**
  3682. * Sets the map `key` to `value`.
  3683. *
  3684. * @private
  3685. * @name set
  3686. * @memberOf MapCache
  3687. * @param {string} key The key of the value to set.
  3688. * @param {*} value The value to set.
  3689. * @returns {Object} Returns the map cache instance.
  3690. */
  3691. function mapCacheSet(key, value) {
  3692. var data = getMapData(this, key),
  3693. size = data.size;
  3694. data.set(key, value);
  3695. this.size += data.size == size ? 0 : 1;
  3696. return this;
  3697. }
  3698. // Add methods to `MapCache`.
  3699. MapCache.prototype.clear = mapCacheClear;
  3700. MapCache.prototype['delete'] = mapCacheDelete;
  3701. MapCache.prototype.get = mapCacheGet;
  3702. MapCache.prototype.has = mapCacheHas;
  3703. MapCache.prototype.set = mapCacheSet;
  3704. /*------------------------------------------------------------------------*/
  3705. /**
  3706. *
  3707. * Creates an array cache object to store unique values.
  3708. *
  3709. * @private
  3710. * @constructor
  3711. * @param {Array} [values] The values to cache.
  3712. */
  3713. function SetCache(values) {
  3714. var index = -1,
  3715. length = values == null ? 0 : values.length;
  3716. this.__data__ = new MapCache;
  3717. while (++index < length) {
  3718. this.add(values[index]);
  3719. }
  3720. }
  3721. /**
  3722. * Adds `value` to the array cache.
  3723. *
  3724. * @private
  3725. * @name add
  3726. * @memberOf SetCache
  3727. * @alias push
  3728. * @param {*} value The value to cache.
  3729. * @returns {Object} Returns the cache instance.
  3730. */
  3731. function setCacheAdd(value) {
  3732. this.__data__.set(value, HASH_UNDEFINED);
  3733. return this;
  3734. }
  3735. /**
  3736. * Checks if `value` is in the array cache.
  3737. *
  3738. * @private
  3739. * @name has
  3740. * @memberOf SetCache
  3741. * @param {*} value The value to search for.
  3742. * @returns {number} Returns `true` if `value` is found, else `false`.
  3743. */
  3744. function setCacheHas(value) {
  3745. return this.__data__.has(value);
  3746. }
  3747. // Add methods to `SetCache`.
  3748. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  3749. SetCache.prototype.has = setCacheHas;
  3750. /*------------------------------------------------------------------------*/
  3751. /**
  3752. * Creates a stack cache object to store key-value pairs.
  3753. *
  3754. * @private
  3755. * @constructor
  3756. * @param {Array} [entries] The key-value pairs to cache.
  3757. */
  3758. function Stack(entries) {
  3759. var data = this.__data__ = new ListCache(entries);
  3760. this.size = data.size;
  3761. }
  3762. /**
  3763. * Removes all key-value entries from the stack.
  3764. *
  3765. * @private
  3766. * @name clear
  3767. * @memberOf Stack
  3768. */
  3769. function stackClear() {
  3770. this.__data__ = new ListCache;
  3771. this.size = 0;
  3772. }
  3773. /**
  3774. * Removes `key` and its value from the stack.
  3775. *
  3776. * @private
  3777. * @name delete
  3778. * @memberOf Stack
  3779. * @param {string} key The key of the value to remove.
  3780. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3781. */
  3782. function stackDelete(key) {
  3783. var data = this.__data__,
  3784. result = data['delete'](key);
  3785. this.size = data.size;
  3786. return result;
  3787. }
  3788. /**
  3789. * Gets the stack value for `key`.
  3790. *
  3791. * @private
  3792. * @name get
  3793. * @memberOf Stack
  3794. * @param {string} key The key of the value to get.
  3795. * @returns {*} Returns the entry value.
  3796. */
  3797. function stackGet(key) {
  3798. return this.__data__.get(key);
  3799. }
  3800. /**
  3801. * Checks if a stack value for `key` exists.
  3802. *
  3803. * @private
  3804. * @name has
  3805. * @memberOf Stack
  3806. * @param {string} key The key of the entry to check.
  3807. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3808. */
  3809. function stackHas(key) {
  3810. return this.__data__.has(key);
  3811. }
  3812. /**
  3813. * Sets the stack `key` to `value`.
  3814. *
  3815. * @private
  3816. * @name set
  3817. * @memberOf Stack
  3818. * @param {string} key The key of the value to set.
  3819. * @param {*} value The value to set.
  3820. * @returns {Object} Returns the stack cache instance.
  3821. */
  3822. function stackSet(key, value) {
  3823. var data = this.__data__;
  3824. if (data instanceof ListCache) {
  3825. var pairs = data.__data__;
  3826. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  3827. pairs.push([key, value]);
  3828. this.size = ++data.size;
  3829. return this;
  3830. }
  3831. data = this.__data__ = new MapCache(pairs);
  3832. }
  3833. data.set(key, value);
  3834. this.size = data.size;
  3835. return this;
  3836. }
  3837. // Add methods to `Stack`.
  3838. Stack.prototype.clear = stackClear;
  3839. Stack.prototype['delete'] = stackDelete;
  3840. Stack.prototype.get = stackGet;
  3841. Stack.prototype.has = stackHas;
  3842. Stack.prototype.set = stackSet;
  3843. /*------------------------------------------------------------------------*/
  3844. /**
  3845. * Creates an array of the enumerable property names of the array-like `value`.
  3846. *
  3847. * @private
  3848. * @param {*} value The value to query.
  3849. * @param {boolean} inherited Specify returning inherited property names.
  3850. * @returns {Array} Returns the array of property names.
  3851. */
  3852. function arrayLikeKeys(value, inherited) {
  3853. var isArr = isArray(value),
  3854. isArg = !isArr && isArguments(value),
  3855. isBuff = !isArr && !isArg && isBuffer(value),
  3856. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  3857. skipIndexes = isArr || isArg || isBuff || isType,
  3858. result = skipIndexes ? baseTimes(value.length, String) : [],
  3859. length = result.length;
  3860. for (var key in value) {
  3861. if ((inherited || hasOwnProperty.call(value, key)) &&
  3862. !(skipIndexes && (
  3863. // Safari 9 has enumerable `arguments.length` in strict mode.
  3864. key == 'length' ||
  3865. // Node.js 0.10 has enumerable non-index properties on buffers.
  3866. (isBuff && (key == 'offset' || key == 'parent')) ||
  3867. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  3868. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  3869. // Skip index properties.
  3870. isIndex(key, length)
  3871. ))) {
  3872. result.push(key);
  3873. }
  3874. }
  3875. return result;
  3876. }
  3877. /**
  3878. * A specialized version of `_.sample` for arrays.
  3879. *
  3880. * @private
  3881. * @param {Array} array The array to sample.
  3882. * @returns {*} Returns the random element.
  3883. */
  3884. function arraySample(array) {
  3885. var length = array.length;
  3886. return length ? array[baseRandom(0, length - 1)] : undefined;
  3887. }
  3888. /**
  3889. * A specialized version of `_.sampleSize` for arrays.
  3890. *
  3891. * @private
  3892. * @param {Array} array The array to sample.
  3893. * @param {number} n The number of elements to sample.
  3894. * @returns {Array} Returns the random elements.
  3895. */
  3896. function arraySampleSize(array, n) {
  3897. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  3898. }
  3899. /**
  3900. * A specialized version of `_.shuffle` for arrays.
  3901. *
  3902. * @private
  3903. * @param {Array} array The array to shuffle.
  3904. * @returns {Array} Returns the new shuffled array.
  3905. */
  3906. function arrayShuffle(array) {
  3907. return shuffleSelf(copyArray(array));
  3908. }
  3909. /**
  3910. * This function is like `assignValue` except that it doesn't assign
  3911. * `undefined` values.
  3912. *
  3913. * @private
  3914. * @param {Object} object The object to modify.
  3915. * @param {string} key The key of the property to assign.
  3916. * @param {*} value The value to assign.
  3917. */
  3918. function assignMergeValue(object, key, value) {
  3919. if ((value !== undefined && !eq(object[key], value)) ||
  3920. (value === undefined && !(key in object))) {
  3921. baseAssignValue(object, key, value);
  3922. }
  3923. }
  3924. /**
  3925. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  3926. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  3927. * for equality comparisons.
  3928. *
  3929. * @private
  3930. * @param {Object} object The object to modify.
  3931. * @param {string} key The key of the property to assign.
  3932. * @param {*} value The value to assign.
  3933. */
  3934. function assignValue(object, key, value) {
  3935. var objValue = object[key];
  3936. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  3937. (value === undefined && !(key in object))) {
  3938. baseAssignValue(object, key, value);
  3939. }
  3940. }
  3941. /**
  3942. * Gets the index at which the `key` is found in `array` of key-value pairs.
  3943. *
  3944. * @private
  3945. * @param {Array} array The array to inspect.
  3946. * @param {*} key The key to search for.
  3947. * @returns {number} Returns the index of the matched value, else `-1`.
  3948. */
  3949. function assocIndexOf(array, key) {
  3950. var length = array.length;
  3951. while (length--) {
  3952. if (eq(array[length][0], key)) {
  3953. return length;
  3954. }
  3955. }
  3956. return -1;
  3957. }
  3958. /**
  3959. * Aggregates elements of `collection` on `accumulator` with keys transformed
  3960. * by `iteratee` and values set by `setter`.
  3961. *
  3962. * @private
  3963. * @param {Array|Object} collection The collection to iterate over.
  3964. * @param {Function} setter The function to set `accumulator` values.
  3965. * @param {Function} iteratee The iteratee to transform keys.
  3966. * @param {Object} accumulator The initial aggregated object.
  3967. * @returns {Function} Returns `accumulator`.
  3968. */
  3969. function baseAggregator(collection, setter, iteratee, accumulator) {
  3970. baseEach(collection, function(value, key, collection) {
  3971. setter(accumulator, value, iteratee(value), collection);
  3972. });
  3973. return accumulator;
  3974. }
  3975. /**
  3976. * The base implementation of `_.assign` without support for multiple sources
  3977. * or `customizer` functions.
  3978. *
  3979. * @private
  3980. * @param {Object} object The destination object.
  3981. * @param {Object} source The source object.
  3982. * @returns {Object} Returns `object`.
  3983. */
  3984. function baseAssign(object, source) {
  3985. return object && copyObject(source, keys(source), object);
  3986. }
  3987. /**
  3988. * The base implementation of `_.assignIn` without support for multiple sources
  3989. * or `customizer` functions.
  3990. *
  3991. * @private
  3992. * @param {Object} object The destination object.
  3993. * @param {Object} source The source object.
  3994. * @returns {Object} Returns `object`.
  3995. */
  3996. function baseAssignIn(object, source) {
  3997. return object && copyObject(source, keysIn(source), object);
  3998. }
  3999. /**
  4000. * The base implementation of `assignValue` and `assignMergeValue` without
  4001. * value checks.
  4002. *
  4003. * @private
  4004. * @param {Object} object The object to modify.
  4005. * @param {string} key The key of the property to assign.
  4006. * @param {*} value The value to assign.
  4007. */
  4008. function baseAssignValue(object, key, value) {
  4009. if (key == '__proto__' && defineProperty) {
  4010. defineProperty(object, key, {
  4011. 'configurable': true,
  4012. 'enumerable': true,
  4013. 'value': value,
  4014. 'writable': true
  4015. });
  4016. } else {
  4017. object[key] = value;
  4018. }
  4019. }
  4020. /**
  4021. * The base implementation of `_.at` without support for individual paths.
  4022. *
  4023. * @private
  4024. * @param {Object} object The object to iterate over.
  4025. * @param {string[]} paths The property paths to pick.
  4026. * @returns {Array} Returns the picked elements.
  4027. */
  4028. function baseAt(object, paths) {
  4029. var index = -1,
  4030. length = paths.length,
  4031. result = Array(length),
  4032. skip = object == null;
  4033. while (++index < length) {
  4034. result[index] = skip ? undefined : get(object, paths[index]);
  4035. }
  4036. return result;
  4037. }
  4038. /**
  4039. * The base implementation of `_.clamp` which doesn't coerce arguments.
  4040. *
  4041. * @private
  4042. * @param {number} number The number to clamp.
  4043. * @param {number} [lower] The lower bound.
  4044. * @param {number} upper The upper bound.
  4045. * @returns {number} Returns the clamped number.
  4046. */
  4047. function baseClamp(number, lower, upper) {
  4048. if (number === number) {
  4049. if (upper !== undefined) {
  4050. number = number <= upper ? number : upper;
  4051. }
  4052. if (lower !== undefined) {
  4053. number = number >= lower ? number : lower;
  4054. }
  4055. }
  4056. return number;
  4057. }
  4058. /**
  4059. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  4060. * traversed objects.
  4061. *
  4062. * @private
  4063. * @param {*} value The value to clone.
  4064. * @param {boolean} bitmask The bitmask flags.
  4065. * 1 - Deep clone
  4066. * 2 - Flatten inherited properties
  4067. * 4 - Clone symbols
  4068. * @param {Function} [customizer] The function to customize cloning.
  4069. * @param {string} [key] The key of `value`.
  4070. * @param {Object} [object] The parent object of `value`.
  4071. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  4072. * @returns {*} Returns the cloned value.
  4073. */
  4074. function baseClone(value, bitmask, customizer, key, object, stack) {
  4075. var result,
  4076. isDeep = bitmask & CLONE_DEEP_FLAG,
  4077. isFlat = bitmask & CLONE_FLAT_FLAG,
  4078. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  4079. if (customizer) {
  4080. result = object ? customizer(value, key, object, stack) : customizer(value);
  4081. }
  4082. if (result !== undefined) {
  4083. return result;
  4084. }
  4085. if (!isObject(value)) {
  4086. return value;
  4087. }
  4088. var isArr = isArray(value);
  4089. if (isArr) {
  4090. result = initCloneArray(value);
  4091. if (!isDeep) {
  4092. return copyArray(value, result);
  4093. }
  4094. } else {
  4095. var tag = getTag(value),
  4096. isFunc = tag == funcTag || tag == genTag;
  4097. if (isBuffer(value)) {
  4098. return cloneBuffer(value, isDeep);
  4099. }
  4100. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  4101. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  4102. if (!isDeep) {
  4103. return isFlat
  4104. ? copySymbolsIn(value, baseAssignIn(result, value))
  4105. : copySymbols(value, baseAssign(result, value));
  4106. }
  4107. } else {
  4108. if (!cloneableTags[tag]) {
  4109. return object ? value : {};
  4110. }
  4111. result = initCloneByTag(value, tag, isDeep);
  4112. }
  4113. }
  4114. // Check for circular references and return its corresponding clone.
  4115. stack || (stack = new Stack);
  4116. var stacked = stack.get(value);
  4117. if (stacked) {
  4118. return stacked;
  4119. }
  4120. stack.set(value, result);
  4121. if (isSet(value)) {
  4122. value.forEach(function(subValue) {
  4123. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  4124. });
  4125. } else if (isMap(value)) {
  4126. value.forEach(function(subValue, key) {
  4127. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  4128. });
  4129. }
  4130. var keysFunc = isFull
  4131. ? (isFlat ? getAllKeysIn : getAllKeys)
  4132. : (isFlat ? keysIn : keys);
  4133. var props = isArr ? undefined : keysFunc(value);
  4134. arrayEach(props || value, function(subValue, key) {
  4135. if (props) {
  4136. key = subValue;
  4137. subValue = value[key];
  4138. }
  4139. // Recursively populate clone (susceptible to call stack limits).
  4140. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  4141. });
  4142. return result;
  4143. }
  4144. /**
  4145. * The base implementation of `_.conforms` which doesn't clone `source`.
  4146. *
  4147. * @private
  4148. * @param {Object} source The object of property predicates to conform to.
  4149. * @returns {Function} Returns the new spec function.
  4150. */
  4151. function baseConforms(source) {
  4152. var props = keys(source);
  4153. return function(object) {
  4154. return baseConformsTo(object, source, props);
  4155. };
  4156. }
  4157. /**
  4158. * The base implementation of `_.conformsTo` which accepts `props` to check.
  4159. *
  4160. * @private
  4161. * @param {Object} object The object to inspect.
  4162. * @param {Object} source The object of property predicates to conform to.
  4163. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  4164. */
  4165. function baseConformsTo(object, source, props) {
  4166. var length = props.length;
  4167. if (object == null) {
  4168. return !length;
  4169. }
  4170. object = Object(object);
  4171. while (length--) {
  4172. var key = props[length],
  4173. predicate = source[key],
  4174. value = object[key];
  4175. if ((value === undefined && !(key in object)) || !predicate(value)) {
  4176. return false;
  4177. }
  4178. }
  4179. return true;
  4180. }
  4181. /**
  4182. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  4183. * to provide to `func`.
  4184. *
  4185. * @private
  4186. * @param {Function} func The function to delay.
  4187. * @param {number} wait The number of milliseconds to delay invocation.
  4188. * @param {Array} args The arguments to provide to `func`.
  4189. * @returns {number|Object} Returns the timer id or timeout object.
  4190. */
  4191. function baseDelay(func, wait, args) {
  4192. if (typeof func != 'function') {
  4193. throw new TypeError(FUNC_ERROR_TEXT);
  4194. }
  4195. return setTimeout(function() { func.apply(undefined, args); }, wait);
  4196. }
  4197. /**
  4198. * The base implementation of methods like `_.difference` without support
  4199. * for excluding multiple arrays or iteratee shorthands.
  4200. *
  4201. * @private
  4202. * @param {Array} array The array to inspect.
  4203. * @param {Array} values The values to exclude.
  4204. * @param {Function} [iteratee] The iteratee invoked per element.
  4205. * @param {Function} [comparator] The comparator invoked per element.
  4206. * @returns {Array} Returns the new array of filtered values.
  4207. */
  4208. function baseDifference(array, values, iteratee, comparator) {
  4209. var index = -1,
  4210. includes = arrayIncludes,
  4211. isCommon = true,
  4212. length = array.length,
  4213. result = [],
  4214. valuesLength = values.length;
  4215. if (!length) {
  4216. return result;
  4217. }
  4218. if (iteratee) {
  4219. values = arrayMap(values, baseUnary(iteratee));
  4220. }
  4221. if (comparator) {
  4222. includes = arrayIncludesWith;
  4223. isCommon = false;
  4224. }
  4225. else if (values.length >= LARGE_ARRAY_SIZE) {
  4226. includes = cacheHas;
  4227. isCommon = false;
  4228. values = new SetCache(values);
  4229. }
  4230. outer:
  4231. while (++index < length) {
  4232. var value = array[index],
  4233. computed = iteratee == null ? value : iteratee(value);
  4234. value = (comparator || value !== 0) ? value : 0;
  4235. if (isCommon && computed === computed) {
  4236. var valuesIndex = valuesLength;
  4237. while (valuesIndex--) {
  4238. if (values[valuesIndex] === computed) {
  4239. continue outer;
  4240. }
  4241. }
  4242. result.push(value);
  4243. }
  4244. else if (!includes(values, computed, comparator)) {
  4245. result.push(value);
  4246. }
  4247. }
  4248. return result;
  4249. }
  4250. /**
  4251. * The base implementation of `_.forEach` without support for iteratee shorthands.
  4252. *
  4253. * @private
  4254. * @param {Array|Object} collection The collection to iterate over.
  4255. * @param {Function} iteratee The function invoked per iteration.
  4256. * @returns {Array|Object} Returns `collection`.
  4257. */
  4258. var baseEach = createBaseEach(baseForOwn);
  4259. /**
  4260. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  4261. *
  4262. * @private
  4263. * @param {Array|Object} collection The collection to iterate over.
  4264. * @param {Function} iteratee The function invoked per iteration.
  4265. * @returns {Array|Object} Returns `collection`.
  4266. */
  4267. var baseEachRight = createBaseEach(baseForOwnRight, true);
  4268. /**
  4269. * The base implementation of `_.every` without support for iteratee shorthands.
  4270. *
  4271. * @private
  4272. * @param {Array|Object} collection The collection to iterate over.
  4273. * @param {Function} predicate The function invoked per iteration.
  4274. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  4275. * else `false`
  4276. */
  4277. function baseEvery(collection, predicate) {
  4278. var result = true;
  4279. baseEach(collection, function(value, index, collection) {
  4280. result = !!predicate(value, index, collection);
  4281. return result;
  4282. });
  4283. return result;
  4284. }
  4285. /**
  4286. * The base implementation of methods like `_.max` and `_.min` which accepts a
  4287. * `comparator` to determine the extremum value.
  4288. *
  4289. * @private
  4290. * @param {Array} array The array to iterate over.
  4291. * @param {Function} iteratee The iteratee invoked per iteration.
  4292. * @param {Function} comparator The comparator used to compare values.
  4293. * @returns {*} Returns the extremum value.
  4294. */
  4295. function baseExtremum(array, iteratee, comparator) {
  4296. var index = -1,
  4297. length = array.length;
  4298. while (++index < length) {
  4299. var value = array[index],
  4300. current = iteratee(value);
  4301. if (current != null && (computed === undefined
  4302. ? (current === current && !isSymbol(current))
  4303. : comparator(current, computed)
  4304. )) {
  4305. var computed = current,
  4306. result = value;
  4307. }
  4308. }
  4309. return result;
  4310. }
  4311. /**
  4312. * The base implementation of `_.fill` without an iteratee call guard.
  4313. *
  4314. * @private
  4315. * @param {Array} array The array to fill.
  4316. * @param {*} value The value to fill `array` with.
  4317. * @param {number} [start=0] The start position.
  4318. * @param {number} [end=array.length] The end position.
  4319. * @returns {Array} Returns `array`.
  4320. */
  4321. function baseFill(array, value, start, end) {
  4322. var length = array.length;
  4323. start = toInteger(start);
  4324. if (start < 0) {
  4325. start = -start > length ? 0 : (length + start);
  4326. }
  4327. end = (end === undefined || end > length) ? length : toInteger(end);
  4328. if (end < 0) {
  4329. end += length;
  4330. }
  4331. end = start > end ? 0 : toLength(end);
  4332. while (start < end) {
  4333. array[start++] = value;
  4334. }
  4335. return array;
  4336. }
  4337. /**
  4338. * The base implementation of `_.filter` without support for iteratee shorthands.
  4339. *
  4340. * @private
  4341. * @param {Array|Object} collection The collection to iterate over.
  4342. * @param {Function} predicate The function invoked per iteration.
  4343. * @returns {Array} Returns the new filtered array.
  4344. */
  4345. function baseFilter(collection, predicate) {
  4346. var result = [];
  4347. baseEach(collection, function(value, index, collection) {
  4348. if (predicate(value, index, collection)) {
  4349. result.push(value);
  4350. }
  4351. });
  4352. return result;
  4353. }
  4354. /**
  4355. * The base implementation of `_.flatten` with support for restricting flattening.
  4356. *
  4357. * @private
  4358. * @param {Array} array The array to flatten.
  4359. * @param {number} depth The maximum recursion depth.
  4360. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  4361. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  4362. * @param {Array} [result=[]] The initial result value.
  4363. * @returns {Array} Returns the new flattened array.
  4364. */
  4365. function baseFlatten(array, depth, predicate, isStrict, result) {
  4366. var index = -1,
  4367. length = array.length;
  4368. predicate || (predicate = isFlattenable);
  4369. result || (result = []);
  4370. while (++index < length) {
  4371. var value = array[index];
  4372. if (depth > 0 && predicate(value)) {
  4373. if (depth > 1) {
  4374. // Recursively flatten arrays (susceptible to call stack limits).
  4375. baseFlatten(value, depth - 1, predicate, isStrict, result);
  4376. } else {
  4377. arrayPush(result, value);
  4378. }
  4379. } else if (!isStrict) {
  4380. result[result.length] = value;
  4381. }
  4382. }
  4383. return result;
  4384. }
  4385. /**
  4386. * The base implementation of `baseForOwn` which iterates over `object`
  4387. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  4388. * Iteratee functions may exit iteration early by explicitly returning `false`.
  4389. *
  4390. * @private
  4391. * @param {Object} object The object to iterate over.
  4392. * @param {Function} iteratee The function invoked per iteration.
  4393. * @param {Function} keysFunc The function to get the keys of `object`.
  4394. * @returns {Object} Returns `object`.
  4395. */
  4396. var baseFor = createBaseFor();
  4397. /**
  4398. * This function is like `baseFor` except that it iterates over properties
  4399. * in the opposite order.
  4400. *
  4401. * @private
  4402. * @param {Object} object The object to iterate over.
  4403. * @param {Function} iteratee The function invoked per iteration.
  4404. * @param {Function} keysFunc The function to get the keys of `object`.
  4405. * @returns {Object} Returns `object`.
  4406. */
  4407. var baseForRight = createBaseFor(true);
  4408. /**
  4409. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  4410. *
  4411. * @private
  4412. * @param {Object} object The object to iterate over.
  4413. * @param {Function} iteratee The function invoked per iteration.
  4414. * @returns {Object} Returns `object`.
  4415. */
  4416. function baseForOwn(object, iteratee) {
  4417. return object && baseFor(object, iteratee, keys);
  4418. }
  4419. /**
  4420. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  4421. *
  4422. * @private
  4423. * @param {Object} object The object to iterate over.
  4424. * @param {Function} iteratee The function invoked per iteration.
  4425. * @returns {Object} Returns `object`.
  4426. */
  4427. function baseForOwnRight(object, iteratee) {
  4428. return object && baseForRight(object, iteratee, keys);
  4429. }
  4430. /**
  4431. * The base implementation of `_.functions` which creates an array of
  4432. * `object` function property names filtered from `props`.
  4433. *
  4434. * @private
  4435. * @param {Object} object The object to inspect.
  4436. * @param {Array} props The property names to filter.
  4437. * @returns {Array} Returns the function names.
  4438. */
  4439. function baseFunctions(object, props) {
  4440. return arrayFilter(props, function(key) {
  4441. return isFunction(object[key]);
  4442. });
  4443. }
  4444. /**
  4445. * The base implementation of `_.get` without support for default values.
  4446. *
  4447. * @private
  4448. * @param {Object} object The object to query.
  4449. * @param {Array|string} path The path of the property to get.
  4450. * @returns {*} Returns the resolved value.
  4451. */
  4452. function baseGet(object, path) {
  4453. path = castPath(path, object);
  4454. var index = 0,
  4455. length = path.length;
  4456. while (object != null && index < length) {
  4457. object = object[toKey(path[index++])];
  4458. }
  4459. return (index && index == length) ? object : undefined;
  4460. }
  4461. /**
  4462. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  4463. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  4464. * symbols of `object`.
  4465. *
  4466. * @private
  4467. * @param {Object} object The object to query.
  4468. * @param {Function} keysFunc The function to get the keys of `object`.
  4469. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  4470. * @returns {Array} Returns the array of property names and symbols.
  4471. */
  4472. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  4473. var result = keysFunc(object);
  4474. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  4475. }
  4476. /**
  4477. * The base implementation of `getTag` without fallbacks for buggy environments.
  4478. *
  4479. * @private
  4480. * @param {*} value The value to query.
  4481. * @returns {string} Returns the `toStringTag`.
  4482. */
  4483. function baseGetTag(value) {
  4484. if (value == null) {
  4485. return value === undefined ? undefinedTag : nullTag;
  4486. }
  4487. return (symToStringTag && symToStringTag in Object(value))
  4488. ? getRawTag(value)
  4489. : objectToString(value);
  4490. }
  4491. /**
  4492. * The base implementation of `_.gt` which doesn't coerce arguments.
  4493. *
  4494. * @private
  4495. * @param {*} value The value to compare.
  4496. * @param {*} other The other value to compare.
  4497. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  4498. * else `false`.
  4499. */
  4500. function baseGt(value, other) {
  4501. return value > other;
  4502. }
  4503. /**
  4504. * The base implementation of `_.has` without support for deep paths.
  4505. *
  4506. * @private
  4507. * @param {Object} [object] The object to query.
  4508. * @param {Array|string} key The key to check.
  4509. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  4510. */
  4511. function baseHas(object, key) {
  4512. return object != null && hasOwnProperty.call(object, key);
  4513. }
  4514. /**
  4515. * The base implementation of `_.hasIn` without support for deep paths.
  4516. *
  4517. * @private
  4518. * @param {Object} [object] The object to query.
  4519. * @param {Array|string} key The key to check.
  4520. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  4521. */
  4522. function baseHasIn(object, key) {
  4523. return object != null && key in Object(object);
  4524. }
  4525. /**
  4526. * The base implementation of `_.inRange` which doesn't coerce arguments.
  4527. *
  4528. * @private
  4529. * @param {number} number The number to check.
  4530. * @param {number} start The start of the range.
  4531. * @param {number} end The end of the range.
  4532. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  4533. */
  4534. function baseInRange(number, start, end) {
  4535. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  4536. }
  4537. /**
  4538. * The base implementation of methods like `_.intersection`, without support
  4539. * for iteratee shorthands, that accepts an array of arrays to inspect.
  4540. *
  4541. * @private
  4542. * @param {Array} arrays The arrays to inspect.
  4543. * @param {Function} [iteratee] The iteratee invoked per element.
  4544. * @param {Function} [comparator] The comparator invoked per element.
  4545. * @returns {Array} Returns the new array of shared values.
  4546. */
  4547. function baseIntersection(arrays, iteratee, comparator) {
  4548. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  4549. length = arrays[0].length,
  4550. othLength = arrays.length,
  4551. othIndex = othLength,
  4552. caches = Array(othLength),
  4553. maxLength = Infinity,
  4554. result = [];
  4555. while (othIndex--) {
  4556. var array = arrays[othIndex];
  4557. if (othIndex && iteratee) {
  4558. array = arrayMap(array, baseUnary(iteratee));
  4559. }
  4560. maxLength = nativeMin(array.length, maxLength);
  4561. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  4562. ? new SetCache(othIndex && array)
  4563. : undefined;
  4564. }
  4565. array = arrays[0];
  4566. var index = -1,
  4567. seen = caches[0];
  4568. outer:
  4569. while (++index < length && result.length < maxLength) {
  4570. var value = array[index],
  4571. computed = iteratee ? iteratee(value) : value;
  4572. value = (comparator || value !== 0) ? value : 0;
  4573. if (!(seen
  4574. ? cacheHas(seen, computed)
  4575. : includes(result, computed, comparator)
  4576. )) {
  4577. othIndex = othLength;
  4578. while (--othIndex) {
  4579. var cache = caches[othIndex];
  4580. if (!(cache
  4581. ? cacheHas(cache, computed)
  4582. : includes(arrays[othIndex], computed, comparator))
  4583. ) {
  4584. continue outer;
  4585. }
  4586. }
  4587. if (seen) {
  4588. seen.push(computed);
  4589. }
  4590. result.push(value);
  4591. }
  4592. }
  4593. return result;
  4594. }
  4595. /**
  4596. * The base implementation of `_.invert` and `_.invertBy` which inverts
  4597. * `object` with values transformed by `iteratee` and set by `setter`.
  4598. *
  4599. * @private
  4600. * @param {Object} object The object to iterate over.
  4601. * @param {Function} setter The function to set `accumulator` values.
  4602. * @param {Function} iteratee The iteratee to transform values.
  4603. * @param {Object} accumulator The initial inverted object.
  4604. * @returns {Function} Returns `accumulator`.
  4605. */
  4606. function baseInverter(object, setter, iteratee, accumulator) {
  4607. baseForOwn(object, function(value, key, object) {
  4608. setter(accumulator, iteratee(value), key, object);
  4609. });
  4610. return accumulator;
  4611. }
  4612. /**
  4613. * The base implementation of `_.invoke` without support for individual
  4614. * method arguments.
  4615. *
  4616. * @private
  4617. * @param {Object} object The object to query.
  4618. * @param {Array|string} path The path of the method to invoke.
  4619. * @param {Array} args The arguments to invoke the method with.
  4620. * @returns {*} Returns the result of the invoked method.
  4621. */
  4622. function baseInvoke(object, path, args) {
  4623. path = castPath(path, object);
  4624. object = parent(object, path);
  4625. var func = object == null ? object : object[toKey(last(path))];
  4626. return func == null ? undefined : apply(func, object, args);
  4627. }
  4628. /**
  4629. * The base implementation of `_.isArguments`.
  4630. *
  4631. * @private
  4632. * @param {*} value The value to check.
  4633. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  4634. */
  4635. function baseIsArguments(value) {
  4636. return isObjectLike(value) && baseGetTag(value) == argsTag;
  4637. }
  4638. /**
  4639. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  4640. *
  4641. * @private
  4642. * @param {*} value The value to check.
  4643. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  4644. */
  4645. function baseIsArrayBuffer(value) {
  4646. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  4647. }
  4648. /**
  4649. * The base implementation of `_.isDate` without Node.js optimizations.
  4650. *
  4651. * @private
  4652. * @param {*} value The value to check.
  4653. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  4654. */
  4655. function baseIsDate(value) {
  4656. return isObjectLike(value) && baseGetTag(value) == dateTag;
  4657. }
  4658. /**
  4659. * The base implementation of `_.isEqual` which supports partial comparisons
  4660. * and tracks traversed objects.
  4661. *
  4662. * @private
  4663. * @param {*} value The value to compare.
  4664. * @param {*} other The other value to compare.
  4665. * @param {boolean} bitmask The bitmask flags.
  4666. * 1 - Unordered comparison
  4667. * 2 - Partial comparison
  4668. * @param {Function} [customizer] The function to customize comparisons.
  4669. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  4670. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  4671. */
  4672. function baseIsEqual(value, other, bitmask, customizer, stack) {
  4673. if (value === other) {
  4674. return true;
  4675. }
  4676. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  4677. return value !== value && other !== other;
  4678. }
  4679. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  4680. }
  4681. /**
  4682. * A specialized version of `baseIsEqual` for arrays and objects which performs
  4683. * deep comparisons and tracks traversed objects enabling objects with circular
  4684. * references to be compared.
  4685. *
  4686. * @private
  4687. * @param {Object} object The object to compare.
  4688. * @param {Object} other The other object to compare.
  4689. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  4690. * @param {Function} customizer The function to customize comparisons.
  4691. * @param {Function} equalFunc The function to determine equivalents of values.
  4692. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  4693. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  4694. */
  4695. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  4696. var objIsArr = isArray(object),
  4697. othIsArr = isArray(other),
  4698. objTag = objIsArr ? arrayTag : getTag(object),
  4699. othTag = othIsArr ? arrayTag : getTag(other);
  4700. objTag = objTag == argsTag ? objectTag : objTag;
  4701. othTag = othTag == argsTag ? objectTag : othTag;
  4702. var objIsObj = objTag == objectTag,
  4703. othIsObj = othTag == objectTag,
  4704. isSameTag = objTag == othTag;
  4705. if (isSameTag && isBuffer(object)) {
  4706. if (!isBuffer(other)) {
  4707. return false;
  4708. }
  4709. objIsArr = true;
  4710. objIsObj = false;
  4711. }
  4712. if (isSameTag && !objIsObj) {
  4713. stack || (stack = new Stack);
  4714. return (objIsArr || isTypedArray(object))
  4715. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  4716. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  4717. }
  4718. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  4719. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  4720. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  4721. if (objIsWrapped || othIsWrapped) {
  4722. var objUnwrapped = objIsWrapped ? object.value() : object,
  4723. othUnwrapped = othIsWrapped ? other.value() : other;
  4724. stack || (stack = new Stack);
  4725. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  4726. }
  4727. }
  4728. if (!isSameTag) {
  4729. return false;
  4730. }
  4731. stack || (stack = new Stack);
  4732. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  4733. }
  4734. /**
  4735. * The base implementation of `_.isMap` without Node.js optimizations.
  4736. *
  4737. * @private
  4738. * @param {*} value The value to check.
  4739. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  4740. */
  4741. function baseIsMap(value) {
  4742. return isObjectLike(value) && getTag(value) == mapTag;
  4743. }
  4744. /**
  4745. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  4746. *
  4747. * @private
  4748. * @param {Object} object The object to inspect.
  4749. * @param {Object} source The object of property values to match.
  4750. * @param {Array} matchData The property names, values, and compare flags to match.
  4751. * @param {Function} [customizer] The function to customize comparisons.
  4752. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  4753. */
  4754. function baseIsMatch(object, source, matchData, customizer) {
  4755. var index = matchData.length,
  4756. length = index,
  4757. noCustomizer = !customizer;
  4758. if (object == null) {
  4759. return !length;
  4760. }
  4761. object = Object(object);
  4762. while (index--) {
  4763. var data = matchData[index];
  4764. if ((noCustomizer && data[2])
  4765. ? data[1] !== object[data[0]]
  4766. : !(data[0] in object)
  4767. ) {
  4768. return false;
  4769. }
  4770. }
  4771. while (++index < length) {
  4772. data = matchData[index];
  4773. var key = data[0],
  4774. objValue = object[key],
  4775. srcValue = data[1];
  4776. if (noCustomizer && data[2]) {
  4777. if (objValue === undefined && !(key in object)) {
  4778. return false;
  4779. }
  4780. } else {
  4781. var stack = new Stack;
  4782. if (customizer) {
  4783. var result = customizer(objValue, srcValue, key, object, source, stack);
  4784. }
  4785. if (!(result === undefined
  4786. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  4787. : result
  4788. )) {
  4789. return false;
  4790. }
  4791. }
  4792. }
  4793. return true;
  4794. }
  4795. /**
  4796. * The base implementation of `_.isNative` without bad shim checks.
  4797. *
  4798. * @private
  4799. * @param {*} value The value to check.
  4800. * @returns {boolean} Returns `true` if `value` is a native function,
  4801. * else `false`.
  4802. */
  4803. function baseIsNative(value) {
  4804. if (!isObject(value) || isMasked(value)) {
  4805. return false;
  4806. }
  4807. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  4808. return pattern.test(toSource(value));
  4809. }
  4810. /**
  4811. * The base implementation of `_.isRegExp` without Node.js optimizations.
  4812. *
  4813. * @private
  4814. * @param {*} value The value to check.
  4815. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  4816. */
  4817. function baseIsRegExp(value) {
  4818. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  4819. }
  4820. /**
  4821. * The base implementation of `_.isSet` without Node.js optimizations.
  4822. *
  4823. * @private
  4824. * @param {*} value The value to check.
  4825. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  4826. */
  4827. function baseIsSet(value) {
  4828. return isObjectLike(value) && getTag(value) == setTag;
  4829. }
  4830. /**
  4831. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  4832. *
  4833. * @private
  4834. * @param {*} value The value to check.
  4835. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  4836. */
  4837. function baseIsTypedArray(value) {
  4838. return isObjectLike(value) &&
  4839. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  4840. }
  4841. /**
  4842. * The base implementation of `_.iteratee`.
  4843. *
  4844. * @private
  4845. * @param {*} [value=_.identity] The value to convert to an iteratee.
  4846. * @returns {Function} Returns the iteratee.
  4847. */
  4848. function baseIteratee(value) {
  4849. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  4850. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  4851. if (typeof value == 'function') {
  4852. return value;
  4853. }
  4854. if (value == null) {
  4855. return identity;
  4856. }
  4857. if (typeof value == 'object') {
  4858. return isArray(value)
  4859. ? baseMatchesProperty(value[0], value[1])
  4860. : baseMatches(value);
  4861. }
  4862. return property(value);
  4863. }
  4864. /**
  4865. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  4866. *
  4867. * @private
  4868. * @param {Object} object The object to query.
  4869. * @returns {Array} Returns the array of property names.
  4870. */
  4871. function baseKeys(object) {
  4872. if (!isPrototype(object)) {
  4873. return nativeKeys(object);
  4874. }
  4875. var result = [];
  4876. for (var key in Object(object)) {
  4877. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  4878. result.push(key);
  4879. }
  4880. }
  4881. return result;
  4882. }
  4883. /**
  4884. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  4885. *
  4886. * @private
  4887. * @param {Object} object The object to query.
  4888. * @returns {Array} Returns the array of property names.
  4889. */
  4890. function baseKeysIn(object) {
  4891. if (!isObject(object)) {
  4892. return nativeKeysIn(object);
  4893. }
  4894. var isProto = isPrototype(object),
  4895. result = [];
  4896. for (var key in object) {
  4897. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  4898. result.push(key);
  4899. }
  4900. }
  4901. return result;
  4902. }
  4903. /**
  4904. * The base implementation of `_.lt` which doesn't coerce arguments.
  4905. *
  4906. * @private
  4907. * @param {*} value The value to compare.
  4908. * @param {*} other The other value to compare.
  4909. * @returns {boolean} Returns `true` if `value` is less than `other`,
  4910. * else `false`.
  4911. */
  4912. function baseLt(value, other) {
  4913. return value < other;
  4914. }
  4915. /**
  4916. * The base implementation of `_.map` without support for iteratee shorthands.
  4917. *
  4918. * @private
  4919. * @param {Array|Object} collection The collection to iterate over.
  4920. * @param {Function} iteratee The function invoked per iteration.
  4921. * @returns {Array} Returns the new mapped array.
  4922. */
  4923. function baseMap(collection, iteratee) {
  4924. var index = -1,
  4925. result = isArrayLike(collection) ? Array(collection.length) : [];
  4926. baseEach(collection, function(value, key, collection) {
  4927. result[++index] = iteratee(value, key, collection);
  4928. });
  4929. return result;
  4930. }
  4931. /**
  4932. * The base implementation of `_.matches` which doesn't clone `source`.
  4933. *
  4934. * @private
  4935. * @param {Object} source The object of property values to match.
  4936. * @returns {Function} Returns the new spec function.
  4937. */
  4938. function baseMatches(source) {
  4939. var matchData = getMatchData(source);
  4940. if (matchData.length == 1 && matchData[0][2]) {
  4941. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  4942. }
  4943. return function(object) {
  4944. return object === source || baseIsMatch(object, source, matchData);
  4945. };
  4946. }
  4947. /**
  4948. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  4949. *
  4950. * @private
  4951. * @param {string} path The path of the property to get.
  4952. * @param {*} srcValue The value to match.
  4953. * @returns {Function} Returns the new spec function.
  4954. */
  4955. function baseMatchesProperty(path, srcValue) {
  4956. if (isKey(path) && isStrictComparable(srcValue)) {
  4957. return matchesStrictComparable(toKey(path), srcValue);
  4958. }
  4959. return function(object) {
  4960. var objValue = get(object, path);
  4961. return (objValue === undefined && objValue === srcValue)
  4962. ? hasIn(object, path)
  4963. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  4964. };
  4965. }
  4966. /**
  4967. * The base implementation of `_.merge` without support for multiple sources.
  4968. *
  4969. * @private
  4970. * @param {Object} object The destination object.
  4971. * @param {Object} source The source object.
  4972. * @param {number} srcIndex The index of `source`.
  4973. * @param {Function} [customizer] The function to customize merged values.
  4974. * @param {Object} [stack] Tracks traversed source values and their merged
  4975. * counterparts.
  4976. */
  4977. function baseMerge(object, source, srcIndex, customizer, stack) {
  4978. if (object === source) {
  4979. return;
  4980. }
  4981. baseFor(source, function(srcValue, key) {
  4982. stack || (stack = new Stack);
  4983. if (isObject(srcValue)) {
  4984. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  4985. }
  4986. else {
  4987. var newValue = customizer
  4988. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  4989. : undefined;
  4990. if (newValue === undefined) {
  4991. newValue = srcValue;
  4992. }
  4993. assignMergeValue(object, key, newValue);
  4994. }
  4995. }, keysIn);
  4996. }
  4997. /**
  4998. * A specialized version of `baseMerge` for arrays and objects which performs
  4999. * deep merges and tracks traversed objects enabling objects with circular
  5000. * references to be merged.
  5001. *
  5002. * @private
  5003. * @param {Object} object The destination object.
  5004. * @param {Object} source The source object.
  5005. * @param {string} key The key of the value to merge.
  5006. * @param {number} srcIndex The index of `source`.
  5007. * @param {Function} mergeFunc The function to merge values.
  5008. * @param {Function} [customizer] The function to customize assigned values.
  5009. * @param {Object} [stack] Tracks traversed source values and their merged
  5010. * counterparts.
  5011. */
  5012. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  5013. var objValue = safeGet(object, key),
  5014. srcValue = safeGet(source, key),
  5015. stacked = stack.get(srcValue);
  5016. if (stacked) {
  5017. assignMergeValue(object, key, stacked);
  5018. return;
  5019. }
  5020. var newValue = customizer
  5021. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  5022. : undefined;
  5023. var isCommon = newValue === undefined;
  5024. if (isCommon) {
  5025. var isArr = isArray(srcValue),
  5026. isBuff = !isArr && isBuffer(srcValue),
  5027. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  5028. newValue = srcValue;
  5029. if (isArr || isBuff || isTyped) {
  5030. if (isArray(objValue)) {
  5031. newValue = objValue;
  5032. }
  5033. else if (isArrayLikeObject(objValue)) {
  5034. newValue = copyArray(objValue);
  5035. }
  5036. else if (isBuff) {
  5037. isCommon = false;
  5038. newValue = cloneBuffer(srcValue, true);
  5039. }
  5040. else if (isTyped) {
  5041. isCommon = false;
  5042. newValue = cloneTypedArray(srcValue, true);
  5043. }
  5044. else {
  5045. newValue = [];
  5046. }
  5047. }
  5048. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  5049. newValue = objValue;
  5050. if (isArguments(objValue)) {
  5051. newValue = toPlainObject(objValue);
  5052. }
  5053. else if (!isObject(objValue) || isFunction(objValue)) {
  5054. newValue = initCloneObject(srcValue);
  5055. }
  5056. }
  5057. else {
  5058. isCommon = false;
  5059. }
  5060. }
  5061. if (isCommon) {
  5062. // Recursively merge objects and arrays (susceptible to call stack limits).
  5063. stack.set(srcValue, newValue);
  5064. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  5065. stack['delete'](srcValue);
  5066. }
  5067. assignMergeValue(object, key, newValue);
  5068. }
  5069. /**
  5070. * The base implementation of `_.nth` which doesn't coerce arguments.
  5071. *
  5072. * @private
  5073. * @param {Array} array The array to query.
  5074. * @param {number} n The index of the element to return.
  5075. * @returns {*} Returns the nth element of `array`.
  5076. */
  5077. function baseNth(array, n) {
  5078. var length = array.length;
  5079. if (!length) {
  5080. return;
  5081. }
  5082. n += n < 0 ? length : 0;
  5083. return isIndex(n, length) ? array[n] : undefined;
  5084. }
  5085. /**
  5086. * The base implementation of `_.orderBy` without param guards.
  5087. *
  5088. * @private
  5089. * @param {Array|Object} collection The collection to iterate over.
  5090. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  5091. * @param {string[]} orders The sort orders of `iteratees`.
  5092. * @returns {Array} Returns the new sorted array.
  5093. */
  5094. function baseOrderBy(collection, iteratees, orders) {
  5095. if (iteratees.length) {
  5096. iteratees = arrayMap(iteratees, function(iteratee) {
  5097. if (isArray(iteratee)) {
  5098. return function(value) {
  5099. return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
  5100. }
  5101. }
  5102. return iteratee;
  5103. });
  5104. } else {
  5105. iteratees = [identity];
  5106. }
  5107. var index = -1;
  5108. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  5109. var result = baseMap(collection, function(value, key, collection) {
  5110. var criteria = arrayMap(iteratees, function(iteratee) {
  5111. return iteratee(value);
  5112. });
  5113. return { 'criteria': criteria, 'index': ++index, 'value': value };
  5114. });
  5115. return baseSortBy(result, function(object, other) {
  5116. return compareMultiple(object, other, orders);
  5117. });
  5118. }
  5119. /**
  5120. * The base implementation of `_.pick` without support for individual
  5121. * property identifiers.
  5122. *
  5123. * @private
  5124. * @param {Object} object The source object.
  5125. * @param {string[]} paths The property paths to pick.
  5126. * @returns {Object} Returns the new object.
  5127. */
  5128. function basePick(object, paths) {
  5129. return basePickBy(object, paths, function(value, path) {
  5130. return hasIn(object, path);
  5131. });
  5132. }
  5133. /**
  5134. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  5135. *
  5136. * @private
  5137. * @param {Object} object The source object.
  5138. * @param {string[]} paths The property paths to pick.
  5139. * @param {Function} predicate The function invoked per property.
  5140. * @returns {Object} Returns the new object.
  5141. */
  5142. function basePickBy(object, paths, predicate) {
  5143. var index = -1,
  5144. length = paths.length,
  5145. result = {};
  5146. while (++index < length) {
  5147. var path = paths[index],
  5148. value = baseGet(object, path);
  5149. if (predicate(value, path)) {
  5150. baseSet(result, castPath(path, object), value);
  5151. }
  5152. }
  5153. return result;
  5154. }
  5155. /**
  5156. * A specialized version of `baseProperty` which supports deep paths.
  5157. *
  5158. * @private
  5159. * @param {Array|string} path The path of the property to get.
  5160. * @returns {Function} Returns the new accessor function.
  5161. */
  5162. function basePropertyDeep(path) {
  5163. return function(object) {
  5164. return baseGet(object, path);
  5165. };
  5166. }
  5167. /**
  5168. * The base implementation of `_.pullAllBy` without support for iteratee
  5169. * shorthands.
  5170. *
  5171. * @private
  5172. * @param {Array} array The array to modify.
  5173. * @param {Array} values The values to remove.
  5174. * @param {Function} [iteratee] The iteratee invoked per element.
  5175. * @param {Function} [comparator] The comparator invoked per element.
  5176. * @returns {Array} Returns `array`.
  5177. */
  5178. function basePullAll(array, values, iteratee, comparator) {
  5179. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  5180. index = -1,
  5181. length = values.length,
  5182. seen = array;
  5183. if (array === values) {
  5184. values = copyArray(values);
  5185. }
  5186. if (iteratee) {
  5187. seen = arrayMap(array, baseUnary(iteratee));
  5188. }
  5189. while (++index < length) {
  5190. var fromIndex = 0,
  5191. value = values[index],
  5192. computed = iteratee ? iteratee(value) : value;
  5193. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  5194. if (seen !== array) {
  5195. splice.call(seen, fromIndex, 1);
  5196. }
  5197. splice.call(array, fromIndex, 1);
  5198. }
  5199. }
  5200. return array;
  5201. }
  5202. /**
  5203. * The base implementation of `_.pullAt` without support for individual
  5204. * indexes or capturing the removed elements.
  5205. *
  5206. * @private
  5207. * @param {Array} array The array to modify.
  5208. * @param {number[]} indexes The indexes of elements to remove.
  5209. * @returns {Array} Returns `array`.
  5210. */
  5211. function basePullAt(array, indexes) {
  5212. var length = array ? indexes.length : 0,
  5213. lastIndex = length - 1;
  5214. while (length--) {
  5215. var index = indexes[length];
  5216. if (length == lastIndex || index !== previous) {
  5217. var previous = index;
  5218. if (isIndex(index)) {
  5219. splice.call(array, index, 1);
  5220. } else {
  5221. baseUnset(array, index);
  5222. }
  5223. }
  5224. }
  5225. return array;
  5226. }
  5227. /**
  5228. * The base implementation of `_.random` without support for returning
  5229. * floating-point numbers.
  5230. *
  5231. * @private
  5232. * @param {number} lower The lower bound.
  5233. * @param {number} upper The upper bound.
  5234. * @returns {number} Returns the random number.
  5235. */
  5236. function baseRandom(lower, upper) {
  5237. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  5238. }
  5239. /**
  5240. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  5241. * coerce arguments.
  5242. *
  5243. * @private
  5244. * @param {number} start The start of the range.
  5245. * @param {number} end The end of the range.
  5246. * @param {number} step The value to increment or decrement by.
  5247. * @param {boolean} [fromRight] Specify iterating from right to left.
  5248. * @returns {Array} Returns the range of numbers.
  5249. */
  5250. function baseRange(start, end, step, fromRight) {
  5251. var index = -1,
  5252. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  5253. result = Array(length);
  5254. while (length--) {
  5255. result[fromRight ? length : ++index] = start;
  5256. start += step;
  5257. }
  5258. return result;
  5259. }
  5260. /**
  5261. * The base implementation of `_.repeat` which doesn't coerce arguments.
  5262. *
  5263. * @private
  5264. * @param {string} string The string to repeat.
  5265. * @param {number} n The number of times to repeat the string.
  5266. * @returns {string} Returns the repeated string.
  5267. */
  5268. function baseRepeat(string, n) {
  5269. var result = '';
  5270. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  5271. return result;
  5272. }
  5273. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  5274. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  5275. do {
  5276. if (n % 2) {
  5277. result += string;
  5278. }
  5279. n = nativeFloor(n / 2);
  5280. if (n) {
  5281. string += string;
  5282. }
  5283. } while (n);
  5284. return result;
  5285. }
  5286. /**
  5287. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  5288. *
  5289. * @private
  5290. * @param {Function} func The function to apply a rest parameter to.
  5291. * @param {number} [start=func.length-1] The start position of the rest parameter.
  5292. * @returns {Function} Returns the new function.
  5293. */
  5294. function baseRest(func, start) {
  5295. return setToString(overRest(func, start, identity), func + '');
  5296. }
  5297. /**
  5298. * The base implementation of `_.sample`.
  5299. *
  5300. * @private
  5301. * @param {Array|Object} collection The collection to sample.
  5302. * @returns {*} Returns the random element.
  5303. */
  5304. function baseSample(collection) {
  5305. return arraySample(values(collection));
  5306. }
  5307. /**
  5308. * The base implementation of `_.sampleSize` without param guards.
  5309. *
  5310. * @private
  5311. * @param {Array|Object} collection The collection to sample.
  5312. * @param {number} n The number of elements to sample.
  5313. * @returns {Array} Returns the random elements.
  5314. */
  5315. function baseSampleSize(collection, n) {
  5316. var array = values(collection);
  5317. return shuffleSelf(array, baseClamp(n, 0, array.length));
  5318. }
  5319. /**
  5320. * The base implementation of `_.set`.
  5321. *
  5322. * @private
  5323. * @param {Object} object The object to modify.
  5324. * @param {Array|string} path The path of the property to set.
  5325. * @param {*} value The value to set.
  5326. * @param {Function} [customizer] The function to customize path creation.
  5327. * @returns {Object} Returns `object`.
  5328. */
  5329. function baseSet(object, path, value, customizer) {
  5330. if (!isObject(object)) {
  5331. return object;
  5332. }
  5333. path = castPath(path, object);
  5334. var index = -1,
  5335. length = path.length,
  5336. lastIndex = length - 1,
  5337. nested = object;
  5338. while (nested != null && ++index < length) {
  5339. var key = toKey(path[index]),
  5340. newValue = value;
  5341. if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
  5342. return object;
  5343. }
  5344. if (index != lastIndex) {
  5345. var objValue = nested[key];
  5346. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  5347. if (newValue === undefined) {
  5348. newValue = isObject(objValue)
  5349. ? objValue
  5350. : (isIndex(path[index + 1]) ? [] : {});
  5351. }
  5352. }
  5353. assignValue(nested, key, newValue);
  5354. nested = nested[key];
  5355. }
  5356. return object;
  5357. }
  5358. /**
  5359. * The base implementation of `setData` without support for hot loop shorting.
  5360. *
  5361. * @private
  5362. * @param {Function} func The function to associate metadata with.
  5363. * @param {*} data The metadata.
  5364. * @returns {Function} Returns `func`.
  5365. */
  5366. var baseSetData = !metaMap ? identity : function(func, data) {
  5367. metaMap.set(func, data);
  5368. return func;
  5369. };
  5370. /**
  5371. * The base implementation of `setToString` without support for hot loop shorting.
  5372. *
  5373. * @private
  5374. * @param {Function} func The function to modify.
  5375. * @param {Function} string The `toString` result.
  5376. * @returns {Function} Returns `func`.
  5377. */
  5378. var baseSetToString = !defineProperty ? identity : function(func, string) {
  5379. return defineProperty(func, 'toString', {
  5380. 'configurable': true,
  5381. 'enumerable': false,
  5382. 'value': constant(string),
  5383. 'writable': true
  5384. });
  5385. };
  5386. /**
  5387. * The base implementation of `_.shuffle`.
  5388. *
  5389. * @private
  5390. * @param {Array|Object} collection The collection to shuffle.
  5391. * @returns {Array} Returns the new shuffled array.
  5392. */
  5393. function baseShuffle(collection) {
  5394. return shuffleSelf(values(collection));
  5395. }
  5396. /**
  5397. * The base implementation of `_.slice` without an iteratee call guard.
  5398. *
  5399. * @private
  5400. * @param {Array} array The array to slice.
  5401. * @param {number} [start=0] The start position.
  5402. * @param {number} [end=array.length] The end position.
  5403. * @returns {Array} Returns the slice of `array`.
  5404. */
  5405. function baseSlice(array, start, end) {
  5406. var index = -1,
  5407. length = array.length;
  5408. if (start < 0) {
  5409. start = -start > length ? 0 : (length + start);
  5410. }
  5411. end = end > length ? length : end;
  5412. if (end < 0) {
  5413. end += length;
  5414. }
  5415. length = start > end ? 0 : ((end - start) >>> 0);
  5416. start >>>= 0;
  5417. var result = Array(length);
  5418. while (++index < length) {
  5419. result[index] = array[index + start];
  5420. }
  5421. return result;
  5422. }
  5423. /**
  5424. * The base implementation of `_.some` without support for iteratee shorthands.
  5425. *
  5426. * @private
  5427. * @param {Array|Object} collection The collection to iterate over.
  5428. * @param {Function} predicate The function invoked per iteration.
  5429. * @returns {boolean} Returns `true` if any element passes the predicate check,
  5430. * else `false`.
  5431. */
  5432. function baseSome(collection, predicate) {
  5433. var result;
  5434. baseEach(collection, function(value, index, collection) {
  5435. result = predicate(value, index, collection);
  5436. return !result;
  5437. });
  5438. return !!result;
  5439. }
  5440. /**
  5441. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  5442. * performs a binary search of `array` to determine the index at which `value`
  5443. * should be inserted into `array` in order to maintain its sort order.
  5444. *
  5445. * @private
  5446. * @param {Array} array The sorted array to inspect.
  5447. * @param {*} value The value to evaluate.
  5448. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  5449. * @returns {number} Returns the index at which `value` should be inserted
  5450. * into `array`.
  5451. */
  5452. function baseSortedIndex(array, value, retHighest) {
  5453. var low = 0,
  5454. high = array == null ? low : array.length;
  5455. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  5456. while (low < high) {
  5457. var mid = (low + high) >>> 1,
  5458. computed = array[mid];
  5459. if (computed !== null && !isSymbol(computed) &&
  5460. (retHighest ? (computed <= value) : (computed < value))) {
  5461. low = mid + 1;
  5462. } else {
  5463. high = mid;
  5464. }
  5465. }
  5466. return high;
  5467. }
  5468. return baseSortedIndexBy(array, value, identity, retHighest);
  5469. }
  5470. /**
  5471. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  5472. * which invokes `iteratee` for `value` and each element of `array` to compute
  5473. * their sort ranking. The iteratee is invoked with one argument; (value).
  5474. *
  5475. * @private
  5476. * @param {Array} array The sorted array to inspect.
  5477. * @param {*} value The value to evaluate.
  5478. * @param {Function} iteratee The iteratee invoked per element.
  5479. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  5480. * @returns {number} Returns the index at which `value` should be inserted
  5481. * into `array`.
  5482. */
  5483. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  5484. var low = 0,
  5485. high = array == null ? 0 : array.length;
  5486. if (high === 0) {
  5487. return 0;
  5488. }
  5489. value = iteratee(value);
  5490. var valIsNaN = value !== value,
  5491. valIsNull = value === null,
  5492. valIsSymbol = isSymbol(value),
  5493. valIsUndefined = value === undefined;
  5494. while (low < high) {
  5495. var mid = nativeFloor((low + high) / 2),
  5496. computed = iteratee(array[mid]),
  5497. othIsDefined = computed !== undefined,
  5498. othIsNull = computed === null,
  5499. othIsReflexive = computed === computed,
  5500. othIsSymbol = isSymbol(computed);
  5501. if (valIsNaN) {
  5502. var setLow = retHighest || othIsReflexive;
  5503. } else if (valIsUndefined) {
  5504. setLow = othIsReflexive && (retHighest || othIsDefined);
  5505. } else if (valIsNull) {
  5506. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  5507. } else if (valIsSymbol) {
  5508. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  5509. } else if (othIsNull || othIsSymbol) {
  5510. setLow = false;
  5511. } else {
  5512. setLow = retHighest ? (computed <= value) : (computed < value);
  5513. }
  5514. if (setLow) {
  5515. low = mid + 1;
  5516. } else {
  5517. high = mid;
  5518. }
  5519. }
  5520. return nativeMin(high, MAX_ARRAY_INDEX);
  5521. }
  5522. /**
  5523. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  5524. * support for iteratee shorthands.
  5525. *
  5526. * @private
  5527. * @param {Array} array The array to inspect.
  5528. * @param {Function} [iteratee] The iteratee invoked per element.
  5529. * @returns {Array} Returns the new duplicate free array.
  5530. */
  5531. function baseSortedUniq(array, iteratee) {
  5532. var index = -1,
  5533. length = array.length,
  5534. resIndex = 0,
  5535. result = [];
  5536. while (++index < length) {
  5537. var value = array[index],
  5538. computed = iteratee ? iteratee(value) : value;
  5539. if (!index || !eq(computed, seen)) {
  5540. var seen = computed;
  5541. result[resIndex++] = value === 0 ? 0 : value;
  5542. }
  5543. }
  5544. return result;
  5545. }
  5546. /**
  5547. * The base implementation of `_.toNumber` which doesn't ensure correct
  5548. * conversions of binary, hexadecimal, or octal string values.
  5549. *
  5550. * @private
  5551. * @param {*} value The value to process.
  5552. * @returns {number} Returns the number.
  5553. */
  5554. function baseToNumber(value) {
  5555. if (typeof value == 'number') {
  5556. return value;
  5557. }
  5558. if (isSymbol(value)) {
  5559. return NAN;
  5560. }
  5561. return +value;
  5562. }
  5563. /**
  5564. * The base implementation of `_.toString` which doesn't convert nullish
  5565. * values to empty strings.
  5566. *
  5567. * @private
  5568. * @param {*} value The value to process.
  5569. * @returns {string} Returns the string.
  5570. */
  5571. function baseToString(value) {
  5572. // Exit early for strings to avoid a performance hit in some environments.
  5573. if (typeof value == 'string') {
  5574. return value;
  5575. }
  5576. if (isArray(value)) {
  5577. // Recursively convert values (susceptible to call stack limits).
  5578. return arrayMap(value, baseToString) + '';
  5579. }
  5580. if (isSymbol(value)) {
  5581. return symbolToString ? symbolToString.call(value) : '';
  5582. }
  5583. var result = (value + '');
  5584. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  5585. }
  5586. /**
  5587. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  5588. *
  5589. * @private
  5590. * @param {Array} array The array to inspect.
  5591. * @param {Function} [iteratee] The iteratee invoked per element.
  5592. * @param {Function} [comparator] The comparator invoked per element.
  5593. * @returns {Array} Returns the new duplicate free array.
  5594. */
  5595. function baseUniq(array, iteratee, comparator) {
  5596. var index = -1,
  5597. includes = arrayIncludes,
  5598. length = array.length,
  5599. isCommon = true,
  5600. result = [],
  5601. seen = result;
  5602. if (comparator) {
  5603. isCommon = false;
  5604. includes = arrayIncludesWith;
  5605. }
  5606. else if (length >= LARGE_ARRAY_SIZE) {
  5607. var set = iteratee ? null : createSet(array);
  5608. if (set) {
  5609. return setToArray(set);
  5610. }
  5611. isCommon = false;
  5612. includes = cacheHas;
  5613. seen = new SetCache;
  5614. }
  5615. else {
  5616. seen = iteratee ? [] : result;
  5617. }
  5618. outer:
  5619. while (++index < length) {
  5620. var value = array[index],
  5621. computed = iteratee ? iteratee(value) : value;
  5622. value = (comparator || value !== 0) ? value : 0;
  5623. if (isCommon && computed === computed) {
  5624. var seenIndex = seen.length;
  5625. while (seenIndex--) {
  5626. if (seen[seenIndex] === computed) {
  5627. continue outer;
  5628. }
  5629. }
  5630. if (iteratee) {
  5631. seen.push(computed);
  5632. }
  5633. result.push(value);
  5634. }
  5635. else if (!includes(seen, computed, comparator)) {
  5636. if (seen !== result) {
  5637. seen.push(computed);
  5638. }
  5639. result.push(value);
  5640. }
  5641. }
  5642. return result;
  5643. }
  5644. /**
  5645. * The base implementation of `_.unset`.
  5646. *
  5647. * @private
  5648. * @param {Object} object The object to modify.
  5649. * @param {Array|string} path The property path to unset.
  5650. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  5651. */
  5652. function baseUnset(object, path) {
  5653. path = castPath(path, object);
  5654. object = parent(object, path);
  5655. return object == null || delete object[toKey(last(path))];
  5656. }
  5657. /**
  5658. * The base implementation of `_.update`.
  5659. *
  5660. * @private
  5661. * @param {Object} object The object to modify.
  5662. * @param {Array|string} path The path of the property to update.
  5663. * @param {Function} updater The function to produce the updated value.
  5664. * @param {Function} [customizer] The function to customize path creation.
  5665. * @returns {Object} Returns `object`.
  5666. */
  5667. function baseUpdate(object, path, updater, customizer) {
  5668. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  5669. }
  5670. /**
  5671. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  5672. * without support for iteratee shorthands.
  5673. *
  5674. * @private
  5675. * @param {Array} array The array to query.
  5676. * @param {Function} predicate The function invoked per iteration.
  5677. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  5678. * @param {boolean} [fromRight] Specify iterating from right to left.
  5679. * @returns {Array} Returns the slice of `array`.
  5680. */
  5681. function baseWhile(array, predicate, isDrop, fromRight) {
  5682. var length = array.length,
  5683. index = fromRight ? length : -1;
  5684. while ((fromRight ? index-- : ++index < length) &&
  5685. predicate(array[index], index, array)) {}
  5686. return isDrop
  5687. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  5688. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  5689. }
  5690. /**
  5691. * The base implementation of `wrapperValue` which returns the result of
  5692. * performing a sequence of actions on the unwrapped `value`, where each
  5693. * successive action is supplied the return value of the previous.
  5694. *
  5695. * @private
  5696. * @param {*} value The unwrapped value.
  5697. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  5698. * @returns {*} Returns the resolved value.
  5699. */
  5700. function baseWrapperValue(value, actions) {
  5701. var result = value;
  5702. if (result instanceof LazyWrapper) {
  5703. result = result.value();
  5704. }
  5705. return arrayReduce(actions, function(result, action) {
  5706. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  5707. }, result);
  5708. }
  5709. /**
  5710. * The base implementation of methods like `_.xor`, without support for
  5711. * iteratee shorthands, that accepts an array of arrays to inspect.
  5712. *
  5713. * @private
  5714. * @param {Array} arrays The arrays to inspect.
  5715. * @param {Function} [iteratee] The iteratee invoked per element.
  5716. * @param {Function} [comparator] The comparator invoked per element.
  5717. * @returns {Array} Returns the new array of values.
  5718. */
  5719. function baseXor(arrays, iteratee, comparator) {
  5720. var length = arrays.length;
  5721. if (length < 2) {
  5722. return length ? baseUniq(arrays[0]) : [];
  5723. }
  5724. var index = -1,
  5725. result = Array(length);
  5726. while (++index < length) {
  5727. var array = arrays[index],
  5728. othIndex = -1;
  5729. while (++othIndex < length) {
  5730. if (othIndex != index) {
  5731. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  5732. }
  5733. }
  5734. }
  5735. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  5736. }
  5737. /**
  5738. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  5739. *
  5740. * @private
  5741. * @param {Array} props The property identifiers.
  5742. * @param {Array} values The property values.
  5743. * @param {Function} assignFunc The function to assign values.
  5744. * @returns {Object} Returns the new object.
  5745. */
  5746. function baseZipObject(props, values, assignFunc) {
  5747. var index = -1,
  5748. length = props.length,
  5749. valsLength = values.length,
  5750. result = {};
  5751. while (++index < length) {
  5752. var value = index < valsLength ? values[index] : undefined;
  5753. assignFunc(result, props[index], value);
  5754. }
  5755. return result;
  5756. }
  5757. /**
  5758. * Casts `value` to an empty array if it's not an array like object.
  5759. *
  5760. * @private
  5761. * @param {*} value The value to inspect.
  5762. * @returns {Array|Object} Returns the cast array-like object.
  5763. */
  5764. function castArrayLikeObject(value) {
  5765. return isArrayLikeObject(value) ? value : [];
  5766. }
  5767. /**
  5768. * Casts `value` to `identity` if it's not a function.
  5769. *
  5770. * @private
  5771. * @param {*} value The value to inspect.
  5772. * @returns {Function} Returns cast function.
  5773. */
  5774. function castFunction(value) {
  5775. return typeof value == 'function' ? value : identity;
  5776. }
  5777. /**
  5778. * Casts `value` to a path array if it's not one.
  5779. *
  5780. * @private
  5781. * @param {*} value The value to inspect.
  5782. * @param {Object} [object] The object to query keys on.
  5783. * @returns {Array} Returns the cast property path array.
  5784. */
  5785. function castPath(value, object) {
  5786. if (isArray(value)) {
  5787. return value;
  5788. }
  5789. return isKey(value, object) ? [value] : stringToPath(toString(value));
  5790. }
  5791. /**
  5792. * A `baseRest` alias which can be replaced with `identity` by module
  5793. * replacement plugins.
  5794. *
  5795. * @private
  5796. * @type {Function}
  5797. * @param {Function} func The function to apply a rest parameter to.
  5798. * @returns {Function} Returns the new function.
  5799. */
  5800. var castRest = baseRest;
  5801. /**
  5802. * Casts `array` to a slice if it's needed.
  5803. *
  5804. * @private
  5805. * @param {Array} array The array to inspect.
  5806. * @param {number} start The start position.
  5807. * @param {number} [end=array.length] The end position.
  5808. * @returns {Array} Returns the cast slice.
  5809. */
  5810. function castSlice(array, start, end) {
  5811. var length = array.length;
  5812. end = end === undefined ? length : end;
  5813. return (!start && end >= length) ? array : baseSlice(array, start, end);
  5814. }
  5815. /**
  5816. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  5817. *
  5818. * @private
  5819. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  5820. */
  5821. var clearTimeout = ctxClearTimeout || function(id) {
  5822. return root.clearTimeout(id);
  5823. };
  5824. /**
  5825. * Creates a clone of `buffer`.
  5826. *
  5827. * @private
  5828. * @param {Buffer} buffer The buffer to clone.
  5829. * @param {boolean} [isDeep] Specify a deep clone.
  5830. * @returns {Buffer} Returns the cloned buffer.
  5831. */
  5832. function cloneBuffer(buffer, isDeep) {
  5833. if (isDeep) {
  5834. return buffer.slice();
  5835. }
  5836. var length = buffer.length,
  5837. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  5838. buffer.copy(result);
  5839. return result;
  5840. }
  5841. /**
  5842. * Creates a clone of `arrayBuffer`.
  5843. *
  5844. * @private
  5845. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  5846. * @returns {ArrayBuffer} Returns the cloned array buffer.
  5847. */
  5848. function cloneArrayBuffer(arrayBuffer) {
  5849. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  5850. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  5851. return result;
  5852. }
  5853. /**
  5854. * Creates a clone of `dataView`.
  5855. *
  5856. * @private
  5857. * @param {Object} dataView The data view to clone.
  5858. * @param {boolean} [isDeep] Specify a deep clone.
  5859. * @returns {Object} Returns the cloned data view.
  5860. */
  5861. function cloneDataView(dataView, isDeep) {
  5862. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  5863. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  5864. }
  5865. /**
  5866. * Creates a clone of `regexp`.
  5867. *
  5868. * @private
  5869. * @param {Object} regexp The regexp to clone.
  5870. * @returns {Object} Returns the cloned regexp.
  5871. */
  5872. function cloneRegExp(regexp) {
  5873. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  5874. result.lastIndex = regexp.lastIndex;
  5875. return result;
  5876. }
  5877. /**
  5878. * Creates a clone of the `symbol` object.
  5879. *
  5880. * @private
  5881. * @param {Object} symbol The symbol object to clone.
  5882. * @returns {Object} Returns the cloned symbol object.
  5883. */
  5884. function cloneSymbol(symbol) {
  5885. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  5886. }
  5887. /**
  5888. * Creates a clone of `typedArray`.
  5889. *
  5890. * @private
  5891. * @param {Object} typedArray The typed array to clone.
  5892. * @param {boolean} [isDeep] Specify a deep clone.
  5893. * @returns {Object} Returns the cloned typed array.
  5894. */
  5895. function cloneTypedArray(typedArray, isDeep) {
  5896. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  5897. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  5898. }
  5899. /**
  5900. * Compares values to sort them in ascending order.
  5901. *
  5902. * @private
  5903. * @param {*} value The value to compare.
  5904. * @param {*} other The other value to compare.
  5905. * @returns {number} Returns the sort order indicator for `value`.
  5906. */
  5907. function compareAscending(value, other) {
  5908. if (value !== other) {
  5909. var valIsDefined = value !== undefined,
  5910. valIsNull = value === null,
  5911. valIsReflexive = value === value,
  5912. valIsSymbol = isSymbol(value);
  5913. var othIsDefined = other !== undefined,
  5914. othIsNull = other === null,
  5915. othIsReflexive = other === other,
  5916. othIsSymbol = isSymbol(other);
  5917. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  5918. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  5919. (valIsNull && othIsDefined && othIsReflexive) ||
  5920. (!valIsDefined && othIsReflexive) ||
  5921. !valIsReflexive) {
  5922. return 1;
  5923. }
  5924. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  5925. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  5926. (othIsNull && valIsDefined && valIsReflexive) ||
  5927. (!othIsDefined && valIsReflexive) ||
  5928. !othIsReflexive) {
  5929. return -1;
  5930. }
  5931. }
  5932. return 0;
  5933. }
  5934. /**
  5935. * Used by `_.orderBy` to compare multiple properties of a value to another
  5936. * and stable sort them.
  5937. *
  5938. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  5939. * specify an order of "desc" for descending or "asc" for ascending sort order
  5940. * of corresponding values.
  5941. *
  5942. * @private
  5943. * @param {Object} object The object to compare.
  5944. * @param {Object} other The other object to compare.
  5945. * @param {boolean[]|string[]} orders The order to sort by for each property.
  5946. * @returns {number} Returns the sort order indicator for `object`.
  5947. */
  5948. function compareMultiple(object, other, orders) {
  5949. var index = -1,
  5950. objCriteria = object.criteria,
  5951. othCriteria = other.criteria,
  5952. length = objCriteria.length,
  5953. ordersLength = orders.length;
  5954. while (++index < length) {
  5955. var result = compareAscending(objCriteria[index], othCriteria[index]);
  5956. if (result) {
  5957. if (index >= ordersLength) {
  5958. return result;
  5959. }
  5960. var order = orders[index];
  5961. return result * (order == 'desc' ? -1 : 1);
  5962. }
  5963. }
  5964. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  5965. // that causes it, under certain circumstances, to provide the same value for
  5966. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  5967. // for more details.
  5968. //
  5969. // This also ensures a stable sort in V8 and other engines.
  5970. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  5971. return object.index - other.index;
  5972. }
  5973. /**
  5974. * Creates an array that is the composition of partially applied arguments,
  5975. * placeholders, and provided arguments into a single array of arguments.
  5976. *
  5977. * @private
  5978. * @param {Array} args The provided arguments.
  5979. * @param {Array} partials The arguments to prepend to those provided.
  5980. * @param {Array} holders The `partials` placeholder indexes.
  5981. * @params {boolean} [isCurried] Specify composing for a curried function.
  5982. * @returns {Array} Returns the new array of composed arguments.
  5983. */
  5984. function composeArgs(args, partials, holders, isCurried) {
  5985. var argsIndex = -1,
  5986. argsLength = args.length,
  5987. holdersLength = holders.length,
  5988. leftIndex = -1,
  5989. leftLength = partials.length,
  5990. rangeLength = nativeMax(argsLength - holdersLength, 0),
  5991. result = Array(leftLength + rangeLength),
  5992. isUncurried = !isCurried;
  5993. while (++leftIndex < leftLength) {
  5994. result[leftIndex] = partials[leftIndex];
  5995. }
  5996. while (++argsIndex < holdersLength) {
  5997. if (isUncurried || argsIndex < argsLength) {
  5998. result[holders[argsIndex]] = args[argsIndex];
  5999. }
  6000. }
  6001. while (rangeLength--) {
  6002. result[leftIndex++] = args[argsIndex++];
  6003. }
  6004. return result;
  6005. }
  6006. /**
  6007. * This function is like `composeArgs` except that the arguments composition
  6008. * is tailored for `_.partialRight`.
  6009. *
  6010. * @private
  6011. * @param {Array} args The provided arguments.
  6012. * @param {Array} partials The arguments to append to those provided.
  6013. * @param {Array} holders The `partials` placeholder indexes.
  6014. * @params {boolean} [isCurried] Specify composing for a curried function.
  6015. * @returns {Array} Returns the new array of composed arguments.
  6016. */
  6017. function composeArgsRight(args, partials, holders, isCurried) {
  6018. var argsIndex = -1,
  6019. argsLength = args.length,
  6020. holdersIndex = -1,
  6021. holdersLength = holders.length,
  6022. rightIndex = -1,
  6023. rightLength = partials.length,
  6024. rangeLength = nativeMax(argsLength - holdersLength, 0),
  6025. result = Array(rangeLength + rightLength),
  6026. isUncurried = !isCurried;
  6027. while (++argsIndex < rangeLength) {
  6028. result[argsIndex] = args[argsIndex];
  6029. }
  6030. var offset = argsIndex;
  6031. while (++rightIndex < rightLength) {
  6032. result[offset + rightIndex] = partials[rightIndex];
  6033. }
  6034. while (++holdersIndex < holdersLength) {
  6035. if (isUncurried || argsIndex < argsLength) {
  6036. result[offset + holders[holdersIndex]] = args[argsIndex++];
  6037. }
  6038. }
  6039. return result;
  6040. }
  6041. /**
  6042. * Copies the values of `source` to `array`.
  6043. *
  6044. * @private
  6045. * @param {Array} source The array to copy values from.
  6046. * @param {Array} [array=[]] The array to copy values to.
  6047. * @returns {Array} Returns `array`.
  6048. */
  6049. function copyArray(source, array) {
  6050. var index = -1,
  6051. length = source.length;
  6052. array || (array = Array(length));
  6053. while (++index < length) {
  6054. array[index] = source[index];
  6055. }
  6056. return array;
  6057. }
  6058. /**
  6059. * Copies properties of `source` to `object`.
  6060. *
  6061. * @private
  6062. * @param {Object} source The object to copy properties from.
  6063. * @param {Array} props The property identifiers to copy.
  6064. * @param {Object} [object={}] The object to copy properties to.
  6065. * @param {Function} [customizer] The function to customize copied values.
  6066. * @returns {Object} Returns `object`.
  6067. */
  6068. function copyObject(source, props, object, customizer) {
  6069. var isNew = !object;
  6070. object || (object = {});
  6071. var index = -1,
  6072. length = props.length;
  6073. while (++index < length) {
  6074. var key = props[index];
  6075. var newValue = customizer
  6076. ? customizer(object[key], source[key], key, object, source)
  6077. : undefined;
  6078. if (newValue === undefined) {
  6079. newValue = source[key];
  6080. }
  6081. if (isNew) {
  6082. baseAssignValue(object, key, newValue);
  6083. } else {
  6084. assignValue(object, key, newValue);
  6085. }
  6086. }
  6087. return object;
  6088. }
  6089. /**
  6090. * Copies own symbols of `source` to `object`.
  6091. *
  6092. * @private
  6093. * @param {Object} source The object to copy symbols from.
  6094. * @param {Object} [object={}] The object to copy symbols to.
  6095. * @returns {Object} Returns `object`.
  6096. */
  6097. function copySymbols(source, object) {
  6098. return copyObject(source, getSymbols(source), object);
  6099. }
  6100. /**
  6101. * Copies own and inherited symbols of `source` to `object`.
  6102. *
  6103. * @private
  6104. * @param {Object} source The object to copy symbols from.
  6105. * @param {Object} [object={}] The object to copy symbols to.
  6106. * @returns {Object} Returns `object`.
  6107. */
  6108. function copySymbolsIn(source, object) {
  6109. return copyObject(source, getSymbolsIn(source), object);
  6110. }
  6111. /**
  6112. * Creates a function like `_.groupBy`.
  6113. *
  6114. * @private
  6115. * @param {Function} setter The function to set accumulator values.
  6116. * @param {Function} [initializer] The accumulator object initializer.
  6117. * @returns {Function} Returns the new aggregator function.
  6118. */
  6119. function createAggregator(setter, initializer) {
  6120. return function(collection, iteratee) {
  6121. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  6122. accumulator = initializer ? initializer() : {};
  6123. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  6124. };
  6125. }
  6126. /**
  6127. * Creates a function like `_.assign`.
  6128. *
  6129. * @private
  6130. * @param {Function} assigner The function to assign values.
  6131. * @returns {Function} Returns the new assigner function.
  6132. */
  6133. function createAssigner(assigner) {
  6134. return baseRest(function(object, sources) {
  6135. var index = -1,
  6136. length = sources.length,
  6137. customizer = length > 1 ? sources[length - 1] : undefined,
  6138. guard = length > 2 ? sources[2] : undefined;
  6139. customizer = (assigner.length > 3 && typeof customizer == 'function')
  6140. ? (length--, customizer)
  6141. : undefined;
  6142. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  6143. customizer = length < 3 ? undefined : customizer;
  6144. length = 1;
  6145. }
  6146. object = Object(object);
  6147. while (++index < length) {
  6148. var source = sources[index];
  6149. if (source) {
  6150. assigner(object, source, index, customizer);
  6151. }
  6152. }
  6153. return object;
  6154. });
  6155. }
  6156. /**
  6157. * Creates a `baseEach` or `baseEachRight` function.
  6158. *
  6159. * @private
  6160. * @param {Function} eachFunc The function to iterate over a collection.
  6161. * @param {boolean} [fromRight] Specify iterating from right to left.
  6162. * @returns {Function} Returns the new base function.
  6163. */
  6164. function createBaseEach(eachFunc, fromRight) {
  6165. return function(collection, iteratee) {
  6166. if (collection == null) {
  6167. return collection;
  6168. }
  6169. if (!isArrayLike(collection)) {
  6170. return eachFunc(collection, iteratee);
  6171. }
  6172. var length = collection.length,
  6173. index = fromRight ? length : -1,
  6174. iterable = Object(collection);
  6175. while ((fromRight ? index-- : ++index < length)) {
  6176. if (iteratee(iterable[index], index, iterable) === false) {
  6177. break;
  6178. }
  6179. }
  6180. return collection;
  6181. };
  6182. }
  6183. /**
  6184. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  6185. *
  6186. * @private
  6187. * @param {boolean} [fromRight] Specify iterating from right to left.
  6188. * @returns {Function} Returns the new base function.
  6189. */
  6190. function createBaseFor(fromRight) {
  6191. return function(object, iteratee, keysFunc) {
  6192. var index = -1,
  6193. iterable = Object(object),
  6194. props = keysFunc(object),
  6195. length = props.length;
  6196. while (length--) {
  6197. var key = props[fromRight ? length : ++index];
  6198. if (iteratee(iterable[key], key, iterable) === false) {
  6199. break;
  6200. }
  6201. }
  6202. return object;
  6203. };
  6204. }
  6205. /**
  6206. * Creates a function that wraps `func` to invoke it with the optional `this`
  6207. * binding of `thisArg`.
  6208. *
  6209. * @private
  6210. * @param {Function} func The function to wrap.
  6211. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  6212. * @param {*} [thisArg] The `this` binding of `func`.
  6213. * @returns {Function} Returns the new wrapped function.
  6214. */
  6215. function createBind(func, bitmask, thisArg) {
  6216. var isBind = bitmask & WRAP_BIND_FLAG,
  6217. Ctor = createCtor(func);
  6218. function wrapper() {
  6219. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  6220. return fn.apply(isBind ? thisArg : this, arguments);
  6221. }
  6222. return wrapper;
  6223. }
  6224. /**
  6225. * Creates a function like `_.lowerFirst`.
  6226. *
  6227. * @private
  6228. * @param {string} methodName The name of the `String` case method to use.
  6229. * @returns {Function} Returns the new case function.
  6230. */
  6231. function createCaseFirst(methodName) {
  6232. return function(string) {
  6233. string = toString(string);
  6234. var strSymbols = hasUnicode(string)
  6235. ? stringToArray(string)
  6236. : undefined;
  6237. var chr = strSymbols
  6238. ? strSymbols[0]
  6239. : string.charAt(0);
  6240. var trailing = strSymbols
  6241. ? castSlice(strSymbols, 1).join('')
  6242. : string.slice(1);
  6243. return chr[methodName]() + trailing;
  6244. };
  6245. }
  6246. /**
  6247. * Creates a function like `_.camelCase`.
  6248. *
  6249. * @private
  6250. * @param {Function} callback The function to combine each word.
  6251. * @returns {Function} Returns the new compounder function.
  6252. */
  6253. function createCompounder(callback) {
  6254. return function(string) {
  6255. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  6256. };
  6257. }
  6258. /**
  6259. * Creates a function that produces an instance of `Ctor` regardless of
  6260. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  6261. *
  6262. * @private
  6263. * @param {Function} Ctor The constructor to wrap.
  6264. * @returns {Function} Returns the new wrapped function.
  6265. */
  6266. function createCtor(Ctor) {
  6267. return function() {
  6268. // Use a `switch` statement to work with class constructors. See
  6269. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  6270. // for more details.
  6271. var args = arguments;
  6272. switch (args.length) {
  6273. case 0: return new Ctor;
  6274. case 1: return new Ctor(args[0]);
  6275. case 2: return new Ctor(args[0], args[1]);
  6276. case 3: return new Ctor(args[0], args[1], args[2]);
  6277. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  6278. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  6279. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  6280. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  6281. }
  6282. var thisBinding = baseCreate(Ctor.prototype),
  6283. result = Ctor.apply(thisBinding, args);
  6284. // Mimic the constructor's `return` behavior.
  6285. // See https://es5.github.io/#x13.2.2 for more details.
  6286. return isObject(result) ? result : thisBinding;
  6287. };
  6288. }
  6289. /**
  6290. * Creates a function that wraps `func` to enable currying.
  6291. *
  6292. * @private
  6293. * @param {Function} func The function to wrap.
  6294. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  6295. * @param {number} arity The arity of `func`.
  6296. * @returns {Function} Returns the new wrapped function.
  6297. */
  6298. function createCurry(func, bitmask, arity) {
  6299. var Ctor = createCtor(func);
  6300. function wrapper() {
  6301. var length = arguments.length,
  6302. args = Array(length),
  6303. index = length,
  6304. placeholder = getHolder(wrapper);
  6305. while (index--) {
  6306. args[index] = arguments[index];
  6307. }
  6308. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  6309. ? []
  6310. : replaceHolders(args, placeholder);
  6311. length -= holders.length;
  6312. if (length < arity) {
  6313. return createRecurry(
  6314. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  6315. args, holders, undefined, undefined, arity - length);
  6316. }
  6317. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  6318. return apply(fn, this, args);
  6319. }
  6320. return wrapper;
  6321. }
  6322. /**
  6323. * Creates a `_.find` or `_.findLast` function.
  6324. *
  6325. * @private
  6326. * @param {Function} findIndexFunc The function to find the collection index.
  6327. * @returns {Function} Returns the new find function.
  6328. */
  6329. function createFind(findIndexFunc) {
  6330. return function(collection, predicate, fromIndex) {
  6331. var iterable = Object(collection);
  6332. if (!isArrayLike(collection)) {
  6333. var iteratee = getIteratee(predicate, 3);
  6334. collection = keys(collection);
  6335. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  6336. }
  6337. var index = findIndexFunc(collection, predicate, fromIndex);
  6338. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  6339. };
  6340. }
  6341. /**
  6342. * Creates a `_.flow` or `_.flowRight` function.
  6343. *
  6344. * @private
  6345. * @param {boolean} [fromRight] Specify iterating from right to left.
  6346. * @returns {Function} Returns the new flow function.
  6347. */
  6348. function createFlow(fromRight) {
  6349. return flatRest(function(funcs) {
  6350. var length = funcs.length,
  6351. index = length,
  6352. prereq = LodashWrapper.prototype.thru;
  6353. if (fromRight) {
  6354. funcs.reverse();
  6355. }
  6356. while (index--) {
  6357. var func = funcs[index];
  6358. if (typeof func != 'function') {
  6359. throw new TypeError(FUNC_ERROR_TEXT);
  6360. }
  6361. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  6362. var wrapper = new LodashWrapper([], true);
  6363. }
  6364. }
  6365. index = wrapper ? index : length;
  6366. while (++index < length) {
  6367. func = funcs[index];
  6368. var funcName = getFuncName(func),
  6369. data = funcName == 'wrapper' ? getData(func) : undefined;
  6370. if (data && isLaziable(data[0]) &&
  6371. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  6372. !data[4].length && data[9] == 1
  6373. ) {
  6374. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  6375. } else {
  6376. wrapper = (func.length == 1 && isLaziable(func))
  6377. ? wrapper[funcName]()
  6378. : wrapper.thru(func);
  6379. }
  6380. }
  6381. return function() {
  6382. var args = arguments,
  6383. value = args[0];
  6384. if (wrapper && args.length == 1 && isArray(value)) {
  6385. return wrapper.plant(value).value();
  6386. }
  6387. var index = 0,
  6388. result = length ? funcs[index].apply(this, args) : value;
  6389. while (++index < length) {
  6390. result = funcs[index].call(this, result);
  6391. }
  6392. return result;
  6393. };
  6394. });
  6395. }
  6396. /**
  6397. * Creates a function that wraps `func` to invoke it with optional `this`
  6398. * binding of `thisArg`, partial application, and currying.
  6399. *
  6400. * @private
  6401. * @param {Function|string} func The function or method name to wrap.
  6402. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  6403. * @param {*} [thisArg] The `this` binding of `func`.
  6404. * @param {Array} [partials] The arguments to prepend to those provided to
  6405. * the new function.
  6406. * @param {Array} [holders] The `partials` placeholder indexes.
  6407. * @param {Array} [partialsRight] The arguments to append to those provided
  6408. * to the new function.
  6409. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  6410. * @param {Array} [argPos] The argument positions of the new function.
  6411. * @param {number} [ary] The arity cap of `func`.
  6412. * @param {number} [arity] The arity of `func`.
  6413. * @returns {Function} Returns the new wrapped function.
  6414. */
  6415. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  6416. var isAry = bitmask & WRAP_ARY_FLAG,
  6417. isBind = bitmask & WRAP_BIND_FLAG,
  6418. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  6419. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  6420. isFlip = bitmask & WRAP_FLIP_FLAG,
  6421. Ctor = isBindKey ? undefined : createCtor(func);
  6422. function wrapper() {
  6423. var length = arguments.length,
  6424. args = Array(length),
  6425. index = length;
  6426. while (index--) {
  6427. args[index] = arguments[index];
  6428. }
  6429. if (isCurried) {
  6430. var placeholder = getHolder(wrapper),
  6431. holdersCount = countHolders(args, placeholder);
  6432. }
  6433. if (partials) {
  6434. args = composeArgs(args, partials, holders, isCurried);
  6435. }
  6436. if (partialsRight) {
  6437. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  6438. }
  6439. length -= holdersCount;
  6440. if (isCurried && length < arity) {
  6441. var newHolders = replaceHolders(args, placeholder);
  6442. return createRecurry(
  6443. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  6444. args, newHolders, argPos, ary, arity - length
  6445. );
  6446. }
  6447. var thisBinding = isBind ? thisArg : this,
  6448. fn = isBindKey ? thisBinding[func] : func;
  6449. length = args.length;
  6450. if (argPos) {
  6451. args = reorder(args, argPos);
  6452. } else if (isFlip && length > 1) {
  6453. args.reverse();
  6454. }
  6455. if (isAry && ary < length) {
  6456. args.length = ary;
  6457. }
  6458. if (this && this !== root && this instanceof wrapper) {
  6459. fn = Ctor || createCtor(fn);
  6460. }
  6461. return fn.apply(thisBinding, args);
  6462. }
  6463. return wrapper;
  6464. }
  6465. /**
  6466. * Creates a function like `_.invertBy`.
  6467. *
  6468. * @private
  6469. * @param {Function} setter The function to set accumulator values.
  6470. * @param {Function} toIteratee The function to resolve iteratees.
  6471. * @returns {Function} Returns the new inverter function.
  6472. */
  6473. function createInverter(setter, toIteratee) {
  6474. return function(object, iteratee) {
  6475. return baseInverter(object, setter, toIteratee(iteratee), {});
  6476. };
  6477. }
  6478. /**
  6479. * Creates a function that performs a mathematical operation on two values.
  6480. *
  6481. * @private
  6482. * @param {Function} operator The function to perform the operation.
  6483. * @param {number} [defaultValue] The value used for `undefined` arguments.
  6484. * @returns {Function} Returns the new mathematical operation function.
  6485. */
  6486. function createMathOperation(operator, defaultValue) {
  6487. return function(value, other) {
  6488. var result;
  6489. if (value === undefined && other === undefined) {
  6490. return defaultValue;
  6491. }
  6492. if (value !== undefined) {
  6493. result = value;
  6494. }
  6495. if (other !== undefined) {
  6496. if (result === undefined) {
  6497. return other;
  6498. }
  6499. if (typeof value == 'string' || typeof other == 'string') {
  6500. value = baseToString(value);
  6501. other = baseToString(other);
  6502. } else {
  6503. value = baseToNumber(value);
  6504. other = baseToNumber(other);
  6505. }
  6506. result = operator(value, other);
  6507. }
  6508. return result;
  6509. };
  6510. }
  6511. /**
  6512. * Creates a function like `_.over`.
  6513. *
  6514. * @private
  6515. * @param {Function} arrayFunc The function to iterate over iteratees.
  6516. * @returns {Function} Returns the new over function.
  6517. */
  6518. function createOver(arrayFunc) {
  6519. return flatRest(function(iteratees) {
  6520. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  6521. return baseRest(function(args) {
  6522. var thisArg = this;
  6523. return arrayFunc(iteratees, function(iteratee) {
  6524. return apply(iteratee, thisArg, args);
  6525. });
  6526. });
  6527. });
  6528. }
  6529. /**
  6530. * Creates the padding for `string` based on `length`. The `chars` string
  6531. * is truncated if the number of characters exceeds `length`.
  6532. *
  6533. * @private
  6534. * @param {number} length The padding length.
  6535. * @param {string} [chars=' '] The string used as padding.
  6536. * @returns {string} Returns the padding for `string`.
  6537. */
  6538. function createPadding(length, chars) {
  6539. chars = chars === undefined ? ' ' : baseToString(chars);
  6540. var charsLength = chars.length;
  6541. if (charsLength < 2) {
  6542. return charsLength ? baseRepeat(chars, length) : chars;
  6543. }
  6544. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  6545. return hasUnicode(chars)
  6546. ? castSlice(stringToArray(result), 0, length).join('')
  6547. : result.slice(0, length);
  6548. }
  6549. /**
  6550. * Creates a function that wraps `func` to invoke it with the `this` binding
  6551. * of `thisArg` and `partials` prepended to the arguments it receives.
  6552. *
  6553. * @private
  6554. * @param {Function} func The function to wrap.
  6555. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  6556. * @param {*} thisArg The `this` binding of `func`.
  6557. * @param {Array} partials The arguments to prepend to those provided to
  6558. * the new function.
  6559. * @returns {Function} Returns the new wrapped function.
  6560. */
  6561. function createPartial(func, bitmask, thisArg, partials) {
  6562. var isBind = bitmask & WRAP_BIND_FLAG,
  6563. Ctor = createCtor(func);
  6564. function wrapper() {
  6565. var argsIndex = -1,
  6566. argsLength = arguments.length,
  6567. leftIndex = -1,
  6568. leftLength = partials.length,
  6569. args = Array(leftLength + argsLength),
  6570. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  6571. while (++leftIndex < leftLength) {
  6572. args[leftIndex] = partials[leftIndex];
  6573. }
  6574. while (argsLength--) {
  6575. args[leftIndex++] = arguments[++argsIndex];
  6576. }
  6577. return apply(fn, isBind ? thisArg : this, args);
  6578. }
  6579. return wrapper;
  6580. }
  6581. /**
  6582. * Creates a `_.range` or `_.rangeRight` function.
  6583. *
  6584. * @private
  6585. * @param {boolean} [fromRight] Specify iterating from right to left.
  6586. * @returns {Function} Returns the new range function.
  6587. */
  6588. function createRange(fromRight) {
  6589. return function(start, end, step) {
  6590. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  6591. end = step = undefined;
  6592. }
  6593. // Ensure the sign of `-0` is preserved.
  6594. start = toFinite(start);
  6595. if (end === undefined) {
  6596. end = start;
  6597. start = 0;
  6598. } else {
  6599. end = toFinite(end);
  6600. }
  6601. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  6602. return baseRange(start, end, step, fromRight);
  6603. };
  6604. }
  6605. /**
  6606. * Creates a function that performs a relational operation on two values.
  6607. *
  6608. * @private
  6609. * @param {Function} operator The function to perform the operation.
  6610. * @returns {Function} Returns the new relational operation function.
  6611. */
  6612. function createRelationalOperation(operator) {
  6613. return function(value, other) {
  6614. if (!(typeof value == 'string' && typeof other == 'string')) {
  6615. value = toNumber(value);
  6616. other = toNumber(other);
  6617. }
  6618. return operator(value, other);
  6619. };
  6620. }
  6621. /**
  6622. * Creates a function that wraps `func` to continue currying.
  6623. *
  6624. * @private
  6625. * @param {Function} func The function to wrap.
  6626. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  6627. * @param {Function} wrapFunc The function to create the `func` wrapper.
  6628. * @param {*} placeholder The placeholder value.
  6629. * @param {*} [thisArg] The `this` binding of `func`.
  6630. * @param {Array} [partials] The arguments to prepend to those provided to
  6631. * the new function.
  6632. * @param {Array} [holders] The `partials` placeholder indexes.
  6633. * @param {Array} [argPos] The argument positions of the new function.
  6634. * @param {number} [ary] The arity cap of `func`.
  6635. * @param {number} [arity] The arity of `func`.
  6636. * @returns {Function} Returns the new wrapped function.
  6637. */
  6638. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  6639. var isCurry = bitmask & WRAP_CURRY_FLAG,
  6640. newHolders = isCurry ? holders : undefined,
  6641. newHoldersRight = isCurry ? undefined : holders,
  6642. newPartials = isCurry ? partials : undefined,
  6643. newPartialsRight = isCurry ? undefined : partials;
  6644. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  6645. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  6646. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  6647. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  6648. }
  6649. var newData = [
  6650. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  6651. newHoldersRight, argPos, ary, arity
  6652. ];
  6653. var result = wrapFunc.apply(undefined, newData);
  6654. if (isLaziable(func)) {
  6655. setData(result, newData);
  6656. }
  6657. result.placeholder = placeholder;
  6658. return setWrapToString(result, func, bitmask);
  6659. }
  6660. /**
  6661. * Creates a function like `_.round`.
  6662. *
  6663. * @private
  6664. * @param {string} methodName The name of the `Math` method to use when rounding.
  6665. * @returns {Function} Returns the new round function.
  6666. */
  6667. function createRound(methodName) {
  6668. var func = Math[methodName];
  6669. return function(number, precision) {
  6670. number = toNumber(number);
  6671. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  6672. if (precision && nativeIsFinite(number)) {
  6673. // Shift with exponential notation to avoid floating-point issues.
  6674. // See [MDN](https://mdn.io/round#Examples) for more details.
  6675. var pair = (toString(number) + 'e').split('e'),
  6676. value = func(pair[0] + 'e' + (+pair[1] + precision));
  6677. pair = (toString(value) + 'e').split('e');
  6678. return +(pair[0] + 'e' + (+pair[1] - precision));
  6679. }
  6680. return func(number);
  6681. };
  6682. }
  6683. /**
  6684. * Creates a set object of `values`.
  6685. *
  6686. * @private
  6687. * @param {Array} values The values to add to the set.
  6688. * @returns {Object} Returns the new set.
  6689. */
  6690. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  6691. return new Set(values);
  6692. };
  6693. /**
  6694. * Creates a `_.toPairs` or `_.toPairsIn` function.
  6695. *
  6696. * @private
  6697. * @param {Function} keysFunc The function to get the keys of a given object.
  6698. * @returns {Function} Returns the new pairs function.
  6699. */
  6700. function createToPairs(keysFunc) {
  6701. return function(object) {
  6702. var tag = getTag(object);
  6703. if (tag == mapTag) {
  6704. return mapToArray(object);
  6705. }
  6706. if (tag == setTag) {
  6707. return setToPairs(object);
  6708. }
  6709. return baseToPairs(object, keysFunc(object));
  6710. };
  6711. }
  6712. /**
  6713. * Creates a function that either curries or invokes `func` with optional
  6714. * `this` binding and partially applied arguments.
  6715. *
  6716. * @private
  6717. * @param {Function|string} func The function or method name to wrap.
  6718. * @param {number} bitmask The bitmask flags.
  6719. * 1 - `_.bind`
  6720. * 2 - `_.bindKey`
  6721. * 4 - `_.curry` or `_.curryRight` of a bound function
  6722. * 8 - `_.curry`
  6723. * 16 - `_.curryRight`
  6724. * 32 - `_.partial`
  6725. * 64 - `_.partialRight`
  6726. * 128 - `_.rearg`
  6727. * 256 - `_.ary`
  6728. * 512 - `_.flip`
  6729. * @param {*} [thisArg] The `this` binding of `func`.
  6730. * @param {Array} [partials] The arguments to be partially applied.
  6731. * @param {Array} [holders] The `partials` placeholder indexes.
  6732. * @param {Array} [argPos] The argument positions of the new function.
  6733. * @param {number} [ary] The arity cap of `func`.
  6734. * @param {number} [arity] The arity of `func`.
  6735. * @returns {Function} Returns the new wrapped function.
  6736. */
  6737. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  6738. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  6739. if (!isBindKey && typeof func != 'function') {
  6740. throw new TypeError(FUNC_ERROR_TEXT);
  6741. }
  6742. var length = partials ? partials.length : 0;
  6743. if (!length) {
  6744. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  6745. partials = holders = undefined;
  6746. }
  6747. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  6748. arity = arity === undefined ? arity : toInteger(arity);
  6749. length -= holders ? holders.length : 0;
  6750. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  6751. var partialsRight = partials,
  6752. holdersRight = holders;
  6753. partials = holders = undefined;
  6754. }
  6755. var data = isBindKey ? undefined : getData(func);
  6756. var newData = [
  6757. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  6758. argPos, ary, arity
  6759. ];
  6760. if (data) {
  6761. mergeData(newData, data);
  6762. }
  6763. func = newData[0];
  6764. bitmask = newData[1];
  6765. thisArg = newData[2];
  6766. partials = newData[3];
  6767. holders = newData[4];
  6768. arity = newData[9] = newData[9] === undefined
  6769. ? (isBindKey ? 0 : func.length)
  6770. : nativeMax(newData[9] - length, 0);
  6771. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  6772. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  6773. }
  6774. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  6775. var result = createBind(func, bitmask, thisArg);
  6776. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  6777. result = createCurry(func, bitmask, arity);
  6778. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  6779. result = createPartial(func, bitmask, thisArg, partials);
  6780. } else {
  6781. result = createHybrid.apply(undefined, newData);
  6782. }
  6783. var setter = data ? baseSetData : setData;
  6784. return setWrapToString(setter(result, newData), func, bitmask);
  6785. }
  6786. /**
  6787. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  6788. * of source objects to the destination object for all destination properties
  6789. * that resolve to `undefined`.
  6790. *
  6791. * @private
  6792. * @param {*} objValue The destination value.
  6793. * @param {*} srcValue The source value.
  6794. * @param {string} key The key of the property to assign.
  6795. * @param {Object} object The parent object of `objValue`.
  6796. * @returns {*} Returns the value to assign.
  6797. */
  6798. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  6799. if (objValue === undefined ||
  6800. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  6801. return srcValue;
  6802. }
  6803. return objValue;
  6804. }
  6805. /**
  6806. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  6807. * objects into destination objects that are passed thru.
  6808. *
  6809. * @private
  6810. * @param {*} objValue The destination value.
  6811. * @param {*} srcValue The source value.
  6812. * @param {string} key The key of the property to merge.
  6813. * @param {Object} object The parent object of `objValue`.
  6814. * @param {Object} source The parent object of `srcValue`.
  6815. * @param {Object} [stack] Tracks traversed source values and their merged
  6816. * counterparts.
  6817. * @returns {*} Returns the value to assign.
  6818. */
  6819. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  6820. if (isObject(objValue) && isObject(srcValue)) {
  6821. // Recursively merge objects and arrays (susceptible to call stack limits).
  6822. stack.set(srcValue, objValue);
  6823. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  6824. stack['delete'](srcValue);
  6825. }
  6826. return objValue;
  6827. }
  6828. /**
  6829. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  6830. * objects.
  6831. *
  6832. * @private
  6833. * @param {*} value The value to inspect.
  6834. * @param {string} key The key of the property to inspect.
  6835. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  6836. */
  6837. function customOmitClone(value) {
  6838. return isPlainObject(value) ? undefined : value;
  6839. }
  6840. /**
  6841. * A specialized version of `baseIsEqualDeep` for arrays with support for
  6842. * partial deep comparisons.
  6843. *
  6844. * @private
  6845. * @param {Array} array The array to compare.
  6846. * @param {Array} other The other array to compare.
  6847. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  6848. * @param {Function} customizer The function to customize comparisons.
  6849. * @param {Function} equalFunc The function to determine equivalents of values.
  6850. * @param {Object} stack Tracks traversed `array` and `other` objects.
  6851. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  6852. */
  6853. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  6854. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  6855. arrLength = array.length,
  6856. othLength = other.length;
  6857. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  6858. return false;
  6859. }
  6860. // Check that cyclic values are equal.
  6861. var arrStacked = stack.get(array);
  6862. var othStacked = stack.get(other);
  6863. if (arrStacked && othStacked) {
  6864. return arrStacked == other && othStacked == array;
  6865. }
  6866. var index = -1,
  6867. result = true,
  6868. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  6869. stack.set(array, other);
  6870. stack.set(other, array);
  6871. // Ignore non-index properties.
  6872. while (++index < arrLength) {
  6873. var arrValue = array[index],
  6874. othValue = other[index];
  6875. if (customizer) {
  6876. var compared = isPartial
  6877. ? customizer(othValue, arrValue, index, other, array, stack)
  6878. : customizer(arrValue, othValue, index, array, other, stack);
  6879. }
  6880. if (compared !== undefined) {
  6881. if (compared) {
  6882. continue;
  6883. }
  6884. result = false;
  6885. break;
  6886. }
  6887. // Recursively compare arrays (susceptible to call stack limits).
  6888. if (seen) {
  6889. if (!arraySome(other, function(othValue, othIndex) {
  6890. if (!cacheHas(seen, othIndex) &&
  6891. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  6892. return seen.push(othIndex);
  6893. }
  6894. })) {
  6895. result = false;
  6896. break;
  6897. }
  6898. } else if (!(
  6899. arrValue === othValue ||
  6900. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  6901. )) {
  6902. result = false;
  6903. break;
  6904. }
  6905. }
  6906. stack['delete'](array);
  6907. stack['delete'](other);
  6908. return result;
  6909. }
  6910. /**
  6911. * A specialized version of `baseIsEqualDeep` for comparing objects of
  6912. * the same `toStringTag`.
  6913. *
  6914. * **Note:** This function only supports comparing values with tags of
  6915. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  6916. *
  6917. * @private
  6918. * @param {Object} object The object to compare.
  6919. * @param {Object} other The other object to compare.
  6920. * @param {string} tag The `toStringTag` of the objects to compare.
  6921. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  6922. * @param {Function} customizer The function to customize comparisons.
  6923. * @param {Function} equalFunc The function to determine equivalents of values.
  6924. * @param {Object} stack Tracks traversed `object` and `other` objects.
  6925. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  6926. */
  6927. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  6928. switch (tag) {
  6929. case dataViewTag:
  6930. if ((object.byteLength != other.byteLength) ||
  6931. (object.byteOffset != other.byteOffset)) {
  6932. return false;
  6933. }
  6934. object = object.buffer;
  6935. other = other.buffer;
  6936. case arrayBufferTag:
  6937. if ((object.byteLength != other.byteLength) ||
  6938. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  6939. return false;
  6940. }
  6941. return true;
  6942. case boolTag:
  6943. case dateTag:
  6944. case numberTag:
  6945. // Coerce booleans to `1` or `0` and dates to milliseconds.
  6946. // Invalid dates are coerced to `NaN`.
  6947. return eq(+object, +other);
  6948. case errorTag:
  6949. return object.name == other.name && object.message == other.message;
  6950. case regexpTag:
  6951. case stringTag:
  6952. // Coerce regexes to strings and treat strings, primitives and objects,
  6953. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  6954. // for more details.
  6955. return object == (other + '');
  6956. case mapTag:
  6957. var convert = mapToArray;
  6958. case setTag:
  6959. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  6960. convert || (convert = setToArray);
  6961. if (object.size != other.size && !isPartial) {
  6962. return false;
  6963. }
  6964. // Assume cyclic values are equal.
  6965. var stacked = stack.get(object);
  6966. if (stacked) {
  6967. return stacked == other;
  6968. }
  6969. bitmask |= COMPARE_UNORDERED_FLAG;
  6970. // Recursively compare objects (susceptible to call stack limits).
  6971. stack.set(object, other);
  6972. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  6973. stack['delete'](object);
  6974. return result;
  6975. case symbolTag:
  6976. if (symbolValueOf) {
  6977. return symbolValueOf.call(object) == symbolValueOf.call(other);
  6978. }
  6979. }
  6980. return false;
  6981. }
  6982. /**
  6983. * A specialized version of `baseIsEqualDeep` for objects with support for
  6984. * partial deep comparisons.
  6985. *
  6986. * @private
  6987. * @param {Object} object The object to compare.
  6988. * @param {Object} other The other object to compare.
  6989. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  6990. * @param {Function} customizer The function to customize comparisons.
  6991. * @param {Function} equalFunc The function to determine equivalents of values.
  6992. * @param {Object} stack Tracks traversed `object` and `other` objects.
  6993. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  6994. */
  6995. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  6996. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  6997. objProps = getAllKeys(object),
  6998. objLength = objProps.length,
  6999. othProps = getAllKeys(other),
  7000. othLength = othProps.length;
  7001. if (objLength != othLength && !isPartial) {
  7002. return false;
  7003. }
  7004. var index = objLength;
  7005. while (index--) {
  7006. var key = objProps[index];
  7007. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  7008. return false;
  7009. }
  7010. }
  7011. // Check that cyclic values are equal.
  7012. var objStacked = stack.get(object);
  7013. var othStacked = stack.get(other);
  7014. if (objStacked && othStacked) {
  7015. return objStacked == other && othStacked == object;
  7016. }
  7017. var result = true;
  7018. stack.set(object, other);
  7019. stack.set(other, object);
  7020. var skipCtor = isPartial;
  7021. while (++index < objLength) {
  7022. key = objProps[index];
  7023. var objValue = object[key],
  7024. othValue = other[key];
  7025. if (customizer) {
  7026. var compared = isPartial
  7027. ? customizer(othValue, objValue, key, other, object, stack)
  7028. : customizer(objValue, othValue, key, object, other, stack);
  7029. }
  7030. // Recursively compare objects (susceptible to call stack limits).
  7031. if (!(compared === undefined
  7032. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  7033. : compared
  7034. )) {
  7035. result = false;
  7036. break;
  7037. }
  7038. skipCtor || (skipCtor = key == 'constructor');
  7039. }
  7040. if (result && !skipCtor) {
  7041. var objCtor = object.constructor,
  7042. othCtor = other.constructor;
  7043. // Non `Object` object instances with different constructors are not equal.
  7044. if (objCtor != othCtor &&
  7045. ('constructor' in object && 'constructor' in other) &&
  7046. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  7047. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  7048. result = false;
  7049. }
  7050. }
  7051. stack['delete'](object);
  7052. stack['delete'](other);
  7053. return result;
  7054. }
  7055. /**
  7056. * A specialized version of `baseRest` which flattens the rest array.
  7057. *
  7058. * @private
  7059. * @param {Function} func The function to apply a rest parameter to.
  7060. * @returns {Function} Returns the new function.
  7061. */
  7062. function flatRest(func) {
  7063. return setToString(overRest(func, undefined, flatten), func + '');
  7064. }
  7065. /**
  7066. * Creates an array of own enumerable property names and symbols of `object`.
  7067. *
  7068. * @private
  7069. * @param {Object} object The object to query.
  7070. * @returns {Array} Returns the array of property names and symbols.
  7071. */
  7072. function getAllKeys(object) {
  7073. return baseGetAllKeys(object, keys, getSymbols);
  7074. }
  7075. /**
  7076. * Creates an array of own and inherited enumerable property names and
  7077. * symbols of `object`.
  7078. *
  7079. * @private
  7080. * @param {Object} object The object to query.
  7081. * @returns {Array} Returns the array of property names and symbols.
  7082. */
  7083. function getAllKeysIn(object) {
  7084. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  7085. }
  7086. /**
  7087. * Gets metadata for `func`.
  7088. *
  7089. * @private
  7090. * @param {Function} func The function to query.
  7091. * @returns {*} Returns the metadata for `func`.
  7092. */
  7093. var getData = !metaMap ? noop : function(func) {
  7094. return metaMap.get(func);
  7095. };
  7096. /**
  7097. * Gets the name of `func`.
  7098. *
  7099. * @private
  7100. * @param {Function} func The function to query.
  7101. * @returns {string} Returns the function name.
  7102. */
  7103. function getFuncName(func) {
  7104. var result = (func.name + ''),
  7105. array = realNames[result],
  7106. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  7107. while (length--) {
  7108. var data = array[length],
  7109. otherFunc = data.func;
  7110. if (otherFunc == null || otherFunc == func) {
  7111. return data.name;
  7112. }
  7113. }
  7114. return result;
  7115. }
  7116. /**
  7117. * Gets the argument placeholder value for `func`.
  7118. *
  7119. * @private
  7120. * @param {Function} func The function to inspect.
  7121. * @returns {*} Returns the placeholder value.
  7122. */
  7123. function getHolder(func) {
  7124. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  7125. return object.placeholder;
  7126. }
  7127. /**
  7128. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  7129. * this function returns the custom method, otherwise it returns `baseIteratee`.
  7130. * If arguments are provided, the chosen function is invoked with them and
  7131. * its result is returned.
  7132. *
  7133. * @private
  7134. * @param {*} [value] The value to convert to an iteratee.
  7135. * @param {number} [arity] The arity of the created iteratee.
  7136. * @returns {Function} Returns the chosen function or its result.
  7137. */
  7138. function getIteratee() {
  7139. var result = lodash.iteratee || iteratee;
  7140. result = result === iteratee ? baseIteratee : result;
  7141. return arguments.length ? result(arguments[0], arguments[1]) : result;
  7142. }
  7143. /**
  7144. * Gets the data for `map`.
  7145. *
  7146. * @private
  7147. * @param {Object} map The map to query.
  7148. * @param {string} key The reference key.
  7149. * @returns {*} Returns the map data.
  7150. */
  7151. function getMapData(map, key) {
  7152. var data = map.__data__;
  7153. return isKeyable(key)
  7154. ? data[typeof key == 'string' ? 'string' : 'hash']
  7155. : data.map;
  7156. }
  7157. /**
  7158. * Gets the property names, values, and compare flags of `object`.
  7159. *
  7160. * @private
  7161. * @param {Object} object The object to query.
  7162. * @returns {Array} Returns the match data of `object`.
  7163. */
  7164. function getMatchData(object) {
  7165. var result = keys(object),
  7166. length = result.length;
  7167. while (length--) {
  7168. var key = result[length],
  7169. value = object[key];
  7170. result[length] = [key, value, isStrictComparable(value)];
  7171. }
  7172. return result;
  7173. }
  7174. /**
  7175. * Gets the native function at `key` of `object`.
  7176. *
  7177. * @private
  7178. * @param {Object} object The object to query.
  7179. * @param {string} key The key of the method to get.
  7180. * @returns {*} Returns the function if it's native, else `undefined`.
  7181. */
  7182. function getNative(object, key) {
  7183. var value = getValue(object, key);
  7184. return baseIsNative(value) ? value : undefined;
  7185. }
  7186. /**
  7187. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  7188. *
  7189. * @private
  7190. * @param {*} value The value to query.
  7191. * @returns {string} Returns the raw `toStringTag`.
  7192. */
  7193. function getRawTag(value) {
  7194. var isOwn = hasOwnProperty.call(value, symToStringTag),
  7195. tag = value[symToStringTag];
  7196. try {
  7197. value[symToStringTag] = undefined;
  7198. var unmasked = true;
  7199. } catch (e) {}
  7200. var result = nativeObjectToString.call(value);
  7201. if (unmasked) {
  7202. if (isOwn) {
  7203. value[symToStringTag] = tag;
  7204. } else {
  7205. delete value[symToStringTag];
  7206. }
  7207. }
  7208. return result;
  7209. }
  7210. /**
  7211. * Creates an array of the own enumerable symbols of `object`.
  7212. *
  7213. * @private
  7214. * @param {Object} object The object to query.
  7215. * @returns {Array} Returns the array of symbols.
  7216. */
  7217. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  7218. if (object == null) {
  7219. return [];
  7220. }
  7221. object = Object(object);
  7222. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  7223. return propertyIsEnumerable.call(object, symbol);
  7224. });
  7225. };
  7226. /**
  7227. * Creates an array of the own and inherited enumerable symbols of `object`.
  7228. *
  7229. * @private
  7230. * @param {Object} object The object to query.
  7231. * @returns {Array} Returns the array of symbols.
  7232. */
  7233. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  7234. var result = [];
  7235. while (object) {
  7236. arrayPush(result, getSymbols(object));
  7237. object = getPrototype(object);
  7238. }
  7239. return result;
  7240. };
  7241. /**
  7242. * Gets the `toStringTag` of `value`.
  7243. *
  7244. * @private
  7245. * @param {*} value The value to query.
  7246. * @returns {string} Returns the `toStringTag`.
  7247. */
  7248. var getTag = baseGetTag;
  7249. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  7250. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  7251. (Map && getTag(new Map) != mapTag) ||
  7252. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  7253. (Set && getTag(new Set) != setTag) ||
  7254. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  7255. getTag = function(value) {
  7256. var result = baseGetTag(value),
  7257. Ctor = result == objectTag ? value.constructor : undefined,
  7258. ctorString = Ctor ? toSource(Ctor) : '';
  7259. if (ctorString) {
  7260. switch (ctorString) {
  7261. case dataViewCtorString: return dataViewTag;
  7262. case mapCtorString: return mapTag;
  7263. case promiseCtorString: return promiseTag;
  7264. case setCtorString: return setTag;
  7265. case weakMapCtorString: return weakMapTag;
  7266. }
  7267. }
  7268. return result;
  7269. };
  7270. }
  7271. /**
  7272. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  7273. *
  7274. * @private
  7275. * @param {number} start The start of the view.
  7276. * @param {number} end The end of the view.
  7277. * @param {Array} transforms The transformations to apply to the view.
  7278. * @returns {Object} Returns an object containing the `start` and `end`
  7279. * positions of the view.
  7280. */
  7281. function getView(start, end, transforms) {
  7282. var index = -1,
  7283. length = transforms.length;
  7284. while (++index < length) {
  7285. var data = transforms[index],
  7286. size = data.size;
  7287. switch (data.type) {
  7288. case 'drop': start += size; break;
  7289. case 'dropRight': end -= size; break;
  7290. case 'take': end = nativeMin(end, start + size); break;
  7291. case 'takeRight': start = nativeMax(start, end - size); break;
  7292. }
  7293. }
  7294. return { 'start': start, 'end': end };
  7295. }
  7296. /**
  7297. * Extracts wrapper details from the `source` body comment.
  7298. *
  7299. * @private
  7300. * @param {string} source The source to inspect.
  7301. * @returns {Array} Returns the wrapper details.
  7302. */
  7303. function getWrapDetails(source) {
  7304. var match = source.match(reWrapDetails);
  7305. return match ? match[1].split(reSplitDetails) : [];
  7306. }
  7307. /**
  7308. * Checks if `path` exists on `object`.
  7309. *
  7310. * @private
  7311. * @param {Object} object The object to query.
  7312. * @param {Array|string} path The path to check.
  7313. * @param {Function} hasFunc The function to check properties.
  7314. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  7315. */
  7316. function hasPath(object, path, hasFunc) {
  7317. path = castPath(path, object);
  7318. var index = -1,
  7319. length = path.length,
  7320. result = false;
  7321. while (++index < length) {
  7322. var key = toKey(path[index]);
  7323. if (!(result = object != null && hasFunc(object, key))) {
  7324. break;
  7325. }
  7326. object = object[key];
  7327. }
  7328. if (result || ++index != length) {
  7329. return result;
  7330. }
  7331. length = object == null ? 0 : object.length;
  7332. return !!length && isLength(length) && isIndex(key, length) &&
  7333. (isArray(object) || isArguments(object));
  7334. }
  7335. /**
  7336. * Initializes an array clone.
  7337. *
  7338. * @private
  7339. * @param {Array} array The array to clone.
  7340. * @returns {Array} Returns the initialized clone.
  7341. */
  7342. function initCloneArray(array) {
  7343. var length = array.length,
  7344. result = new array.constructor(length);
  7345. // Add properties assigned by `RegExp#exec`.
  7346. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  7347. result.index = array.index;
  7348. result.input = array.input;
  7349. }
  7350. return result;
  7351. }
  7352. /**
  7353. * Initializes an object clone.
  7354. *
  7355. * @private
  7356. * @param {Object} object The object to clone.
  7357. * @returns {Object} Returns the initialized clone.
  7358. */
  7359. function initCloneObject(object) {
  7360. return (typeof object.constructor == 'function' && !isPrototype(object))
  7361. ? baseCreate(getPrototype(object))
  7362. : {};
  7363. }
  7364. /**
  7365. * Initializes an object clone based on its `toStringTag`.
  7366. *
  7367. * **Note:** This function only supports cloning values with tags of
  7368. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  7369. *
  7370. * @private
  7371. * @param {Object} object The object to clone.
  7372. * @param {string} tag The `toStringTag` of the object to clone.
  7373. * @param {boolean} [isDeep] Specify a deep clone.
  7374. * @returns {Object} Returns the initialized clone.
  7375. */
  7376. function initCloneByTag(object, tag, isDeep) {
  7377. var Ctor = object.constructor;
  7378. switch (tag) {
  7379. case arrayBufferTag:
  7380. return cloneArrayBuffer(object);
  7381. case boolTag:
  7382. case dateTag:
  7383. return new Ctor(+object);
  7384. case dataViewTag:
  7385. return cloneDataView(object, isDeep);
  7386. case float32Tag: case float64Tag:
  7387. case int8Tag: case int16Tag: case int32Tag:
  7388. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  7389. return cloneTypedArray(object, isDeep);
  7390. case mapTag:
  7391. return new Ctor;
  7392. case numberTag:
  7393. case stringTag:
  7394. return new Ctor(object);
  7395. case regexpTag:
  7396. return cloneRegExp(object);
  7397. case setTag:
  7398. return new Ctor;
  7399. case symbolTag:
  7400. return cloneSymbol(object);
  7401. }
  7402. }
  7403. /**
  7404. * Inserts wrapper `details` in a comment at the top of the `source` body.
  7405. *
  7406. * @private
  7407. * @param {string} source The source to modify.
  7408. * @returns {Array} details The details to insert.
  7409. * @returns {string} Returns the modified source.
  7410. */
  7411. function insertWrapDetails(source, details) {
  7412. var length = details.length;
  7413. if (!length) {
  7414. return source;
  7415. }
  7416. var lastIndex = length - 1;
  7417. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  7418. details = details.join(length > 2 ? ', ' : ' ');
  7419. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  7420. }
  7421. /**
  7422. * Checks if `value` is a flattenable `arguments` object or array.
  7423. *
  7424. * @private
  7425. * @param {*} value The value to check.
  7426. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  7427. */
  7428. function isFlattenable(value) {
  7429. return isArray(value) || isArguments(value) ||
  7430. !!(spreadableSymbol && value && value[spreadableSymbol]);
  7431. }
  7432. /**
  7433. * Checks if `value` is a valid array-like index.
  7434. *
  7435. * @private
  7436. * @param {*} value The value to check.
  7437. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  7438. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  7439. */
  7440. function isIndex(value, length) {
  7441. var type = typeof value;
  7442. length = length == null ? MAX_SAFE_INTEGER : length;
  7443. return !!length &&
  7444. (type == 'number' ||
  7445. (type != 'symbol' && reIsUint.test(value))) &&
  7446. (value > -1 && value % 1 == 0 && value < length);
  7447. }
  7448. /**
  7449. * Checks if the given arguments are from an iteratee call.
  7450. *
  7451. * @private
  7452. * @param {*} value The potential iteratee value argument.
  7453. * @param {*} index The potential iteratee index or key argument.
  7454. * @param {*} object The potential iteratee object argument.
  7455. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  7456. * else `false`.
  7457. */
  7458. function isIterateeCall(value, index, object) {
  7459. if (!isObject(object)) {
  7460. return false;
  7461. }
  7462. var type = typeof index;
  7463. if (type == 'number'
  7464. ? (isArrayLike(object) && isIndex(index, object.length))
  7465. : (type == 'string' && index in object)
  7466. ) {
  7467. return eq(object[index], value);
  7468. }
  7469. return false;
  7470. }
  7471. /**
  7472. * Checks if `value` is a property name and not a property path.
  7473. *
  7474. * @private
  7475. * @param {*} value The value to check.
  7476. * @param {Object} [object] The object to query keys on.
  7477. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  7478. */
  7479. function isKey(value, object) {
  7480. if (isArray(value)) {
  7481. return false;
  7482. }
  7483. var type = typeof value;
  7484. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  7485. value == null || isSymbol(value)) {
  7486. return true;
  7487. }
  7488. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  7489. (object != null && value in Object(object));
  7490. }
  7491. /**
  7492. * Checks if `value` is suitable for use as unique object key.
  7493. *
  7494. * @private
  7495. * @param {*} value The value to check.
  7496. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  7497. */
  7498. function isKeyable(value) {
  7499. var type = typeof value;
  7500. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  7501. ? (value !== '__proto__')
  7502. : (value === null);
  7503. }
  7504. /**
  7505. * Checks if `func` has a lazy counterpart.
  7506. *
  7507. * @private
  7508. * @param {Function} func The function to check.
  7509. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  7510. * else `false`.
  7511. */
  7512. function isLaziable(func) {
  7513. var funcName = getFuncName(func),
  7514. other = lodash[funcName];
  7515. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  7516. return false;
  7517. }
  7518. if (func === other) {
  7519. return true;
  7520. }
  7521. var data = getData(other);
  7522. return !!data && func === data[0];
  7523. }
  7524. /**
  7525. * Checks if `func` has its source masked.
  7526. *
  7527. * @private
  7528. * @param {Function} func The function to check.
  7529. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  7530. */
  7531. function isMasked(func) {
  7532. return !!maskSrcKey && (maskSrcKey in func);
  7533. }
  7534. /**
  7535. * Checks if `func` is capable of being masked.
  7536. *
  7537. * @private
  7538. * @param {*} value The value to check.
  7539. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  7540. */
  7541. var isMaskable = coreJsData ? isFunction : stubFalse;
  7542. /**
  7543. * Checks if `value` is likely a prototype object.
  7544. *
  7545. * @private
  7546. * @param {*} value The value to check.
  7547. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  7548. */
  7549. function isPrototype(value) {
  7550. var Ctor = value && value.constructor,
  7551. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  7552. return value === proto;
  7553. }
  7554. /**
  7555. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  7556. *
  7557. * @private
  7558. * @param {*} value The value to check.
  7559. * @returns {boolean} Returns `true` if `value` if suitable for strict
  7560. * equality comparisons, else `false`.
  7561. */
  7562. function isStrictComparable(value) {
  7563. return value === value && !isObject(value);
  7564. }
  7565. /**
  7566. * A specialized version of `matchesProperty` for source values suitable
  7567. * for strict equality comparisons, i.e. `===`.
  7568. *
  7569. * @private
  7570. * @param {string} key The key of the property to get.
  7571. * @param {*} srcValue The value to match.
  7572. * @returns {Function} Returns the new spec function.
  7573. */
  7574. function matchesStrictComparable(key, srcValue) {
  7575. return function(object) {
  7576. if (object == null) {
  7577. return false;
  7578. }
  7579. return object[key] === srcValue &&
  7580. (srcValue !== undefined || (key in Object(object)));
  7581. };
  7582. }
  7583. /**
  7584. * A specialized version of `_.memoize` which clears the memoized function's
  7585. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  7586. *
  7587. * @private
  7588. * @param {Function} func The function to have its output memoized.
  7589. * @returns {Function} Returns the new memoized function.
  7590. */
  7591. function memoizeCapped(func) {
  7592. var result = memoize(func, function(key) {
  7593. if (cache.size === MAX_MEMOIZE_SIZE) {
  7594. cache.clear();
  7595. }
  7596. return key;
  7597. });
  7598. var cache = result.cache;
  7599. return result;
  7600. }
  7601. /**
  7602. * Merges the function metadata of `source` into `data`.
  7603. *
  7604. * Merging metadata reduces the number of wrappers used to invoke a function.
  7605. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  7606. * may be applied regardless of execution order. Methods like `_.ary` and
  7607. * `_.rearg` modify function arguments, making the order in which they are
  7608. * executed important, preventing the merging of metadata. However, we make
  7609. * an exception for a safe combined case where curried functions have `_.ary`
  7610. * and or `_.rearg` applied.
  7611. *
  7612. * @private
  7613. * @param {Array} data The destination metadata.
  7614. * @param {Array} source The source metadata.
  7615. * @returns {Array} Returns `data`.
  7616. */
  7617. function mergeData(data, source) {
  7618. var bitmask = data[1],
  7619. srcBitmask = source[1],
  7620. newBitmask = bitmask | srcBitmask,
  7621. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  7622. var isCombo =
  7623. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  7624. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  7625. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  7626. // Exit early if metadata can't be merged.
  7627. if (!(isCommon || isCombo)) {
  7628. return data;
  7629. }
  7630. // Use source `thisArg` if available.
  7631. if (srcBitmask & WRAP_BIND_FLAG) {
  7632. data[2] = source[2];
  7633. // Set when currying a bound function.
  7634. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  7635. }
  7636. // Compose partial arguments.
  7637. var value = source[3];
  7638. if (value) {
  7639. var partials = data[3];
  7640. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  7641. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  7642. }
  7643. // Compose partial right arguments.
  7644. value = source[5];
  7645. if (value) {
  7646. partials = data[5];
  7647. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  7648. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  7649. }
  7650. // Use source `argPos` if available.
  7651. value = source[7];
  7652. if (value) {
  7653. data[7] = value;
  7654. }
  7655. // Use source `ary` if it's smaller.
  7656. if (srcBitmask & WRAP_ARY_FLAG) {
  7657. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  7658. }
  7659. // Use source `arity` if one is not provided.
  7660. if (data[9] == null) {
  7661. data[9] = source[9];
  7662. }
  7663. // Use source `func` and merge bitmasks.
  7664. data[0] = source[0];
  7665. data[1] = newBitmask;
  7666. return data;
  7667. }
  7668. /**
  7669. * This function is like
  7670. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  7671. * except that it includes inherited enumerable properties.
  7672. *
  7673. * @private
  7674. * @param {Object} object The object to query.
  7675. * @returns {Array} Returns the array of property names.
  7676. */
  7677. function nativeKeysIn(object) {
  7678. var result = [];
  7679. if (object != null) {
  7680. for (var key in Object(object)) {
  7681. result.push(key);
  7682. }
  7683. }
  7684. return result;
  7685. }
  7686. /**
  7687. * Converts `value` to a string using `Object.prototype.toString`.
  7688. *
  7689. * @private
  7690. * @param {*} value The value to convert.
  7691. * @returns {string} Returns the converted string.
  7692. */
  7693. function objectToString(value) {
  7694. return nativeObjectToString.call(value);
  7695. }
  7696. /**
  7697. * A specialized version of `baseRest` which transforms the rest array.
  7698. *
  7699. * @private
  7700. * @param {Function} func The function to apply a rest parameter to.
  7701. * @param {number} [start=func.length-1] The start position of the rest parameter.
  7702. * @param {Function} transform The rest array transform.
  7703. * @returns {Function} Returns the new function.
  7704. */
  7705. function overRest(func, start, transform) {
  7706. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  7707. return function() {
  7708. var args = arguments,
  7709. index = -1,
  7710. length = nativeMax(args.length - start, 0),
  7711. array = Array(length);
  7712. while (++index < length) {
  7713. array[index] = args[start + index];
  7714. }
  7715. index = -1;
  7716. var otherArgs = Array(start + 1);
  7717. while (++index < start) {
  7718. otherArgs[index] = args[index];
  7719. }
  7720. otherArgs[start] = transform(array);
  7721. return apply(func, this, otherArgs);
  7722. };
  7723. }
  7724. /**
  7725. * Gets the parent value at `path` of `object`.
  7726. *
  7727. * @private
  7728. * @param {Object} object The object to query.
  7729. * @param {Array} path The path to get the parent value of.
  7730. * @returns {*} Returns the parent value.
  7731. */
  7732. function parent(object, path) {
  7733. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  7734. }
  7735. /**
  7736. * Reorder `array` according to the specified indexes where the element at
  7737. * the first index is assigned as the first element, the element at
  7738. * the second index is assigned as the second element, and so on.
  7739. *
  7740. * @private
  7741. * @param {Array} array The array to reorder.
  7742. * @param {Array} indexes The arranged array indexes.
  7743. * @returns {Array} Returns `array`.
  7744. */
  7745. function reorder(array, indexes) {
  7746. var arrLength = array.length,
  7747. length = nativeMin(indexes.length, arrLength),
  7748. oldArray = copyArray(array);
  7749. while (length--) {
  7750. var index = indexes[length];
  7751. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  7752. }
  7753. return array;
  7754. }
  7755. /**
  7756. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  7757. *
  7758. * @private
  7759. * @param {Object} object The object to query.
  7760. * @param {string} key The key of the property to get.
  7761. * @returns {*} Returns the property value.
  7762. */
  7763. function safeGet(object, key) {
  7764. if (key === 'constructor' && typeof object[key] === 'function') {
  7765. return;
  7766. }
  7767. if (key == '__proto__') {
  7768. return;
  7769. }
  7770. return object[key];
  7771. }
  7772. /**
  7773. * Sets metadata for `func`.
  7774. *
  7775. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  7776. * period of time, it will trip its breaker and transition to an identity
  7777. * function to avoid garbage collection pauses in V8. See
  7778. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  7779. * for more details.
  7780. *
  7781. * @private
  7782. * @param {Function} func The function to associate metadata with.
  7783. * @param {*} data The metadata.
  7784. * @returns {Function} Returns `func`.
  7785. */
  7786. var setData = shortOut(baseSetData);
  7787. /**
  7788. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  7789. *
  7790. * @private
  7791. * @param {Function} func The function to delay.
  7792. * @param {number} wait The number of milliseconds to delay invocation.
  7793. * @returns {number|Object} Returns the timer id or timeout object.
  7794. */
  7795. var setTimeout = ctxSetTimeout || function(func, wait) {
  7796. return root.setTimeout(func, wait);
  7797. };
  7798. /**
  7799. * Sets the `toString` method of `func` to return `string`.
  7800. *
  7801. * @private
  7802. * @param {Function} func The function to modify.
  7803. * @param {Function} string The `toString` result.
  7804. * @returns {Function} Returns `func`.
  7805. */
  7806. var setToString = shortOut(baseSetToString);
  7807. /**
  7808. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  7809. * with wrapper details in a comment at the top of the source body.
  7810. *
  7811. * @private
  7812. * @param {Function} wrapper The function to modify.
  7813. * @param {Function} reference The reference function.
  7814. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  7815. * @returns {Function} Returns `wrapper`.
  7816. */
  7817. function setWrapToString(wrapper, reference, bitmask) {
  7818. var source = (reference + '');
  7819. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  7820. }
  7821. /**
  7822. * Creates a function that'll short out and invoke `identity` instead
  7823. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  7824. * milliseconds.
  7825. *
  7826. * @private
  7827. * @param {Function} func The function to restrict.
  7828. * @returns {Function} Returns the new shortable function.
  7829. */
  7830. function shortOut(func) {
  7831. var count = 0,
  7832. lastCalled = 0;
  7833. return function() {
  7834. var stamp = nativeNow(),
  7835. remaining = HOT_SPAN - (stamp - lastCalled);
  7836. lastCalled = stamp;
  7837. if (remaining > 0) {
  7838. if (++count >= HOT_COUNT) {
  7839. return arguments[0];
  7840. }
  7841. } else {
  7842. count = 0;
  7843. }
  7844. return func.apply(undefined, arguments);
  7845. };
  7846. }
  7847. /**
  7848. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  7849. *
  7850. * @private
  7851. * @param {Array} array The array to shuffle.
  7852. * @param {number} [size=array.length] The size of `array`.
  7853. * @returns {Array} Returns `array`.
  7854. */
  7855. function shuffleSelf(array, size) {
  7856. var index = -1,
  7857. length = array.length,
  7858. lastIndex = length - 1;
  7859. size = size === undefined ? length : size;
  7860. while (++index < size) {
  7861. var rand = baseRandom(index, lastIndex),
  7862. value = array[rand];
  7863. array[rand] = array[index];
  7864. array[index] = value;
  7865. }
  7866. array.length = size;
  7867. return array;
  7868. }
  7869. /**
  7870. * Converts `string` to a property path array.
  7871. *
  7872. * @private
  7873. * @param {string} string The string to convert.
  7874. * @returns {Array} Returns the property path array.
  7875. */
  7876. var stringToPath = memoizeCapped(function(string) {
  7877. var result = [];
  7878. if (string.charCodeAt(0) === 46 /* . */) {
  7879. result.push('');
  7880. }
  7881. string.replace(rePropName, function(match, number, quote, subString) {
  7882. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  7883. });
  7884. return result;
  7885. });
  7886. /**
  7887. * Converts `value` to a string key if it's not a string or symbol.
  7888. *
  7889. * @private
  7890. * @param {*} value The value to inspect.
  7891. * @returns {string|symbol} Returns the key.
  7892. */
  7893. function toKey(value) {
  7894. if (typeof value == 'string' || isSymbol(value)) {
  7895. return value;
  7896. }
  7897. var result = (value + '');
  7898. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  7899. }
  7900. /**
  7901. * Converts `func` to its source code.
  7902. *
  7903. * @private
  7904. * @param {Function} func The function to convert.
  7905. * @returns {string} Returns the source code.
  7906. */
  7907. function toSource(func) {
  7908. if (func != null) {
  7909. try {
  7910. return funcToString.call(func);
  7911. } catch (e) {}
  7912. try {
  7913. return (func + '');
  7914. } catch (e) {}
  7915. }
  7916. return '';
  7917. }
  7918. /**
  7919. * Updates wrapper `details` based on `bitmask` flags.
  7920. *
  7921. * @private
  7922. * @returns {Array} details The details to modify.
  7923. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  7924. * @returns {Array} Returns `details`.
  7925. */
  7926. function updateWrapDetails(details, bitmask) {
  7927. arrayEach(wrapFlags, function(pair) {
  7928. var value = '_.' + pair[0];
  7929. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  7930. details.push(value);
  7931. }
  7932. });
  7933. return details.sort();
  7934. }
  7935. /**
  7936. * Creates a clone of `wrapper`.
  7937. *
  7938. * @private
  7939. * @param {Object} wrapper The wrapper to clone.
  7940. * @returns {Object} Returns the cloned wrapper.
  7941. */
  7942. function wrapperClone(wrapper) {
  7943. if (wrapper instanceof LazyWrapper) {
  7944. return wrapper.clone();
  7945. }
  7946. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  7947. result.__actions__ = copyArray(wrapper.__actions__);
  7948. result.__index__ = wrapper.__index__;
  7949. result.__values__ = wrapper.__values__;
  7950. return result;
  7951. }
  7952. /*------------------------------------------------------------------------*/
  7953. /**
  7954. * Creates an array of elements split into groups the length of `size`.
  7955. * If `array` can't be split evenly, the final chunk will be the remaining
  7956. * elements.
  7957. *
  7958. * @static
  7959. * @memberOf _
  7960. * @since 3.0.0
  7961. * @category Array
  7962. * @param {Array} array The array to process.
  7963. * @param {number} [size=1] The length of each chunk
  7964. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  7965. * @returns {Array} Returns the new array of chunks.
  7966. * @example
  7967. *
  7968. * _.chunk(['a', 'b', 'c', 'd'], 2);
  7969. * // => [['a', 'b'], ['c', 'd']]
  7970. *
  7971. * _.chunk(['a', 'b', 'c', 'd'], 3);
  7972. * // => [['a', 'b', 'c'], ['d']]
  7973. */
  7974. function chunk(array, size, guard) {
  7975. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  7976. size = 1;
  7977. } else {
  7978. size = nativeMax(toInteger(size), 0);
  7979. }
  7980. var length = array == null ? 0 : array.length;
  7981. if (!length || size < 1) {
  7982. return [];
  7983. }
  7984. var index = 0,
  7985. resIndex = 0,
  7986. result = Array(nativeCeil(length / size));
  7987. while (index < length) {
  7988. result[resIndex++] = baseSlice(array, index, (index += size));
  7989. }
  7990. return result;
  7991. }
  7992. /**
  7993. * Creates an array with all falsey values removed. The values `false`, `null`,
  7994. * `0`, `""`, `undefined`, and `NaN` are falsey.
  7995. *
  7996. * @static
  7997. * @memberOf _
  7998. * @since 0.1.0
  7999. * @category Array
  8000. * @param {Array} array The array to compact.
  8001. * @returns {Array} Returns the new array of filtered values.
  8002. * @example
  8003. *
  8004. * _.compact([0, 1, false, 2, '', 3]);
  8005. * // => [1, 2, 3]
  8006. */
  8007. function compact(array) {
  8008. var index = -1,
  8009. length = array == null ? 0 : array.length,
  8010. resIndex = 0,
  8011. result = [];
  8012. while (++index < length) {
  8013. var value = array[index];
  8014. if (value) {
  8015. result[resIndex++] = value;
  8016. }
  8017. }
  8018. return result;
  8019. }
  8020. /**
  8021. * Creates a new array concatenating `array` with any additional arrays
  8022. * and/or values.
  8023. *
  8024. * @static
  8025. * @memberOf _
  8026. * @since 4.0.0
  8027. * @category Array
  8028. * @param {Array} array The array to concatenate.
  8029. * @param {...*} [values] The values to concatenate.
  8030. * @returns {Array} Returns the new concatenated array.
  8031. * @example
  8032. *
  8033. * var array = [1];
  8034. * var other = _.concat(array, 2, [3], [[4]]);
  8035. *
  8036. * console.log(other);
  8037. * // => [1, 2, 3, [4]]
  8038. *
  8039. * console.log(array);
  8040. * // => [1]
  8041. */
  8042. function concat() {
  8043. var length = arguments.length;
  8044. if (!length) {
  8045. return [];
  8046. }
  8047. var args = Array(length - 1),
  8048. array = arguments[0],
  8049. index = length;
  8050. while (index--) {
  8051. args[index - 1] = arguments[index];
  8052. }
  8053. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  8054. }
  8055. /**
  8056. * Creates an array of `array` values not included in the other given arrays
  8057. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8058. * for equality comparisons. The order and references of result values are
  8059. * determined by the first array.
  8060. *
  8061. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  8062. *
  8063. * @static
  8064. * @memberOf _
  8065. * @since 0.1.0
  8066. * @category Array
  8067. * @param {Array} array The array to inspect.
  8068. * @param {...Array} [values] The values to exclude.
  8069. * @returns {Array} Returns the new array of filtered values.
  8070. * @see _.without, _.xor
  8071. * @example
  8072. *
  8073. * _.difference([2, 1], [2, 3]);
  8074. * // => [1]
  8075. */
  8076. var difference = baseRest(function(array, values) {
  8077. return isArrayLikeObject(array)
  8078. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  8079. : [];
  8080. });
  8081. /**
  8082. * This method is like `_.difference` except that it accepts `iteratee` which
  8083. * is invoked for each element of `array` and `values` to generate the criterion
  8084. * by which they're compared. The order and references of result values are
  8085. * determined by the first array. The iteratee is invoked with one argument:
  8086. * (value).
  8087. *
  8088. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  8089. *
  8090. * @static
  8091. * @memberOf _
  8092. * @since 4.0.0
  8093. * @category Array
  8094. * @param {Array} array The array to inspect.
  8095. * @param {...Array} [values] The values to exclude.
  8096. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8097. * @returns {Array} Returns the new array of filtered values.
  8098. * @example
  8099. *
  8100. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  8101. * // => [1.2]
  8102. *
  8103. * // The `_.property` iteratee shorthand.
  8104. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  8105. * // => [{ 'x': 2 }]
  8106. */
  8107. var differenceBy = baseRest(function(array, values) {
  8108. var iteratee = last(values);
  8109. if (isArrayLikeObject(iteratee)) {
  8110. iteratee = undefined;
  8111. }
  8112. return isArrayLikeObject(array)
  8113. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  8114. : [];
  8115. });
  8116. /**
  8117. * This method is like `_.difference` except that it accepts `comparator`
  8118. * which is invoked to compare elements of `array` to `values`. The order and
  8119. * references of result values are determined by the first array. The comparator
  8120. * is invoked with two arguments: (arrVal, othVal).
  8121. *
  8122. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  8123. *
  8124. * @static
  8125. * @memberOf _
  8126. * @since 4.0.0
  8127. * @category Array
  8128. * @param {Array} array The array to inspect.
  8129. * @param {...Array} [values] The values to exclude.
  8130. * @param {Function} [comparator] The comparator invoked per element.
  8131. * @returns {Array} Returns the new array of filtered values.
  8132. * @example
  8133. *
  8134. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  8135. *
  8136. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  8137. * // => [{ 'x': 2, 'y': 1 }]
  8138. */
  8139. var differenceWith = baseRest(function(array, values) {
  8140. var comparator = last(values);
  8141. if (isArrayLikeObject(comparator)) {
  8142. comparator = undefined;
  8143. }
  8144. return isArrayLikeObject(array)
  8145. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  8146. : [];
  8147. });
  8148. /**
  8149. * Creates a slice of `array` with `n` elements dropped from the beginning.
  8150. *
  8151. * @static
  8152. * @memberOf _
  8153. * @since 0.5.0
  8154. * @category Array
  8155. * @param {Array} array The array to query.
  8156. * @param {number} [n=1] The number of elements to drop.
  8157. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8158. * @returns {Array} Returns the slice of `array`.
  8159. * @example
  8160. *
  8161. * _.drop([1, 2, 3]);
  8162. * // => [2, 3]
  8163. *
  8164. * _.drop([1, 2, 3], 2);
  8165. * // => [3]
  8166. *
  8167. * _.drop([1, 2, 3], 5);
  8168. * // => []
  8169. *
  8170. * _.drop([1, 2, 3], 0);
  8171. * // => [1, 2, 3]
  8172. */
  8173. function drop(array, n, guard) {
  8174. var length = array == null ? 0 : array.length;
  8175. if (!length) {
  8176. return [];
  8177. }
  8178. n = (guard || n === undefined) ? 1 : toInteger(n);
  8179. return baseSlice(array, n < 0 ? 0 : n, length);
  8180. }
  8181. /**
  8182. * Creates a slice of `array` with `n` elements dropped from the end.
  8183. *
  8184. * @static
  8185. * @memberOf _
  8186. * @since 3.0.0
  8187. * @category Array
  8188. * @param {Array} array The array to query.
  8189. * @param {number} [n=1] The number of elements to drop.
  8190. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8191. * @returns {Array} Returns the slice of `array`.
  8192. * @example
  8193. *
  8194. * _.dropRight([1, 2, 3]);
  8195. * // => [1, 2]
  8196. *
  8197. * _.dropRight([1, 2, 3], 2);
  8198. * // => [1]
  8199. *
  8200. * _.dropRight([1, 2, 3], 5);
  8201. * // => []
  8202. *
  8203. * _.dropRight([1, 2, 3], 0);
  8204. * // => [1, 2, 3]
  8205. */
  8206. function dropRight(array, n, guard) {
  8207. var length = array == null ? 0 : array.length;
  8208. if (!length) {
  8209. return [];
  8210. }
  8211. n = (guard || n === undefined) ? 1 : toInteger(n);
  8212. n = length - n;
  8213. return baseSlice(array, 0, n < 0 ? 0 : n);
  8214. }
  8215. /**
  8216. * Creates a slice of `array` excluding elements dropped from the end.
  8217. * Elements are dropped until `predicate` returns falsey. The predicate is
  8218. * invoked with three arguments: (value, index, array).
  8219. *
  8220. * @static
  8221. * @memberOf _
  8222. * @since 3.0.0
  8223. * @category Array
  8224. * @param {Array} array The array to query.
  8225. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8226. * @returns {Array} Returns the slice of `array`.
  8227. * @example
  8228. *
  8229. * var users = [
  8230. * { 'user': 'barney', 'active': true },
  8231. * { 'user': 'fred', 'active': false },
  8232. * { 'user': 'pebbles', 'active': false }
  8233. * ];
  8234. *
  8235. * _.dropRightWhile(users, function(o) { return !o.active; });
  8236. * // => objects for ['barney']
  8237. *
  8238. * // The `_.matches` iteratee shorthand.
  8239. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  8240. * // => objects for ['barney', 'fred']
  8241. *
  8242. * // The `_.matchesProperty` iteratee shorthand.
  8243. * _.dropRightWhile(users, ['active', false]);
  8244. * // => objects for ['barney']
  8245. *
  8246. * // The `_.property` iteratee shorthand.
  8247. * _.dropRightWhile(users, 'active');
  8248. * // => objects for ['barney', 'fred', 'pebbles']
  8249. */
  8250. function dropRightWhile(array, predicate) {
  8251. return (array && array.length)
  8252. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  8253. : [];
  8254. }
  8255. /**
  8256. * Creates a slice of `array` excluding elements dropped from the beginning.
  8257. * Elements are dropped until `predicate` returns falsey. The predicate is
  8258. * invoked with three arguments: (value, index, array).
  8259. *
  8260. * @static
  8261. * @memberOf _
  8262. * @since 3.0.0
  8263. * @category Array
  8264. * @param {Array} array The array to query.
  8265. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8266. * @returns {Array} Returns the slice of `array`.
  8267. * @example
  8268. *
  8269. * var users = [
  8270. * { 'user': 'barney', 'active': false },
  8271. * { 'user': 'fred', 'active': false },
  8272. * { 'user': 'pebbles', 'active': true }
  8273. * ];
  8274. *
  8275. * _.dropWhile(users, function(o) { return !o.active; });
  8276. * // => objects for ['pebbles']
  8277. *
  8278. * // The `_.matches` iteratee shorthand.
  8279. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  8280. * // => objects for ['fred', 'pebbles']
  8281. *
  8282. * // The `_.matchesProperty` iteratee shorthand.
  8283. * _.dropWhile(users, ['active', false]);
  8284. * // => objects for ['pebbles']
  8285. *
  8286. * // The `_.property` iteratee shorthand.
  8287. * _.dropWhile(users, 'active');
  8288. * // => objects for ['barney', 'fred', 'pebbles']
  8289. */
  8290. function dropWhile(array, predicate) {
  8291. return (array && array.length)
  8292. ? baseWhile(array, getIteratee(predicate, 3), true)
  8293. : [];
  8294. }
  8295. /**
  8296. * Fills elements of `array` with `value` from `start` up to, but not
  8297. * including, `end`.
  8298. *
  8299. * **Note:** This method mutates `array`.
  8300. *
  8301. * @static
  8302. * @memberOf _
  8303. * @since 3.2.0
  8304. * @category Array
  8305. * @param {Array} array The array to fill.
  8306. * @param {*} value The value to fill `array` with.
  8307. * @param {number} [start=0] The start position.
  8308. * @param {number} [end=array.length] The end position.
  8309. * @returns {Array} Returns `array`.
  8310. * @example
  8311. *
  8312. * var array = [1, 2, 3];
  8313. *
  8314. * _.fill(array, 'a');
  8315. * console.log(array);
  8316. * // => ['a', 'a', 'a']
  8317. *
  8318. * _.fill(Array(3), 2);
  8319. * // => [2, 2, 2]
  8320. *
  8321. * _.fill([4, 6, 8, 10], '*', 1, 3);
  8322. * // => [4, '*', '*', 10]
  8323. */
  8324. function fill(array, value, start, end) {
  8325. var length = array == null ? 0 : array.length;
  8326. if (!length) {
  8327. return [];
  8328. }
  8329. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  8330. start = 0;
  8331. end = length;
  8332. }
  8333. return baseFill(array, value, start, end);
  8334. }
  8335. /**
  8336. * This method is like `_.find` except that it returns the index of the first
  8337. * element `predicate` returns truthy for instead of the element itself.
  8338. *
  8339. * @static
  8340. * @memberOf _
  8341. * @since 1.1.0
  8342. * @category Array
  8343. * @param {Array} array The array to inspect.
  8344. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8345. * @param {number} [fromIndex=0] The index to search from.
  8346. * @returns {number} Returns the index of the found element, else `-1`.
  8347. * @example
  8348. *
  8349. * var users = [
  8350. * { 'user': 'barney', 'active': false },
  8351. * { 'user': 'fred', 'active': false },
  8352. * { 'user': 'pebbles', 'active': true }
  8353. * ];
  8354. *
  8355. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  8356. * // => 0
  8357. *
  8358. * // The `_.matches` iteratee shorthand.
  8359. * _.findIndex(users, { 'user': 'fred', 'active': false });
  8360. * // => 1
  8361. *
  8362. * // The `_.matchesProperty` iteratee shorthand.
  8363. * _.findIndex(users, ['active', false]);
  8364. * // => 0
  8365. *
  8366. * // The `_.property` iteratee shorthand.
  8367. * _.findIndex(users, 'active');
  8368. * // => 2
  8369. */
  8370. function findIndex(array, predicate, fromIndex) {
  8371. var length = array == null ? 0 : array.length;
  8372. if (!length) {
  8373. return -1;
  8374. }
  8375. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  8376. if (index < 0) {
  8377. index = nativeMax(length + index, 0);
  8378. }
  8379. return baseFindIndex(array, getIteratee(predicate, 3), index);
  8380. }
  8381. /**
  8382. * This method is like `_.findIndex` except that it iterates over elements
  8383. * of `collection` from right to left.
  8384. *
  8385. * @static
  8386. * @memberOf _
  8387. * @since 2.0.0
  8388. * @category Array
  8389. * @param {Array} array The array to inspect.
  8390. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8391. * @param {number} [fromIndex=array.length-1] The index to search from.
  8392. * @returns {number} Returns the index of the found element, else `-1`.
  8393. * @example
  8394. *
  8395. * var users = [
  8396. * { 'user': 'barney', 'active': true },
  8397. * { 'user': 'fred', 'active': false },
  8398. * { 'user': 'pebbles', 'active': false }
  8399. * ];
  8400. *
  8401. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  8402. * // => 2
  8403. *
  8404. * // The `_.matches` iteratee shorthand.
  8405. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  8406. * // => 0
  8407. *
  8408. * // The `_.matchesProperty` iteratee shorthand.
  8409. * _.findLastIndex(users, ['active', false]);
  8410. * // => 2
  8411. *
  8412. * // The `_.property` iteratee shorthand.
  8413. * _.findLastIndex(users, 'active');
  8414. * // => 0
  8415. */
  8416. function findLastIndex(array, predicate, fromIndex) {
  8417. var length = array == null ? 0 : array.length;
  8418. if (!length) {
  8419. return -1;
  8420. }
  8421. var index = length - 1;
  8422. if (fromIndex !== undefined) {
  8423. index = toInteger(fromIndex);
  8424. index = fromIndex < 0
  8425. ? nativeMax(length + index, 0)
  8426. : nativeMin(index, length - 1);
  8427. }
  8428. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  8429. }
  8430. /**
  8431. * Flattens `array` a single level deep.
  8432. *
  8433. * @static
  8434. * @memberOf _
  8435. * @since 0.1.0
  8436. * @category Array
  8437. * @param {Array} array The array to flatten.
  8438. * @returns {Array} Returns the new flattened array.
  8439. * @example
  8440. *
  8441. * _.flatten([1, [2, [3, [4]], 5]]);
  8442. * // => [1, 2, [3, [4]], 5]
  8443. */
  8444. function flatten(array) {
  8445. var length = array == null ? 0 : array.length;
  8446. return length ? baseFlatten(array, 1) : [];
  8447. }
  8448. /**
  8449. * Recursively flattens `array`.
  8450. *
  8451. * @static
  8452. * @memberOf _
  8453. * @since 3.0.0
  8454. * @category Array
  8455. * @param {Array} array The array to flatten.
  8456. * @returns {Array} Returns the new flattened array.
  8457. * @example
  8458. *
  8459. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  8460. * // => [1, 2, 3, 4, 5]
  8461. */
  8462. function flattenDeep(array) {
  8463. var length = array == null ? 0 : array.length;
  8464. return length ? baseFlatten(array, INFINITY) : [];
  8465. }
  8466. /**
  8467. * Recursively flatten `array` up to `depth` times.
  8468. *
  8469. * @static
  8470. * @memberOf _
  8471. * @since 4.4.0
  8472. * @category Array
  8473. * @param {Array} array The array to flatten.
  8474. * @param {number} [depth=1] The maximum recursion depth.
  8475. * @returns {Array} Returns the new flattened array.
  8476. * @example
  8477. *
  8478. * var array = [1, [2, [3, [4]], 5]];
  8479. *
  8480. * _.flattenDepth(array, 1);
  8481. * // => [1, 2, [3, [4]], 5]
  8482. *
  8483. * _.flattenDepth(array, 2);
  8484. * // => [1, 2, 3, [4], 5]
  8485. */
  8486. function flattenDepth(array, depth) {
  8487. var length = array == null ? 0 : array.length;
  8488. if (!length) {
  8489. return [];
  8490. }
  8491. depth = depth === undefined ? 1 : toInteger(depth);
  8492. return baseFlatten(array, depth);
  8493. }
  8494. /**
  8495. * The inverse of `_.toPairs`; this method returns an object composed
  8496. * from key-value `pairs`.
  8497. *
  8498. * @static
  8499. * @memberOf _
  8500. * @since 4.0.0
  8501. * @category Array
  8502. * @param {Array} pairs The key-value pairs.
  8503. * @returns {Object} Returns the new object.
  8504. * @example
  8505. *
  8506. * _.fromPairs([['a', 1], ['b', 2]]);
  8507. * // => { 'a': 1, 'b': 2 }
  8508. */
  8509. function fromPairs(pairs) {
  8510. var index = -1,
  8511. length = pairs == null ? 0 : pairs.length,
  8512. result = {};
  8513. while (++index < length) {
  8514. var pair = pairs[index];
  8515. result[pair[0]] = pair[1];
  8516. }
  8517. return result;
  8518. }
  8519. /**
  8520. * Gets the first element of `array`.
  8521. *
  8522. * @static
  8523. * @memberOf _
  8524. * @since 0.1.0
  8525. * @alias first
  8526. * @category Array
  8527. * @param {Array} array The array to query.
  8528. * @returns {*} Returns the first element of `array`.
  8529. * @example
  8530. *
  8531. * _.head([1, 2, 3]);
  8532. * // => 1
  8533. *
  8534. * _.head([]);
  8535. * // => undefined
  8536. */
  8537. function head(array) {
  8538. return (array && array.length) ? array[0] : undefined;
  8539. }
  8540. /**
  8541. * Gets the index at which the first occurrence of `value` is found in `array`
  8542. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8543. * for equality comparisons. If `fromIndex` is negative, it's used as the
  8544. * offset from the end of `array`.
  8545. *
  8546. * @static
  8547. * @memberOf _
  8548. * @since 0.1.0
  8549. * @category Array
  8550. * @param {Array} array The array to inspect.
  8551. * @param {*} value The value to search for.
  8552. * @param {number} [fromIndex=0] The index to search from.
  8553. * @returns {number} Returns the index of the matched value, else `-1`.
  8554. * @example
  8555. *
  8556. * _.indexOf([1, 2, 1, 2], 2);
  8557. * // => 1
  8558. *
  8559. * // Search from the `fromIndex`.
  8560. * _.indexOf([1, 2, 1, 2], 2, 2);
  8561. * // => 3
  8562. */
  8563. function indexOf(array, value, fromIndex) {
  8564. var length = array == null ? 0 : array.length;
  8565. if (!length) {
  8566. return -1;
  8567. }
  8568. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  8569. if (index < 0) {
  8570. index = nativeMax(length + index, 0);
  8571. }
  8572. return baseIndexOf(array, value, index);
  8573. }
  8574. /**
  8575. * Gets all but the last element of `array`.
  8576. *
  8577. * @static
  8578. * @memberOf _
  8579. * @since 0.1.0
  8580. * @category Array
  8581. * @param {Array} array The array to query.
  8582. * @returns {Array} Returns the slice of `array`.
  8583. * @example
  8584. *
  8585. * _.initial([1, 2, 3]);
  8586. * // => [1, 2]
  8587. */
  8588. function initial(array) {
  8589. var length = array == null ? 0 : array.length;
  8590. return length ? baseSlice(array, 0, -1) : [];
  8591. }
  8592. /**
  8593. * Creates an array of unique values that are included in all given arrays
  8594. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8595. * for equality comparisons. The order and references of result values are
  8596. * determined by the first array.
  8597. *
  8598. * @static
  8599. * @memberOf _
  8600. * @since 0.1.0
  8601. * @category Array
  8602. * @param {...Array} [arrays] The arrays to inspect.
  8603. * @returns {Array} Returns the new array of intersecting values.
  8604. * @example
  8605. *
  8606. * _.intersection([2, 1], [2, 3]);
  8607. * // => [2]
  8608. */
  8609. var intersection = baseRest(function(arrays) {
  8610. var mapped = arrayMap(arrays, castArrayLikeObject);
  8611. return (mapped.length && mapped[0] === arrays[0])
  8612. ? baseIntersection(mapped)
  8613. : [];
  8614. });
  8615. /**
  8616. * This method is like `_.intersection` except that it accepts `iteratee`
  8617. * which is invoked for each element of each `arrays` to generate the criterion
  8618. * by which they're compared. The order and references of result values are
  8619. * determined by the first array. The iteratee is invoked with one argument:
  8620. * (value).
  8621. *
  8622. * @static
  8623. * @memberOf _
  8624. * @since 4.0.0
  8625. * @category Array
  8626. * @param {...Array} [arrays] The arrays to inspect.
  8627. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8628. * @returns {Array} Returns the new array of intersecting values.
  8629. * @example
  8630. *
  8631. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  8632. * // => [2.1]
  8633. *
  8634. * // The `_.property` iteratee shorthand.
  8635. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  8636. * // => [{ 'x': 1 }]
  8637. */
  8638. var intersectionBy = baseRest(function(arrays) {
  8639. var iteratee = last(arrays),
  8640. mapped = arrayMap(arrays, castArrayLikeObject);
  8641. if (iteratee === last(mapped)) {
  8642. iteratee = undefined;
  8643. } else {
  8644. mapped.pop();
  8645. }
  8646. return (mapped.length && mapped[0] === arrays[0])
  8647. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  8648. : [];
  8649. });
  8650. /**
  8651. * This method is like `_.intersection` except that it accepts `comparator`
  8652. * which is invoked to compare elements of `arrays`. The order and references
  8653. * of result values are determined by the first array. The comparator is
  8654. * invoked with two arguments: (arrVal, othVal).
  8655. *
  8656. * @static
  8657. * @memberOf _
  8658. * @since 4.0.0
  8659. * @category Array
  8660. * @param {...Array} [arrays] The arrays to inspect.
  8661. * @param {Function} [comparator] The comparator invoked per element.
  8662. * @returns {Array} Returns the new array of intersecting values.
  8663. * @example
  8664. *
  8665. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  8666. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  8667. *
  8668. * _.intersectionWith(objects, others, _.isEqual);
  8669. * // => [{ 'x': 1, 'y': 2 }]
  8670. */
  8671. var intersectionWith = baseRest(function(arrays) {
  8672. var comparator = last(arrays),
  8673. mapped = arrayMap(arrays, castArrayLikeObject);
  8674. comparator = typeof comparator == 'function' ? comparator : undefined;
  8675. if (comparator) {
  8676. mapped.pop();
  8677. }
  8678. return (mapped.length && mapped[0] === arrays[0])
  8679. ? baseIntersection(mapped, undefined, comparator)
  8680. : [];
  8681. });
  8682. /**
  8683. * Converts all elements in `array` into a string separated by `separator`.
  8684. *
  8685. * @static
  8686. * @memberOf _
  8687. * @since 4.0.0
  8688. * @category Array
  8689. * @param {Array} array The array to convert.
  8690. * @param {string} [separator=','] The element separator.
  8691. * @returns {string} Returns the joined string.
  8692. * @example
  8693. *
  8694. * _.join(['a', 'b', 'c'], '~');
  8695. * // => 'a~b~c'
  8696. */
  8697. function join(array, separator) {
  8698. return array == null ? '' : nativeJoin.call(array, separator);
  8699. }
  8700. /**
  8701. * Gets the last element of `array`.
  8702. *
  8703. * @static
  8704. * @memberOf _
  8705. * @since 0.1.0
  8706. * @category Array
  8707. * @param {Array} array The array to query.
  8708. * @returns {*} Returns the last element of `array`.
  8709. * @example
  8710. *
  8711. * _.last([1, 2, 3]);
  8712. * // => 3
  8713. */
  8714. function last(array) {
  8715. var length = array == null ? 0 : array.length;
  8716. return length ? array[length - 1] : undefined;
  8717. }
  8718. /**
  8719. * This method is like `_.indexOf` except that it iterates over elements of
  8720. * `array` from right to left.
  8721. *
  8722. * @static
  8723. * @memberOf _
  8724. * @since 0.1.0
  8725. * @category Array
  8726. * @param {Array} array The array to inspect.
  8727. * @param {*} value The value to search for.
  8728. * @param {number} [fromIndex=array.length-1] The index to search from.
  8729. * @returns {number} Returns the index of the matched value, else `-1`.
  8730. * @example
  8731. *
  8732. * _.lastIndexOf([1, 2, 1, 2], 2);
  8733. * // => 3
  8734. *
  8735. * // Search from the `fromIndex`.
  8736. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  8737. * // => 1
  8738. */
  8739. function lastIndexOf(array, value, fromIndex) {
  8740. var length = array == null ? 0 : array.length;
  8741. if (!length) {
  8742. return -1;
  8743. }
  8744. var index = length;
  8745. if (fromIndex !== undefined) {
  8746. index = toInteger(fromIndex);
  8747. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  8748. }
  8749. return value === value
  8750. ? strictLastIndexOf(array, value, index)
  8751. : baseFindIndex(array, baseIsNaN, index, true);
  8752. }
  8753. /**
  8754. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  8755. * element from the end is returned.
  8756. *
  8757. * @static
  8758. * @memberOf _
  8759. * @since 4.11.0
  8760. * @category Array
  8761. * @param {Array} array The array to query.
  8762. * @param {number} [n=0] The index of the element to return.
  8763. * @returns {*} Returns the nth element of `array`.
  8764. * @example
  8765. *
  8766. * var array = ['a', 'b', 'c', 'd'];
  8767. *
  8768. * _.nth(array, 1);
  8769. * // => 'b'
  8770. *
  8771. * _.nth(array, -2);
  8772. * // => 'c';
  8773. */
  8774. function nth(array, n) {
  8775. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  8776. }
  8777. /**
  8778. * Removes all given values from `array` using
  8779. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8780. * for equality comparisons.
  8781. *
  8782. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  8783. * to remove elements from an array by predicate.
  8784. *
  8785. * @static
  8786. * @memberOf _
  8787. * @since 2.0.0
  8788. * @category Array
  8789. * @param {Array} array The array to modify.
  8790. * @param {...*} [values] The values to remove.
  8791. * @returns {Array} Returns `array`.
  8792. * @example
  8793. *
  8794. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  8795. *
  8796. * _.pull(array, 'a', 'c');
  8797. * console.log(array);
  8798. * // => ['b', 'b']
  8799. */
  8800. var pull = baseRest(pullAll);
  8801. /**
  8802. * This method is like `_.pull` except that it accepts an array of values to remove.
  8803. *
  8804. * **Note:** Unlike `_.difference`, this method mutates `array`.
  8805. *
  8806. * @static
  8807. * @memberOf _
  8808. * @since 4.0.0
  8809. * @category Array
  8810. * @param {Array} array The array to modify.
  8811. * @param {Array} values The values to remove.
  8812. * @returns {Array} Returns `array`.
  8813. * @example
  8814. *
  8815. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  8816. *
  8817. * _.pullAll(array, ['a', 'c']);
  8818. * console.log(array);
  8819. * // => ['b', 'b']
  8820. */
  8821. function pullAll(array, values) {
  8822. return (array && array.length && values && values.length)
  8823. ? basePullAll(array, values)
  8824. : array;
  8825. }
  8826. /**
  8827. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  8828. * invoked for each element of `array` and `values` to generate the criterion
  8829. * by which they're compared. The iteratee is invoked with one argument: (value).
  8830. *
  8831. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  8832. *
  8833. * @static
  8834. * @memberOf _
  8835. * @since 4.0.0
  8836. * @category Array
  8837. * @param {Array} array The array to modify.
  8838. * @param {Array} values The values to remove.
  8839. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8840. * @returns {Array} Returns `array`.
  8841. * @example
  8842. *
  8843. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  8844. *
  8845. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  8846. * console.log(array);
  8847. * // => [{ 'x': 2 }]
  8848. */
  8849. function pullAllBy(array, values, iteratee) {
  8850. return (array && array.length && values && values.length)
  8851. ? basePullAll(array, values, getIteratee(iteratee, 2))
  8852. : array;
  8853. }
  8854. /**
  8855. * This method is like `_.pullAll` except that it accepts `comparator` which
  8856. * is invoked to compare elements of `array` to `values`. The comparator is
  8857. * invoked with two arguments: (arrVal, othVal).
  8858. *
  8859. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  8860. *
  8861. * @static
  8862. * @memberOf _
  8863. * @since 4.6.0
  8864. * @category Array
  8865. * @param {Array} array The array to modify.
  8866. * @param {Array} values The values to remove.
  8867. * @param {Function} [comparator] The comparator invoked per element.
  8868. * @returns {Array} Returns `array`.
  8869. * @example
  8870. *
  8871. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  8872. *
  8873. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  8874. * console.log(array);
  8875. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  8876. */
  8877. function pullAllWith(array, values, comparator) {
  8878. return (array && array.length && values && values.length)
  8879. ? basePullAll(array, values, undefined, comparator)
  8880. : array;
  8881. }
  8882. /**
  8883. * Removes elements from `array` corresponding to `indexes` and returns an
  8884. * array of removed elements.
  8885. *
  8886. * **Note:** Unlike `_.at`, this method mutates `array`.
  8887. *
  8888. * @static
  8889. * @memberOf _
  8890. * @since 3.0.0
  8891. * @category Array
  8892. * @param {Array} array The array to modify.
  8893. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  8894. * @returns {Array} Returns the new array of removed elements.
  8895. * @example
  8896. *
  8897. * var array = ['a', 'b', 'c', 'd'];
  8898. * var pulled = _.pullAt(array, [1, 3]);
  8899. *
  8900. * console.log(array);
  8901. * // => ['a', 'c']
  8902. *
  8903. * console.log(pulled);
  8904. * // => ['b', 'd']
  8905. */
  8906. var pullAt = flatRest(function(array, indexes) {
  8907. var length = array == null ? 0 : array.length,
  8908. result = baseAt(array, indexes);
  8909. basePullAt(array, arrayMap(indexes, function(index) {
  8910. return isIndex(index, length) ? +index : index;
  8911. }).sort(compareAscending));
  8912. return result;
  8913. });
  8914. /**
  8915. * Removes all elements from `array` that `predicate` returns truthy for
  8916. * and returns an array of the removed elements. The predicate is invoked
  8917. * with three arguments: (value, index, array).
  8918. *
  8919. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  8920. * to pull elements from an array by value.
  8921. *
  8922. * @static
  8923. * @memberOf _
  8924. * @since 2.0.0
  8925. * @category Array
  8926. * @param {Array} array The array to modify.
  8927. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8928. * @returns {Array} Returns the new array of removed elements.
  8929. * @example
  8930. *
  8931. * var array = [1, 2, 3, 4];
  8932. * var evens = _.remove(array, function(n) {
  8933. * return n % 2 == 0;
  8934. * });
  8935. *
  8936. * console.log(array);
  8937. * // => [1, 3]
  8938. *
  8939. * console.log(evens);
  8940. * // => [2, 4]
  8941. */
  8942. function remove(array, predicate) {
  8943. var result = [];
  8944. if (!(array && array.length)) {
  8945. return result;
  8946. }
  8947. var index = -1,
  8948. indexes = [],
  8949. length = array.length;
  8950. predicate = getIteratee(predicate, 3);
  8951. while (++index < length) {
  8952. var value = array[index];
  8953. if (predicate(value, index, array)) {
  8954. result.push(value);
  8955. indexes.push(index);
  8956. }
  8957. }
  8958. basePullAt(array, indexes);
  8959. return result;
  8960. }
  8961. /**
  8962. * Reverses `array` so that the first element becomes the last, the second
  8963. * element becomes the second to last, and so on.
  8964. *
  8965. * **Note:** This method mutates `array` and is based on
  8966. * [`Array#reverse`](https://mdn.io/Array/reverse).
  8967. *
  8968. * @static
  8969. * @memberOf _
  8970. * @since 4.0.0
  8971. * @category Array
  8972. * @param {Array} array The array to modify.
  8973. * @returns {Array} Returns `array`.
  8974. * @example
  8975. *
  8976. * var array = [1, 2, 3];
  8977. *
  8978. * _.reverse(array);
  8979. * // => [3, 2, 1]
  8980. *
  8981. * console.log(array);
  8982. * // => [3, 2, 1]
  8983. */
  8984. function reverse(array) {
  8985. return array == null ? array : nativeReverse.call(array);
  8986. }
  8987. /**
  8988. * Creates a slice of `array` from `start` up to, but not including, `end`.
  8989. *
  8990. * **Note:** This method is used instead of
  8991. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  8992. * returned.
  8993. *
  8994. * @static
  8995. * @memberOf _
  8996. * @since 3.0.0
  8997. * @category Array
  8998. * @param {Array} array The array to slice.
  8999. * @param {number} [start=0] The start position.
  9000. * @param {number} [end=array.length] The end position.
  9001. * @returns {Array} Returns the slice of `array`.
  9002. */
  9003. function slice(array, start, end) {
  9004. var length = array == null ? 0 : array.length;
  9005. if (!length) {
  9006. return [];
  9007. }
  9008. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  9009. start = 0;
  9010. end = length;
  9011. }
  9012. else {
  9013. start = start == null ? 0 : toInteger(start);
  9014. end = end === undefined ? length : toInteger(end);
  9015. }
  9016. return baseSlice(array, start, end);
  9017. }
  9018. /**
  9019. * Uses a binary search to determine the lowest index at which `value`
  9020. * should be inserted into `array` in order to maintain its sort order.
  9021. *
  9022. * @static
  9023. * @memberOf _
  9024. * @since 0.1.0
  9025. * @category Array
  9026. * @param {Array} array The sorted array to inspect.
  9027. * @param {*} value The value to evaluate.
  9028. * @returns {number} Returns the index at which `value` should be inserted
  9029. * into `array`.
  9030. * @example
  9031. *
  9032. * _.sortedIndex([30, 50], 40);
  9033. * // => 1
  9034. */
  9035. function sortedIndex(array, value) {
  9036. return baseSortedIndex(array, value);
  9037. }
  9038. /**
  9039. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  9040. * which is invoked for `value` and each element of `array` to compute their
  9041. * sort ranking. The iteratee is invoked with one argument: (value).
  9042. *
  9043. * @static
  9044. * @memberOf _
  9045. * @since 4.0.0
  9046. * @category Array
  9047. * @param {Array} array The sorted array to inspect.
  9048. * @param {*} value The value to evaluate.
  9049. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  9050. * @returns {number} Returns the index at which `value` should be inserted
  9051. * into `array`.
  9052. * @example
  9053. *
  9054. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  9055. *
  9056. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  9057. * // => 0
  9058. *
  9059. * // The `_.property` iteratee shorthand.
  9060. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  9061. * // => 0
  9062. */
  9063. function sortedIndexBy(array, value, iteratee) {
  9064. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  9065. }
  9066. /**
  9067. * This method is like `_.indexOf` except that it performs a binary
  9068. * search on a sorted `array`.
  9069. *
  9070. * @static
  9071. * @memberOf _
  9072. * @since 4.0.0
  9073. * @category Array
  9074. * @param {Array} array The array to inspect.
  9075. * @param {*} value The value to search for.
  9076. * @returns {number} Returns the index of the matched value, else `-1`.
  9077. * @example
  9078. *
  9079. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  9080. * // => 1
  9081. */
  9082. function sortedIndexOf(array, value) {
  9083. var length = array == null ? 0 : array.length;
  9084. if (length) {
  9085. var index = baseSortedIndex(array, value);
  9086. if (index < length && eq(array[index], value)) {
  9087. return index;
  9088. }
  9089. }
  9090. return -1;
  9091. }
  9092. /**
  9093. * This method is like `_.sortedIndex` except that it returns the highest
  9094. * index at which `value` should be inserted into `array` in order to
  9095. * maintain its sort order.
  9096. *
  9097. * @static
  9098. * @memberOf _
  9099. * @since 3.0.0
  9100. * @category Array
  9101. * @param {Array} array The sorted array to inspect.
  9102. * @param {*} value The value to evaluate.
  9103. * @returns {number} Returns the index at which `value` should be inserted
  9104. * into `array`.
  9105. * @example
  9106. *
  9107. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  9108. * // => 4
  9109. */
  9110. function sortedLastIndex(array, value) {
  9111. return baseSortedIndex(array, value, true);
  9112. }
  9113. /**
  9114. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  9115. * which is invoked for `value` and each element of `array` to compute their
  9116. * sort ranking. The iteratee is invoked with one argument: (value).
  9117. *
  9118. * @static
  9119. * @memberOf _
  9120. * @since 4.0.0
  9121. * @category Array
  9122. * @param {Array} array The sorted array to inspect.
  9123. * @param {*} value The value to evaluate.
  9124. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  9125. * @returns {number} Returns the index at which `value` should be inserted
  9126. * into `array`.
  9127. * @example
  9128. *
  9129. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  9130. *
  9131. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  9132. * // => 1
  9133. *
  9134. * // The `_.property` iteratee shorthand.
  9135. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  9136. * // => 1
  9137. */
  9138. function sortedLastIndexBy(array, value, iteratee) {
  9139. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  9140. }
  9141. /**
  9142. * This method is like `_.lastIndexOf` except that it performs a binary
  9143. * search on a sorted `array`.
  9144. *
  9145. * @static
  9146. * @memberOf _
  9147. * @since 4.0.0
  9148. * @category Array
  9149. * @param {Array} array The array to inspect.
  9150. * @param {*} value The value to search for.
  9151. * @returns {number} Returns the index of the matched value, else `-1`.
  9152. * @example
  9153. *
  9154. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  9155. * // => 3
  9156. */
  9157. function sortedLastIndexOf(array, value) {
  9158. var length = array == null ? 0 : array.length;
  9159. if (length) {
  9160. var index = baseSortedIndex(array, value, true) - 1;
  9161. if (eq(array[index], value)) {
  9162. return index;
  9163. }
  9164. }
  9165. return -1;
  9166. }
  9167. /**
  9168. * This method is like `_.uniq` except that it's designed and optimized
  9169. * for sorted arrays.
  9170. *
  9171. * @static
  9172. * @memberOf _
  9173. * @since 4.0.0
  9174. * @category Array
  9175. * @param {Array} array The array to inspect.
  9176. * @returns {Array} Returns the new duplicate free array.
  9177. * @example
  9178. *
  9179. * _.sortedUniq([1, 1, 2]);
  9180. * // => [1, 2]
  9181. */
  9182. function sortedUniq(array) {
  9183. return (array && array.length)
  9184. ? baseSortedUniq(array)
  9185. : [];
  9186. }
  9187. /**
  9188. * This method is like `_.uniqBy` except that it's designed and optimized
  9189. * for sorted arrays.
  9190. *
  9191. * @static
  9192. * @memberOf _
  9193. * @since 4.0.0
  9194. * @category Array
  9195. * @param {Array} array The array to inspect.
  9196. * @param {Function} [iteratee] The iteratee invoked per element.
  9197. * @returns {Array} Returns the new duplicate free array.
  9198. * @example
  9199. *
  9200. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  9201. * // => [1.1, 2.3]
  9202. */
  9203. function sortedUniqBy(array, iteratee) {
  9204. return (array && array.length)
  9205. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  9206. : [];
  9207. }
  9208. /**
  9209. * Gets all but the first element of `array`.
  9210. *
  9211. * @static
  9212. * @memberOf _
  9213. * @since 4.0.0
  9214. * @category Array
  9215. * @param {Array} array The array to query.
  9216. * @returns {Array} Returns the slice of `array`.
  9217. * @example
  9218. *
  9219. * _.tail([1, 2, 3]);
  9220. * // => [2, 3]
  9221. */
  9222. function tail(array) {
  9223. var length = array == null ? 0 : array.length;
  9224. return length ? baseSlice(array, 1, length) : [];
  9225. }
  9226. /**
  9227. * Creates a slice of `array` with `n` elements taken from the beginning.
  9228. *
  9229. * @static
  9230. * @memberOf _
  9231. * @since 0.1.0
  9232. * @category Array
  9233. * @param {Array} array The array to query.
  9234. * @param {number} [n=1] The number of elements to take.
  9235. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  9236. * @returns {Array} Returns the slice of `array`.
  9237. * @example
  9238. *
  9239. * _.take([1, 2, 3]);
  9240. * // => [1]
  9241. *
  9242. * _.take([1, 2, 3], 2);
  9243. * // => [1, 2]
  9244. *
  9245. * _.take([1, 2, 3], 5);
  9246. * // => [1, 2, 3]
  9247. *
  9248. * _.take([1, 2, 3], 0);
  9249. * // => []
  9250. */
  9251. function take(array, n, guard) {
  9252. if (!(array && array.length)) {
  9253. return [];
  9254. }
  9255. n = (guard || n === undefined) ? 1 : toInteger(n);
  9256. return baseSlice(array, 0, n < 0 ? 0 : n);
  9257. }
  9258. /**
  9259. * Creates a slice of `array` with `n` elements taken from the end.
  9260. *
  9261. * @static
  9262. * @memberOf _
  9263. * @since 3.0.0
  9264. * @category Array
  9265. * @param {Array} array The array to query.
  9266. * @param {number} [n=1] The number of elements to take.
  9267. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  9268. * @returns {Array} Returns the slice of `array`.
  9269. * @example
  9270. *
  9271. * _.takeRight([1, 2, 3]);
  9272. * // => [3]
  9273. *
  9274. * _.takeRight([1, 2, 3], 2);
  9275. * // => [2, 3]
  9276. *
  9277. * _.takeRight([1, 2, 3], 5);
  9278. * // => [1, 2, 3]
  9279. *
  9280. * _.takeRight([1, 2, 3], 0);
  9281. * // => []
  9282. */
  9283. function takeRight(array, n, guard) {
  9284. var length = array == null ? 0 : array.length;
  9285. if (!length) {
  9286. return [];
  9287. }
  9288. n = (guard || n === undefined) ? 1 : toInteger(n);
  9289. n = length - n;
  9290. return baseSlice(array, n < 0 ? 0 : n, length);
  9291. }
  9292. /**
  9293. * Creates a slice of `array` with elements taken from the end. Elements are
  9294. * taken until `predicate` returns falsey. The predicate is invoked with
  9295. * three arguments: (value, index, array).
  9296. *
  9297. * @static
  9298. * @memberOf _
  9299. * @since 3.0.0
  9300. * @category Array
  9301. * @param {Array} array The array to query.
  9302. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9303. * @returns {Array} Returns the slice of `array`.
  9304. * @example
  9305. *
  9306. * var users = [
  9307. * { 'user': 'barney', 'active': true },
  9308. * { 'user': 'fred', 'active': false },
  9309. * { 'user': 'pebbles', 'active': false }
  9310. * ];
  9311. *
  9312. * _.takeRightWhile(users, function(o) { return !o.active; });
  9313. * // => objects for ['fred', 'pebbles']
  9314. *
  9315. * // The `_.matches` iteratee shorthand.
  9316. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  9317. * // => objects for ['pebbles']
  9318. *
  9319. * // The `_.matchesProperty` iteratee shorthand.
  9320. * _.takeRightWhile(users, ['active', false]);
  9321. * // => objects for ['fred', 'pebbles']
  9322. *
  9323. * // The `_.property` iteratee shorthand.
  9324. * _.takeRightWhile(users, 'active');
  9325. * // => []
  9326. */
  9327. function takeRightWhile(array, predicate) {
  9328. return (array && array.length)
  9329. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  9330. : [];
  9331. }
  9332. /**
  9333. * Creates a slice of `array` with elements taken from the beginning. Elements
  9334. * are taken until `predicate` returns falsey. The predicate is invoked with
  9335. * three arguments: (value, index, array).
  9336. *
  9337. * @static
  9338. * @memberOf _
  9339. * @since 3.0.0
  9340. * @category Array
  9341. * @param {Array} array The array to query.
  9342. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9343. * @returns {Array} Returns the slice of `array`.
  9344. * @example
  9345. *
  9346. * var users = [
  9347. * { 'user': 'barney', 'active': false },
  9348. * { 'user': 'fred', 'active': false },
  9349. * { 'user': 'pebbles', 'active': true }
  9350. * ];
  9351. *
  9352. * _.takeWhile(users, function(o) { return !o.active; });
  9353. * // => objects for ['barney', 'fred']
  9354. *
  9355. * // The `_.matches` iteratee shorthand.
  9356. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  9357. * // => objects for ['barney']
  9358. *
  9359. * // The `_.matchesProperty` iteratee shorthand.
  9360. * _.takeWhile(users, ['active', false]);
  9361. * // => objects for ['barney', 'fred']
  9362. *
  9363. * // The `_.property` iteratee shorthand.
  9364. * _.takeWhile(users, 'active');
  9365. * // => []
  9366. */
  9367. function takeWhile(array, predicate) {
  9368. return (array && array.length)
  9369. ? baseWhile(array, getIteratee(predicate, 3))
  9370. : [];
  9371. }
  9372. /**
  9373. * Creates an array of unique values, in order, from all given arrays using
  9374. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  9375. * for equality comparisons.
  9376. *
  9377. * @static
  9378. * @memberOf _
  9379. * @since 0.1.0
  9380. * @category Array
  9381. * @param {...Array} [arrays] The arrays to inspect.
  9382. * @returns {Array} Returns the new array of combined values.
  9383. * @example
  9384. *
  9385. * _.union([2], [1, 2]);
  9386. * // => [2, 1]
  9387. */
  9388. var union = baseRest(function(arrays) {
  9389. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  9390. });
  9391. /**
  9392. * This method is like `_.union` except that it accepts `iteratee` which is
  9393. * invoked for each element of each `arrays` to generate the criterion by
  9394. * which uniqueness is computed. Result values are chosen from the first
  9395. * array in which the value occurs. The iteratee is invoked with one argument:
  9396. * (value).
  9397. *
  9398. * @static
  9399. * @memberOf _
  9400. * @since 4.0.0
  9401. * @category Array
  9402. * @param {...Array} [arrays] The arrays to inspect.
  9403. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  9404. * @returns {Array} Returns the new array of combined values.
  9405. * @example
  9406. *
  9407. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  9408. * // => [2.1, 1.2]
  9409. *
  9410. * // The `_.property` iteratee shorthand.
  9411. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  9412. * // => [{ 'x': 1 }, { 'x': 2 }]
  9413. */
  9414. var unionBy = baseRest(function(arrays) {
  9415. var iteratee = last(arrays);
  9416. if (isArrayLikeObject(iteratee)) {
  9417. iteratee = undefined;
  9418. }
  9419. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  9420. });
  9421. /**
  9422. * This method is like `_.union` except that it accepts `comparator` which
  9423. * is invoked to compare elements of `arrays`. Result values are chosen from
  9424. * the first array in which the value occurs. The comparator is invoked
  9425. * with two arguments: (arrVal, othVal).
  9426. *
  9427. * @static
  9428. * @memberOf _
  9429. * @since 4.0.0
  9430. * @category Array
  9431. * @param {...Array} [arrays] The arrays to inspect.
  9432. * @param {Function} [comparator] The comparator invoked per element.
  9433. * @returns {Array} Returns the new array of combined values.
  9434. * @example
  9435. *
  9436. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  9437. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  9438. *
  9439. * _.unionWith(objects, others, _.isEqual);
  9440. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  9441. */
  9442. var unionWith = baseRest(function(arrays) {
  9443. var comparator = last(arrays);
  9444. comparator = typeof comparator == 'function' ? comparator : undefined;
  9445. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  9446. });
  9447. /**
  9448. * Creates a duplicate-free version of an array, using
  9449. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  9450. * for equality comparisons, in which only the first occurrence of each element
  9451. * is kept. The order of result values is determined by the order they occur
  9452. * in the array.
  9453. *
  9454. * @static
  9455. * @memberOf _
  9456. * @since 0.1.0
  9457. * @category Array
  9458. * @param {Array} array The array to inspect.
  9459. * @returns {Array} Returns the new duplicate free array.
  9460. * @example
  9461. *
  9462. * _.uniq([2, 1, 2]);
  9463. * // => [2, 1]
  9464. */
  9465. function uniq(array) {
  9466. return (array && array.length) ? baseUniq(array) : [];
  9467. }
  9468. /**
  9469. * This method is like `_.uniq` except that it accepts `iteratee` which is
  9470. * invoked for each element in `array` to generate the criterion by which
  9471. * uniqueness is computed. The order of result values is determined by the
  9472. * order they occur in the array. The iteratee is invoked with one argument:
  9473. * (value).
  9474. *
  9475. * @static
  9476. * @memberOf _
  9477. * @since 4.0.0
  9478. * @category Array
  9479. * @param {Array} array The array to inspect.
  9480. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  9481. * @returns {Array} Returns the new duplicate free array.
  9482. * @example
  9483. *
  9484. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  9485. * // => [2.1, 1.2]
  9486. *
  9487. * // The `_.property` iteratee shorthand.
  9488. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  9489. * // => [{ 'x': 1 }, { 'x': 2 }]
  9490. */
  9491. function uniqBy(array, iteratee) {
  9492. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  9493. }
  9494. /**
  9495. * This method is like `_.uniq` except that it accepts `comparator` which
  9496. * is invoked to compare elements of `array`. The order of result values is
  9497. * determined by the order they occur in the array.The comparator is invoked
  9498. * with two arguments: (arrVal, othVal).
  9499. *
  9500. * @static
  9501. * @memberOf _
  9502. * @since 4.0.0
  9503. * @category Array
  9504. * @param {Array} array The array to inspect.
  9505. * @param {Function} [comparator] The comparator invoked per element.
  9506. * @returns {Array} Returns the new duplicate free array.
  9507. * @example
  9508. *
  9509. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  9510. *
  9511. * _.uniqWith(objects, _.isEqual);
  9512. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  9513. */
  9514. function uniqWith(array, comparator) {
  9515. comparator = typeof comparator == 'function' ? comparator : undefined;
  9516. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  9517. }
  9518. /**
  9519. * This method is like `_.zip` except that it accepts an array of grouped
  9520. * elements and creates an array regrouping the elements to their pre-zip
  9521. * configuration.
  9522. *
  9523. * @static
  9524. * @memberOf _
  9525. * @since 1.2.0
  9526. * @category Array
  9527. * @param {Array} array The array of grouped elements to process.
  9528. * @returns {Array} Returns the new array of regrouped elements.
  9529. * @example
  9530. *
  9531. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  9532. * // => [['a', 1, true], ['b', 2, false]]
  9533. *
  9534. * _.unzip(zipped);
  9535. * // => [['a', 'b'], [1, 2], [true, false]]
  9536. */
  9537. function unzip(array) {
  9538. if (!(array && array.length)) {
  9539. return [];
  9540. }
  9541. var length = 0;
  9542. array = arrayFilter(array, function(group) {
  9543. if (isArrayLikeObject(group)) {
  9544. length = nativeMax(group.length, length);
  9545. return true;
  9546. }
  9547. });
  9548. return baseTimes(length, function(index) {
  9549. return arrayMap(array, baseProperty(index));
  9550. });
  9551. }
  9552. /**
  9553. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  9554. * how regrouped values should be combined. The iteratee is invoked with the
  9555. * elements of each group: (...group).
  9556. *
  9557. * @static
  9558. * @memberOf _
  9559. * @since 3.8.0
  9560. * @category Array
  9561. * @param {Array} array The array of grouped elements to process.
  9562. * @param {Function} [iteratee=_.identity] The function to combine
  9563. * regrouped values.
  9564. * @returns {Array} Returns the new array of regrouped elements.
  9565. * @example
  9566. *
  9567. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  9568. * // => [[1, 10, 100], [2, 20, 200]]
  9569. *
  9570. * _.unzipWith(zipped, _.add);
  9571. * // => [3, 30, 300]
  9572. */
  9573. function unzipWith(array, iteratee) {
  9574. if (!(array && array.length)) {
  9575. return [];
  9576. }
  9577. var result = unzip(array);
  9578. if (iteratee == null) {
  9579. return result;
  9580. }
  9581. return arrayMap(result, function(group) {
  9582. return apply(iteratee, undefined, group);
  9583. });
  9584. }
  9585. /**
  9586. * Creates an array excluding all given values using
  9587. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  9588. * for equality comparisons.
  9589. *
  9590. * **Note:** Unlike `_.pull`, this method returns a new array.
  9591. *
  9592. * @static
  9593. * @memberOf _
  9594. * @since 0.1.0
  9595. * @category Array
  9596. * @param {Array} array The array to inspect.
  9597. * @param {...*} [values] The values to exclude.
  9598. * @returns {Array} Returns the new array of filtered values.
  9599. * @see _.difference, _.xor
  9600. * @example
  9601. *
  9602. * _.without([2, 1, 2, 3], 1, 2);
  9603. * // => [3]
  9604. */
  9605. var without = baseRest(function(array, values) {
  9606. return isArrayLikeObject(array)
  9607. ? baseDifference(array, values)
  9608. : [];
  9609. });
  9610. /**
  9611. * Creates an array of unique values that is the
  9612. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  9613. * of the given arrays. The order of result values is determined by the order
  9614. * they occur in the arrays.
  9615. *
  9616. * @static
  9617. * @memberOf _
  9618. * @since 2.4.0
  9619. * @category Array
  9620. * @param {...Array} [arrays] The arrays to inspect.
  9621. * @returns {Array} Returns the new array of filtered values.
  9622. * @see _.difference, _.without
  9623. * @example
  9624. *
  9625. * _.xor([2, 1], [2, 3]);
  9626. * // => [1, 3]
  9627. */
  9628. var xor = baseRest(function(arrays) {
  9629. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  9630. });
  9631. /**
  9632. * This method is like `_.xor` except that it accepts `iteratee` which is
  9633. * invoked for each element of each `arrays` to generate the criterion by
  9634. * which by which they're compared. The order of result values is determined
  9635. * by the order they occur in the arrays. The iteratee is invoked with one
  9636. * argument: (value).
  9637. *
  9638. * @static
  9639. * @memberOf _
  9640. * @since 4.0.0
  9641. * @category Array
  9642. * @param {...Array} [arrays] The arrays to inspect.
  9643. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  9644. * @returns {Array} Returns the new array of filtered values.
  9645. * @example
  9646. *
  9647. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  9648. * // => [1.2, 3.4]
  9649. *
  9650. * // The `_.property` iteratee shorthand.
  9651. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  9652. * // => [{ 'x': 2 }]
  9653. */
  9654. var xorBy = baseRest(function(arrays) {
  9655. var iteratee = last(arrays);
  9656. if (isArrayLikeObject(iteratee)) {
  9657. iteratee = undefined;
  9658. }
  9659. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  9660. });
  9661. /**
  9662. * This method is like `_.xor` except that it accepts `comparator` which is
  9663. * invoked to compare elements of `arrays`. The order of result values is
  9664. * determined by the order they occur in the arrays. The comparator is invoked
  9665. * with two arguments: (arrVal, othVal).
  9666. *
  9667. * @static
  9668. * @memberOf _
  9669. * @since 4.0.0
  9670. * @category Array
  9671. * @param {...Array} [arrays] The arrays to inspect.
  9672. * @param {Function} [comparator] The comparator invoked per element.
  9673. * @returns {Array} Returns the new array of filtered values.
  9674. * @example
  9675. *
  9676. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  9677. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  9678. *
  9679. * _.xorWith(objects, others, _.isEqual);
  9680. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  9681. */
  9682. var xorWith = baseRest(function(arrays) {
  9683. var comparator = last(arrays);
  9684. comparator = typeof comparator == 'function' ? comparator : undefined;
  9685. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  9686. });
  9687. /**
  9688. * Creates an array of grouped elements, the first of which contains the
  9689. * first elements of the given arrays, the second of which contains the
  9690. * second elements of the given arrays, and so on.
  9691. *
  9692. * @static
  9693. * @memberOf _
  9694. * @since 0.1.0
  9695. * @category Array
  9696. * @param {...Array} [arrays] The arrays to process.
  9697. * @returns {Array} Returns the new array of grouped elements.
  9698. * @example
  9699. *
  9700. * _.zip(['a', 'b'], [1, 2], [true, false]);
  9701. * // => [['a', 1, true], ['b', 2, false]]
  9702. */
  9703. var zip = baseRest(unzip);
  9704. /**
  9705. * This method is like `_.fromPairs` except that it accepts two arrays,
  9706. * one of property identifiers and one of corresponding values.
  9707. *
  9708. * @static
  9709. * @memberOf _
  9710. * @since 0.4.0
  9711. * @category Array
  9712. * @param {Array} [props=[]] The property identifiers.
  9713. * @param {Array} [values=[]] The property values.
  9714. * @returns {Object} Returns the new object.
  9715. * @example
  9716. *
  9717. * _.zipObject(['a', 'b'], [1, 2]);
  9718. * // => { 'a': 1, 'b': 2 }
  9719. */
  9720. function zipObject(props, values) {
  9721. return baseZipObject(props || [], values || [], assignValue);
  9722. }
  9723. /**
  9724. * This method is like `_.zipObject` except that it supports property paths.
  9725. *
  9726. * @static
  9727. * @memberOf _
  9728. * @since 4.1.0
  9729. * @category Array
  9730. * @param {Array} [props=[]] The property identifiers.
  9731. * @param {Array} [values=[]] The property values.
  9732. * @returns {Object} Returns the new object.
  9733. * @example
  9734. *
  9735. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  9736. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  9737. */
  9738. function zipObjectDeep(props, values) {
  9739. return baseZipObject(props || [], values || [], baseSet);
  9740. }
  9741. /**
  9742. * This method is like `_.zip` except that it accepts `iteratee` to specify
  9743. * how grouped values should be combined. The iteratee is invoked with the
  9744. * elements of each group: (...group).
  9745. *
  9746. * @static
  9747. * @memberOf _
  9748. * @since 3.8.0
  9749. * @category Array
  9750. * @param {...Array} [arrays] The arrays to process.
  9751. * @param {Function} [iteratee=_.identity] The function to combine
  9752. * grouped values.
  9753. * @returns {Array} Returns the new array of grouped elements.
  9754. * @example
  9755. *
  9756. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  9757. * return a + b + c;
  9758. * });
  9759. * // => [111, 222]
  9760. */
  9761. var zipWith = baseRest(function(arrays) {
  9762. var length = arrays.length,
  9763. iteratee = length > 1 ? arrays[length - 1] : undefined;
  9764. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  9765. return unzipWith(arrays, iteratee);
  9766. });
  9767. /*------------------------------------------------------------------------*/
  9768. /**
  9769. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  9770. * chain sequences enabled. The result of such sequences must be unwrapped
  9771. * with `_#value`.
  9772. *
  9773. * @static
  9774. * @memberOf _
  9775. * @since 1.3.0
  9776. * @category Seq
  9777. * @param {*} value The value to wrap.
  9778. * @returns {Object} Returns the new `lodash` wrapper instance.
  9779. * @example
  9780. *
  9781. * var users = [
  9782. * { 'user': 'barney', 'age': 36 },
  9783. * { 'user': 'fred', 'age': 40 },
  9784. * { 'user': 'pebbles', 'age': 1 }
  9785. * ];
  9786. *
  9787. * var youngest = _
  9788. * .chain(users)
  9789. * .sortBy('age')
  9790. * .map(function(o) {
  9791. * return o.user + ' is ' + o.age;
  9792. * })
  9793. * .head()
  9794. * .value();
  9795. * // => 'pebbles is 1'
  9796. */
  9797. function chain(value) {
  9798. var result = lodash(value);
  9799. result.__chain__ = true;
  9800. return result;
  9801. }
  9802. /**
  9803. * This method invokes `interceptor` and returns `value`. The interceptor
  9804. * is invoked with one argument; (value). The purpose of this method is to
  9805. * "tap into" a method chain sequence in order to modify intermediate results.
  9806. *
  9807. * @static
  9808. * @memberOf _
  9809. * @since 0.1.0
  9810. * @category Seq
  9811. * @param {*} value The value to provide to `interceptor`.
  9812. * @param {Function} interceptor The function to invoke.
  9813. * @returns {*} Returns `value`.
  9814. * @example
  9815. *
  9816. * _([1, 2, 3])
  9817. * .tap(function(array) {
  9818. * // Mutate input array.
  9819. * array.pop();
  9820. * })
  9821. * .reverse()
  9822. * .value();
  9823. * // => [2, 1]
  9824. */
  9825. function tap(value, interceptor) {
  9826. interceptor(value);
  9827. return value;
  9828. }
  9829. /**
  9830. * This method is like `_.tap` except that it returns the result of `interceptor`.
  9831. * The purpose of this method is to "pass thru" values replacing intermediate
  9832. * results in a method chain sequence.
  9833. *
  9834. * @static
  9835. * @memberOf _
  9836. * @since 3.0.0
  9837. * @category Seq
  9838. * @param {*} value The value to provide to `interceptor`.
  9839. * @param {Function} interceptor The function to invoke.
  9840. * @returns {*} Returns the result of `interceptor`.
  9841. * @example
  9842. *
  9843. * _(' abc ')
  9844. * .chain()
  9845. * .trim()
  9846. * .thru(function(value) {
  9847. * return [value];
  9848. * })
  9849. * .value();
  9850. * // => ['abc']
  9851. */
  9852. function thru(value, interceptor) {
  9853. return interceptor(value);
  9854. }
  9855. /**
  9856. * This method is the wrapper version of `_.at`.
  9857. *
  9858. * @name at
  9859. * @memberOf _
  9860. * @since 1.0.0
  9861. * @category Seq
  9862. * @param {...(string|string[])} [paths] The property paths to pick.
  9863. * @returns {Object} Returns the new `lodash` wrapper instance.
  9864. * @example
  9865. *
  9866. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  9867. *
  9868. * _(object).at(['a[0].b.c', 'a[1]']).value();
  9869. * // => [3, 4]
  9870. */
  9871. var wrapperAt = flatRest(function(paths) {
  9872. var length = paths.length,
  9873. start = length ? paths[0] : 0,
  9874. value = this.__wrapped__,
  9875. interceptor = function(object) { return baseAt(object, paths); };
  9876. if (length > 1 || this.__actions__.length ||
  9877. !(value instanceof LazyWrapper) || !isIndex(start)) {
  9878. return this.thru(interceptor);
  9879. }
  9880. value = value.slice(start, +start + (length ? 1 : 0));
  9881. value.__actions__.push({
  9882. 'func': thru,
  9883. 'args': [interceptor],
  9884. 'thisArg': undefined
  9885. });
  9886. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  9887. if (length && !array.length) {
  9888. array.push(undefined);
  9889. }
  9890. return array;
  9891. });
  9892. });
  9893. /**
  9894. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  9895. *
  9896. * @name chain
  9897. * @memberOf _
  9898. * @since 0.1.0
  9899. * @category Seq
  9900. * @returns {Object} Returns the new `lodash` wrapper instance.
  9901. * @example
  9902. *
  9903. * var users = [
  9904. * { 'user': 'barney', 'age': 36 },
  9905. * { 'user': 'fred', 'age': 40 }
  9906. * ];
  9907. *
  9908. * // A sequence without explicit chaining.
  9909. * _(users).head();
  9910. * // => { 'user': 'barney', 'age': 36 }
  9911. *
  9912. * // A sequence with explicit chaining.
  9913. * _(users)
  9914. * .chain()
  9915. * .head()
  9916. * .pick('user')
  9917. * .value();
  9918. * // => { 'user': 'barney' }
  9919. */
  9920. function wrapperChain() {
  9921. return chain(this);
  9922. }
  9923. /**
  9924. * Executes the chain sequence and returns the wrapped result.
  9925. *
  9926. * @name commit
  9927. * @memberOf _
  9928. * @since 3.2.0
  9929. * @category Seq
  9930. * @returns {Object} Returns the new `lodash` wrapper instance.
  9931. * @example
  9932. *
  9933. * var array = [1, 2];
  9934. * var wrapped = _(array).push(3);
  9935. *
  9936. * console.log(array);
  9937. * // => [1, 2]
  9938. *
  9939. * wrapped = wrapped.commit();
  9940. * console.log(array);
  9941. * // => [1, 2, 3]
  9942. *
  9943. * wrapped.last();
  9944. * // => 3
  9945. *
  9946. * console.log(array);
  9947. * // => [1, 2, 3]
  9948. */
  9949. function wrapperCommit() {
  9950. return new LodashWrapper(this.value(), this.__chain__);
  9951. }
  9952. /**
  9953. * Gets the next value on a wrapped object following the
  9954. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  9955. *
  9956. * @name next
  9957. * @memberOf _
  9958. * @since 4.0.0
  9959. * @category Seq
  9960. * @returns {Object} Returns the next iterator value.
  9961. * @example
  9962. *
  9963. * var wrapped = _([1, 2]);
  9964. *
  9965. * wrapped.next();
  9966. * // => { 'done': false, 'value': 1 }
  9967. *
  9968. * wrapped.next();
  9969. * // => { 'done': false, 'value': 2 }
  9970. *
  9971. * wrapped.next();
  9972. * // => { 'done': true, 'value': undefined }
  9973. */
  9974. function wrapperNext() {
  9975. if (this.__values__ === undefined) {
  9976. this.__values__ = toArray(this.value());
  9977. }
  9978. var done = this.__index__ >= this.__values__.length,
  9979. value = done ? undefined : this.__values__[this.__index__++];
  9980. return { 'done': done, 'value': value };
  9981. }
  9982. /**
  9983. * Enables the wrapper to be iterable.
  9984. *
  9985. * @name Symbol.iterator
  9986. * @memberOf _
  9987. * @since 4.0.0
  9988. * @category Seq
  9989. * @returns {Object} Returns the wrapper object.
  9990. * @example
  9991. *
  9992. * var wrapped = _([1, 2]);
  9993. *
  9994. * wrapped[Symbol.iterator]() === wrapped;
  9995. * // => true
  9996. *
  9997. * Array.from(wrapped);
  9998. * // => [1, 2]
  9999. */
  10000. function wrapperToIterator() {
  10001. return this;
  10002. }
  10003. /**
  10004. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  10005. *
  10006. * @name plant
  10007. * @memberOf _
  10008. * @since 3.2.0
  10009. * @category Seq
  10010. * @param {*} value The value to plant.
  10011. * @returns {Object} Returns the new `lodash` wrapper instance.
  10012. * @example
  10013. *
  10014. * function square(n) {
  10015. * return n * n;
  10016. * }
  10017. *
  10018. * var wrapped = _([1, 2]).map(square);
  10019. * var other = wrapped.plant([3, 4]);
  10020. *
  10021. * other.value();
  10022. * // => [9, 16]
  10023. *
  10024. * wrapped.value();
  10025. * // => [1, 4]
  10026. */
  10027. function wrapperPlant(value) {
  10028. var result,
  10029. parent = this;
  10030. while (parent instanceof baseLodash) {
  10031. var clone = wrapperClone(parent);
  10032. clone.__index__ = 0;
  10033. clone.__values__ = undefined;
  10034. if (result) {
  10035. previous.__wrapped__ = clone;
  10036. } else {
  10037. result = clone;
  10038. }
  10039. var previous = clone;
  10040. parent = parent.__wrapped__;
  10041. }
  10042. previous.__wrapped__ = value;
  10043. return result;
  10044. }
  10045. /**
  10046. * This method is the wrapper version of `_.reverse`.
  10047. *
  10048. * **Note:** This method mutates the wrapped array.
  10049. *
  10050. * @name reverse
  10051. * @memberOf _
  10052. * @since 0.1.0
  10053. * @category Seq
  10054. * @returns {Object} Returns the new `lodash` wrapper instance.
  10055. * @example
  10056. *
  10057. * var array = [1, 2, 3];
  10058. *
  10059. * _(array).reverse().value()
  10060. * // => [3, 2, 1]
  10061. *
  10062. * console.log(array);
  10063. * // => [3, 2, 1]
  10064. */
  10065. function wrapperReverse() {
  10066. var value = this.__wrapped__;
  10067. if (value instanceof LazyWrapper) {
  10068. var wrapped = value;
  10069. if (this.__actions__.length) {
  10070. wrapped = new LazyWrapper(this);
  10071. }
  10072. wrapped = wrapped.reverse();
  10073. wrapped.__actions__.push({
  10074. 'func': thru,
  10075. 'args': [reverse],
  10076. 'thisArg': undefined
  10077. });
  10078. return new LodashWrapper(wrapped, this.__chain__);
  10079. }
  10080. return this.thru(reverse);
  10081. }
  10082. /**
  10083. * Executes the chain sequence to resolve the unwrapped value.
  10084. *
  10085. * @name value
  10086. * @memberOf _
  10087. * @since 0.1.0
  10088. * @alias toJSON, valueOf
  10089. * @category Seq
  10090. * @returns {*} Returns the resolved unwrapped value.
  10091. * @example
  10092. *
  10093. * _([1, 2, 3]).value();
  10094. * // => [1, 2, 3]
  10095. */
  10096. function wrapperValue() {
  10097. return baseWrapperValue(this.__wrapped__, this.__actions__);
  10098. }
  10099. /*------------------------------------------------------------------------*/
  10100. /**
  10101. * Creates an object composed of keys generated from the results of running
  10102. * each element of `collection` thru `iteratee`. The corresponding value of
  10103. * each key is the number of times the key was returned by `iteratee`. The
  10104. * iteratee is invoked with one argument: (value).
  10105. *
  10106. * @static
  10107. * @memberOf _
  10108. * @since 0.5.0
  10109. * @category Collection
  10110. * @param {Array|Object} collection The collection to iterate over.
  10111. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  10112. * @returns {Object} Returns the composed aggregate object.
  10113. * @example
  10114. *
  10115. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  10116. * // => { '4': 1, '6': 2 }
  10117. *
  10118. * // The `_.property` iteratee shorthand.
  10119. * _.countBy(['one', 'two', 'three'], 'length');
  10120. * // => { '3': 2, '5': 1 }
  10121. */
  10122. var countBy = createAggregator(function(result, value, key) {
  10123. if (hasOwnProperty.call(result, key)) {
  10124. ++result[key];
  10125. } else {
  10126. baseAssignValue(result, key, 1);
  10127. }
  10128. });
  10129. /**
  10130. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  10131. * Iteration is stopped once `predicate` returns falsey. The predicate is
  10132. * invoked with three arguments: (value, index|key, collection).
  10133. *
  10134. * **Note:** This method returns `true` for
  10135. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  10136. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  10137. * elements of empty collections.
  10138. *
  10139. * @static
  10140. * @memberOf _
  10141. * @since 0.1.0
  10142. * @category Collection
  10143. * @param {Array|Object} collection The collection to iterate over.
  10144. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  10145. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10146. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  10147. * else `false`.
  10148. * @example
  10149. *
  10150. * _.every([true, 1, null, 'yes'], Boolean);
  10151. * // => false
  10152. *
  10153. * var users = [
  10154. * { 'user': 'barney', 'age': 36, 'active': false },
  10155. * { 'user': 'fred', 'age': 40, 'active': false }
  10156. * ];
  10157. *
  10158. * // The `_.matches` iteratee shorthand.
  10159. * _.every(users, { 'user': 'barney', 'active': false });
  10160. * // => false
  10161. *
  10162. * // The `_.matchesProperty` iteratee shorthand.
  10163. * _.every(users, ['active', false]);
  10164. * // => true
  10165. *
  10166. * // The `_.property` iteratee shorthand.
  10167. * _.every(users, 'active');
  10168. * // => false
  10169. */
  10170. function every(collection, predicate, guard) {
  10171. var func = isArray(collection) ? arrayEvery : baseEvery;
  10172. if (guard && isIterateeCall(collection, predicate, guard)) {
  10173. predicate = undefined;
  10174. }
  10175. return func(collection, getIteratee(predicate, 3));
  10176. }
  10177. /**
  10178. * Iterates over elements of `collection`, returning an array of all elements
  10179. * `predicate` returns truthy for. The predicate is invoked with three
  10180. * arguments: (value, index|key, collection).
  10181. *
  10182. * **Note:** Unlike `_.remove`, this method returns a new array.
  10183. *
  10184. * @static
  10185. * @memberOf _
  10186. * @since 0.1.0
  10187. * @category Collection
  10188. * @param {Array|Object} collection The collection to iterate over.
  10189. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  10190. * @returns {Array} Returns the new filtered array.
  10191. * @see _.reject
  10192. * @example
  10193. *
  10194. * var users = [
  10195. * { 'user': 'barney', 'age': 36, 'active': true },
  10196. * { 'user': 'fred', 'age': 40, 'active': false }
  10197. * ];
  10198. *
  10199. * _.filter(users, function(o) { return !o.active; });
  10200. * // => objects for ['fred']
  10201. *
  10202. * // The `_.matches` iteratee shorthand.
  10203. * _.filter(users, { 'age': 36, 'active': true });
  10204. * // => objects for ['barney']
  10205. *
  10206. * // The `_.matchesProperty` iteratee shorthand.
  10207. * _.filter(users, ['active', false]);
  10208. * // => objects for ['fred']
  10209. *
  10210. * // The `_.property` iteratee shorthand.
  10211. * _.filter(users, 'active');
  10212. * // => objects for ['barney']
  10213. *
  10214. * // Combining several predicates using `_.overEvery` or `_.overSome`.
  10215. * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));
  10216. * // => objects for ['fred', 'barney']
  10217. */
  10218. function filter(collection, predicate) {
  10219. var func = isArray(collection) ? arrayFilter : baseFilter;
  10220. return func(collection, getIteratee(predicate, 3));
  10221. }
  10222. /**
  10223. * Iterates over elements of `collection`, returning the first element
  10224. * `predicate` returns truthy for. The predicate is invoked with three
  10225. * arguments: (value, index|key, collection).
  10226. *
  10227. * @static
  10228. * @memberOf _
  10229. * @since 0.1.0
  10230. * @category Collection
  10231. * @param {Array|Object} collection The collection to inspect.
  10232. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  10233. * @param {number} [fromIndex=0] The index to search from.
  10234. * @returns {*} Returns the matched element, else `undefined`.
  10235. * @example
  10236. *
  10237. * var users = [
  10238. * { 'user': 'barney', 'age': 36, 'active': true },
  10239. * { 'user': 'fred', 'age': 40, 'active': false },
  10240. * { 'user': 'pebbles', 'age': 1, 'active': true }
  10241. * ];
  10242. *
  10243. * _.find(users, function(o) { return o.age < 40; });
  10244. * // => object for 'barney'
  10245. *
  10246. * // The `_.matches` iteratee shorthand.
  10247. * _.find(users, { 'age': 1, 'active': true });
  10248. * // => object for 'pebbles'
  10249. *
  10250. * // The `_.matchesProperty` iteratee shorthand.
  10251. * _.find(users, ['active', false]);
  10252. * // => object for 'fred'
  10253. *
  10254. * // The `_.property` iteratee shorthand.
  10255. * _.find(users, 'active');
  10256. * // => object for 'barney'
  10257. */
  10258. var find = createFind(findIndex);
  10259. /**
  10260. * This method is like `_.find` except that it iterates over elements of
  10261. * `collection` from right to left.
  10262. *
  10263. * @static
  10264. * @memberOf _
  10265. * @since 2.0.0
  10266. * @category Collection
  10267. * @param {Array|Object} collection The collection to inspect.
  10268. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  10269. * @param {number} [fromIndex=collection.length-1] The index to search from.
  10270. * @returns {*} Returns the matched element, else `undefined`.
  10271. * @example
  10272. *
  10273. * _.findLast([1, 2, 3, 4], function(n) {
  10274. * return n % 2 == 1;
  10275. * });
  10276. * // => 3
  10277. */
  10278. var findLast = createFind(findLastIndex);
  10279. /**
  10280. * Creates a flattened array of values by running each element in `collection`
  10281. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  10282. * with three arguments: (value, index|key, collection).
  10283. *
  10284. * @static
  10285. * @memberOf _
  10286. * @since 4.0.0
  10287. * @category Collection
  10288. * @param {Array|Object} collection The collection to iterate over.
  10289. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10290. * @returns {Array} Returns the new flattened array.
  10291. * @example
  10292. *
  10293. * function duplicate(n) {
  10294. * return [n, n];
  10295. * }
  10296. *
  10297. * _.flatMap([1, 2], duplicate);
  10298. * // => [1, 1, 2, 2]
  10299. */
  10300. function flatMap(collection, iteratee) {
  10301. return baseFlatten(map(collection, iteratee), 1);
  10302. }
  10303. /**
  10304. * This method is like `_.flatMap` except that it recursively flattens the
  10305. * mapped results.
  10306. *
  10307. * @static
  10308. * @memberOf _
  10309. * @since 4.7.0
  10310. * @category Collection
  10311. * @param {Array|Object} collection The collection to iterate over.
  10312. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10313. * @returns {Array} Returns the new flattened array.
  10314. * @example
  10315. *
  10316. * function duplicate(n) {
  10317. * return [[[n, n]]];
  10318. * }
  10319. *
  10320. * _.flatMapDeep([1, 2], duplicate);
  10321. * // => [1, 1, 2, 2]
  10322. */
  10323. function flatMapDeep(collection, iteratee) {
  10324. return baseFlatten(map(collection, iteratee), INFINITY);
  10325. }
  10326. /**
  10327. * This method is like `_.flatMap` except that it recursively flattens the
  10328. * mapped results up to `depth` times.
  10329. *
  10330. * @static
  10331. * @memberOf _
  10332. * @since 4.7.0
  10333. * @category Collection
  10334. * @param {Array|Object} collection The collection to iterate over.
  10335. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10336. * @param {number} [depth=1] The maximum recursion depth.
  10337. * @returns {Array} Returns the new flattened array.
  10338. * @example
  10339. *
  10340. * function duplicate(n) {
  10341. * return [[[n, n]]];
  10342. * }
  10343. *
  10344. * _.flatMapDepth([1, 2], duplicate, 2);
  10345. * // => [[1, 1], [2, 2]]
  10346. */
  10347. function flatMapDepth(collection, iteratee, depth) {
  10348. depth = depth === undefined ? 1 : toInteger(depth);
  10349. return baseFlatten(map(collection, iteratee), depth);
  10350. }
  10351. /**
  10352. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  10353. * The iteratee is invoked with three arguments: (value, index|key, collection).
  10354. * Iteratee functions may exit iteration early by explicitly returning `false`.
  10355. *
  10356. * **Note:** As with other "Collections" methods, objects with a "length"
  10357. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  10358. * or `_.forOwn` for object iteration.
  10359. *
  10360. * @static
  10361. * @memberOf _
  10362. * @since 0.1.0
  10363. * @alias each
  10364. * @category Collection
  10365. * @param {Array|Object} collection The collection to iterate over.
  10366. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10367. * @returns {Array|Object} Returns `collection`.
  10368. * @see _.forEachRight
  10369. * @example
  10370. *
  10371. * _.forEach([1, 2], function(value) {
  10372. * console.log(value);
  10373. * });
  10374. * // => Logs `1` then `2`.
  10375. *
  10376. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  10377. * console.log(key);
  10378. * });
  10379. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  10380. */
  10381. function forEach(collection, iteratee) {
  10382. var func = isArray(collection) ? arrayEach : baseEach;
  10383. return func(collection, getIteratee(iteratee, 3));
  10384. }
  10385. /**
  10386. * This method is like `_.forEach` except that it iterates over elements of
  10387. * `collection` from right to left.
  10388. *
  10389. * @static
  10390. * @memberOf _
  10391. * @since 2.0.0
  10392. * @alias eachRight
  10393. * @category Collection
  10394. * @param {Array|Object} collection The collection to iterate over.
  10395. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10396. * @returns {Array|Object} Returns `collection`.
  10397. * @see _.forEach
  10398. * @example
  10399. *
  10400. * _.forEachRight([1, 2], function(value) {
  10401. * console.log(value);
  10402. * });
  10403. * // => Logs `2` then `1`.
  10404. */
  10405. function forEachRight(collection, iteratee) {
  10406. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  10407. return func(collection, getIteratee(iteratee, 3));
  10408. }
  10409. /**
  10410. * Creates an object composed of keys generated from the results of running
  10411. * each element of `collection` thru `iteratee`. The order of grouped values
  10412. * is determined by the order they occur in `collection`. The corresponding
  10413. * value of each key is an array of elements responsible for generating the
  10414. * key. The iteratee is invoked with one argument: (value).
  10415. *
  10416. * @static
  10417. * @memberOf _
  10418. * @since 0.1.0
  10419. * @category Collection
  10420. * @param {Array|Object} collection The collection to iterate over.
  10421. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  10422. * @returns {Object} Returns the composed aggregate object.
  10423. * @example
  10424. *
  10425. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  10426. * // => { '4': [4.2], '6': [6.1, 6.3] }
  10427. *
  10428. * // The `_.property` iteratee shorthand.
  10429. * _.groupBy(['one', 'two', 'three'], 'length');
  10430. * // => { '3': ['one', 'two'], '5': ['three'] }
  10431. */
  10432. var groupBy = createAggregator(function(result, value, key) {
  10433. if (hasOwnProperty.call(result, key)) {
  10434. result[key].push(value);
  10435. } else {
  10436. baseAssignValue(result, key, [value]);
  10437. }
  10438. });
  10439. /**
  10440. * Checks if `value` is in `collection`. If `collection` is a string, it's
  10441. * checked for a substring of `value`, otherwise
  10442. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  10443. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  10444. * the offset from the end of `collection`.
  10445. *
  10446. * @static
  10447. * @memberOf _
  10448. * @since 0.1.0
  10449. * @category Collection
  10450. * @param {Array|Object|string} collection The collection to inspect.
  10451. * @param {*} value The value to search for.
  10452. * @param {number} [fromIndex=0] The index to search from.
  10453. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  10454. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  10455. * @example
  10456. *
  10457. * _.includes([1, 2, 3], 1);
  10458. * // => true
  10459. *
  10460. * _.includes([1, 2, 3], 1, 2);
  10461. * // => false
  10462. *
  10463. * _.includes({ 'a': 1, 'b': 2 }, 1);
  10464. * // => true
  10465. *
  10466. * _.includes('abcd', 'bc');
  10467. * // => true
  10468. */
  10469. function includes(collection, value, fromIndex, guard) {
  10470. collection = isArrayLike(collection) ? collection : values(collection);
  10471. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  10472. var length = collection.length;
  10473. if (fromIndex < 0) {
  10474. fromIndex = nativeMax(length + fromIndex, 0);
  10475. }
  10476. return isString(collection)
  10477. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  10478. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  10479. }
  10480. /**
  10481. * Invokes the method at `path` of each element in `collection`, returning
  10482. * an array of the results of each invoked method. Any additional arguments
  10483. * are provided to each invoked method. If `path` is a function, it's invoked
  10484. * for, and `this` bound to, each element in `collection`.
  10485. *
  10486. * @static
  10487. * @memberOf _
  10488. * @since 4.0.0
  10489. * @category Collection
  10490. * @param {Array|Object} collection The collection to iterate over.
  10491. * @param {Array|Function|string} path The path of the method to invoke or
  10492. * the function invoked per iteration.
  10493. * @param {...*} [args] The arguments to invoke each method with.
  10494. * @returns {Array} Returns the array of results.
  10495. * @example
  10496. *
  10497. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  10498. * // => [[1, 5, 7], [1, 2, 3]]
  10499. *
  10500. * _.invokeMap([123, 456], String.prototype.split, '');
  10501. * // => [['1', '2', '3'], ['4', '5', '6']]
  10502. */
  10503. var invokeMap = baseRest(function(collection, path, args) {
  10504. var index = -1,
  10505. isFunc = typeof path == 'function',
  10506. result = isArrayLike(collection) ? Array(collection.length) : [];
  10507. baseEach(collection, function(value) {
  10508. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  10509. });
  10510. return result;
  10511. });
  10512. /**
  10513. * Creates an object composed of keys generated from the results of running
  10514. * each element of `collection` thru `iteratee`. The corresponding value of
  10515. * each key is the last element responsible for generating the key. The
  10516. * iteratee is invoked with one argument: (value).
  10517. *
  10518. * @static
  10519. * @memberOf _
  10520. * @since 4.0.0
  10521. * @category Collection
  10522. * @param {Array|Object} collection The collection to iterate over.
  10523. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  10524. * @returns {Object} Returns the composed aggregate object.
  10525. * @example
  10526. *
  10527. * var array = [
  10528. * { 'dir': 'left', 'code': 97 },
  10529. * { 'dir': 'right', 'code': 100 }
  10530. * ];
  10531. *
  10532. * _.keyBy(array, function(o) {
  10533. * return String.fromCharCode(o.code);
  10534. * });
  10535. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  10536. *
  10537. * _.keyBy(array, 'dir');
  10538. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  10539. */
  10540. var keyBy = createAggregator(function(result, value, key) {
  10541. baseAssignValue(result, key, value);
  10542. });
  10543. /**
  10544. * Creates an array of values by running each element in `collection` thru
  10545. * `iteratee`. The iteratee is invoked with three arguments:
  10546. * (value, index|key, collection).
  10547. *
  10548. * Many lodash methods are guarded to work as iteratees for methods like
  10549. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  10550. *
  10551. * The guarded methods are:
  10552. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  10553. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  10554. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  10555. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  10556. *
  10557. * @static
  10558. * @memberOf _
  10559. * @since 0.1.0
  10560. * @category Collection
  10561. * @param {Array|Object} collection The collection to iterate over.
  10562. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10563. * @returns {Array} Returns the new mapped array.
  10564. * @example
  10565. *
  10566. * function square(n) {
  10567. * return n * n;
  10568. * }
  10569. *
  10570. * _.map([4, 8], square);
  10571. * // => [16, 64]
  10572. *
  10573. * _.map({ 'a': 4, 'b': 8 }, square);
  10574. * // => [16, 64] (iteration order is not guaranteed)
  10575. *
  10576. * var users = [
  10577. * { 'user': 'barney' },
  10578. * { 'user': 'fred' }
  10579. * ];
  10580. *
  10581. * // The `_.property` iteratee shorthand.
  10582. * _.map(users, 'user');
  10583. * // => ['barney', 'fred']
  10584. */
  10585. function map(collection, iteratee) {
  10586. var func = isArray(collection) ? arrayMap : baseMap;
  10587. return func(collection, getIteratee(iteratee, 3));
  10588. }
  10589. /**
  10590. * This method is like `_.sortBy` except that it allows specifying the sort
  10591. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  10592. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  10593. * descending or "asc" for ascending sort order of corresponding values.
  10594. *
  10595. * @static
  10596. * @memberOf _
  10597. * @since 4.0.0
  10598. * @category Collection
  10599. * @param {Array|Object} collection The collection to iterate over.
  10600. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  10601. * The iteratees to sort by.
  10602. * @param {string[]} [orders] The sort orders of `iteratees`.
  10603. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  10604. * @returns {Array} Returns the new sorted array.
  10605. * @example
  10606. *
  10607. * var users = [
  10608. * { 'user': 'fred', 'age': 48 },
  10609. * { 'user': 'barney', 'age': 34 },
  10610. * { 'user': 'fred', 'age': 40 },
  10611. * { 'user': 'barney', 'age': 36 }
  10612. * ];
  10613. *
  10614. * // Sort by `user` in ascending order and by `age` in descending order.
  10615. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  10616. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  10617. */
  10618. function orderBy(collection, iteratees, orders, guard) {
  10619. if (collection == null) {
  10620. return [];
  10621. }
  10622. if (!isArray(iteratees)) {
  10623. iteratees = iteratees == null ? [] : [iteratees];
  10624. }
  10625. orders = guard ? undefined : orders;
  10626. if (!isArray(orders)) {
  10627. orders = orders == null ? [] : [orders];
  10628. }
  10629. return baseOrderBy(collection, iteratees, orders);
  10630. }
  10631. /**
  10632. * Creates an array of elements split into two groups, the first of which
  10633. * contains elements `predicate` returns truthy for, the second of which
  10634. * contains elements `predicate` returns falsey for. The predicate is
  10635. * invoked with one argument: (value).
  10636. *
  10637. * @static
  10638. * @memberOf _
  10639. * @since 3.0.0
  10640. * @category Collection
  10641. * @param {Array|Object} collection The collection to iterate over.
  10642. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  10643. * @returns {Array} Returns the array of grouped elements.
  10644. * @example
  10645. *
  10646. * var users = [
  10647. * { 'user': 'barney', 'age': 36, 'active': false },
  10648. * { 'user': 'fred', 'age': 40, 'active': true },
  10649. * { 'user': 'pebbles', 'age': 1, 'active': false }
  10650. * ];
  10651. *
  10652. * _.partition(users, function(o) { return o.active; });
  10653. * // => objects for [['fred'], ['barney', 'pebbles']]
  10654. *
  10655. * // The `_.matches` iteratee shorthand.
  10656. * _.partition(users, { 'age': 1, 'active': false });
  10657. * // => objects for [['pebbles'], ['barney', 'fred']]
  10658. *
  10659. * // The `_.matchesProperty` iteratee shorthand.
  10660. * _.partition(users, ['active', false]);
  10661. * // => objects for [['barney', 'pebbles'], ['fred']]
  10662. *
  10663. * // The `_.property` iteratee shorthand.
  10664. * _.partition(users, 'active');
  10665. * // => objects for [['fred'], ['barney', 'pebbles']]
  10666. */
  10667. var partition = createAggregator(function(result, value, key) {
  10668. result[key ? 0 : 1].push(value);
  10669. }, function() { return [[], []]; });
  10670. /**
  10671. * Reduces `collection` to a value which is the accumulated result of running
  10672. * each element in `collection` thru `iteratee`, where each successive
  10673. * invocation is supplied the return value of the previous. If `accumulator`
  10674. * is not given, the first element of `collection` is used as the initial
  10675. * value. The iteratee is invoked with four arguments:
  10676. * (accumulator, value, index|key, collection).
  10677. *
  10678. * Many lodash methods are guarded to work as iteratees for methods like
  10679. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  10680. *
  10681. * The guarded methods are:
  10682. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  10683. * and `sortBy`
  10684. *
  10685. * @static
  10686. * @memberOf _
  10687. * @since 0.1.0
  10688. * @category Collection
  10689. * @param {Array|Object} collection The collection to iterate over.
  10690. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10691. * @param {*} [accumulator] The initial value.
  10692. * @returns {*} Returns the accumulated value.
  10693. * @see _.reduceRight
  10694. * @example
  10695. *
  10696. * _.reduce([1, 2], function(sum, n) {
  10697. * return sum + n;
  10698. * }, 0);
  10699. * // => 3
  10700. *
  10701. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  10702. * (result[value] || (result[value] = [])).push(key);
  10703. * return result;
  10704. * }, {});
  10705. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  10706. */
  10707. function reduce(collection, iteratee, accumulator) {
  10708. var func = isArray(collection) ? arrayReduce : baseReduce,
  10709. initAccum = arguments.length < 3;
  10710. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  10711. }
  10712. /**
  10713. * This method is like `_.reduce` except that it iterates over elements of
  10714. * `collection` from right to left.
  10715. *
  10716. * @static
  10717. * @memberOf _
  10718. * @since 0.1.0
  10719. * @category Collection
  10720. * @param {Array|Object} collection The collection to iterate over.
  10721. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10722. * @param {*} [accumulator] The initial value.
  10723. * @returns {*} Returns the accumulated value.
  10724. * @see _.reduce
  10725. * @example
  10726. *
  10727. * var array = [[0, 1], [2, 3], [4, 5]];
  10728. *
  10729. * _.reduceRight(array, function(flattened, other) {
  10730. * return flattened.concat(other);
  10731. * }, []);
  10732. * // => [4, 5, 2, 3, 0, 1]
  10733. */
  10734. function reduceRight(collection, iteratee, accumulator) {
  10735. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  10736. initAccum = arguments.length < 3;
  10737. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  10738. }
  10739. /**
  10740. * The opposite of `_.filter`; this method returns the elements of `collection`
  10741. * that `predicate` does **not** return truthy for.
  10742. *
  10743. * @static
  10744. * @memberOf _
  10745. * @since 0.1.0
  10746. * @category Collection
  10747. * @param {Array|Object} collection The collection to iterate over.
  10748. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  10749. * @returns {Array} Returns the new filtered array.
  10750. * @see _.filter
  10751. * @example
  10752. *
  10753. * var users = [
  10754. * { 'user': 'barney', 'age': 36, 'active': false },
  10755. * { 'user': 'fred', 'age': 40, 'active': true }
  10756. * ];
  10757. *
  10758. * _.reject(users, function(o) { return !o.active; });
  10759. * // => objects for ['fred']
  10760. *
  10761. * // The `_.matches` iteratee shorthand.
  10762. * _.reject(users, { 'age': 40, 'active': true });
  10763. * // => objects for ['barney']
  10764. *
  10765. * // The `_.matchesProperty` iteratee shorthand.
  10766. * _.reject(users, ['active', false]);
  10767. * // => objects for ['fred']
  10768. *
  10769. * // The `_.property` iteratee shorthand.
  10770. * _.reject(users, 'active');
  10771. * // => objects for ['barney']
  10772. */
  10773. function reject(collection, predicate) {
  10774. var func = isArray(collection) ? arrayFilter : baseFilter;
  10775. return func(collection, negate(getIteratee(predicate, 3)));
  10776. }
  10777. /**
  10778. * Gets a random element from `collection`.
  10779. *
  10780. * @static
  10781. * @memberOf _
  10782. * @since 2.0.0
  10783. * @category Collection
  10784. * @param {Array|Object} collection The collection to sample.
  10785. * @returns {*} Returns the random element.
  10786. * @example
  10787. *
  10788. * _.sample([1, 2, 3, 4]);
  10789. * // => 2
  10790. */
  10791. function sample(collection) {
  10792. var func = isArray(collection) ? arraySample : baseSample;
  10793. return func(collection);
  10794. }
  10795. /**
  10796. * Gets `n` random elements at unique keys from `collection` up to the
  10797. * size of `collection`.
  10798. *
  10799. * @static
  10800. * @memberOf _
  10801. * @since 4.0.0
  10802. * @category Collection
  10803. * @param {Array|Object} collection The collection to sample.
  10804. * @param {number} [n=1] The number of elements to sample.
  10805. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10806. * @returns {Array} Returns the random elements.
  10807. * @example
  10808. *
  10809. * _.sampleSize([1, 2, 3], 2);
  10810. * // => [3, 1]
  10811. *
  10812. * _.sampleSize([1, 2, 3], 4);
  10813. * // => [2, 3, 1]
  10814. */
  10815. function sampleSize(collection, n, guard) {
  10816. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  10817. n = 1;
  10818. } else {
  10819. n = toInteger(n);
  10820. }
  10821. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  10822. return func(collection, n);
  10823. }
  10824. /**
  10825. * Creates an array of shuffled values, using a version of the
  10826. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  10827. *
  10828. * @static
  10829. * @memberOf _
  10830. * @since 0.1.0
  10831. * @category Collection
  10832. * @param {Array|Object} collection The collection to shuffle.
  10833. * @returns {Array} Returns the new shuffled array.
  10834. * @example
  10835. *
  10836. * _.shuffle([1, 2, 3, 4]);
  10837. * // => [4, 1, 3, 2]
  10838. */
  10839. function shuffle(collection) {
  10840. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  10841. return func(collection);
  10842. }
  10843. /**
  10844. * Gets the size of `collection` by returning its length for array-like
  10845. * values or the number of own enumerable string keyed properties for objects.
  10846. *
  10847. * @static
  10848. * @memberOf _
  10849. * @since 0.1.0
  10850. * @category Collection
  10851. * @param {Array|Object|string} collection The collection to inspect.
  10852. * @returns {number} Returns the collection size.
  10853. * @example
  10854. *
  10855. * _.size([1, 2, 3]);
  10856. * // => 3
  10857. *
  10858. * _.size({ 'a': 1, 'b': 2 });
  10859. * // => 2
  10860. *
  10861. * _.size('pebbles');
  10862. * // => 7
  10863. */
  10864. function size(collection) {
  10865. if (collection == null) {
  10866. return 0;
  10867. }
  10868. if (isArrayLike(collection)) {
  10869. return isString(collection) ? stringSize(collection) : collection.length;
  10870. }
  10871. var tag = getTag(collection);
  10872. if (tag == mapTag || tag == setTag) {
  10873. return collection.size;
  10874. }
  10875. return baseKeys(collection).length;
  10876. }
  10877. /**
  10878. * Checks if `predicate` returns truthy for **any** element of `collection`.
  10879. * Iteration is stopped once `predicate` returns truthy. The predicate is
  10880. * invoked with three arguments: (value, index|key, collection).
  10881. *
  10882. * @static
  10883. * @memberOf _
  10884. * @since 0.1.0
  10885. * @category Collection
  10886. * @param {Array|Object} collection The collection to iterate over.
  10887. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  10888. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10889. * @returns {boolean} Returns `true` if any element passes the predicate check,
  10890. * else `false`.
  10891. * @example
  10892. *
  10893. * _.some([null, 0, 'yes', false], Boolean);
  10894. * // => true
  10895. *
  10896. * var users = [
  10897. * { 'user': 'barney', 'active': true },
  10898. * { 'user': 'fred', 'active': false }
  10899. * ];
  10900. *
  10901. * // The `_.matches` iteratee shorthand.
  10902. * _.some(users, { 'user': 'barney', 'active': false });
  10903. * // => false
  10904. *
  10905. * // The `_.matchesProperty` iteratee shorthand.
  10906. * _.some(users, ['active', false]);
  10907. * // => true
  10908. *
  10909. * // The `_.property` iteratee shorthand.
  10910. * _.some(users, 'active');
  10911. * // => true
  10912. */
  10913. function some(collection, predicate, guard) {
  10914. var func = isArray(collection) ? arraySome : baseSome;
  10915. if (guard && isIterateeCall(collection, predicate, guard)) {
  10916. predicate = undefined;
  10917. }
  10918. return func(collection, getIteratee(predicate, 3));
  10919. }
  10920. /**
  10921. * Creates an array of elements, sorted in ascending order by the results of
  10922. * running each element in a collection thru each iteratee. This method
  10923. * performs a stable sort, that is, it preserves the original sort order of
  10924. * equal elements. The iteratees are invoked with one argument: (value).
  10925. *
  10926. * @static
  10927. * @memberOf _
  10928. * @since 0.1.0
  10929. * @category Collection
  10930. * @param {Array|Object} collection The collection to iterate over.
  10931. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  10932. * The iteratees to sort by.
  10933. * @returns {Array} Returns the new sorted array.
  10934. * @example
  10935. *
  10936. * var users = [
  10937. * { 'user': 'fred', 'age': 48 },
  10938. * { 'user': 'barney', 'age': 36 },
  10939. * { 'user': 'fred', 'age': 30 },
  10940. * { 'user': 'barney', 'age': 34 }
  10941. * ];
  10942. *
  10943. * _.sortBy(users, [function(o) { return o.user; }]);
  10944. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
  10945. *
  10946. * _.sortBy(users, ['user', 'age']);
  10947. * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
  10948. */
  10949. var sortBy = baseRest(function(collection, iteratees) {
  10950. if (collection == null) {
  10951. return [];
  10952. }
  10953. var length = iteratees.length;
  10954. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  10955. iteratees = [];
  10956. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  10957. iteratees = [iteratees[0]];
  10958. }
  10959. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  10960. });
  10961. /*------------------------------------------------------------------------*/
  10962. /**
  10963. * Gets the timestamp of the number of milliseconds that have elapsed since
  10964. * the Unix epoch (1 January 1970 00:00:00 UTC).
  10965. *
  10966. * @static
  10967. * @memberOf _
  10968. * @since 2.4.0
  10969. * @category Date
  10970. * @returns {number} Returns the timestamp.
  10971. * @example
  10972. *
  10973. * _.defer(function(stamp) {
  10974. * console.log(_.now() - stamp);
  10975. * }, _.now());
  10976. * // => Logs the number of milliseconds it took for the deferred invocation.
  10977. */
  10978. var now = ctxNow || function() {
  10979. return root.Date.now();
  10980. };
  10981. /*------------------------------------------------------------------------*/
  10982. /**
  10983. * The opposite of `_.before`; this method creates a function that invokes
  10984. * `func` once it's called `n` or more times.
  10985. *
  10986. * @static
  10987. * @memberOf _
  10988. * @since 0.1.0
  10989. * @category Function
  10990. * @param {number} n The number of calls before `func` is invoked.
  10991. * @param {Function} func The function to restrict.
  10992. * @returns {Function} Returns the new restricted function.
  10993. * @example
  10994. *
  10995. * var saves = ['profile', 'settings'];
  10996. *
  10997. * var done = _.after(saves.length, function() {
  10998. * console.log('done saving!');
  10999. * });
  11000. *
  11001. * _.forEach(saves, function(type) {
  11002. * asyncSave({ 'type': type, 'complete': done });
  11003. * });
  11004. * // => Logs 'done saving!' after the two async saves have completed.
  11005. */
  11006. function after(n, func) {
  11007. if (typeof func != 'function') {
  11008. throw new TypeError(FUNC_ERROR_TEXT);
  11009. }
  11010. n = toInteger(n);
  11011. return function() {
  11012. if (--n < 1) {
  11013. return func.apply(this, arguments);
  11014. }
  11015. };
  11016. }
  11017. /**
  11018. * Creates a function that invokes `func`, with up to `n` arguments,
  11019. * ignoring any additional arguments.
  11020. *
  11021. * @static
  11022. * @memberOf _
  11023. * @since 3.0.0
  11024. * @category Function
  11025. * @param {Function} func The function to cap arguments for.
  11026. * @param {number} [n=func.length] The arity cap.
  11027. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  11028. * @returns {Function} Returns the new capped function.
  11029. * @example
  11030. *
  11031. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  11032. * // => [6, 8, 10]
  11033. */
  11034. function ary(func, n, guard) {
  11035. n = guard ? undefined : n;
  11036. n = (func && n == null) ? func.length : n;
  11037. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  11038. }
  11039. /**
  11040. * Creates a function that invokes `func`, with the `this` binding and arguments
  11041. * of the created function, while it's called less than `n` times. Subsequent
  11042. * calls to the created function return the result of the last `func` invocation.
  11043. *
  11044. * @static
  11045. * @memberOf _
  11046. * @since 3.0.0
  11047. * @category Function
  11048. * @param {number} n The number of calls at which `func` is no longer invoked.
  11049. * @param {Function} func The function to restrict.
  11050. * @returns {Function} Returns the new restricted function.
  11051. * @example
  11052. *
  11053. * jQuery(element).on('click', _.before(5, addContactToList));
  11054. * // => Allows adding up to 4 contacts to the list.
  11055. */
  11056. function before(n, func) {
  11057. var result;
  11058. if (typeof func != 'function') {
  11059. throw new TypeError(FUNC_ERROR_TEXT);
  11060. }
  11061. n = toInteger(n);
  11062. return function() {
  11063. if (--n > 0) {
  11064. result = func.apply(this, arguments);
  11065. }
  11066. if (n <= 1) {
  11067. func = undefined;
  11068. }
  11069. return result;
  11070. };
  11071. }
  11072. /**
  11073. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  11074. * and `partials` prepended to the arguments it receives.
  11075. *
  11076. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  11077. * may be used as a placeholder for partially applied arguments.
  11078. *
  11079. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  11080. * property of bound functions.
  11081. *
  11082. * @static
  11083. * @memberOf _
  11084. * @since 0.1.0
  11085. * @category Function
  11086. * @param {Function} func The function to bind.
  11087. * @param {*} thisArg The `this` binding of `func`.
  11088. * @param {...*} [partials] The arguments to be partially applied.
  11089. * @returns {Function} Returns the new bound function.
  11090. * @example
  11091. *
  11092. * function greet(greeting, punctuation) {
  11093. * return greeting + ' ' + this.user + punctuation;
  11094. * }
  11095. *
  11096. * var object = { 'user': 'fred' };
  11097. *
  11098. * var bound = _.bind(greet, object, 'hi');
  11099. * bound('!');
  11100. * // => 'hi fred!'
  11101. *
  11102. * // Bound with placeholders.
  11103. * var bound = _.bind(greet, object, _, '!');
  11104. * bound('hi');
  11105. * // => 'hi fred!'
  11106. */
  11107. var bind = baseRest(function(func, thisArg, partials) {
  11108. var bitmask = WRAP_BIND_FLAG;
  11109. if (partials.length) {
  11110. var holders = replaceHolders(partials, getHolder(bind));
  11111. bitmask |= WRAP_PARTIAL_FLAG;
  11112. }
  11113. return createWrap(func, bitmask, thisArg, partials, holders);
  11114. });
  11115. /**
  11116. * Creates a function that invokes the method at `object[key]` with `partials`
  11117. * prepended to the arguments it receives.
  11118. *
  11119. * This method differs from `_.bind` by allowing bound functions to reference
  11120. * methods that may be redefined or don't yet exist. See
  11121. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  11122. * for more details.
  11123. *
  11124. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  11125. * builds, may be used as a placeholder for partially applied arguments.
  11126. *
  11127. * @static
  11128. * @memberOf _
  11129. * @since 0.10.0
  11130. * @category Function
  11131. * @param {Object} object The object to invoke the method on.
  11132. * @param {string} key The key of the method.
  11133. * @param {...*} [partials] The arguments to be partially applied.
  11134. * @returns {Function} Returns the new bound function.
  11135. * @example
  11136. *
  11137. * var object = {
  11138. * 'user': 'fred',
  11139. * 'greet': function(greeting, punctuation) {
  11140. * return greeting + ' ' + this.user + punctuation;
  11141. * }
  11142. * };
  11143. *
  11144. * var bound = _.bindKey(object, 'greet', 'hi');
  11145. * bound('!');
  11146. * // => 'hi fred!'
  11147. *
  11148. * object.greet = function(greeting, punctuation) {
  11149. * return greeting + 'ya ' + this.user + punctuation;
  11150. * };
  11151. *
  11152. * bound('!');
  11153. * // => 'hiya fred!'
  11154. *
  11155. * // Bound with placeholders.
  11156. * var bound = _.bindKey(object, 'greet', _, '!');
  11157. * bound('hi');
  11158. * // => 'hiya fred!'
  11159. */
  11160. var bindKey = baseRest(function(object, key, partials) {
  11161. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  11162. if (partials.length) {
  11163. var holders = replaceHolders(partials, getHolder(bindKey));
  11164. bitmask |= WRAP_PARTIAL_FLAG;
  11165. }
  11166. return createWrap(key, bitmask, object, partials, holders);
  11167. });
  11168. /**
  11169. * Creates a function that accepts arguments of `func` and either invokes
  11170. * `func` returning its result, if at least `arity` number of arguments have
  11171. * been provided, or returns a function that accepts the remaining `func`
  11172. * arguments, and so on. The arity of `func` may be specified if `func.length`
  11173. * is not sufficient.
  11174. *
  11175. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  11176. * may be used as a placeholder for provided arguments.
  11177. *
  11178. * **Note:** This method doesn't set the "length" property of curried functions.
  11179. *
  11180. * @static
  11181. * @memberOf _
  11182. * @since 2.0.0
  11183. * @category Function
  11184. * @param {Function} func The function to curry.
  11185. * @param {number} [arity=func.length] The arity of `func`.
  11186. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  11187. * @returns {Function} Returns the new curried function.
  11188. * @example
  11189. *
  11190. * var abc = function(a, b, c) {
  11191. * return [a, b, c];
  11192. * };
  11193. *
  11194. * var curried = _.curry(abc);
  11195. *
  11196. * curried(1)(2)(3);
  11197. * // => [1, 2, 3]
  11198. *
  11199. * curried(1, 2)(3);
  11200. * // => [1, 2, 3]
  11201. *
  11202. * curried(1, 2, 3);
  11203. * // => [1, 2, 3]
  11204. *
  11205. * // Curried with placeholders.
  11206. * curried(1)(_, 3)(2);
  11207. * // => [1, 2, 3]
  11208. */
  11209. function curry(func, arity, guard) {
  11210. arity = guard ? undefined : arity;
  11211. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  11212. result.placeholder = curry.placeholder;
  11213. return result;
  11214. }
  11215. /**
  11216. * This method is like `_.curry` except that arguments are applied to `func`
  11217. * in the manner of `_.partialRight` instead of `_.partial`.
  11218. *
  11219. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  11220. * builds, may be used as a placeholder for provided arguments.
  11221. *
  11222. * **Note:** This method doesn't set the "length" property of curried functions.
  11223. *
  11224. * @static
  11225. * @memberOf _
  11226. * @since 3.0.0
  11227. * @category Function
  11228. * @param {Function} func The function to curry.
  11229. * @param {number} [arity=func.length] The arity of `func`.
  11230. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  11231. * @returns {Function} Returns the new curried function.
  11232. * @example
  11233. *
  11234. * var abc = function(a, b, c) {
  11235. * return [a, b, c];
  11236. * };
  11237. *
  11238. * var curried = _.curryRight(abc);
  11239. *
  11240. * curried(3)(2)(1);
  11241. * // => [1, 2, 3]
  11242. *
  11243. * curried(2, 3)(1);
  11244. * // => [1, 2, 3]
  11245. *
  11246. * curried(1, 2, 3);
  11247. * // => [1, 2, 3]
  11248. *
  11249. * // Curried with placeholders.
  11250. * curried(3)(1, _)(2);
  11251. * // => [1, 2, 3]
  11252. */
  11253. function curryRight(func, arity, guard) {
  11254. arity = guard ? undefined : arity;
  11255. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  11256. result.placeholder = curryRight.placeholder;
  11257. return result;
  11258. }
  11259. /**
  11260. * Creates a debounced function that delays invoking `func` until after `wait`
  11261. * milliseconds have elapsed since the last time the debounced function was
  11262. * invoked. The debounced function comes with a `cancel` method to cancel
  11263. * delayed `func` invocations and a `flush` method to immediately invoke them.
  11264. * Provide `options` to indicate whether `func` should be invoked on the
  11265. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  11266. * with the last arguments provided to the debounced function. Subsequent
  11267. * calls to the debounced function return the result of the last `func`
  11268. * invocation.
  11269. *
  11270. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  11271. * invoked on the trailing edge of the timeout only if the debounced function
  11272. * is invoked more than once during the `wait` timeout.
  11273. *
  11274. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  11275. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  11276. *
  11277. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  11278. * for details over the differences between `_.debounce` and `_.throttle`.
  11279. *
  11280. * @static
  11281. * @memberOf _
  11282. * @since 0.1.0
  11283. * @category Function
  11284. * @param {Function} func The function to debounce.
  11285. * @param {number} [wait=0] The number of milliseconds to delay.
  11286. * @param {Object} [options={}] The options object.
  11287. * @param {boolean} [options.leading=false]
  11288. * Specify invoking on the leading edge of the timeout.
  11289. * @param {number} [options.maxWait]
  11290. * The maximum time `func` is allowed to be delayed before it's invoked.
  11291. * @param {boolean} [options.trailing=true]
  11292. * Specify invoking on the trailing edge of the timeout.
  11293. * @returns {Function} Returns the new debounced function.
  11294. * @example
  11295. *
  11296. * // Avoid costly calculations while the window size is in flux.
  11297. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  11298. *
  11299. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  11300. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  11301. * 'leading': true,
  11302. * 'trailing': false
  11303. * }));
  11304. *
  11305. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  11306. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  11307. * var source = new EventSource('/stream');
  11308. * jQuery(source).on('message', debounced);
  11309. *
  11310. * // Cancel the trailing debounced invocation.
  11311. * jQuery(window).on('popstate', debounced.cancel);
  11312. */
  11313. function debounce(func, wait, options) {
  11314. var lastArgs,
  11315. lastThis,
  11316. maxWait,
  11317. result,
  11318. timerId,
  11319. lastCallTime,
  11320. lastInvokeTime = 0,
  11321. leading = false,
  11322. maxing = false,
  11323. trailing = true;
  11324. if (typeof func != 'function') {
  11325. throw new TypeError(FUNC_ERROR_TEXT);
  11326. }
  11327. wait = toNumber(wait) || 0;
  11328. if (isObject(options)) {
  11329. leading = !!options.leading;
  11330. maxing = 'maxWait' in options;
  11331. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  11332. trailing = 'trailing' in options ? !!options.trailing : trailing;
  11333. }
  11334. function invokeFunc(time) {
  11335. var args = lastArgs,
  11336. thisArg = lastThis;
  11337. lastArgs = lastThis = undefined;
  11338. lastInvokeTime = time;
  11339. result = func.apply(thisArg, args);
  11340. return result;
  11341. }
  11342. function leadingEdge(time) {
  11343. // Reset any `maxWait` timer.
  11344. lastInvokeTime = time;
  11345. // Start the timer for the trailing edge.
  11346. timerId = setTimeout(timerExpired, wait);
  11347. // Invoke the leading edge.
  11348. return leading ? invokeFunc(time) : result;
  11349. }
  11350. function remainingWait(time) {
  11351. var timeSinceLastCall = time - lastCallTime,
  11352. timeSinceLastInvoke = time - lastInvokeTime,
  11353. timeWaiting = wait - timeSinceLastCall;
  11354. return maxing
  11355. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  11356. : timeWaiting;
  11357. }
  11358. function shouldInvoke(time) {
  11359. var timeSinceLastCall = time - lastCallTime,
  11360. timeSinceLastInvoke = time - lastInvokeTime;
  11361. // Either this is the first call, activity has stopped and we're at the
  11362. // trailing edge, the system time has gone backwards and we're treating
  11363. // it as the trailing edge, or we've hit the `maxWait` limit.
  11364. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  11365. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  11366. }
  11367. function timerExpired() {
  11368. var time = now();
  11369. if (shouldInvoke(time)) {
  11370. return trailingEdge(time);
  11371. }
  11372. // Restart the timer.
  11373. timerId = setTimeout(timerExpired, remainingWait(time));
  11374. }
  11375. function trailingEdge(time) {
  11376. timerId = undefined;
  11377. // Only invoke if we have `lastArgs` which means `func` has been
  11378. // debounced at least once.
  11379. if (trailing && lastArgs) {
  11380. return invokeFunc(time);
  11381. }
  11382. lastArgs = lastThis = undefined;
  11383. return result;
  11384. }
  11385. function cancel() {
  11386. if (timerId !== undefined) {
  11387. clearTimeout(timerId);
  11388. }
  11389. lastInvokeTime = 0;
  11390. lastArgs = lastCallTime = lastThis = timerId = undefined;
  11391. }
  11392. function flush() {
  11393. return timerId === undefined ? result : trailingEdge(now());
  11394. }
  11395. function debounced() {
  11396. var time = now(),
  11397. isInvoking = shouldInvoke(time);
  11398. lastArgs = arguments;
  11399. lastThis = this;
  11400. lastCallTime = time;
  11401. if (isInvoking) {
  11402. if (timerId === undefined) {
  11403. return leadingEdge(lastCallTime);
  11404. }
  11405. if (maxing) {
  11406. // Handle invocations in a tight loop.
  11407. clearTimeout(timerId);
  11408. timerId = setTimeout(timerExpired, wait);
  11409. return invokeFunc(lastCallTime);
  11410. }
  11411. }
  11412. if (timerId === undefined) {
  11413. timerId = setTimeout(timerExpired, wait);
  11414. }
  11415. return result;
  11416. }
  11417. debounced.cancel = cancel;
  11418. debounced.flush = flush;
  11419. return debounced;
  11420. }
  11421. /**
  11422. * Defers invoking the `func` until the current call stack has cleared. Any
  11423. * additional arguments are provided to `func` when it's invoked.
  11424. *
  11425. * @static
  11426. * @memberOf _
  11427. * @since 0.1.0
  11428. * @category Function
  11429. * @param {Function} func The function to defer.
  11430. * @param {...*} [args] The arguments to invoke `func` with.
  11431. * @returns {number} Returns the timer id.
  11432. * @example
  11433. *
  11434. * _.defer(function(text) {
  11435. * console.log(text);
  11436. * }, 'deferred');
  11437. * // => Logs 'deferred' after one millisecond.
  11438. */
  11439. var defer = baseRest(function(func, args) {
  11440. return baseDelay(func, 1, args);
  11441. });
  11442. /**
  11443. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  11444. * provided to `func` when it's invoked.
  11445. *
  11446. * @static
  11447. * @memberOf _
  11448. * @since 0.1.0
  11449. * @category Function
  11450. * @param {Function} func The function to delay.
  11451. * @param {number} wait The number of milliseconds to delay invocation.
  11452. * @param {...*} [args] The arguments to invoke `func` with.
  11453. * @returns {number} Returns the timer id.
  11454. * @example
  11455. *
  11456. * _.delay(function(text) {
  11457. * console.log(text);
  11458. * }, 1000, 'later');
  11459. * // => Logs 'later' after one second.
  11460. */
  11461. var delay = baseRest(function(func, wait, args) {
  11462. return baseDelay(func, toNumber(wait) || 0, args);
  11463. });
  11464. /**
  11465. * Creates a function that invokes `func` with arguments reversed.
  11466. *
  11467. * @static
  11468. * @memberOf _
  11469. * @since 4.0.0
  11470. * @category Function
  11471. * @param {Function} func The function to flip arguments for.
  11472. * @returns {Function} Returns the new flipped function.
  11473. * @example
  11474. *
  11475. * var flipped = _.flip(function() {
  11476. * return _.toArray(arguments);
  11477. * });
  11478. *
  11479. * flipped('a', 'b', 'c', 'd');
  11480. * // => ['d', 'c', 'b', 'a']
  11481. */
  11482. function flip(func) {
  11483. return createWrap(func, WRAP_FLIP_FLAG);
  11484. }
  11485. /**
  11486. * Creates a function that memoizes the result of `func`. If `resolver` is
  11487. * provided, it determines the cache key for storing the result based on the
  11488. * arguments provided to the memoized function. By default, the first argument
  11489. * provided to the memoized function is used as the map cache key. The `func`
  11490. * is invoked with the `this` binding of the memoized function.
  11491. *
  11492. * **Note:** The cache is exposed as the `cache` property on the memoized
  11493. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  11494. * constructor with one whose instances implement the
  11495. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  11496. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  11497. *
  11498. * @static
  11499. * @memberOf _
  11500. * @since 0.1.0
  11501. * @category Function
  11502. * @param {Function} func The function to have its output memoized.
  11503. * @param {Function} [resolver] The function to resolve the cache key.
  11504. * @returns {Function} Returns the new memoized function.
  11505. * @example
  11506. *
  11507. * var object = { 'a': 1, 'b': 2 };
  11508. * var other = { 'c': 3, 'd': 4 };
  11509. *
  11510. * var values = _.memoize(_.values);
  11511. * values(object);
  11512. * // => [1, 2]
  11513. *
  11514. * values(other);
  11515. * // => [3, 4]
  11516. *
  11517. * object.a = 2;
  11518. * values(object);
  11519. * // => [1, 2]
  11520. *
  11521. * // Modify the result cache.
  11522. * values.cache.set(object, ['a', 'b']);
  11523. * values(object);
  11524. * // => ['a', 'b']
  11525. *
  11526. * // Replace `_.memoize.Cache`.
  11527. * _.memoize.Cache = WeakMap;
  11528. */
  11529. function memoize(func, resolver) {
  11530. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  11531. throw new TypeError(FUNC_ERROR_TEXT);
  11532. }
  11533. var memoized = function() {
  11534. var args = arguments,
  11535. key = resolver ? resolver.apply(this, args) : args[0],
  11536. cache = memoized.cache;
  11537. if (cache.has(key)) {
  11538. return cache.get(key);
  11539. }
  11540. var result = func.apply(this, args);
  11541. memoized.cache = cache.set(key, result) || cache;
  11542. return result;
  11543. };
  11544. memoized.cache = new (memoize.Cache || MapCache);
  11545. return memoized;
  11546. }
  11547. // Expose `MapCache`.
  11548. memoize.Cache = MapCache;
  11549. /**
  11550. * Creates a function that negates the result of the predicate `func`. The
  11551. * `func` predicate is invoked with the `this` binding and arguments of the
  11552. * created function.
  11553. *
  11554. * @static
  11555. * @memberOf _
  11556. * @since 3.0.0
  11557. * @category Function
  11558. * @param {Function} predicate The predicate to negate.
  11559. * @returns {Function} Returns the new negated function.
  11560. * @example
  11561. *
  11562. * function isEven(n) {
  11563. * return n % 2 == 0;
  11564. * }
  11565. *
  11566. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  11567. * // => [1, 3, 5]
  11568. */
  11569. function negate(predicate) {
  11570. if (typeof predicate != 'function') {
  11571. throw new TypeError(FUNC_ERROR_TEXT);
  11572. }
  11573. return function() {
  11574. var args = arguments;
  11575. switch (args.length) {
  11576. case 0: return !predicate.call(this);
  11577. case 1: return !predicate.call(this, args[0]);
  11578. case 2: return !predicate.call(this, args[0], args[1]);
  11579. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  11580. }
  11581. return !predicate.apply(this, args);
  11582. };
  11583. }
  11584. /**
  11585. * Creates a function that is restricted to invoking `func` once. Repeat calls
  11586. * to the function return the value of the first invocation. The `func` is
  11587. * invoked with the `this` binding and arguments of the created function.
  11588. *
  11589. * @static
  11590. * @memberOf _
  11591. * @since 0.1.0
  11592. * @category Function
  11593. * @param {Function} func The function to restrict.
  11594. * @returns {Function} Returns the new restricted function.
  11595. * @example
  11596. *
  11597. * var initialize = _.once(createApplication);
  11598. * initialize();
  11599. * initialize();
  11600. * // => `createApplication` is invoked once
  11601. */
  11602. function once(func) {
  11603. return before(2, func);
  11604. }
  11605. /**
  11606. * Creates a function that invokes `func` with its arguments transformed.
  11607. *
  11608. * @static
  11609. * @since 4.0.0
  11610. * @memberOf _
  11611. * @category Function
  11612. * @param {Function} func The function to wrap.
  11613. * @param {...(Function|Function[])} [transforms=[_.identity]]
  11614. * The argument transforms.
  11615. * @returns {Function} Returns the new function.
  11616. * @example
  11617. *
  11618. * function doubled(n) {
  11619. * return n * 2;
  11620. * }
  11621. *
  11622. * function square(n) {
  11623. * return n * n;
  11624. * }
  11625. *
  11626. * var func = _.overArgs(function(x, y) {
  11627. * return [x, y];
  11628. * }, [square, doubled]);
  11629. *
  11630. * func(9, 3);
  11631. * // => [81, 6]
  11632. *
  11633. * func(10, 5);
  11634. * // => [100, 10]
  11635. */
  11636. var overArgs = castRest(function(func, transforms) {
  11637. transforms = (transforms.length == 1 && isArray(transforms[0]))
  11638. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  11639. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  11640. var funcsLength = transforms.length;
  11641. return baseRest(function(args) {
  11642. var index = -1,
  11643. length = nativeMin(args.length, funcsLength);
  11644. while (++index < length) {
  11645. args[index] = transforms[index].call(this, args[index]);
  11646. }
  11647. return apply(func, this, args);
  11648. });
  11649. });
  11650. /**
  11651. * Creates a function that invokes `func` with `partials` prepended to the
  11652. * arguments it receives. This method is like `_.bind` except it does **not**
  11653. * alter the `this` binding.
  11654. *
  11655. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  11656. * builds, may be used as a placeholder for partially applied arguments.
  11657. *
  11658. * **Note:** This method doesn't set the "length" property of partially
  11659. * applied functions.
  11660. *
  11661. * @static
  11662. * @memberOf _
  11663. * @since 0.2.0
  11664. * @category Function
  11665. * @param {Function} func The function to partially apply arguments to.
  11666. * @param {...*} [partials] The arguments to be partially applied.
  11667. * @returns {Function} Returns the new partially applied function.
  11668. * @example
  11669. *
  11670. * function greet(greeting, name) {
  11671. * return greeting + ' ' + name;
  11672. * }
  11673. *
  11674. * var sayHelloTo = _.partial(greet, 'hello');
  11675. * sayHelloTo('fred');
  11676. * // => 'hello fred'
  11677. *
  11678. * // Partially applied with placeholders.
  11679. * var greetFred = _.partial(greet, _, 'fred');
  11680. * greetFred('hi');
  11681. * // => 'hi fred'
  11682. */
  11683. var partial = baseRest(function(func, partials) {
  11684. var holders = replaceHolders(partials, getHolder(partial));
  11685. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  11686. });
  11687. /**
  11688. * This method is like `_.partial` except that partially applied arguments
  11689. * are appended to the arguments it receives.
  11690. *
  11691. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  11692. * builds, may be used as a placeholder for partially applied arguments.
  11693. *
  11694. * **Note:** This method doesn't set the "length" property of partially
  11695. * applied functions.
  11696. *
  11697. * @static
  11698. * @memberOf _
  11699. * @since 1.0.0
  11700. * @category Function
  11701. * @param {Function} func The function to partially apply arguments to.
  11702. * @param {...*} [partials] The arguments to be partially applied.
  11703. * @returns {Function} Returns the new partially applied function.
  11704. * @example
  11705. *
  11706. * function greet(greeting, name) {
  11707. * return greeting + ' ' + name;
  11708. * }
  11709. *
  11710. * var greetFred = _.partialRight(greet, 'fred');
  11711. * greetFred('hi');
  11712. * // => 'hi fred'
  11713. *
  11714. * // Partially applied with placeholders.
  11715. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  11716. * sayHelloTo('fred');
  11717. * // => 'hello fred'
  11718. */
  11719. var partialRight = baseRest(function(func, partials) {
  11720. var holders = replaceHolders(partials, getHolder(partialRight));
  11721. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  11722. });
  11723. /**
  11724. * Creates a function that invokes `func` with arguments arranged according
  11725. * to the specified `indexes` where the argument value at the first index is
  11726. * provided as the first argument, the argument value at the second index is
  11727. * provided as the second argument, and so on.
  11728. *
  11729. * @static
  11730. * @memberOf _
  11731. * @since 3.0.0
  11732. * @category Function
  11733. * @param {Function} func The function to rearrange arguments for.
  11734. * @param {...(number|number[])} indexes The arranged argument indexes.
  11735. * @returns {Function} Returns the new function.
  11736. * @example
  11737. *
  11738. * var rearged = _.rearg(function(a, b, c) {
  11739. * return [a, b, c];
  11740. * }, [2, 0, 1]);
  11741. *
  11742. * rearged('b', 'c', 'a')
  11743. * // => ['a', 'b', 'c']
  11744. */
  11745. var rearg = flatRest(function(func, indexes) {
  11746. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  11747. });
  11748. /**
  11749. * Creates a function that invokes `func` with the `this` binding of the
  11750. * created function and arguments from `start` and beyond provided as
  11751. * an array.
  11752. *
  11753. * **Note:** This method is based on the
  11754. * [rest parameter](https://mdn.io/rest_parameters).
  11755. *
  11756. * @static
  11757. * @memberOf _
  11758. * @since 4.0.0
  11759. * @category Function
  11760. * @param {Function} func The function to apply a rest parameter to.
  11761. * @param {number} [start=func.length-1] The start position of the rest parameter.
  11762. * @returns {Function} Returns the new function.
  11763. * @example
  11764. *
  11765. * var say = _.rest(function(what, names) {
  11766. * return what + ' ' + _.initial(names).join(', ') +
  11767. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  11768. * });
  11769. *
  11770. * say('hello', 'fred', 'barney', 'pebbles');
  11771. * // => 'hello fred, barney, & pebbles'
  11772. */
  11773. function rest(func, start) {
  11774. if (typeof func != 'function') {
  11775. throw new TypeError(FUNC_ERROR_TEXT);
  11776. }
  11777. start = start === undefined ? start : toInteger(start);
  11778. return baseRest(func, start);
  11779. }
  11780. /**
  11781. * Creates a function that invokes `func` with the `this` binding of the
  11782. * create function and an array of arguments much like
  11783. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  11784. *
  11785. * **Note:** This method is based on the
  11786. * [spread operator](https://mdn.io/spread_operator).
  11787. *
  11788. * @static
  11789. * @memberOf _
  11790. * @since 3.2.0
  11791. * @category Function
  11792. * @param {Function} func The function to spread arguments over.
  11793. * @param {number} [start=0] The start position of the spread.
  11794. * @returns {Function} Returns the new function.
  11795. * @example
  11796. *
  11797. * var say = _.spread(function(who, what) {
  11798. * return who + ' says ' + what;
  11799. * });
  11800. *
  11801. * say(['fred', 'hello']);
  11802. * // => 'fred says hello'
  11803. *
  11804. * var numbers = Promise.all([
  11805. * Promise.resolve(40),
  11806. * Promise.resolve(36)
  11807. * ]);
  11808. *
  11809. * numbers.then(_.spread(function(x, y) {
  11810. * return x + y;
  11811. * }));
  11812. * // => a Promise of 76
  11813. */
  11814. function spread(func, start) {
  11815. if (typeof func != 'function') {
  11816. throw new TypeError(FUNC_ERROR_TEXT);
  11817. }
  11818. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  11819. return baseRest(function(args) {
  11820. var array = args[start],
  11821. otherArgs = castSlice(args, 0, start);
  11822. if (array) {
  11823. arrayPush(otherArgs, array);
  11824. }
  11825. return apply(func, this, otherArgs);
  11826. });
  11827. }
  11828. /**
  11829. * Creates a throttled function that only invokes `func` at most once per
  11830. * every `wait` milliseconds. The throttled function comes with a `cancel`
  11831. * method to cancel delayed `func` invocations and a `flush` method to
  11832. * immediately invoke them. Provide `options` to indicate whether `func`
  11833. * should be invoked on the leading and/or trailing edge of the `wait`
  11834. * timeout. The `func` is invoked with the last arguments provided to the
  11835. * throttled function. Subsequent calls to the throttled function return the
  11836. * result of the last `func` invocation.
  11837. *
  11838. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  11839. * invoked on the trailing edge of the timeout only if the throttled function
  11840. * is invoked more than once during the `wait` timeout.
  11841. *
  11842. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  11843. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  11844. *
  11845. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  11846. * for details over the differences between `_.throttle` and `_.debounce`.
  11847. *
  11848. * @static
  11849. * @memberOf _
  11850. * @since 0.1.0
  11851. * @category Function
  11852. * @param {Function} func The function to throttle.
  11853. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  11854. * @param {Object} [options={}] The options object.
  11855. * @param {boolean} [options.leading=true]
  11856. * Specify invoking on the leading edge of the timeout.
  11857. * @param {boolean} [options.trailing=true]
  11858. * Specify invoking on the trailing edge of the timeout.
  11859. * @returns {Function} Returns the new throttled function.
  11860. * @example
  11861. *
  11862. * // Avoid excessively updating the position while scrolling.
  11863. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  11864. *
  11865. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  11866. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  11867. * jQuery(element).on('click', throttled);
  11868. *
  11869. * // Cancel the trailing throttled invocation.
  11870. * jQuery(window).on('popstate', throttled.cancel);
  11871. */
  11872. function throttle(func, wait, options) {
  11873. var leading = true,
  11874. trailing = true;
  11875. if (typeof func != 'function') {
  11876. throw new TypeError(FUNC_ERROR_TEXT);
  11877. }
  11878. if (isObject(options)) {
  11879. leading = 'leading' in options ? !!options.leading : leading;
  11880. trailing = 'trailing' in options ? !!options.trailing : trailing;
  11881. }
  11882. return debounce(func, wait, {
  11883. 'leading': leading,
  11884. 'maxWait': wait,
  11885. 'trailing': trailing
  11886. });
  11887. }
  11888. /**
  11889. * Creates a function that accepts up to one argument, ignoring any
  11890. * additional arguments.
  11891. *
  11892. * @static
  11893. * @memberOf _
  11894. * @since 4.0.0
  11895. * @category Function
  11896. * @param {Function} func The function to cap arguments for.
  11897. * @returns {Function} Returns the new capped function.
  11898. * @example
  11899. *
  11900. * _.map(['6', '8', '10'], _.unary(parseInt));
  11901. * // => [6, 8, 10]
  11902. */
  11903. function unary(func) {
  11904. return ary(func, 1);
  11905. }
  11906. /**
  11907. * Creates a function that provides `value` to `wrapper` as its first
  11908. * argument. Any additional arguments provided to the function are appended
  11909. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  11910. * binding of the created function.
  11911. *
  11912. * @static
  11913. * @memberOf _
  11914. * @since 0.1.0
  11915. * @category Function
  11916. * @param {*} value The value to wrap.
  11917. * @param {Function} [wrapper=identity] The wrapper function.
  11918. * @returns {Function} Returns the new function.
  11919. * @example
  11920. *
  11921. * var p = _.wrap(_.escape, function(func, text) {
  11922. * return '<p>' + func(text) + '</p>';
  11923. * });
  11924. *
  11925. * p('fred, barney, & pebbles');
  11926. * // => '<p>fred, barney, &amp; pebbles</p>'
  11927. */
  11928. function wrap(value, wrapper) {
  11929. return partial(castFunction(wrapper), value);
  11930. }
  11931. /*------------------------------------------------------------------------*/
  11932. /**
  11933. * Casts `value` as an array if it's not one.
  11934. *
  11935. * @static
  11936. * @memberOf _
  11937. * @since 4.4.0
  11938. * @category Lang
  11939. * @param {*} value The value to inspect.
  11940. * @returns {Array} Returns the cast array.
  11941. * @example
  11942. *
  11943. * _.castArray(1);
  11944. * // => [1]
  11945. *
  11946. * _.castArray({ 'a': 1 });
  11947. * // => [{ 'a': 1 }]
  11948. *
  11949. * _.castArray('abc');
  11950. * // => ['abc']
  11951. *
  11952. * _.castArray(null);
  11953. * // => [null]
  11954. *
  11955. * _.castArray(undefined);
  11956. * // => [undefined]
  11957. *
  11958. * _.castArray();
  11959. * // => []
  11960. *
  11961. * var array = [1, 2, 3];
  11962. * console.log(_.castArray(array) === array);
  11963. * // => true
  11964. */
  11965. function castArray() {
  11966. if (!arguments.length) {
  11967. return [];
  11968. }
  11969. var value = arguments[0];
  11970. return isArray(value) ? value : [value];
  11971. }
  11972. /**
  11973. * Creates a shallow clone of `value`.
  11974. *
  11975. * **Note:** This method is loosely based on the
  11976. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  11977. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  11978. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  11979. * arrays. The own enumerable properties of `arguments` objects are cloned
  11980. * as plain objects. An empty object is returned for uncloneable values such
  11981. * as error objects, functions, DOM nodes, and WeakMaps.
  11982. *
  11983. * @static
  11984. * @memberOf _
  11985. * @since 0.1.0
  11986. * @category Lang
  11987. * @param {*} value The value to clone.
  11988. * @returns {*} Returns the cloned value.
  11989. * @see _.cloneDeep
  11990. * @example
  11991. *
  11992. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  11993. *
  11994. * var shallow = _.clone(objects);
  11995. * console.log(shallow[0] === objects[0]);
  11996. * // => true
  11997. */
  11998. function clone(value) {
  11999. return baseClone(value, CLONE_SYMBOLS_FLAG);
  12000. }
  12001. /**
  12002. * This method is like `_.clone` except that it accepts `customizer` which
  12003. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  12004. * cloning is handled by the method instead. The `customizer` is invoked with
  12005. * up to four arguments; (value [, index|key, object, stack]).
  12006. *
  12007. * @static
  12008. * @memberOf _
  12009. * @since 4.0.0
  12010. * @category Lang
  12011. * @param {*} value The value to clone.
  12012. * @param {Function} [customizer] The function to customize cloning.
  12013. * @returns {*} Returns the cloned value.
  12014. * @see _.cloneDeepWith
  12015. * @example
  12016. *
  12017. * function customizer(value) {
  12018. * if (_.isElement(value)) {
  12019. * return value.cloneNode(false);
  12020. * }
  12021. * }
  12022. *
  12023. * var el = _.cloneWith(document.body, customizer);
  12024. *
  12025. * console.log(el === document.body);
  12026. * // => false
  12027. * console.log(el.nodeName);
  12028. * // => 'BODY'
  12029. * console.log(el.childNodes.length);
  12030. * // => 0
  12031. */
  12032. function cloneWith(value, customizer) {
  12033. customizer = typeof customizer == 'function' ? customizer : undefined;
  12034. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  12035. }
  12036. /**
  12037. * This method is like `_.clone` except that it recursively clones `value`.
  12038. *
  12039. * @static
  12040. * @memberOf _
  12041. * @since 1.0.0
  12042. * @category Lang
  12043. * @param {*} value The value to recursively clone.
  12044. * @returns {*} Returns the deep cloned value.
  12045. * @see _.clone
  12046. * @example
  12047. *
  12048. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  12049. *
  12050. * var deep = _.cloneDeep(objects);
  12051. * console.log(deep[0] === objects[0]);
  12052. * // => false
  12053. */
  12054. function cloneDeep(value) {
  12055. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  12056. }
  12057. /**
  12058. * This method is like `_.cloneWith` except that it recursively clones `value`.
  12059. *
  12060. * @static
  12061. * @memberOf _
  12062. * @since 4.0.0
  12063. * @category Lang
  12064. * @param {*} value The value to recursively clone.
  12065. * @param {Function} [customizer] The function to customize cloning.
  12066. * @returns {*} Returns the deep cloned value.
  12067. * @see _.cloneWith
  12068. * @example
  12069. *
  12070. * function customizer(value) {
  12071. * if (_.isElement(value)) {
  12072. * return value.cloneNode(true);
  12073. * }
  12074. * }
  12075. *
  12076. * var el = _.cloneDeepWith(document.body, customizer);
  12077. *
  12078. * console.log(el === document.body);
  12079. * // => false
  12080. * console.log(el.nodeName);
  12081. * // => 'BODY'
  12082. * console.log(el.childNodes.length);
  12083. * // => 20
  12084. */
  12085. function cloneDeepWith(value, customizer) {
  12086. customizer = typeof customizer == 'function' ? customizer : undefined;
  12087. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  12088. }
  12089. /**
  12090. * Checks if `object` conforms to `source` by invoking the predicate
  12091. * properties of `source` with the corresponding property values of `object`.
  12092. *
  12093. * **Note:** This method is equivalent to `_.conforms` when `source` is
  12094. * partially applied.
  12095. *
  12096. * @static
  12097. * @memberOf _
  12098. * @since 4.14.0
  12099. * @category Lang
  12100. * @param {Object} object The object to inspect.
  12101. * @param {Object} source The object of property predicates to conform to.
  12102. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  12103. * @example
  12104. *
  12105. * var object = { 'a': 1, 'b': 2 };
  12106. *
  12107. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  12108. * // => true
  12109. *
  12110. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  12111. * // => false
  12112. */
  12113. function conformsTo(object, source) {
  12114. return source == null || baseConformsTo(object, source, keys(source));
  12115. }
  12116. /**
  12117. * Performs a
  12118. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  12119. * comparison between two values to determine if they are equivalent.
  12120. *
  12121. * @static
  12122. * @memberOf _
  12123. * @since 4.0.0
  12124. * @category Lang
  12125. * @param {*} value The value to compare.
  12126. * @param {*} other The other value to compare.
  12127. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  12128. * @example
  12129. *
  12130. * var object = { 'a': 1 };
  12131. * var other = { 'a': 1 };
  12132. *
  12133. * _.eq(object, object);
  12134. * // => true
  12135. *
  12136. * _.eq(object, other);
  12137. * // => false
  12138. *
  12139. * _.eq('a', 'a');
  12140. * // => true
  12141. *
  12142. * _.eq('a', Object('a'));
  12143. * // => false
  12144. *
  12145. * _.eq(NaN, NaN);
  12146. * // => true
  12147. */
  12148. function eq(value, other) {
  12149. return value === other || (value !== value && other !== other);
  12150. }
  12151. /**
  12152. * Checks if `value` is greater than `other`.
  12153. *
  12154. * @static
  12155. * @memberOf _
  12156. * @since 3.9.0
  12157. * @category Lang
  12158. * @param {*} value The value to compare.
  12159. * @param {*} other The other value to compare.
  12160. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  12161. * else `false`.
  12162. * @see _.lt
  12163. * @example
  12164. *
  12165. * _.gt(3, 1);
  12166. * // => true
  12167. *
  12168. * _.gt(3, 3);
  12169. * // => false
  12170. *
  12171. * _.gt(1, 3);
  12172. * // => false
  12173. */
  12174. var gt = createRelationalOperation(baseGt);
  12175. /**
  12176. * Checks if `value` is greater than or equal to `other`.
  12177. *
  12178. * @static
  12179. * @memberOf _
  12180. * @since 3.9.0
  12181. * @category Lang
  12182. * @param {*} value The value to compare.
  12183. * @param {*} other The other value to compare.
  12184. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  12185. * `other`, else `false`.
  12186. * @see _.lte
  12187. * @example
  12188. *
  12189. * _.gte(3, 1);
  12190. * // => true
  12191. *
  12192. * _.gte(3, 3);
  12193. * // => true
  12194. *
  12195. * _.gte(1, 3);
  12196. * // => false
  12197. */
  12198. var gte = createRelationalOperation(function(value, other) {
  12199. return value >= other;
  12200. });
  12201. /**
  12202. * Checks if `value` is likely an `arguments` object.
  12203. *
  12204. * @static
  12205. * @memberOf _
  12206. * @since 0.1.0
  12207. * @category Lang
  12208. * @param {*} value The value to check.
  12209. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  12210. * else `false`.
  12211. * @example
  12212. *
  12213. * _.isArguments(function() { return arguments; }());
  12214. * // => true
  12215. *
  12216. * _.isArguments([1, 2, 3]);
  12217. * // => false
  12218. */
  12219. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  12220. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  12221. !propertyIsEnumerable.call(value, 'callee');
  12222. };
  12223. /**
  12224. * Checks if `value` is classified as an `Array` object.
  12225. *
  12226. * @static
  12227. * @memberOf _
  12228. * @since 0.1.0
  12229. * @category Lang
  12230. * @param {*} value The value to check.
  12231. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  12232. * @example
  12233. *
  12234. * _.isArray([1, 2, 3]);
  12235. * // => true
  12236. *
  12237. * _.isArray(document.body.children);
  12238. * // => false
  12239. *
  12240. * _.isArray('abc');
  12241. * // => false
  12242. *
  12243. * _.isArray(_.noop);
  12244. * // => false
  12245. */
  12246. var isArray = Array.isArray;
  12247. /**
  12248. * Checks if `value` is classified as an `ArrayBuffer` object.
  12249. *
  12250. * @static
  12251. * @memberOf _
  12252. * @since 4.3.0
  12253. * @category Lang
  12254. * @param {*} value The value to check.
  12255. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  12256. * @example
  12257. *
  12258. * _.isArrayBuffer(new ArrayBuffer(2));
  12259. * // => true
  12260. *
  12261. * _.isArrayBuffer(new Array(2));
  12262. * // => false
  12263. */
  12264. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  12265. /**
  12266. * Checks if `value` is array-like. A value is considered array-like if it's
  12267. * not a function and has a `value.length` that's an integer greater than or
  12268. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  12269. *
  12270. * @static
  12271. * @memberOf _
  12272. * @since 4.0.0
  12273. * @category Lang
  12274. * @param {*} value The value to check.
  12275. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  12276. * @example
  12277. *
  12278. * _.isArrayLike([1, 2, 3]);
  12279. * // => true
  12280. *
  12281. * _.isArrayLike(document.body.children);
  12282. * // => true
  12283. *
  12284. * _.isArrayLike('abc');
  12285. * // => true
  12286. *
  12287. * _.isArrayLike(_.noop);
  12288. * // => false
  12289. */
  12290. function isArrayLike(value) {
  12291. return value != null && isLength(value.length) && !isFunction(value);
  12292. }
  12293. /**
  12294. * This method is like `_.isArrayLike` except that it also checks if `value`
  12295. * is an object.
  12296. *
  12297. * @static
  12298. * @memberOf _
  12299. * @since 4.0.0
  12300. * @category Lang
  12301. * @param {*} value The value to check.
  12302. * @returns {boolean} Returns `true` if `value` is an array-like object,
  12303. * else `false`.
  12304. * @example
  12305. *
  12306. * _.isArrayLikeObject([1, 2, 3]);
  12307. * // => true
  12308. *
  12309. * _.isArrayLikeObject(document.body.children);
  12310. * // => true
  12311. *
  12312. * _.isArrayLikeObject('abc');
  12313. * // => false
  12314. *
  12315. * _.isArrayLikeObject(_.noop);
  12316. * // => false
  12317. */
  12318. function isArrayLikeObject(value) {
  12319. return isObjectLike(value) && isArrayLike(value);
  12320. }
  12321. /**
  12322. * Checks if `value` is classified as a boolean primitive or object.
  12323. *
  12324. * @static
  12325. * @memberOf _
  12326. * @since 0.1.0
  12327. * @category Lang
  12328. * @param {*} value The value to check.
  12329. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  12330. * @example
  12331. *
  12332. * _.isBoolean(false);
  12333. * // => true
  12334. *
  12335. * _.isBoolean(null);
  12336. * // => false
  12337. */
  12338. function isBoolean(value) {
  12339. return value === true || value === false ||
  12340. (isObjectLike(value) && baseGetTag(value) == boolTag);
  12341. }
  12342. /**
  12343. * Checks if `value` is a buffer.
  12344. *
  12345. * @static
  12346. * @memberOf _
  12347. * @since 4.3.0
  12348. * @category Lang
  12349. * @param {*} value The value to check.
  12350. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  12351. * @example
  12352. *
  12353. * _.isBuffer(new Buffer(2));
  12354. * // => true
  12355. *
  12356. * _.isBuffer(new Uint8Array(2));
  12357. * // => false
  12358. */
  12359. var isBuffer = nativeIsBuffer || stubFalse;
  12360. /**
  12361. * Checks if `value` is classified as a `Date` object.
  12362. *
  12363. * @static
  12364. * @memberOf _
  12365. * @since 0.1.0
  12366. * @category Lang
  12367. * @param {*} value The value to check.
  12368. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  12369. * @example
  12370. *
  12371. * _.isDate(new Date);
  12372. * // => true
  12373. *
  12374. * _.isDate('Mon April 23 2012');
  12375. * // => false
  12376. */
  12377. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  12378. /**
  12379. * Checks if `value` is likely a DOM element.
  12380. *
  12381. * @static
  12382. * @memberOf _
  12383. * @since 0.1.0
  12384. * @category Lang
  12385. * @param {*} value The value to check.
  12386. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  12387. * @example
  12388. *
  12389. * _.isElement(document.body);
  12390. * // => true
  12391. *
  12392. * _.isElement('<body>');
  12393. * // => false
  12394. */
  12395. function isElement(value) {
  12396. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  12397. }
  12398. /**
  12399. * Checks if `value` is an empty object, collection, map, or set.
  12400. *
  12401. * Objects are considered empty if they have no own enumerable string keyed
  12402. * properties.
  12403. *
  12404. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  12405. * jQuery-like collections are considered empty if they have a `length` of `0`.
  12406. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  12407. *
  12408. * @static
  12409. * @memberOf _
  12410. * @since 0.1.0
  12411. * @category Lang
  12412. * @param {*} value The value to check.
  12413. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  12414. * @example
  12415. *
  12416. * _.isEmpty(null);
  12417. * // => true
  12418. *
  12419. * _.isEmpty(true);
  12420. * // => true
  12421. *
  12422. * _.isEmpty(1);
  12423. * // => true
  12424. *
  12425. * _.isEmpty([1, 2, 3]);
  12426. * // => false
  12427. *
  12428. * _.isEmpty({ 'a': 1 });
  12429. * // => false
  12430. */
  12431. function isEmpty(value) {
  12432. if (value == null) {
  12433. return true;
  12434. }
  12435. if (isArrayLike(value) &&
  12436. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  12437. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  12438. return !value.length;
  12439. }
  12440. var tag = getTag(value);
  12441. if (tag == mapTag || tag == setTag) {
  12442. return !value.size;
  12443. }
  12444. if (isPrototype(value)) {
  12445. return !baseKeys(value).length;
  12446. }
  12447. for (var key in value) {
  12448. if (hasOwnProperty.call(value, key)) {
  12449. return false;
  12450. }
  12451. }
  12452. return true;
  12453. }
  12454. /**
  12455. * Performs a deep comparison between two values to determine if they are
  12456. * equivalent.
  12457. *
  12458. * **Note:** This method supports comparing arrays, array buffers, booleans,
  12459. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  12460. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  12461. * by their own, not inherited, enumerable properties. Functions and DOM
  12462. * nodes are compared by strict equality, i.e. `===`.
  12463. *
  12464. * @static
  12465. * @memberOf _
  12466. * @since 0.1.0
  12467. * @category Lang
  12468. * @param {*} value The value to compare.
  12469. * @param {*} other The other value to compare.
  12470. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  12471. * @example
  12472. *
  12473. * var object = { 'a': 1 };
  12474. * var other = { 'a': 1 };
  12475. *
  12476. * _.isEqual(object, other);
  12477. * // => true
  12478. *
  12479. * object === other;
  12480. * // => false
  12481. */
  12482. function isEqual(value, other) {
  12483. return baseIsEqual(value, other);
  12484. }
  12485. /**
  12486. * This method is like `_.isEqual` except that it accepts `customizer` which
  12487. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  12488. * are handled by the method instead. The `customizer` is invoked with up to
  12489. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  12490. *
  12491. * @static
  12492. * @memberOf _
  12493. * @since 4.0.0
  12494. * @category Lang
  12495. * @param {*} value The value to compare.
  12496. * @param {*} other The other value to compare.
  12497. * @param {Function} [customizer] The function to customize comparisons.
  12498. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  12499. * @example
  12500. *
  12501. * function isGreeting(value) {
  12502. * return /^h(?:i|ello)$/.test(value);
  12503. * }
  12504. *
  12505. * function customizer(objValue, othValue) {
  12506. * if (isGreeting(objValue) && isGreeting(othValue)) {
  12507. * return true;
  12508. * }
  12509. * }
  12510. *
  12511. * var array = ['hello', 'goodbye'];
  12512. * var other = ['hi', 'goodbye'];
  12513. *
  12514. * _.isEqualWith(array, other, customizer);
  12515. * // => true
  12516. */
  12517. function isEqualWith(value, other, customizer) {
  12518. customizer = typeof customizer == 'function' ? customizer : undefined;
  12519. var result = customizer ? customizer(value, other) : undefined;
  12520. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  12521. }
  12522. /**
  12523. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  12524. * `SyntaxError`, `TypeError`, or `URIError` object.
  12525. *
  12526. * @static
  12527. * @memberOf _
  12528. * @since 3.0.0
  12529. * @category Lang
  12530. * @param {*} value The value to check.
  12531. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  12532. * @example
  12533. *
  12534. * _.isError(new Error);
  12535. * // => true
  12536. *
  12537. * _.isError(Error);
  12538. * // => false
  12539. */
  12540. function isError(value) {
  12541. if (!isObjectLike(value)) {
  12542. return false;
  12543. }
  12544. var tag = baseGetTag(value);
  12545. return tag == errorTag || tag == domExcTag ||
  12546. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  12547. }
  12548. /**
  12549. * Checks if `value` is a finite primitive number.
  12550. *
  12551. * **Note:** This method is based on
  12552. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  12553. *
  12554. * @static
  12555. * @memberOf _
  12556. * @since 0.1.0
  12557. * @category Lang
  12558. * @param {*} value The value to check.
  12559. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  12560. * @example
  12561. *
  12562. * _.isFinite(3);
  12563. * // => true
  12564. *
  12565. * _.isFinite(Number.MIN_VALUE);
  12566. * // => true
  12567. *
  12568. * _.isFinite(Infinity);
  12569. * // => false
  12570. *
  12571. * _.isFinite('3');
  12572. * // => false
  12573. */
  12574. function isFinite(value) {
  12575. return typeof value == 'number' && nativeIsFinite(value);
  12576. }
  12577. /**
  12578. * Checks if `value` is classified as a `Function` object.
  12579. *
  12580. * @static
  12581. * @memberOf _
  12582. * @since 0.1.0
  12583. * @category Lang
  12584. * @param {*} value The value to check.
  12585. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  12586. * @example
  12587. *
  12588. * _.isFunction(_);
  12589. * // => true
  12590. *
  12591. * _.isFunction(/abc/);
  12592. * // => false
  12593. */
  12594. function isFunction(value) {
  12595. if (!isObject(value)) {
  12596. return false;
  12597. }
  12598. // The use of `Object#toString` avoids issues with the `typeof` operator
  12599. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  12600. var tag = baseGetTag(value);
  12601. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  12602. }
  12603. /**
  12604. * Checks if `value` is an integer.
  12605. *
  12606. * **Note:** This method is based on
  12607. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  12608. *
  12609. * @static
  12610. * @memberOf _
  12611. * @since 4.0.0
  12612. * @category Lang
  12613. * @param {*} value The value to check.
  12614. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  12615. * @example
  12616. *
  12617. * _.isInteger(3);
  12618. * // => true
  12619. *
  12620. * _.isInteger(Number.MIN_VALUE);
  12621. * // => false
  12622. *
  12623. * _.isInteger(Infinity);
  12624. * // => false
  12625. *
  12626. * _.isInteger('3');
  12627. * // => false
  12628. */
  12629. function isInteger(value) {
  12630. return typeof value == 'number' && value == toInteger(value);
  12631. }
  12632. /**
  12633. * Checks if `value` is a valid array-like length.
  12634. *
  12635. * **Note:** This method is loosely based on
  12636. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  12637. *
  12638. * @static
  12639. * @memberOf _
  12640. * @since 4.0.0
  12641. * @category Lang
  12642. * @param {*} value The value to check.
  12643. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  12644. * @example
  12645. *
  12646. * _.isLength(3);
  12647. * // => true
  12648. *
  12649. * _.isLength(Number.MIN_VALUE);
  12650. * // => false
  12651. *
  12652. * _.isLength(Infinity);
  12653. * // => false
  12654. *
  12655. * _.isLength('3');
  12656. * // => false
  12657. */
  12658. function isLength(value) {
  12659. return typeof value == 'number' &&
  12660. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  12661. }
  12662. /**
  12663. * Checks if `value` is the
  12664. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  12665. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  12666. *
  12667. * @static
  12668. * @memberOf _
  12669. * @since 0.1.0
  12670. * @category Lang
  12671. * @param {*} value The value to check.
  12672. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  12673. * @example
  12674. *
  12675. * _.isObject({});
  12676. * // => true
  12677. *
  12678. * _.isObject([1, 2, 3]);
  12679. * // => true
  12680. *
  12681. * _.isObject(_.noop);
  12682. * // => true
  12683. *
  12684. * _.isObject(null);
  12685. * // => false
  12686. */
  12687. function isObject(value) {
  12688. var type = typeof value;
  12689. return value != null && (type == 'object' || type == 'function');
  12690. }
  12691. /**
  12692. * Checks if `value` is object-like. A value is object-like if it's not `null`
  12693. * and has a `typeof` result of "object".
  12694. *
  12695. * @static
  12696. * @memberOf _
  12697. * @since 4.0.0
  12698. * @category Lang
  12699. * @param {*} value The value to check.
  12700. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  12701. * @example
  12702. *
  12703. * _.isObjectLike({});
  12704. * // => true
  12705. *
  12706. * _.isObjectLike([1, 2, 3]);
  12707. * // => true
  12708. *
  12709. * _.isObjectLike(_.noop);
  12710. * // => false
  12711. *
  12712. * _.isObjectLike(null);
  12713. * // => false
  12714. */
  12715. function isObjectLike(value) {
  12716. return value != null && typeof value == 'object';
  12717. }
  12718. /**
  12719. * Checks if `value` is classified as a `Map` object.
  12720. *
  12721. * @static
  12722. * @memberOf _
  12723. * @since 4.3.0
  12724. * @category Lang
  12725. * @param {*} value The value to check.
  12726. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  12727. * @example
  12728. *
  12729. * _.isMap(new Map);
  12730. * // => true
  12731. *
  12732. * _.isMap(new WeakMap);
  12733. * // => false
  12734. */
  12735. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  12736. /**
  12737. * Performs a partial deep comparison between `object` and `source` to
  12738. * determine if `object` contains equivalent property values.
  12739. *
  12740. * **Note:** This method is equivalent to `_.matches` when `source` is
  12741. * partially applied.
  12742. *
  12743. * Partial comparisons will match empty array and empty object `source`
  12744. * values against any array or object value, respectively. See `_.isEqual`
  12745. * for a list of supported value comparisons.
  12746. *
  12747. * @static
  12748. * @memberOf _
  12749. * @since 3.0.0
  12750. * @category Lang
  12751. * @param {Object} object The object to inspect.
  12752. * @param {Object} source The object of property values to match.
  12753. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  12754. * @example
  12755. *
  12756. * var object = { 'a': 1, 'b': 2 };
  12757. *
  12758. * _.isMatch(object, { 'b': 2 });
  12759. * // => true
  12760. *
  12761. * _.isMatch(object, { 'b': 1 });
  12762. * // => false
  12763. */
  12764. function isMatch(object, source) {
  12765. return object === source || baseIsMatch(object, source, getMatchData(source));
  12766. }
  12767. /**
  12768. * This method is like `_.isMatch` except that it accepts `customizer` which
  12769. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  12770. * are handled by the method instead. The `customizer` is invoked with five
  12771. * arguments: (objValue, srcValue, index|key, object, source).
  12772. *
  12773. * @static
  12774. * @memberOf _
  12775. * @since 4.0.0
  12776. * @category Lang
  12777. * @param {Object} object The object to inspect.
  12778. * @param {Object} source The object of property values to match.
  12779. * @param {Function} [customizer] The function to customize comparisons.
  12780. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  12781. * @example
  12782. *
  12783. * function isGreeting(value) {
  12784. * return /^h(?:i|ello)$/.test(value);
  12785. * }
  12786. *
  12787. * function customizer(objValue, srcValue) {
  12788. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  12789. * return true;
  12790. * }
  12791. * }
  12792. *
  12793. * var object = { 'greeting': 'hello' };
  12794. * var source = { 'greeting': 'hi' };
  12795. *
  12796. * _.isMatchWith(object, source, customizer);
  12797. * // => true
  12798. */
  12799. function isMatchWith(object, source, customizer) {
  12800. customizer = typeof customizer == 'function' ? customizer : undefined;
  12801. return baseIsMatch(object, source, getMatchData(source), customizer);
  12802. }
  12803. /**
  12804. * Checks if `value` is `NaN`.
  12805. *
  12806. * **Note:** This method is based on
  12807. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  12808. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  12809. * `undefined` and other non-number values.
  12810. *
  12811. * @static
  12812. * @memberOf _
  12813. * @since 0.1.0
  12814. * @category Lang
  12815. * @param {*} value The value to check.
  12816. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  12817. * @example
  12818. *
  12819. * _.isNaN(NaN);
  12820. * // => true
  12821. *
  12822. * _.isNaN(new Number(NaN));
  12823. * // => true
  12824. *
  12825. * isNaN(undefined);
  12826. * // => true
  12827. *
  12828. * _.isNaN(undefined);
  12829. * // => false
  12830. */
  12831. function isNaN(value) {
  12832. // An `NaN` primitive is the only value that is not equal to itself.
  12833. // Perform the `toStringTag` check first to avoid errors with some
  12834. // ActiveX objects in IE.
  12835. return isNumber(value) && value != +value;
  12836. }
  12837. /**
  12838. * Checks if `value` is a pristine native function.
  12839. *
  12840. * **Note:** This method can't reliably detect native functions in the presence
  12841. * of the core-js package because core-js circumvents this kind of detection.
  12842. * Despite multiple requests, the core-js maintainer has made it clear: any
  12843. * attempt to fix the detection will be obstructed. As a result, we're left
  12844. * with little choice but to throw an error. Unfortunately, this also affects
  12845. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  12846. * which rely on core-js.
  12847. *
  12848. * @static
  12849. * @memberOf _
  12850. * @since 3.0.0
  12851. * @category Lang
  12852. * @param {*} value The value to check.
  12853. * @returns {boolean} Returns `true` if `value` is a native function,
  12854. * else `false`.
  12855. * @example
  12856. *
  12857. * _.isNative(Array.prototype.push);
  12858. * // => true
  12859. *
  12860. * _.isNative(_);
  12861. * // => false
  12862. */
  12863. function isNative(value) {
  12864. if (isMaskable(value)) {
  12865. throw new Error(CORE_ERROR_TEXT);
  12866. }
  12867. return baseIsNative(value);
  12868. }
  12869. /**
  12870. * Checks if `value` is `null`.
  12871. *
  12872. * @static
  12873. * @memberOf _
  12874. * @since 0.1.0
  12875. * @category Lang
  12876. * @param {*} value The value to check.
  12877. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  12878. * @example
  12879. *
  12880. * _.isNull(null);
  12881. * // => true
  12882. *
  12883. * _.isNull(void 0);
  12884. * // => false
  12885. */
  12886. function isNull(value) {
  12887. return value === null;
  12888. }
  12889. /**
  12890. * Checks if `value` is `null` or `undefined`.
  12891. *
  12892. * @static
  12893. * @memberOf _
  12894. * @since 4.0.0
  12895. * @category Lang
  12896. * @param {*} value The value to check.
  12897. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  12898. * @example
  12899. *
  12900. * _.isNil(null);
  12901. * // => true
  12902. *
  12903. * _.isNil(void 0);
  12904. * // => true
  12905. *
  12906. * _.isNil(NaN);
  12907. * // => false
  12908. */
  12909. function isNil(value) {
  12910. return value == null;
  12911. }
  12912. /**
  12913. * Checks if `value` is classified as a `Number` primitive or object.
  12914. *
  12915. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  12916. * classified as numbers, use the `_.isFinite` method.
  12917. *
  12918. * @static
  12919. * @memberOf _
  12920. * @since 0.1.0
  12921. * @category Lang
  12922. * @param {*} value The value to check.
  12923. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  12924. * @example
  12925. *
  12926. * _.isNumber(3);
  12927. * // => true
  12928. *
  12929. * _.isNumber(Number.MIN_VALUE);
  12930. * // => true
  12931. *
  12932. * _.isNumber(Infinity);
  12933. * // => true
  12934. *
  12935. * _.isNumber('3');
  12936. * // => false
  12937. */
  12938. function isNumber(value) {
  12939. return typeof value == 'number' ||
  12940. (isObjectLike(value) && baseGetTag(value) == numberTag);
  12941. }
  12942. /**
  12943. * Checks if `value` is a plain object, that is, an object created by the
  12944. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  12945. *
  12946. * @static
  12947. * @memberOf _
  12948. * @since 0.8.0
  12949. * @category Lang
  12950. * @param {*} value The value to check.
  12951. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  12952. * @example
  12953. *
  12954. * function Foo() {
  12955. * this.a = 1;
  12956. * }
  12957. *
  12958. * _.isPlainObject(new Foo);
  12959. * // => false
  12960. *
  12961. * _.isPlainObject([1, 2, 3]);
  12962. * // => false
  12963. *
  12964. * _.isPlainObject({ 'x': 0, 'y': 0 });
  12965. * // => true
  12966. *
  12967. * _.isPlainObject(Object.create(null));
  12968. * // => true
  12969. */
  12970. function isPlainObject(value) {
  12971. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  12972. return false;
  12973. }
  12974. var proto = getPrototype(value);
  12975. if (proto === null) {
  12976. return true;
  12977. }
  12978. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  12979. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  12980. funcToString.call(Ctor) == objectCtorString;
  12981. }
  12982. /**
  12983. * Checks if `value` is classified as a `RegExp` object.
  12984. *
  12985. * @static
  12986. * @memberOf _
  12987. * @since 0.1.0
  12988. * @category Lang
  12989. * @param {*} value The value to check.
  12990. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  12991. * @example
  12992. *
  12993. * _.isRegExp(/abc/);
  12994. * // => true
  12995. *
  12996. * _.isRegExp('/abc/');
  12997. * // => false
  12998. */
  12999. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  13000. /**
  13001. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  13002. * double precision number which isn't the result of a rounded unsafe integer.
  13003. *
  13004. * **Note:** This method is based on
  13005. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  13006. *
  13007. * @static
  13008. * @memberOf _
  13009. * @since 4.0.0
  13010. * @category Lang
  13011. * @param {*} value The value to check.
  13012. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  13013. * @example
  13014. *
  13015. * _.isSafeInteger(3);
  13016. * // => true
  13017. *
  13018. * _.isSafeInteger(Number.MIN_VALUE);
  13019. * // => false
  13020. *
  13021. * _.isSafeInteger(Infinity);
  13022. * // => false
  13023. *
  13024. * _.isSafeInteger('3');
  13025. * // => false
  13026. */
  13027. function isSafeInteger(value) {
  13028. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  13029. }
  13030. /**
  13031. * Checks if `value` is classified as a `Set` object.
  13032. *
  13033. * @static
  13034. * @memberOf _
  13035. * @since 4.3.0
  13036. * @category Lang
  13037. * @param {*} value The value to check.
  13038. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  13039. * @example
  13040. *
  13041. * _.isSet(new Set);
  13042. * // => true
  13043. *
  13044. * _.isSet(new WeakSet);
  13045. * // => false
  13046. */
  13047. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  13048. /**
  13049. * Checks if `value` is classified as a `String` primitive or object.
  13050. *
  13051. * @static
  13052. * @since 0.1.0
  13053. * @memberOf _
  13054. * @category Lang
  13055. * @param {*} value The value to check.
  13056. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  13057. * @example
  13058. *
  13059. * _.isString('abc');
  13060. * // => true
  13061. *
  13062. * _.isString(1);
  13063. * // => false
  13064. */
  13065. function isString(value) {
  13066. return typeof value == 'string' ||
  13067. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  13068. }
  13069. /**
  13070. * Checks if `value` is classified as a `Symbol` primitive or object.
  13071. *
  13072. * @static
  13073. * @memberOf _
  13074. * @since 4.0.0
  13075. * @category Lang
  13076. * @param {*} value The value to check.
  13077. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  13078. * @example
  13079. *
  13080. * _.isSymbol(Symbol.iterator);
  13081. * // => true
  13082. *
  13083. * _.isSymbol('abc');
  13084. * // => false
  13085. */
  13086. function isSymbol(value) {
  13087. return typeof value == 'symbol' ||
  13088. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  13089. }
  13090. /**
  13091. * Checks if `value` is classified as a typed array.
  13092. *
  13093. * @static
  13094. * @memberOf _
  13095. * @since 3.0.0
  13096. * @category Lang
  13097. * @param {*} value The value to check.
  13098. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  13099. * @example
  13100. *
  13101. * _.isTypedArray(new Uint8Array);
  13102. * // => true
  13103. *
  13104. * _.isTypedArray([]);
  13105. * // => false
  13106. */
  13107. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  13108. /**
  13109. * Checks if `value` is `undefined`.
  13110. *
  13111. * @static
  13112. * @since 0.1.0
  13113. * @memberOf _
  13114. * @category Lang
  13115. * @param {*} value The value to check.
  13116. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  13117. * @example
  13118. *
  13119. * _.isUndefined(void 0);
  13120. * // => true
  13121. *
  13122. * _.isUndefined(null);
  13123. * // => false
  13124. */
  13125. function isUndefined(value) {
  13126. return value === undefined;
  13127. }
  13128. /**
  13129. * Checks if `value` is classified as a `WeakMap` object.
  13130. *
  13131. * @static
  13132. * @memberOf _
  13133. * @since 4.3.0
  13134. * @category Lang
  13135. * @param {*} value The value to check.
  13136. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  13137. * @example
  13138. *
  13139. * _.isWeakMap(new WeakMap);
  13140. * // => true
  13141. *
  13142. * _.isWeakMap(new Map);
  13143. * // => false
  13144. */
  13145. function isWeakMap(value) {
  13146. return isObjectLike(value) && getTag(value) == weakMapTag;
  13147. }
  13148. /**
  13149. * Checks if `value` is classified as a `WeakSet` object.
  13150. *
  13151. * @static
  13152. * @memberOf _
  13153. * @since 4.3.0
  13154. * @category Lang
  13155. * @param {*} value The value to check.
  13156. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  13157. * @example
  13158. *
  13159. * _.isWeakSet(new WeakSet);
  13160. * // => true
  13161. *
  13162. * _.isWeakSet(new Set);
  13163. * // => false
  13164. */
  13165. function isWeakSet(value) {
  13166. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  13167. }
  13168. /**
  13169. * Checks if `value` is less than `other`.
  13170. *
  13171. * @static
  13172. * @memberOf _
  13173. * @since 3.9.0
  13174. * @category Lang
  13175. * @param {*} value The value to compare.
  13176. * @param {*} other The other value to compare.
  13177. * @returns {boolean} Returns `true` if `value` is less than `other`,
  13178. * else `false`.
  13179. * @see _.gt
  13180. * @example
  13181. *
  13182. * _.lt(1, 3);
  13183. * // => true
  13184. *
  13185. * _.lt(3, 3);
  13186. * // => false
  13187. *
  13188. * _.lt(3, 1);
  13189. * // => false
  13190. */
  13191. var lt = createRelationalOperation(baseLt);
  13192. /**
  13193. * Checks if `value` is less than or equal to `other`.
  13194. *
  13195. * @static
  13196. * @memberOf _
  13197. * @since 3.9.0
  13198. * @category Lang
  13199. * @param {*} value The value to compare.
  13200. * @param {*} other The other value to compare.
  13201. * @returns {boolean} Returns `true` if `value` is less than or equal to
  13202. * `other`, else `false`.
  13203. * @see _.gte
  13204. * @example
  13205. *
  13206. * _.lte(1, 3);
  13207. * // => true
  13208. *
  13209. * _.lte(3, 3);
  13210. * // => true
  13211. *
  13212. * _.lte(3, 1);
  13213. * // => false
  13214. */
  13215. var lte = createRelationalOperation(function(value, other) {
  13216. return value <= other;
  13217. });
  13218. /**
  13219. * Converts `value` to an array.
  13220. *
  13221. * @static
  13222. * @since 0.1.0
  13223. * @memberOf _
  13224. * @category Lang
  13225. * @param {*} value The value to convert.
  13226. * @returns {Array} Returns the converted array.
  13227. * @example
  13228. *
  13229. * _.toArray({ 'a': 1, 'b': 2 });
  13230. * // => [1, 2]
  13231. *
  13232. * _.toArray('abc');
  13233. * // => ['a', 'b', 'c']
  13234. *
  13235. * _.toArray(1);
  13236. * // => []
  13237. *
  13238. * _.toArray(null);
  13239. * // => []
  13240. */
  13241. function toArray(value) {
  13242. if (!value) {
  13243. return [];
  13244. }
  13245. if (isArrayLike(value)) {
  13246. return isString(value) ? stringToArray(value) : copyArray(value);
  13247. }
  13248. if (symIterator && value[symIterator]) {
  13249. return iteratorToArray(value[symIterator]());
  13250. }
  13251. var tag = getTag(value),
  13252. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  13253. return func(value);
  13254. }
  13255. /**
  13256. * Converts `value` to a finite number.
  13257. *
  13258. * @static
  13259. * @memberOf _
  13260. * @since 4.12.0
  13261. * @category Lang
  13262. * @param {*} value The value to convert.
  13263. * @returns {number} Returns the converted number.
  13264. * @example
  13265. *
  13266. * _.toFinite(3.2);
  13267. * // => 3.2
  13268. *
  13269. * _.toFinite(Number.MIN_VALUE);
  13270. * // => 5e-324
  13271. *
  13272. * _.toFinite(Infinity);
  13273. * // => 1.7976931348623157e+308
  13274. *
  13275. * _.toFinite('3.2');
  13276. * // => 3.2
  13277. */
  13278. function toFinite(value) {
  13279. if (!value) {
  13280. return value === 0 ? value : 0;
  13281. }
  13282. value = toNumber(value);
  13283. if (value === INFINITY || value === -INFINITY) {
  13284. var sign = (value < 0 ? -1 : 1);
  13285. return sign * MAX_INTEGER;
  13286. }
  13287. return value === value ? value : 0;
  13288. }
  13289. /**
  13290. * Converts `value` to an integer.
  13291. *
  13292. * **Note:** This method is loosely based on
  13293. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  13294. *
  13295. * @static
  13296. * @memberOf _
  13297. * @since 4.0.0
  13298. * @category Lang
  13299. * @param {*} value The value to convert.
  13300. * @returns {number} Returns the converted integer.
  13301. * @example
  13302. *
  13303. * _.toInteger(3.2);
  13304. * // => 3
  13305. *
  13306. * _.toInteger(Number.MIN_VALUE);
  13307. * // => 0
  13308. *
  13309. * _.toInteger(Infinity);
  13310. * // => 1.7976931348623157e+308
  13311. *
  13312. * _.toInteger('3.2');
  13313. * // => 3
  13314. */
  13315. function toInteger(value) {
  13316. var result = toFinite(value),
  13317. remainder = result % 1;
  13318. return result === result ? (remainder ? result - remainder : result) : 0;
  13319. }
  13320. /**
  13321. * Converts `value` to an integer suitable for use as the length of an
  13322. * array-like object.
  13323. *
  13324. * **Note:** This method is based on
  13325. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  13326. *
  13327. * @static
  13328. * @memberOf _
  13329. * @since 4.0.0
  13330. * @category Lang
  13331. * @param {*} value The value to convert.
  13332. * @returns {number} Returns the converted integer.
  13333. * @example
  13334. *
  13335. * _.toLength(3.2);
  13336. * // => 3
  13337. *
  13338. * _.toLength(Number.MIN_VALUE);
  13339. * // => 0
  13340. *
  13341. * _.toLength(Infinity);
  13342. * // => 4294967295
  13343. *
  13344. * _.toLength('3.2');
  13345. * // => 3
  13346. */
  13347. function toLength(value) {
  13348. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  13349. }
  13350. /**
  13351. * Converts `value` to a number.
  13352. *
  13353. * @static
  13354. * @memberOf _
  13355. * @since 4.0.0
  13356. * @category Lang
  13357. * @param {*} value The value to process.
  13358. * @returns {number} Returns the number.
  13359. * @example
  13360. *
  13361. * _.toNumber(3.2);
  13362. * // => 3.2
  13363. *
  13364. * _.toNumber(Number.MIN_VALUE);
  13365. * // => 5e-324
  13366. *
  13367. * _.toNumber(Infinity);
  13368. * // => Infinity
  13369. *
  13370. * _.toNumber('3.2');
  13371. * // => 3.2
  13372. */
  13373. function toNumber(value) {
  13374. if (typeof value == 'number') {
  13375. return value;
  13376. }
  13377. if (isSymbol(value)) {
  13378. return NAN;
  13379. }
  13380. if (isObject(value)) {
  13381. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  13382. value = isObject(other) ? (other + '') : other;
  13383. }
  13384. if (typeof value != 'string') {
  13385. return value === 0 ? value : +value;
  13386. }
  13387. value = baseTrim(value);
  13388. var isBinary = reIsBinary.test(value);
  13389. return (isBinary || reIsOctal.test(value))
  13390. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  13391. : (reIsBadHex.test(value) ? NAN : +value);
  13392. }
  13393. /**
  13394. * Converts `value` to a plain object flattening inherited enumerable string
  13395. * keyed properties of `value` to own properties of the plain object.
  13396. *
  13397. * @static
  13398. * @memberOf _
  13399. * @since 3.0.0
  13400. * @category Lang
  13401. * @param {*} value The value to convert.
  13402. * @returns {Object} Returns the converted plain object.
  13403. * @example
  13404. *
  13405. * function Foo() {
  13406. * this.b = 2;
  13407. * }
  13408. *
  13409. * Foo.prototype.c = 3;
  13410. *
  13411. * _.assign({ 'a': 1 }, new Foo);
  13412. * // => { 'a': 1, 'b': 2 }
  13413. *
  13414. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  13415. * // => { 'a': 1, 'b': 2, 'c': 3 }
  13416. */
  13417. function toPlainObject(value) {
  13418. return copyObject(value, keysIn(value));
  13419. }
  13420. /**
  13421. * Converts `value` to a safe integer. A safe integer can be compared and
  13422. * represented correctly.
  13423. *
  13424. * @static
  13425. * @memberOf _
  13426. * @since 4.0.0
  13427. * @category Lang
  13428. * @param {*} value The value to convert.
  13429. * @returns {number} Returns the converted integer.
  13430. * @example
  13431. *
  13432. * _.toSafeInteger(3.2);
  13433. * // => 3
  13434. *
  13435. * _.toSafeInteger(Number.MIN_VALUE);
  13436. * // => 0
  13437. *
  13438. * _.toSafeInteger(Infinity);
  13439. * // => 9007199254740991
  13440. *
  13441. * _.toSafeInteger('3.2');
  13442. * // => 3
  13443. */
  13444. function toSafeInteger(value) {
  13445. return value
  13446. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  13447. : (value === 0 ? value : 0);
  13448. }
  13449. /**
  13450. * Converts `value` to a string. An empty string is returned for `null`
  13451. * and `undefined` values. The sign of `-0` is preserved.
  13452. *
  13453. * @static
  13454. * @memberOf _
  13455. * @since 4.0.0
  13456. * @category Lang
  13457. * @param {*} value The value to convert.
  13458. * @returns {string} Returns the converted string.
  13459. * @example
  13460. *
  13461. * _.toString(null);
  13462. * // => ''
  13463. *
  13464. * _.toString(-0);
  13465. * // => '-0'
  13466. *
  13467. * _.toString([1, 2, 3]);
  13468. * // => '1,2,3'
  13469. */
  13470. function toString(value) {
  13471. return value == null ? '' : baseToString(value);
  13472. }
  13473. /*------------------------------------------------------------------------*/
  13474. /**
  13475. * Assigns own enumerable string keyed properties of source objects to the
  13476. * destination object. Source objects are applied from left to right.
  13477. * Subsequent sources overwrite property assignments of previous sources.
  13478. *
  13479. * **Note:** This method mutates `object` and is loosely based on
  13480. * [`Object.assign`](https://mdn.io/Object/assign).
  13481. *
  13482. * @static
  13483. * @memberOf _
  13484. * @since 0.10.0
  13485. * @category Object
  13486. * @param {Object} object The destination object.
  13487. * @param {...Object} [sources] The source objects.
  13488. * @returns {Object} Returns `object`.
  13489. * @see _.assignIn
  13490. * @example
  13491. *
  13492. * function Foo() {
  13493. * this.a = 1;
  13494. * }
  13495. *
  13496. * function Bar() {
  13497. * this.c = 3;
  13498. * }
  13499. *
  13500. * Foo.prototype.b = 2;
  13501. * Bar.prototype.d = 4;
  13502. *
  13503. * _.assign({ 'a': 0 }, new Foo, new Bar);
  13504. * // => { 'a': 1, 'c': 3 }
  13505. */
  13506. var assign = createAssigner(function(object, source) {
  13507. if (isPrototype(source) || isArrayLike(source)) {
  13508. copyObject(source, keys(source), object);
  13509. return;
  13510. }
  13511. for (var key in source) {
  13512. if (hasOwnProperty.call(source, key)) {
  13513. assignValue(object, key, source[key]);
  13514. }
  13515. }
  13516. });
  13517. /**
  13518. * This method is like `_.assign` except that it iterates over own and
  13519. * inherited source properties.
  13520. *
  13521. * **Note:** This method mutates `object`.
  13522. *
  13523. * @static
  13524. * @memberOf _
  13525. * @since 4.0.0
  13526. * @alias extend
  13527. * @category Object
  13528. * @param {Object} object The destination object.
  13529. * @param {...Object} [sources] The source objects.
  13530. * @returns {Object} Returns `object`.
  13531. * @see _.assign
  13532. * @example
  13533. *
  13534. * function Foo() {
  13535. * this.a = 1;
  13536. * }
  13537. *
  13538. * function Bar() {
  13539. * this.c = 3;
  13540. * }
  13541. *
  13542. * Foo.prototype.b = 2;
  13543. * Bar.prototype.d = 4;
  13544. *
  13545. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  13546. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  13547. */
  13548. var assignIn = createAssigner(function(object, source) {
  13549. copyObject(source, keysIn(source), object);
  13550. });
  13551. /**
  13552. * This method is like `_.assignIn` except that it accepts `customizer`
  13553. * which is invoked to produce the assigned values. If `customizer` returns
  13554. * `undefined`, assignment is handled by the method instead. The `customizer`
  13555. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  13556. *
  13557. * **Note:** This method mutates `object`.
  13558. *
  13559. * @static
  13560. * @memberOf _
  13561. * @since 4.0.0
  13562. * @alias extendWith
  13563. * @category Object
  13564. * @param {Object} object The destination object.
  13565. * @param {...Object} sources The source objects.
  13566. * @param {Function} [customizer] The function to customize assigned values.
  13567. * @returns {Object} Returns `object`.
  13568. * @see _.assignWith
  13569. * @example
  13570. *
  13571. * function customizer(objValue, srcValue) {
  13572. * return _.isUndefined(objValue) ? srcValue : objValue;
  13573. * }
  13574. *
  13575. * var defaults = _.partialRight(_.assignInWith, customizer);
  13576. *
  13577. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  13578. * // => { 'a': 1, 'b': 2 }
  13579. */
  13580. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  13581. copyObject(source, keysIn(source), object, customizer);
  13582. });
  13583. /**
  13584. * This method is like `_.assign` except that it accepts `customizer`
  13585. * which is invoked to produce the assigned values. If `customizer` returns
  13586. * `undefined`, assignment is handled by the method instead. The `customizer`
  13587. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  13588. *
  13589. * **Note:** This method mutates `object`.
  13590. *
  13591. * @static
  13592. * @memberOf _
  13593. * @since 4.0.0
  13594. * @category Object
  13595. * @param {Object} object The destination object.
  13596. * @param {...Object} sources The source objects.
  13597. * @param {Function} [customizer] The function to customize assigned values.
  13598. * @returns {Object} Returns `object`.
  13599. * @see _.assignInWith
  13600. * @example
  13601. *
  13602. * function customizer(objValue, srcValue) {
  13603. * return _.isUndefined(objValue) ? srcValue : objValue;
  13604. * }
  13605. *
  13606. * var defaults = _.partialRight(_.assignWith, customizer);
  13607. *
  13608. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  13609. * // => { 'a': 1, 'b': 2 }
  13610. */
  13611. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  13612. copyObject(source, keys(source), object, customizer);
  13613. });
  13614. /**
  13615. * Creates an array of values corresponding to `paths` of `object`.
  13616. *
  13617. * @static
  13618. * @memberOf _
  13619. * @since 1.0.0
  13620. * @category Object
  13621. * @param {Object} object The object to iterate over.
  13622. * @param {...(string|string[])} [paths] The property paths to pick.
  13623. * @returns {Array} Returns the picked values.
  13624. * @example
  13625. *
  13626. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  13627. *
  13628. * _.at(object, ['a[0].b.c', 'a[1]']);
  13629. * // => [3, 4]
  13630. */
  13631. var at = flatRest(baseAt);
  13632. /**
  13633. * Creates an object that inherits from the `prototype` object. If a
  13634. * `properties` object is given, its own enumerable string keyed properties
  13635. * are assigned to the created object.
  13636. *
  13637. * @static
  13638. * @memberOf _
  13639. * @since 2.3.0
  13640. * @category Object
  13641. * @param {Object} prototype The object to inherit from.
  13642. * @param {Object} [properties] The properties to assign to the object.
  13643. * @returns {Object} Returns the new object.
  13644. * @example
  13645. *
  13646. * function Shape() {
  13647. * this.x = 0;
  13648. * this.y = 0;
  13649. * }
  13650. *
  13651. * function Circle() {
  13652. * Shape.call(this);
  13653. * }
  13654. *
  13655. * Circle.prototype = _.create(Shape.prototype, {
  13656. * 'constructor': Circle
  13657. * });
  13658. *
  13659. * var circle = new Circle;
  13660. * circle instanceof Circle;
  13661. * // => true
  13662. *
  13663. * circle instanceof Shape;
  13664. * // => true
  13665. */
  13666. function create(prototype, properties) {
  13667. var result = baseCreate(prototype);
  13668. return properties == null ? result : baseAssign(result, properties);
  13669. }
  13670. /**
  13671. * Assigns own and inherited enumerable string keyed properties of source
  13672. * objects to the destination object for all destination properties that
  13673. * resolve to `undefined`. Source objects are applied from left to right.
  13674. * Once a property is set, additional values of the same property are ignored.
  13675. *
  13676. * **Note:** This method mutates `object`.
  13677. *
  13678. * @static
  13679. * @since 0.1.0
  13680. * @memberOf _
  13681. * @category Object
  13682. * @param {Object} object The destination object.
  13683. * @param {...Object} [sources] The source objects.
  13684. * @returns {Object} Returns `object`.
  13685. * @see _.defaultsDeep
  13686. * @example
  13687. *
  13688. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  13689. * // => { 'a': 1, 'b': 2 }
  13690. */
  13691. var defaults = baseRest(function(object, sources) {
  13692. object = Object(object);
  13693. var index = -1;
  13694. var length = sources.length;
  13695. var guard = length > 2 ? sources[2] : undefined;
  13696. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  13697. length = 1;
  13698. }
  13699. while (++index < length) {
  13700. var source = sources[index];
  13701. var props = keysIn(source);
  13702. var propsIndex = -1;
  13703. var propsLength = props.length;
  13704. while (++propsIndex < propsLength) {
  13705. var key = props[propsIndex];
  13706. var value = object[key];
  13707. if (value === undefined ||
  13708. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  13709. object[key] = source[key];
  13710. }
  13711. }
  13712. }
  13713. return object;
  13714. });
  13715. /**
  13716. * This method is like `_.defaults` except that it recursively assigns
  13717. * default properties.
  13718. *
  13719. * **Note:** This method mutates `object`.
  13720. *
  13721. * @static
  13722. * @memberOf _
  13723. * @since 3.10.0
  13724. * @category Object
  13725. * @param {Object} object The destination object.
  13726. * @param {...Object} [sources] The source objects.
  13727. * @returns {Object} Returns `object`.
  13728. * @see _.defaults
  13729. * @example
  13730. *
  13731. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  13732. * // => { 'a': { 'b': 2, 'c': 3 } }
  13733. */
  13734. var defaultsDeep = baseRest(function(args) {
  13735. args.push(undefined, customDefaultsMerge);
  13736. return apply(mergeWith, undefined, args);
  13737. });
  13738. /**
  13739. * This method is like `_.find` except that it returns the key of the first
  13740. * element `predicate` returns truthy for instead of the element itself.
  13741. *
  13742. * @static
  13743. * @memberOf _
  13744. * @since 1.1.0
  13745. * @category Object
  13746. * @param {Object} object The object to inspect.
  13747. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  13748. * @returns {string|undefined} Returns the key of the matched element,
  13749. * else `undefined`.
  13750. * @example
  13751. *
  13752. * var users = {
  13753. * 'barney': { 'age': 36, 'active': true },
  13754. * 'fred': { 'age': 40, 'active': false },
  13755. * 'pebbles': { 'age': 1, 'active': true }
  13756. * };
  13757. *
  13758. * _.findKey(users, function(o) { return o.age < 40; });
  13759. * // => 'barney' (iteration order is not guaranteed)
  13760. *
  13761. * // The `_.matches` iteratee shorthand.
  13762. * _.findKey(users, { 'age': 1, 'active': true });
  13763. * // => 'pebbles'
  13764. *
  13765. * // The `_.matchesProperty` iteratee shorthand.
  13766. * _.findKey(users, ['active', false]);
  13767. * // => 'fred'
  13768. *
  13769. * // The `_.property` iteratee shorthand.
  13770. * _.findKey(users, 'active');
  13771. * // => 'barney'
  13772. */
  13773. function findKey(object, predicate) {
  13774. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  13775. }
  13776. /**
  13777. * This method is like `_.findKey` except that it iterates over elements of
  13778. * a collection in the opposite order.
  13779. *
  13780. * @static
  13781. * @memberOf _
  13782. * @since 2.0.0
  13783. * @category Object
  13784. * @param {Object} object The object to inspect.
  13785. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  13786. * @returns {string|undefined} Returns the key of the matched element,
  13787. * else `undefined`.
  13788. * @example
  13789. *
  13790. * var users = {
  13791. * 'barney': { 'age': 36, 'active': true },
  13792. * 'fred': { 'age': 40, 'active': false },
  13793. * 'pebbles': { 'age': 1, 'active': true }
  13794. * };
  13795. *
  13796. * _.findLastKey(users, function(o) { return o.age < 40; });
  13797. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  13798. *
  13799. * // The `_.matches` iteratee shorthand.
  13800. * _.findLastKey(users, { 'age': 36, 'active': true });
  13801. * // => 'barney'
  13802. *
  13803. * // The `_.matchesProperty` iteratee shorthand.
  13804. * _.findLastKey(users, ['active', false]);
  13805. * // => 'fred'
  13806. *
  13807. * // The `_.property` iteratee shorthand.
  13808. * _.findLastKey(users, 'active');
  13809. * // => 'pebbles'
  13810. */
  13811. function findLastKey(object, predicate) {
  13812. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  13813. }
  13814. /**
  13815. * Iterates over own and inherited enumerable string keyed properties of an
  13816. * object and invokes `iteratee` for each property. The iteratee is invoked
  13817. * with three arguments: (value, key, object). Iteratee functions may exit
  13818. * iteration early by explicitly returning `false`.
  13819. *
  13820. * @static
  13821. * @memberOf _
  13822. * @since 0.3.0
  13823. * @category Object
  13824. * @param {Object} object The object to iterate over.
  13825. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13826. * @returns {Object} Returns `object`.
  13827. * @see _.forInRight
  13828. * @example
  13829. *
  13830. * function Foo() {
  13831. * this.a = 1;
  13832. * this.b = 2;
  13833. * }
  13834. *
  13835. * Foo.prototype.c = 3;
  13836. *
  13837. * _.forIn(new Foo, function(value, key) {
  13838. * console.log(key);
  13839. * });
  13840. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  13841. */
  13842. function forIn(object, iteratee) {
  13843. return object == null
  13844. ? object
  13845. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  13846. }
  13847. /**
  13848. * This method is like `_.forIn` except that it iterates over properties of
  13849. * `object` in the opposite order.
  13850. *
  13851. * @static
  13852. * @memberOf _
  13853. * @since 2.0.0
  13854. * @category Object
  13855. * @param {Object} object The object to iterate over.
  13856. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13857. * @returns {Object} Returns `object`.
  13858. * @see _.forIn
  13859. * @example
  13860. *
  13861. * function Foo() {
  13862. * this.a = 1;
  13863. * this.b = 2;
  13864. * }
  13865. *
  13866. * Foo.prototype.c = 3;
  13867. *
  13868. * _.forInRight(new Foo, function(value, key) {
  13869. * console.log(key);
  13870. * });
  13871. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  13872. */
  13873. function forInRight(object, iteratee) {
  13874. return object == null
  13875. ? object
  13876. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  13877. }
  13878. /**
  13879. * Iterates over own enumerable string keyed properties of an object and
  13880. * invokes `iteratee` for each property. The iteratee is invoked with three
  13881. * arguments: (value, key, object). Iteratee functions may exit iteration
  13882. * early by explicitly returning `false`.
  13883. *
  13884. * @static
  13885. * @memberOf _
  13886. * @since 0.3.0
  13887. * @category Object
  13888. * @param {Object} object The object to iterate over.
  13889. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13890. * @returns {Object} Returns `object`.
  13891. * @see _.forOwnRight
  13892. * @example
  13893. *
  13894. * function Foo() {
  13895. * this.a = 1;
  13896. * this.b = 2;
  13897. * }
  13898. *
  13899. * Foo.prototype.c = 3;
  13900. *
  13901. * _.forOwn(new Foo, function(value, key) {
  13902. * console.log(key);
  13903. * });
  13904. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  13905. */
  13906. function forOwn(object, iteratee) {
  13907. return object && baseForOwn(object, getIteratee(iteratee, 3));
  13908. }
  13909. /**
  13910. * This method is like `_.forOwn` except that it iterates over properties of
  13911. * `object` in the opposite order.
  13912. *
  13913. * @static
  13914. * @memberOf _
  13915. * @since 2.0.0
  13916. * @category Object
  13917. * @param {Object} object The object to iterate over.
  13918. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13919. * @returns {Object} Returns `object`.
  13920. * @see _.forOwn
  13921. * @example
  13922. *
  13923. * function Foo() {
  13924. * this.a = 1;
  13925. * this.b = 2;
  13926. * }
  13927. *
  13928. * Foo.prototype.c = 3;
  13929. *
  13930. * _.forOwnRight(new Foo, function(value, key) {
  13931. * console.log(key);
  13932. * });
  13933. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  13934. */
  13935. function forOwnRight(object, iteratee) {
  13936. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  13937. }
  13938. /**
  13939. * Creates an array of function property names from own enumerable properties
  13940. * of `object`.
  13941. *
  13942. * @static
  13943. * @since 0.1.0
  13944. * @memberOf _
  13945. * @category Object
  13946. * @param {Object} object The object to inspect.
  13947. * @returns {Array} Returns the function names.
  13948. * @see _.functionsIn
  13949. * @example
  13950. *
  13951. * function Foo() {
  13952. * this.a = _.constant('a');
  13953. * this.b = _.constant('b');
  13954. * }
  13955. *
  13956. * Foo.prototype.c = _.constant('c');
  13957. *
  13958. * _.functions(new Foo);
  13959. * // => ['a', 'b']
  13960. */
  13961. function functions(object) {
  13962. return object == null ? [] : baseFunctions(object, keys(object));
  13963. }
  13964. /**
  13965. * Creates an array of function property names from own and inherited
  13966. * enumerable properties of `object`.
  13967. *
  13968. * @static
  13969. * @memberOf _
  13970. * @since 4.0.0
  13971. * @category Object
  13972. * @param {Object} object The object to inspect.
  13973. * @returns {Array} Returns the function names.
  13974. * @see _.functions
  13975. * @example
  13976. *
  13977. * function Foo() {
  13978. * this.a = _.constant('a');
  13979. * this.b = _.constant('b');
  13980. * }
  13981. *
  13982. * Foo.prototype.c = _.constant('c');
  13983. *
  13984. * _.functionsIn(new Foo);
  13985. * // => ['a', 'b', 'c']
  13986. */
  13987. function functionsIn(object) {
  13988. return object == null ? [] : baseFunctions(object, keysIn(object));
  13989. }
  13990. /**
  13991. * Gets the value at `path` of `object`. If the resolved value is
  13992. * `undefined`, the `defaultValue` is returned in its place.
  13993. *
  13994. * @static
  13995. * @memberOf _
  13996. * @since 3.7.0
  13997. * @category Object
  13998. * @param {Object} object The object to query.
  13999. * @param {Array|string} path The path of the property to get.
  14000. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  14001. * @returns {*} Returns the resolved value.
  14002. * @example
  14003. *
  14004. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  14005. *
  14006. * _.get(object, 'a[0].b.c');
  14007. * // => 3
  14008. *
  14009. * _.get(object, ['a', '0', 'b', 'c']);
  14010. * // => 3
  14011. *
  14012. * _.get(object, 'a.b.c', 'default');
  14013. * // => 'default'
  14014. */
  14015. function get(object, path, defaultValue) {
  14016. var result = object == null ? undefined : baseGet(object, path);
  14017. return result === undefined ? defaultValue : result;
  14018. }
  14019. /**
  14020. * Checks if `path` is a direct property of `object`.
  14021. *
  14022. * @static
  14023. * @since 0.1.0
  14024. * @memberOf _
  14025. * @category Object
  14026. * @param {Object} object The object to query.
  14027. * @param {Array|string} path The path to check.
  14028. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  14029. * @example
  14030. *
  14031. * var object = { 'a': { 'b': 2 } };
  14032. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  14033. *
  14034. * _.has(object, 'a');
  14035. * // => true
  14036. *
  14037. * _.has(object, 'a.b');
  14038. * // => true
  14039. *
  14040. * _.has(object, ['a', 'b']);
  14041. * // => true
  14042. *
  14043. * _.has(other, 'a');
  14044. * // => false
  14045. */
  14046. function has(object, path) {
  14047. return object != null && hasPath(object, path, baseHas);
  14048. }
  14049. /**
  14050. * Checks if `path` is a direct or inherited property of `object`.
  14051. *
  14052. * @static
  14053. * @memberOf _
  14054. * @since 4.0.0
  14055. * @category Object
  14056. * @param {Object} object The object to query.
  14057. * @param {Array|string} path The path to check.
  14058. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  14059. * @example
  14060. *
  14061. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  14062. *
  14063. * _.hasIn(object, 'a');
  14064. * // => true
  14065. *
  14066. * _.hasIn(object, 'a.b');
  14067. * // => true
  14068. *
  14069. * _.hasIn(object, ['a', 'b']);
  14070. * // => true
  14071. *
  14072. * _.hasIn(object, 'b');
  14073. * // => false
  14074. */
  14075. function hasIn(object, path) {
  14076. return object != null && hasPath(object, path, baseHasIn);
  14077. }
  14078. /**
  14079. * Creates an object composed of the inverted keys and values of `object`.
  14080. * If `object` contains duplicate values, subsequent values overwrite
  14081. * property assignments of previous values.
  14082. *
  14083. * @static
  14084. * @memberOf _
  14085. * @since 0.7.0
  14086. * @category Object
  14087. * @param {Object} object The object to invert.
  14088. * @returns {Object} Returns the new inverted object.
  14089. * @example
  14090. *
  14091. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  14092. *
  14093. * _.invert(object);
  14094. * // => { '1': 'c', '2': 'b' }
  14095. */
  14096. var invert = createInverter(function(result, value, key) {
  14097. if (value != null &&
  14098. typeof value.toString != 'function') {
  14099. value = nativeObjectToString.call(value);
  14100. }
  14101. result[value] = key;
  14102. }, constant(identity));
  14103. /**
  14104. * This method is like `_.invert` except that the inverted object is generated
  14105. * from the results of running each element of `object` thru `iteratee`. The
  14106. * corresponding inverted value of each inverted key is an array of keys
  14107. * responsible for generating the inverted value. The iteratee is invoked
  14108. * with one argument: (value).
  14109. *
  14110. * @static
  14111. * @memberOf _
  14112. * @since 4.1.0
  14113. * @category Object
  14114. * @param {Object} object The object to invert.
  14115. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  14116. * @returns {Object} Returns the new inverted object.
  14117. * @example
  14118. *
  14119. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  14120. *
  14121. * _.invertBy(object);
  14122. * // => { '1': ['a', 'c'], '2': ['b'] }
  14123. *
  14124. * _.invertBy(object, function(value) {
  14125. * return 'group' + value;
  14126. * });
  14127. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  14128. */
  14129. var invertBy = createInverter(function(result, value, key) {
  14130. if (value != null &&
  14131. typeof value.toString != 'function') {
  14132. value = nativeObjectToString.call(value);
  14133. }
  14134. if (hasOwnProperty.call(result, value)) {
  14135. result[value].push(key);
  14136. } else {
  14137. result[value] = [key];
  14138. }
  14139. }, getIteratee);
  14140. /**
  14141. * Invokes the method at `path` of `object`.
  14142. *
  14143. * @static
  14144. * @memberOf _
  14145. * @since 4.0.0
  14146. * @category Object
  14147. * @param {Object} object The object to query.
  14148. * @param {Array|string} path The path of the method to invoke.
  14149. * @param {...*} [args] The arguments to invoke the method with.
  14150. * @returns {*} Returns the result of the invoked method.
  14151. * @example
  14152. *
  14153. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  14154. *
  14155. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  14156. * // => [2, 3]
  14157. */
  14158. var invoke = baseRest(baseInvoke);
  14159. /**
  14160. * Creates an array of the own enumerable property names of `object`.
  14161. *
  14162. * **Note:** Non-object values are coerced to objects. See the
  14163. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  14164. * for more details.
  14165. *
  14166. * @static
  14167. * @since 0.1.0
  14168. * @memberOf _
  14169. * @category Object
  14170. * @param {Object} object The object to query.
  14171. * @returns {Array} Returns the array of property names.
  14172. * @example
  14173. *
  14174. * function Foo() {
  14175. * this.a = 1;
  14176. * this.b = 2;
  14177. * }
  14178. *
  14179. * Foo.prototype.c = 3;
  14180. *
  14181. * _.keys(new Foo);
  14182. * // => ['a', 'b'] (iteration order is not guaranteed)
  14183. *
  14184. * _.keys('hi');
  14185. * // => ['0', '1']
  14186. */
  14187. function keys(object) {
  14188. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  14189. }
  14190. /**
  14191. * Creates an array of the own and inherited enumerable property names of `object`.
  14192. *
  14193. * **Note:** Non-object values are coerced to objects.
  14194. *
  14195. * @static
  14196. * @memberOf _
  14197. * @since 3.0.0
  14198. * @category Object
  14199. * @param {Object} object The object to query.
  14200. * @returns {Array} Returns the array of property names.
  14201. * @example
  14202. *
  14203. * function Foo() {
  14204. * this.a = 1;
  14205. * this.b = 2;
  14206. * }
  14207. *
  14208. * Foo.prototype.c = 3;
  14209. *
  14210. * _.keysIn(new Foo);
  14211. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  14212. */
  14213. function keysIn(object) {
  14214. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  14215. }
  14216. /**
  14217. * The opposite of `_.mapValues`; this method creates an object with the
  14218. * same values as `object` and keys generated by running each own enumerable
  14219. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  14220. * with three arguments: (value, key, object).
  14221. *
  14222. * @static
  14223. * @memberOf _
  14224. * @since 3.8.0
  14225. * @category Object
  14226. * @param {Object} object The object to iterate over.
  14227. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  14228. * @returns {Object} Returns the new mapped object.
  14229. * @see _.mapValues
  14230. * @example
  14231. *
  14232. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  14233. * return key + value;
  14234. * });
  14235. * // => { 'a1': 1, 'b2': 2 }
  14236. */
  14237. function mapKeys(object, iteratee) {
  14238. var result = {};
  14239. iteratee = getIteratee(iteratee, 3);
  14240. baseForOwn(object, function(value, key, object) {
  14241. baseAssignValue(result, iteratee(value, key, object), value);
  14242. });
  14243. return result;
  14244. }
  14245. /**
  14246. * Creates an object with the same keys as `object` and values generated
  14247. * by running each own enumerable string keyed property of `object` thru
  14248. * `iteratee`. The iteratee is invoked with three arguments:
  14249. * (value, key, object).
  14250. *
  14251. * @static
  14252. * @memberOf _
  14253. * @since 2.4.0
  14254. * @category Object
  14255. * @param {Object} object The object to iterate over.
  14256. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  14257. * @returns {Object} Returns the new mapped object.
  14258. * @see _.mapKeys
  14259. * @example
  14260. *
  14261. * var users = {
  14262. * 'fred': { 'user': 'fred', 'age': 40 },
  14263. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  14264. * };
  14265. *
  14266. * _.mapValues(users, function(o) { return o.age; });
  14267. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  14268. *
  14269. * // The `_.property` iteratee shorthand.
  14270. * _.mapValues(users, 'age');
  14271. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  14272. */
  14273. function mapValues(object, iteratee) {
  14274. var result = {};
  14275. iteratee = getIteratee(iteratee, 3);
  14276. baseForOwn(object, function(value, key, object) {
  14277. baseAssignValue(result, key, iteratee(value, key, object));
  14278. });
  14279. return result;
  14280. }
  14281. /**
  14282. * This method is like `_.assign` except that it recursively merges own and
  14283. * inherited enumerable string keyed properties of source objects into the
  14284. * destination object. Source properties that resolve to `undefined` are
  14285. * skipped if a destination value exists. Array and plain object properties
  14286. * are merged recursively. Other objects and value types are overridden by
  14287. * assignment. Source objects are applied from left to right. Subsequent
  14288. * sources overwrite property assignments of previous sources.
  14289. *
  14290. * **Note:** This method mutates `object`.
  14291. *
  14292. * @static
  14293. * @memberOf _
  14294. * @since 0.5.0
  14295. * @category Object
  14296. * @param {Object} object The destination object.
  14297. * @param {...Object} [sources] The source objects.
  14298. * @returns {Object} Returns `object`.
  14299. * @example
  14300. *
  14301. * var object = {
  14302. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  14303. * };
  14304. *
  14305. * var other = {
  14306. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  14307. * };
  14308. *
  14309. * _.merge(object, other);
  14310. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  14311. */
  14312. var merge = createAssigner(function(object, source, srcIndex) {
  14313. baseMerge(object, source, srcIndex);
  14314. });
  14315. /**
  14316. * This method is like `_.merge` except that it accepts `customizer` which
  14317. * is invoked to produce the merged values of the destination and source
  14318. * properties. If `customizer` returns `undefined`, merging is handled by the
  14319. * method instead. The `customizer` is invoked with six arguments:
  14320. * (objValue, srcValue, key, object, source, stack).
  14321. *
  14322. * **Note:** This method mutates `object`.
  14323. *
  14324. * @static
  14325. * @memberOf _
  14326. * @since 4.0.0
  14327. * @category Object
  14328. * @param {Object} object The destination object.
  14329. * @param {...Object} sources The source objects.
  14330. * @param {Function} customizer The function to customize assigned values.
  14331. * @returns {Object} Returns `object`.
  14332. * @example
  14333. *
  14334. * function customizer(objValue, srcValue) {
  14335. * if (_.isArray(objValue)) {
  14336. * return objValue.concat(srcValue);
  14337. * }
  14338. * }
  14339. *
  14340. * var object = { 'a': [1], 'b': [2] };
  14341. * var other = { 'a': [3], 'b': [4] };
  14342. *
  14343. * _.mergeWith(object, other, customizer);
  14344. * // => { 'a': [1, 3], 'b': [2, 4] }
  14345. */
  14346. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  14347. baseMerge(object, source, srcIndex, customizer);
  14348. });
  14349. /**
  14350. * The opposite of `_.pick`; this method creates an object composed of the
  14351. * own and inherited enumerable property paths of `object` that are not omitted.
  14352. *
  14353. * **Note:** This method is considerably slower than `_.pick`.
  14354. *
  14355. * @static
  14356. * @since 0.1.0
  14357. * @memberOf _
  14358. * @category Object
  14359. * @param {Object} object The source object.
  14360. * @param {...(string|string[])} [paths] The property paths to omit.
  14361. * @returns {Object} Returns the new object.
  14362. * @example
  14363. *
  14364. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  14365. *
  14366. * _.omit(object, ['a', 'c']);
  14367. * // => { 'b': '2' }
  14368. */
  14369. var omit = flatRest(function(object, paths) {
  14370. var result = {};
  14371. if (object == null) {
  14372. return result;
  14373. }
  14374. var isDeep = false;
  14375. paths = arrayMap(paths, function(path) {
  14376. path = castPath(path, object);
  14377. isDeep || (isDeep = path.length > 1);
  14378. return path;
  14379. });
  14380. copyObject(object, getAllKeysIn(object), result);
  14381. if (isDeep) {
  14382. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  14383. }
  14384. var length = paths.length;
  14385. while (length--) {
  14386. baseUnset(result, paths[length]);
  14387. }
  14388. return result;
  14389. });
  14390. /**
  14391. * The opposite of `_.pickBy`; this method creates an object composed of
  14392. * the own and inherited enumerable string keyed properties of `object` that
  14393. * `predicate` doesn't return truthy for. The predicate is invoked with two
  14394. * arguments: (value, key).
  14395. *
  14396. * @static
  14397. * @memberOf _
  14398. * @since 4.0.0
  14399. * @category Object
  14400. * @param {Object} object The source object.
  14401. * @param {Function} [predicate=_.identity] The function invoked per property.
  14402. * @returns {Object} Returns the new object.
  14403. * @example
  14404. *
  14405. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  14406. *
  14407. * _.omitBy(object, _.isNumber);
  14408. * // => { 'b': '2' }
  14409. */
  14410. function omitBy(object, predicate) {
  14411. return pickBy(object, negate(getIteratee(predicate)));
  14412. }
  14413. /**
  14414. * Creates an object composed of the picked `object` properties.
  14415. *
  14416. * @static
  14417. * @since 0.1.0
  14418. * @memberOf _
  14419. * @category Object
  14420. * @param {Object} object The source object.
  14421. * @param {...(string|string[])} [paths] The property paths to pick.
  14422. * @returns {Object} Returns the new object.
  14423. * @example
  14424. *
  14425. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  14426. *
  14427. * _.pick(object, ['a', 'c']);
  14428. * // => { 'a': 1, 'c': 3 }
  14429. */
  14430. var pick = flatRest(function(object, paths) {
  14431. return object == null ? {} : basePick(object, paths);
  14432. });
  14433. /**
  14434. * Creates an object composed of the `object` properties `predicate` returns
  14435. * truthy for. The predicate is invoked with two arguments: (value, key).
  14436. *
  14437. * @static
  14438. * @memberOf _
  14439. * @since 4.0.0
  14440. * @category Object
  14441. * @param {Object} object The source object.
  14442. * @param {Function} [predicate=_.identity] The function invoked per property.
  14443. * @returns {Object} Returns the new object.
  14444. * @example
  14445. *
  14446. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  14447. *
  14448. * _.pickBy(object, _.isNumber);
  14449. * // => { 'a': 1, 'c': 3 }
  14450. */
  14451. function pickBy(object, predicate) {
  14452. if (object == null) {
  14453. return {};
  14454. }
  14455. var props = arrayMap(getAllKeysIn(object), function(prop) {
  14456. return [prop];
  14457. });
  14458. predicate = getIteratee(predicate);
  14459. return basePickBy(object, props, function(value, path) {
  14460. return predicate(value, path[0]);
  14461. });
  14462. }
  14463. /**
  14464. * This method is like `_.get` except that if the resolved value is a
  14465. * function it's invoked with the `this` binding of its parent object and
  14466. * its result is returned.
  14467. *
  14468. * @static
  14469. * @since 0.1.0
  14470. * @memberOf _
  14471. * @category Object
  14472. * @param {Object} object The object to query.
  14473. * @param {Array|string} path The path of the property to resolve.
  14474. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  14475. * @returns {*} Returns the resolved value.
  14476. * @example
  14477. *
  14478. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  14479. *
  14480. * _.result(object, 'a[0].b.c1');
  14481. * // => 3
  14482. *
  14483. * _.result(object, 'a[0].b.c2');
  14484. * // => 4
  14485. *
  14486. * _.result(object, 'a[0].b.c3', 'default');
  14487. * // => 'default'
  14488. *
  14489. * _.result(object, 'a[0].b.c3', _.constant('default'));
  14490. * // => 'default'
  14491. */
  14492. function result(object, path, defaultValue) {
  14493. path = castPath(path, object);
  14494. var index = -1,
  14495. length = path.length;
  14496. // Ensure the loop is entered when path is empty.
  14497. if (!length) {
  14498. length = 1;
  14499. object = undefined;
  14500. }
  14501. while (++index < length) {
  14502. var value = object == null ? undefined : object[toKey(path[index])];
  14503. if (value === undefined) {
  14504. index = length;
  14505. value = defaultValue;
  14506. }
  14507. object = isFunction(value) ? value.call(object) : value;
  14508. }
  14509. return object;
  14510. }
  14511. /**
  14512. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  14513. * it's created. Arrays are created for missing index properties while objects
  14514. * are created for all other missing properties. Use `_.setWith` to customize
  14515. * `path` creation.
  14516. *
  14517. * **Note:** This method mutates `object`.
  14518. *
  14519. * @static
  14520. * @memberOf _
  14521. * @since 3.7.0
  14522. * @category Object
  14523. * @param {Object} object The object to modify.
  14524. * @param {Array|string} path The path of the property to set.
  14525. * @param {*} value The value to set.
  14526. * @returns {Object} Returns `object`.
  14527. * @example
  14528. *
  14529. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  14530. *
  14531. * _.set(object, 'a[0].b.c', 4);
  14532. * console.log(object.a[0].b.c);
  14533. * // => 4
  14534. *
  14535. * _.set(object, ['x', '0', 'y', 'z'], 5);
  14536. * console.log(object.x[0].y.z);
  14537. * // => 5
  14538. */
  14539. function set(object, path, value) {
  14540. return object == null ? object : baseSet(object, path, value);
  14541. }
  14542. /**
  14543. * This method is like `_.set` except that it accepts `customizer` which is
  14544. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  14545. * path creation is handled by the method instead. The `customizer` is invoked
  14546. * with three arguments: (nsValue, key, nsObject).
  14547. *
  14548. * **Note:** This method mutates `object`.
  14549. *
  14550. * @static
  14551. * @memberOf _
  14552. * @since 4.0.0
  14553. * @category Object
  14554. * @param {Object} object The object to modify.
  14555. * @param {Array|string} path The path of the property to set.
  14556. * @param {*} value The value to set.
  14557. * @param {Function} [customizer] The function to customize assigned values.
  14558. * @returns {Object} Returns `object`.
  14559. * @example
  14560. *
  14561. * var object = {};
  14562. *
  14563. * _.setWith(object, '[0][1]', 'a', Object);
  14564. * // => { '0': { '1': 'a' } }
  14565. */
  14566. function setWith(object, path, value, customizer) {
  14567. customizer = typeof customizer == 'function' ? customizer : undefined;
  14568. return object == null ? object : baseSet(object, path, value, customizer);
  14569. }
  14570. /**
  14571. * Creates an array of own enumerable string keyed-value pairs for `object`
  14572. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  14573. * entries are returned.
  14574. *
  14575. * @static
  14576. * @memberOf _
  14577. * @since 4.0.0
  14578. * @alias entries
  14579. * @category Object
  14580. * @param {Object} object The object to query.
  14581. * @returns {Array} Returns the key-value pairs.
  14582. * @example
  14583. *
  14584. * function Foo() {
  14585. * this.a = 1;
  14586. * this.b = 2;
  14587. * }
  14588. *
  14589. * Foo.prototype.c = 3;
  14590. *
  14591. * _.toPairs(new Foo);
  14592. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  14593. */
  14594. var toPairs = createToPairs(keys);
  14595. /**
  14596. * Creates an array of own and inherited enumerable string keyed-value pairs
  14597. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  14598. * or set, its entries are returned.
  14599. *
  14600. * @static
  14601. * @memberOf _
  14602. * @since 4.0.0
  14603. * @alias entriesIn
  14604. * @category Object
  14605. * @param {Object} object The object to query.
  14606. * @returns {Array} Returns the key-value pairs.
  14607. * @example
  14608. *
  14609. * function Foo() {
  14610. * this.a = 1;
  14611. * this.b = 2;
  14612. * }
  14613. *
  14614. * Foo.prototype.c = 3;
  14615. *
  14616. * _.toPairsIn(new Foo);
  14617. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  14618. */
  14619. var toPairsIn = createToPairs(keysIn);
  14620. /**
  14621. * An alternative to `_.reduce`; this method transforms `object` to a new
  14622. * `accumulator` object which is the result of running each of its own
  14623. * enumerable string keyed properties thru `iteratee`, with each invocation
  14624. * potentially mutating the `accumulator` object. If `accumulator` is not
  14625. * provided, a new object with the same `[[Prototype]]` will be used. The
  14626. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  14627. * Iteratee functions may exit iteration early by explicitly returning `false`.
  14628. *
  14629. * @static
  14630. * @memberOf _
  14631. * @since 1.3.0
  14632. * @category Object
  14633. * @param {Object} object The object to iterate over.
  14634. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  14635. * @param {*} [accumulator] The custom accumulator value.
  14636. * @returns {*} Returns the accumulated value.
  14637. * @example
  14638. *
  14639. * _.transform([2, 3, 4], function(result, n) {
  14640. * result.push(n *= n);
  14641. * return n % 2 == 0;
  14642. * }, []);
  14643. * // => [4, 9]
  14644. *
  14645. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  14646. * (result[value] || (result[value] = [])).push(key);
  14647. * }, {});
  14648. * // => { '1': ['a', 'c'], '2': ['b'] }
  14649. */
  14650. function transform(object, iteratee, accumulator) {
  14651. var isArr = isArray(object),
  14652. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  14653. iteratee = getIteratee(iteratee, 4);
  14654. if (accumulator == null) {
  14655. var Ctor = object && object.constructor;
  14656. if (isArrLike) {
  14657. accumulator = isArr ? new Ctor : [];
  14658. }
  14659. else if (isObject(object)) {
  14660. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  14661. }
  14662. else {
  14663. accumulator = {};
  14664. }
  14665. }
  14666. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  14667. return iteratee(accumulator, value, index, object);
  14668. });
  14669. return accumulator;
  14670. }
  14671. /**
  14672. * Removes the property at `path` of `object`.
  14673. *
  14674. * **Note:** This method mutates `object`.
  14675. *
  14676. * @static
  14677. * @memberOf _
  14678. * @since 4.0.0
  14679. * @category Object
  14680. * @param {Object} object The object to modify.
  14681. * @param {Array|string} path The path of the property to unset.
  14682. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  14683. * @example
  14684. *
  14685. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  14686. * _.unset(object, 'a[0].b.c');
  14687. * // => true
  14688. *
  14689. * console.log(object);
  14690. * // => { 'a': [{ 'b': {} }] };
  14691. *
  14692. * _.unset(object, ['a', '0', 'b', 'c']);
  14693. * // => true
  14694. *
  14695. * console.log(object);
  14696. * // => { 'a': [{ 'b': {} }] };
  14697. */
  14698. function unset(object, path) {
  14699. return object == null ? true : baseUnset(object, path);
  14700. }
  14701. /**
  14702. * This method is like `_.set` except that accepts `updater` to produce the
  14703. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  14704. * is invoked with one argument: (value).
  14705. *
  14706. * **Note:** This method mutates `object`.
  14707. *
  14708. * @static
  14709. * @memberOf _
  14710. * @since 4.6.0
  14711. * @category Object
  14712. * @param {Object} object The object to modify.
  14713. * @param {Array|string} path The path of the property to set.
  14714. * @param {Function} updater The function to produce the updated value.
  14715. * @returns {Object} Returns `object`.
  14716. * @example
  14717. *
  14718. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  14719. *
  14720. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  14721. * console.log(object.a[0].b.c);
  14722. * // => 9
  14723. *
  14724. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  14725. * console.log(object.x[0].y.z);
  14726. * // => 0
  14727. */
  14728. function update(object, path, updater) {
  14729. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  14730. }
  14731. /**
  14732. * This method is like `_.update` except that it accepts `customizer` which is
  14733. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  14734. * path creation is handled by the method instead. The `customizer` is invoked
  14735. * with three arguments: (nsValue, key, nsObject).
  14736. *
  14737. * **Note:** This method mutates `object`.
  14738. *
  14739. * @static
  14740. * @memberOf _
  14741. * @since 4.6.0
  14742. * @category Object
  14743. * @param {Object} object The object to modify.
  14744. * @param {Array|string} path The path of the property to set.
  14745. * @param {Function} updater The function to produce the updated value.
  14746. * @param {Function} [customizer] The function to customize assigned values.
  14747. * @returns {Object} Returns `object`.
  14748. * @example
  14749. *
  14750. * var object = {};
  14751. *
  14752. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  14753. * // => { '0': { '1': 'a' } }
  14754. */
  14755. function updateWith(object, path, updater, customizer) {
  14756. customizer = typeof customizer == 'function' ? customizer : undefined;
  14757. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  14758. }
  14759. /**
  14760. * Creates an array of the own enumerable string keyed property values of `object`.
  14761. *
  14762. * **Note:** Non-object values are coerced to objects.
  14763. *
  14764. * @static
  14765. * @since 0.1.0
  14766. * @memberOf _
  14767. * @category Object
  14768. * @param {Object} object The object to query.
  14769. * @returns {Array} Returns the array of property values.
  14770. * @example
  14771. *
  14772. * function Foo() {
  14773. * this.a = 1;
  14774. * this.b = 2;
  14775. * }
  14776. *
  14777. * Foo.prototype.c = 3;
  14778. *
  14779. * _.values(new Foo);
  14780. * // => [1, 2] (iteration order is not guaranteed)
  14781. *
  14782. * _.values('hi');
  14783. * // => ['h', 'i']
  14784. */
  14785. function values(object) {
  14786. return object == null ? [] : baseValues(object, keys(object));
  14787. }
  14788. /**
  14789. * Creates an array of the own and inherited enumerable string keyed property
  14790. * values of `object`.
  14791. *
  14792. * **Note:** Non-object values are coerced to objects.
  14793. *
  14794. * @static
  14795. * @memberOf _
  14796. * @since 3.0.0
  14797. * @category Object
  14798. * @param {Object} object The object to query.
  14799. * @returns {Array} Returns the array of property values.
  14800. * @example
  14801. *
  14802. * function Foo() {
  14803. * this.a = 1;
  14804. * this.b = 2;
  14805. * }
  14806. *
  14807. * Foo.prototype.c = 3;
  14808. *
  14809. * _.valuesIn(new Foo);
  14810. * // => [1, 2, 3] (iteration order is not guaranteed)
  14811. */
  14812. function valuesIn(object) {
  14813. return object == null ? [] : baseValues(object, keysIn(object));
  14814. }
  14815. /*------------------------------------------------------------------------*/
  14816. /**
  14817. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  14818. *
  14819. * @static
  14820. * @memberOf _
  14821. * @since 4.0.0
  14822. * @category Number
  14823. * @param {number} number The number to clamp.
  14824. * @param {number} [lower] The lower bound.
  14825. * @param {number} upper The upper bound.
  14826. * @returns {number} Returns the clamped number.
  14827. * @example
  14828. *
  14829. * _.clamp(-10, -5, 5);
  14830. * // => -5
  14831. *
  14832. * _.clamp(10, -5, 5);
  14833. * // => 5
  14834. */
  14835. function clamp(number, lower, upper) {
  14836. if (upper === undefined) {
  14837. upper = lower;
  14838. lower = undefined;
  14839. }
  14840. if (upper !== undefined) {
  14841. upper = toNumber(upper);
  14842. upper = upper === upper ? upper : 0;
  14843. }
  14844. if (lower !== undefined) {
  14845. lower = toNumber(lower);
  14846. lower = lower === lower ? lower : 0;
  14847. }
  14848. return baseClamp(toNumber(number), lower, upper);
  14849. }
  14850. /**
  14851. * Checks if `n` is between `start` and up to, but not including, `end`. If
  14852. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  14853. * If `start` is greater than `end` the params are swapped to support
  14854. * negative ranges.
  14855. *
  14856. * @static
  14857. * @memberOf _
  14858. * @since 3.3.0
  14859. * @category Number
  14860. * @param {number} number The number to check.
  14861. * @param {number} [start=0] The start of the range.
  14862. * @param {number} end The end of the range.
  14863. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  14864. * @see _.range, _.rangeRight
  14865. * @example
  14866. *
  14867. * _.inRange(3, 2, 4);
  14868. * // => true
  14869. *
  14870. * _.inRange(4, 8);
  14871. * // => true
  14872. *
  14873. * _.inRange(4, 2);
  14874. * // => false
  14875. *
  14876. * _.inRange(2, 2);
  14877. * // => false
  14878. *
  14879. * _.inRange(1.2, 2);
  14880. * // => true
  14881. *
  14882. * _.inRange(5.2, 4);
  14883. * // => false
  14884. *
  14885. * _.inRange(-3, -2, -6);
  14886. * // => true
  14887. */
  14888. function inRange(number, start, end) {
  14889. start = toFinite(start);
  14890. if (end === undefined) {
  14891. end = start;
  14892. start = 0;
  14893. } else {
  14894. end = toFinite(end);
  14895. }
  14896. number = toNumber(number);
  14897. return baseInRange(number, start, end);
  14898. }
  14899. /**
  14900. * Produces a random number between the inclusive `lower` and `upper` bounds.
  14901. * If only one argument is provided a number between `0` and the given number
  14902. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  14903. * floats, a floating-point number is returned instead of an integer.
  14904. *
  14905. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  14906. * floating-point values which can produce unexpected results.
  14907. *
  14908. * @static
  14909. * @memberOf _
  14910. * @since 0.7.0
  14911. * @category Number
  14912. * @param {number} [lower=0] The lower bound.
  14913. * @param {number} [upper=1] The upper bound.
  14914. * @param {boolean} [floating] Specify returning a floating-point number.
  14915. * @returns {number} Returns the random number.
  14916. * @example
  14917. *
  14918. * _.random(0, 5);
  14919. * // => an integer between 0 and 5
  14920. *
  14921. * _.random(5);
  14922. * // => also an integer between 0 and 5
  14923. *
  14924. * _.random(5, true);
  14925. * // => a floating-point number between 0 and 5
  14926. *
  14927. * _.random(1.2, 5.2);
  14928. * // => a floating-point number between 1.2 and 5.2
  14929. */
  14930. function random(lower, upper, floating) {
  14931. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  14932. upper = floating = undefined;
  14933. }
  14934. if (floating === undefined) {
  14935. if (typeof upper == 'boolean') {
  14936. floating = upper;
  14937. upper = undefined;
  14938. }
  14939. else if (typeof lower == 'boolean') {
  14940. floating = lower;
  14941. lower = undefined;
  14942. }
  14943. }
  14944. if (lower === undefined && upper === undefined) {
  14945. lower = 0;
  14946. upper = 1;
  14947. }
  14948. else {
  14949. lower = toFinite(lower);
  14950. if (upper === undefined) {
  14951. upper = lower;
  14952. lower = 0;
  14953. } else {
  14954. upper = toFinite(upper);
  14955. }
  14956. }
  14957. if (lower > upper) {
  14958. var temp = lower;
  14959. lower = upper;
  14960. upper = temp;
  14961. }
  14962. if (floating || lower % 1 || upper % 1) {
  14963. var rand = nativeRandom();
  14964. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  14965. }
  14966. return baseRandom(lower, upper);
  14967. }
  14968. /*------------------------------------------------------------------------*/
  14969. /**
  14970. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  14971. *
  14972. * @static
  14973. * @memberOf _
  14974. * @since 3.0.0
  14975. * @category String
  14976. * @param {string} [string=''] The string to convert.
  14977. * @returns {string} Returns the camel cased string.
  14978. * @example
  14979. *
  14980. * _.camelCase('Foo Bar');
  14981. * // => 'fooBar'
  14982. *
  14983. * _.camelCase('--foo-bar--');
  14984. * // => 'fooBar'
  14985. *
  14986. * _.camelCase('__FOO_BAR__');
  14987. * // => 'fooBar'
  14988. */
  14989. var camelCase = createCompounder(function(result, word, index) {
  14990. word = word.toLowerCase();
  14991. return result + (index ? capitalize(word) : word);
  14992. });
  14993. /**
  14994. * Converts the first character of `string` to upper case and the remaining
  14995. * to lower case.
  14996. *
  14997. * @static
  14998. * @memberOf _
  14999. * @since 3.0.0
  15000. * @category String
  15001. * @param {string} [string=''] The string to capitalize.
  15002. * @returns {string} Returns the capitalized string.
  15003. * @example
  15004. *
  15005. * _.capitalize('FRED');
  15006. * // => 'Fred'
  15007. */
  15008. function capitalize(string) {
  15009. return upperFirst(toString(string).toLowerCase());
  15010. }
  15011. /**
  15012. * Deburrs `string` by converting
  15013. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  15014. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  15015. * letters to basic Latin letters and removing
  15016. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  15017. *
  15018. * @static
  15019. * @memberOf _
  15020. * @since 3.0.0
  15021. * @category String
  15022. * @param {string} [string=''] The string to deburr.
  15023. * @returns {string} Returns the deburred string.
  15024. * @example
  15025. *
  15026. * _.deburr('déjà vu');
  15027. * // => 'deja vu'
  15028. */
  15029. function deburr(string) {
  15030. string = toString(string);
  15031. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  15032. }
  15033. /**
  15034. * Checks if `string` ends with the given target string.
  15035. *
  15036. * @static
  15037. * @memberOf _
  15038. * @since 3.0.0
  15039. * @category String
  15040. * @param {string} [string=''] The string to inspect.
  15041. * @param {string} [target] The string to search for.
  15042. * @param {number} [position=string.length] The position to search up to.
  15043. * @returns {boolean} Returns `true` if `string` ends with `target`,
  15044. * else `false`.
  15045. * @example
  15046. *
  15047. * _.endsWith('abc', 'c');
  15048. * // => true
  15049. *
  15050. * _.endsWith('abc', 'b');
  15051. * // => false
  15052. *
  15053. * _.endsWith('abc', 'b', 2);
  15054. * // => true
  15055. */
  15056. function endsWith(string, target, position) {
  15057. string = toString(string);
  15058. target = baseToString(target);
  15059. var length = string.length;
  15060. position = position === undefined
  15061. ? length
  15062. : baseClamp(toInteger(position), 0, length);
  15063. var end = position;
  15064. position -= target.length;
  15065. return position >= 0 && string.slice(position, end) == target;
  15066. }
  15067. /**
  15068. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  15069. * corresponding HTML entities.
  15070. *
  15071. * **Note:** No other characters are escaped. To escape additional
  15072. * characters use a third-party library like [_he_](https://mths.be/he).
  15073. *
  15074. * Though the ">" character is escaped for symmetry, characters like
  15075. * ">" and "/" don't need escaping in HTML and have no special meaning
  15076. * unless they're part of a tag or unquoted attribute value. See
  15077. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  15078. * (under "semi-related fun fact") for more details.
  15079. *
  15080. * When working with HTML you should always
  15081. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  15082. * XSS vectors.
  15083. *
  15084. * @static
  15085. * @since 0.1.0
  15086. * @memberOf _
  15087. * @category String
  15088. * @param {string} [string=''] The string to escape.
  15089. * @returns {string} Returns the escaped string.
  15090. * @example
  15091. *
  15092. * _.escape('fred, barney, & pebbles');
  15093. * // => 'fred, barney, &amp; pebbles'
  15094. */
  15095. function escape(string) {
  15096. string = toString(string);
  15097. return (string && reHasUnescapedHtml.test(string))
  15098. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  15099. : string;
  15100. }
  15101. /**
  15102. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  15103. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  15104. *
  15105. * @static
  15106. * @memberOf _
  15107. * @since 3.0.0
  15108. * @category String
  15109. * @param {string} [string=''] The string to escape.
  15110. * @returns {string} Returns the escaped string.
  15111. * @example
  15112. *
  15113. * _.escapeRegExp('[lodash](https://lodash.com/)');
  15114. * // => '\[lodash\]\(https://lodash\.com/\)'
  15115. */
  15116. function escapeRegExp(string) {
  15117. string = toString(string);
  15118. return (string && reHasRegExpChar.test(string))
  15119. ? string.replace(reRegExpChar, '\\$&')
  15120. : string;
  15121. }
  15122. /**
  15123. * Converts `string` to
  15124. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  15125. *
  15126. * @static
  15127. * @memberOf _
  15128. * @since 3.0.0
  15129. * @category String
  15130. * @param {string} [string=''] The string to convert.
  15131. * @returns {string} Returns the kebab cased string.
  15132. * @example
  15133. *
  15134. * _.kebabCase('Foo Bar');
  15135. * // => 'foo-bar'
  15136. *
  15137. * _.kebabCase('fooBar');
  15138. * // => 'foo-bar'
  15139. *
  15140. * _.kebabCase('__FOO_BAR__');
  15141. * // => 'foo-bar'
  15142. */
  15143. var kebabCase = createCompounder(function(result, word, index) {
  15144. return result + (index ? '-' : '') + word.toLowerCase();
  15145. });
  15146. /**
  15147. * Converts `string`, as space separated words, to lower case.
  15148. *
  15149. * @static
  15150. * @memberOf _
  15151. * @since 4.0.0
  15152. * @category String
  15153. * @param {string} [string=''] The string to convert.
  15154. * @returns {string} Returns the lower cased string.
  15155. * @example
  15156. *
  15157. * _.lowerCase('--Foo-Bar--');
  15158. * // => 'foo bar'
  15159. *
  15160. * _.lowerCase('fooBar');
  15161. * // => 'foo bar'
  15162. *
  15163. * _.lowerCase('__FOO_BAR__');
  15164. * // => 'foo bar'
  15165. */
  15166. var lowerCase = createCompounder(function(result, word, index) {
  15167. return result + (index ? ' ' : '') + word.toLowerCase();
  15168. });
  15169. /**
  15170. * Converts the first character of `string` to lower case.
  15171. *
  15172. * @static
  15173. * @memberOf _
  15174. * @since 4.0.0
  15175. * @category String
  15176. * @param {string} [string=''] The string to convert.
  15177. * @returns {string} Returns the converted string.
  15178. * @example
  15179. *
  15180. * _.lowerFirst('Fred');
  15181. * // => 'fred'
  15182. *
  15183. * _.lowerFirst('FRED');
  15184. * // => 'fRED'
  15185. */
  15186. var lowerFirst = createCaseFirst('toLowerCase');
  15187. /**
  15188. * Pads `string` on the left and right sides if it's shorter than `length`.
  15189. * Padding characters are truncated if they can't be evenly divided by `length`.
  15190. *
  15191. * @static
  15192. * @memberOf _
  15193. * @since 3.0.0
  15194. * @category String
  15195. * @param {string} [string=''] The string to pad.
  15196. * @param {number} [length=0] The padding length.
  15197. * @param {string} [chars=' '] The string used as padding.
  15198. * @returns {string} Returns the padded string.
  15199. * @example
  15200. *
  15201. * _.pad('abc', 8);
  15202. * // => ' abc '
  15203. *
  15204. * _.pad('abc', 8, '_-');
  15205. * // => '_-abc_-_'
  15206. *
  15207. * _.pad('abc', 3);
  15208. * // => 'abc'
  15209. */
  15210. function pad(string, length, chars) {
  15211. string = toString(string);
  15212. length = toInteger(length);
  15213. var strLength = length ? stringSize(string) : 0;
  15214. if (!length || strLength >= length) {
  15215. return string;
  15216. }
  15217. var mid = (length - strLength) / 2;
  15218. return (
  15219. createPadding(nativeFloor(mid), chars) +
  15220. string +
  15221. createPadding(nativeCeil(mid), chars)
  15222. );
  15223. }
  15224. /**
  15225. * Pads `string` on the right side if it's shorter than `length`. Padding
  15226. * characters are truncated if they exceed `length`.
  15227. *
  15228. * @static
  15229. * @memberOf _
  15230. * @since 4.0.0
  15231. * @category String
  15232. * @param {string} [string=''] The string to pad.
  15233. * @param {number} [length=0] The padding length.
  15234. * @param {string} [chars=' '] The string used as padding.
  15235. * @returns {string} Returns the padded string.
  15236. * @example
  15237. *
  15238. * _.padEnd('abc', 6);
  15239. * // => 'abc '
  15240. *
  15241. * _.padEnd('abc', 6, '_-');
  15242. * // => 'abc_-_'
  15243. *
  15244. * _.padEnd('abc', 3);
  15245. * // => 'abc'
  15246. */
  15247. function padEnd(string, length, chars) {
  15248. string = toString(string);
  15249. length = toInteger(length);
  15250. var strLength = length ? stringSize(string) : 0;
  15251. return (length && strLength < length)
  15252. ? (string + createPadding(length - strLength, chars))
  15253. : string;
  15254. }
  15255. /**
  15256. * Pads `string` on the left side if it's shorter than `length`. Padding
  15257. * characters are truncated if they exceed `length`.
  15258. *
  15259. * @static
  15260. * @memberOf _
  15261. * @since 4.0.0
  15262. * @category String
  15263. * @param {string} [string=''] The string to pad.
  15264. * @param {number} [length=0] The padding length.
  15265. * @param {string} [chars=' '] The string used as padding.
  15266. * @returns {string} Returns the padded string.
  15267. * @example
  15268. *
  15269. * _.padStart('abc', 6);
  15270. * // => ' abc'
  15271. *
  15272. * _.padStart('abc', 6, '_-');
  15273. * // => '_-_abc'
  15274. *
  15275. * _.padStart('abc', 3);
  15276. * // => 'abc'
  15277. */
  15278. function padStart(string, length, chars) {
  15279. string = toString(string);
  15280. length = toInteger(length);
  15281. var strLength = length ? stringSize(string) : 0;
  15282. return (length && strLength < length)
  15283. ? (createPadding(length - strLength, chars) + string)
  15284. : string;
  15285. }
  15286. /**
  15287. * Converts `string` to an integer of the specified radix. If `radix` is
  15288. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  15289. * hexadecimal, in which case a `radix` of `16` is used.
  15290. *
  15291. * **Note:** This method aligns with the
  15292. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  15293. *
  15294. * @static
  15295. * @memberOf _
  15296. * @since 1.1.0
  15297. * @category String
  15298. * @param {string} string The string to convert.
  15299. * @param {number} [radix=10] The radix to interpret `value` by.
  15300. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15301. * @returns {number} Returns the converted integer.
  15302. * @example
  15303. *
  15304. * _.parseInt('08');
  15305. * // => 8
  15306. *
  15307. * _.map(['6', '08', '10'], _.parseInt);
  15308. * // => [6, 8, 10]
  15309. */
  15310. function parseInt(string, radix, guard) {
  15311. if (guard || radix == null) {
  15312. radix = 0;
  15313. } else if (radix) {
  15314. radix = +radix;
  15315. }
  15316. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  15317. }
  15318. /**
  15319. * Repeats the given string `n` times.
  15320. *
  15321. * @static
  15322. * @memberOf _
  15323. * @since 3.0.0
  15324. * @category String
  15325. * @param {string} [string=''] The string to repeat.
  15326. * @param {number} [n=1] The number of times to repeat the string.
  15327. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15328. * @returns {string} Returns the repeated string.
  15329. * @example
  15330. *
  15331. * _.repeat('*', 3);
  15332. * // => '***'
  15333. *
  15334. * _.repeat('abc', 2);
  15335. * // => 'abcabc'
  15336. *
  15337. * _.repeat('abc', 0);
  15338. * // => ''
  15339. */
  15340. function repeat(string, n, guard) {
  15341. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  15342. n = 1;
  15343. } else {
  15344. n = toInteger(n);
  15345. }
  15346. return baseRepeat(toString(string), n);
  15347. }
  15348. /**
  15349. * Replaces matches for `pattern` in `string` with `replacement`.
  15350. *
  15351. * **Note:** This method is based on
  15352. * [`String#replace`](https://mdn.io/String/replace).
  15353. *
  15354. * @static
  15355. * @memberOf _
  15356. * @since 4.0.0
  15357. * @category String
  15358. * @param {string} [string=''] The string to modify.
  15359. * @param {RegExp|string} pattern The pattern to replace.
  15360. * @param {Function|string} replacement The match replacement.
  15361. * @returns {string} Returns the modified string.
  15362. * @example
  15363. *
  15364. * _.replace('Hi Fred', 'Fred', 'Barney');
  15365. * // => 'Hi Barney'
  15366. */
  15367. function replace() {
  15368. var args = arguments,
  15369. string = toString(args[0]);
  15370. return args.length < 3 ? string : string.replace(args[1], args[2]);
  15371. }
  15372. /**
  15373. * Converts `string` to
  15374. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  15375. *
  15376. * @static
  15377. * @memberOf _
  15378. * @since 3.0.0
  15379. * @category String
  15380. * @param {string} [string=''] The string to convert.
  15381. * @returns {string} Returns the snake cased string.
  15382. * @example
  15383. *
  15384. * _.snakeCase('Foo Bar');
  15385. * // => 'foo_bar'
  15386. *
  15387. * _.snakeCase('fooBar');
  15388. * // => 'foo_bar'
  15389. *
  15390. * _.snakeCase('--FOO-BAR--');
  15391. * // => 'foo_bar'
  15392. */
  15393. var snakeCase = createCompounder(function(result, word, index) {
  15394. return result + (index ? '_' : '') + word.toLowerCase();
  15395. });
  15396. /**
  15397. * Splits `string` by `separator`.
  15398. *
  15399. * **Note:** This method is based on
  15400. * [`String#split`](https://mdn.io/String/split).
  15401. *
  15402. * @static
  15403. * @memberOf _
  15404. * @since 4.0.0
  15405. * @category String
  15406. * @param {string} [string=''] The string to split.
  15407. * @param {RegExp|string} separator The separator pattern to split by.
  15408. * @param {number} [limit] The length to truncate results to.
  15409. * @returns {Array} Returns the string segments.
  15410. * @example
  15411. *
  15412. * _.split('a-b-c', '-', 2);
  15413. * // => ['a', 'b']
  15414. */
  15415. function split(string, separator, limit) {
  15416. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  15417. separator = limit = undefined;
  15418. }
  15419. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  15420. if (!limit) {
  15421. return [];
  15422. }
  15423. string = toString(string);
  15424. if (string && (
  15425. typeof separator == 'string' ||
  15426. (separator != null && !isRegExp(separator))
  15427. )) {
  15428. separator = baseToString(separator);
  15429. if (!separator && hasUnicode(string)) {
  15430. return castSlice(stringToArray(string), 0, limit);
  15431. }
  15432. }
  15433. return string.split(separator, limit);
  15434. }
  15435. /**
  15436. * Converts `string` to
  15437. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  15438. *
  15439. * @static
  15440. * @memberOf _
  15441. * @since 3.1.0
  15442. * @category String
  15443. * @param {string} [string=''] The string to convert.
  15444. * @returns {string} Returns the start cased string.
  15445. * @example
  15446. *
  15447. * _.startCase('--foo-bar--');
  15448. * // => 'Foo Bar'
  15449. *
  15450. * _.startCase('fooBar');
  15451. * // => 'Foo Bar'
  15452. *
  15453. * _.startCase('__FOO_BAR__');
  15454. * // => 'FOO BAR'
  15455. */
  15456. var startCase = createCompounder(function(result, word, index) {
  15457. return result + (index ? ' ' : '') + upperFirst(word);
  15458. });
  15459. /**
  15460. * Checks if `string` starts with the given target string.
  15461. *
  15462. * @static
  15463. * @memberOf _
  15464. * @since 3.0.0
  15465. * @category String
  15466. * @param {string} [string=''] The string to inspect.
  15467. * @param {string} [target] The string to search for.
  15468. * @param {number} [position=0] The position to search from.
  15469. * @returns {boolean} Returns `true` if `string` starts with `target`,
  15470. * else `false`.
  15471. * @example
  15472. *
  15473. * _.startsWith('abc', 'a');
  15474. * // => true
  15475. *
  15476. * _.startsWith('abc', 'b');
  15477. * // => false
  15478. *
  15479. * _.startsWith('abc', 'b', 1);
  15480. * // => true
  15481. */
  15482. function startsWith(string, target, position) {
  15483. string = toString(string);
  15484. position = position == null
  15485. ? 0
  15486. : baseClamp(toInteger(position), 0, string.length);
  15487. target = baseToString(target);
  15488. return string.slice(position, position + target.length) == target;
  15489. }
  15490. /**
  15491. * Creates a compiled template function that can interpolate data properties
  15492. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  15493. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  15494. * properties may be accessed as free variables in the template. If a setting
  15495. * object is given, it takes precedence over `_.templateSettings` values.
  15496. *
  15497. * **Note:** In the development build `_.template` utilizes
  15498. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  15499. * for easier debugging.
  15500. *
  15501. * For more information on precompiling templates see
  15502. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  15503. *
  15504. * For more information on Chrome extension sandboxes see
  15505. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  15506. *
  15507. * @static
  15508. * @since 0.1.0
  15509. * @memberOf _
  15510. * @category String
  15511. * @param {string} [string=''] The template string.
  15512. * @param {Object} [options={}] The options object.
  15513. * @param {RegExp} [options.escape=_.templateSettings.escape]
  15514. * The HTML "escape" delimiter.
  15515. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  15516. * The "evaluate" delimiter.
  15517. * @param {Object} [options.imports=_.templateSettings.imports]
  15518. * An object to import into the template as free variables.
  15519. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  15520. * The "interpolate" delimiter.
  15521. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  15522. * The sourceURL of the compiled template.
  15523. * @param {string} [options.variable='obj']
  15524. * The data object variable name.
  15525. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15526. * @returns {Function} Returns the compiled template function.
  15527. * @example
  15528. *
  15529. * // Use the "interpolate" delimiter to create a compiled template.
  15530. * var compiled = _.template('hello <%= user %>!');
  15531. * compiled({ 'user': 'fred' });
  15532. * // => 'hello fred!'
  15533. *
  15534. * // Use the HTML "escape" delimiter to escape data property values.
  15535. * var compiled = _.template('<b><%- value %></b>');
  15536. * compiled({ 'value': '<script>' });
  15537. * // => '<b>&lt;script&gt;</b>'
  15538. *
  15539. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  15540. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  15541. * compiled({ 'users': ['fred', 'barney'] });
  15542. * // => '<li>fred</li><li>barney</li>'
  15543. *
  15544. * // Use the internal `print` function in "evaluate" delimiters.
  15545. * var compiled = _.template('<% print("hello " + user); %>!');
  15546. * compiled({ 'user': 'barney' });
  15547. * // => 'hello barney!'
  15548. *
  15549. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  15550. * // Disable support by replacing the "interpolate" delimiter.
  15551. * var compiled = _.template('hello ${ user }!');
  15552. * compiled({ 'user': 'pebbles' });
  15553. * // => 'hello pebbles!'
  15554. *
  15555. * // Use backslashes to treat delimiters as plain text.
  15556. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  15557. * compiled({ 'value': 'ignored' });
  15558. * // => '<%- value %>'
  15559. *
  15560. * // Use the `imports` option to import `jQuery` as `jq`.
  15561. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  15562. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  15563. * compiled({ 'users': ['fred', 'barney'] });
  15564. * // => '<li>fred</li><li>barney</li>'
  15565. *
  15566. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  15567. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  15568. * compiled(data);
  15569. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  15570. *
  15571. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  15572. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  15573. * compiled.source;
  15574. * // => function(data) {
  15575. * // var __t, __p = '';
  15576. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  15577. * // return __p;
  15578. * // }
  15579. *
  15580. * // Use custom template delimiters.
  15581. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  15582. * var compiled = _.template('hello {{ user }}!');
  15583. * compiled({ 'user': 'mustache' });
  15584. * // => 'hello mustache!'
  15585. *
  15586. * // Use the `source` property to inline compiled templates for meaningful
  15587. * // line numbers in error messages and stack traces.
  15588. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  15589. * var JST = {\
  15590. * "main": ' + _.template(mainText).source + '\
  15591. * };\
  15592. * ');
  15593. */
  15594. function template(string, options, guard) {
  15595. // Based on John Resig's `tmpl` implementation
  15596. // (http://ejohn.org/blog/javascript-micro-templating/)
  15597. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  15598. var settings = lodash.templateSettings;
  15599. if (guard && isIterateeCall(string, options, guard)) {
  15600. options = undefined;
  15601. }
  15602. string = toString(string);
  15603. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  15604. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  15605. importsKeys = keys(imports),
  15606. importsValues = baseValues(imports, importsKeys);
  15607. var isEscaping,
  15608. isEvaluating,
  15609. index = 0,
  15610. interpolate = options.interpolate || reNoMatch,
  15611. source = "__p += '";
  15612. // Compile the regexp to match each delimiter.
  15613. var reDelimiters = RegExp(
  15614. (options.escape || reNoMatch).source + '|' +
  15615. interpolate.source + '|' +
  15616. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  15617. (options.evaluate || reNoMatch).source + '|$'
  15618. , 'g');
  15619. // Use a sourceURL for easier debugging.
  15620. // The sourceURL gets injected into the source that's eval-ed, so be careful
  15621. // to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in
  15622. // and escape the comment, thus injecting code that gets evaled.
  15623. var sourceURL = '//# sourceURL=' +
  15624. (hasOwnProperty.call(options, 'sourceURL')
  15625. ? (options.sourceURL + '').replace(/\s/g, ' ')
  15626. : ('lodash.templateSources[' + (++templateCounter) + ']')
  15627. ) + '\n';
  15628. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  15629. interpolateValue || (interpolateValue = esTemplateValue);
  15630. // Escape characters that can't be included in string literals.
  15631. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  15632. // Replace delimiters with snippets.
  15633. if (escapeValue) {
  15634. isEscaping = true;
  15635. source += "' +\n__e(" + escapeValue + ") +\n'";
  15636. }
  15637. if (evaluateValue) {
  15638. isEvaluating = true;
  15639. source += "';\n" + evaluateValue + ";\n__p += '";
  15640. }
  15641. if (interpolateValue) {
  15642. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  15643. }
  15644. index = offset + match.length;
  15645. // The JS engine embedded in Adobe products needs `match` returned in
  15646. // order to produce the correct `offset` value.
  15647. return match;
  15648. });
  15649. source += "';\n";
  15650. // If `variable` is not specified wrap a with-statement around the generated
  15651. // code to add the data object to the top of the scope chain.
  15652. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  15653. if (!variable) {
  15654. source = 'with (obj) {\n' + source + '\n}\n';
  15655. }
  15656. // Throw an error if a forbidden character was found in `variable`, to prevent
  15657. // potential command injection attacks.
  15658. else if (reForbiddenIdentifierChars.test(variable)) {
  15659. throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);
  15660. }
  15661. // Cleanup code by stripping empty strings.
  15662. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  15663. .replace(reEmptyStringMiddle, '$1')
  15664. .replace(reEmptyStringTrailing, '$1;');
  15665. // Frame code as the function body.
  15666. source = 'function(' + (variable || 'obj') + ') {\n' +
  15667. (variable
  15668. ? ''
  15669. : 'obj || (obj = {});\n'
  15670. ) +
  15671. "var __t, __p = ''" +
  15672. (isEscaping
  15673. ? ', __e = _.escape'
  15674. : ''
  15675. ) +
  15676. (isEvaluating
  15677. ? ', __j = Array.prototype.join;\n' +
  15678. "function print() { __p += __j.call(arguments, '') }\n"
  15679. : ';\n'
  15680. ) +
  15681. source +
  15682. 'return __p\n}';
  15683. var result = attempt(function() {
  15684. return Function(importsKeys, sourceURL + 'return ' + source)
  15685. .apply(undefined, importsValues);
  15686. });
  15687. // Provide the compiled function's source by its `toString` method or
  15688. // the `source` property as a convenience for inlining compiled templates.
  15689. result.source = source;
  15690. if (isError(result)) {
  15691. throw result;
  15692. }
  15693. return result;
  15694. }
  15695. /**
  15696. * Converts `string`, as a whole, to lower case just like
  15697. * [String#toLowerCase](https://mdn.io/toLowerCase).
  15698. *
  15699. * @static
  15700. * @memberOf _
  15701. * @since 4.0.0
  15702. * @category String
  15703. * @param {string} [string=''] The string to convert.
  15704. * @returns {string} Returns the lower cased string.
  15705. * @example
  15706. *
  15707. * _.toLower('--Foo-Bar--');
  15708. * // => '--foo-bar--'
  15709. *
  15710. * _.toLower('fooBar');
  15711. * // => 'foobar'
  15712. *
  15713. * _.toLower('__FOO_BAR__');
  15714. * // => '__foo_bar__'
  15715. */
  15716. function toLower(value) {
  15717. return toString(value).toLowerCase();
  15718. }
  15719. /**
  15720. * Converts `string`, as a whole, to upper case just like
  15721. * [String#toUpperCase](https://mdn.io/toUpperCase).
  15722. *
  15723. * @static
  15724. * @memberOf _
  15725. * @since 4.0.0
  15726. * @category String
  15727. * @param {string} [string=''] The string to convert.
  15728. * @returns {string} Returns the upper cased string.
  15729. * @example
  15730. *
  15731. * _.toUpper('--foo-bar--');
  15732. * // => '--FOO-BAR--'
  15733. *
  15734. * _.toUpper('fooBar');
  15735. * // => 'FOOBAR'
  15736. *
  15737. * _.toUpper('__foo_bar__');
  15738. * // => '__FOO_BAR__'
  15739. */
  15740. function toUpper(value) {
  15741. return toString(value).toUpperCase();
  15742. }
  15743. /**
  15744. * Removes leading and trailing whitespace or specified characters from `string`.
  15745. *
  15746. * @static
  15747. * @memberOf _
  15748. * @since 3.0.0
  15749. * @category String
  15750. * @param {string} [string=''] The string to trim.
  15751. * @param {string} [chars=whitespace] The characters to trim.
  15752. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15753. * @returns {string} Returns the trimmed string.
  15754. * @example
  15755. *
  15756. * _.trim(' abc ');
  15757. * // => 'abc'
  15758. *
  15759. * _.trim('-_-abc-_-', '_-');
  15760. * // => 'abc'
  15761. *
  15762. * _.map([' foo ', ' bar '], _.trim);
  15763. * // => ['foo', 'bar']
  15764. */
  15765. function trim(string, chars, guard) {
  15766. string = toString(string);
  15767. if (string && (guard || chars === undefined)) {
  15768. return baseTrim(string);
  15769. }
  15770. if (!string || !(chars = baseToString(chars))) {
  15771. return string;
  15772. }
  15773. var strSymbols = stringToArray(string),
  15774. chrSymbols = stringToArray(chars),
  15775. start = charsStartIndex(strSymbols, chrSymbols),
  15776. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  15777. return castSlice(strSymbols, start, end).join('');
  15778. }
  15779. /**
  15780. * Removes trailing whitespace or specified characters from `string`.
  15781. *
  15782. * @static
  15783. * @memberOf _
  15784. * @since 4.0.0
  15785. * @category String
  15786. * @param {string} [string=''] The string to trim.
  15787. * @param {string} [chars=whitespace] The characters to trim.
  15788. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15789. * @returns {string} Returns the trimmed string.
  15790. * @example
  15791. *
  15792. * _.trimEnd(' abc ');
  15793. * // => ' abc'
  15794. *
  15795. * _.trimEnd('-_-abc-_-', '_-');
  15796. * // => '-_-abc'
  15797. */
  15798. function trimEnd(string, chars, guard) {
  15799. string = toString(string);
  15800. if (string && (guard || chars === undefined)) {
  15801. return string.slice(0, trimmedEndIndex(string) + 1);
  15802. }
  15803. if (!string || !(chars = baseToString(chars))) {
  15804. return string;
  15805. }
  15806. var strSymbols = stringToArray(string),
  15807. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  15808. return castSlice(strSymbols, 0, end).join('');
  15809. }
  15810. /**
  15811. * Removes leading whitespace or specified characters from `string`.
  15812. *
  15813. * @static
  15814. * @memberOf _
  15815. * @since 4.0.0
  15816. * @category String
  15817. * @param {string} [string=''] The string to trim.
  15818. * @param {string} [chars=whitespace] The characters to trim.
  15819. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15820. * @returns {string} Returns the trimmed string.
  15821. * @example
  15822. *
  15823. * _.trimStart(' abc ');
  15824. * // => 'abc '
  15825. *
  15826. * _.trimStart('-_-abc-_-', '_-');
  15827. * // => 'abc-_-'
  15828. */
  15829. function trimStart(string, chars, guard) {
  15830. string = toString(string);
  15831. if (string && (guard || chars === undefined)) {
  15832. return string.replace(reTrimStart, '');
  15833. }
  15834. if (!string || !(chars = baseToString(chars))) {
  15835. return string;
  15836. }
  15837. var strSymbols = stringToArray(string),
  15838. start = charsStartIndex(strSymbols, stringToArray(chars));
  15839. return castSlice(strSymbols, start).join('');
  15840. }
  15841. /**
  15842. * Truncates `string` if it's longer than the given maximum string length.
  15843. * The last characters of the truncated string are replaced with the omission
  15844. * string which defaults to "...".
  15845. *
  15846. * @static
  15847. * @memberOf _
  15848. * @since 4.0.0
  15849. * @category String
  15850. * @param {string} [string=''] The string to truncate.
  15851. * @param {Object} [options={}] The options object.
  15852. * @param {number} [options.length=30] The maximum string length.
  15853. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  15854. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  15855. * @returns {string} Returns the truncated string.
  15856. * @example
  15857. *
  15858. * _.truncate('hi-diddly-ho there, neighborino');
  15859. * // => 'hi-diddly-ho there, neighbo...'
  15860. *
  15861. * _.truncate('hi-diddly-ho there, neighborino', {
  15862. * 'length': 24,
  15863. * 'separator': ' '
  15864. * });
  15865. * // => 'hi-diddly-ho there,...'
  15866. *
  15867. * _.truncate('hi-diddly-ho there, neighborino', {
  15868. * 'length': 24,
  15869. * 'separator': /,? +/
  15870. * });
  15871. * // => 'hi-diddly-ho there...'
  15872. *
  15873. * _.truncate('hi-diddly-ho there, neighborino', {
  15874. * 'omission': ' [...]'
  15875. * });
  15876. * // => 'hi-diddly-ho there, neig [...]'
  15877. */
  15878. function truncate(string, options) {
  15879. var length = DEFAULT_TRUNC_LENGTH,
  15880. omission = DEFAULT_TRUNC_OMISSION;
  15881. if (isObject(options)) {
  15882. var separator = 'separator' in options ? options.separator : separator;
  15883. length = 'length' in options ? toInteger(options.length) : length;
  15884. omission = 'omission' in options ? baseToString(options.omission) : omission;
  15885. }
  15886. string = toString(string);
  15887. var strLength = string.length;
  15888. if (hasUnicode(string)) {
  15889. var strSymbols = stringToArray(string);
  15890. strLength = strSymbols.length;
  15891. }
  15892. if (length >= strLength) {
  15893. return string;
  15894. }
  15895. var end = length - stringSize(omission);
  15896. if (end < 1) {
  15897. return omission;
  15898. }
  15899. var result = strSymbols
  15900. ? castSlice(strSymbols, 0, end).join('')
  15901. : string.slice(0, end);
  15902. if (separator === undefined) {
  15903. return result + omission;
  15904. }
  15905. if (strSymbols) {
  15906. end += (result.length - end);
  15907. }
  15908. if (isRegExp(separator)) {
  15909. if (string.slice(end).search(separator)) {
  15910. var match,
  15911. substring = result;
  15912. if (!separator.global) {
  15913. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  15914. }
  15915. separator.lastIndex = 0;
  15916. while ((match = separator.exec(substring))) {
  15917. var newEnd = match.index;
  15918. }
  15919. result = result.slice(0, newEnd === undefined ? end : newEnd);
  15920. }
  15921. } else if (string.indexOf(baseToString(separator), end) != end) {
  15922. var index = result.lastIndexOf(separator);
  15923. if (index > -1) {
  15924. result = result.slice(0, index);
  15925. }
  15926. }
  15927. return result + omission;
  15928. }
  15929. /**
  15930. * The inverse of `_.escape`; this method converts the HTML entities
  15931. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  15932. * their corresponding characters.
  15933. *
  15934. * **Note:** No other HTML entities are unescaped. To unescape additional
  15935. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  15936. *
  15937. * @static
  15938. * @memberOf _
  15939. * @since 0.6.0
  15940. * @category String
  15941. * @param {string} [string=''] The string to unescape.
  15942. * @returns {string} Returns the unescaped string.
  15943. * @example
  15944. *
  15945. * _.unescape('fred, barney, &amp; pebbles');
  15946. * // => 'fred, barney, & pebbles'
  15947. */
  15948. function unescape(string) {
  15949. string = toString(string);
  15950. return (string && reHasEscapedHtml.test(string))
  15951. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  15952. : string;
  15953. }
  15954. /**
  15955. * Converts `string`, as space separated words, to upper case.
  15956. *
  15957. * @static
  15958. * @memberOf _
  15959. * @since 4.0.0
  15960. * @category String
  15961. * @param {string} [string=''] The string to convert.
  15962. * @returns {string} Returns the upper cased string.
  15963. * @example
  15964. *
  15965. * _.upperCase('--foo-bar');
  15966. * // => 'FOO BAR'
  15967. *
  15968. * _.upperCase('fooBar');
  15969. * // => 'FOO BAR'
  15970. *
  15971. * _.upperCase('__foo_bar__');
  15972. * // => 'FOO BAR'
  15973. */
  15974. var upperCase = createCompounder(function(result, word, index) {
  15975. return result + (index ? ' ' : '') + word.toUpperCase();
  15976. });
  15977. /**
  15978. * Converts the first character of `string` to upper case.
  15979. *
  15980. * @static
  15981. * @memberOf _
  15982. * @since 4.0.0
  15983. * @category String
  15984. * @param {string} [string=''] The string to convert.
  15985. * @returns {string} Returns the converted string.
  15986. * @example
  15987. *
  15988. * _.upperFirst('fred');
  15989. * // => 'Fred'
  15990. *
  15991. * _.upperFirst('FRED');
  15992. * // => 'FRED'
  15993. */
  15994. var upperFirst = createCaseFirst('toUpperCase');
  15995. /**
  15996. * Splits `string` into an array of its words.
  15997. *
  15998. * @static
  15999. * @memberOf _
  16000. * @since 3.0.0
  16001. * @category String
  16002. * @param {string} [string=''] The string to inspect.
  16003. * @param {RegExp|string} [pattern] The pattern to match words.
  16004. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  16005. * @returns {Array} Returns the words of `string`.
  16006. * @example
  16007. *
  16008. * _.words('fred, barney, & pebbles');
  16009. * // => ['fred', 'barney', 'pebbles']
  16010. *
  16011. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  16012. * // => ['fred', 'barney', '&', 'pebbles']
  16013. */
  16014. function words(string, pattern, guard) {
  16015. string = toString(string);
  16016. pattern = guard ? undefined : pattern;
  16017. if (pattern === undefined) {
  16018. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  16019. }
  16020. return string.match(pattern) || [];
  16021. }
  16022. /*------------------------------------------------------------------------*/
  16023. /**
  16024. * Attempts to invoke `func`, returning either the result or the caught error
  16025. * object. Any additional arguments are provided to `func` when it's invoked.
  16026. *
  16027. * @static
  16028. * @memberOf _
  16029. * @since 3.0.0
  16030. * @category Util
  16031. * @param {Function} func The function to attempt.
  16032. * @param {...*} [args] The arguments to invoke `func` with.
  16033. * @returns {*} Returns the `func` result or error object.
  16034. * @example
  16035. *
  16036. * // Avoid throwing errors for invalid selectors.
  16037. * var elements = _.attempt(function(selector) {
  16038. * return document.querySelectorAll(selector);
  16039. * }, '>_>');
  16040. *
  16041. * if (_.isError(elements)) {
  16042. * elements = [];
  16043. * }
  16044. */
  16045. var attempt = baseRest(function(func, args) {
  16046. try {
  16047. return apply(func, undefined, args);
  16048. } catch (e) {
  16049. return isError(e) ? e : new Error(e);
  16050. }
  16051. });
  16052. /**
  16053. * Binds methods of an object to the object itself, overwriting the existing
  16054. * method.
  16055. *
  16056. * **Note:** This method doesn't set the "length" property of bound functions.
  16057. *
  16058. * @static
  16059. * @since 0.1.0
  16060. * @memberOf _
  16061. * @category Util
  16062. * @param {Object} object The object to bind and assign the bound methods to.
  16063. * @param {...(string|string[])} methodNames The object method names to bind.
  16064. * @returns {Object} Returns `object`.
  16065. * @example
  16066. *
  16067. * var view = {
  16068. * 'label': 'docs',
  16069. * 'click': function() {
  16070. * console.log('clicked ' + this.label);
  16071. * }
  16072. * };
  16073. *
  16074. * _.bindAll(view, ['click']);
  16075. * jQuery(element).on('click', view.click);
  16076. * // => Logs 'clicked docs' when clicked.
  16077. */
  16078. var bindAll = flatRest(function(object, methodNames) {
  16079. arrayEach(methodNames, function(key) {
  16080. key = toKey(key);
  16081. baseAssignValue(object, key, bind(object[key], object));
  16082. });
  16083. return object;
  16084. });
  16085. /**
  16086. * Creates a function that iterates over `pairs` and invokes the corresponding
  16087. * function of the first predicate to return truthy. The predicate-function
  16088. * pairs are invoked with the `this` binding and arguments of the created
  16089. * function.
  16090. *
  16091. * @static
  16092. * @memberOf _
  16093. * @since 4.0.0
  16094. * @category Util
  16095. * @param {Array} pairs The predicate-function pairs.
  16096. * @returns {Function} Returns the new composite function.
  16097. * @example
  16098. *
  16099. * var func = _.cond([
  16100. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  16101. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  16102. * [_.stubTrue, _.constant('no match')]
  16103. * ]);
  16104. *
  16105. * func({ 'a': 1, 'b': 2 });
  16106. * // => 'matches A'
  16107. *
  16108. * func({ 'a': 0, 'b': 1 });
  16109. * // => 'matches B'
  16110. *
  16111. * func({ 'a': '1', 'b': '2' });
  16112. * // => 'no match'
  16113. */
  16114. function cond(pairs) {
  16115. var length = pairs == null ? 0 : pairs.length,
  16116. toIteratee = getIteratee();
  16117. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  16118. if (typeof pair[1] != 'function') {
  16119. throw new TypeError(FUNC_ERROR_TEXT);
  16120. }
  16121. return [toIteratee(pair[0]), pair[1]];
  16122. });
  16123. return baseRest(function(args) {
  16124. var index = -1;
  16125. while (++index < length) {
  16126. var pair = pairs[index];
  16127. if (apply(pair[0], this, args)) {
  16128. return apply(pair[1], this, args);
  16129. }
  16130. }
  16131. });
  16132. }
  16133. /**
  16134. * Creates a function that invokes the predicate properties of `source` with
  16135. * the corresponding property values of a given object, returning `true` if
  16136. * all predicates return truthy, else `false`.
  16137. *
  16138. * **Note:** The created function is equivalent to `_.conformsTo` with
  16139. * `source` partially applied.
  16140. *
  16141. * @static
  16142. * @memberOf _
  16143. * @since 4.0.0
  16144. * @category Util
  16145. * @param {Object} source The object of property predicates to conform to.
  16146. * @returns {Function} Returns the new spec function.
  16147. * @example
  16148. *
  16149. * var objects = [
  16150. * { 'a': 2, 'b': 1 },
  16151. * { 'a': 1, 'b': 2 }
  16152. * ];
  16153. *
  16154. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  16155. * // => [{ 'a': 1, 'b': 2 }]
  16156. */
  16157. function conforms(source) {
  16158. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  16159. }
  16160. /**
  16161. * Creates a function that returns `value`.
  16162. *
  16163. * @static
  16164. * @memberOf _
  16165. * @since 2.4.0
  16166. * @category Util
  16167. * @param {*} value The value to return from the new function.
  16168. * @returns {Function} Returns the new constant function.
  16169. * @example
  16170. *
  16171. * var objects = _.times(2, _.constant({ 'a': 1 }));
  16172. *
  16173. * console.log(objects);
  16174. * // => [{ 'a': 1 }, { 'a': 1 }]
  16175. *
  16176. * console.log(objects[0] === objects[1]);
  16177. * // => true
  16178. */
  16179. function constant(value) {
  16180. return function() {
  16181. return value;
  16182. };
  16183. }
  16184. /**
  16185. * Checks `value` to determine whether a default value should be returned in
  16186. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  16187. * or `undefined`.
  16188. *
  16189. * @static
  16190. * @memberOf _
  16191. * @since 4.14.0
  16192. * @category Util
  16193. * @param {*} value The value to check.
  16194. * @param {*} defaultValue The default value.
  16195. * @returns {*} Returns the resolved value.
  16196. * @example
  16197. *
  16198. * _.defaultTo(1, 10);
  16199. * // => 1
  16200. *
  16201. * _.defaultTo(undefined, 10);
  16202. * // => 10
  16203. */
  16204. function defaultTo(value, defaultValue) {
  16205. return (value == null || value !== value) ? defaultValue : value;
  16206. }
  16207. /**
  16208. * Creates a function that returns the result of invoking the given functions
  16209. * with the `this` binding of the created function, where each successive
  16210. * invocation is supplied the return value of the previous.
  16211. *
  16212. * @static
  16213. * @memberOf _
  16214. * @since 3.0.0
  16215. * @category Util
  16216. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  16217. * @returns {Function} Returns the new composite function.
  16218. * @see _.flowRight
  16219. * @example
  16220. *
  16221. * function square(n) {
  16222. * return n * n;
  16223. * }
  16224. *
  16225. * var addSquare = _.flow([_.add, square]);
  16226. * addSquare(1, 2);
  16227. * // => 9
  16228. */
  16229. var flow = createFlow();
  16230. /**
  16231. * This method is like `_.flow` except that it creates a function that
  16232. * invokes the given functions from right to left.
  16233. *
  16234. * @static
  16235. * @since 3.0.0
  16236. * @memberOf _
  16237. * @category Util
  16238. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  16239. * @returns {Function} Returns the new composite function.
  16240. * @see _.flow
  16241. * @example
  16242. *
  16243. * function square(n) {
  16244. * return n * n;
  16245. * }
  16246. *
  16247. * var addSquare = _.flowRight([square, _.add]);
  16248. * addSquare(1, 2);
  16249. * // => 9
  16250. */
  16251. var flowRight = createFlow(true);
  16252. /**
  16253. * This method returns the first argument it receives.
  16254. *
  16255. * @static
  16256. * @since 0.1.0
  16257. * @memberOf _
  16258. * @category Util
  16259. * @param {*} value Any value.
  16260. * @returns {*} Returns `value`.
  16261. * @example
  16262. *
  16263. * var object = { 'a': 1 };
  16264. *
  16265. * console.log(_.identity(object) === object);
  16266. * // => true
  16267. */
  16268. function identity(value) {
  16269. return value;
  16270. }
  16271. /**
  16272. * Creates a function that invokes `func` with the arguments of the created
  16273. * function. If `func` is a property name, the created function returns the
  16274. * property value for a given element. If `func` is an array or object, the
  16275. * created function returns `true` for elements that contain the equivalent
  16276. * source properties, otherwise it returns `false`.
  16277. *
  16278. * @static
  16279. * @since 4.0.0
  16280. * @memberOf _
  16281. * @category Util
  16282. * @param {*} [func=_.identity] The value to convert to a callback.
  16283. * @returns {Function} Returns the callback.
  16284. * @example
  16285. *
  16286. * var users = [
  16287. * { 'user': 'barney', 'age': 36, 'active': true },
  16288. * { 'user': 'fred', 'age': 40, 'active': false }
  16289. * ];
  16290. *
  16291. * // The `_.matches` iteratee shorthand.
  16292. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  16293. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  16294. *
  16295. * // The `_.matchesProperty` iteratee shorthand.
  16296. * _.filter(users, _.iteratee(['user', 'fred']));
  16297. * // => [{ 'user': 'fred', 'age': 40 }]
  16298. *
  16299. * // The `_.property` iteratee shorthand.
  16300. * _.map(users, _.iteratee('user'));
  16301. * // => ['barney', 'fred']
  16302. *
  16303. * // Create custom iteratee shorthands.
  16304. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  16305. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  16306. * return func.test(string);
  16307. * };
  16308. * });
  16309. *
  16310. * _.filter(['abc', 'def'], /ef/);
  16311. * // => ['def']
  16312. */
  16313. function iteratee(func) {
  16314. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  16315. }
  16316. /**
  16317. * Creates a function that performs a partial deep comparison between a given
  16318. * object and `source`, returning `true` if the given object has equivalent
  16319. * property values, else `false`.
  16320. *
  16321. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  16322. * partially applied.
  16323. *
  16324. * Partial comparisons will match empty array and empty object `source`
  16325. * values against any array or object value, respectively. See `_.isEqual`
  16326. * for a list of supported value comparisons.
  16327. *
  16328. * **Note:** Multiple values can be checked by combining several matchers
  16329. * using `_.overSome`
  16330. *
  16331. * @static
  16332. * @memberOf _
  16333. * @since 3.0.0
  16334. * @category Util
  16335. * @param {Object} source The object of property values to match.
  16336. * @returns {Function} Returns the new spec function.
  16337. * @example
  16338. *
  16339. * var objects = [
  16340. * { 'a': 1, 'b': 2, 'c': 3 },
  16341. * { 'a': 4, 'b': 5, 'c': 6 }
  16342. * ];
  16343. *
  16344. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  16345. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  16346. *
  16347. * // Checking for several possible values
  16348. * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));
  16349. * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
  16350. */
  16351. function matches(source) {
  16352. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  16353. }
  16354. /**
  16355. * Creates a function that performs a partial deep comparison between the
  16356. * value at `path` of a given object to `srcValue`, returning `true` if the
  16357. * object value is equivalent, else `false`.
  16358. *
  16359. * **Note:** Partial comparisons will match empty array and empty object
  16360. * `srcValue` values against any array or object value, respectively. See
  16361. * `_.isEqual` for a list of supported value comparisons.
  16362. *
  16363. * **Note:** Multiple values can be checked by combining several matchers
  16364. * using `_.overSome`
  16365. *
  16366. * @static
  16367. * @memberOf _
  16368. * @since 3.2.0
  16369. * @category Util
  16370. * @param {Array|string} path The path of the property to get.
  16371. * @param {*} srcValue The value to match.
  16372. * @returns {Function} Returns the new spec function.
  16373. * @example
  16374. *
  16375. * var objects = [
  16376. * { 'a': 1, 'b': 2, 'c': 3 },
  16377. * { 'a': 4, 'b': 5, 'c': 6 }
  16378. * ];
  16379. *
  16380. * _.find(objects, _.matchesProperty('a', 4));
  16381. * // => { 'a': 4, 'b': 5, 'c': 6 }
  16382. *
  16383. * // Checking for several possible values
  16384. * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)]));
  16385. * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
  16386. */
  16387. function matchesProperty(path, srcValue) {
  16388. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  16389. }
  16390. /**
  16391. * Creates a function that invokes the method at `path` of a given object.
  16392. * Any additional arguments are provided to the invoked method.
  16393. *
  16394. * @static
  16395. * @memberOf _
  16396. * @since 3.7.0
  16397. * @category Util
  16398. * @param {Array|string} path The path of the method to invoke.
  16399. * @param {...*} [args] The arguments to invoke the method with.
  16400. * @returns {Function} Returns the new invoker function.
  16401. * @example
  16402. *
  16403. * var objects = [
  16404. * { 'a': { 'b': _.constant(2) } },
  16405. * { 'a': { 'b': _.constant(1) } }
  16406. * ];
  16407. *
  16408. * _.map(objects, _.method('a.b'));
  16409. * // => [2, 1]
  16410. *
  16411. * _.map(objects, _.method(['a', 'b']));
  16412. * // => [2, 1]
  16413. */
  16414. var method = baseRest(function(path, args) {
  16415. return function(object) {
  16416. return baseInvoke(object, path, args);
  16417. };
  16418. });
  16419. /**
  16420. * The opposite of `_.method`; this method creates a function that invokes
  16421. * the method at a given path of `object`. Any additional arguments are
  16422. * provided to the invoked method.
  16423. *
  16424. * @static
  16425. * @memberOf _
  16426. * @since 3.7.0
  16427. * @category Util
  16428. * @param {Object} object The object to query.
  16429. * @param {...*} [args] The arguments to invoke the method with.
  16430. * @returns {Function} Returns the new invoker function.
  16431. * @example
  16432. *
  16433. * var array = _.times(3, _.constant),
  16434. * object = { 'a': array, 'b': array, 'c': array };
  16435. *
  16436. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  16437. * // => [2, 0]
  16438. *
  16439. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  16440. * // => [2, 0]
  16441. */
  16442. var methodOf = baseRest(function(object, args) {
  16443. return function(path) {
  16444. return baseInvoke(object, path, args);
  16445. };
  16446. });
  16447. /**
  16448. * Adds all own enumerable string keyed function properties of a source
  16449. * object to the destination object. If `object` is a function, then methods
  16450. * are added to its prototype as well.
  16451. *
  16452. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  16453. * avoid conflicts caused by modifying the original.
  16454. *
  16455. * @static
  16456. * @since 0.1.0
  16457. * @memberOf _
  16458. * @category Util
  16459. * @param {Function|Object} [object=lodash] The destination object.
  16460. * @param {Object} source The object of functions to add.
  16461. * @param {Object} [options={}] The options object.
  16462. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  16463. * @returns {Function|Object} Returns `object`.
  16464. * @example
  16465. *
  16466. * function vowels(string) {
  16467. * return _.filter(string, function(v) {
  16468. * return /[aeiou]/i.test(v);
  16469. * });
  16470. * }
  16471. *
  16472. * _.mixin({ 'vowels': vowels });
  16473. * _.vowels('fred');
  16474. * // => ['e']
  16475. *
  16476. * _('fred').vowels().value();
  16477. * // => ['e']
  16478. *
  16479. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  16480. * _('fred').vowels();
  16481. * // => ['e']
  16482. */
  16483. function mixin(object, source, options) {
  16484. var props = keys(source),
  16485. methodNames = baseFunctions(source, props);
  16486. if (options == null &&
  16487. !(isObject(source) && (methodNames.length || !props.length))) {
  16488. options = source;
  16489. source = object;
  16490. object = this;
  16491. methodNames = baseFunctions(source, keys(source));
  16492. }
  16493. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  16494. isFunc = isFunction(object);
  16495. arrayEach(methodNames, function(methodName) {
  16496. var func = source[methodName];
  16497. object[methodName] = func;
  16498. if (isFunc) {
  16499. object.prototype[methodName] = function() {
  16500. var chainAll = this.__chain__;
  16501. if (chain || chainAll) {
  16502. var result = object(this.__wrapped__),
  16503. actions = result.__actions__ = copyArray(this.__actions__);
  16504. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  16505. result.__chain__ = chainAll;
  16506. return result;
  16507. }
  16508. return func.apply(object, arrayPush([this.value()], arguments));
  16509. };
  16510. }
  16511. });
  16512. return object;
  16513. }
  16514. /**
  16515. * Reverts the `_` variable to its previous value and returns a reference to
  16516. * the `lodash` function.
  16517. *
  16518. * @static
  16519. * @since 0.1.0
  16520. * @memberOf _
  16521. * @category Util
  16522. * @returns {Function} Returns the `lodash` function.
  16523. * @example
  16524. *
  16525. * var lodash = _.noConflict();
  16526. */
  16527. function noConflict() {
  16528. if (root._ === this) {
  16529. root._ = oldDash;
  16530. }
  16531. return this;
  16532. }
  16533. /**
  16534. * This method returns `undefined`.
  16535. *
  16536. * @static
  16537. * @memberOf _
  16538. * @since 2.3.0
  16539. * @category Util
  16540. * @example
  16541. *
  16542. * _.times(2, _.noop);
  16543. * // => [undefined, undefined]
  16544. */
  16545. function noop() {
  16546. // No operation performed.
  16547. }
  16548. /**
  16549. * Creates a function that gets the argument at index `n`. If `n` is negative,
  16550. * the nth argument from the end is returned.
  16551. *
  16552. * @static
  16553. * @memberOf _
  16554. * @since 4.0.0
  16555. * @category Util
  16556. * @param {number} [n=0] The index of the argument to return.
  16557. * @returns {Function} Returns the new pass-thru function.
  16558. * @example
  16559. *
  16560. * var func = _.nthArg(1);
  16561. * func('a', 'b', 'c', 'd');
  16562. * // => 'b'
  16563. *
  16564. * var func = _.nthArg(-2);
  16565. * func('a', 'b', 'c', 'd');
  16566. * // => 'c'
  16567. */
  16568. function nthArg(n) {
  16569. n = toInteger(n);
  16570. return baseRest(function(args) {
  16571. return baseNth(args, n);
  16572. });
  16573. }
  16574. /**
  16575. * Creates a function that invokes `iteratees` with the arguments it receives
  16576. * and returns their results.
  16577. *
  16578. * @static
  16579. * @memberOf _
  16580. * @since 4.0.0
  16581. * @category Util
  16582. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  16583. * The iteratees to invoke.
  16584. * @returns {Function} Returns the new function.
  16585. * @example
  16586. *
  16587. * var func = _.over([Math.max, Math.min]);
  16588. *
  16589. * func(1, 2, 3, 4);
  16590. * // => [4, 1]
  16591. */
  16592. var over = createOver(arrayMap);
  16593. /**
  16594. * Creates a function that checks if **all** of the `predicates` return
  16595. * truthy when invoked with the arguments it receives.
  16596. *
  16597. * Following shorthands are possible for providing predicates.
  16598. * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
  16599. * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
  16600. *
  16601. * @static
  16602. * @memberOf _
  16603. * @since 4.0.0
  16604. * @category Util
  16605. * @param {...(Function|Function[])} [predicates=[_.identity]]
  16606. * The predicates to check.
  16607. * @returns {Function} Returns the new function.
  16608. * @example
  16609. *
  16610. * var func = _.overEvery([Boolean, isFinite]);
  16611. *
  16612. * func('1');
  16613. * // => true
  16614. *
  16615. * func(null);
  16616. * // => false
  16617. *
  16618. * func(NaN);
  16619. * // => false
  16620. */
  16621. var overEvery = createOver(arrayEvery);
  16622. /**
  16623. * Creates a function that checks if **any** of the `predicates` return
  16624. * truthy when invoked with the arguments it receives.
  16625. *
  16626. * Following shorthands are possible for providing predicates.
  16627. * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
  16628. * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
  16629. *
  16630. * @static
  16631. * @memberOf _
  16632. * @since 4.0.0
  16633. * @category Util
  16634. * @param {...(Function|Function[])} [predicates=[_.identity]]
  16635. * The predicates to check.
  16636. * @returns {Function} Returns the new function.
  16637. * @example
  16638. *
  16639. * var func = _.overSome([Boolean, isFinite]);
  16640. *
  16641. * func('1');
  16642. * // => true
  16643. *
  16644. * func(null);
  16645. * // => true
  16646. *
  16647. * func(NaN);
  16648. * // => false
  16649. *
  16650. * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }])
  16651. * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]])
  16652. */
  16653. var overSome = createOver(arraySome);
  16654. /**
  16655. * Creates a function that returns the value at `path` of a given object.
  16656. *
  16657. * @static
  16658. * @memberOf _
  16659. * @since 2.4.0
  16660. * @category Util
  16661. * @param {Array|string} path The path of the property to get.
  16662. * @returns {Function} Returns the new accessor function.
  16663. * @example
  16664. *
  16665. * var objects = [
  16666. * { 'a': { 'b': 2 } },
  16667. * { 'a': { 'b': 1 } }
  16668. * ];
  16669. *
  16670. * _.map(objects, _.property('a.b'));
  16671. * // => [2, 1]
  16672. *
  16673. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  16674. * // => [1, 2]
  16675. */
  16676. function property(path) {
  16677. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  16678. }
  16679. /**
  16680. * The opposite of `_.property`; this method creates a function that returns
  16681. * the value at a given path of `object`.
  16682. *
  16683. * @static
  16684. * @memberOf _
  16685. * @since 3.0.0
  16686. * @category Util
  16687. * @param {Object} object The object to query.
  16688. * @returns {Function} Returns the new accessor function.
  16689. * @example
  16690. *
  16691. * var array = [0, 1, 2],
  16692. * object = { 'a': array, 'b': array, 'c': array };
  16693. *
  16694. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  16695. * // => [2, 0]
  16696. *
  16697. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  16698. * // => [2, 0]
  16699. */
  16700. function propertyOf(object) {
  16701. return function(path) {
  16702. return object == null ? undefined : baseGet(object, path);
  16703. };
  16704. }
  16705. /**
  16706. * Creates an array of numbers (positive and/or negative) progressing from
  16707. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  16708. * `start` is specified without an `end` or `step`. If `end` is not specified,
  16709. * it's set to `start` with `start` then set to `0`.
  16710. *
  16711. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  16712. * floating-point values which can produce unexpected results.
  16713. *
  16714. * @static
  16715. * @since 0.1.0
  16716. * @memberOf _
  16717. * @category Util
  16718. * @param {number} [start=0] The start of the range.
  16719. * @param {number} end The end of the range.
  16720. * @param {number} [step=1] The value to increment or decrement by.
  16721. * @returns {Array} Returns the range of numbers.
  16722. * @see _.inRange, _.rangeRight
  16723. * @example
  16724. *
  16725. * _.range(4);
  16726. * // => [0, 1, 2, 3]
  16727. *
  16728. * _.range(-4);
  16729. * // => [0, -1, -2, -3]
  16730. *
  16731. * _.range(1, 5);
  16732. * // => [1, 2, 3, 4]
  16733. *
  16734. * _.range(0, 20, 5);
  16735. * // => [0, 5, 10, 15]
  16736. *
  16737. * _.range(0, -4, -1);
  16738. * // => [0, -1, -2, -3]
  16739. *
  16740. * _.range(1, 4, 0);
  16741. * // => [1, 1, 1]
  16742. *
  16743. * _.range(0);
  16744. * // => []
  16745. */
  16746. var range = createRange();
  16747. /**
  16748. * This method is like `_.range` except that it populates values in
  16749. * descending order.
  16750. *
  16751. * @static
  16752. * @memberOf _
  16753. * @since 4.0.0
  16754. * @category Util
  16755. * @param {number} [start=0] The start of the range.
  16756. * @param {number} end The end of the range.
  16757. * @param {number} [step=1] The value to increment or decrement by.
  16758. * @returns {Array} Returns the range of numbers.
  16759. * @see _.inRange, _.range
  16760. * @example
  16761. *
  16762. * _.rangeRight(4);
  16763. * // => [3, 2, 1, 0]
  16764. *
  16765. * _.rangeRight(-4);
  16766. * // => [-3, -2, -1, 0]
  16767. *
  16768. * _.rangeRight(1, 5);
  16769. * // => [4, 3, 2, 1]
  16770. *
  16771. * _.rangeRight(0, 20, 5);
  16772. * // => [15, 10, 5, 0]
  16773. *
  16774. * _.rangeRight(0, -4, -1);
  16775. * // => [-3, -2, -1, 0]
  16776. *
  16777. * _.rangeRight(1, 4, 0);
  16778. * // => [1, 1, 1]
  16779. *
  16780. * _.rangeRight(0);
  16781. * // => []
  16782. */
  16783. var rangeRight = createRange(true);
  16784. /**
  16785. * This method returns a new empty array.
  16786. *
  16787. * @static
  16788. * @memberOf _
  16789. * @since 4.13.0
  16790. * @category Util
  16791. * @returns {Array} Returns the new empty array.
  16792. * @example
  16793. *
  16794. * var arrays = _.times(2, _.stubArray);
  16795. *
  16796. * console.log(arrays);
  16797. * // => [[], []]
  16798. *
  16799. * console.log(arrays[0] === arrays[1]);
  16800. * // => false
  16801. */
  16802. function stubArray() {
  16803. return [];
  16804. }
  16805. /**
  16806. * This method returns `false`.
  16807. *
  16808. * @static
  16809. * @memberOf _
  16810. * @since 4.13.0
  16811. * @category Util
  16812. * @returns {boolean} Returns `false`.
  16813. * @example
  16814. *
  16815. * _.times(2, _.stubFalse);
  16816. * // => [false, false]
  16817. */
  16818. function stubFalse() {
  16819. return false;
  16820. }
  16821. /**
  16822. * This method returns a new empty object.
  16823. *
  16824. * @static
  16825. * @memberOf _
  16826. * @since 4.13.0
  16827. * @category Util
  16828. * @returns {Object} Returns the new empty object.
  16829. * @example
  16830. *
  16831. * var objects = _.times(2, _.stubObject);
  16832. *
  16833. * console.log(objects);
  16834. * // => [{}, {}]
  16835. *
  16836. * console.log(objects[0] === objects[1]);
  16837. * // => false
  16838. */
  16839. function stubObject() {
  16840. return {};
  16841. }
  16842. /**
  16843. * This method returns an empty string.
  16844. *
  16845. * @static
  16846. * @memberOf _
  16847. * @since 4.13.0
  16848. * @category Util
  16849. * @returns {string} Returns the empty string.
  16850. * @example
  16851. *
  16852. * _.times(2, _.stubString);
  16853. * // => ['', '']
  16854. */
  16855. function stubString() {
  16856. return '';
  16857. }
  16858. /**
  16859. * This method returns `true`.
  16860. *
  16861. * @static
  16862. * @memberOf _
  16863. * @since 4.13.0
  16864. * @category Util
  16865. * @returns {boolean} Returns `true`.
  16866. * @example
  16867. *
  16868. * _.times(2, _.stubTrue);
  16869. * // => [true, true]
  16870. */
  16871. function stubTrue() {
  16872. return true;
  16873. }
  16874. /**
  16875. * Invokes the iteratee `n` times, returning an array of the results of
  16876. * each invocation. The iteratee is invoked with one argument; (index).
  16877. *
  16878. * @static
  16879. * @since 0.1.0
  16880. * @memberOf _
  16881. * @category Util
  16882. * @param {number} n The number of times to invoke `iteratee`.
  16883. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  16884. * @returns {Array} Returns the array of results.
  16885. * @example
  16886. *
  16887. * _.times(3, String);
  16888. * // => ['0', '1', '2']
  16889. *
  16890. * _.times(4, _.constant(0));
  16891. * // => [0, 0, 0, 0]
  16892. */
  16893. function times(n, iteratee) {
  16894. n = toInteger(n);
  16895. if (n < 1 || n > MAX_SAFE_INTEGER) {
  16896. return [];
  16897. }
  16898. var index = MAX_ARRAY_LENGTH,
  16899. length = nativeMin(n, MAX_ARRAY_LENGTH);
  16900. iteratee = getIteratee(iteratee);
  16901. n -= MAX_ARRAY_LENGTH;
  16902. var result = baseTimes(length, iteratee);
  16903. while (++index < n) {
  16904. iteratee(index);
  16905. }
  16906. return result;
  16907. }
  16908. /**
  16909. * Converts `value` to a property path array.
  16910. *
  16911. * @static
  16912. * @memberOf _
  16913. * @since 4.0.0
  16914. * @category Util
  16915. * @param {*} value The value to convert.
  16916. * @returns {Array} Returns the new property path array.
  16917. * @example
  16918. *
  16919. * _.toPath('a.b.c');
  16920. * // => ['a', 'b', 'c']
  16921. *
  16922. * _.toPath('a[0].b.c');
  16923. * // => ['a', '0', 'b', 'c']
  16924. */
  16925. function toPath(value) {
  16926. if (isArray(value)) {
  16927. return arrayMap(value, toKey);
  16928. }
  16929. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  16930. }
  16931. /**
  16932. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  16933. *
  16934. * @static
  16935. * @since 0.1.0
  16936. * @memberOf _
  16937. * @category Util
  16938. * @param {string} [prefix=''] The value to prefix the ID with.
  16939. * @returns {string} Returns the unique ID.
  16940. * @example
  16941. *
  16942. * _.uniqueId('contact_');
  16943. * // => 'contact_104'
  16944. *
  16945. * _.uniqueId();
  16946. * // => '105'
  16947. */
  16948. function uniqueId(prefix) {
  16949. var id = ++idCounter;
  16950. return toString(prefix) + id;
  16951. }
  16952. /*------------------------------------------------------------------------*/
  16953. /**
  16954. * Adds two numbers.
  16955. *
  16956. * @static
  16957. * @memberOf _
  16958. * @since 3.4.0
  16959. * @category Math
  16960. * @param {number} augend The first number in an addition.
  16961. * @param {number} addend The second number in an addition.
  16962. * @returns {number} Returns the total.
  16963. * @example
  16964. *
  16965. * _.add(6, 4);
  16966. * // => 10
  16967. */
  16968. var add = createMathOperation(function(augend, addend) {
  16969. return augend + addend;
  16970. }, 0);
  16971. /**
  16972. * Computes `number` rounded up to `precision`.
  16973. *
  16974. * @static
  16975. * @memberOf _
  16976. * @since 3.10.0
  16977. * @category Math
  16978. * @param {number} number The number to round up.
  16979. * @param {number} [precision=0] The precision to round up to.
  16980. * @returns {number} Returns the rounded up number.
  16981. * @example
  16982. *
  16983. * _.ceil(4.006);
  16984. * // => 5
  16985. *
  16986. * _.ceil(6.004, 2);
  16987. * // => 6.01
  16988. *
  16989. * _.ceil(6040, -2);
  16990. * // => 6100
  16991. */
  16992. var ceil = createRound('ceil');
  16993. /**
  16994. * Divide two numbers.
  16995. *
  16996. * @static
  16997. * @memberOf _
  16998. * @since 4.7.0
  16999. * @category Math
  17000. * @param {number} dividend The first number in a division.
  17001. * @param {number} divisor The second number in a division.
  17002. * @returns {number} Returns the quotient.
  17003. * @example
  17004. *
  17005. * _.divide(6, 4);
  17006. * // => 1.5
  17007. */
  17008. var divide = createMathOperation(function(dividend, divisor) {
  17009. return dividend / divisor;
  17010. }, 1);
  17011. /**
  17012. * Computes `number` rounded down to `precision`.
  17013. *
  17014. * @static
  17015. * @memberOf _
  17016. * @since 3.10.0
  17017. * @category Math
  17018. * @param {number} number The number to round down.
  17019. * @param {number} [precision=0] The precision to round down to.
  17020. * @returns {number} Returns the rounded down number.
  17021. * @example
  17022. *
  17023. * _.floor(4.006);
  17024. * // => 4
  17025. *
  17026. * _.floor(0.046, 2);
  17027. * // => 0.04
  17028. *
  17029. * _.floor(4060, -2);
  17030. * // => 4000
  17031. */
  17032. var floor = createRound('floor');
  17033. /**
  17034. * Computes the maximum value of `array`. If `array` is empty or falsey,
  17035. * `undefined` is returned.
  17036. *
  17037. * @static
  17038. * @since 0.1.0
  17039. * @memberOf _
  17040. * @category Math
  17041. * @param {Array} array The array to iterate over.
  17042. * @returns {*} Returns the maximum value.
  17043. * @example
  17044. *
  17045. * _.max([4, 2, 8, 6]);
  17046. * // => 8
  17047. *
  17048. * _.max([]);
  17049. * // => undefined
  17050. */
  17051. function max(array) {
  17052. return (array && array.length)
  17053. ? baseExtremum(array, identity, baseGt)
  17054. : undefined;
  17055. }
  17056. /**
  17057. * This method is like `_.max` except that it accepts `iteratee` which is
  17058. * invoked for each element in `array` to generate the criterion by which
  17059. * the value is ranked. The iteratee is invoked with one argument: (value).
  17060. *
  17061. * @static
  17062. * @memberOf _
  17063. * @since 4.0.0
  17064. * @category Math
  17065. * @param {Array} array The array to iterate over.
  17066. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  17067. * @returns {*} Returns the maximum value.
  17068. * @example
  17069. *
  17070. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  17071. *
  17072. * _.maxBy(objects, function(o) { return o.n; });
  17073. * // => { 'n': 2 }
  17074. *
  17075. * // The `_.property` iteratee shorthand.
  17076. * _.maxBy(objects, 'n');
  17077. * // => { 'n': 2 }
  17078. */
  17079. function maxBy(array, iteratee) {
  17080. return (array && array.length)
  17081. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  17082. : undefined;
  17083. }
  17084. /**
  17085. * Computes the mean of the values in `array`.
  17086. *
  17087. * @static
  17088. * @memberOf _
  17089. * @since 4.0.0
  17090. * @category Math
  17091. * @param {Array} array The array to iterate over.
  17092. * @returns {number} Returns the mean.
  17093. * @example
  17094. *
  17095. * _.mean([4, 2, 8, 6]);
  17096. * // => 5
  17097. */
  17098. function mean(array) {
  17099. return baseMean(array, identity);
  17100. }
  17101. /**
  17102. * This method is like `_.mean` except that it accepts `iteratee` which is
  17103. * invoked for each element in `array` to generate the value to be averaged.
  17104. * The iteratee is invoked with one argument: (value).
  17105. *
  17106. * @static
  17107. * @memberOf _
  17108. * @since 4.7.0
  17109. * @category Math
  17110. * @param {Array} array The array to iterate over.
  17111. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  17112. * @returns {number} Returns the mean.
  17113. * @example
  17114. *
  17115. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  17116. *
  17117. * _.meanBy(objects, function(o) { return o.n; });
  17118. * // => 5
  17119. *
  17120. * // The `_.property` iteratee shorthand.
  17121. * _.meanBy(objects, 'n');
  17122. * // => 5
  17123. */
  17124. function meanBy(array, iteratee) {
  17125. return baseMean(array, getIteratee(iteratee, 2));
  17126. }
  17127. /**
  17128. * Computes the minimum value of `array`. If `array` is empty or falsey,
  17129. * `undefined` is returned.
  17130. *
  17131. * @static
  17132. * @since 0.1.0
  17133. * @memberOf _
  17134. * @category Math
  17135. * @param {Array} array The array to iterate over.
  17136. * @returns {*} Returns the minimum value.
  17137. * @example
  17138. *
  17139. * _.min([4, 2, 8, 6]);
  17140. * // => 2
  17141. *
  17142. * _.min([]);
  17143. * // => undefined
  17144. */
  17145. function min(array) {
  17146. return (array && array.length)
  17147. ? baseExtremum(array, identity, baseLt)
  17148. : undefined;
  17149. }
  17150. /**
  17151. * This method is like `_.min` except that it accepts `iteratee` which is
  17152. * invoked for each element in `array` to generate the criterion by which
  17153. * the value is ranked. The iteratee is invoked with one argument: (value).
  17154. *
  17155. * @static
  17156. * @memberOf _
  17157. * @since 4.0.0
  17158. * @category Math
  17159. * @param {Array} array The array to iterate over.
  17160. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  17161. * @returns {*} Returns the minimum value.
  17162. * @example
  17163. *
  17164. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  17165. *
  17166. * _.minBy(objects, function(o) { return o.n; });
  17167. * // => { 'n': 1 }
  17168. *
  17169. * // The `_.property` iteratee shorthand.
  17170. * _.minBy(objects, 'n');
  17171. * // => { 'n': 1 }
  17172. */
  17173. function minBy(array, iteratee) {
  17174. return (array && array.length)
  17175. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  17176. : undefined;
  17177. }
  17178. /**
  17179. * Multiply two numbers.
  17180. *
  17181. * @static
  17182. * @memberOf _
  17183. * @since 4.7.0
  17184. * @category Math
  17185. * @param {number} multiplier The first number in a multiplication.
  17186. * @param {number} multiplicand The second number in a multiplication.
  17187. * @returns {number} Returns the product.
  17188. * @example
  17189. *
  17190. * _.multiply(6, 4);
  17191. * // => 24
  17192. */
  17193. var multiply = createMathOperation(function(multiplier, multiplicand) {
  17194. return multiplier * multiplicand;
  17195. }, 1);
  17196. /**
  17197. * Computes `number` rounded to `precision`.
  17198. *
  17199. * @static
  17200. * @memberOf _
  17201. * @since 3.10.0
  17202. * @category Math
  17203. * @param {number} number The number to round.
  17204. * @param {number} [precision=0] The precision to round to.
  17205. * @returns {number} Returns the rounded number.
  17206. * @example
  17207. *
  17208. * _.round(4.006);
  17209. * // => 4
  17210. *
  17211. * _.round(4.006, 2);
  17212. * // => 4.01
  17213. *
  17214. * _.round(4060, -2);
  17215. * // => 4100
  17216. */
  17217. var round = createRound('round');
  17218. /**
  17219. * Subtract two numbers.
  17220. *
  17221. * @static
  17222. * @memberOf _
  17223. * @since 4.0.0
  17224. * @category Math
  17225. * @param {number} minuend The first number in a subtraction.
  17226. * @param {number} subtrahend The second number in a subtraction.
  17227. * @returns {number} Returns the difference.
  17228. * @example
  17229. *
  17230. * _.subtract(6, 4);
  17231. * // => 2
  17232. */
  17233. var subtract = createMathOperation(function(minuend, subtrahend) {
  17234. return minuend - subtrahend;
  17235. }, 0);
  17236. /**
  17237. * Computes the sum of the values in `array`.
  17238. *
  17239. * @static
  17240. * @memberOf _
  17241. * @since 3.4.0
  17242. * @category Math
  17243. * @param {Array} array The array to iterate over.
  17244. * @returns {number} Returns the sum.
  17245. * @example
  17246. *
  17247. * _.sum([4, 2, 8, 6]);
  17248. * // => 20
  17249. */
  17250. function sum(array) {
  17251. return (array && array.length)
  17252. ? baseSum(array, identity)
  17253. : 0;
  17254. }
  17255. /**
  17256. * This method is like `_.sum` except that it accepts `iteratee` which is
  17257. * invoked for each element in `array` to generate the value to be summed.
  17258. * The iteratee is invoked with one argument: (value).
  17259. *
  17260. * @static
  17261. * @memberOf _
  17262. * @since 4.0.0
  17263. * @category Math
  17264. * @param {Array} array The array to iterate over.
  17265. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  17266. * @returns {number} Returns the sum.
  17267. * @example
  17268. *
  17269. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  17270. *
  17271. * _.sumBy(objects, function(o) { return o.n; });
  17272. * // => 20
  17273. *
  17274. * // The `_.property` iteratee shorthand.
  17275. * _.sumBy(objects, 'n');
  17276. * // => 20
  17277. */
  17278. function sumBy(array, iteratee) {
  17279. return (array && array.length)
  17280. ? baseSum(array, getIteratee(iteratee, 2))
  17281. : 0;
  17282. }
  17283. /*------------------------------------------------------------------------*/
  17284. // Add methods that return wrapped values in chain sequences.
  17285. lodash.after = after;
  17286. lodash.ary = ary;
  17287. lodash.assign = assign;
  17288. lodash.assignIn = assignIn;
  17289. lodash.assignInWith = assignInWith;
  17290. lodash.assignWith = assignWith;
  17291. lodash.at = at;
  17292. lodash.before = before;
  17293. lodash.bind = bind;
  17294. lodash.bindAll = bindAll;
  17295. lodash.bindKey = bindKey;
  17296. lodash.castArray = castArray;
  17297. lodash.chain = chain;
  17298. lodash.chunk = chunk;
  17299. lodash.compact = compact;
  17300. lodash.concat = concat;
  17301. lodash.cond = cond;
  17302. lodash.conforms = conforms;
  17303. lodash.constant = constant;
  17304. lodash.countBy = countBy;
  17305. lodash.create = create;
  17306. lodash.curry = curry;
  17307. lodash.curryRight = curryRight;
  17308. lodash.debounce = debounce;
  17309. lodash.defaults = defaults;
  17310. lodash.defaultsDeep = defaultsDeep;
  17311. lodash.defer = defer;
  17312. lodash.delay = delay;
  17313. lodash.difference = difference;
  17314. lodash.differenceBy = differenceBy;
  17315. lodash.differenceWith = differenceWith;
  17316. lodash.drop = drop;
  17317. lodash.dropRight = dropRight;
  17318. lodash.dropRightWhile = dropRightWhile;
  17319. lodash.dropWhile = dropWhile;
  17320. lodash.fill = fill;
  17321. lodash.filter = filter;
  17322. lodash.flatMap = flatMap;
  17323. lodash.flatMapDeep = flatMapDeep;
  17324. lodash.flatMapDepth = flatMapDepth;
  17325. lodash.flatten = flatten;
  17326. lodash.flattenDeep = flattenDeep;
  17327. lodash.flattenDepth = flattenDepth;
  17328. lodash.flip = flip;
  17329. lodash.flow = flow;
  17330. lodash.flowRight = flowRight;
  17331. lodash.fromPairs = fromPairs;
  17332. lodash.functions = functions;
  17333. lodash.functionsIn = functionsIn;
  17334. lodash.groupBy = groupBy;
  17335. lodash.initial = initial;
  17336. lodash.intersection = intersection;
  17337. lodash.intersectionBy = intersectionBy;
  17338. lodash.intersectionWith = intersectionWith;
  17339. lodash.invert = invert;
  17340. lodash.invertBy = invertBy;
  17341. lodash.invokeMap = invokeMap;
  17342. lodash.iteratee = iteratee;
  17343. lodash.keyBy = keyBy;
  17344. lodash.keys = keys;
  17345. lodash.keysIn = keysIn;
  17346. lodash.map = map;
  17347. lodash.mapKeys = mapKeys;
  17348. lodash.mapValues = mapValues;
  17349. lodash.matches = matches;
  17350. lodash.matchesProperty = matchesProperty;
  17351. lodash.memoize = memoize;
  17352. lodash.merge = merge;
  17353. lodash.mergeWith = mergeWith;
  17354. lodash.method = method;
  17355. lodash.methodOf = methodOf;
  17356. lodash.mixin = mixin;
  17357. lodash.negate = negate;
  17358. lodash.nthArg = nthArg;
  17359. lodash.omit = omit;
  17360. lodash.omitBy = omitBy;
  17361. lodash.once = once;
  17362. lodash.orderBy = orderBy;
  17363. lodash.over = over;
  17364. lodash.overArgs = overArgs;
  17365. lodash.overEvery = overEvery;
  17366. lodash.overSome = overSome;
  17367. lodash.partial = partial;
  17368. lodash.partialRight = partialRight;
  17369. lodash.partition = partition;
  17370. lodash.pick = pick;
  17371. lodash.pickBy = pickBy;
  17372. lodash.property = property;
  17373. lodash.propertyOf = propertyOf;
  17374. lodash.pull = pull;
  17375. lodash.pullAll = pullAll;
  17376. lodash.pullAllBy = pullAllBy;
  17377. lodash.pullAllWith = pullAllWith;
  17378. lodash.pullAt = pullAt;
  17379. lodash.range = range;
  17380. lodash.rangeRight = rangeRight;
  17381. lodash.rearg = rearg;
  17382. lodash.reject = reject;
  17383. lodash.remove = remove;
  17384. lodash.rest = rest;
  17385. lodash.reverse = reverse;
  17386. lodash.sampleSize = sampleSize;
  17387. lodash.set = set;
  17388. lodash.setWith = setWith;
  17389. lodash.shuffle = shuffle;
  17390. lodash.slice = slice;
  17391. lodash.sortBy = sortBy;
  17392. lodash.sortedUniq = sortedUniq;
  17393. lodash.sortedUniqBy = sortedUniqBy;
  17394. lodash.split = split;
  17395. lodash.spread = spread;
  17396. lodash.tail = tail;
  17397. lodash.take = take;
  17398. lodash.takeRight = takeRight;
  17399. lodash.takeRightWhile = takeRightWhile;
  17400. lodash.takeWhile = takeWhile;
  17401. lodash.tap = tap;
  17402. lodash.throttle = throttle;
  17403. lodash.thru = thru;
  17404. lodash.toArray = toArray;
  17405. lodash.toPairs = toPairs;
  17406. lodash.toPairsIn = toPairsIn;
  17407. lodash.toPath = toPath;
  17408. lodash.toPlainObject = toPlainObject;
  17409. lodash.transform = transform;
  17410. lodash.unary = unary;
  17411. lodash.union = union;
  17412. lodash.unionBy = unionBy;
  17413. lodash.unionWith = unionWith;
  17414. lodash.uniq = uniq;
  17415. lodash.uniqBy = uniqBy;
  17416. lodash.uniqWith = uniqWith;
  17417. lodash.unset = unset;
  17418. lodash.unzip = unzip;
  17419. lodash.unzipWith = unzipWith;
  17420. lodash.update = update;
  17421. lodash.updateWith = updateWith;
  17422. lodash.values = values;
  17423. lodash.valuesIn = valuesIn;
  17424. lodash.without = without;
  17425. lodash.words = words;
  17426. lodash.wrap = wrap;
  17427. lodash.xor = xor;
  17428. lodash.xorBy = xorBy;
  17429. lodash.xorWith = xorWith;
  17430. lodash.zip = zip;
  17431. lodash.zipObject = zipObject;
  17432. lodash.zipObjectDeep = zipObjectDeep;
  17433. lodash.zipWith = zipWith;
  17434. // Add aliases.
  17435. lodash.entries = toPairs;
  17436. lodash.entriesIn = toPairsIn;
  17437. lodash.extend = assignIn;
  17438. lodash.extendWith = assignInWith;
  17439. // Add methods to `lodash.prototype`.
  17440. mixin(lodash, lodash);
  17441. /*------------------------------------------------------------------------*/
  17442. // Add methods that return unwrapped values in chain sequences.
  17443. lodash.add = add;
  17444. lodash.attempt = attempt;
  17445. lodash.camelCase = camelCase;
  17446. lodash.capitalize = capitalize;
  17447. lodash.ceil = ceil;
  17448. lodash.clamp = clamp;
  17449. lodash.clone = clone;
  17450. lodash.cloneDeep = cloneDeep;
  17451. lodash.cloneDeepWith = cloneDeepWith;
  17452. lodash.cloneWith = cloneWith;
  17453. lodash.conformsTo = conformsTo;
  17454. lodash.deburr = deburr;
  17455. lodash.defaultTo = defaultTo;
  17456. lodash.divide = divide;
  17457. lodash.endsWith = endsWith;
  17458. lodash.eq = eq;
  17459. lodash.escape = escape;
  17460. lodash.escapeRegExp = escapeRegExp;
  17461. lodash.every = every;
  17462. lodash.find = find;
  17463. lodash.findIndex = findIndex;
  17464. lodash.findKey = findKey;
  17465. lodash.findLast = findLast;
  17466. lodash.findLastIndex = findLastIndex;
  17467. lodash.findLastKey = findLastKey;
  17468. lodash.floor = floor;
  17469. lodash.forEach = forEach;
  17470. lodash.forEachRight = forEachRight;
  17471. lodash.forIn = forIn;
  17472. lodash.forInRight = forInRight;
  17473. lodash.forOwn = forOwn;
  17474. lodash.forOwnRight = forOwnRight;
  17475. lodash.get = get;
  17476. lodash.gt = gt;
  17477. lodash.gte = gte;
  17478. lodash.has = has;
  17479. lodash.hasIn = hasIn;
  17480. lodash.head = head;
  17481. lodash.identity = identity;
  17482. lodash.includes = includes;
  17483. lodash.indexOf = indexOf;
  17484. lodash.inRange = inRange;
  17485. lodash.invoke = invoke;
  17486. lodash.isArguments = isArguments;
  17487. lodash.isArray = isArray;
  17488. lodash.isArrayBuffer = isArrayBuffer;
  17489. lodash.isArrayLike = isArrayLike;
  17490. lodash.isArrayLikeObject = isArrayLikeObject;
  17491. lodash.isBoolean = isBoolean;
  17492. lodash.isBuffer = isBuffer;
  17493. lodash.isDate = isDate;
  17494. lodash.isElement = isElement;
  17495. lodash.isEmpty = isEmpty;
  17496. lodash.isEqual = isEqual;
  17497. lodash.isEqualWith = isEqualWith;
  17498. lodash.isError = isError;
  17499. lodash.isFinite = isFinite;
  17500. lodash.isFunction = isFunction;
  17501. lodash.isInteger = isInteger;
  17502. lodash.isLength = isLength;
  17503. lodash.isMap = isMap;
  17504. lodash.isMatch = isMatch;
  17505. lodash.isMatchWith = isMatchWith;
  17506. lodash.isNaN = isNaN;
  17507. lodash.isNative = isNative;
  17508. lodash.isNil = isNil;
  17509. lodash.isNull = isNull;
  17510. lodash.isNumber = isNumber;
  17511. lodash.isObject = isObject;
  17512. lodash.isObjectLike = isObjectLike;
  17513. lodash.isPlainObject = isPlainObject;
  17514. lodash.isRegExp = isRegExp;
  17515. lodash.isSafeInteger = isSafeInteger;
  17516. lodash.isSet = isSet;
  17517. lodash.isString = isString;
  17518. lodash.isSymbol = isSymbol;
  17519. lodash.isTypedArray = isTypedArray;
  17520. lodash.isUndefined = isUndefined;
  17521. lodash.isWeakMap = isWeakMap;
  17522. lodash.isWeakSet = isWeakSet;
  17523. lodash.join = join;
  17524. lodash.kebabCase = kebabCase;
  17525. lodash.last = last;
  17526. lodash.lastIndexOf = lastIndexOf;
  17527. lodash.lowerCase = lowerCase;
  17528. lodash.lowerFirst = lowerFirst;
  17529. lodash.lt = lt;
  17530. lodash.lte = lte;
  17531. lodash.max = max;
  17532. lodash.maxBy = maxBy;
  17533. lodash.mean = mean;
  17534. lodash.meanBy = meanBy;
  17535. lodash.min = min;
  17536. lodash.minBy = minBy;
  17537. lodash.stubArray = stubArray;
  17538. lodash.stubFalse = stubFalse;
  17539. lodash.stubObject = stubObject;
  17540. lodash.stubString = stubString;
  17541. lodash.stubTrue = stubTrue;
  17542. lodash.multiply = multiply;
  17543. lodash.nth = nth;
  17544. lodash.noConflict = noConflict;
  17545. lodash.noop = noop;
  17546. lodash.now = now;
  17547. lodash.pad = pad;
  17548. lodash.padEnd = padEnd;
  17549. lodash.padStart = padStart;
  17550. lodash.parseInt = parseInt;
  17551. lodash.random = random;
  17552. lodash.reduce = reduce;
  17553. lodash.reduceRight = reduceRight;
  17554. lodash.repeat = repeat;
  17555. lodash.replace = replace;
  17556. lodash.result = result;
  17557. lodash.round = round;
  17558. lodash.runInContext = runInContext;
  17559. lodash.sample = sample;
  17560. lodash.size = size;
  17561. lodash.snakeCase = snakeCase;
  17562. lodash.some = some;
  17563. lodash.sortedIndex = sortedIndex;
  17564. lodash.sortedIndexBy = sortedIndexBy;
  17565. lodash.sortedIndexOf = sortedIndexOf;
  17566. lodash.sortedLastIndex = sortedLastIndex;
  17567. lodash.sortedLastIndexBy = sortedLastIndexBy;
  17568. lodash.sortedLastIndexOf = sortedLastIndexOf;
  17569. lodash.startCase = startCase;
  17570. lodash.startsWith = startsWith;
  17571. lodash.subtract = subtract;
  17572. lodash.sum = sum;
  17573. lodash.sumBy = sumBy;
  17574. lodash.template = template;
  17575. lodash.times = times;
  17576. lodash.toFinite = toFinite;
  17577. lodash.toInteger = toInteger;
  17578. lodash.toLength = toLength;
  17579. lodash.toLower = toLower;
  17580. lodash.toNumber = toNumber;
  17581. lodash.toSafeInteger = toSafeInteger;
  17582. lodash.toString = toString;
  17583. lodash.toUpper = toUpper;
  17584. lodash.trim = trim;
  17585. lodash.trimEnd = trimEnd;
  17586. lodash.trimStart = trimStart;
  17587. lodash.truncate = truncate;
  17588. lodash.unescape = unescape;
  17589. lodash.uniqueId = uniqueId;
  17590. lodash.upperCase = upperCase;
  17591. lodash.upperFirst = upperFirst;
  17592. // Add aliases.
  17593. lodash.each = forEach;
  17594. lodash.eachRight = forEachRight;
  17595. lodash.first = head;
  17596. mixin(lodash, (function() {
  17597. var source = {};
  17598. baseForOwn(lodash, function(func, methodName) {
  17599. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  17600. source[methodName] = func;
  17601. }
  17602. });
  17603. return source;
  17604. }()), { 'chain': false });
  17605. /*------------------------------------------------------------------------*/
  17606. /**
  17607. * The semantic version number.
  17608. *
  17609. * @static
  17610. * @memberOf _
  17611. * @type {string}
  17612. */
  17613. lodash.VERSION = VERSION;
  17614. // Assign default placeholders.
  17615. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  17616. lodash[methodName].placeholder = lodash;
  17617. });
  17618. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  17619. arrayEach(['drop', 'take'], function(methodName, index) {
  17620. LazyWrapper.prototype[methodName] = function(n) {
  17621. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  17622. var result = (this.__filtered__ && !index)
  17623. ? new LazyWrapper(this)
  17624. : this.clone();
  17625. if (result.__filtered__) {
  17626. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  17627. } else {
  17628. result.__views__.push({
  17629. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  17630. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  17631. });
  17632. }
  17633. return result;
  17634. };
  17635. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  17636. return this.reverse()[methodName](n).reverse();
  17637. };
  17638. });
  17639. // Add `LazyWrapper` methods that accept an `iteratee` value.
  17640. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  17641. var type = index + 1,
  17642. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  17643. LazyWrapper.prototype[methodName] = function(iteratee) {
  17644. var result = this.clone();
  17645. result.__iteratees__.push({
  17646. 'iteratee': getIteratee(iteratee, 3),
  17647. 'type': type
  17648. });
  17649. result.__filtered__ = result.__filtered__ || isFilter;
  17650. return result;
  17651. };
  17652. });
  17653. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  17654. arrayEach(['head', 'last'], function(methodName, index) {
  17655. var takeName = 'take' + (index ? 'Right' : '');
  17656. LazyWrapper.prototype[methodName] = function() {
  17657. return this[takeName](1).value()[0];
  17658. };
  17659. });
  17660. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  17661. arrayEach(['initial', 'tail'], function(methodName, index) {
  17662. var dropName = 'drop' + (index ? '' : 'Right');
  17663. LazyWrapper.prototype[methodName] = function() {
  17664. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  17665. };
  17666. });
  17667. LazyWrapper.prototype.compact = function() {
  17668. return this.filter(identity);
  17669. };
  17670. LazyWrapper.prototype.find = function(predicate) {
  17671. return this.filter(predicate).head();
  17672. };
  17673. LazyWrapper.prototype.findLast = function(predicate) {
  17674. return this.reverse().find(predicate);
  17675. };
  17676. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  17677. if (typeof path == 'function') {
  17678. return new LazyWrapper(this);
  17679. }
  17680. return this.map(function(value) {
  17681. return baseInvoke(value, path, args);
  17682. });
  17683. });
  17684. LazyWrapper.prototype.reject = function(predicate) {
  17685. return this.filter(negate(getIteratee(predicate)));
  17686. };
  17687. LazyWrapper.prototype.slice = function(start, end) {
  17688. start = toInteger(start);
  17689. var result = this;
  17690. if (result.__filtered__ && (start > 0 || end < 0)) {
  17691. return new LazyWrapper(result);
  17692. }
  17693. if (start < 0) {
  17694. result = result.takeRight(-start);
  17695. } else if (start) {
  17696. result = result.drop(start);
  17697. }
  17698. if (end !== undefined) {
  17699. end = toInteger(end);
  17700. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  17701. }
  17702. return result;
  17703. };
  17704. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  17705. return this.reverse().takeWhile(predicate).reverse();
  17706. };
  17707. LazyWrapper.prototype.toArray = function() {
  17708. return this.take(MAX_ARRAY_LENGTH);
  17709. };
  17710. // Add `LazyWrapper` methods to `lodash.prototype`.
  17711. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  17712. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  17713. isTaker = /^(?:head|last)$/.test(methodName),
  17714. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  17715. retUnwrapped = isTaker || /^find/.test(methodName);
  17716. if (!lodashFunc) {
  17717. return;
  17718. }
  17719. lodash.prototype[methodName] = function() {
  17720. var value = this.__wrapped__,
  17721. args = isTaker ? [1] : arguments,
  17722. isLazy = value instanceof LazyWrapper,
  17723. iteratee = args[0],
  17724. useLazy = isLazy || isArray(value);
  17725. var interceptor = function(value) {
  17726. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  17727. return (isTaker && chainAll) ? result[0] : result;
  17728. };
  17729. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  17730. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  17731. isLazy = useLazy = false;
  17732. }
  17733. var chainAll = this.__chain__,
  17734. isHybrid = !!this.__actions__.length,
  17735. isUnwrapped = retUnwrapped && !chainAll,
  17736. onlyLazy = isLazy && !isHybrid;
  17737. if (!retUnwrapped && useLazy) {
  17738. value = onlyLazy ? value : new LazyWrapper(this);
  17739. var result = func.apply(value, args);
  17740. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  17741. return new LodashWrapper(result, chainAll);
  17742. }
  17743. if (isUnwrapped && onlyLazy) {
  17744. return func.apply(this, args);
  17745. }
  17746. result = this.thru(interceptor);
  17747. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  17748. };
  17749. });
  17750. // Add `Array` methods to `lodash.prototype`.
  17751. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  17752. var func = arrayProto[methodName],
  17753. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  17754. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  17755. lodash.prototype[methodName] = function() {
  17756. var args = arguments;
  17757. if (retUnwrapped && !this.__chain__) {
  17758. var value = this.value();
  17759. return func.apply(isArray(value) ? value : [], args);
  17760. }
  17761. return this[chainName](function(value) {
  17762. return func.apply(isArray(value) ? value : [], args);
  17763. });
  17764. };
  17765. });
  17766. // Map minified method names to their real names.
  17767. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  17768. var lodashFunc = lodash[methodName];
  17769. if (lodashFunc) {
  17770. var key = lodashFunc.name + '';
  17771. if (!hasOwnProperty.call(realNames, key)) {
  17772. realNames[key] = [];
  17773. }
  17774. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  17775. }
  17776. });
  17777. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  17778. 'name': 'wrapper',
  17779. 'func': undefined
  17780. }];
  17781. // Add methods to `LazyWrapper`.
  17782. LazyWrapper.prototype.clone = lazyClone;
  17783. LazyWrapper.prototype.reverse = lazyReverse;
  17784. LazyWrapper.prototype.value = lazyValue;
  17785. // Add chain sequence methods to the `lodash` wrapper.
  17786. lodash.prototype.at = wrapperAt;
  17787. lodash.prototype.chain = wrapperChain;
  17788. lodash.prototype.commit = wrapperCommit;
  17789. lodash.prototype.next = wrapperNext;
  17790. lodash.prototype.plant = wrapperPlant;
  17791. lodash.prototype.reverse = wrapperReverse;
  17792. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  17793. // Add lazy aliases.
  17794. lodash.prototype.first = lodash.prototype.head;
  17795. if (symIterator) {
  17796. lodash.prototype[symIterator] = wrapperToIterator;
  17797. }
  17798. return lodash;
  17799. });
  17800. /*--------------------------------------------------------------------------*/
  17801. // Export lodash.
  17802. var _ = runInContext();
  17803. // Some AMD build optimizers, like r.js, check for condition patterns like:
  17804. if (true) {
  17805. // Expose Lodash on the global object to prevent errors when Lodash is
  17806. // loaded by a script tag in the presence of an AMD loader.
  17807. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  17808. // Use `_.noConflict` to remove Lodash from the global object.
  17809. root._ = _;
  17810. // Define as an anonymous module so, through path mapping, it can be
  17811. // referenced as the "underscore" module.
  17812. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  17813. return _;
  17814. }).call(exports, __webpack_require__, exports, module),
  17815. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17816. }
  17817. // Check for `exports` after `define` in case a build optimizer adds it.
  17818. else {}
  17819. }.call(this));
  17820. /***/ }),
  17821. /***/ "./node_modules/vue-loader/dist/exportHelper.js":
  17822. /*!******************************************************!*\
  17823. !*** ./node_modules/vue-loader/dist/exportHelper.js ***!
  17824. \******************************************************/
  17825. /***/ ((__unused_webpack_module, exports) => {
  17826. "use strict";
  17827. Object.defineProperty(exports, "__esModule", ({ value: true }));
  17828. // runtime helper for setting properties on components
  17829. // in a tree-shakable way
  17830. exports["default"] = (sfc, props) => {
  17831. const target = sfc.__vccOpts || sfc;
  17832. for (const [key, val] of props) {
  17833. target[key] = val;
  17834. }
  17835. return target;
  17836. };
  17837. /***/ }),
  17838. /***/ "./resources/js/components/AppDropdown.vue":
  17839. /*!*************************************************!*\
  17840. !*** ./resources/js/components/AppDropdown.vue ***!
  17841. \*************************************************/
  17842. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17843. "use strict";
  17844. __webpack_require__.r(__webpack_exports__);
  17845. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17846. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17847. /* harmony export */ });
  17848. /* harmony import */ var _AppDropdown_vue_vue_type_template_id_ce0d1992__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AppDropdown.vue?vue&type=template&id=ce0d1992 */ "./resources/js/components/AppDropdown.vue?vue&type=template&id=ce0d1992");
  17849. /* harmony import */ var _AppDropdown_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AppDropdown.vue?vue&type=script&setup=true&lang=js */ "./resources/js/components/AppDropdown.vue?vue&type=script&setup=true&lang=js");
  17850. /* 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");
  17851. ;
  17852. const __exports__ = /*#__PURE__*/(0,_home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_AppDropdown_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_AppDropdown_vue_vue_type_template_id_ce0d1992__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/AppDropdown.vue"]])
  17853. /* hot reload */
  17854. if (false) {}
  17855. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17856. /***/ }),
  17857. /***/ "./resources/js/components/AppFooter.vue":
  17858. /*!***********************************************!*\
  17859. !*** ./resources/js/components/AppFooter.vue ***!
  17860. \***********************************************/
  17861. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17862. "use strict";
  17863. __webpack_require__.r(__webpack_exports__);
  17864. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17865. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17866. /* harmony export */ });
  17867. /* 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");
  17868. /* 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");
  17869. const script = {}
  17870. ;
  17871. 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"]])
  17872. /* hot reload */
  17873. if (false) {}
  17874. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17875. /***/ }),
  17876. /***/ "./resources/js/components/AppInputText.vue":
  17877. /*!**************************************************!*\
  17878. !*** ./resources/js/components/AppInputText.vue ***!
  17879. \**************************************************/
  17880. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17881. "use strict";
  17882. __webpack_require__.r(__webpack_exports__);
  17883. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17884. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17885. /* harmony export */ });
  17886. /* harmony import */ var _AppInputText_vue_vue_type_template_id_16729fe1__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AppInputText.vue?vue&type=template&id=16729fe1 */ "./resources/js/components/AppInputText.vue?vue&type=template&id=16729fe1");
  17887. /* harmony import */ var _AppInputText_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AppInputText.vue?vue&type=script&setup=true&lang=js */ "./resources/js/components/AppInputText.vue?vue&type=script&setup=true&lang=js");
  17888. /* 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");
  17889. ;
  17890. const __exports__ = /*#__PURE__*/(0,_home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_AppInputText_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_AppInputText_vue_vue_type_template_id_16729fe1__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/AppInputText.vue"]])
  17891. /* hot reload */
  17892. if (false) {}
  17893. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17894. /***/ }),
  17895. /***/ "./resources/js/components/AppMessage.vue":
  17896. /*!************************************************!*\
  17897. !*** ./resources/js/components/AppMessage.vue ***!
  17898. \************************************************/
  17899. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17900. "use strict";
  17901. __webpack_require__.r(__webpack_exports__);
  17902. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17903. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17904. /* harmony export */ });
  17905. /* 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");
  17906. /* 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");
  17907. /* 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");
  17908. ;
  17909. 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"]])
  17910. /* hot reload */
  17911. if (false) {}
  17912. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17913. /***/ }),
  17914. /***/ "./resources/js/components/AppSidebar.vue":
  17915. /*!************************************************!*\
  17916. !*** ./resources/js/components/AppSidebar.vue ***!
  17917. \************************************************/
  17918. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17919. "use strict";
  17920. __webpack_require__.r(__webpack_exports__);
  17921. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17922. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17923. /* harmony export */ });
  17924. /* 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");
  17925. /* 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");
  17926. /* 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");
  17927. ;
  17928. 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"]])
  17929. /* hot reload */
  17930. if (false) {}
  17931. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17932. /***/ }),
  17933. /***/ "./resources/js/components/AppSubSidebar.vue":
  17934. /*!***************************************************!*\
  17935. !*** ./resources/js/components/AppSubSidebar.vue ***!
  17936. \***************************************************/
  17937. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17938. "use strict";
  17939. __webpack_require__.r(__webpack_exports__);
  17940. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17941. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17942. /* harmony export */ });
  17943. /* 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");
  17944. /* 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");
  17945. /* 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");
  17946. ;
  17947. 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"]])
  17948. /* hot reload */
  17949. if (false) {}
  17950. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17951. /***/ }),
  17952. /***/ "./resources/js/components/AppTopBar.vue":
  17953. /*!***********************************************!*\
  17954. !*** ./resources/js/components/AppTopBar.vue ***!
  17955. \***********************************************/
  17956. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17957. "use strict";
  17958. __webpack_require__.r(__webpack_exports__);
  17959. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17960. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17961. /* harmony export */ });
  17962. /* 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");
  17963. /* 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");
  17964. /* 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");
  17965. ;
  17966. 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"]])
  17967. /* hot reload */
  17968. if (false) {}
  17969. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17970. /***/ }),
  17971. /***/ "./resources/js/layouts/AppLayout.vue":
  17972. /*!********************************************!*\
  17973. !*** ./resources/js/layouts/AppLayout.vue ***!
  17974. \********************************************/
  17975. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17976. "use strict";
  17977. __webpack_require__.r(__webpack_exports__);
  17978. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17979. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17980. /* harmony export */ });
  17981. /* 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");
  17982. /* 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");
  17983. /* 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");
  17984. ;
  17985. 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"]])
  17986. /* hot reload */
  17987. if (false) {}
  17988. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17989. /***/ }),
  17990. /***/ "./resources/js/pages/member/Edit.vue":
  17991. /*!********************************************!*\
  17992. !*** ./resources/js/pages/member/Edit.vue ***!
  17993. \********************************************/
  17994. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17995. "use strict";
  17996. __webpack_require__.r(__webpack_exports__);
  17997. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17998. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17999. /* harmony export */ });
  18000. /* harmony import */ var _Edit_vue_vue_type_template_id_1a9fb226__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Edit.vue?vue&type=template&id=1a9fb226 */ "./resources/js/pages/member/Edit.vue?vue&type=template&id=1a9fb226");
  18001. /* harmony import */ var _Edit_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Edit.vue?vue&type=script&setup=true&lang=js */ "./resources/js/pages/member/Edit.vue?vue&type=script&setup=true&lang=js");
  18002. /* 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");
  18003. ;
  18004. const __exports__ = /*#__PURE__*/(0,_home_dijitalcode_Projects_parkirin_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_Edit_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_Edit_vue_vue_type_template_id_1a9fb226__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/pages/member/Edit.vue"]])
  18005. /* hot reload */
  18006. if (false) {}
  18007. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  18008. /***/ }),
  18009. /***/ "./resources/js/components/AppDropdown.vue?vue&type=script&setup=true&lang=js":
  18010. /*!************************************************************************************!*\
  18011. !*** ./resources/js/components/AppDropdown.vue?vue&type=script&setup=true&lang=js ***!
  18012. \************************************************************************************/
  18013. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18014. "use strict";
  18015. __webpack_require__.r(__webpack_exports__);
  18016. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18017. /* 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_AppDropdown_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__["default"])
  18018. /* harmony export */ });
  18019. /* 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_AppDropdown_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]!./AppDropdown.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/AppDropdown.vue?vue&type=script&setup=true&lang=js");
  18020. /***/ }),
  18021. /***/ "./resources/js/components/AppInputText.vue?vue&type=script&setup=true&lang=js":
  18022. /*!*************************************************************************************!*\
  18023. !*** ./resources/js/components/AppInputText.vue?vue&type=script&setup=true&lang=js ***!
  18024. \*************************************************************************************/
  18025. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18026. "use strict";
  18027. __webpack_require__.r(__webpack_exports__);
  18028. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18029. /* 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_AppInputText_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__["default"])
  18030. /* harmony export */ });
  18031. /* 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_AppInputText_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]!./AppInputText.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/AppInputText.vue?vue&type=script&setup=true&lang=js");
  18032. /***/ }),
  18033. /***/ "./resources/js/components/AppMessage.vue?vue&type=script&setup=true&lang=js":
  18034. /*!***********************************************************************************!*\
  18035. !*** ./resources/js/components/AppMessage.vue?vue&type=script&setup=true&lang=js ***!
  18036. \***********************************************************************************/
  18037. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18038. "use strict";
  18039. __webpack_require__.r(__webpack_exports__);
  18040. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18041. /* 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"])
  18042. /* harmony export */ });
  18043. /* 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");
  18044. /***/ }),
  18045. /***/ "./resources/js/components/AppSidebar.vue?vue&type=script&setup=true&lang=js":
  18046. /*!***********************************************************************************!*\
  18047. !*** ./resources/js/components/AppSidebar.vue?vue&type=script&setup=true&lang=js ***!
  18048. \***********************************************************************************/
  18049. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18050. "use strict";
  18051. __webpack_require__.r(__webpack_exports__);
  18052. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18053. /* 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"])
  18054. /* harmony export */ });
  18055. /* 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");
  18056. /***/ }),
  18057. /***/ "./resources/js/components/AppSubSidebar.vue?vue&type=script&setup=true&lang=js":
  18058. /*!**************************************************************************************!*\
  18059. !*** ./resources/js/components/AppSubSidebar.vue?vue&type=script&setup=true&lang=js ***!
  18060. \**************************************************************************************/
  18061. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18062. "use strict";
  18063. __webpack_require__.r(__webpack_exports__);
  18064. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18065. /* 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"])
  18066. /* harmony export */ });
  18067. /* 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");
  18068. /***/ }),
  18069. /***/ "./resources/js/components/AppTopBar.vue?vue&type=script&setup=true&lang=js":
  18070. /*!**********************************************************************************!*\
  18071. !*** ./resources/js/components/AppTopBar.vue?vue&type=script&setup=true&lang=js ***!
  18072. \**********************************************************************************/
  18073. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18074. "use strict";
  18075. __webpack_require__.r(__webpack_exports__);
  18076. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18077. /* 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"])
  18078. /* harmony export */ });
  18079. /* 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");
  18080. /***/ }),
  18081. /***/ "./resources/js/layouts/AppLayout.vue?vue&type=script&setup=true&lang=js":
  18082. /*!*******************************************************************************!*\
  18083. !*** ./resources/js/layouts/AppLayout.vue?vue&type=script&setup=true&lang=js ***!
  18084. \*******************************************************************************/
  18085. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18086. "use strict";
  18087. __webpack_require__.r(__webpack_exports__);
  18088. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18089. /* 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"])
  18090. /* harmony export */ });
  18091. /* 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");
  18092. /***/ }),
  18093. /***/ "./resources/js/pages/member/Edit.vue?vue&type=script&setup=true&lang=js":
  18094. /*!*******************************************************************************!*\
  18095. !*** ./resources/js/pages/member/Edit.vue?vue&type=script&setup=true&lang=js ***!
  18096. \*******************************************************************************/
  18097. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18098. "use strict";
  18099. __webpack_require__.r(__webpack_exports__);
  18100. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18101. /* 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_Edit_vue_vue_type_script_setup_true_lang_js__WEBPACK_IMPORTED_MODULE_0__["default"])
  18102. /* harmony export */ });
  18103. /* 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_Edit_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]!./Edit.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/member/Edit.vue?vue&type=script&setup=true&lang=js");
  18104. /***/ }),
  18105. /***/ "./resources/js/components/AppDropdown.vue?vue&type=template&id=ce0d1992":
  18106. /*!*******************************************************************************!*\
  18107. !*** ./resources/js/components/AppDropdown.vue?vue&type=template&id=ce0d1992 ***!
  18108. \*******************************************************************************/
  18109. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18110. "use strict";
  18111. __webpack_require__.r(__webpack_exports__);
  18112. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18113. /* 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_AppDropdown_vue_vue_type_template_id_ce0d1992__WEBPACK_IMPORTED_MODULE_0__.render)
  18114. /* harmony export */ });
  18115. /* 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_AppDropdown_vue_vue_type_template_id_ce0d1992__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]!./AppDropdown.vue?vue&type=template&id=ce0d1992 */ "./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/AppDropdown.vue?vue&type=template&id=ce0d1992");
  18116. /***/ }),
  18117. /***/ "./resources/js/components/AppFooter.vue?vue&type=template&id=4ab6097e":
  18118. /*!*****************************************************************************!*\
  18119. !*** ./resources/js/components/AppFooter.vue?vue&type=template&id=4ab6097e ***!
  18120. \*****************************************************************************/
  18121. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18122. "use strict";
  18123. __webpack_require__.r(__webpack_exports__);
  18124. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18125. /* 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)
  18126. /* harmony export */ });
  18127. /* 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");
  18128. /***/ }),
  18129. /***/ "./resources/js/components/AppInputText.vue?vue&type=template&id=16729fe1":
  18130. /*!********************************************************************************!*\
  18131. !*** ./resources/js/components/AppInputText.vue?vue&type=template&id=16729fe1 ***!
  18132. \********************************************************************************/
  18133. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18134. "use strict";
  18135. __webpack_require__.r(__webpack_exports__);
  18136. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18137. /* 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_AppInputText_vue_vue_type_template_id_16729fe1__WEBPACK_IMPORTED_MODULE_0__.render)
  18138. /* harmony export */ });
  18139. /* 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_AppInputText_vue_vue_type_template_id_16729fe1__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]!./AppInputText.vue?vue&type=template&id=16729fe1 */ "./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/AppInputText.vue?vue&type=template&id=16729fe1");
  18140. /***/ }),
  18141. /***/ "./resources/js/components/AppMessage.vue?vue&type=template&id=07159051":
  18142. /*!******************************************************************************!*\
  18143. !*** ./resources/js/components/AppMessage.vue?vue&type=template&id=07159051 ***!
  18144. \******************************************************************************/
  18145. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18146. "use strict";
  18147. __webpack_require__.r(__webpack_exports__);
  18148. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18149. /* 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)
  18150. /* harmony export */ });
  18151. /* 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");
  18152. /***/ }),
  18153. /***/ "./resources/js/components/AppSidebar.vue?vue&type=template&id=22a4e926":
  18154. /*!******************************************************************************!*\
  18155. !*** ./resources/js/components/AppSidebar.vue?vue&type=template&id=22a4e926 ***!
  18156. \******************************************************************************/
  18157. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18158. "use strict";
  18159. __webpack_require__.r(__webpack_exports__);
  18160. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18161. /* 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)
  18162. /* harmony export */ });
  18163. /* 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");
  18164. /***/ }),
  18165. /***/ "./resources/js/components/AppSubSidebar.vue?vue&type=template&id=0addd9bc":
  18166. /*!*********************************************************************************!*\
  18167. !*** ./resources/js/components/AppSubSidebar.vue?vue&type=template&id=0addd9bc ***!
  18168. \*********************************************************************************/
  18169. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18170. "use strict";
  18171. __webpack_require__.r(__webpack_exports__);
  18172. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18173. /* 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)
  18174. /* harmony export */ });
  18175. /* 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");
  18176. /***/ }),
  18177. /***/ "./resources/js/components/AppTopBar.vue?vue&type=template&id=42bf62a4":
  18178. /*!*****************************************************************************!*\
  18179. !*** ./resources/js/components/AppTopBar.vue?vue&type=template&id=42bf62a4 ***!
  18180. \*****************************************************************************/
  18181. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18182. "use strict";
  18183. __webpack_require__.r(__webpack_exports__);
  18184. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18185. /* 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)
  18186. /* harmony export */ });
  18187. /* 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");
  18188. /***/ }),
  18189. /***/ "./resources/js/layouts/AppLayout.vue?vue&type=template&id=2cfb4112":
  18190. /*!**************************************************************************!*\
  18191. !*** ./resources/js/layouts/AppLayout.vue?vue&type=template&id=2cfb4112 ***!
  18192. \**************************************************************************/
  18193. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18194. "use strict";
  18195. __webpack_require__.r(__webpack_exports__);
  18196. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18197. /* 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)
  18198. /* harmony export */ });
  18199. /* 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");
  18200. /***/ }),
  18201. /***/ "./resources/js/pages/member/Edit.vue?vue&type=template&id=1a9fb226":
  18202. /*!**************************************************************************!*\
  18203. !*** ./resources/js/pages/member/Edit.vue?vue&type=template&id=1a9fb226 ***!
  18204. \**************************************************************************/
  18205. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18206. "use strict";
  18207. __webpack_require__.r(__webpack_exports__);
  18208. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18209. /* 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_Edit_vue_vue_type_template_id_1a9fb226__WEBPACK_IMPORTED_MODULE_0__.render)
  18210. /* harmony export */ });
  18211. /* 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_Edit_vue_vue_type_template_id_1a9fb226__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]!./Edit.vue?vue&type=template&id=1a9fb226 */ "./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/member/Edit.vue?vue&type=template&id=1a9fb226");
  18212. /***/ })
  18213. }]);