resources_js_pages_member_Edit_vue.js 659KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625
  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. label: 'Pengaturan',
  1639. items: [{
  1640. label: 'Tarif Parkir',
  1641. icon: 'pi pi-car',
  1642. to: '/parking-fees/create',
  1643. component: 'parkingfee/Create'
  1644. }]
  1645. }],
  1646. // Operator
  1647. 3: [{
  1648. label: 'Home',
  1649. items: [{
  1650. label: 'Dashboard',
  1651. icon: 'pi pi-home',
  1652. to: '/dashboards',
  1653. component: 'home/Index'
  1654. }]
  1655. }, {
  1656. label: 'Menu',
  1657. items: [{
  1658. label: 'Pengeluaran',
  1659. icon: 'pi pi-wallet',
  1660. to: '/expenses',
  1661. component: 'expense/Index'
  1662. }, {
  1663. label: 'Member',
  1664. icon: 'pi pi-id-card',
  1665. to: '/members',
  1666. component: 'member/Index'
  1667. }, {
  1668. label: 'Top Up',
  1669. icon: 'pi pi-car',
  1670. to: '/top-ups',
  1671. component: 'topup/Index'
  1672. }]
  1673. }]
  1674. });
  1675. /***/ }),
  1676. /***/ "./node_modules/lodash/lodash.js":
  1677. /*!***************************************!*\
  1678. !*** ./node_modules/lodash/lodash.js ***!
  1679. \***************************************/
  1680. /***/ (function(module, exports, __webpack_require__) {
  1681. /* module decorator */ module = __webpack_require__.nmd(module);
  1682. var __WEBPACK_AMD_DEFINE_RESULT__;/**
  1683. * @license
  1684. * Lodash <https://lodash.com/>
  1685. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  1686. * Released under MIT license <https://lodash.com/license>
  1687. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  1688. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  1689. */
  1690. ;(function() {
  1691. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  1692. var undefined;
  1693. /** Used as the semantic version number. */
  1694. var VERSION = '4.17.21';
  1695. /** Used as the size to enable large array optimizations. */
  1696. var LARGE_ARRAY_SIZE = 200;
  1697. /** Error message constants. */
  1698. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  1699. FUNC_ERROR_TEXT = 'Expected a function',
  1700. INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`';
  1701. /** Used to stand-in for `undefined` hash values. */
  1702. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  1703. /** Used as the maximum memoize cache size. */
  1704. var MAX_MEMOIZE_SIZE = 500;
  1705. /** Used as the internal argument placeholder. */
  1706. var PLACEHOLDER = '__lodash_placeholder__';
  1707. /** Used to compose bitmasks for cloning. */
  1708. var CLONE_DEEP_FLAG = 1,
  1709. CLONE_FLAT_FLAG = 2,
  1710. CLONE_SYMBOLS_FLAG = 4;
  1711. /** Used to compose bitmasks for value comparisons. */
  1712. var COMPARE_PARTIAL_FLAG = 1,
  1713. COMPARE_UNORDERED_FLAG = 2;
  1714. /** Used to compose bitmasks for function metadata. */
  1715. var WRAP_BIND_FLAG = 1,
  1716. WRAP_BIND_KEY_FLAG = 2,
  1717. WRAP_CURRY_BOUND_FLAG = 4,
  1718. WRAP_CURRY_FLAG = 8,
  1719. WRAP_CURRY_RIGHT_FLAG = 16,
  1720. WRAP_PARTIAL_FLAG = 32,
  1721. WRAP_PARTIAL_RIGHT_FLAG = 64,
  1722. WRAP_ARY_FLAG = 128,
  1723. WRAP_REARG_FLAG = 256,
  1724. WRAP_FLIP_FLAG = 512;
  1725. /** Used as default options for `_.truncate`. */
  1726. var DEFAULT_TRUNC_LENGTH = 30,
  1727. DEFAULT_TRUNC_OMISSION = '...';
  1728. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  1729. var HOT_COUNT = 800,
  1730. HOT_SPAN = 16;
  1731. /** Used to indicate the type of lazy iteratees. */
  1732. var LAZY_FILTER_FLAG = 1,
  1733. LAZY_MAP_FLAG = 2,
  1734. LAZY_WHILE_FLAG = 3;
  1735. /** Used as references for various `Number` constants. */
  1736. var INFINITY = 1 / 0,
  1737. MAX_SAFE_INTEGER = 9007199254740991,
  1738. MAX_INTEGER = 1.7976931348623157e+308,
  1739. NAN = 0 / 0;
  1740. /** Used as references for the maximum length and index of an array. */
  1741. var MAX_ARRAY_LENGTH = 4294967295,
  1742. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  1743. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  1744. /** Used to associate wrap methods with their bit flags. */
  1745. var wrapFlags = [
  1746. ['ary', WRAP_ARY_FLAG],
  1747. ['bind', WRAP_BIND_FLAG],
  1748. ['bindKey', WRAP_BIND_KEY_FLAG],
  1749. ['curry', WRAP_CURRY_FLAG],
  1750. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  1751. ['flip', WRAP_FLIP_FLAG],
  1752. ['partial', WRAP_PARTIAL_FLAG],
  1753. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  1754. ['rearg', WRAP_REARG_FLAG]
  1755. ];
  1756. /** `Object#toString` result references. */
  1757. var argsTag = '[object Arguments]',
  1758. arrayTag = '[object Array]',
  1759. asyncTag = '[object AsyncFunction]',
  1760. boolTag = '[object Boolean]',
  1761. dateTag = '[object Date]',
  1762. domExcTag = '[object DOMException]',
  1763. errorTag = '[object Error]',
  1764. funcTag = '[object Function]',
  1765. genTag = '[object GeneratorFunction]',
  1766. mapTag = '[object Map]',
  1767. numberTag = '[object Number]',
  1768. nullTag = '[object Null]',
  1769. objectTag = '[object Object]',
  1770. promiseTag = '[object Promise]',
  1771. proxyTag = '[object Proxy]',
  1772. regexpTag = '[object RegExp]',
  1773. setTag = '[object Set]',
  1774. stringTag = '[object String]',
  1775. symbolTag = '[object Symbol]',
  1776. undefinedTag = '[object Undefined]',
  1777. weakMapTag = '[object WeakMap]',
  1778. weakSetTag = '[object WeakSet]';
  1779. var arrayBufferTag = '[object ArrayBuffer]',
  1780. dataViewTag = '[object DataView]',
  1781. float32Tag = '[object Float32Array]',
  1782. float64Tag = '[object Float64Array]',
  1783. int8Tag = '[object Int8Array]',
  1784. int16Tag = '[object Int16Array]',
  1785. int32Tag = '[object Int32Array]',
  1786. uint8Tag = '[object Uint8Array]',
  1787. uint8ClampedTag = '[object Uint8ClampedArray]',
  1788. uint16Tag = '[object Uint16Array]',
  1789. uint32Tag = '[object Uint32Array]';
  1790. /** Used to match empty string literals in compiled template source. */
  1791. var reEmptyStringLeading = /\b__p \+= '';/g,
  1792. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  1793. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  1794. /** Used to match HTML entities and HTML characters. */
  1795. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  1796. reUnescapedHtml = /[&<>"']/g,
  1797. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  1798. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  1799. /** Used to match template delimiters. */
  1800. var reEscape = /<%-([\s\S]+?)%>/g,
  1801. reEvaluate = /<%([\s\S]+?)%>/g,
  1802. reInterpolate = /<%=([\s\S]+?)%>/g;
  1803. /** Used to match property names within property paths. */
  1804. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  1805. reIsPlainProp = /^\w*$/,
  1806. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  1807. /**
  1808. * Used to match `RegExp`
  1809. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  1810. */
  1811. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  1812. reHasRegExpChar = RegExp(reRegExpChar.source);
  1813. /** Used to match leading whitespace. */
  1814. var reTrimStart = /^\s+/;
  1815. /** Used to match a single whitespace character. */
  1816. var reWhitespace = /\s/;
  1817. /** Used to match wrap detail comments. */
  1818. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  1819. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  1820. reSplitDetails = /,? & /;
  1821. /** Used to match words composed of alphanumeric characters. */
  1822. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  1823. /**
  1824. * Used to validate the `validate` option in `_.template` variable.
  1825. *
  1826. * Forbids characters which could potentially change the meaning of the function argument definition:
  1827. * - "()," (modification of function parameters)
  1828. * - "=" (default value)
  1829. * - "[]{}" (destructuring of function parameters)
  1830. * - "/" (beginning of a comment)
  1831. * - whitespace
  1832. */
  1833. var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
  1834. /** Used to match backslashes in property paths. */
  1835. var reEscapeChar = /\\(\\)?/g;
  1836. /**
  1837. * Used to match
  1838. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  1839. */
  1840. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  1841. /** Used to match `RegExp` flags from their coerced string values. */
  1842. var reFlags = /\w*$/;
  1843. /** Used to detect bad signed hexadecimal string values. */
  1844. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  1845. /** Used to detect binary string values. */
  1846. var reIsBinary = /^0b[01]+$/i;
  1847. /** Used to detect host constructors (Safari). */
  1848. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  1849. /** Used to detect octal string values. */
  1850. var reIsOctal = /^0o[0-7]+$/i;
  1851. /** Used to detect unsigned integer values. */
  1852. var reIsUint = /^(?:0|[1-9]\d*)$/;
  1853. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  1854. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  1855. /** Used to ensure capturing order of template delimiters. */
  1856. var reNoMatch = /($^)/;
  1857. /** Used to match unescaped characters in compiled string literals. */
  1858. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  1859. /** Used to compose unicode character classes. */
  1860. var rsAstralRange = '\\ud800-\\udfff',
  1861. rsComboMarksRange = '\\u0300-\\u036f',
  1862. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  1863. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  1864. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  1865. rsDingbatRange = '\\u2700-\\u27bf',
  1866. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  1867. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  1868. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  1869. rsPunctuationRange = '\\u2000-\\u206f',
  1870. 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',
  1871. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  1872. rsVarRange = '\\ufe0e\\ufe0f',
  1873. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  1874. /** Used to compose unicode capture groups. */
  1875. var rsApos = "['\u2019]",
  1876. rsAstral = '[' + rsAstralRange + ']',
  1877. rsBreak = '[' + rsBreakRange + ']',
  1878. rsCombo = '[' + rsComboRange + ']',
  1879. rsDigits = '\\d+',
  1880. rsDingbat = '[' + rsDingbatRange + ']',
  1881. rsLower = '[' + rsLowerRange + ']',
  1882. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  1883. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  1884. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  1885. rsNonAstral = '[^' + rsAstralRange + ']',
  1886. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  1887. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  1888. rsUpper = '[' + rsUpperRange + ']',
  1889. rsZWJ = '\\u200d';
  1890. /** Used to compose unicode regexes. */
  1891. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  1892. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  1893. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  1894. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  1895. reOptMod = rsModifier + '?',
  1896. rsOptVar = '[' + rsVarRange + ']?',
  1897. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  1898. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  1899. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  1900. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  1901. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  1902. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  1903. /** Used to match apostrophes. */
  1904. var reApos = RegExp(rsApos, 'g');
  1905. /**
  1906. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  1907. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  1908. */
  1909. var reComboMark = RegExp(rsCombo, 'g');
  1910. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  1911. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  1912. /** Used to match complex or compound words. */
  1913. var reUnicodeWord = RegExp([
  1914. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  1915. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  1916. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  1917. rsUpper + '+' + rsOptContrUpper,
  1918. rsOrdUpper,
  1919. rsOrdLower,
  1920. rsDigits,
  1921. rsEmoji
  1922. ].join('|'), 'g');
  1923. /** 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/). */
  1924. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  1925. /** Used to detect strings that need a more robust regexp to match words. */
  1926. 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 ]/;
  1927. /** Used to assign default `context` object properties. */
  1928. var contextProps = [
  1929. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  1930. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  1931. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  1932. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  1933. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  1934. ];
  1935. /** Used to make template sourceURLs easier to identify. */
  1936. var templateCounter = -1;
  1937. /** Used to identify `toStringTag` values of typed arrays. */
  1938. var typedArrayTags = {};
  1939. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  1940. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  1941. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  1942. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  1943. typedArrayTags[uint32Tag] = true;
  1944. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  1945. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  1946. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  1947. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  1948. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  1949. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  1950. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  1951. typedArrayTags[weakMapTag] = false;
  1952. /** Used to identify `toStringTag` values supported by `_.clone`. */
  1953. var cloneableTags = {};
  1954. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  1955. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  1956. cloneableTags[boolTag] = cloneableTags[dateTag] =
  1957. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  1958. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  1959. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  1960. cloneableTags[numberTag] = cloneableTags[objectTag] =
  1961. cloneableTags[regexpTag] = cloneableTags[setTag] =
  1962. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  1963. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  1964. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  1965. cloneableTags[errorTag] = cloneableTags[funcTag] =
  1966. cloneableTags[weakMapTag] = false;
  1967. /** Used to map Latin Unicode letters to basic Latin letters. */
  1968. var deburredLetters = {
  1969. // Latin-1 Supplement block.
  1970. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  1971. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  1972. '\xc7': 'C', '\xe7': 'c',
  1973. '\xd0': 'D', '\xf0': 'd',
  1974. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  1975. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  1976. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  1977. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  1978. '\xd1': 'N', '\xf1': 'n',
  1979. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  1980. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  1981. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  1982. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  1983. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  1984. '\xc6': 'Ae', '\xe6': 'ae',
  1985. '\xde': 'Th', '\xfe': 'th',
  1986. '\xdf': 'ss',
  1987. // Latin Extended-A block.
  1988. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  1989. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  1990. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  1991. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  1992. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  1993. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  1994. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  1995. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  1996. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  1997. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  1998. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  1999. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  2000. '\u0134': 'J', '\u0135': 'j',
  2001. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  2002. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  2003. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  2004. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  2005. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  2006. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  2007. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  2008. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  2009. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  2010. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  2011. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  2012. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  2013. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  2014. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  2015. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  2016. '\u0174': 'W', '\u0175': 'w',
  2017. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  2018. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  2019. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  2020. '\u0132': 'IJ', '\u0133': 'ij',
  2021. '\u0152': 'Oe', '\u0153': 'oe',
  2022. '\u0149': "'n", '\u017f': 's'
  2023. };
  2024. /** Used to map characters to HTML entities. */
  2025. var htmlEscapes = {
  2026. '&': '&amp;',
  2027. '<': '&lt;',
  2028. '>': '&gt;',
  2029. '"': '&quot;',
  2030. "'": '&#39;'
  2031. };
  2032. /** Used to map HTML entities to characters. */
  2033. var htmlUnescapes = {
  2034. '&amp;': '&',
  2035. '&lt;': '<',
  2036. '&gt;': '>',
  2037. '&quot;': '"',
  2038. '&#39;': "'"
  2039. };
  2040. /** Used to escape characters for inclusion in compiled string literals. */
  2041. var stringEscapes = {
  2042. '\\': '\\',
  2043. "'": "'",
  2044. '\n': 'n',
  2045. '\r': 'r',
  2046. '\u2028': 'u2028',
  2047. '\u2029': 'u2029'
  2048. };
  2049. /** Built-in method references without a dependency on `root`. */
  2050. var freeParseFloat = parseFloat,
  2051. freeParseInt = parseInt;
  2052. /** Detect free variable `global` from Node.js. */
  2053. var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
  2054. /** Detect free variable `self`. */
  2055. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  2056. /** Used as a reference to the global object. */
  2057. var root = freeGlobal || freeSelf || Function('return this')();
  2058. /** Detect free variable `exports`. */
  2059. var freeExports = true && exports && !exports.nodeType && exports;
  2060. /** Detect free variable `module`. */
  2061. var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module;
  2062. /** Detect the popular CommonJS extension `module.exports`. */
  2063. var moduleExports = freeModule && freeModule.exports === freeExports;
  2064. /** Detect free variable `process` from Node.js. */
  2065. var freeProcess = moduleExports && freeGlobal.process;
  2066. /** Used to access faster Node.js helpers. */
  2067. var nodeUtil = (function() {
  2068. try {
  2069. // Use `util.types` for Node.js 10+.
  2070. var types = freeModule && freeModule.require && freeModule.require('util').types;
  2071. if (types) {
  2072. return types;
  2073. }
  2074. // Legacy `process.binding('util')` for Node.js < 10.
  2075. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  2076. } catch (e) {}
  2077. }());
  2078. /* Node.js helper references. */
  2079. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  2080. nodeIsDate = nodeUtil && nodeUtil.isDate,
  2081. nodeIsMap = nodeUtil && nodeUtil.isMap,
  2082. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  2083. nodeIsSet = nodeUtil && nodeUtil.isSet,
  2084. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  2085. /*--------------------------------------------------------------------------*/
  2086. /**
  2087. * A faster alternative to `Function#apply`, this function invokes `func`
  2088. * with the `this` binding of `thisArg` and the arguments of `args`.
  2089. *
  2090. * @private
  2091. * @param {Function} func The function to invoke.
  2092. * @param {*} thisArg The `this` binding of `func`.
  2093. * @param {Array} args The arguments to invoke `func` with.
  2094. * @returns {*} Returns the result of `func`.
  2095. */
  2096. function apply(func, thisArg, args) {
  2097. switch (args.length) {
  2098. case 0: return func.call(thisArg);
  2099. case 1: return func.call(thisArg, args[0]);
  2100. case 2: return func.call(thisArg, args[0], args[1]);
  2101. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  2102. }
  2103. return func.apply(thisArg, args);
  2104. }
  2105. /**
  2106. * A specialized version of `baseAggregator` for arrays.
  2107. *
  2108. * @private
  2109. * @param {Array} [array] The array to iterate over.
  2110. * @param {Function} setter The function to set `accumulator` values.
  2111. * @param {Function} iteratee The iteratee to transform keys.
  2112. * @param {Object} accumulator The initial aggregated object.
  2113. * @returns {Function} Returns `accumulator`.
  2114. */
  2115. function arrayAggregator(array, setter, iteratee, accumulator) {
  2116. var index = -1,
  2117. length = array == null ? 0 : array.length;
  2118. while (++index < length) {
  2119. var value = array[index];
  2120. setter(accumulator, value, iteratee(value), array);
  2121. }
  2122. return accumulator;
  2123. }
  2124. /**
  2125. * A specialized version of `_.forEach` for arrays without support for
  2126. * iteratee shorthands.
  2127. *
  2128. * @private
  2129. * @param {Array} [array] The array to iterate over.
  2130. * @param {Function} iteratee The function invoked per iteration.
  2131. * @returns {Array} Returns `array`.
  2132. */
  2133. function arrayEach(array, iteratee) {
  2134. var index = -1,
  2135. length = array == null ? 0 : array.length;
  2136. while (++index < length) {
  2137. if (iteratee(array[index], index, array) === false) {
  2138. break;
  2139. }
  2140. }
  2141. return array;
  2142. }
  2143. /**
  2144. * A specialized version of `_.forEachRight` for arrays without support for
  2145. * iteratee shorthands.
  2146. *
  2147. * @private
  2148. * @param {Array} [array] The array to iterate over.
  2149. * @param {Function} iteratee The function invoked per iteration.
  2150. * @returns {Array} Returns `array`.
  2151. */
  2152. function arrayEachRight(array, iteratee) {
  2153. var length = array == null ? 0 : array.length;
  2154. while (length--) {
  2155. if (iteratee(array[length], length, array) === false) {
  2156. break;
  2157. }
  2158. }
  2159. return array;
  2160. }
  2161. /**
  2162. * A specialized version of `_.every` for arrays without support for
  2163. * iteratee shorthands.
  2164. *
  2165. * @private
  2166. * @param {Array} [array] The array to iterate over.
  2167. * @param {Function} predicate The function invoked per iteration.
  2168. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  2169. * else `false`.
  2170. */
  2171. function arrayEvery(array, predicate) {
  2172. var index = -1,
  2173. length = array == null ? 0 : array.length;
  2174. while (++index < length) {
  2175. if (!predicate(array[index], index, array)) {
  2176. return false;
  2177. }
  2178. }
  2179. return true;
  2180. }
  2181. /**
  2182. * A specialized version of `_.filter` for arrays without support for
  2183. * iteratee shorthands.
  2184. *
  2185. * @private
  2186. * @param {Array} [array] The array to iterate over.
  2187. * @param {Function} predicate The function invoked per iteration.
  2188. * @returns {Array} Returns the new filtered array.
  2189. */
  2190. function arrayFilter(array, predicate) {
  2191. var index = -1,
  2192. length = array == null ? 0 : array.length,
  2193. resIndex = 0,
  2194. result = [];
  2195. while (++index < length) {
  2196. var value = array[index];
  2197. if (predicate(value, index, array)) {
  2198. result[resIndex++] = value;
  2199. }
  2200. }
  2201. return result;
  2202. }
  2203. /**
  2204. * A specialized version of `_.includes` for arrays without support for
  2205. * specifying an index to search from.
  2206. *
  2207. * @private
  2208. * @param {Array} [array] The array to inspect.
  2209. * @param {*} target The value to search for.
  2210. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  2211. */
  2212. function arrayIncludes(array, value) {
  2213. var length = array == null ? 0 : array.length;
  2214. return !!length && baseIndexOf(array, value, 0) > -1;
  2215. }
  2216. /**
  2217. * This function is like `arrayIncludes` except that it accepts a comparator.
  2218. *
  2219. * @private
  2220. * @param {Array} [array] The array to inspect.
  2221. * @param {*} target The value to search for.
  2222. * @param {Function} comparator The comparator invoked per element.
  2223. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  2224. */
  2225. function arrayIncludesWith(array, value, comparator) {
  2226. var index = -1,
  2227. length = array == null ? 0 : array.length;
  2228. while (++index < length) {
  2229. if (comparator(value, array[index])) {
  2230. return true;
  2231. }
  2232. }
  2233. return false;
  2234. }
  2235. /**
  2236. * A specialized version of `_.map` for arrays without support for iteratee
  2237. * shorthands.
  2238. *
  2239. * @private
  2240. * @param {Array} [array] The array to iterate over.
  2241. * @param {Function} iteratee The function invoked per iteration.
  2242. * @returns {Array} Returns the new mapped array.
  2243. */
  2244. function arrayMap(array, iteratee) {
  2245. var index = -1,
  2246. length = array == null ? 0 : array.length,
  2247. result = Array(length);
  2248. while (++index < length) {
  2249. result[index] = iteratee(array[index], index, array);
  2250. }
  2251. return result;
  2252. }
  2253. /**
  2254. * Appends the elements of `values` to `array`.
  2255. *
  2256. * @private
  2257. * @param {Array} array The array to modify.
  2258. * @param {Array} values The values to append.
  2259. * @returns {Array} Returns `array`.
  2260. */
  2261. function arrayPush(array, values) {
  2262. var index = -1,
  2263. length = values.length,
  2264. offset = array.length;
  2265. while (++index < length) {
  2266. array[offset + index] = values[index];
  2267. }
  2268. return array;
  2269. }
  2270. /**
  2271. * A specialized version of `_.reduce` for arrays without support for
  2272. * iteratee shorthands.
  2273. *
  2274. * @private
  2275. * @param {Array} [array] The array to iterate over.
  2276. * @param {Function} iteratee The function invoked per iteration.
  2277. * @param {*} [accumulator] The initial value.
  2278. * @param {boolean} [initAccum] Specify using the first element of `array` as
  2279. * the initial value.
  2280. * @returns {*} Returns the accumulated value.
  2281. */
  2282. function arrayReduce(array, iteratee, accumulator, initAccum) {
  2283. var index = -1,
  2284. length = array == null ? 0 : array.length;
  2285. if (initAccum && length) {
  2286. accumulator = array[++index];
  2287. }
  2288. while (++index < length) {
  2289. accumulator = iteratee(accumulator, array[index], index, array);
  2290. }
  2291. return accumulator;
  2292. }
  2293. /**
  2294. * A specialized version of `_.reduceRight` for arrays without support for
  2295. * iteratee shorthands.
  2296. *
  2297. * @private
  2298. * @param {Array} [array] The array to iterate over.
  2299. * @param {Function} iteratee The function invoked per iteration.
  2300. * @param {*} [accumulator] The initial value.
  2301. * @param {boolean} [initAccum] Specify using the last element of `array` as
  2302. * the initial value.
  2303. * @returns {*} Returns the accumulated value.
  2304. */
  2305. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  2306. var length = array == null ? 0 : array.length;
  2307. if (initAccum && length) {
  2308. accumulator = array[--length];
  2309. }
  2310. while (length--) {
  2311. accumulator = iteratee(accumulator, array[length], length, array);
  2312. }
  2313. return accumulator;
  2314. }
  2315. /**
  2316. * A specialized version of `_.some` for arrays without support for iteratee
  2317. * shorthands.
  2318. *
  2319. * @private
  2320. * @param {Array} [array] The array to iterate over.
  2321. * @param {Function} predicate The function invoked per iteration.
  2322. * @returns {boolean} Returns `true` if any element passes the predicate check,
  2323. * else `false`.
  2324. */
  2325. function arraySome(array, predicate) {
  2326. var index = -1,
  2327. length = array == null ? 0 : array.length;
  2328. while (++index < length) {
  2329. if (predicate(array[index], index, array)) {
  2330. return true;
  2331. }
  2332. }
  2333. return false;
  2334. }
  2335. /**
  2336. * Gets the size of an ASCII `string`.
  2337. *
  2338. * @private
  2339. * @param {string} string The string inspect.
  2340. * @returns {number} Returns the string size.
  2341. */
  2342. var asciiSize = baseProperty('length');
  2343. /**
  2344. * Converts an ASCII `string` to an array.
  2345. *
  2346. * @private
  2347. * @param {string} string The string to convert.
  2348. * @returns {Array} Returns the converted array.
  2349. */
  2350. function asciiToArray(string) {
  2351. return string.split('');
  2352. }
  2353. /**
  2354. * Splits an ASCII `string` into an array of its words.
  2355. *
  2356. * @private
  2357. * @param {string} The string to inspect.
  2358. * @returns {Array} Returns the words of `string`.
  2359. */
  2360. function asciiWords(string) {
  2361. return string.match(reAsciiWord) || [];
  2362. }
  2363. /**
  2364. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  2365. * without support for iteratee shorthands, which iterates over `collection`
  2366. * using `eachFunc`.
  2367. *
  2368. * @private
  2369. * @param {Array|Object} collection The collection to inspect.
  2370. * @param {Function} predicate The function invoked per iteration.
  2371. * @param {Function} eachFunc The function to iterate over `collection`.
  2372. * @returns {*} Returns the found element or its key, else `undefined`.
  2373. */
  2374. function baseFindKey(collection, predicate, eachFunc) {
  2375. var result;
  2376. eachFunc(collection, function(value, key, collection) {
  2377. if (predicate(value, key, collection)) {
  2378. result = key;
  2379. return false;
  2380. }
  2381. });
  2382. return result;
  2383. }
  2384. /**
  2385. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  2386. * support for iteratee shorthands.
  2387. *
  2388. * @private
  2389. * @param {Array} array The array to inspect.
  2390. * @param {Function} predicate The function invoked per iteration.
  2391. * @param {number} fromIndex The index to search from.
  2392. * @param {boolean} [fromRight] Specify iterating from right to left.
  2393. * @returns {number} Returns the index of the matched value, else `-1`.
  2394. */
  2395. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  2396. var length = array.length,
  2397. index = fromIndex + (fromRight ? 1 : -1);
  2398. while ((fromRight ? index-- : ++index < length)) {
  2399. if (predicate(array[index], index, array)) {
  2400. return index;
  2401. }
  2402. }
  2403. return -1;
  2404. }
  2405. /**
  2406. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  2407. *
  2408. * @private
  2409. * @param {Array} array The array to inspect.
  2410. * @param {*} value The value to search for.
  2411. * @param {number} fromIndex The index to search from.
  2412. * @returns {number} Returns the index of the matched value, else `-1`.
  2413. */
  2414. function baseIndexOf(array, value, fromIndex) {
  2415. return value === value
  2416. ? strictIndexOf(array, value, fromIndex)
  2417. : baseFindIndex(array, baseIsNaN, fromIndex);
  2418. }
  2419. /**
  2420. * This function is like `baseIndexOf` except that it accepts a comparator.
  2421. *
  2422. * @private
  2423. * @param {Array} array The array to inspect.
  2424. * @param {*} value The value to search for.
  2425. * @param {number} fromIndex The index to search from.
  2426. * @param {Function} comparator The comparator invoked per element.
  2427. * @returns {number} Returns the index of the matched value, else `-1`.
  2428. */
  2429. function baseIndexOfWith(array, value, fromIndex, comparator) {
  2430. var index = fromIndex - 1,
  2431. length = array.length;
  2432. while (++index < length) {
  2433. if (comparator(array[index], value)) {
  2434. return index;
  2435. }
  2436. }
  2437. return -1;
  2438. }
  2439. /**
  2440. * The base implementation of `_.isNaN` without support for number objects.
  2441. *
  2442. * @private
  2443. * @param {*} value The value to check.
  2444. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  2445. */
  2446. function baseIsNaN(value) {
  2447. return value !== value;
  2448. }
  2449. /**
  2450. * The base implementation of `_.mean` and `_.meanBy` without support for
  2451. * iteratee shorthands.
  2452. *
  2453. * @private
  2454. * @param {Array} array The array to iterate over.
  2455. * @param {Function} iteratee The function invoked per iteration.
  2456. * @returns {number} Returns the mean.
  2457. */
  2458. function baseMean(array, iteratee) {
  2459. var length = array == null ? 0 : array.length;
  2460. return length ? (baseSum(array, iteratee) / length) : NAN;
  2461. }
  2462. /**
  2463. * The base implementation of `_.property` without support for deep paths.
  2464. *
  2465. * @private
  2466. * @param {string} key The key of the property to get.
  2467. * @returns {Function} Returns the new accessor function.
  2468. */
  2469. function baseProperty(key) {
  2470. return function(object) {
  2471. return object == null ? undefined : object[key];
  2472. };
  2473. }
  2474. /**
  2475. * The base implementation of `_.propertyOf` without support for deep paths.
  2476. *
  2477. * @private
  2478. * @param {Object} object The object to query.
  2479. * @returns {Function} Returns the new accessor function.
  2480. */
  2481. function basePropertyOf(object) {
  2482. return function(key) {
  2483. return object == null ? undefined : object[key];
  2484. };
  2485. }
  2486. /**
  2487. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  2488. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  2489. *
  2490. * @private
  2491. * @param {Array|Object} collection The collection to iterate over.
  2492. * @param {Function} iteratee The function invoked per iteration.
  2493. * @param {*} accumulator The initial value.
  2494. * @param {boolean} initAccum Specify using the first or last element of
  2495. * `collection` as the initial value.
  2496. * @param {Function} eachFunc The function to iterate over `collection`.
  2497. * @returns {*} Returns the accumulated value.
  2498. */
  2499. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  2500. eachFunc(collection, function(value, index, collection) {
  2501. accumulator = initAccum
  2502. ? (initAccum = false, value)
  2503. : iteratee(accumulator, value, index, collection);
  2504. });
  2505. return accumulator;
  2506. }
  2507. /**
  2508. * The base implementation of `_.sortBy` which uses `comparer` to define the
  2509. * sort order of `array` and replaces criteria objects with their corresponding
  2510. * values.
  2511. *
  2512. * @private
  2513. * @param {Array} array The array to sort.
  2514. * @param {Function} comparer The function to define sort order.
  2515. * @returns {Array} Returns `array`.
  2516. */
  2517. function baseSortBy(array, comparer) {
  2518. var length = array.length;
  2519. array.sort(comparer);
  2520. while (length--) {
  2521. array[length] = array[length].value;
  2522. }
  2523. return array;
  2524. }
  2525. /**
  2526. * The base implementation of `_.sum` and `_.sumBy` without support for
  2527. * iteratee shorthands.
  2528. *
  2529. * @private
  2530. * @param {Array} array The array to iterate over.
  2531. * @param {Function} iteratee The function invoked per iteration.
  2532. * @returns {number} Returns the sum.
  2533. */
  2534. function baseSum(array, iteratee) {
  2535. var result,
  2536. index = -1,
  2537. length = array.length;
  2538. while (++index < length) {
  2539. var current = iteratee(array[index]);
  2540. if (current !== undefined) {
  2541. result = result === undefined ? current : (result + current);
  2542. }
  2543. }
  2544. return result;
  2545. }
  2546. /**
  2547. * The base implementation of `_.times` without support for iteratee shorthands
  2548. * or max array length checks.
  2549. *
  2550. * @private
  2551. * @param {number} n The number of times to invoke `iteratee`.
  2552. * @param {Function} iteratee The function invoked per iteration.
  2553. * @returns {Array} Returns the array of results.
  2554. */
  2555. function baseTimes(n, iteratee) {
  2556. var index = -1,
  2557. result = Array(n);
  2558. while (++index < n) {
  2559. result[index] = iteratee(index);
  2560. }
  2561. return result;
  2562. }
  2563. /**
  2564. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  2565. * of key-value pairs for `object` corresponding to the property names of `props`.
  2566. *
  2567. * @private
  2568. * @param {Object} object The object to query.
  2569. * @param {Array} props The property names to get values for.
  2570. * @returns {Object} Returns the key-value pairs.
  2571. */
  2572. function baseToPairs(object, props) {
  2573. return arrayMap(props, function(key) {
  2574. return [key, object[key]];
  2575. });
  2576. }
  2577. /**
  2578. * The base implementation of `_.trim`.
  2579. *
  2580. * @private
  2581. * @param {string} string The string to trim.
  2582. * @returns {string} Returns the trimmed string.
  2583. */
  2584. function baseTrim(string) {
  2585. return string
  2586. ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
  2587. : string;
  2588. }
  2589. /**
  2590. * The base implementation of `_.unary` without support for storing metadata.
  2591. *
  2592. * @private
  2593. * @param {Function} func The function to cap arguments for.
  2594. * @returns {Function} Returns the new capped function.
  2595. */
  2596. function baseUnary(func) {
  2597. return function(value) {
  2598. return func(value);
  2599. };
  2600. }
  2601. /**
  2602. * The base implementation of `_.values` and `_.valuesIn` which creates an
  2603. * array of `object` property values corresponding to the property names
  2604. * of `props`.
  2605. *
  2606. * @private
  2607. * @param {Object} object The object to query.
  2608. * @param {Array} props The property names to get values for.
  2609. * @returns {Object} Returns the array of property values.
  2610. */
  2611. function baseValues(object, props) {
  2612. return arrayMap(props, function(key) {
  2613. return object[key];
  2614. });
  2615. }
  2616. /**
  2617. * Checks if a `cache` value for `key` exists.
  2618. *
  2619. * @private
  2620. * @param {Object} cache The cache to query.
  2621. * @param {string} key The key of the entry to check.
  2622. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2623. */
  2624. function cacheHas(cache, key) {
  2625. return cache.has(key);
  2626. }
  2627. /**
  2628. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  2629. * that is not found in the character symbols.
  2630. *
  2631. * @private
  2632. * @param {Array} strSymbols The string symbols to inspect.
  2633. * @param {Array} chrSymbols The character symbols to find.
  2634. * @returns {number} Returns the index of the first unmatched string symbol.
  2635. */
  2636. function charsStartIndex(strSymbols, chrSymbols) {
  2637. var index = -1,
  2638. length = strSymbols.length;
  2639. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  2640. return index;
  2641. }
  2642. /**
  2643. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  2644. * that is not found in the character symbols.
  2645. *
  2646. * @private
  2647. * @param {Array} strSymbols The string symbols to inspect.
  2648. * @param {Array} chrSymbols The character symbols to find.
  2649. * @returns {number} Returns the index of the last unmatched string symbol.
  2650. */
  2651. function charsEndIndex(strSymbols, chrSymbols) {
  2652. var index = strSymbols.length;
  2653. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  2654. return index;
  2655. }
  2656. /**
  2657. * Gets the number of `placeholder` occurrences in `array`.
  2658. *
  2659. * @private
  2660. * @param {Array} array The array to inspect.
  2661. * @param {*} placeholder The placeholder to search for.
  2662. * @returns {number} Returns the placeholder count.
  2663. */
  2664. function countHolders(array, placeholder) {
  2665. var length = array.length,
  2666. result = 0;
  2667. while (length--) {
  2668. if (array[length] === placeholder) {
  2669. ++result;
  2670. }
  2671. }
  2672. return result;
  2673. }
  2674. /**
  2675. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  2676. * letters to basic Latin letters.
  2677. *
  2678. * @private
  2679. * @param {string} letter The matched letter to deburr.
  2680. * @returns {string} Returns the deburred letter.
  2681. */
  2682. var deburrLetter = basePropertyOf(deburredLetters);
  2683. /**
  2684. * Used by `_.escape` to convert characters to HTML entities.
  2685. *
  2686. * @private
  2687. * @param {string} chr The matched character to escape.
  2688. * @returns {string} Returns the escaped character.
  2689. */
  2690. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  2691. /**
  2692. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  2693. *
  2694. * @private
  2695. * @param {string} chr The matched character to escape.
  2696. * @returns {string} Returns the escaped character.
  2697. */
  2698. function escapeStringChar(chr) {
  2699. return '\\' + stringEscapes[chr];
  2700. }
  2701. /**
  2702. * Gets the value at `key` of `object`.
  2703. *
  2704. * @private
  2705. * @param {Object} [object] The object to query.
  2706. * @param {string} key The key of the property to get.
  2707. * @returns {*} Returns the property value.
  2708. */
  2709. function getValue(object, key) {
  2710. return object == null ? undefined : object[key];
  2711. }
  2712. /**
  2713. * Checks if `string` contains Unicode symbols.
  2714. *
  2715. * @private
  2716. * @param {string} string The string to inspect.
  2717. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  2718. */
  2719. function hasUnicode(string) {
  2720. return reHasUnicode.test(string);
  2721. }
  2722. /**
  2723. * Checks if `string` contains a word composed of Unicode symbols.
  2724. *
  2725. * @private
  2726. * @param {string} string The string to inspect.
  2727. * @returns {boolean} Returns `true` if a word is found, else `false`.
  2728. */
  2729. function hasUnicodeWord(string) {
  2730. return reHasUnicodeWord.test(string);
  2731. }
  2732. /**
  2733. * Converts `iterator` to an array.
  2734. *
  2735. * @private
  2736. * @param {Object} iterator The iterator to convert.
  2737. * @returns {Array} Returns the converted array.
  2738. */
  2739. function iteratorToArray(iterator) {
  2740. var data,
  2741. result = [];
  2742. while (!(data = iterator.next()).done) {
  2743. result.push(data.value);
  2744. }
  2745. return result;
  2746. }
  2747. /**
  2748. * Converts `map` to its key-value pairs.
  2749. *
  2750. * @private
  2751. * @param {Object} map The map to convert.
  2752. * @returns {Array} Returns the key-value pairs.
  2753. */
  2754. function mapToArray(map) {
  2755. var index = -1,
  2756. result = Array(map.size);
  2757. map.forEach(function(value, key) {
  2758. result[++index] = [key, value];
  2759. });
  2760. return result;
  2761. }
  2762. /**
  2763. * Creates a unary function that invokes `func` with its argument transformed.
  2764. *
  2765. * @private
  2766. * @param {Function} func The function to wrap.
  2767. * @param {Function} transform The argument transform.
  2768. * @returns {Function} Returns the new function.
  2769. */
  2770. function overArg(func, transform) {
  2771. return function(arg) {
  2772. return func(transform(arg));
  2773. };
  2774. }
  2775. /**
  2776. * Replaces all `placeholder` elements in `array` with an internal placeholder
  2777. * and returns an array of their indexes.
  2778. *
  2779. * @private
  2780. * @param {Array} array The array to modify.
  2781. * @param {*} placeholder The placeholder to replace.
  2782. * @returns {Array} Returns the new array of placeholder indexes.
  2783. */
  2784. function replaceHolders(array, placeholder) {
  2785. var index = -1,
  2786. length = array.length,
  2787. resIndex = 0,
  2788. result = [];
  2789. while (++index < length) {
  2790. var value = array[index];
  2791. if (value === placeholder || value === PLACEHOLDER) {
  2792. array[index] = PLACEHOLDER;
  2793. result[resIndex++] = index;
  2794. }
  2795. }
  2796. return result;
  2797. }
  2798. /**
  2799. * Converts `set` to an array of its values.
  2800. *
  2801. * @private
  2802. * @param {Object} set The set to convert.
  2803. * @returns {Array} Returns the values.
  2804. */
  2805. function setToArray(set) {
  2806. var index = -1,
  2807. result = Array(set.size);
  2808. set.forEach(function(value) {
  2809. result[++index] = value;
  2810. });
  2811. return result;
  2812. }
  2813. /**
  2814. * Converts `set` to its value-value pairs.
  2815. *
  2816. * @private
  2817. * @param {Object} set The set to convert.
  2818. * @returns {Array} Returns the value-value pairs.
  2819. */
  2820. function setToPairs(set) {
  2821. var index = -1,
  2822. result = Array(set.size);
  2823. set.forEach(function(value) {
  2824. result[++index] = [value, value];
  2825. });
  2826. return result;
  2827. }
  2828. /**
  2829. * A specialized version of `_.indexOf` which performs strict equality
  2830. * comparisons of values, i.e. `===`.
  2831. *
  2832. * @private
  2833. * @param {Array} array The array to inspect.
  2834. * @param {*} value The value to search for.
  2835. * @param {number} fromIndex The index to search from.
  2836. * @returns {number} Returns the index of the matched value, else `-1`.
  2837. */
  2838. function strictIndexOf(array, value, fromIndex) {
  2839. var index = fromIndex - 1,
  2840. length = array.length;
  2841. while (++index < length) {
  2842. if (array[index] === value) {
  2843. return index;
  2844. }
  2845. }
  2846. return -1;
  2847. }
  2848. /**
  2849. * A specialized version of `_.lastIndexOf` which performs strict equality
  2850. * comparisons of values, i.e. `===`.
  2851. *
  2852. * @private
  2853. * @param {Array} array The array to inspect.
  2854. * @param {*} value The value to search for.
  2855. * @param {number} fromIndex The index to search from.
  2856. * @returns {number} Returns the index of the matched value, else `-1`.
  2857. */
  2858. function strictLastIndexOf(array, value, fromIndex) {
  2859. var index = fromIndex + 1;
  2860. while (index--) {
  2861. if (array[index] === value) {
  2862. return index;
  2863. }
  2864. }
  2865. return index;
  2866. }
  2867. /**
  2868. * Gets the number of symbols in `string`.
  2869. *
  2870. * @private
  2871. * @param {string} string The string to inspect.
  2872. * @returns {number} Returns the string size.
  2873. */
  2874. function stringSize(string) {
  2875. return hasUnicode(string)
  2876. ? unicodeSize(string)
  2877. : asciiSize(string);
  2878. }
  2879. /**
  2880. * Converts `string` to an array.
  2881. *
  2882. * @private
  2883. * @param {string} string The string to convert.
  2884. * @returns {Array} Returns the converted array.
  2885. */
  2886. function stringToArray(string) {
  2887. return hasUnicode(string)
  2888. ? unicodeToArray(string)
  2889. : asciiToArray(string);
  2890. }
  2891. /**
  2892. * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
  2893. * character of `string`.
  2894. *
  2895. * @private
  2896. * @param {string} string The string to inspect.
  2897. * @returns {number} Returns the index of the last non-whitespace character.
  2898. */
  2899. function trimmedEndIndex(string) {
  2900. var index = string.length;
  2901. while (index-- && reWhitespace.test(string.charAt(index))) {}
  2902. return index;
  2903. }
  2904. /**
  2905. * Used by `_.unescape` to convert HTML entities to characters.
  2906. *
  2907. * @private
  2908. * @param {string} chr The matched character to unescape.
  2909. * @returns {string} Returns the unescaped character.
  2910. */
  2911. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  2912. /**
  2913. * Gets the size of a Unicode `string`.
  2914. *
  2915. * @private
  2916. * @param {string} string The string inspect.
  2917. * @returns {number} Returns the string size.
  2918. */
  2919. function unicodeSize(string) {
  2920. var result = reUnicode.lastIndex = 0;
  2921. while (reUnicode.test(string)) {
  2922. ++result;
  2923. }
  2924. return result;
  2925. }
  2926. /**
  2927. * Converts a Unicode `string` to an array.
  2928. *
  2929. * @private
  2930. * @param {string} string The string to convert.
  2931. * @returns {Array} Returns the converted array.
  2932. */
  2933. function unicodeToArray(string) {
  2934. return string.match(reUnicode) || [];
  2935. }
  2936. /**
  2937. * Splits a Unicode `string` into an array of its words.
  2938. *
  2939. * @private
  2940. * @param {string} The string to inspect.
  2941. * @returns {Array} Returns the words of `string`.
  2942. */
  2943. function unicodeWords(string) {
  2944. return string.match(reUnicodeWord) || [];
  2945. }
  2946. /*--------------------------------------------------------------------------*/
  2947. /**
  2948. * Create a new pristine `lodash` function using the `context` object.
  2949. *
  2950. * @static
  2951. * @memberOf _
  2952. * @since 1.1.0
  2953. * @category Util
  2954. * @param {Object} [context=root] The context object.
  2955. * @returns {Function} Returns a new `lodash` function.
  2956. * @example
  2957. *
  2958. * _.mixin({ 'foo': _.constant('foo') });
  2959. *
  2960. * var lodash = _.runInContext();
  2961. * lodash.mixin({ 'bar': lodash.constant('bar') });
  2962. *
  2963. * _.isFunction(_.foo);
  2964. * // => true
  2965. * _.isFunction(_.bar);
  2966. * // => false
  2967. *
  2968. * lodash.isFunction(lodash.foo);
  2969. * // => false
  2970. * lodash.isFunction(lodash.bar);
  2971. * // => true
  2972. *
  2973. * // Create a suped-up `defer` in Node.js.
  2974. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  2975. */
  2976. var runInContext = (function runInContext(context) {
  2977. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  2978. /** Built-in constructor references. */
  2979. var Array = context.Array,
  2980. Date = context.Date,
  2981. Error = context.Error,
  2982. Function = context.Function,
  2983. Math = context.Math,
  2984. Object = context.Object,
  2985. RegExp = context.RegExp,
  2986. String = context.String,
  2987. TypeError = context.TypeError;
  2988. /** Used for built-in method references. */
  2989. var arrayProto = Array.prototype,
  2990. funcProto = Function.prototype,
  2991. objectProto = Object.prototype;
  2992. /** Used to detect overreaching core-js shims. */
  2993. var coreJsData = context['__core-js_shared__'];
  2994. /** Used to resolve the decompiled source of functions. */
  2995. var funcToString = funcProto.toString;
  2996. /** Used to check objects for own properties. */
  2997. var hasOwnProperty = objectProto.hasOwnProperty;
  2998. /** Used to generate unique IDs. */
  2999. var idCounter = 0;
  3000. /** Used to detect methods masquerading as native. */
  3001. var maskSrcKey = (function() {
  3002. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  3003. return uid ? ('Symbol(src)_1.' + uid) : '';
  3004. }());
  3005. /**
  3006. * Used to resolve the
  3007. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  3008. * of values.
  3009. */
  3010. var nativeObjectToString = objectProto.toString;
  3011. /** Used to infer the `Object` constructor. */
  3012. var objectCtorString = funcToString.call(Object);
  3013. /** Used to restore the original `_` reference in `_.noConflict`. */
  3014. var oldDash = root._;
  3015. /** Used to detect if a method is native. */
  3016. var reIsNative = RegExp('^' +
  3017. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  3018. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  3019. );
  3020. /** Built-in value references. */
  3021. var Buffer = moduleExports ? context.Buffer : undefined,
  3022. Symbol = context.Symbol,
  3023. Uint8Array = context.Uint8Array,
  3024. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  3025. getPrototype = overArg(Object.getPrototypeOf, Object),
  3026. objectCreate = Object.create,
  3027. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  3028. splice = arrayProto.splice,
  3029. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  3030. symIterator = Symbol ? Symbol.iterator : undefined,
  3031. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  3032. var defineProperty = (function() {
  3033. try {
  3034. var func = getNative(Object, 'defineProperty');
  3035. func({}, '', {});
  3036. return func;
  3037. } catch (e) {}
  3038. }());
  3039. /** Mocked built-ins. */
  3040. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  3041. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  3042. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  3043. /* Built-in method references for those with the same name as other `lodash` methods. */
  3044. var nativeCeil = Math.ceil,
  3045. nativeFloor = Math.floor,
  3046. nativeGetSymbols = Object.getOwnPropertySymbols,
  3047. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  3048. nativeIsFinite = context.isFinite,
  3049. nativeJoin = arrayProto.join,
  3050. nativeKeys = overArg(Object.keys, Object),
  3051. nativeMax = Math.max,
  3052. nativeMin = Math.min,
  3053. nativeNow = Date.now,
  3054. nativeParseInt = context.parseInt,
  3055. nativeRandom = Math.random,
  3056. nativeReverse = arrayProto.reverse;
  3057. /* Built-in method references that are verified to be native. */
  3058. var DataView = getNative(context, 'DataView'),
  3059. Map = getNative(context, 'Map'),
  3060. Promise = getNative(context, 'Promise'),
  3061. Set = getNative(context, 'Set'),
  3062. WeakMap = getNative(context, 'WeakMap'),
  3063. nativeCreate = getNative(Object, 'create');
  3064. /** Used to store function metadata. */
  3065. var metaMap = WeakMap && new WeakMap;
  3066. /** Used to lookup unminified function names. */
  3067. var realNames = {};
  3068. /** Used to detect maps, sets, and weakmaps. */
  3069. var dataViewCtorString = toSource(DataView),
  3070. mapCtorString = toSource(Map),
  3071. promiseCtorString = toSource(Promise),
  3072. setCtorString = toSource(Set),
  3073. weakMapCtorString = toSource(WeakMap);
  3074. /** Used to convert symbols to primitives and strings. */
  3075. var symbolProto = Symbol ? Symbol.prototype : undefined,
  3076. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  3077. symbolToString = symbolProto ? symbolProto.toString : undefined;
  3078. /*------------------------------------------------------------------------*/
  3079. /**
  3080. * Creates a `lodash` object which wraps `value` to enable implicit method
  3081. * chain sequences. Methods that operate on and return arrays, collections,
  3082. * and functions can be chained together. Methods that retrieve a single value
  3083. * or may return a primitive value will automatically end the chain sequence
  3084. * and return the unwrapped value. Otherwise, the value must be unwrapped
  3085. * with `_#value`.
  3086. *
  3087. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  3088. * enabled using `_.chain`.
  3089. *
  3090. * The execution of chained methods is lazy, that is, it's deferred until
  3091. * `_#value` is implicitly or explicitly called.
  3092. *
  3093. * Lazy evaluation allows several methods to support shortcut fusion.
  3094. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  3095. * the creation of intermediate arrays and can greatly reduce the number of
  3096. * iteratee executions. Sections of a chain sequence qualify for shortcut
  3097. * fusion if the section is applied to an array and iteratees accept only
  3098. * one argument. The heuristic for whether a section qualifies for shortcut
  3099. * fusion is subject to change.
  3100. *
  3101. * Chaining is supported in custom builds as long as the `_#value` method is
  3102. * directly or indirectly included in the build.
  3103. *
  3104. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  3105. *
  3106. * The wrapper `Array` methods are:
  3107. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  3108. *
  3109. * The wrapper `String` methods are:
  3110. * `replace` and `split`
  3111. *
  3112. * The wrapper methods that support shortcut fusion are:
  3113. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  3114. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  3115. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  3116. *
  3117. * The chainable wrapper methods are:
  3118. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  3119. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  3120. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  3121. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  3122. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  3123. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  3124. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  3125. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  3126. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  3127. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  3128. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  3129. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  3130. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  3131. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  3132. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  3133. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  3134. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  3135. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  3136. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  3137. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  3138. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  3139. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  3140. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  3141. * `zipObject`, `zipObjectDeep`, and `zipWith`
  3142. *
  3143. * The wrapper methods that are **not** chainable by default are:
  3144. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  3145. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  3146. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  3147. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  3148. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  3149. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  3150. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  3151. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  3152. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  3153. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  3154. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  3155. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  3156. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  3157. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  3158. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  3159. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  3160. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  3161. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  3162. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  3163. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  3164. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  3165. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  3166. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  3167. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  3168. * `upperFirst`, `value`, and `words`
  3169. *
  3170. * @name _
  3171. * @constructor
  3172. * @category Seq
  3173. * @param {*} value The value to wrap in a `lodash` instance.
  3174. * @returns {Object} Returns the new `lodash` wrapper instance.
  3175. * @example
  3176. *
  3177. * function square(n) {
  3178. * return n * n;
  3179. * }
  3180. *
  3181. * var wrapped = _([1, 2, 3]);
  3182. *
  3183. * // Returns an unwrapped value.
  3184. * wrapped.reduce(_.add);
  3185. * // => 6
  3186. *
  3187. * // Returns a wrapped value.
  3188. * var squares = wrapped.map(square);
  3189. *
  3190. * _.isArray(squares);
  3191. * // => false
  3192. *
  3193. * _.isArray(squares.value());
  3194. * // => true
  3195. */
  3196. function lodash(value) {
  3197. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  3198. if (value instanceof LodashWrapper) {
  3199. return value;
  3200. }
  3201. if (hasOwnProperty.call(value, '__wrapped__')) {
  3202. return wrapperClone(value);
  3203. }
  3204. }
  3205. return new LodashWrapper(value);
  3206. }
  3207. /**
  3208. * The base implementation of `_.create` without support for assigning
  3209. * properties to the created object.
  3210. *
  3211. * @private
  3212. * @param {Object} proto The object to inherit from.
  3213. * @returns {Object} Returns the new object.
  3214. */
  3215. var baseCreate = (function() {
  3216. function object() {}
  3217. return function(proto) {
  3218. if (!isObject(proto)) {
  3219. return {};
  3220. }
  3221. if (objectCreate) {
  3222. return objectCreate(proto);
  3223. }
  3224. object.prototype = proto;
  3225. var result = new object;
  3226. object.prototype = undefined;
  3227. return result;
  3228. };
  3229. }());
  3230. /**
  3231. * The function whose prototype chain sequence wrappers inherit from.
  3232. *
  3233. * @private
  3234. */
  3235. function baseLodash() {
  3236. // No operation performed.
  3237. }
  3238. /**
  3239. * The base constructor for creating `lodash` wrapper objects.
  3240. *
  3241. * @private
  3242. * @param {*} value The value to wrap.
  3243. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  3244. */
  3245. function LodashWrapper(value, chainAll) {
  3246. this.__wrapped__ = value;
  3247. this.__actions__ = [];
  3248. this.__chain__ = !!chainAll;
  3249. this.__index__ = 0;
  3250. this.__values__ = undefined;
  3251. }
  3252. /**
  3253. * By default, the template delimiters used by lodash are like those in
  3254. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  3255. * following template settings to use alternative delimiters.
  3256. *
  3257. * @static
  3258. * @memberOf _
  3259. * @type {Object}
  3260. */
  3261. lodash.templateSettings = {
  3262. /**
  3263. * Used to detect `data` property values to be HTML-escaped.
  3264. *
  3265. * @memberOf _.templateSettings
  3266. * @type {RegExp}
  3267. */
  3268. 'escape': reEscape,
  3269. /**
  3270. * Used to detect code to be evaluated.
  3271. *
  3272. * @memberOf _.templateSettings
  3273. * @type {RegExp}
  3274. */
  3275. 'evaluate': reEvaluate,
  3276. /**
  3277. * Used to detect `data` property values to inject.
  3278. *
  3279. * @memberOf _.templateSettings
  3280. * @type {RegExp}
  3281. */
  3282. 'interpolate': reInterpolate,
  3283. /**
  3284. * Used to reference the data object in the template text.
  3285. *
  3286. * @memberOf _.templateSettings
  3287. * @type {string}
  3288. */
  3289. 'variable': '',
  3290. /**
  3291. * Used to import variables into the compiled template.
  3292. *
  3293. * @memberOf _.templateSettings
  3294. * @type {Object}
  3295. */
  3296. 'imports': {
  3297. /**
  3298. * A reference to the `lodash` function.
  3299. *
  3300. * @memberOf _.templateSettings.imports
  3301. * @type {Function}
  3302. */
  3303. '_': lodash
  3304. }
  3305. };
  3306. // Ensure wrappers are instances of `baseLodash`.
  3307. lodash.prototype = baseLodash.prototype;
  3308. lodash.prototype.constructor = lodash;
  3309. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  3310. LodashWrapper.prototype.constructor = LodashWrapper;
  3311. /*------------------------------------------------------------------------*/
  3312. /**
  3313. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  3314. *
  3315. * @private
  3316. * @constructor
  3317. * @param {*} value The value to wrap.
  3318. */
  3319. function LazyWrapper(value) {
  3320. this.__wrapped__ = value;
  3321. this.__actions__ = [];
  3322. this.__dir__ = 1;
  3323. this.__filtered__ = false;
  3324. this.__iteratees__ = [];
  3325. this.__takeCount__ = MAX_ARRAY_LENGTH;
  3326. this.__views__ = [];
  3327. }
  3328. /**
  3329. * Creates a clone of the lazy wrapper object.
  3330. *
  3331. * @private
  3332. * @name clone
  3333. * @memberOf LazyWrapper
  3334. * @returns {Object} Returns the cloned `LazyWrapper` object.
  3335. */
  3336. function lazyClone() {
  3337. var result = new LazyWrapper(this.__wrapped__);
  3338. result.__actions__ = copyArray(this.__actions__);
  3339. result.__dir__ = this.__dir__;
  3340. result.__filtered__ = this.__filtered__;
  3341. result.__iteratees__ = copyArray(this.__iteratees__);
  3342. result.__takeCount__ = this.__takeCount__;
  3343. result.__views__ = copyArray(this.__views__);
  3344. return result;
  3345. }
  3346. /**
  3347. * Reverses the direction of lazy iteration.
  3348. *
  3349. * @private
  3350. * @name reverse
  3351. * @memberOf LazyWrapper
  3352. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  3353. */
  3354. function lazyReverse() {
  3355. if (this.__filtered__) {
  3356. var result = new LazyWrapper(this);
  3357. result.__dir__ = -1;
  3358. result.__filtered__ = true;
  3359. } else {
  3360. result = this.clone();
  3361. result.__dir__ *= -1;
  3362. }
  3363. return result;
  3364. }
  3365. /**
  3366. * Extracts the unwrapped value from its lazy wrapper.
  3367. *
  3368. * @private
  3369. * @name value
  3370. * @memberOf LazyWrapper
  3371. * @returns {*} Returns the unwrapped value.
  3372. */
  3373. function lazyValue() {
  3374. var array = this.__wrapped__.value(),
  3375. dir = this.__dir__,
  3376. isArr = isArray(array),
  3377. isRight = dir < 0,
  3378. arrLength = isArr ? array.length : 0,
  3379. view = getView(0, arrLength, this.__views__),
  3380. start = view.start,
  3381. end = view.end,
  3382. length = end - start,
  3383. index = isRight ? end : (start - 1),
  3384. iteratees = this.__iteratees__,
  3385. iterLength = iteratees.length,
  3386. resIndex = 0,
  3387. takeCount = nativeMin(length, this.__takeCount__);
  3388. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  3389. return baseWrapperValue(array, this.__actions__);
  3390. }
  3391. var result = [];
  3392. outer:
  3393. while (length-- && resIndex < takeCount) {
  3394. index += dir;
  3395. var iterIndex = -1,
  3396. value = array[index];
  3397. while (++iterIndex < iterLength) {
  3398. var data = iteratees[iterIndex],
  3399. iteratee = data.iteratee,
  3400. type = data.type,
  3401. computed = iteratee(value);
  3402. if (type == LAZY_MAP_FLAG) {
  3403. value = computed;
  3404. } else if (!computed) {
  3405. if (type == LAZY_FILTER_FLAG) {
  3406. continue outer;
  3407. } else {
  3408. break outer;
  3409. }
  3410. }
  3411. }
  3412. result[resIndex++] = value;
  3413. }
  3414. return result;
  3415. }
  3416. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  3417. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  3418. LazyWrapper.prototype.constructor = LazyWrapper;
  3419. /*------------------------------------------------------------------------*/
  3420. /**
  3421. * Creates a hash object.
  3422. *
  3423. * @private
  3424. * @constructor
  3425. * @param {Array} [entries] The key-value pairs to cache.
  3426. */
  3427. function Hash(entries) {
  3428. var index = -1,
  3429. length = entries == null ? 0 : entries.length;
  3430. this.clear();
  3431. while (++index < length) {
  3432. var entry = entries[index];
  3433. this.set(entry[0], entry[1]);
  3434. }
  3435. }
  3436. /**
  3437. * Removes all key-value entries from the hash.
  3438. *
  3439. * @private
  3440. * @name clear
  3441. * @memberOf Hash
  3442. */
  3443. function hashClear() {
  3444. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  3445. this.size = 0;
  3446. }
  3447. /**
  3448. * Removes `key` and its value from the hash.
  3449. *
  3450. * @private
  3451. * @name delete
  3452. * @memberOf Hash
  3453. * @param {Object} hash The hash to modify.
  3454. * @param {string} key The key of the value to remove.
  3455. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3456. */
  3457. function hashDelete(key) {
  3458. var result = this.has(key) && delete this.__data__[key];
  3459. this.size -= result ? 1 : 0;
  3460. return result;
  3461. }
  3462. /**
  3463. * Gets the hash value for `key`.
  3464. *
  3465. * @private
  3466. * @name get
  3467. * @memberOf Hash
  3468. * @param {string} key The key of the value to get.
  3469. * @returns {*} Returns the entry value.
  3470. */
  3471. function hashGet(key) {
  3472. var data = this.__data__;
  3473. if (nativeCreate) {
  3474. var result = data[key];
  3475. return result === HASH_UNDEFINED ? undefined : result;
  3476. }
  3477. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  3478. }
  3479. /**
  3480. * Checks if a hash value for `key` exists.
  3481. *
  3482. * @private
  3483. * @name has
  3484. * @memberOf Hash
  3485. * @param {string} key The key of the entry to check.
  3486. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3487. */
  3488. function hashHas(key) {
  3489. var data = this.__data__;
  3490. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  3491. }
  3492. /**
  3493. * Sets the hash `key` to `value`.
  3494. *
  3495. * @private
  3496. * @name set
  3497. * @memberOf Hash
  3498. * @param {string} key The key of the value to set.
  3499. * @param {*} value The value to set.
  3500. * @returns {Object} Returns the hash instance.
  3501. */
  3502. function hashSet(key, value) {
  3503. var data = this.__data__;
  3504. this.size += this.has(key) ? 0 : 1;
  3505. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  3506. return this;
  3507. }
  3508. // Add methods to `Hash`.
  3509. Hash.prototype.clear = hashClear;
  3510. Hash.prototype['delete'] = hashDelete;
  3511. Hash.prototype.get = hashGet;
  3512. Hash.prototype.has = hashHas;
  3513. Hash.prototype.set = hashSet;
  3514. /*------------------------------------------------------------------------*/
  3515. /**
  3516. * Creates an list cache object.
  3517. *
  3518. * @private
  3519. * @constructor
  3520. * @param {Array} [entries] The key-value pairs to cache.
  3521. */
  3522. function ListCache(entries) {
  3523. var index = -1,
  3524. length = entries == null ? 0 : entries.length;
  3525. this.clear();
  3526. while (++index < length) {
  3527. var entry = entries[index];
  3528. this.set(entry[0], entry[1]);
  3529. }
  3530. }
  3531. /**
  3532. * Removes all key-value entries from the list cache.
  3533. *
  3534. * @private
  3535. * @name clear
  3536. * @memberOf ListCache
  3537. */
  3538. function listCacheClear() {
  3539. this.__data__ = [];
  3540. this.size = 0;
  3541. }
  3542. /**
  3543. * Removes `key` and its value from the list cache.
  3544. *
  3545. * @private
  3546. * @name delete
  3547. * @memberOf ListCache
  3548. * @param {string} key The key of the value to remove.
  3549. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3550. */
  3551. function listCacheDelete(key) {
  3552. var data = this.__data__,
  3553. index = assocIndexOf(data, key);
  3554. if (index < 0) {
  3555. return false;
  3556. }
  3557. var lastIndex = data.length - 1;
  3558. if (index == lastIndex) {
  3559. data.pop();
  3560. } else {
  3561. splice.call(data, index, 1);
  3562. }
  3563. --this.size;
  3564. return true;
  3565. }
  3566. /**
  3567. * Gets the list cache value for `key`.
  3568. *
  3569. * @private
  3570. * @name get
  3571. * @memberOf ListCache
  3572. * @param {string} key The key of the value to get.
  3573. * @returns {*} Returns the entry value.
  3574. */
  3575. function listCacheGet(key) {
  3576. var data = this.__data__,
  3577. index = assocIndexOf(data, key);
  3578. return index < 0 ? undefined : data[index][1];
  3579. }
  3580. /**
  3581. * Checks if a list cache value for `key` exists.
  3582. *
  3583. * @private
  3584. * @name has
  3585. * @memberOf ListCache
  3586. * @param {string} key The key of the entry to check.
  3587. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3588. */
  3589. function listCacheHas(key) {
  3590. return assocIndexOf(this.__data__, key) > -1;
  3591. }
  3592. /**
  3593. * Sets the list cache `key` to `value`.
  3594. *
  3595. * @private
  3596. * @name set
  3597. * @memberOf ListCache
  3598. * @param {string} key The key of the value to set.
  3599. * @param {*} value The value to set.
  3600. * @returns {Object} Returns the list cache instance.
  3601. */
  3602. function listCacheSet(key, value) {
  3603. var data = this.__data__,
  3604. index = assocIndexOf(data, key);
  3605. if (index < 0) {
  3606. ++this.size;
  3607. data.push([key, value]);
  3608. } else {
  3609. data[index][1] = value;
  3610. }
  3611. return this;
  3612. }
  3613. // Add methods to `ListCache`.
  3614. ListCache.prototype.clear = listCacheClear;
  3615. ListCache.prototype['delete'] = listCacheDelete;
  3616. ListCache.prototype.get = listCacheGet;
  3617. ListCache.prototype.has = listCacheHas;
  3618. ListCache.prototype.set = listCacheSet;
  3619. /*------------------------------------------------------------------------*/
  3620. /**
  3621. * Creates a map cache object to store key-value pairs.
  3622. *
  3623. * @private
  3624. * @constructor
  3625. * @param {Array} [entries] The key-value pairs to cache.
  3626. */
  3627. function MapCache(entries) {
  3628. var index = -1,
  3629. length = entries == null ? 0 : entries.length;
  3630. this.clear();
  3631. while (++index < length) {
  3632. var entry = entries[index];
  3633. this.set(entry[0], entry[1]);
  3634. }
  3635. }
  3636. /**
  3637. * Removes all key-value entries from the map.
  3638. *
  3639. * @private
  3640. * @name clear
  3641. * @memberOf MapCache
  3642. */
  3643. function mapCacheClear() {
  3644. this.size = 0;
  3645. this.__data__ = {
  3646. 'hash': new Hash,
  3647. 'map': new (Map || ListCache),
  3648. 'string': new Hash
  3649. };
  3650. }
  3651. /**
  3652. * Removes `key` and its value from the map.
  3653. *
  3654. * @private
  3655. * @name delete
  3656. * @memberOf MapCache
  3657. * @param {string} key The key of the value to remove.
  3658. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3659. */
  3660. function mapCacheDelete(key) {
  3661. var result = getMapData(this, key)['delete'](key);
  3662. this.size -= result ? 1 : 0;
  3663. return result;
  3664. }
  3665. /**
  3666. * Gets the map value for `key`.
  3667. *
  3668. * @private
  3669. * @name get
  3670. * @memberOf MapCache
  3671. * @param {string} key The key of the value to get.
  3672. * @returns {*} Returns the entry value.
  3673. */
  3674. function mapCacheGet(key) {
  3675. return getMapData(this, key).get(key);
  3676. }
  3677. /**
  3678. * Checks if a map value for `key` exists.
  3679. *
  3680. * @private
  3681. * @name has
  3682. * @memberOf MapCache
  3683. * @param {string} key The key of the entry to check.
  3684. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3685. */
  3686. function mapCacheHas(key) {
  3687. return getMapData(this, key).has(key);
  3688. }
  3689. /**
  3690. * Sets the map `key` to `value`.
  3691. *
  3692. * @private
  3693. * @name set
  3694. * @memberOf MapCache
  3695. * @param {string} key The key of the value to set.
  3696. * @param {*} value The value to set.
  3697. * @returns {Object} Returns the map cache instance.
  3698. */
  3699. function mapCacheSet(key, value) {
  3700. var data = getMapData(this, key),
  3701. size = data.size;
  3702. data.set(key, value);
  3703. this.size += data.size == size ? 0 : 1;
  3704. return this;
  3705. }
  3706. // Add methods to `MapCache`.
  3707. MapCache.prototype.clear = mapCacheClear;
  3708. MapCache.prototype['delete'] = mapCacheDelete;
  3709. MapCache.prototype.get = mapCacheGet;
  3710. MapCache.prototype.has = mapCacheHas;
  3711. MapCache.prototype.set = mapCacheSet;
  3712. /*------------------------------------------------------------------------*/
  3713. /**
  3714. *
  3715. * Creates an array cache object to store unique values.
  3716. *
  3717. * @private
  3718. * @constructor
  3719. * @param {Array} [values] The values to cache.
  3720. */
  3721. function SetCache(values) {
  3722. var index = -1,
  3723. length = values == null ? 0 : values.length;
  3724. this.__data__ = new MapCache;
  3725. while (++index < length) {
  3726. this.add(values[index]);
  3727. }
  3728. }
  3729. /**
  3730. * Adds `value` to the array cache.
  3731. *
  3732. * @private
  3733. * @name add
  3734. * @memberOf SetCache
  3735. * @alias push
  3736. * @param {*} value The value to cache.
  3737. * @returns {Object} Returns the cache instance.
  3738. */
  3739. function setCacheAdd(value) {
  3740. this.__data__.set(value, HASH_UNDEFINED);
  3741. return this;
  3742. }
  3743. /**
  3744. * Checks if `value` is in the array cache.
  3745. *
  3746. * @private
  3747. * @name has
  3748. * @memberOf SetCache
  3749. * @param {*} value The value to search for.
  3750. * @returns {number} Returns `true` if `value` is found, else `false`.
  3751. */
  3752. function setCacheHas(value) {
  3753. return this.__data__.has(value);
  3754. }
  3755. // Add methods to `SetCache`.
  3756. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  3757. SetCache.prototype.has = setCacheHas;
  3758. /*------------------------------------------------------------------------*/
  3759. /**
  3760. * Creates a stack cache object to store key-value pairs.
  3761. *
  3762. * @private
  3763. * @constructor
  3764. * @param {Array} [entries] The key-value pairs to cache.
  3765. */
  3766. function Stack(entries) {
  3767. var data = this.__data__ = new ListCache(entries);
  3768. this.size = data.size;
  3769. }
  3770. /**
  3771. * Removes all key-value entries from the stack.
  3772. *
  3773. * @private
  3774. * @name clear
  3775. * @memberOf Stack
  3776. */
  3777. function stackClear() {
  3778. this.__data__ = new ListCache;
  3779. this.size = 0;
  3780. }
  3781. /**
  3782. * Removes `key` and its value from the stack.
  3783. *
  3784. * @private
  3785. * @name delete
  3786. * @memberOf Stack
  3787. * @param {string} key The key of the value to remove.
  3788. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3789. */
  3790. function stackDelete(key) {
  3791. var data = this.__data__,
  3792. result = data['delete'](key);
  3793. this.size = data.size;
  3794. return result;
  3795. }
  3796. /**
  3797. * Gets the stack value for `key`.
  3798. *
  3799. * @private
  3800. * @name get
  3801. * @memberOf Stack
  3802. * @param {string} key The key of the value to get.
  3803. * @returns {*} Returns the entry value.
  3804. */
  3805. function stackGet(key) {
  3806. return this.__data__.get(key);
  3807. }
  3808. /**
  3809. * Checks if a stack value for `key` exists.
  3810. *
  3811. * @private
  3812. * @name has
  3813. * @memberOf Stack
  3814. * @param {string} key The key of the entry to check.
  3815. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3816. */
  3817. function stackHas(key) {
  3818. return this.__data__.has(key);
  3819. }
  3820. /**
  3821. * Sets the stack `key` to `value`.
  3822. *
  3823. * @private
  3824. * @name set
  3825. * @memberOf Stack
  3826. * @param {string} key The key of the value to set.
  3827. * @param {*} value The value to set.
  3828. * @returns {Object} Returns the stack cache instance.
  3829. */
  3830. function stackSet(key, value) {
  3831. var data = this.__data__;
  3832. if (data instanceof ListCache) {
  3833. var pairs = data.__data__;
  3834. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  3835. pairs.push([key, value]);
  3836. this.size = ++data.size;
  3837. return this;
  3838. }
  3839. data = this.__data__ = new MapCache(pairs);
  3840. }
  3841. data.set(key, value);
  3842. this.size = data.size;
  3843. return this;
  3844. }
  3845. // Add methods to `Stack`.
  3846. Stack.prototype.clear = stackClear;
  3847. Stack.prototype['delete'] = stackDelete;
  3848. Stack.prototype.get = stackGet;
  3849. Stack.prototype.has = stackHas;
  3850. Stack.prototype.set = stackSet;
  3851. /*------------------------------------------------------------------------*/
  3852. /**
  3853. * Creates an array of the enumerable property names of the array-like `value`.
  3854. *
  3855. * @private
  3856. * @param {*} value The value to query.
  3857. * @param {boolean} inherited Specify returning inherited property names.
  3858. * @returns {Array} Returns the array of property names.
  3859. */
  3860. function arrayLikeKeys(value, inherited) {
  3861. var isArr = isArray(value),
  3862. isArg = !isArr && isArguments(value),
  3863. isBuff = !isArr && !isArg && isBuffer(value),
  3864. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  3865. skipIndexes = isArr || isArg || isBuff || isType,
  3866. result = skipIndexes ? baseTimes(value.length, String) : [],
  3867. length = result.length;
  3868. for (var key in value) {
  3869. if ((inherited || hasOwnProperty.call(value, key)) &&
  3870. !(skipIndexes && (
  3871. // Safari 9 has enumerable `arguments.length` in strict mode.
  3872. key == 'length' ||
  3873. // Node.js 0.10 has enumerable non-index properties on buffers.
  3874. (isBuff && (key == 'offset' || key == 'parent')) ||
  3875. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  3876. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  3877. // Skip index properties.
  3878. isIndex(key, length)
  3879. ))) {
  3880. result.push(key);
  3881. }
  3882. }
  3883. return result;
  3884. }
  3885. /**
  3886. * A specialized version of `_.sample` for arrays.
  3887. *
  3888. * @private
  3889. * @param {Array} array The array to sample.
  3890. * @returns {*} Returns the random element.
  3891. */
  3892. function arraySample(array) {
  3893. var length = array.length;
  3894. return length ? array[baseRandom(0, length - 1)] : undefined;
  3895. }
  3896. /**
  3897. * A specialized version of `_.sampleSize` for arrays.
  3898. *
  3899. * @private
  3900. * @param {Array} array The array to sample.
  3901. * @param {number} n The number of elements to sample.
  3902. * @returns {Array} Returns the random elements.
  3903. */
  3904. function arraySampleSize(array, n) {
  3905. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  3906. }
  3907. /**
  3908. * A specialized version of `_.shuffle` for arrays.
  3909. *
  3910. * @private
  3911. * @param {Array} array The array to shuffle.
  3912. * @returns {Array} Returns the new shuffled array.
  3913. */
  3914. function arrayShuffle(array) {
  3915. return shuffleSelf(copyArray(array));
  3916. }
  3917. /**
  3918. * This function is like `assignValue` except that it doesn't assign
  3919. * `undefined` values.
  3920. *
  3921. * @private
  3922. * @param {Object} object The object to modify.
  3923. * @param {string} key The key of the property to assign.
  3924. * @param {*} value The value to assign.
  3925. */
  3926. function assignMergeValue(object, key, value) {
  3927. if ((value !== undefined && !eq(object[key], value)) ||
  3928. (value === undefined && !(key in object))) {
  3929. baseAssignValue(object, key, value);
  3930. }
  3931. }
  3932. /**
  3933. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  3934. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  3935. * for equality comparisons.
  3936. *
  3937. * @private
  3938. * @param {Object} object The object to modify.
  3939. * @param {string} key The key of the property to assign.
  3940. * @param {*} value The value to assign.
  3941. */
  3942. function assignValue(object, key, value) {
  3943. var objValue = object[key];
  3944. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  3945. (value === undefined && !(key in object))) {
  3946. baseAssignValue(object, key, value);
  3947. }
  3948. }
  3949. /**
  3950. * Gets the index at which the `key` is found in `array` of key-value pairs.
  3951. *
  3952. * @private
  3953. * @param {Array} array The array to inspect.
  3954. * @param {*} key The key to search for.
  3955. * @returns {number} Returns the index of the matched value, else `-1`.
  3956. */
  3957. function assocIndexOf(array, key) {
  3958. var length = array.length;
  3959. while (length--) {
  3960. if (eq(array[length][0], key)) {
  3961. return length;
  3962. }
  3963. }
  3964. return -1;
  3965. }
  3966. /**
  3967. * Aggregates elements of `collection` on `accumulator` with keys transformed
  3968. * by `iteratee` and values set by `setter`.
  3969. *
  3970. * @private
  3971. * @param {Array|Object} collection The collection to iterate over.
  3972. * @param {Function} setter The function to set `accumulator` values.
  3973. * @param {Function} iteratee The iteratee to transform keys.
  3974. * @param {Object} accumulator The initial aggregated object.
  3975. * @returns {Function} Returns `accumulator`.
  3976. */
  3977. function baseAggregator(collection, setter, iteratee, accumulator) {
  3978. baseEach(collection, function(value, key, collection) {
  3979. setter(accumulator, value, iteratee(value), collection);
  3980. });
  3981. return accumulator;
  3982. }
  3983. /**
  3984. * The base implementation of `_.assign` without support for multiple sources
  3985. * or `customizer` functions.
  3986. *
  3987. * @private
  3988. * @param {Object} object The destination object.
  3989. * @param {Object} source The source object.
  3990. * @returns {Object} Returns `object`.
  3991. */
  3992. function baseAssign(object, source) {
  3993. return object && copyObject(source, keys(source), object);
  3994. }
  3995. /**
  3996. * The base implementation of `_.assignIn` without support for multiple sources
  3997. * or `customizer` functions.
  3998. *
  3999. * @private
  4000. * @param {Object} object The destination object.
  4001. * @param {Object} source The source object.
  4002. * @returns {Object} Returns `object`.
  4003. */
  4004. function baseAssignIn(object, source) {
  4005. return object && copyObject(source, keysIn(source), object);
  4006. }
  4007. /**
  4008. * The base implementation of `assignValue` and `assignMergeValue` without
  4009. * value checks.
  4010. *
  4011. * @private
  4012. * @param {Object} object The object to modify.
  4013. * @param {string} key The key of the property to assign.
  4014. * @param {*} value The value to assign.
  4015. */
  4016. function baseAssignValue(object, key, value) {
  4017. if (key == '__proto__' && defineProperty) {
  4018. defineProperty(object, key, {
  4019. 'configurable': true,
  4020. 'enumerable': true,
  4021. 'value': value,
  4022. 'writable': true
  4023. });
  4024. } else {
  4025. object[key] = value;
  4026. }
  4027. }
  4028. /**
  4029. * The base implementation of `_.at` without support for individual paths.
  4030. *
  4031. * @private
  4032. * @param {Object} object The object to iterate over.
  4033. * @param {string[]} paths The property paths to pick.
  4034. * @returns {Array} Returns the picked elements.
  4035. */
  4036. function baseAt(object, paths) {
  4037. var index = -1,
  4038. length = paths.length,
  4039. result = Array(length),
  4040. skip = object == null;
  4041. while (++index < length) {
  4042. result[index] = skip ? undefined : get(object, paths[index]);
  4043. }
  4044. return result;
  4045. }
  4046. /**
  4047. * The base implementation of `_.clamp` which doesn't coerce arguments.
  4048. *
  4049. * @private
  4050. * @param {number} number The number to clamp.
  4051. * @param {number} [lower] The lower bound.
  4052. * @param {number} upper The upper bound.
  4053. * @returns {number} Returns the clamped number.
  4054. */
  4055. function baseClamp(number, lower, upper) {
  4056. if (number === number) {
  4057. if (upper !== undefined) {
  4058. number = number <= upper ? number : upper;
  4059. }
  4060. if (lower !== undefined) {
  4061. number = number >= lower ? number : lower;
  4062. }
  4063. }
  4064. return number;
  4065. }
  4066. /**
  4067. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  4068. * traversed objects.
  4069. *
  4070. * @private
  4071. * @param {*} value The value to clone.
  4072. * @param {boolean} bitmask The bitmask flags.
  4073. * 1 - Deep clone
  4074. * 2 - Flatten inherited properties
  4075. * 4 - Clone symbols
  4076. * @param {Function} [customizer] The function to customize cloning.
  4077. * @param {string} [key] The key of `value`.
  4078. * @param {Object} [object] The parent object of `value`.
  4079. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  4080. * @returns {*} Returns the cloned value.
  4081. */
  4082. function baseClone(value, bitmask, customizer, key, object, stack) {
  4083. var result,
  4084. isDeep = bitmask & CLONE_DEEP_FLAG,
  4085. isFlat = bitmask & CLONE_FLAT_FLAG,
  4086. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  4087. if (customizer) {
  4088. result = object ? customizer(value, key, object, stack) : customizer(value);
  4089. }
  4090. if (result !== undefined) {
  4091. return result;
  4092. }
  4093. if (!isObject(value)) {
  4094. return value;
  4095. }
  4096. var isArr = isArray(value);
  4097. if (isArr) {
  4098. result = initCloneArray(value);
  4099. if (!isDeep) {
  4100. return copyArray(value, result);
  4101. }
  4102. } else {
  4103. var tag = getTag(value),
  4104. isFunc = tag == funcTag || tag == genTag;
  4105. if (isBuffer(value)) {
  4106. return cloneBuffer(value, isDeep);
  4107. }
  4108. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  4109. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  4110. if (!isDeep) {
  4111. return isFlat
  4112. ? copySymbolsIn(value, baseAssignIn(result, value))
  4113. : copySymbols(value, baseAssign(result, value));
  4114. }
  4115. } else {
  4116. if (!cloneableTags[tag]) {
  4117. return object ? value : {};
  4118. }
  4119. result = initCloneByTag(value, tag, isDeep);
  4120. }
  4121. }
  4122. // Check for circular references and return its corresponding clone.
  4123. stack || (stack = new Stack);
  4124. var stacked = stack.get(value);
  4125. if (stacked) {
  4126. return stacked;
  4127. }
  4128. stack.set(value, result);
  4129. if (isSet(value)) {
  4130. value.forEach(function(subValue) {
  4131. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  4132. });
  4133. } else if (isMap(value)) {
  4134. value.forEach(function(subValue, key) {
  4135. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  4136. });
  4137. }
  4138. var keysFunc = isFull
  4139. ? (isFlat ? getAllKeysIn : getAllKeys)
  4140. : (isFlat ? keysIn : keys);
  4141. var props = isArr ? undefined : keysFunc(value);
  4142. arrayEach(props || value, function(subValue, key) {
  4143. if (props) {
  4144. key = subValue;
  4145. subValue = value[key];
  4146. }
  4147. // Recursively populate clone (susceptible to call stack limits).
  4148. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  4149. });
  4150. return result;
  4151. }
  4152. /**
  4153. * The base implementation of `_.conforms` which doesn't clone `source`.
  4154. *
  4155. * @private
  4156. * @param {Object} source The object of property predicates to conform to.
  4157. * @returns {Function} Returns the new spec function.
  4158. */
  4159. function baseConforms(source) {
  4160. var props = keys(source);
  4161. return function(object) {
  4162. return baseConformsTo(object, source, props);
  4163. };
  4164. }
  4165. /**
  4166. * The base implementation of `_.conformsTo` which accepts `props` to check.
  4167. *
  4168. * @private
  4169. * @param {Object} object The object to inspect.
  4170. * @param {Object} source The object of property predicates to conform to.
  4171. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  4172. */
  4173. function baseConformsTo(object, source, props) {
  4174. var length = props.length;
  4175. if (object == null) {
  4176. return !length;
  4177. }
  4178. object = Object(object);
  4179. while (length--) {
  4180. var key = props[length],
  4181. predicate = source[key],
  4182. value = object[key];
  4183. if ((value === undefined && !(key in object)) || !predicate(value)) {
  4184. return false;
  4185. }
  4186. }
  4187. return true;
  4188. }
  4189. /**
  4190. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  4191. * to provide to `func`.
  4192. *
  4193. * @private
  4194. * @param {Function} func The function to delay.
  4195. * @param {number} wait The number of milliseconds to delay invocation.
  4196. * @param {Array} args The arguments to provide to `func`.
  4197. * @returns {number|Object} Returns the timer id or timeout object.
  4198. */
  4199. function baseDelay(func, wait, args) {
  4200. if (typeof func != 'function') {
  4201. throw new TypeError(FUNC_ERROR_TEXT);
  4202. }
  4203. return setTimeout(function() { func.apply(undefined, args); }, wait);
  4204. }
  4205. /**
  4206. * The base implementation of methods like `_.difference` without support
  4207. * for excluding multiple arrays or iteratee shorthands.
  4208. *
  4209. * @private
  4210. * @param {Array} array The array to inspect.
  4211. * @param {Array} values The values to exclude.
  4212. * @param {Function} [iteratee] The iteratee invoked per element.
  4213. * @param {Function} [comparator] The comparator invoked per element.
  4214. * @returns {Array} Returns the new array of filtered values.
  4215. */
  4216. function baseDifference(array, values, iteratee, comparator) {
  4217. var index = -1,
  4218. includes = arrayIncludes,
  4219. isCommon = true,
  4220. length = array.length,
  4221. result = [],
  4222. valuesLength = values.length;
  4223. if (!length) {
  4224. return result;
  4225. }
  4226. if (iteratee) {
  4227. values = arrayMap(values, baseUnary(iteratee));
  4228. }
  4229. if (comparator) {
  4230. includes = arrayIncludesWith;
  4231. isCommon = false;
  4232. }
  4233. else if (values.length >= LARGE_ARRAY_SIZE) {
  4234. includes = cacheHas;
  4235. isCommon = false;
  4236. values = new SetCache(values);
  4237. }
  4238. outer:
  4239. while (++index < length) {
  4240. var value = array[index],
  4241. computed = iteratee == null ? value : iteratee(value);
  4242. value = (comparator || value !== 0) ? value : 0;
  4243. if (isCommon && computed === computed) {
  4244. var valuesIndex = valuesLength;
  4245. while (valuesIndex--) {
  4246. if (values[valuesIndex] === computed) {
  4247. continue outer;
  4248. }
  4249. }
  4250. result.push(value);
  4251. }
  4252. else if (!includes(values, computed, comparator)) {
  4253. result.push(value);
  4254. }
  4255. }
  4256. return result;
  4257. }
  4258. /**
  4259. * The base implementation of `_.forEach` without support for iteratee shorthands.
  4260. *
  4261. * @private
  4262. * @param {Array|Object} collection The collection to iterate over.
  4263. * @param {Function} iteratee The function invoked per iteration.
  4264. * @returns {Array|Object} Returns `collection`.
  4265. */
  4266. var baseEach = createBaseEach(baseForOwn);
  4267. /**
  4268. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  4269. *
  4270. * @private
  4271. * @param {Array|Object} collection The collection to iterate over.
  4272. * @param {Function} iteratee The function invoked per iteration.
  4273. * @returns {Array|Object} Returns `collection`.
  4274. */
  4275. var baseEachRight = createBaseEach(baseForOwnRight, true);
  4276. /**
  4277. * The base implementation of `_.every` without support for iteratee shorthands.
  4278. *
  4279. * @private
  4280. * @param {Array|Object} collection The collection to iterate over.
  4281. * @param {Function} predicate The function invoked per iteration.
  4282. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  4283. * else `false`
  4284. */
  4285. function baseEvery(collection, predicate) {
  4286. var result = true;
  4287. baseEach(collection, function(value, index, collection) {
  4288. result = !!predicate(value, index, collection);
  4289. return result;
  4290. });
  4291. return result;
  4292. }
  4293. /**
  4294. * The base implementation of methods like `_.max` and `_.min` which accepts a
  4295. * `comparator` to determine the extremum value.
  4296. *
  4297. * @private
  4298. * @param {Array} array The array to iterate over.
  4299. * @param {Function} iteratee The iteratee invoked per iteration.
  4300. * @param {Function} comparator The comparator used to compare values.
  4301. * @returns {*} Returns the extremum value.
  4302. */
  4303. function baseExtremum(array, iteratee, comparator) {
  4304. var index = -1,
  4305. length = array.length;
  4306. while (++index < length) {
  4307. var value = array[index],
  4308. current = iteratee(value);
  4309. if (current != null && (computed === undefined
  4310. ? (current === current && !isSymbol(current))
  4311. : comparator(current, computed)
  4312. )) {
  4313. var computed = current,
  4314. result = value;
  4315. }
  4316. }
  4317. return result;
  4318. }
  4319. /**
  4320. * The base implementation of `_.fill` without an iteratee call guard.
  4321. *
  4322. * @private
  4323. * @param {Array} array The array to fill.
  4324. * @param {*} value The value to fill `array` with.
  4325. * @param {number} [start=0] The start position.
  4326. * @param {number} [end=array.length] The end position.
  4327. * @returns {Array} Returns `array`.
  4328. */
  4329. function baseFill(array, value, start, end) {
  4330. var length = array.length;
  4331. start = toInteger(start);
  4332. if (start < 0) {
  4333. start = -start > length ? 0 : (length + start);
  4334. }
  4335. end = (end === undefined || end > length) ? length : toInteger(end);
  4336. if (end < 0) {
  4337. end += length;
  4338. }
  4339. end = start > end ? 0 : toLength(end);
  4340. while (start < end) {
  4341. array[start++] = value;
  4342. }
  4343. return array;
  4344. }
  4345. /**
  4346. * The base implementation of `_.filter` without support for iteratee shorthands.
  4347. *
  4348. * @private
  4349. * @param {Array|Object} collection The collection to iterate over.
  4350. * @param {Function} predicate The function invoked per iteration.
  4351. * @returns {Array} Returns the new filtered array.
  4352. */
  4353. function baseFilter(collection, predicate) {
  4354. var result = [];
  4355. baseEach(collection, function(value, index, collection) {
  4356. if (predicate(value, index, collection)) {
  4357. result.push(value);
  4358. }
  4359. });
  4360. return result;
  4361. }
  4362. /**
  4363. * The base implementation of `_.flatten` with support for restricting flattening.
  4364. *
  4365. * @private
  4366. * @param {Array} array The array to flatten.
  4367. * @param {number} depth The maximum recursion depth.
  4368. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  4369. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  4370. * @param {Array} [result=[]] The initial result value.
  4371. * @returns {Array} Returns the new flattened array.
  4372. */
  4373. function baseFlatten(array, depth, predicate, isStrict, result) {
  4374. var index = -1,
  4375. length = array.length;
  4376. predicate || (predicate = isFlattenable);
  4377. result || (result = []);
  4378. while (++index < length) {
  4379. var value = array[index];
  4380. if (depth > 0 && predicate(value)) {
  4381. if (depth > 1) {
  4382. // Recursively flatten arrays (susceptible to call stack limits).
  4383. baseFlatten(value, depth - 1, predicate, isStrict, result);
  4384. } else {
  4385. arrayPush(result, value);
  4386. }
  4387. } else if (!isStrict) {
  4388. result[result.length] = value;
  4389. }
  4390. }
  4391. return result;
  4392. }
  4393. /**
  4394. * The base implementation of `baseForOwn` which iterates over `object`
  4395. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  4396. * Iteratee functions may exit iteration early by explicitly returning `false`.
  4397. *
  4398. * @private
  4399. * @param {Object} object The object to iterate over.
  4400. * @param {Function} iteratee The function invoked per iteration.
  4401. * @param {Function} keysFunc The function to get the keys of `object`.
  4402. * @returns {Object} Returns `object`.
  4403. */
  4404. var baseFor = createBaseFor();
  4405. /**
  4406. * This function is like `baseFor` except that it iterates over properties
  4407. * in the opposite order.
  4408. *
  4409. * @private
  4410. * @param {Object} object The object to iterate over.
  4411. * @param {Function} iteratee The function invoked per iteration.
  4412. * @param {Function} keysFunc The function to get the keys of `object`.
  4413. * @returns {Object} Returns `object`.
  4414. */
  4415. var baseForRight = createBaseFor(true);
  4416. /**
  4417. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  4418. *
  4419. * @private
  4420. * @param {Object} object The object to iterate over.
  4421. * @param {Function} iteratee The function invoked per iteration.
  4422. * @returns {Object} Returns `object`.
  4423. */
  4424. function baseForOwn(object, iteratee) {
  4425. return object && baseFor(object, iteratee, keys);
  4426. }
  4427. /**
  4428. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  4429. *
  4430. * @private
  4431. * @param {Object} object The object to iterate over.
  4432. * @param {Function} iteratee The function invoked per iteration.
  4433. * @returns {Object} Returns `object`.
  4434. */
  4435. function baseForOwnRight(object, iteratee) {
  4436. return object && baseForRight(object, iteratee, keys);
  4437. }
  4438. /**
  4439. * The base implementation of `_.functions` which creates an array of
  4440. * `object` function property names filtered from `props`.
  4441. *
  4442. * @private
  4443. * @param {Object} object The object to inspect.
  4444. * @param {Array} props The property names to filter.
  4445. * @returns {Array} Returns the function names.
  4446. */
  4447. function baseFunctions(object, props) {
  4448. return arrayFilter(props, function(key) {
  4449. return isFunction(object[key]);
  4450. });
  4451. }
  4452. /**
  4453. * The base implementation of `_.get` without support for default values.
  4454. *
  4455. * @private
  4456. * @param {Object} object The object to query.
  4457. * @param {Array|string} path The path of the property to get.
  4458. * @returns {*} Returns the resolved value.
  4459. */
  4460. function baseGet(object, path) {
  4461. path = castPath(path, object);
  4462. var index = 0,
  4463. length = path.length;
  4464. while (object != null && index < length) {
  4465. object = object[toKey(path[index++])];
  4466. }
  4467. return (index && index == length) ? object : undefined;
  4468. }
  4469. /**
  4470. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  4471. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  4472. * symbols of `object`.
  4473. *
  4474. * @private
  4475. * @param {Object} object The object to query.
  4476. * @param {Function} keysFunc The function to get the keys of `object`.
  4477. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  4478. * @returns {Array} Returns the array of property names and symbols.
  4479. */
  4480. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  4481. var result = keysFunc(object);
  4482. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  4483. }
  4484. /**
  4485. * The base implementation of `getTag` without fallbacks for buggy environments.
  4486. *
  4487. * @private
  4488. * @param {*} value The value to query.
  4489. * @returns {string} Returns the `toStringTag`.
  4490. */
  4491. function baseGetTag(value) {
  4492. if (value == null) {
  4493. return value === undefined ? undefinedTag : nullTag;
  4494. }
  4495. return (symToStringTag && symToStringTag in Object(value))
  4496. ? getRawTag(value)
  4497. : objectToString(value);
  4498. }
  4499. /**
  4500. * The base implementation of `_.gt` which doesn't coerce arguments.
  4501. *
  4502. * @private
  4503. * @param {*} value The value to compare.
  4504. * @param {*} other The other value to compare.
  4505. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  4506. * else `false`.
  4507. */
  4508. function baseGt(value, other) {
  4509. return value > other;
  4510. }
  4511. /**
  4512. * The base implementation of `_.has` without support for deep paths.
  4513. *
  4514. * @private
  4515. * @param {Object} [object] The object to query.
  4516. * @param {Array|string} key The key to check.
  4517. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  4518. */
  4519. function baseHas(object, key) {
  4520. return object != null && hasOwnProperty.call(object, key);
  4521. }
  4522. /**
  4523. * The base implementation of `_.hasIn` without support for deep paths.
  4524. *
  4525. * @private
  4526. * @param {Object} [object] The object to query.
  4527. * @param {Array|string} key The key to check.
  4528. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  4529. */
  4530. function baseHasIn(object, key) {
  4531. return object != null && key in Object(object);
  4532. }
  4533. /**
  4534. * The base implementation of `_.inRange` which doesn't coerce arguments.
  4535. *
  4536. * @private
  4537. * @param {number} number The number to check.
  4538. * @param {number} start The start of the range.
  4539. * @param {number} end The end of the range.
  4540. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  4541. */
  4542. function baseInRange(number, start, end) {
  4543. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  4544. }
  4545. /**
  4546. * The base implementation of methods like `_.intersection`, without support
  4547. * for iteratee shorthands, that accepts an array of arrays to inspect.
  4548. *
  4549. * @private
  4550. * @param {Array} arrays The arrays to inspect.
  4551. * @param {Function} [iteratee] The iteratee invoked per element.
  4552. * @param {Function} [comparator] The comparator invoked per element.
  4553. * @returns {Array} Returns the new array of shared values.
  4554. */
  4555. function baseIntersection(arrays, iteratee, comparator) {
  4556. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  4557. length = arrays[0].length,
  4558. othLength = arrays.length,
  4559. othIndex = othLength,
  4560. caches = Array(othLength),
  4561. maxLength = Infinity,
  4562. result = [];
  4563. while (othIndex--) {
  4564. var array = arrays[othIndex];
  4565. if (othIndex && iteratee) {
  4566. array = arrayMap(array, baseUnary(iteratee));
  4567. }
  4568. maxLength = nativeMin(array.length, maxLength);
  4569. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  4570. ? new SetCache(othIndex && array)
  4571. : undefined;
  4572. }
  4573. array = arrays[0];
  4574. var index = -1,
  4575. seen = caches[0];
  4576. outer:
  4577. while (++index < length && result.length < maxLength) {
  4578. var value = array[index],
  4579. computed = iteratee ? iteratee(value) : value;
  4580. value = (comparator || value !== 0) ? value : 0;
  4581. if (!(seen
  4582. ? cacheHas(seen, computed)
  4583. : includes(result, computed, comparator)
  4584. )) {
  4585. othIndex = othLength;
  4586. while (--othIndex) {
  4587. var cache = caches[othIndex];
  4588. if (!(cache
  4589. ? cacheHas(cache, computed)
  4590. : includes(arrays[othIndex], computed, comparator))
  4591. ) {
  4592. continue outer;
  4593. }
  4594. }
  4595. if (seen) {
  4596. seen.push(computed);
  4597. }
  4598. result.push(value);
  4599. }
  4600. }
  4601. return result;
  4602. }
  4603. /**
  4604. * The base implementation of `_.invert` and `_.invertBy` which inverts
  4605. * `object` with values transformed by `iteratee` and set by `setter`.
  4606. *
  4607. * @private
  4608. * @param {Object} object The object to iterate over.
  4609. * @param {Function} setter The function to set `accumulator` values.
  4610. * @param {Function} iteratee The iteratee to transform values.
  4611. * @param {Object} accumulator The initial inverted object.
  4612. * @returns {Function} Returns `accumulator`.
  4613. */
  4614. function baseInverter(object, setter, iteratee, accumulator) {
  4615. baseForOwn(object, function(value, key, object) {
  4616. setter(accumulator, iteratee(value), key, object);
  4617. });
  4618. return accumulator;
  4619. }
  4620. /**
  4621. * The base implementation of `_.invoke` without support for individual
  4622. * method arguments.
  4623. *
  4624. * @private
  4625. * @param {Object} object The object to query.
  4626. * @param {Array|string} path The path of the method to invoke.
  4627. * @param {Array} args The arguments to invoke the method with.
  4628. * @returns {*} Returns the result of the invoked method.
  4629. */
  4630. function baseInvoke(object, path, args) {
  4631. path = castPath(path, object);
  4632. object = parent(object, path);
  4633. var func = object == null ? object : object[toKey(last(path))];
  4634. return func == null ? undefined : apply(func, object, args);
  4635. }
  4636. /**
  4637. * The base implementation of `_.isArguments`.
  4638. *
  4639. * @private
  4640. * @param {*} value The value to check.
  4641. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  4642. */
  4643. function baseIsArguments(value) {
  4644. return isObjectLike(value) && baseGetTag(value) == argsTag;
  4645. }
  4646. /**
  4647. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  4648. *
  4649. * @private
  4650. * @param {*} value The value to check.
  4651. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  4652. */
  4653. function baseIsArrayBuffer(value) {
  4654. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  4655. }
  4656. /**
  4657. * The base implementation of `_.isDate` without Node.js optimizations.
  4658. *
  4659. * @private
  4660. * @param {*} value The value to check.
  4661. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  4662. */
  4663. function baseIsDate(value) {
  4664. return isObjectLike(value) && baseGetTag(value) == dateTag;
  4665. }
  4666. /**
  4667. * The base implementation of `_.isEqual` which supports partial comparisons
  4668. * and tracks traversed objects.
  4669. *
  4670. * @private
  4671. * @param {*} value The value to compare.
  4672. * @param {*} other The other value to compare.
  4673. * @param {boolean} bitmask The bitmask flags.
  4674. * 1 - Unordered comparison
  4675. * 2 - Partial comparison
  4676. * @param {Function} [customizer] The function to customize comparisons.
  4677. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  4678. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  4679. */
  4680. function baseIsEqual(value, other, bitmask, customizer, stack) {
  4681. if (value === other) {
  4682. return true;
  4683. }
  4684. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  4685. return value !== value && other !== other;
  4686. }
  4687. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  4688. }
  4689. /**
  4690. * A specialized version of `baseIsEqual` for arrays and objects which performs
  4691. * deep comparisons and tracks traversed objects enabling objects with circular
  4692. * references to be compared.
  4693. *
  4694. * @private
  4695. * @param {Object} object The object to compare.
  4696. * @param {Object} other The other object to compare.
  4697. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  4698. * @param {Function} customizer The function to customize comparisons.
  4699. * @param {Function} equalFunc The function to determine equivalents of values.
  4700. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  4701. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  4702. */
  4703. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  4704. var objIsArr = isArray(object),
  4705. othIsArr = isArray(other),
  4706. objTag = objIsArr ? arrayTag : getTag(object),
  4707. othTag = othIsArr ? arrayTag : getTag(other);
  4708. objTag = objTag == argsTag ? objectTag : objTag;
  4709. othTag = othTag == argsTag ? objectTag : othTag;
  4710. var objIsObj = objTag == objectTag,
  4711. othIsObj = othTag == objectTag,
  4712. isSameTag = objTag == othTag;
  4713. if (isSameTag && isBuffer(object)) {
  4714. if (!isBuffer(other)) {
  4715. return false;
  4716. }
  4717. objIsArr = true;
  4718. objIsObj = false;
  4719. }
  4720. if (isSameTag && !objIsObj) {
  4721. stack || (stack = new Stack);
  4722. return (objIsArr || isTypedArray(object))
  4723. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  4724. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  4725. }
  4726. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  4727. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  4728. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  4729. if (objIsWrapped || othIsWrapped) {
  4730. var objUnwrapped = objIsWrapped ? object.value() : object,
  4731. othUnwrapped = othIsWrapped ? other.value() : other;
  4732. stack || (stack = new Stack);
  4733. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  4734. }
  4735. }
  4736. if (!isSameTag) {
  4737. return false;
  4738. }
  4739. stack || (stack = new Stack);
  4740. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  4741. }
  4742. /**
  4743. * The base implementation of `_.isMap` without Node.js optimizations.
  4744. *
  4745. * @private
  4746. * @param {*} value The value to check.
  4747. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  4748. */
  4749. function baseIsMap(value) {
  4750. return isObjectLike(value) && getTag(value) == mapTag;
  4751. }
  4752. /**
  4753. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  4754. *
  4755. * @private
  4756. * @param {Object} object The object to inspect.
  4757. * @param {Object} source The object of property values to match.
  4758. * @param {Array} matchData The property names, values, and compare flags to match.
  4759. * @param {Function} [customizer] The function to customize comparisons.
  4760. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  4761. */
  4762. function baseIsMatch(object, source, matchData, customizer) {
  4763. var index = matchData.length,
  4764. length = index,
  4765. noCustomizer = !customizer;
  4766. if (object == null) {
  4767. return !length;
  4768. }
  4769. object = Object(object);
  4770. while (index--) {
  4771. var data = matchData[index];
  4772. if ((noCustomizer && data[2])
  4773. ? data[1] !== object[data[0]]
  4774. : !(data[0] in object)
  4775. ) {
  4776. return false;
  4777. }
  4778. }
  4779. while (++index < length) {
  4780. data = matchData[index];
  4781. var key = data[0],
  4782. objValue = object[key],
  4783. srcValue = data[1];
  4784. if (noCustomizer && data[2]) {
  4785. if (objValue === undefined && !(key in object)) {
  4786. return false;
  4787. }
  4788. } else {
  4789. var stack = new Stack;
  4790. if (customizer) {
  4791. var result = customizer(objValue, srcValue, key, object, source, stack);
  4792. }
  4793. if (!(result === undefined
  4794. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  4795. : result
  4796. )) {
  4797. return false;
  4798. }
  4799. }
  4800. }
  4801. return true;
  4802. }
  4803. /**
  4804. * The base implementation of `_.isNative` without bad shim checks.
  4805. *
  4806. * @private
  4807. * @param {*} value The value to check.
  4808. * @returns {boolean} Returns `true` if `value` is a native function,
  4809. * else `false`.
  4810. */
  4811. function baseIsNative(value) {
  4812. if (!isObject(value) || isMasked(value)) {
  4813. return false;
  4814. }
  4815. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  4816. return pattern.test(toSource(value));
  4817. }
  4818. /**
  4819. * The base implementation of `_.isRegExp` without Node.js optimizations.
  4820. *
  4821. * @private
  4822. * @param {*} value The value to check.
  4823. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  4824. */
  4825. function baseIsRegExp(value) {
  4826. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  4827. }
  4828. /**
  4829. * The base implementation of `_.isSet` without Node.js optimizations.
  4830. *
  4831. * @private
  4832. * @param {*} value The value to check.
  4833. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  4834. */
  4835. function baseIsSet(value) {
  4836. return isObjectLike(value) && getTag(value) == setTag;
  4837. }
  4838. /**
  4839. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  4840. *
  4841. * @private
  4842. * @param {*} value The value to check.
  4843. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  4844. */
  4845. function baseIsTypedArray(value) {
  4846. return isObjectLike(value) &&
  4847. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  4848. }
  4849. /**
  4850. * The base implementation of `_.iteratee`.
  4851. *
  4852. * @private
  4853. * @param {*} [value=_.identity] The value to convert to an iteratee.
  4854. * @returns {Function} Returns the iteratee.
  4855. */
  4856. function baseIteratee(value) {
  4857. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  4858. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  4859. if (typeof value == 'function') {
  4860. return value;
  4861. }
  4862. if (value == null) {
  4863. return identity;
  4864. }
  4865. if (typeof value == 'object') {
  4866. return isArray(value)
  4867. ? baseMatchesProperty(value[0], value[1])
  4868. : baseMatches(value);
  4869. }
  4870. return property(value);
  4871. }
  4872. /**
  4873. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  4874. *
  4875. * @private
  4876. * @param {Object} object The object to query.
  4877. * @returns {Array} Returns the array of property names.
  4878. */
  4879. function baseKeys(object) {
  4880. if (!isPrototype(object)) {
  4881. return nativeKeys(object);
  4882. }
  4883. var result = [];
  4884. for (var key in Object(object)) {
  4885. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  4886. result.push(key);
  4887. }
  4888. }
  4889. return result;
  4890. }
  4891. /**
  4892. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  4893. *
  4894. * @private
  4895. * @param {Object} object The object to query.
  4896. * @returns {Array} Returns the array of property names.
  4897. */
  4898. function baseKeysIn(object) {
  4899. if (!isObject(object)) {
  4900. return nativeKeysIn(object);
  4901. }
  4902. var isProto = isPrototype(object),
  4903. result = [];
  4904. for (var key in object) {
  4905. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  4906. result.push(key);
  4907. }
  4908. }
  4909. return result;
  4910. }
  4911. /**
  4912. * The base implementation of `_.lt` which doesn't coerce arguments.
  4913. *
  4914. * @private
  4915. * @param {*} value The value to compare.
  4916. * @param {*} other The other value to compare.
  4917. * @returns {boolean} Returns `true` if `value` is less than `other`,
  4918. * else `false`.
  4919. */
  4920. function baseLt(value, other) {
  4921. return value < other;
  4922. }
  4923. /**
  4924. * The base implementation of `_.map` without support for iteratee shorthands.
  4925. *
  4926. * @private
  4927. * @param {Array|Object} collection The collection to iterate over.
  4928. * @param {Function} iteratee The function invoked per iteration.
  4929. * @returns {Array} Returns the new mapped array.
  4930. */
  4931. function baseMap(collection, iteratee) {
  4932. var index = -1,
  4933. result = isArrayLike(collection) ? Array(collection.length) : [];
  4934. baseEach(collection, function(value, key, collection) {
  4935. result[++index] = iteratee(value, key, collection);
  4936. });
  4937. return result;
  4938. }
  4939. /**
  4940. * The base implementation of `_.matches` which doesn't clone `source`.
  4941. *
  4942. * @private
  4943. * @param {Object} source The object of property values to match.
  4944. * @returns {Function} Returns the new spec function.
  4945. */
  4946. function baseMatches(source) {
  4947. var matchData = getMatchData(source);
  4948. if (matchData.length == 1 && matchData[0][2]) {
  4949. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  4950. }
  4951. return function(object) {
  4952. return object === source || baseIsMatch(object, source, matchData);
  4953. };
  4954. }
  4955. /**
  4956. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  4957. *
  4958. * @private
  4959. * @param {string} path The path of the property to get.
  4960. * @param {*} srcValue The value to match.
  4961. * @returns {Function} Returns the new spec function.
  4962. */
  4963. function baseMatchesProperty(path, srcValue) {
  4964. if (isKey(path) && isStrictComparable(srcValue)) {
  4965. return matchesStrictComparable(toKey(path), srcValue);
  4966. }
  4967. return function(object) {
  4968. var objValue = get(object, path);
  4969. return (objValue === undefined && objValue === srcValue)
  4970. ? hasIn(object, path)
  4971. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  4972. };
  4973. }
  4974. /**
  4975. * The base implementation of `_.merge` without support for multiple sources.
  4976. *
  4977. * @private
  4978. * @param {Object} object The destination object.
  4979. * @param {Object} source The source object.
  4980. * @param {number} srcIndex The index of `source`.
  4981. * @param {Function} [customizer] The function to customize merged values.
  4982. * @param {Object} [stack] Tracks traversed source values and their merged
  4983. * counterparts.
  4984. */
  4985. function baseMerge(object, source, srcIndex, customizer, stack) {
  4986. if (object === source) {
  4987. return;
  4988. }
  4989. baseFor(source, function(srcValue, key) {
  4990. stack || (stack = new Stack);
  4991. if (isObject(srcValue)) {
  4992. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  4993. }
  4994. else {
  4995. var newValue = customizer
  4996. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  4997. : undefined;
  4998. if (newValue === undefined) {
  4999. newValue = srcValue;
  5000. }
  5001. assignMergeValue(object, key, newValue);
  5002. }
  5003. }, keysIn);
  5004. }
  5005. /**
  5006. * A specialized version of `baseMerge` for arrays and objects which performs
  5007. * deep merges and tracks traversed objects enabling objects with circular
  5008. * references to be merged.
  5009. *
  5010. * @private
  5011. * @param {Object} object The destination object.
  5012. * @param {Object} source The source object.
  5013. * @param {string} key The key of the value to merge.
  5014. * @param {number} srcIndex The index of `source`.
  5015. * @param {Function} mergeFunc The function to merge values.
  5016. * @param {Function} [customizer] The function to customize assigned values.
  5017. * @param {Object} [stack] Tracks traversed source values and their merged
  5018. * counterparts.
  5019. */
  5020. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  5021. var objValue = safeGet(object, key),
  5022. srcValue = safeGet(source, key),
  5023. stacked = stack.get(srcValue);
  5024. if (stacked) {
  5025. assignMergeValue(object, key, stacked);
  5026. return;
  5027. }
  5028. var newValue = customizer
  5029. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  5030. : undefined;
  5031. var isCommon = newValue === undefined;
  5032. if (isCommon) {
  5033. var isArr = isArray(srcValue),
  5034. isBuff = !isArr && isBuffer(srcValue),
  5035. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  5036. newValue = srcValue;
  5037. if (isArr || isBuff || isTyped) {
  5038. if (isArray(objValue)) {
  5039. newValue = objValue;
  5040. }
  5041. else if (isArrayLikeObject(objValue)) {
  5042. newValue = copyArray(objValue);
  5043. }
  5044. else if (isBuff) {
  5045. isCommon = false;
  5046. newValue = cloneBuffer(srcValue, true);
  5047. }
  5048. else if (isTyped) {
  5049. isCommon = false;
  5050. newValue = cloneTypedArray(srcValue, true);
  5051. }
  5052. else {
  5053. newValue = [];
  5054. }
  5055. }
  5056. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  5057. newValue = objValue;
  5058. if (isArguments(objValue)) {
  5059. newValue = toPlainObject(objValue);
  5060. }
  5061. else if (!isObject(objValue) || isFunction(objValue)) {
  5062. newValue = initCloneObject(srcValue);
  5063. }
  5064. }
  5065. else {
  5066. isCommon = false;
  5067. }
  5068. }
  5069. if (isCommon) {
  5070. // Recursively merge objects and arrays (susceptible to call stack limits).
  5071. stack.set(srcValue, newValue);
  5072. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  5073. stack['delete'](srcValue);
  5074. }
  5075. assignMergeValue(object, key, newValue);
  5076. }
  5077. /**
  5078. * The base implementation of `_.nth` which doesn't coerce arguments.
  5079. *
  5080. * @private
  5081. * @param {Array} array The array to query.
  5082. * @param {number} n The index of the element to return.
  5083. * @returns {*} Returns the nth element of `array`.
  5084. */
  5085. function baseNth(array, n) {
  5086. var length = array.length;
  5087. if (!length) {
  5088. return;
  5089. }
  5090. n += n < 0 ? length : 0;
  5091. return isIndex(n, length) ? array[n] : undefined;
  5092. }
  5093. /**
  5094. * The base implementation of `_.orderBy` without param guards.
  5095. *
  5096. * @private
  5097. * @param {Array|Object} collection The collection to iterate over.
  5098. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  5099. * @param {string[]} orders The sort orders of `iteratees`.
  5100. * @returns {Array} Returns the new sorted array.
  5101. */
  5102. function baseOrderBy(collection, iteratees, orders) {
  5103. if (iteratees.length) {
  5104. iteratees = arrayMap(iteratees, function(iteratee) {
  5105. if (isArray(iteratee)) {
  5106. return function(value) {
  5107. return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
  5108. }
  5109. }
  5110. return iteratee;
  5111. });
  5112. } else {
  5113. iteratees = [identity];
  5114. }
  5115. var index = -1;
  5116. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  5117. var result = baseMap(collection, function(value, key, collection) {
  5118. var criteria = arrayMap(iteratees, function(iteratee) {
  5119. return iteratee(value);
  5120. });
  5121. return { 'criteria': criteria, 'index': ++index, 'value': value };
  5122. });
  5123. return baseSortBy(result, function(object, other) {
  5124. return compareMultiple(object, other, orders);
  5125. });
  5126. }
  5127. /**
  5128. * The base implementation of `_.pick` without support for individual
  5129. * property identifiers.
  5130. *
  5131. * @private
  5132. * @param {Object} object The source object.
  5133. * @param {string[]} paths The property paths to pick.
  5134. * @returns {Object} Returns the new object.
  5135. */
  5136. function basePick(object, paths) {
  5137. return basePickBy(object, paths, function(value, path) {
  5138. return hasIn(object, path);
  5139. });
  5140. }
  5141. /**
  5142. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  5143. *
  5144. * @private
  5145. * @param {Object} object The source object.
  5146. * @param {string[]} paths The property paths to pick.
  5147. * @param {Function} predicate The function invoked per property.
  5148. * @returns {Object} Returns the new object.
  5149. */
  5150. function basePickBy(object, paths, predicate) {
  5151. var index = -1,
  5152. length = paths.length,
  5153. result = {};
  5154. while (++index < length) {
  5155. var path = paths[index],
  5156. value = baseGet(object, path);
  5157. if (predicate(value, path)) {
  5158. baseSet(result, castPath(path, object), value);
  5159. }
  5160. }
  5161. return result;
  5162. }
  5163. /**
  5164. * A specialized version of `baseProperty` which supports deep paths.
  5165. *
  5166. * @private
  5167. * @param {Array|string} path The path of the property to get.
  5168. * @returns {Function} Returns the new accessor function.
  5169. */
  5170. function basePropertyDeep(path) {
  5171. return function(object) {
  5172. return baseGet(object, path);
  5173. };
  5174. }
  5175. /**
  5176. * The base implementation of `_.pullAllBy` without support for iteratee
  5177. * shorthands.
  5178. *
  5179. * @private
  5180. * @param {Array} array The array to modify.
  5181. * @param {Array} values The values to remove.
  5182. * @param {Function} [iteratee] The iteratee invoked per element.
  5183. * @param {Function} [comparator] The comparator invoked per element.
  5184. * @returns {Array} Returns `array`.
  5185. */
  5186. function basePullAll(array, values, iteratee, comparator) {
  5187. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  5188. index = -1,
  5189. length = values.length,
  5190. seen = array;
  5191. if (array === values) {
  5192. values = copyArray(values);
  5193. }
  5194. if (iteratee) {
  5195. seen = arrayMap(array, baseUnary(iteratee));
  5196. }
  5197. while (++index < length) {
  5198. var fromIndex = 0,
  5199. value = values[index],
  5200. computed = iteratee ? iteratee(value) : value;
  5201. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  5202. if (seen !== array) {
  5203. splice.call(seen, fromIndex, 1);
  5204. }
  5205. splice.call(array, fromIndex, 1);
  5206. }
  5207. }
  5208. return array;
  5209. }
  5210. /**
  5211. * The base implementation of `_.pullAt` without support for individual
  5212. * indexes or capturing the removed elements.
  5213. *
  5214. * @private
  5215. * @param {Array} array The array to modify.
  5216. * @param {number[]} indexes The indexes of elements to remove.
  5217. * @returns {Array} Returns `array`.
  5218. */
  5219. function basePullAt(array, indexes) {
  5220. var length = array ? indexes.length : 0,
  5221. lastIndex = length - 1;
  5222. while (length--) {
  5223. var index = indexes[length];
  5224. if (length == lastIndex || index !== previous) {
  5225. var previous = index;
  5226. if (isIndex(index)) {
  5227. splice.call(array, index, 1);
  5228. } else {
  5229. baseUnset(array, index);
  5230. }
  5231. }
  5232. }
  5233. return array;
  5234. }
  5235. /**
  5236. * The base implementation of `_.random` without support for returning
  5237. * floating-point numbers.
  5238. *
  5239. * @private
  5240. * @param {number} lower The lower bound.
  5241. * @param {number} upper The upper bound.
  5242. * @returns {number} Returns the random number.
  5243. */
  5244. function baseRandom(lower, upper) {
  5245. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  5246. }
  5247. /**
  5248. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  5249. * coerce arguments.
  5250. *
  5251. * @private
  5252. * @param {number} start The start of the range.
  5253. * @param {number} end The end of the range.
  5254. * @param {number} step The value to increment or decrement by.
  5255. * @param {boolean} [fromRight] Specify iterating from right to left.
  5256. * @returns {Array} Returns the range of numbers.
  5257. */
  5258. function baseRange(start, end, step, fromRight) {
  5259. var index = -1,
  5260. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  5261. result = Array(length);
  5262. while (length--) {
  5263. result[fromRight ? length : ++index] = start;
  5264. start += step;
  5265. }
  5266. return result;
  5267. }
  5268. /**
  5269. * The base implementation of `_.repeat` which doesn't coerce arguments.
  5270. *
  5271. * @private
  5272. * @param {string} string The string to repeat.
  5273. * @param {number} n The number of times to repeat the string.
  5274. * @returns {string} Returns the repeated string.
  5275. */
  5276. function baseRepeat(string, n) {
  5277. var result = '';
  5278. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  5279. return result;
  5280. }
  5281. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  5282. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  5283. do {
  5284. if (n % 2) {
  5285. result += string;
  5286. }
  5287. n = nativeFloor(n / 2);
  5288. if (n) {
  5289. string += string;
  5290. }
  5291. } while (n);
  5292. return result;
  5293. }
  5294. /**
  5295. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  5296. *
  5297. * @private
  5298. * @param {Function} func The function to apply a rest parameter to.
  5299. * @param {number} [start=func.length-1] The start position of the rest parameter.
  5300. * @returns {Function} Returns the new function.
  5301. */
  5302. function baseRest(func, start) {
  5303. return setToString(overRest(func, start, identity), func + '');
  5304. }
  5305. /**
  5306. * The base implementation of `_.sample`.
  5307. *
  5308. * @private
  5309. * @param {Array|Object} collection The collection to sample.
  5310. * @returns {*} Returns the random element.
  5311. */
  5312. function baseSample(collection) {
  5313. return arraySample(values(collection));
  5314. }
  5315. /**
  5316. * The base implementation of `_.sampleSize` without param guards.
  5317. *
  5318. * @private
  5319. * @param {Array|Object} collection The collection to sample.
  5320. * @param {number} n The number of elements to sample.
  5321. * @returns {Array} Returns the random elements.
  5322. */
  5323. function baseSampleSize(collection, n) {
  5324. var array = values(collection);
  5325. return shuffleSelf(array, baseClamp(n, 0, array.length));
  5326. }
  5327. /**
  5328. * The base implementation of `_.set`.
  5329. *
  5330. * @private
  5331. * @param {Object} object The object to modify.
  5332. * @param {Array|string} path The path of the property to set.
  5333. * @param {*} value The value to set.
  5334. * @param {Function} [customizer] The function to customize path creation.
  5335. * @returns {Object} Returns `object`.
  5336. */
  5337. function baseSet(object, path, value, customizer) {
  5338. if (!isObject(object)) {
  5339. return object;
  5340. }
  5341. path = castPath(path, object);
  5342. var index = -1,
  5343. length = path.length,
  5344. lastIndex = length - 1,
  5345. nested = object;
  5346. while (nested != null && ++index < length) {
  5347. var key = toKey(path[index]),
  5348. newValue = value;
  5349. if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
  5350. return object;
  5351. }
  5352. if (index != lastIndex) {
  5353. var objValue = nested[key];
  5354. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  5355. if (newValue === undefined) {
  5356. newValue = isObject(objValue)
  5357. ? objValue
  5358. : (isIndex(path[index + 1]) ? [] : {});
  5359. }
  5360. }
  5361. assignValue(nested, key, newValue);
  5362. nested = nested[key];
  5363. }
  5364. return object;
  5365. }
  5366. /**
  5367. * The base implementation of `setData` without support for hot loop shorting.
  5368. *
  5369. * @private
  5370. * @param {Function} func The function to associate metadata with.
  5371. * @param {*} data The metadata.
  5372. * @returns {Function} Returns `func`.
  5373. */
  5374. var baseSetData = !metaMap ? identity : function(func, data) {
  5375. metaMap.set(func, data);
  5376. return func;
  5377. };
  5378. /**
  5379. * The base implementation of `setToString` without support for hot loop shorting.
  5380. *
  5381. * @private
  5382. * @param {Function} func The function to modify.
  5383. * @param {Function} string The `toString` result.
  5384. * @returns {Function} Returns `func`.
  5385. */
  5386. var baseSetToString = !defineProperty ? identity : function(func, string) {
  5387. return defineProperty(func, 'toString', {
  5388. 'configurable': true,
  5389. 'enumerable': false,
  5390. 'value': constant(string),
  5391. 'writable': true
  5392. });
  5393. };
  5394. /**
  5395. * The base implementation of `_.shuffle`.
  5396. *
  5397. * @private
  5398. * @param {Array|Object} collection The collection to shuffle.
  5399. * @returns {Array} Returns the new shuffled array.
  5400. */
  5401. function baseShuffle(collection) {
  5402. return shuffleSelf(values(collection));
  5403. }
  5404. /**
  5405. * The base implementation of `_.slice` without an iteratee call guard.
  5406. *
  5407. * @private
  5408. * @param {Array} array The array to slice.
  5409. * @param {number} [start=0] The start position.
  5410. * @param {number} [end=array.length] The end position.
  5411. * @returns {Array} Returns the slice of `array`.
  5412. */
  5413. function baseSlice(array, start, end) {
  5414. var index = -1,
  5415. length = array.length;
  5416. if (start < 0) {
  5417. start = -start > length ? 0 : (length + start);
  5418. }
  5419. end = end > length ? length : end;
  5420. if (end < 0) {
  5421. end += length;
  5422. }
  5423. length = start > end ? 0 : ((end - start) >>> 0);
  5424. start >>>= 0;
  5425. var result = Array(length);
  5426. while (++index < length) {
  5427. result[index] = array[index + start];
  5428. }
  5429. return result;
  5430. }
  5431. /**
  5432. * The base implementation of `_.some` without support for iteratee shorthands.
  5433. *
  5434. * @private
  5435. * @param {Array|Object} collection The collection to iterate over.
  5436. * @param {Function} predicate The function invoked per iteration.
  5437. * @returns {boolean} Returns `true` if any element passes the predicate check,
  5438. * else `false`.
  5439. */
  5440. function baseSome(collection, predicate) {
  5441. var result;
  5442. baseEach(collection, function(value, index, collection) {
  5443. result = predicate(value, index, collection);
  5444. return !result;
  5445. });
  5446. return !!result;
  5447. }
  5448. /**
  5449. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  5450. * performs a binary search of `array` to determine the index at which `value`
  5451. * should be inserted into `array` in order to maintain its sort order.
  5452. *
  5453. * @private
  5454. * @param {Array} array The sorted array to inspect.
  5455. * @param {*} value The value to evaluate.
  5456. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  5457. * @returns {number} Returns the index at which `value` should be inserted
  5458. * into `array`.
  5459. */
  5460. function baseSortedIndex(array, value, retHighest) {
  5461. var low = 0,
  5462. high = array == null ? low : array.length;
  5463. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  5464. while (low < high) {
  5465. var mid = (low + high) >>> 1,
  5466. computed = array[mid];
  5467. if (computed !== null && !isSymbol(computed) &&
  5468. (retHighest ? (computed <= value) : (computed < value))) {
  5469. low = mid + 1;
  5470. } else {
  5471. high = mid;
  5472. }
  5473. }
  5474. return high;
  5475. }
  5476. return baseSortedIndexBy(array, value, identity, retHighest);
  5477. }
  5478. /**
  5479. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  5480. * which invokes `iteratee` for `value` and each element of `array` to compute
  5481. * their sort ranking. The iteratee is invoked with one argument; (value).
  5482. *
  5483. * @private
  5484. * @param {Array} array The sorted array to inspect.
  5485. * @param {*} value The value to evaluate.
  5486. * @param {Function} iteratee The iteratee invoked per element.
  5487. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  5488. * @returns {number} Returns the index at which `value` should be inserted
  5489. * into `array`.
  5490. */
  5491. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  5492. var low = 0,
  5493. high = array == null ? 0 : array.length;
  5494. if (high === 0) {
  5495. return 0;
  5496. }
  5497. value = iteratee(value);
  5498. var valIsNaN = value !== value,
  5499. valIsNull = value === null,
  5500. valIsSymbol = isSymbol(value),
  5501. valIsUndefined = value === undefined;
  5502. while (low < high) {
  5503. var mid = nativeFloor((low + high) / 2),
  5504. computed = iteratee(array[mid]),
  5505. othIsDefined = computed !== undefined,
  5506. othIsNull = computed === null,
  5507. othIsReflexive = computed === computed,
  5508. othIsSymbol = isSymbol(computed);
  5509. if (valIsNaN) {
  5510. var setLow = retHighest || othIsReflexive;
  5511. } else if (valIsUndefined) {
  5512. setLow = othIsReflexive && (retHighest || othIsDefined);
  5513. } else if (valIsNull) {
  5514. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  5515. } else if (valIsSymbol) {
  5516. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  5517. } else if (othIsNull || othIsSymbol) {
  5518. setLow = false;
  5519. } else {
  5520. setLow = retHighest ? (computed <= value) : (computed < value);
  5521. }
  5522. if (setLow) {
  5523. low = mid + 1;
  5524. } else {
  5525. high = mid;
  5526. }
  5527. }
  5528. return nativeMin(high, MAX_ARRAY_INDEX);
  5529. }
  5530. /**
  5531. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  5532. * support for iteratee shorthands.
  5533. *
  5534. * @private
  5535. * @param {Array} array The array to inspect.
  5536. * @param {Function} [iteratee] The iteratee invoked per element.
  5537. * @returns {Array} Returns the new duplicate free array.
  5538. */
  5539. function baseSortedUniq(array, iteratee) {
  5540. var index = -1,
  5541. length = array.length,
  5542. resIndex = 0,
  5543. result = [];
  5544. while (++index < length) {
  5545. var value = array[index],
  5546. computed = iteratee ? iteratee(value) : value;
  5547. if (!index || !eq(computed, seen)) {
  5548. var seen = computed;
  5549. result[resIndex++] = value === 0 ? 0 : value;
  5550. }
  5551. }
  5552. return result;
  5553. }
  5554. /**
  5555. * The base implementation of `_.toNumber` which doesn't ensure correct
  5556. * conversions of binary, hexadecimal, or octal string values.
  5557. *
  5558. * @private
  5559. * @param {*} value The value to process.
  5560. * @returns {number} Returns the number.
  5561. */
  5562. function baseToNumber(value) {
  5563. if (typeof value == 'number') {
  5564. return value;
  5565. }
  5566. if (isSymbol(value)) {
  5567. return NAN;
  5568. }
  5569. return +value;
  5570. }
  5571. /**
  5572. * The base implementation of `_.toString` which doesn't convert nullish
  5573. * values to empty strings.
  5574. *
  5575. * @private
  5576. * @param {*} value The value to process.
  5577. * @returns {string} Returns the string.
  5578. */
  5579. function baseToString(value) {
  5580. // Exit early for strings to avoid a performance hit in some environments.
  5581. if (typeof value == 'string') {
  5582. return value;
  5583. }
  5584. if (isArray(value)) {
  5585. // Recursively convert values (susceptible to call stack limits).
  5586. return arrayMap(value, baseToString) + '';
  5587. }
  5588. if (isSymbol(value)) {
  5589. return symbolToString ? symbolToString.call(value) : '';
  5590. }
  5591. var result = (value + '');
  5592. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  5593. }
  5594. /**
  5595. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  5596. *
  5597. * @private
  5598. * @param {Array} array The array to inspect.
  5599. * @param {Function} [iteratee] The iteratee invoked per element.
  5600. * @param {Function} [comparator] The comparator invoked per element.
  5601. * @returns {Array} Returns the new duplicate free array.
  5602. */
  5603. function baseUniq(array, iteratee, comparator) {
  5604. var index = -1,
  5605. includes = arrayIncludes,
  5606. length = array.length,
  5607. isCommon = true,
  5608. result = [],
  5609. seen = result;
  5610. if (comparator) {
  5611. isCommon = false;
  5612. includes = arrayIncludesWith;
  5613. }
  5614. else if (length >= LARGE_ARRAY_SIZE) {
  5615. var set = iteratee ? null : createSet(array);
  5616. if (set) {
  5617. return setToArray(set);
  5618. }
  5619. isCommon = false;
  5620. includes = cacheHas;
  5621. seen = new SetCache;
  5622. }
  5623. else {
  5624. seen = iteratee ? [] : result;
  5625. }
  5626. outer:
  5627. while (++index < length) {
  5628. var value = array[index],
  5629. computed = iteratee ? iteratee(value) : value;
  5630. value = (comparator || value !== 0) ? value : 0;
  5631. if (isCommon && computed === computed) {
  5632. var seenIndex = seen.length;
  5633. while (seenIndex--) {
  5634. if (seen[seenIndex] === computed) {
  5635. continue outer;
  5636. }
  5637. }
  5638. if (iteratee) {
  5639. seen.push(computed);
  5640. }
  5641. result.push(value);
  5642. }
  5643. else if (!includes(seen, computed, comparator)) {
  5644. if (seen !== result) {
  5645. seen.push(computed);
  5646. }
  5647. result.push(value);
  5648. }
  5649. }
  5650. return result;
  5651. }
  5652. /**
  5653. * The base implementation of `_.unset`.
  5654. *
  5655. * @private
  5656. * @param {Object} object The object to modify.
  5657. * @param {Array|string} path The property path to unset.
  5658. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  5659. */
  5660. function baseUnset(object, path) {
  5661. path = castPath(path, object);
  5662. object = parent(object, path);
  5663. return object == null || delete object[toKey(last(path))];
  5664. }
  5665. /**
  5666. * The base implementation of `_.update`.
  5667. *
  5668. * @private
  5669. * @param {Object} object The object to modify.
  5670. * @param {Array|string} path The path of the property to update.
  5671. * @param {Function} updater The function to produce the updated value.
  5672. * @param {Function} [customizer] The function to customize path creation.
  5673. * @returns {Object} Returns `object`.
  5674. */
  5675. function baseUpdate(object, path, updater, customizer) {
  5676. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  5677. }
  5678. /**
  5679. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  5680. * without support for iteratee shorthands.
  5681. *
  5682. * @private
  5683. * @param {Array} array The array to query.
  5684. * @param {Function} predicate The function invoked per iteration.
  5685. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  5686. * @param {boolean} [fromRight] Specify iterating from right to left.
  5687. * @returns {Array} Returns the slice of `array`.
  5688. */
  5689. function baseWhile(array, predicate, isDrop, fromRight) {
  5690. var length = array.length,
  5691. index = fromRight ? length : -1;
  5692. while ((fromRight ? index-- : ++index < length) &&
  5693. predicate(array[index], index, array)) {}
  5694. return isDrop
  5695. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  5696. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  5697. }
  5698. /**
  5699. * The base implementation of `wrapperValue` which returns the result of
  5700. * performing a sequence of actions on the unwrapped `value`, where each
  5701. * successive action is supplied the return value of the previous.
  5702. *
  5703. * @private
  5704. * @param {*} value The unwrapped value.
  5705. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  5706. * @returns {*} Returns the resolved value.
  5707. */
  5708. function baseWrapperValue(value, actions) {
  5709. var result = value;
  5710. if (result instanceof LazyWrapper) {
  5711. result = result.value();
  5712. }
  5713. return arrayReduce(actions, function(result, action) {
  5714. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  5715. }, result);
  5716. }
  5717. /**
  5718. * The base implementation of methods like `_.xor`, without support for
  5719. * iteratee shorthands, that accepts an array of arrays to inspect.
  5720. *
  5721. * @private
  5722. * @param {Array} arrays The arrays to inspect.
  5723. * @param {Function} [iteratee] The iteratee invoked per element.
  5724. * @param {Function} [comparator] The comparator invoked per element.
  5725. * @returns {Array} Returns the new array of values.
  5726. */
  5727. function baseXor(arrays, iteratee, comparator) {
  5728. var length = arrays.length;
  5729. if (length < 2) {
  5730. return length ? baseUniq(arrays[0]) : [];
  5731. }
  5732. var index = -1,
  5733. result = Array(length);
  5734. while (++index < length) {
  5735. var array = arrays[index],
  5736. othIndex = -1;
  5737. while (++othIndex < length) {
  5738. if (othIndex != index) {
  5739. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  5740. }
  5741. }
  5742. }
  5743. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  5744. }
  5745. /**
  5746. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  5747. *
  5748. * @private
  5749. * @param {Array} props The property identifiers.
  5750. * @param {Array} values The property values.
  5751. * @param {Function} assignFunc The function to assign values.
  5752. * @returns {Object} Returns the new object.
  5753. */
  5754. function baseZipObject(props, values, assignFunc) {
  5755. var index = -1,
  5756. length = props.length,
  5757. valsLength = values.length,
  5758. result = {};
  5759. while (++index < length) {
  5760. var value = index < valsLength ? values[index] : undefined;
  5761. assignFunc(result, props[index], value);
  5762. }
  5763. return result;
  5764. }
  5765. /**
  5766. * Casts `value` to an empty array if it's not an array like object.
  5767. *
  5768. * @private
  5769. * @param {*} value The value to inspect.
  5770. * @returns {Array|Object} Returns the cast array-like object.
  5771. */
  5772. function castArrayLikeObject(value) {
  5773. return isArrayLikeObject(value) ? value : [];
  5774. }
  5775. /**
  5776. * Casts `value` to `identity` if it's not a function.
  5777. *
  5778. * @private
  5779. * @param {*} value The value to inspect.
  5780. * @returns {Function} Returns cast function.
  5781. */
  5782. function castFunction(value) {
  5783. return typeof value == 'function' ? value : identity;
  5784. }
  5785. /**
  5786. * Casts `value` to a path array if it's not one.
  5787. *
  5788. * @private
  5789. * @param {*} value The value to inspect.
  5790. * @param {Object} [object] The object to query keys on.
  5791. * @returns {Array} Returns the cast property path array.
  5792. */
  5793. function castPath(value, object) {
  5794. if (isArray(value)) {
  5795. return value;
  5796. }
  5797. return isKey(value, object) ? [value] : stringToPath(toString(value));
  5798. }
  5799. /**
  5800. * A `baseRest` alias which can be replaced with `identity` by module
  5801. * replacement plugins.
  5802. *
  5803. * @private
  5804. * @type {Function}
  5805. * @param {Function} func The function to apply a rest parameter to.
  5806. * @returns {Function} Returns the new function.
  5807. */
  5808. var castRest = baseRest;
  5809. /**
  5810. * Casts `array` to a slice if it's needed.
  5811. *
  5812. * @private
  5813. * @param {Array} array The array to inspect.
  5814. * @param {number} start The start position.
  5815. * @param {number} [end=array.length] The end position.
  5816. * @returns {Array} Returns the cast slice.
  5817. */
  5818. function castSlice(array, start, end) {
  5819. var length = array.length;
  5820. end = end === undefined ? length : end;
  5821. return (!start && end >= length) ? array : baseSlice(array, start, end);
  5822. }
  5823. /**
  5824. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  5825. *
  5826. * @private
  5827. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  5828. */
  5829. var clearTimeout = ctxClearTimeout || function(id) {
  5830. return root.clearTimeout(id);
  5831. };
  5832. /**
  5833. * Creates a clone of `buffer`.
  5834. *
  5835. * @private
  5836. * @param {Buffer} buffer The buffer to clone.
  5837. * @param {boolean} [isDeep] Specify a deep clone.
  5838. * @returns {Buffer} Returns the cloned buffer.
  5839. */
  5840. function cloneBuffer(buffer, isDeep) {
  5841. if (isDeep) {
  5842. return buffer.slice();
  5843. }
  5844. var length = buffer.length,
  5845. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  5846. buffer.copy(result);
  5847. return result;
  5848. }
  5849. /**
  5850. * Creates a clone of `arrayBuffer`.
  5851. *
  5852. * @private
  5853. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  5854. * @returns {ArrayBuffer} Returns the cloned array buffer.
  5855. */
  5856. function cloneArrayBuffer(arrayBuffer) {
  5857. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  5858. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  5859. return result;
  5860. }
  5861. /**
  5862. * Creates a clone of `dataView`.
  5863. *
  5864. * @private
  5865. * @param {Object} dataView The data view to clone.
  5866. * @param {boolean} [isDeep] Specify a deep clone.
  5867. * @returns {Object} Returns the cloned data view.
  5868. */
  5869. function cloneDataView(dataView, isDeep) {
  5870. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  5871. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  5872. }
  5873. /**
  5874. * Creates a clone of `regexp`.
  5875. *
  5876. * @private
  5877. * @param {Object} regexp The regexp to clone.
  5878. * @returns {Object} Returns the cloned regexp.
  5879. */
  5880. function cloneRegExp(regexp) {
  5881. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  5882. result.lastIndex = regexp.lastIndex;
  5883. return result;
  5884. }
  5885. /**
  5886. * Creates a clone of the `symbol` object.
  5887. *
  5888. * @private
  5889. * @param {Object} symbol The symbol object to clone.
  5890. * @returns {Object} Returns the cloned symbol object.
  5891. */
  5892. function cloneSymbol(symbol) {
  5893. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  5894. }
  5895. /**
  5896. * Creates a clone of `typedArray`.
  5897. *
  5898. * @private
  5899. * @param {Object} typedArray The typed array to clone.
  5900. * @param {boolean} [isDeep] Specify a deep clone.
  5901. * @returns {Object} Returns the cloned typed array.
  5902. */
  5903. function cloneTypedArray(typedArray, isDeep) {
  5904. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  5905. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  5906. }
  5907. /**
  5908. * Compares values to sort them in ascending order.
  5909. *
  5910. * @private
  5911. * @param {*} value The value to compare.
  5912. * @param {*} other The other value to compare.
  5913. * @returns {number} Returns the sort order indicator for `value`.
  5914. */
  5915. function compareAscending(value, other) {
  5916. if (value !== other) {
  5917. var valIsDefined = value !== undefined,
  5918. valIsNull = value === null,
  5919. valIsReflexive = value === value,
  5920. valIsSymbol = isSymbol(value);
  5921. var othIsDefined = other !== undefined,
  5922. othIsNull = other === null,
  5923. othIsReflexive = other === other,
  5924. othIsSymbol = isSymbol(other);
  5925. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  5926. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  5927. (valIsNull && othIsDefined && othIsReflexive) ||
  5928. (!valIsDefined && othIsReflexive) ||
  5929. !valIsReflexive) {
  5930. return 1;
  5931. }
  5932. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  5933. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  5934. (othIsNull && valIsDefined && valIsReflexive) ||
  5935. (!othIsDefined && valIsReflexive) ||
  5936. !othIsReflexive) {
  5937. return -1;
  5938. }
  5939. }
  5940. return 0;
  5941. }
  5942. /**
  5943. * Used by `_.orderBy` to compare multiple properties of a value to another
  5944. * and stable sort them.
  5945. *
  5946. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  5947. * specify an order of "desc" for descending or "asc" for ascending sort order
  5948. * of corresponding values.
  5949. *
  5950. * @private
  5951. * @param {Object} object The object to compare.
  5952. * @param {Object} other The other object to compare.
  5953. * @param {boolean[]|string[]} orders The order to sort by for each property.
  5954. * @returns {number} Returns the sort order indicator for `object`.
  5955. */
  5956. function compareMultiple(object, other, orders) {
  5957. var index = -1,
  5958. objCriteria = object.criteria,
  5959. othCriteria = other.criteria,
  5960. length = objCriteria.length,
  5961. ordersLength = orders.length;
  5962. while (++index < length) {
  5963. var result = compareAscending(objCriteria[index], othCriteria[index]);
  5964. if (result) {
  5965. if (index >= ordersLength) {
  5966. return result;
  5967. }
  5968. var order = orders[index];
  5969. return result * (order == 'desc' ? -1 : 1);
  5970. }
  5971. }
  5972. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  5973. // that causes it, under certain circumstances, to provide the same value for
  5974. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  5975. // for more details.
  5976. //
  5977. // This also ensures a stable sort in V8 and other engines.
  5978. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  5979. return object.index - other.index;
  5980. }
  5981. /**
  5982. * Creates an array that is the composition of partially applied arguments,
  5983. * placeholders, and provided arguments into a single array of arguments.
  5984. *
  5985. * @private
  5986. * @param {Array} args The provided arguments.
  5987. * @param {Array} partials The arguments to prepend to those provided.
  5988. * @param {Array} holders The `partials` placeholder indexes.
  5989. * @params {boolean} [isCurried] Specify composing for a curried function.
  5990. * @returns {Array} Returns the new array of composed arguments.
  5991. */
  5992. function composeArgs(args, partials, holders, isCurried) {
  5993. var argsIndex = -1,
  5994. argsLength = args.length,
  5995. holdersLength = holders.length,
  5996. leftIndex = -1,
  5997. leftLength = partials.length,
  5998. rangeLength = nativeMax(argsLength - holdersLength, 0),
  5999. result = Array(leftLength + rangeLength),
  6000. isUncurried = !isCurried;
  6001. while (++leftIndex < leftLength) {
  6002. result[leftIndex] = partials[leftIndex];
  6003. }
  6004. while (++argsIndex < holdersLength) {
  6005. if (isUncurried || argsIndex < argsLength) {
  6006. result[holders[argsIndex]] = args[argsIndex];
  6007. }
  6008. }
  6009. while (rangeLength--) {
  6010. result[leftIndex++] = args[argsIndex++];
  6011. }
  6012. return result;
  6013. }
  6014. /**
  6015. * This function is like `composeArgs` except that the arguments composition
  6016. * is tailored for `_.partialRight`.
  6017. *
  6018. * @private
  6019. * @param {Array} args The provided arguments.
  6020. * @param {Array} partials The arguments to append to those provided.
  6021. * @param {Array} holders The `partials` placeholder indexes.
  6022. * @params {boolean} [isCurried] Specify composing for a curried function.
  6023. * @returns {Array} Returns the new array of composed arguments.
  6024. */
  6025. function composeArgsRight(args, partials, holders, isCurried) {
  6026. var argsIndex = -1,
  6027. argsLength = args.length,
  6028. holdersIndex = -1,
  6029. holdersLength = holders.length,
  6030. rightIndex = -1,
  6031. rightLength = partials.length,
  6032. rangeLength = nativeMax(argsLength - holdersLength, 0),
  6033. result = Array(rangeLength + rightLength),
  6034. isUncurried = !isCurried;
  6035. while (++argsIndex < rangeLength) {
  6036. result[argsIndex] = args[argsIndex];
  6037. }
  6038. var offset = argsIndex;
  6039. while (++rightIndex < rightLength) {
  6040. result[offset + rightIndex] = partials[rightIndex];
  6041. }
  6042. while (++holdersIndex < holdersLength) {
  6043. if (isUncurried || argsIndex < argsLength) {
  6044. result[offset + holders[holdersIndex]] = args[argsIndex++];
  6045. }
  6046. }
  6047. return result;
  6048. }
  6049. /**
  6050. * Copies the values of `source` to `array`.
  6051. *
  6052. * @private
  6053. * @param {Array} source The array to copy values from.
  6054. * @param {Array} [array=[]] The array to copy values to.
  6055. * @returns {Array} Returns `array`.
  6056. */
  6057. function copyArray(source, array) {
  6058. var index = -1,
  6059. length = source.length;
  6060. array || (array = Array(length));
  6061. while (++index < length) {
  6062. array[index] = source[index];
  6063. }
  6064. return array;
  6065. }
  6066. /**
  6067. * Copies properties of `source` to `object`.
  6068. *
  6069. * @private
  6070. * @param {Object} source The object to copy properties from.
  6071. * @param {Array} props The property identifiers to copy.
  6072. * @param {Object} [object={}] The object to copy properties to.
  6073. * @param {Function} [customizer] The function to customize copied values.
  6074. * @returns {Object} Returns `object`.
  6075. */
  6076. function copyObject(source, props, object, customizer) {
  6077. var isNew = !object;
  6078. object || (object = {});
  6079. var index = -1,
  6080. length = props.length;
  6081. while (++index < length) {
  6082. var key = props[index];
  6083. var newValue = customizer
  6084. ? customizer(object[key], source[key], key, object, source)
  6085. : undefined;
  6086. if (newValue === undefined) {
  6087. newValue = source[key];
  6088. }
  6089. if (isNew) {
  6090. baseAssignValue(object, key, newValue);
  6091. } else {
  6092. assignValue(object, key, newValue);
  6093. }
  6094. }
  6095. return object;
  6096. }
  6097. /**
  6098. * Copies own symbols of `source` to `object`.
  6099. *
  6100. * @private
  6101. * @param {Object} source The object to copy symbols from.
  6102. * @param {Object} [object={}] The object to copy symbols to.
  6103. * @returns {Object} Returns `object`.
  6104. */
  6105. function copySymbols(source, object) {
  6106. return copyObject(source, getSymbols(source), object);
  6107. }
  6108. /**
  6109. * Copies own and inherited symbols of `source` to `object`.
  6110. *
  6111. * @private
  6112. * @param {Object} source The object to copy symbols from.
  6113. * @param {Object} [object={}] The object to copy symbols to.
  6114. * @returns {Object} Returns `object`.
  6115. */
  6116. function copySymbolsIn(source, object) {
  6117. return copyObject(source, getSymbolsIn(source), object);
  6118. }
  6119. /**
  6120. * Creates a function like `_.groupBy`.
  6121. *
  6122. * @private
  6123. * @param {Function} setter The function to set accumulator values.
  6124. * @param {Function} [initializer] The accumulator object initializer.
  6125. * @returns {Function} Returns the new aggregator function.
  6126. */
  6127. function createAggregator(setter, initializer) {
  6128. return function(collection, iteratee) {
  6129. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  6130. accumulator = initializer ? initializer() : {};
  6131. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  6132. };
  6133. }
  6134. /**
  6135. * Creates a function like `_.assign`.
  6136. *
  6137. * @private
  6138. * @param {Function} assigner The function to assign values.
  6139. * @returns {Function} Returns the new assigner function.
  6140. */
  6141. function createAssigner(assigner) {
  6142. return baseRest(function(object, sources) {
  6143. var index = -1,
  6144. length = sources.length,
  6145. customizer = length > 1 ? sources[length - 1] : undefined,
  6146. guard = length > 2 ? sources[2] : undefined;
  6147. customizer = (assigner.length > 3 && typeof customizer == 'function')
  6148. ? (length--, customizer)
  6149. : undefined;
  6150. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  6151. customizer = length < 3 ? undefined : customizer;
  6152. length = 1;
  6153. }
  6154. object = Object(object);
  6155. while (++index < length) {
  6156. var source = sources[index];
  6157. if (source) {
  6158. assigner(object, source, index, customizer);
  6159. }
  6160. }
  6161. return object;
  6162. });
  6163. }
  6164. /**
  6165. * Creates a `baseEach` or `baseEachRight` function.
  6166. *
  6167. * @private
  6168. * @param {Function} eachFunc The function to iterate over a collection.
  6169. * @param {boolean} [fromRight] Specify iterating from right to left.
  6170. * @returns {Function} Returns the new base function.
  6171. */
  6172. function createBaseEach(eachFunc, fromRight) {
  6173. return function(collection, iteratee) {
  6174. if (collection == null) {
  6175. return collection;
  6176. }
  6177. if (!isArrayLike(collection)) {
  6178. return eachFunc(collection, iteratee);
  6179. }
  6180. var length = collection.length,
  6181. index = fromRight ? length : -1,
  6182. iterable = Object(collection);
  6183. while ((fromRight ? index-- : ++index < length)) {
  6184. if (iteratee(iterable[index], index, iterable) === false) {
  6185. break;
  6186. }
  6187. }
  6188. return collection;
  6189. };
  6190. }
  6191. /**
  6192. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  6193. *
  6194. * @private
  6195. * @param {boolean} [fromRight] Specify iterating from right to left.
  6196. * @returns {Function} Returns the new base function.
  6197. */
  6198. function createBaseFor(fromRight) {
  6199. return function(object, iteratee, keysFunc) {
  6200. var index = -1,
  6201. iterable = Object(object),
  6202. props = keysFunc(object),
  6203. length = props.length;
  6204. while (length--) {
  6205. var key = props[fromRight ? length : ++index];
  6206. if (iteratee(iterable[key], key, iterable) === false) {
  6207. break;
  6208. }
  6209. }
  6210. return object;
  6211. };
  6212. }
  6213. /**
  6214. * Creates a function that wraps `func` to invoke it with the optional `this`
  6215. * binding of `thisArg`.
  6216. *
  6217. * @private
  6218. * @param {Function} func The function to wrap.
  6219. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  6220. * @param {*} [thisArg] The `this` binding of `func`.
  6221. * @returns {Function} Returns the new wrapped function.
  6222. */
  6223. function createBind(func, bitmask, thisArg) {
  6224. var isBind = bitmask & WRAP_BIND_FLAG,
  6225. Ctor = createCtor(func);
  6226. function wrapper() {
  6227. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  6228. return fn.apply(isBind ? thisArg : this, arguments);
  6229. }
  6230. return wrapper;
  6231. }
  6232. /**
  6233. * Creates a function like `_.lowerFirst`.
  6234. *
  6235. * @private
  6236. * @param {string} methodName The name of the `String` case method to use.
  6237. * @returns {Function} Returns the new case function.
  6238. */
  6239. function createCaseFirst(methodName) {
  6240. return function(string) {
  6241. string = toString(string);
  6242. var strSymbols = hasUnicode(string)
  6243. ? stringToArray(string)
  6244. : undefined;
  6245. var chr = strSymbols
  6246. ? strSymbols[0]
  6247. : string.charAt(0);
  6248. var trailing = strSymbols
  6249. ? castSlice(strSymbols, 1).join('')
  6250. : string.slice(1);
  6251. return chr[methodName]() + trailing;
  6252. };
  6253. }
  6254. /**
  6255. * Creates a function like `_.camelCase`.
  6256. *
  6257. * @private
  6258. * @param {Function} callback The function to combine each word.
  6259. * @returns {Function} Returns the new compounder function.
  6260. */
  6261. function createCompounder(callback) {
  6262. return function(string) {
  6263. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  6264. };
  6265. }
  6266. /**
  6267. * Creates a function that produces an instance of `Ctor` regardless of
  6268. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  6269. *
  6270. * @private
  6271. * @param {Function} Ctor The constructor to wrap.
  6272. * @returns {Function} Returns the new wrapped function.
  6273. */
  6274. function createCtor(Ctor) {
  6275. return function() {
  6276. // Use a `switch` statement to work with class constructors. See
  6277. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  6278. // for more details.
  6279. var args = arguments;
  6280. switch (args.length) {
  6281. case 0: return new Ctor;
  6282. case 1: return new Ctor(args[0]);
  6283. case 2: return new Ctor(args[0], args[1]);
  6284. case 3: return new Ctor(args[0], args[1], args[2]);
  6285. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  6286. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  6287. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  6288. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  6289. }
  6290. var thisBinding = baseCreate(Ctor.prototype),
  6291. result = Ctor.apply(thisBinding, args);
  6292. // Mimic the constructor's `return` behavior.
  6293. // See https://es5.github.io/#x13.2.2 for more details.
  6294. return isObject(result) ? result : thisBinding;
  6295. };
  6296. }
  6297. /**
  6298. * Creates a function that wraps `func` to enable currying.
  6299. *
  6300. * @private
  6301. * @param {Function} func The function to wrap.
  6302. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  6303. * @param {number} arity The arity of `func`.
  6304. * @returns {Function} Returns the new wrapped function.
  6305. */
  6306. function createCurry(func, bitmask, arity) {
  6307. var Ctor = createCtor(func);
  6308. function wrapper() {
  6309. var length = arguments.length,
  6310. args = Array(length),
  6311. index = length,
  6312. placeholder = getHolder(wrapper);
  6313. while (index--) {
  6314. args[index] = arguments[index];
  6315. }
  6316. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  6317. ? []
  6318. : replaceHolders(args, placeholder);
  6319. length -= holders.length;
  6320. if (length < arity) {
  6321. return createRecurry(
  6322. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  6323. args, holders, undefined, undefined, arity - length);
  6324. }
  6325. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  6326. return apply(fn, this, args);
  6327. }
  6328. return wrapper;
  6329. }
  6330. /**
  6331. * Creates a `_.find` or `_.findLast` function.
  6332. *
  6333. * @private
  6334. * @param {Function} findIndexFunc The function to find the collection index.
  6335. * @returns {Function} Returns the new find function.
  6336. */
  6337. function createFind(findIndexFunc) {
  6338. return function(collection, predicate, fromIndex) {
  6339. var iterable = Object(collection);
  6340. if (!isArrayLike(collection)) {
  6341. var iteratee = getIteratee(predicate, 3);
  6342. collection = keys(collection);
  6343. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  6344. }
  6345. var index = findIndexFunc(collection, predicate, fromIndex);
  6346. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  6347. };
  6348. }
  6349. /**
  6350. * Creates a `_.flow` or `_.flowRight` function.
  6351. *
  6352. * @private
  6353. * @param {boolean} [fromRight] Specify iterating from right to left.
  6354. * @returns {Function} Returns the new flow function.
  6355. */
  6356. function createFlow(fromRight) {
  6357. return flatRest(function(funcs) {
  6358. var length = funcs.length,
  6359. index = length,
  6360. prereq = LodashWrapper.prototype.thru;
  6361. if (fromRight) {
  6362. funcs.reverse();
  6363. }
  6364. while (index--) {
  6365. var func = funcs[index];
  6366. if (typeof func != 'function') {
  6367. throw new TypeError(FUNC_ERROR_TEXT);
  6368. }
  6369. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  6370. var wrapper = new LodashWrapper([], true);
  6371. }
  6372. }
  6373. index = wrapper ? index : length;
  6374. while (++index < length) {
  6375. func = funcs[index];
  6376. var funcName = getFuncName(func),
  6377. data = funcName == 'wrapper' ? getData(func) : undefined;
  6378. if (data && isLaziable(data[0]) &&
  6379. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  6380. !data[4].length && data[9] == 1
  6381. ) {
  6382. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  6383. } else {
  6384. wrapper = (func.length == 1 && isLaziable(func))
  6385. ? wrapper[funcName]()
  6386. : wrapper.thru(func);
  6387. }
  6388. }
  6389. return function() {
  6390. var args = arguments,
  6391. value = args[0];
  6392. if (wrapper && args.length == 1 && isArray(value)) {
  6393. return wrapper.plant(value).value();
  6394. }
  6395. var index = 0,
  6396. result = length ? funcs[index].apply(this, args) : value;
  6397. while (++index < length) {
  6398. result = funcs[index].call(this, result);
  6399. }
  6400. return result;
  6401. };
  6402. });
  6403. }
  6404. /**
  6405. * Creates a function that wraps `func` to invoke it with optional `this`
  6406. * binding of `thisArg`, partial application, and currying.
  6407. *
  6408. * @private
  6409. * @param {Function|string} func The function or method name to wrap.
  6410. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  6411. * @param {*} [thisArg] The `this` binding of `func`.
  6412. * @param {Array} [partials] The arguments to prepend to those provided to
  6413. * the new function.
  6414. * @param {Array} [holders] The `partials` placeholder indexes.
  6415. * @param {Array} [partialsRight] The arguments to append to those provided
  6416. * to the new function.
  6417. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  6418. * @param {Array} [argPos] The argument positions of the new function.
  6419. * @param {number} [ary] The arity cap of `func`.
  6420. * @param {number} [arity] The arity of `func`.
  6421. * @returns {Function} Returns the new wrapped function.
  6422. */
  6423. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  6424. var isAry = bitmask & WRAP_ARY_FLAG,
  6425. isBind = bitmask & WRAP_BIND_FLAG,
  6426. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  6427. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  6428. isFlip = bitmask & WRAP_FLIP_FLAG,
  6429. Ctor = isBindKey ? undefined : createCtor(func);
  6430. function wrapper() {
  6431. var length = arguments.length,
  6432. args = Array(length),
  6433. index = length;
  6434. while (index--) {
  6435. args[index] = arguments[index];
  6436. }
  6437. if (isCurried) {
  6438. var placeholder = getHolder(wrapper),
  6439. holdersCount = countHolders(args, placeholder);
  6440. }
  6441. if (partials) {
  6442. args = composeArgs(args, partials, holders, isCurried);
  6443. }
  6444. if (partialsRight) {
  6445. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  6446. }
  6447. length -= holdersCount;
  6448. if (isCurried && length < arity) {
  6449. var newHolders = replaceHolders(args, placeholder);
  6450. return createRecurry(
  6451. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  6452. args, newHolders, argPos, ary, arity - length
  6453. );
  6454. }
  6455. var thisBinding = isBind ? thisArg : this,
  6456. fn = isBindKey ? thisBinding[func] : func;
  6457. length = args.length;
  6458. if (argPos) {
  6459. args = reorder(args, argPos);
  6460. } else if (isFlip && length > 1) {
  6461. args.reverse();
  6462. }
  6463. if (isAry && ary < length) {
  6464. args.length = ary;
  6465. }
  6466. if (this && this !== root && this instanceof wrapper) {
  6467. fn = Ctor || createCtor(fn);
  6468. }
  6469. return fn.apply(thisBinding, args);
  6470. }
  6471. return wrapper;
  6472. }
  6473. /**
  6474. * Creates a function like `_.invertBy`.
  6475. *
  6476. * @private
  6477. * @param {Function} setter The function to set accumulator values.
  6478. * @param {Function} toIteratee The function to resolve iteratees.
  6479. * @returns {Function} Returns the new inverter function.
  6480. */
  6481. function createInverter(setter, toIteratee) {
  6482. return function(object, iteratee) {
  6483. return baseInverter(object, setter, toIteratee(iteratee), {});
  6484. };
  6485. }
  6486. /**
  6487. * Creates a function that performs a mathematical operation on two values.
  6488. *
  6489. * @private
  6490. * @param {Function} operator The function to perform the operation.
  6491. * @param {number} [defaultValue] The value used for `undefined` arguments.
  6492. * @returns {Function} Returns the new mathematical operation function.
  6493. */
  6494. function createMathOperation(operator, defaultValue) {
  6495. return function(value, other) {
  6496. var result;
  6497. if (value === undefined && other === undefined) {
  6498. return defaultValue;
  6499. }
  6500. if (value !== undefined) {
  6501. result = value;
  6502. }
  6503. if (other !== undefined) {
  6504. if (result === undefined) {
  6505. return other;
  6506. }
  6507. if (typeof value == 'string' || typeof other == 'string') {
  6508. value = baseToString(value);
  6509. other = baseToString(other);
  6510. } else {
  6511. value = baseToNumber(value);
  6512. other = baseToNumber(other);
  6513. }
  6514. result = operator(value, other);
  6515. }
  6516. return result;
  6517. };
  6518. }
  6519. /**
  6520. * Creates a function like `_.over`.
  6521. *
  6522. * @private
  6523. * @param {Function} arrayFunc The function to iterate over iteratees.
  6524. * @returns {Function} Returns the new over function.
  6525. */
  6526. function createOver(arrayFunc) {
  6527. return flatRest(function(iteratees) {
  6528. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  6529. return baseRest(function(args) {
  6530. var thisArg = this;
  6531. return arrayFunc(iteratees, function(iteratee) {
  6532. return apply(iteratee, thisArg, args);
  6533. });
  6534. });
  6535. });
  6536. }
  6537. /**
  6538. * Creates the padding for `string` based on `length`. The `chars` string
  6539. * is truncated if the number of characters exceeds `length`.
  6540. *
  6541. * @private
  6542. * @param {number} length The padding length.
  6543. * @param {string} [chars=' '] The string used as padding.
  6544. * @returns {string} Returns the padding for `string`.
  6545. */
  6546. function createPadding(length, chars) {
  6547. chars = chars === undefined ? ' ' : baseToString(chars);
  6548. var charsLength = chars.length;
  6549. if (charsLength < 2) {
  6550. return charsLength ? baseRepeat(chars, length) : chars;
  6551. }
  6552. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  6553. return hasUnicode(chars)
  6554. ? castSlice(stringToArray(result), 0, length).join('')
  6555. : result.slice(0, length);
  6556. }
  6557. /**
  6558. * Creates a function that wraps `func` to invoke it with the `this` binding
  6559. * of `thisArg` and `partials` prepended to the arguments it receives.
  6560. *
  6561. * @private
  6562. * @param {Function} func The function to wrap.
  6563. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  6564. * @param {*} thisArg The `this` binding of `func`.
  6565. * @param {Array} partials The arguments to prepend to those provided to
  6566. * the new function.
  6567. * @returns {Function} Returns the new wrapped function.
  6568. */
  6569. function createPartial(func, bitmask, thisArg, partials) {
  6570. var isBind = bitmask & WRAP_BIND_FLAG,
  6571. Ctor = createCtor(func);
  6572. function wrapper() {
  6573. var argsIndex = -1,
  6574. argsLength = arguments.length,
  6575. leftIndex = -1,
  6576. leftLength = partials.length,
  6577. args = Array(leftLength + argsLength),
  6578. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  6579. while (++leftIndex < leftLength) {
  6580. args[leftIndex] = partials[leftIndex];
  6581. }
  6582. while (argsLength--) {
  6583. args[leftIndex++] = arguments[++argsIndex];
  6584. }
  6585. return apply(fn, isBind ? thisArg : this, args);
  6586. }
  6587. return wrapper;
  6588. }
  6589. /**
  6590. * Creates a `_.range` or `_.rangeRight` function.
  6591. *
  6592. * @private
  6593. * @param {boolean} [fromRight] Specify iterating from right to left.
  6594. * @returns {Function} Returns the new range function.
  6595. */
  6596. function createRange(fromRight) {
  6597. return function(start, end, step) {
  6598. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  6599. end = step = undefined;
  6600. }
  6601. // Ensure the sign of `-0` is preserved.
  6602. start = toFinite(start);
  6603. if (end === undefined) {
  6604. end = start;
  6605. start = 0;
  6606. } else {
  6607. end = toFinite(end);
  6608. }
  6609. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  6610. return baseRange(start, end, step, fromRight);
  6611. };
  6612. }
  6613. /**
  6614. * Creates a function that performs a relational operation on two values.
  6615. *
  6616. * @private
  6617. * @param {Function} operator The function to perform the operation.
  6618. * @returns {Function} Returns the new relational operation function.
  6619. */
  6620. function createRelationalOperation(operator) {
  6621. return function(value, other) {
  6622. if (!(typeof value == 'string' && typeof other == 'string')) {
  6623. value = toNumber(value);
  6624. other = toNumber(other);
  6625. }
  6626. return operator(value, other);
  6627. };
  6628. }
  6629. /**
  6630. * Creates a function that wraps `func` to continue currying.
  6631. *
  6632. * @private
  6633. * @param {Function} func The function to wrap.
  6634. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  6635. * @param {Function} wrapFunc The function to create the `func` wrapper.
  6636. * @param {*} placeholder The placeholder value.
  6637. * @param {*} [thisArg] The `this` binding of `func`.
  6638. * @param {Array} [partials] The arguments to prepend to those provided to
  6639. * the new function.
  6640. * @param {Array} [holders] The `partials` placeholder indexes.
  6641. * @param {Array} [argPos] The argument positions of the new function.
  6642. * @param {number} [ary] The arity cap of `func`.
  6643. * @param {number} [arity] The arity of `func`.
  6644. * @returns {Function} Returns the new wrapped function.
  6645. */
  6646. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  6647. var isCurry = bitmask & WRAP_CURRY_FLAG,
  6648. newHolders = isCurry ? holders : undefined,
  6649. newHoldersRight = isCurry ? undefined : holders,
  6650. newPartials = isCurry ? partials : undefined,
  6651. newPartialsRight = isCurry ? undefined : partials;
  6652. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  6653. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  6654. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  6655. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  6656. }
  6657. var newData = [
  6658. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  6659. newHoldersRight, argPos, ary, arity
  6660. ];
  6661. var result = wrapFunc.apply(undefined, newData);
  6662. if (isLaziable(func)) {
  6663. setData(result, newData);
  6664. }
  6665. result.placeholder = placeholder;
  6666. return setWrapToString(result, func, bitmask);
  6667. }
  6668. /**
  6669. * Creates a function like `_.round`.
  6670. *
  6671. * @private
  6672. * @param {string} methodName The name of the `Math` method to use when rounding.
  6673. * @returns {Function} Returns the new round function.
  6674. */
  6675. function createRound(methodName) {
  6676. var func = Math[methodName];
  6677. return function(number, precision) {
  6678. number = toNumber(number);
  6679. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  6680. if (precision && nativeIsFinite(number)) {
  6681. // Shift with exponential notation to avoid floating-point issues.
  6682. // See [MDN](https://mdn.io/round#Examples) for more details.
  6683. var pair = (toString(number) + 'e').split('e'),
  6684. value = func(pair[0] + 'e' + (+pair[1] + precision));
  6685. pair = (toString(value) + 'e').split('e');
  6686. return +(pair[0] + 'e' + (+pair[1] - precision));
  6687. }
  6688. return func(number);
  6689. };
  6690. }
  6691. /**
  6692. * Creates a set object of `values`.
  6693. *
  6694. * @private
  6695. * @param {Array} values The values to add to the set.
  6696. * @returns {Object} Returns the new set.
  6697. */
  6698. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  6699. return new Set(values);
  6700. };
  6701. /**
  6702. * Creates a `_.toPairs` or `_.toPairsIn` function.
  6703. *
  6704. * @private
  6705. * @param {Function} keysFunc The function to get the keys of a given object.
  6706. * @returns {Function} Returns the new pairs function.
  6707. */
  6708. function createToPairs(keysFunc) {
  6709. return function(object) {
  6710. var tag = getTag(object);
  6711. if (tag == mapTag) {
  6712. return mapToArray(object);
  6713. }
  6714. if (tag == setTag) {
  6715. return setToPairs(object);
  6716. }
  6717. return baseToPairs(object, keysFunc(object));
  6718. };
  6719. }
  6720. /**
  6721. * Creates a function that either curries or invokes `func` with optional
  6722. * `this` binding and partially applied arguments.
  6723. *
  6724. * @private
  6725. * @param {Function|string} func The function or method name to wrap.
  6726. * @param {number} bitmask The bitmask flags.
  6727. * 1 - `_.bind`
  6728. * 2 - `_.bindKey`
  6729. * 4 - `_.curry` or `_.curryRight` of a bound function
  6730. * 8 - `_.curry`
  6731. * 16 - `_.curryRight`
  6732. * 32 - `_.partial`
  6733. * 64 - `_.partialRight`
  6734. * 128 - `_.rearg`
  6735. * 256 - `_.ary`
  6736. * 512 - `_.flip`
  6737. * @param {*} [thisArg] The `this` binding of `func`.
  6738. * @param {Array} [partials] The arguments to be partially applied.
  6739. * @param {Array} [holders] The `partials` placeholder indexes.
  6740. * @param {Array} [argPos] The argument positions of the new function.
  6741. * @param {number} [ary] The arity cap of `func`.
  6742. * @param {number} [arity] The arity of `func`.
  6743. * @returns {Function} Returns the new wrapped function.
  6744. */
  6745. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  6746. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  6747. if (!isBindKey && typeof func != 'function') {
  6748. throw new TypeError(FUNC_ERROR_TEXT);
  6749. }
  6750. var length = partials ? partials.length : 0;
  6751. if (!length) {
  6752. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  6753. partials = holders = undefined;
  6754. }
  6755. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  6756. arity = arity === undefined ? arity : toInteger(arity);
  6757. length -= holders ? holders.length : 0;
  6758. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  6759. var partialsRight = partials,
  6760. holdersRight = holders;
  6761. partials = holders = undefined;
  6762. }
  6763. var data = isBindKey ? undefined : getData(func);
  6764. var newData = [
  6765. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  6766. argPos, ary, arity
  6767. ];
  6768. if (data) {
  6769. mergeData(newData, data);
  6770. }
  6771. func = newData[0];
  6772. bitmask = newData[1];
  6773. thisArg = newData[2];
  6774. partials = newData[3];
  6775. holders = newData[4];
  6776. arity = newData[9] = newData[9] === undefined
  6777. ? (isBindKey ? 0 : func.length)
  6778. : nativeMax(newData[9] - length, 0);
  6779. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  6780. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  6781. }
  6782. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  6783. var result = createBind(func, bitmask, thisArg);
  6784. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  6785. result = createCurry(func, bitmask, arity);
  6786. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  6787. result = createPartial(func, bitmask, thisArg, partials);
  6788. } else {
  6789. result = createHybrid.apply(undefined, newData);
  6790. }
  6791. var setter = data ? baseSetData : setData;
  6792. return setWrapToString(setter(result, newData), func, bitmask);
  6793. }
  6794. /**
  6795. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  6796. * of source objects to the destination object for all destination properties
  6797. * that resolve to `undefined`.
  6798. *
  6799. * @private
  6800. * @param {*} objValue The destination value.
  6801. * @param {*} srcValue The source value.
  6802. * @param {string} key The key of the property to assign.
  6803. * @param {Object} object The parent object of `objValue`.
  6804. * @returns {*} Returns the value to assign.
  6805. */
  6806. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  6807. if (objValue === undefined ||
  6808. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  6809. return srcValue;
  6810. }
  6811. return objValue;
  6812. }
  6813. /**
  6814. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  6815. * objects into destination objects that are passed thru.
  6816. *
  6817. * @private
  6818. * @param {*} objValue The destination value.
  6819. * @param {*} srcValue The source value.
  6820. * @param {string} key The key of the property to merge.
  6821. * @param {Object} object The parent object of `objValue`.
  6822. * @param {Object} source The parent object of `srcValue`.
  6823. * @param {Object} [stack] Tracks traversed source values and their merged
  6824. * counterparts.
  6825. * @returns {*} Returns the value to assign.
  6826. */
  6827. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  6828. if (isObject(objValue) && isObject(srcValue)) {
  6829. // Recursively merge objects and arrays (susceptible to call stack limits).
  6830. stack.set(srcValue, objValue);
  6831. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  6832. stack['delete'](srcValue);
  6833. }
  6834. return objValue;
  6835. }
  6836. /**
  6837. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  6838. * objects.
  6839. *
  6840. * @private
  6841. * @param {*} value The value to inspect.
  6842. * @param {string} key The key of the property to inspect.
  6843. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  6844. */
  6845. function customOmitClone(value) {
  6846. return isPlainObject(value) ? undefined : value;
  6847. }
  6848. /**
  6849. * A specialized version of `baseIsEqualDeep` for arrays with support for
  6850. * partial deep comparisons.
  6851. *
  6852. * @private
  6853. * @param {Array} array The array to compare.
  6854. * @param {Array} other The other array to compare.
  6855. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  6856. * @param {Function} customizer The function to customize comparisons.
  6857. * @param {Function} equalFunc The function to determine equivalents of values.
  6858. * @param {Object} stack Tracks traversed `array` and `other` objects.
  6859. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  6860. */
  6861. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  6862. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  6863. arrLength = array.length,
  6864. othLength = other.length;
  6865. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  6866. return false;
  6867. }
  6868. // Check that cyclic values are equal.
  6869. var arrStacked = stack.get(array);
  6870. var othStacked = stack.get(other);
  6871. if (arrStacked && othStacked) {
  6872. return arrStacked == other && othStacked == array;
  6873. }
  6874. var index = -1,
  6875. result = true,
  6876. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  6877. stack.set(array, other);
  6878. stack.set(other, array);
  6879. // Ignore non-index properties.
  6880. while (++index < arrLength) {
  6881. var arrValue = array[index],
  6882. othValue = other[index];
  6883. if (customizer) {
  6884. var compared = isPartial
  6885. ? customizer(othValue, arrValue, index, other, array, stack)
  6886. : customizer(arrValue, othValue, index, array, other, stack);
  6887. }
  6888. if (compared !== undefined) {
  6889. if (compared) {
  6890. continue;
  6891. }
  6892. result = false;
  6893. break;
  6894. }
  6895. // Recursively compare arrays (susceptible to call stack limits).
  6896. if (seen) {
  6897. if (!arraySome(other, function(othValue, othIndex) {
  6898. if (!cacheHas(seen, othIndex) &&
  6899. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  6900. return seen.push(othIndex);
  6901. }
  6902. })) {
  6903. result = false;
  6904. break;
  6905. }
  6906. } else if (!(
  6907. arrValue === othValue ||
  6908. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  6909. )) {
  6910. result = false;
  6911. break;
  6912. }
  6913. }
  6914. stack['delete'](array);
  6915. stack['delete'](other);
  6916. return result;
  6917. }
  6918. /**
  6919. * A specialized version of `baseIsEqualDeep` for comparing objects of
  6920. * the same `toStringTag`.
  6921. *
  6922. * **Note:** This function only supports comparing values with tags of
  6923. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  6924. *
  6925. * @private
  6926. * @param {Object} object The object to compare.
  6927. * @param {Object} other The other object to compare.
  6928. * @param {string} tag The `toStringTag` of the objects to compare.
  6929. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  6930. * @param {Function} customizer The function to customize comparisons.
  6931. * @param {Function} equalFunc The function to determine equivalents of values.
  6932. * @param {Object} stack Tracks traversed `object` and `other` objects.
  6933. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  6934. */
  6935. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  6936. switch (tag) {
  6937. case dataViewTag:
  6938. if ((object.byteLength != other.byteLength) ||
  6939. (object.byteOffset != other.byteOffset)) {
  6940. return false;
  6941. }
  6942. object = object.buffer;
  6943. other = other.buffer;
  6944. case arrayBufferTag:
  6945. if ((object.byteLength != other.byteLength) ||
  6946. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  6947. return false;
  6948. }
  6949. return true;
  6950. case boolTag:
  6951. case dateTag:
  6952. case numberTag:
  6953. // Coerce booleans to `1` or `0` and dates to milliseconds.
  6954. // Invalid dates are coerced to `NaN`.
  6955. return eq(+object, +other);
  6956. case errorTag:
  6957. return object.name == other.name && object.message == other.message;
  6958. case regexpTag:
  6959. case stringTag:
  6960. // Coerce regexes to strings and treat strings, primitives and objects,
  6961. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  6962. // for more details.
  6963. return object == (other + '');
  6964. case mapTag:
  6965. var convert = mapToArray;
  6966. case setTag:
  6967. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  6968. convert || (convert = setToArray);
  6969. if (object.size != other.size && !isPartial) {
  6970. return false;
  6971. }
  6972. // Assume cyclic values are equal.
  6973. var stacked = stack.get(object);
  6974. if (stacked) {
  6975. return stacked == other;
  6976. }
  6977. bitmask |= COMPARE_UNORDERED_FLAG;
  6978. // Recursively compare objects (susceptible to call stack limits).
  6979. stack.set(object, other);
  6980. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  6981. stack['delete'](object);
  6982. return result;
  6983. case symbolTag:
  6984. if (symbolValueOf) {
  6985. return symbolValueOf.call(object) == symbolValueOf.call(other);
  6986. }
  6987. }
  6988. return false;
  6989. }
  6990. /**
  6991. * A specialized version of `baseIsEqualDeep` for objects with support for
  6992. * partial deep comparisons.
  6993. *
  6994. * @private
  6995. * @param {Object} object The object to compare.
  6996. * @param {Object} other The other object to compare.
  6997. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  6998. * @param {Function} customizer The function to customize comparisons.
  6999. * @param {Function} equalFunc The function to determine equivalents of values.
  7000. * @param {Object} stack Tracks traversed `object` and `other` objects.
  7001. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  7002. */
  7003. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  7004. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  7005. objProps = getAllKeys(object),
  7006. objLength = objProps.length,
  7007. othProps = getAllKeys(other),
  7008. othLength = othProps.length;
  7009. if (objLength != othLength && !isPartial) {
  7010. return false;
  7011. }
  7012. var index = objLength;
  7013. while (index--) {
  7014. var key = objProps[index];
  7015. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  7016. return false;
  7017. }
  7018. }
  7019. // Check that cyclic values are equal.
  7020. var objStacked = stack.get(object);
  7021. var othStacked = stack.get(other);
  7022. if (objStacked && othStacked) {
  7023. return objStacked == other && othStacked == object;
  7024. }
  7025. var result = true;
  7026. stack.set(object, other);
  7027. stack.set(other, object);
  7028. var skipCtor = isPartial;
  7029. while (++index < objLength) {
  7030. key = objProps[index];
  7031. var objValue = object[key],
  7032. othValue = other[key];
  7033. if (customizer) {
  7034. var compared = isPartial
  7035. ? customizer(othValue, objValue, key, other, object, stack)
  7036. : customizer(objValue, othValue, key, object, other, stack);
  7037. }
  7038. // Recursively compare objects (susceptible to call stack limits).
  7039. if (!(compared === undefined
  7040. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  7041. : compared
  7042. )) {
  7043. result = false;
  7044. break;
  7045. }
  7046. skipCtor || (skipCtor = key == 'constructor');
  7047. }
  7048. if (result && !skipCtor) {
  7049. var objCtor = object.constructor,
  7050. othCtor = other.constructor;
  7051. // Non `Object` object instances with different constructors are not equal.
  7052. if (objCtor != othCtor &&
  7053. ('constructor' in object && 'constructor' in other) &&
  7054. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  7055. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  7056. result = false;
  7057. }
  7058. }
  7059. stack['delete'](object);
  7060. stack['delete'](other);
  7061. return result;
  7062. }
  7063. /**
  7064. * A specialized version of `baseRest` which flattens the rest array.
  7065. *
  7066. * @private
  7067. * @param {Function} func The function to apply a rest parameter to.
  7068. * @returns {Function} Returns the new function.
  7069. */
  7070. function flatRest(func) {
  7071. return setToString(overRest(func, undefined, flatten), func + '');
  7072. }
  7073. /**
  7074. * Creates an array of own enumerable property names and symbols of `object`.
  7075. *
  7076. * @private
  7077. * @param {Object} object The object to query.
  7078. * @returns {Array} Returns the array of property names and symbols.
  7079. */
  7080. function getAllKeys(object) {
  7081. return baseGetAllKeys(object, keys, getSymbols);
  7082. }
  7083. /**
  7084. * Creates an array of own and inherited enumerable property names and
  7085. * symbols of `object`.
  7086. *
  7087. * @private
  7088. * @param {Object} object The object to query.
  7089. * @returns {Array} Returns the array of property names and symbols.
  7090. */
  7091. function getAllKeysIn(object) {
  7092. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  7093. }
  7094. /**
  7095. * Gets metadata for `func`.
  7096. *
  7097. * @private
  7098. * @param {Function} func The function to query.
  7099. * @returns {*} Returns the metadata for `func`.
  7100. */
  7101. var getData = !metaMap ? noop : function(func) {
  7102. return metaMap.get(func);
  7103. };
  7104. /**
  7105. * Gets the name of `func`.
  7106. *
  7107. * @private
  7108. * @param {Function} func The function to query.
  7109. * @returns {string} Returns the function name.
  7110. */
  7111. function getFuncName(func) {
  7112. var result = (func.name + ''),
  7113. array = realNames[result],
  7114. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  7115. while (length--) {
  7116. var data = array[length],
  7117. otherFunc = data.func;
  7118. if (otherFunc == null || otherFunc == func) {
  7119. return data.name;
  7120. }
  7121. }
  7122. return result;
  7123. }
  7124. /**
  7125. * Gets the argument placeholder value for `func`.
  7126. *
  7127. * @private
  7128. * @param {Function} func The function to inspect.
  7129. * @returns {*} Returns the placeholder value.
  7130. */
  7131. function getHolder(func) {
  7132. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  7133. return object.placeholder;
  7134. }
  7135. /**
  7136. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  7137. * this function returns the custom method, otherwise it returns `baseIteratee`.
  7138. * If arguments are provided, the chosen function is invoked with them and
  7139. * its result is returned.
  7140. *
  7141. * @private
  7142. * @param {*} [value] The value to convert to an iteratee.
  7143. * @param {number} [arity] The arity of the created iteratee.
  7144. * @returns {Function} Returns the chosen function or its result.
  7145. */
  7146. function getIteratee() {
  7147. var result = lodash.iteratee || iteratee;
  7148. result = result === iteratee ? baseIteratee : result;
  7149. return arguments.length ? result(arguments[0], arguments[1]) : result;
  7150. }
  7151. /**
  7152. * Gets the data for `map`.
  7153. *
  7154. * @private
  7155. * @param {Object} map The map to query.
  7156. * @param {string} key The reference key.
  7157. * @returns {*} Returns the map data.
  7158. */
  7159. function getMapData(map, key) {
  7160. var data = map.__data__;
  7161. return isKeyable(key)
  7162. ? data[typeof key == 'string' ? 'string' : 'hash']
  7163. : data.map;
  7164. }
  7165. /**
  7166. * Gets the property names, values, and compare flags of `object`.
  7167. *
  7168. * @private
  7169. * @param {Object} object The object to query.
  7170. * @returns {Array} Returns the match data of `object`.
  7171. */
  7172. function getMatchData(object) {
  7173. var result = keys(object),
  7174. length = result.length;
  7175. while (length--) {
  7176. var key = result[length],
  7177. value = object[key];
  7178. result[length] = [key, value, isStrictComparable(value)];
  7179. }
  7180. return result;
  7181. }
  7182. /**
  7183. * Gets the native function at `key` of `object`.
  7184. *
  7185. * @private
  7186. * @param {Object} object The object to query.
  7187. * @param {string} key The key of the method to get.
  7188. * @returns {*} Returns the function if it's native, else `undefined`.
  7189. */
  7190. function getNative(object, key) {
  7191. var value = getValue(object, key);
  7192. return baseIsNative(value) ? value : undefined;
  7193. }
  7194. /**
  7195. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  7196. *
  7197. * @private
  7198. * @param {*} value The value to query.
  7199. * @returns {string} Returns the raw `toStringTag`.
  7200. */
  7201. function getRawTag(value) {
  7202. var isOwn = hasOwnProperty.call(value, symToStringTag),
  7203. tag = value[symToStringTag];
  7204. try {
  7205. value[symToStringTag] = undefined;
  7206. var unmasked = true;
  7207. } catch (e) {}
  7208. var result = nativeObjectToString.call(value);
  7209. if (unmasked) {
  7210. if (isOwn) {
  7211. value[symToStringTag] = tag;
  7212. } else {
  7213. delete value[symToStringTag];
  7214. }
  7215. }
  7216. return result;
  7217. }
  7218. /**
  7219. * Creates an array of the own enumerable symbols of `object`.
  7220. *
  7221. * @private
  7222. * @param {Object} object The object to query.
  7223. * @returns {Array} Returns the array of symbols.
  7224. */
  7225. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  7226. if (object == null) {
  7227. return [];
  7228. }
  7229. object = Object(object);
  7230. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  7231. return propertyIsEnumerable.call(object, symbol);
  7232. });
  7233. };
  7234. /**
  7235. * Creates an array of the own and inherited enumerable symbols of `object`.
  7236. *
  7237. * @private
  7238. * @param {Object} object The object to query.
  7239. * @returns {Array} Returns the array of symbols.
  7240. */
  7241. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  7242. var result = [];
  7243. while (object) {
  7244. arrayPush(result, getSymbols(object));
  7245. object = getPrototype(object);
  7246. }
  7247. return result;
  7248. };
  7249. /**
  7250. * Gets the `toStringTag` of `value`.
  7251. *
  7252. * @private
  7253. * @param {*} value The value to query.
  7254. * @returns {string} Returns the `toStringTag`.
  7255. */
  7256. var getTag = baseGetTag;
  7257. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  7258. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  7259. (Map && getTag(new Map) != mapTag) ||
  7260. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  7261. (Set && getTag(new Set) != setTag) ||
  7262. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  7263. getTag = function(value) {
  7264. var result = baseGetTag(value),
  7265. Ctor = result == objectTag ? value.constructor : undefined,
  7266. ctorString = Ctor ? toSource(Ctor) : '';
  7267. if (ctorString) {
  7268. switch (ctorString) {
  7269. case dataViewCtorString: return dataViewTag;
  7270. case mapCtorString: return mapTag;
  7271. case promiseCtorString: return promiseTag;
  7272. case setCtorString: return setTag;
  7273. case weakMapCtorString: return weakMapTag;
  7274. }
  7275. }
  7276. return result;
  7277. };
  7278. }
  7279. /**
  7280. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  7281. *
  7282. * @private
  7283. * @param {number} start The start of the view.
  7284. * @param {number} end The end of the view.
  7285. * @param {Array} transforms The transformations to apply to the view.
  7286. * @returns {Object} Returns an object containing the `start` and `end`
  7287. * positions of the view.
  7288. */
  7289. function getView(start, end, transforms) {
  7290. var index = -1,
  7291. length = transforms.length;
  7292. while (++index < length) {
  7293. var data = transforms[index],
  7294. size = data.size;
  7295. switch (data.type) {
  7296. case 'drop': start += size; break;
  7297. case 'dropRight': end -= size; break;
  7298. case 'take': end = nativeMin(end, start + size); break;
  7299. case 'takeRight': start = nativeMax(start, end - size); break;
  7300. }
  7301. }
  7302. return { 'start': start, 'end': end };
  7303. }
  7304. /**
  7305. * Extracts wrapper details from the `source` body comment.
  7306. *
  7307. * @private
  7308. * @param {string} source The source to inspect.
  7309. * @returns {Array} Returns the wrapper details.
  7310. */
  7311. function getWrapDetails(source) {
  7312. var match = source.match(reWrapDetails);
  7313. return match ? match[1].split(reSplitDetails) : [];
  7314. }
  7315. /**
  7316. * Checks if `path` exists on `object`.
  7317. *
  7318. * @private
  7319. * @param {Object} object The object to query.
  7320. * @param {Array|string} path The path to check.
  7321. * @param {Function} hasFunc The function to check properties.
  7322. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  7323. */
  7324. function hasPath(object, path, hasFunc) {
  7325. path = castPath(path, object);
  7326. var index = -1,
  7327. length = path.length,
  7328. result = false;
  7329. while (++index < length) {
  7330. var key = toKey(path[index]);
  7331. if (!(result = object != null && hasFunc(object, key))) {
  7332. break;
  7333. }
  7334. object = object[key];
  7335. }
  7336. if (result || ++index != length) {
  7337. return result;
  7338. }
  7339. length = object == null ? 0 : object.length;
  7340. return !!length && isLength(length) && isIndex(key, length) &&
  7341. (isArray(object) || isArguments(object));
  7342. }
  7343. /**
  7344. * Initializes an array clone.
  7345. *
  7346. * @private
  7347. * @param {Array} array The array to clone.
  7348. * @returns {Array} Returns the initialized clone.
  7349. */
  7350. function initCloneArray(array) {
  7351. var length = array.length,
  7352. result = new array.constructor(length);
  7353. // Add properties assigned by `RegExp#exec`.
  7354. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  7355. result.index = array.index;
  7356. result.input = array.input;
  7357. }
  7358. return result;
  7359. }
  7360. /**
  7361. * Initializes an object clone.
  7362. *
  7363. * @private
  7364. * @param {Object} object The object to clone.
  7365. * @returns {Object} Returns the initialized clone.
  7366. */
  7367. function initCloneObject(object) {
  7368. return (typeof object.constructor == 'function' && !isPrototype(object))
  7369. ? baseCreate(getPrototype(object))
  7370. : {};
  7371. }
  7372. /**
  7373. * Initializes an object clone based on its `toStringTag`.
  7374. *
  7375. * **Note:** This function only supports cloning values with tags of
  7376. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  7377. *
  7378. * @private
  7379. * @param {Object} object The object to clone.
  7380. * @param {string} tag The `toStringTag` of the object to clone.
  7381. * @param {boolean} [isDeep] Specify a deep clone.
  7382. * @returns {Object} Returns the initialized clone.
  7383. */
  7384. function initCloneByTag(object, tag, isDeep) {
  7385. var Ctor = object.constructor;
  7386. switch (tag) {
  7387. case arrayBufferTag:
  7388. return cloneArrayBuffer(object);
  7389. case boolTag:
  7390. case dateTag:
  7391. return new Ctor(+object);
  7392. case dataViewTag:
  7393. return cloneDataView(object, isDeep);
  7394. case float32Tag: case float64Tag:
  7395. case int8Tag: case int16Tag: case int32Tag:
  7396. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  7397. return cloneTypedArray(object, isDeep);
  7398. case mapTag:
  7399. return new Ctor;
  7400. case numberTag:
  7401. case stringTag:
  7402. return new Ctor(object);
  7403. case regexpTag:
  7404. return cloneRegExp(object);
  7405. case setTag:
  7406. return new Ctor;
  7407. case symbolTag:
  7408. return cloneSymbol(object);
  7409. }
  7410. }
  7411. /**
  7412. * Inserts wrapper `details` in a comment at the top of the `source` body.
  7413. *
  7414. * @private
  7415. * @param {string} source The source to modify.
  7416. * @returns {Array} details The details to insert.
  7417. * @returns {string} Returns the modified source.
  7418. */
  7419. function insertWrapDetails(source, details) {
  7420. var length = details.length;
  7421. if (!length) {
  7422. return source;
  7423. }
  7424. var lastIndex = length - 1;
  7425. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  7426. details = details.join(length > 2 ? ', ' : ' ');
  7427. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  7428. }
  7429. /**
  7430. * Checks if `value` is a flattenable `arguments` object or array.
  7431. *
  7432. * @private
  7433. * @param {*} value The value to check.
  7434. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  7435. */
  7436. function isFlattenable(value) {
  7437. return isArray(value) || isArguments(value) ||
  7438. !!(spreadableSymbol && value && value[spreadableSymbol]);
  7439. }
  7440. /**
  7441. * Checks if `value` is a valid array-like index.
  7442. *
  7443. * @private
  7444. * @param {*} value The value to check.
  7445. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  7446. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  7447. */
  7448. function isIndex(value, length) {
  7449. var type = typeof value;
  7450. length = length == null ? MAX_SAFE_INTEGER : length;
  7451. return !!length &&
  7452. (type == 'number' ||
  7453. (type != 'symbol' && reIsUint.test(value))) &&
  7454. (value > -1 && value % 1 == 0 && value < length);
  7455. }
  7456. /**
  7457. * Checks if the given arguments are from an iteratee call.
  7458. *
  7459. * @private
  7460. * @param {*} value The potential iteratee value argument.
  7461. * @param {*} index The potential iteratee index or key argument.
  7462. * @param {*} object The potential iteratee object argument.
  7463. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  7464. * else `false`.
  7465. */
  7466. function isIterateeCall(value, index, object) {
  7467. if (!isObject(object)) {
  7468. return false;
  7469. }
  7470. var type = typeof index;
  7471. if (type == 'number'
  7472. ? (isArrayLike(object) && isIndex(index, object.length))
  7473. : (type == 'string' && index in object)
  7474. ) {
  7475. return eq(object[index], value);
  7476. }
  7477. return false;
  7478. }
  7479. /**
  7480. * Checks if `value` is a property name and not a property path.
  7481. *
  7482. * @private
  7483. * @param {*} value The value to check.
  7484. * @param {Object} [object] The object to query keys on.
  7485. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  7486. */
  7487. function isKey(value, object) {
  7488. if (isArray(value)) {
  7489. return false;
  7490. }
  7491. var type = typeof value;
  7492. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  7493. value == null || isSymbol(value)) {
  7494. return true;
  7495. }
  7496. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  7497. (object != null && value in Object(object));
  7498. }
  7499. /**
  7500. * Checks if `value` is suitable for use as unique object key.
  7501. *
  7502. * @private
  7503. * @param {*} value The value to check.
  7504. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  7505. */
  7506. function isKeyable(value) {
  7507. var type = typeof value;
  7508. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  7509. ? (value !== '__proto__')
  7510. : (value === null);
  7511. }
  7512. /**
  7513. * Checks if `func` has a lazy counterpart.
  7514. *
  7515. * @private
  7516. * @param {Function} func The function to check.
  7517. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  7518. * else `false`.
  7519. */
  7520. function isLaziable(func) {
  7521. var funcName = getFuncName(func),
  7522. other = lodash[funcName];
  7523. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  7524. return false;
  7525. }
  7526. if (func === other) {
  7527. return true;
  7528. }
  7529. var data = getData(other);
  7530. return !!data && func === data[0];
  7531. }
  7532. /**
  7533. * Checks if `func` has its source masked.
  7534. *
  7535. * @private
  7536. * @param {Function} func The function to check.
  7537. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  7538. */
  7539. function isMasked(func) {
  7540. return !!maskSrcKey && (maskSrcKey in func);
  7541. }
  7542. /**
  7543. * Checks if `func` is capable of being masked.
  7544. *
  7545. * @private
  7546. * @param {*} value The value to check.
  7547. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  7548. */
  7549. var isMaskable = coreJsData ? isFunction : stubFalse;
  7550. /**
  7551. * Checks if `value` is likely a prototype object.
  7552. *
  7553. * @private
  7554. * @param {*} value The value to check.
  7555. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  7556. */
  7557. function isPrototype(value) {
  7558. var Ctor = value && value.constructor,
  7559. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  7560. return value === proto;
  7561. }
  7562. /**
  7563. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  7564. *
  7565. * @private
  7566. * @param {*} value The value to check.
  7567. * @returns {boolean} Returns `true` if `value` if suitable for strict
  7568. * equality comparisons, else `false`.
  7569. */
  7570. function isStrictComparable(value) {
  7571. return value === value && !isObject(value);
  7572. }
  7573. /**
  7574. * A specialized version of `matchesProperty` for source values suitable
  7575. * for strict equality comparisons, i.e. `===`.
  7576. *
  7577. * @private
  7578. * @param {string} key The key of the property to get.
  7579. * @param {*} srcValue The value to match.
  7580. * @returns {Function} Returns the new spec function.
  7581. */
  7582. function matchesStrictComparable(key, srcValue) {
  7583. return function(object) {
  7584. if (object == null) {
  7585. return false;
  7586. }
  7587. return object[key] === srcValue &&
  7588. (srcValue !== undefined || (key in Object(object)));
  7589. };
  7590. }
  7591. /**
  7592. * A specialized version of `_.memoize` which clears the memoized function's
  7593. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  7594. *
  7595. * @private
  7596. * @param {Function} func The function to have its output memoized.
  7597. * @returns {Function} Returns the new memoized function.
  7598. */
  7599. function memoizeCapped(func) {
  7600. var result = memoize(func, function(key) {
  7601. if (cache.size === MAX_MEMOIZE_SIZE) {
  7602. cache.clear();
  7603. }
  7604. return key;
  7605. });
  7606. var cache = result.cache;
  7607. return result;
  7608. }
  7609. /**
  7610. * Merges the function metadata of `source` into `data`.
  7611. *
  7612. * Merging metadata reduces the number of wrappers used to invoke a function.
  7613. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  7614. * may be applied regardless of execution order. Methods like `_.ary` and
  7615. * `_.rearg` modify function arguments, making the order in which they are
  7616. * executed important, preventing the merging of metadata. However, we make
  7617. * an exception for a safe combined case where curried functions have `_.ary`
  7618. * and or `_.rearg` applied.
  7619. *
  7620. * @private
  7621. * @param {Array} data The destination metadata.
  7622. * @param {Array} source The source metadata.
  7623. * @returns {Array} Returns `data`.
  7624. */
  7625. function mergeData(data, source) {
  7626. var bitmask = data[1],
  7627. srcBitmask = source[1],
  7628. newBitmask = bitmask | srcBitmask,
  7629. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  7630. var isCombo =
  7631. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  7632. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  7633. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  7634. // Exit early if metadata can't be merged.
  7635. if (!(isCommon || isCombo)) {
  7636. return data;
  7637. }
  7638. // Use source `thisArg` if available.
  7639. if (srcBitmask & WRAP_BIND_FLAG) {
  7640. data[2] = source[2];
  7641. // Set when currying a bound function.
  7642. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  7643. }
  7644. // Compose partial arguments.
  7645. var value = source[3];
  7646. if (value) {
  7647. var partials = data[3];
  7648. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  7649. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  7650. }
  7651. // Compose partial right arguments.
  7652. value = source[5];
  7653. if (value) {
  7654. partials = data[5];
  7655. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  7656. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  7657. }
  7658. // Use source `argPos` if available.
  7659. value = source[7];
  7660. if (value) {
  7661. data[7] = value;
  7662. }
  7663. // Use source `ary` if it's smaller.
  7664. if (srcBitmask & WRAP_ARY_FLAG) {
  7665. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  7666. }
  7667. // Use source `arity` if one is not provided.
  7668. if (data[9] == null) {
  7669. data[9] = source[9];
  7670. }
  7671. // Use source `func` and merge bitmasks.
  7672. data[0] = source[0];
  7673. data[1] = newBitmask;
  7674. return data;
  7675. }
  7676. /**
  7677. * This function is like
  7678. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  7679. * except that it includes inherited enumerable properties.
  7680. *
  7681. * @private
  7682. * @param {Object} object The object to query.
  7683. * @returns {Array} Returns the array of property names.
  7684. */
  7685. function nativeKeysIn(object) {
  7686. var result = [];
  7687. if (object != null) {
  7688. for (var key in Object(object)) {
  7689. result.push(key);
  7690. }
  7691. }
  7692. return result;
  7693. }
  7694. /**
  7695. * Converts `value` to a string using `Object.prototype.toString`.
  7696. *
  7697. * @private
  7698. * @param {*} value The value to convert.
  7699. * @returns {string} Returns the converted string.
  7700. */
  7701. function objectToString(value) {
  7702. return nativeObjectToString.call(value);
  7703. }
  7704. /**
  7705. * A specialized version of `baseRest` which transforms the rest array.
  7706. *
  7707. * @private
  7708. * @param {Function} func The function to apply a rest parameter to.
  7709. * @param {number} [start=func.length-1] The start position of the rest parameter.
  7710. * @param {Function} transform The rest array transform.
  7711. * @returns {Function} Returns the new function.
  7712. */
  7713. function overRest(func, start, transform) {
  7714. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  7715. return function() {
  7716. var args = arguments,
  7717. index = -1,
  7718. length = nativeMax(args.length - start, 0),
  7719. array = Array(length);
  7720. while (++index < length) {
  7721. array[index] = args[start + index];
  7722. }
  7723. index = -1;
  7724. var otherArgs = Array(start + 1);
  7725. while (++index < start) {
  7726. otherArgs[index] = args[index];
  7727. }
  7728. otherArgs[start] = transform(array);
  7729. return apply(func, this, otherArgs);
  7730. };
  7731. }
  7732. /**
  7733. * Gets the parent value at `path` of `object`.
  7734. *
  7735. * @private
  7736. * @param {Object} object The object to query.
  7737. * @param {Array} path The path to get the parent value of.
  7738. * @returns {*} Returns the parent value.
  7739. */
  7740. function parent(object, path) {
  7741. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  7742. }
  7743. /**
  7744. * Reorder `array` according to the specified indexes where the element at
  7745. * the first index is assigned as the first element, the element at
  7746. * the second index is assigned as the second element, and so on.
  7747. *
  7748. * @private
  7749. * @param {Array} array The array to reorder.
  7750. * @param {Array} indexes The arranged array indexes.
  7751. * @returns {Array} Returns `array`.
  7752. */
  7753. function reorder(array, indexes) {
  7754. var arrLength = array.length,
  7755. length = nativeMin(indexes.length, arrLength),
  7756. oldArray = copyArray(array);
  7757. while (length--) {
  7758. var index = indexes[length];
  7759. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  7760. }
  7761. return array;
  7762. }
  7763. /**
  7764. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  7765. *
  7766. * @private
  7767. * @param {Object} object The object to query.
  7768. * @param {string} key The key of the property to get.
  7769. * @returns {*} Returns the property value.
  7770. */
  7771. function safeGet(object, key) {
  7772. if (key === 'constructor' && typeof object[key] === 'function') {
  7773. return;
  7774. }
  7775. if (key == '__proto__') {
  7776. return;
  7777. }
  7778. return object[key];
  7779. }
  7780. /**
  7781. * Sets metadata for `func`.
  7782. *
  7783. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  7784. * period of time, it will trip its breaker and transition to an identity
  7785. * function to avoid garbage collection pauses in V8. See
  7786. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  7787. * for more details.
  7788. *
  7789. * @private
  7790. * @param {Function} func The function to associate metadata with.
  7791. * @param {*} data The metadata.
  7792. * @returns {Function} Returns `func`.
  7793. */
  7794. var setData = shortOut(baseSetData);
  7795. /**
  7796. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  7797. *
  7798. * @private
  7799. * @param {Function} func The function to delay.
  7800. * @param {number} wait The number of milliseconds to delay invocation.
  7801. * @returns {number|Object} Returns the timer id or timeout object.
  7802. */
  7803. var setTimeout = ctxSetTimeout || function(func, wait) {
  7804. return root.setTimeout(func, wait);
  7805. };
  7806. /**
  7807. * Sets the `toString` method of `func` to return `string`.
  7808. *
  7809. * @private
  7810. * @param {Function} func The function to modify.
  7811. * @param {Function} string The `toString` result.
  7812. * @returns {Function} Returns `func`.
  7813. */
  7814. var setToString = shortOut(baseSetToString);
  7815. /**
  7816. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  7817. * with wrapper details in a comment at the top of the source body.
  7818. *
  7819. * @private
  7820. * @param {Function} wrapper The function to modify.
  7821. * @param {Function} reference The reference function.
  7822. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  7823. * @returns {Function} Returns `wrapper`.
  7824. */
  7825. function setWrapToString(wrapper, reference, bitmask) {
  7826. var source = (reference + '');
  7827. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  7828. }
  7829. /**
  7830. * Creates a function that'll short out and invoke `identity` instead
  7831. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  7832. * milliseconds.
  7833. *
  7834. * @private
  7835. * @param {Function} func The function to restrict.
  7836. * @returns {Function} Returns the new shortable function.
  7837. */
  7838. function shortOut(func) {
  7839. var count = 0,
  7840. lastCalled = 0;
  7841. return function() {
  7842. var stamp = nativeNow(),
  7843. remaining = HOT_SPAN - (stamp - lastCalled);
  7844. lastCalled = stamp;
  7845. if (remaining > 0) {
  7846. if (++count >= HOT_COUNT) {
  7847. return arguments[0];
  7848. }
  7849. } else {
  7850. count = 0;
  7851. }
  7852. return func.apply(undefined, arguments);
  7853. };
  7854. }
  7855. /**
  7856. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  7857. *
  7858. * @private
  7859. * @param {Array} array The array to shuffle.
  7860. * @param {number} [size=array.length] The size of `array`.
  7861. * @returns {Array} Returns `array`.
  7862. */
  7863. function shuffleSelf(array, size) {
  7864. var index = -1,
  7865. length = array.length,
  7866. lastIndex = length - 1;
  7867. size = size === undefined ? length : size;
  7868. while (++index < size) {
  7869. var rand = baseRandom(index, lastIndex),
  7870. value = array[rand];
  7871. array[rand] = array[index];
  7872. array[index] = value;
  7873. }
  7874. array.length = size;
  7875. return array;
  7876. }
  7877. /**
  7878. * Converts `string` to a property path array.
  7879. *
  7880. * @private
  7881. * @param {string} string The string to convert.
  7882. * @returns {Array} Returns the property path array.
  7883. */
  7884. var stringToPath = memoizeCapped(function(string) {
  7885. var result = [];
  7886. if (string.charCodeAt(0) === 46 /* . */) {
  7887. result.push('');
  7888. }
  7889. string.replace(rePropName, function(match, number, quote, subString) {
  7890. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  7891. });
  7892. return result;
  7893. });
  7894. /**
  7895. * Converts `value` to a string key if it's not a string or symbol.
  7896. *
  7897. * @private
  7898. * @param {*} value The value to inspect.
  7899. * @returns {string|symbol} Returns the key.
  7900. */
  7901. function toKey(value) {
  7902. if (typeof value == 'string' || isSymbol(value)) {
  7903. return value;
  7904. }
  7905. var result = (value + '');
  7906. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  7907. }
  7908. /**
  7909. * Converts `func` to its source code.
  7910. *
  7911. * @private
  7912. * @param {Function} func The function to convert.
  7913. * @returns {string} Returns the source code.
  7914. */
  7915. function toSource(func) {
  7916. if (func != null) {
  7917. try {
  7918. return funcToString.call(func);
  7919. } catch (e) {}
  7920. try {
  7921. return (func + '');
  7922. } catch (e) {}
  7923. }
  7924. return '';
  7925. }
  7926. /**
  7927. * Updates wrapper `details` based on `bitmask` flags.
  7928. *
  7929. * @private
  7930. * @returns {Array} details The details to modify.
  7931. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  7932. * @returns {Array} Returns `details`.
  7933. */
  7934. function updateWrapDetails(details, bitmask) {
  7935. arrayEach(wrapFlags, function(pair) {
  7936. var value = '_.' + pair[0];
  7937. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  7938. details.push(value);
  7939. }
  7940. });
  7941. return details.sort();
  7942. }
  7943. /**
  7944. * Creates a clone of `wrapper`.
  7945. *
  7946. * @private
  7947. * @param {Object} wrapper The wrapper to clone.
  7948. * @returns {Object} Returns the cloned wrapper.
  7949. */
  7950. function wrapperClone(wrapper) {
  7951. if (wrapper instanceof LazyWrapper) {
  7952. return wrapper.clone();
  7953. }
  7954. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  7955. result.__actions__ = copyArray(wrapper.__actions__);
  7956. result.__index__ = wrapper.__index__;
  7957. result.__values__ = wrapper.__values__;
  7958. return result;
  7959. }
  7960. /*------------------------------------------------------------------------*/
  7961. /**
  7962. * Creates an array of elements split into groups the length of `size`.
  7963. * If `array` can't be split evenly, the final chunk will be the remaining
  7964. * elements.
  7965. *
  7966. * @static
  7967. * @memberOf _
  7968. * @since 3.0.0
  7969. * @category Array
  7970. * @param {Array} array The array to process.
  7971. * @param {number} [size=1] The length of each chunk
  7972. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  7973. * @returns {Array} Returns the new array of chunks.
  7974. * @example
  7975. *
  7976. * _.chunk(['a', 'b', 'c', 'd'], 2);
  7977. * // => [['a', 'b'], ['c', 'd']]
  7978. *
  7979. * _.chunk(['a', 'b', 'c', 'd'], 3);
  7980. * // => [['a', 'b', 'c'], ['d']]
  7981. */
  7982. function chunk(array, size, guard) {
  7983. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  7984. size = 1;
  7985. } else {
  7986. size = nativeMax(toInteger(size), 0);
  7987. }
  7988. var length = array == null ? 0 : array.length;
  7989. if (!length || size < 1) {
  7990. return [];
  7991. }
  7992. var index = 0,
  7993. resIndex = 0,
  7994. result = Array(nativeCeil(length / size));
  7995. while (index < length) {
  7996. result[resIndex++] = baseSlice(array, index, (index += size));
  7997. }
  7998. return result;
  7999. }
  8000. /**
  8001. * Creates an array with all falsey values removed. The values `false`, `null`,
  8002. * `0`, `""`, `undefined`, and `NaN` are falsey.
  8003. *
  8004. * @static
  8005. * @memberOf _
  8006. * @since 0.1.0
  8007. * @category Array
  8008. * @param {Array} array The array to compact.
  8009. * @returns {Array} Returns the new array of filtered values.
  8010. * @example
  8011. *
  8012. * _.compact([0, 1, false, 2, '', 3]);
  8013. * // => [1, 2, 3]
  8014. */
  8015. function compact(array) {
  8016. var index = -1,
  8017. length = array == null ? 0 : array.length,
  8018. resIndex = 0,
  8019. result = [];
  8020. while (++index < length) {
  8021. var value = array[index];
  8022. if (value) {
  8023. result[resIndex++] = value;
  8024. }
  8025. }
  8026. return result;
  8027. }
  8028. /**
  8029. * Creates a new array concatenating `array` with any additional arrays
  8030. * and/or values.
  8031. *
  8032. * @static
  8033. * @memberOf _
  8034. * @since 4.0.0
  8035. * @category Array
  8036. * @param {Array} array The array to concatenate.
  8037. * @param {...*} [values] The values to concatenate.
  8038. * @returns {Array} Returns the new concatenated array.
  8039. * @example
  8040. *
  8041. * var array = [1];
  8042. * var other = _.concat(array, 2, [3], [[4]]);
  8043. *
  8044. * console.log(other);
  8045. * // => [1, 2, 3, [4]]
  8046. *
  8047. * console.log(array);
  8048. * // => [1]
  8049. */
  8050. function concat() {
  8051. var length = arguments.length;
  8052. if (!length) {
  8053. return [];
  8054. }
  8055. var args = Array(length - 1),
  8056. array = arguments[0],
  8057. index = length;
  8058. while (index--) {
  8059. args[index - 1] = arguments[index];
  8060. }
  8061. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  8062. }
  8063. /**
  8064. * Creates an array of `array` values not included in the other given arrays
  8065. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8066. * for equality comparisons. The order and references of result values are
  8067. * determined by the first array.
  8068. *
  8069. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  8070. *
  8071. * @static
  8072. * @memberOf _
  8073. * @since 0.1.0
  8074. * @category Array
  8075. * @param {Array} array The array to inspect.
  8076. * @param {...Array} [values] The values to exclude.
  8077. * @returns {Array} Returns the new array of filtered values.
  8078. * @see _.without, _.xor
  8079. * @example
  8080. *
  8081. * _.difference([2, 1], [2, 3]);
  8082. * // => [1]
  8083. */
  8084. var difference = baseRest(function(array, values) {
  8085. return isArrayLikeObject(array)
  8086. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  8087. : [];
  8088. });
  8089. /**
  8090. * This method is like `_.difference` except that it accepts `iteratee` which
  8091. * is invoked for each element of `array` and `values` to generate the criterion
  8092. * by which they're compared. The order and references of result values are
  8093. * determined by the first array. The iteratee is invoked with one argument:
  8094. * (value).
  8095. *
  8096. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  8097. *
  8098. * @static
  8099. * @memberOf _
  8100. * @since 4.0.0
  8101. * @category Array
  8102. * @param {Array} array The array to inspect.
  8103. * @param {...Array} [values] The values to exclude.
  8104. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8105. * @returns {Array} Returns the new array of filtered values.
  8106. * @example
  8107. *
  8108. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  8109. * // => [1.2]
  8110. *
  8111. * // The `_.property` iteratee shorthand.
  8112. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  8113. * // => [{ 'x': 2 }]
  8114. */
  8115. var differenceBy = baseRest(function(array, values) {
  8116. var iteratee = last(values);
  8117. if (isArrayLikeObject(iteratee)) {
  8118. iteratee = undefined;
  8119. }
  8120. return isArrayLikeObject(array)
  8121. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  8122. : [];
  8123. });
  8124. /**
  8125. * This method is like `_.difference` except that it accepts `comparator`
  8126. * which is invoked to compare elements of `array` to `values`. The order and
  8127. * references of result values are determined by the first array. The comparator
  8128. * is invoked with two arguments: (arrVal, othVal).
  8129. *
  8130. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  8131. *
  8132. * @static
  8133. * @memberOf _
  8134. * @since 4.0.0
  8135. * @category Array
  8136. * @param {Array} array The array to inspect.
  8137. * @param {...Array} [values] The values to exclude.
  8138. * @param {Function} [comparator] The comparator invoked per element.
  8139. * @returns {Array} Returns the new array of filtered values.
  8140. * @example
  8141. *
  8142. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  8143. *
  8144. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  8145. * // => [{ 'x': 2, 'y': 1 }]
  8146. */
  8147. var differenceWith = baseRest(function(array, values) {
  8148. var comparator = last(values);
  8149. if (isArrayLikeObject(comparator)) {
  8150. comparator = undefined;
  8151. }
  8152. return isArrayLikeObject(array)
  8153. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  8154. : [];
  8155. });
  8156. /**
  8157. * Creates a slice of `array` with `n` elements dropped from the beginning.
  8158. *
  8159. * @static
  8160. * @memberOf _
  8161. * @since 0.5.0
  8162. * @category Array
  8163. * @param {Array} array The array to query.
  8164. * @param {number} [n=1] The number of elements to drop.
  8165. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8166. * @returns {Array} Returns the slice of `array`.
  8167. * @example
  8168. *
  8169. * _.drop([1, 2, 3]);
  8170. * // => [2, 3]
  8171. *
  8172. * _.drop([1, 2, 3], 2);
  8173. * // => [3]
  8174. *
  8175. * _.drop([1, 2, 3], 5);
  8176. * // => []
  8177. *
  8178. * _.drop([1, 2, 3], 0);
  8179. * // => [1, 2, 3]
  8180. */
  8181. function drop(array, n, guard) {
  8182. var length = array == null ? 0 : array.length;
  8183. if (!length) {
  8184. return [];
  8185. }
  8186. n = (guard || n === undefined) ? 1 : toInteger(n);
  8187. return baseSlice(array, n < 0 ? 0 : n, length);
  8188. }
  8189. /**
  8190. * Creates a slice of `array` with `n` elements dropped from the end.
  8191. *
  8192. * @static
  8193. * @memberOf _
  8194. * @since 3.0.0
  8195. * @category Array
  8196. * @param {Array} array The array to query.
  8197. * @param {number} [n=1] The number of elements to drop.
  8198. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8199. * @returns {Array} Returns the slice of `array`.
  8200. * @example
  8201. *
  8202. * _.dropRight([1, 2, 3]);
  8203. * // => [1, 2]
  8204. *
  8205. * _.dropRight([1, 2, 3], 2);
  8206. * // => [1]
  8207. *
  8208. * _.dropRight([1, 2, 3], 5);
  8209. * // => []
  8210. *
  8211. * _.dropRight([1, 2, 3], 0);
  8212. * // => [1, 2, 3]
  8213. */
  8214. function dropRight(array, n, guard) {
  8215. var length = array == null ? 0 : array.length;
  8216. if (!length) {
  8217. return [];
  8218. }
  8219. n = (guard || n === undefined) ? 1 : toInteger(n);
  8220. n = length - n;
  8221. return baseSlice(array, 0, n < 0 ? 0 : n);
  8222. }
  8223. /**
  8224. * Creates a slice of `array` excluding elements dropped from the end.
  8225. * Elements are dropped until `predicate` returns falsey. The predicate is
  8226. * invoked with three arguments: (value, index, array).
  8227. *
  8228. * @static
  8229. * @memberOf _
  8230. * @since 3.0.0
  8231. * @category Array
  8232. * @param {Array} array The array to query.
  8233. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8234. * @returns {Array} Returns the slice of `array`.
  8235. * @example
  8236. *
  8237. * var users = [
  8238. * { 'user': 'barney', 'active': true },
  8239. * { 'user': 'fred', 'active': false },
  8240. * { 'user': 'pebbles', 'active': false }
  8241. * ];
  8242. *
  8243. * _.dropRightWhile(users, function(o) { return !o.active; });
  8244. * // => objects for ['barney']
  8245. *
  8246. * // The `_.matches` iteratee shorthand.
  8247. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  8248. * // => objects for ['barney', 'fred']
  8249. *
  8250. * // The `_.matchesProperty` iteratee shorthand.
  8251. * _.dropRightWhile(users, ['active', false]);
  8252. * // => objects for ['barney']
  8253. *
  8254. * // The `_.property` iteratee shorthand.
  8255. * _.dropRightWhile(users, 'active');
  8256. * // => objects for ['barney', 'fred', 'pebbles']
  8257. */
  8258. function dropRightWhile(array, predicate) {
  8259. return (array && array.length)
  8260. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  8261. : [];
  8262. }
  8263. /**
  8264. * Creates a slice of `array` excluding elements dropped from the beginning.
  8265. * Elements are dropped until `predicate` returns falsey. The predicate is
  8266. * invoked with three arguments: (value, index, array).
  8267. *
  8268. * @static
  8269. * @memberOf _
  8270. * @since 3.0.0
  8271. * @category Array
  8272. * @param {Array} array The array to query.
  8273. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8274. * @returns {Array} Returns the slice of `array`.
  8275. * @example
  8276. *
  8277. * var users = [
  8278. * { 'user': 'barney', 'active': false },
  8279. * { 'user': 'fred', 'active': false },
  8280. * { 'user': 'pebbles', 'active': true }
  8281. * ];
  8282. *
  8283. * _.dropWhile(users, function(o) { return !o.active; });
  8284. * // => objects for ['pebbles']
  8285. *
  8286. * // The `_.matches` iteratee shorthand.
  8287. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  8288. * // => objects for ['fred', 'pebbles']
  8289. *
  8290. * // The `_.matchesProperty` iteratee shorthand.
  8291. * _.dropWhile(users, ['active', false]);
  8292. * // => objects for ['pebbles']
  8293. *
  8294. * // The `_.property` iteratee shorthand.
  8295. * _.dropWhile(users, 'active');
  8296. * // => objects for ['barney', 'fred', 'pebbles']
  8297. */
  8298. function dropWhile(array, predicate) {
  8299. return (array && array.length)
  8300. ? baseWhile(array, getIteratee(predicate, 3), true)
  8301. : [];
  8302. }
  8303. /**
  8304. * Fills elements of `array` with `value` from `start` up to, but not
  8305. * including, `end`.
  8306. *
  8307. * **Note:** This method mutates `array`.
  8308. *
  8309. * @static
  8310. * @memberOf _
  8311. * @since 3.2.0
  8312. * @category Array
  8313. * @param {Array} array The array to fill.
  8314. * @param {*} value The value to fill `array` with.
  8315. * @param {number} [start=0] The start position.
  8316. * @param {number} [end=array.length] The end position.
  8317. * @returns {Array} Returns `array`.
  8318. * @example
  8319. *
  8320. * var array = [1, 2, 3];
  8321. *
  8322. * _.fill(array, 'a');
  8323. * console.log(array);
  8324. * // => ['a', 'a', 'a']
  8325. *
  8326. * _.fill(Array(3), 2);
  8327. * // => [2, 2, 2]
  8328. *
  8329. * _.fill([4, 6, 8, 10], '*', 1, 3);
  8330. * // => [4, '*', '*', 10]
  8331. */
  8332. function fill(array, value, start, end) {
  8333. var length = array == null ? 0 : array.length;
  8334. if (!length) {
  8335. return [];
  8336. }
  8337. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  8338. start = 0;
  8339. end = length;
  8340. }
  8341. return baseFill(array, value, start, end);
  8342. }
  8343. /**
  8344. * This method is like `_.find` except that it returns the index of the first
  8345. * element `predicate` returns truthy for instead of the element itself.
  8346. *
  8347. * @static
  8348. * @memberOf _
  8349. * @since 1.1.0
  8350. * @category Array
  8351. * @param {Array} array The array to inspect.
  8352. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8353. * @param {number} [fromIndex=0] The index to search from.
  8354. * @returns {number} Returns the index of the found element, else `-1`.
  8355. * @example
  8356. *
  8357. * var users = [
  8358. * { 'user': 'barney', 'active': false },
  8359. * { 'user': 'fred', 'active': false },
  8360. * { 'user': 'pebbles', 'active': true }
  8361. * ];
  8362. *
  8363. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  8364. * // => 0
  8365. *
  8366. * // The `_.matches` iteratee shorthand.
  8367. * _.findIndex(users, { 'user': 'fred', 'active': false });
  8368. * // => 1
  8369. *
  8370. * // The `_.matchesProperty` iteratee shorthand.
  8371. * _.findIndex(users, ['active', false]);
  8372. * // => 0
  8373. *
  8374. * // The `_.property` iteratee shorthand.
  8375. * _.findIndex(users, 'active');
  8376. * // => 2
  8377. */
  8378. function findIndex(array, predicate, fromIndex) {
  8379. var length = array == null ? 0 : array.length;
  8380. if (!length) {
  8381. return -1;
  8382. }
  8383. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  8384. if (index < 0) {
  8385. index = nativeMax(length + index, 0);
  8386. }
  8387. return baseFindIndex(array, getIteratee(predicate, 3), index);
  8388. }
  8389. /**
  8390. * This method is like `_.findIndex` except that it iterates over elements
  8391. * of `collection` from right to left.
  8392. *
  8393. * @static
  8394. * @memberOf _
  8395. * @since 2.0.0
  8396. * @category Array
  8397. * @param {Array} array The array to inspect.
  8398. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8399. * @param {number} [fromIndex=array.length-1] The index to search from.
  8400. * @returns {number} Returns the index of the found element, else `-1`.
  8401. * @example
  8402. *
  8403. * var users = [
  8404. * { 'user': 'barney', 'active': true },
  8405. * { 'user': 'fred', 'active': false },
  8406. * { 'user': 'pebbles', 'active': false }
  8407. * ];
  8408. *
  8409. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  8410. * // => 2
  8411. *
  8412. * // The `_.matches` iteratee shorthand.
  8413. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  8414. * // => 0
  8415. *
  8416. * // The `_.matchesProperty` iteratee shorthand.
  8417. * _.findLastIndex(users, ['active', false]);
  8418. * // => 2
  8419. *
  8420. * // The `_.property` iteratee shorthand.
  8421. * _.findLastIndex(users, 'active');
  8422. * // => 0
  8423. */
  8424. function findLastIndex(array, predicate, fromIndex) {
  8425. var length = array == null ? 0 : array.length;
  8426. if (!length) {
  8427. return -1;
  8428. }
  8429. var index = length - 1;
  8430. if (fromIndex !== undefined) {
  8431. index = toInteger(fromIndex);
  8432. index = fromIndex < 0
  8433. ? nativeMax(length + index, 0)
  8434. : nativeMin(index, length - 1);
  8435. }
  8436. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  8437. }
  8438. /**
  8439. * Flattens `array` a single level deep.
  8440. *
  8441. * @static
  8442. * @memberOf _
  8443. * @since 0.1.0
  8444. * @category Array
  8445. * @param {Array} array The array to flatten.
  8446. * @returns {Array} Returns the new flattened array.
  8447. * @example
  8448. *
  8449. * _.flatten([1, [2, [3, [4]], 5]]);
  8450. * // => [1, 2, [3, [4]], 5]
  8451. */
  8452. function flatten(array) {
  8453. var length = array == null ? 0 : array.length;
  8454. return length ? baseFlatten(array, 1) : [];
  8455. }
  8456. /**
  8457. * Recursively flattens `array`.
  8458. *
  8459. * @static
  8460. * @memberOf _
  8461. * @since 3.0.0
  8462. * @category Array
  8463. * @param {Array} array The array to flatten.
  8464. * @returns {Array} Returns the new flattened array.
  8465. * @example
  8466. *
  8467. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  8468. * // => [1, 2, 3, 4, 5]
  8469. */
  8470. function flattenDeep(array) {
  8471. var length = array == null ? 0 : array.length;
  8472. return length ? baseFlatten(array, INFINITY) : [];
  8473. }
  8474. /**
  8475. * Recursively flatten `array` up to `depth` times.
  8476. *
  8477. * @static
  8478. * @memberOf _
  8479. * @since 4.4.0
  8480. * @category Array
  8481. * @param {Array} array The array to flatten.
  8482. * @param {number} [depth=1] The maximum recursion depth.
  8483. * @returns {Array} Returns the new flattened array.
  8484. * @example
  8485. *
  8486. * var array = [1, [2, [3, [4]], 5]];
  8487. *
  8488. * _.flattenDepth(array, 1);
  8489. * // => [1, 2, [3, [4]], 5]
  8490. *
  8491. * _.flattenDepth(array, 2);
  8492. * // => [1, 2, 3, [4], 5]
  8493. */
  8494. function flattenDepth(array, depth) {
  8495. var length = array == null ? 0 : array.length;
  8496. if (!length) {
  8497. return [];
  8498. }
  8499. depth = depth === undefined ? 1 : toInteger(depth);
  8500. return baseFlatten(array, depth);
  8501. }
  8502. /**
  8503. * The inverse of `_.toPairs`; this method returns an object composed
  8504. * from key-value `pairs`.
  8505. *
  8506. * @static
  8507. * @memberOf _
  8508. * @since 4.0.0
  8509. * @category Array
  8510. * @param {Array} pairs The key-value pairs.
  8511. * @returns {Object} Returns the new object.
  8512. * @example
  8513. *
  8514. * _.fromPairs([['a', 1], ['b', 2]]);
  8515. * // => { 'a': 1, 'b': 2 }
  8516. */
  8517. function fromPairs(pairs) {
  8518. var index = -1,
  8519. length = pairs == null ? 0 : pairs.length,
  8520. result = {};
  8521. while (++index < length) {
  8522. var pair = pairs[index];
  8523. result[pair[0]] = pair[1];
  8524. }
  8525. return result;
  8526. }
  8527. /**
  8528. * Gets the first element of `array`.
  8529. *
  8530. * @static
  8531. * @memberOf _
  8532. * @since 0.1.0
  8533. * @alias first
  8534. * @category Array
  8535. * @param {Array} array The array to query.
  8536. * @returns {*} Returns the first element of `array`.
  8537. * @example
  8538. *
  8539. * _.head([1, 2, 3]);
  8540. * // => 1
  8541. *
  8542. * _.head([]);
  8543. * // => undefined
  8544. */
  8545. function head(array) {
  8546. return (array && array.length) ? array[0] : undefined;
  8547. }
  8548. /**
  8549. * Gets the index at which the first occurrence of `value` is found in `array`
  8550. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8551. * for equality comparisons. If `fromIndex` is negative, it's used as the
  8552. * offset from the end of `array`.
  8553. *
  8554. * @static
  8555. * @memberOf _
  8556. * @since 0.1.0
  8557. * @category Array
  8558. * @param {Array} array The array to inspect.
  8559. * @param {*} value The value to search for.
  8560. * @param {number} [fromIndex=0] The index to search from.
  8561. * @returns {number} Returns the index of the matched value, else `-1`.
  8562. * @example
  8563. *
  8564. * _.indexOf([1, 2, 1, 2], 2);
  8565. * // => 1
  8566. *
  8567. * // Search from the `fromIndex`.
  8568. * _.indexOf([1, 2, 1, 2], 2, 2);
  8569. * // => 3
  8570. */
  8571. function indexOf(array, value, fromIndex) {
  8572. var length = array == null ? 0 : array.length;
  8573. if (!length) {
  8574. return -1;
  8575. }
  8576. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  8577. if (index < 0) {
  8578. index = nativeMax(length + index, 0);
  8579. }
  8580. return baseIndexOf(array, value, index);
  8581. }
  8582. /**
  8583. * Gets all but the last element of `array`.
  8584. *
  8585. * @static
  8586. * @memberOf _
  8587. * @since 0.1.0
  8588. * @category Array
  8589. * @param {Array} array The array to query.
  8590. * @returns {Array} Returns the slice of `array`.
  8591. * @example
  8592. *
  8593. * _.initial([1, 2, 3]);
  8594. * // => [1, 2]
  8595. */
  8596. function initial(array) {
  8597. var length = array == null ? 0 : array.length;
  8598. return length ? baseSlice(array, 0, -1) : [];
  8599. }
  8600. /**
  8601. * Creates an array of unique values that are included in all given arrays
  8602. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8603. * for equality comparisons. The order and references of result values are
  8604. * determined by the first array.
  8605. *
  8606. * @static
  8607. * @memberOf _
  8608. * @since 0.1.0
  8609. * @category Array
  8610. * @param {...Array} [arrays] The arrays to inspect.
  8611. * @returns {Array} Returns the new array of intersecting values.
  8612. * @example
  8613. *
  8614. * _.intersection([2, 1], [2, 3]);
  8615. * // => [2]
  8616. */
  8617. var intersection = baseRest(function(arrays) {
  8618. var mapped = arrayMap(arrays, castArrayLikeObject);
  8619. return (mapped.length && mapped[0] === arrays[0])
  8620. ? baseIntersection(mapped)
  8621. : [];
  8622. });
  8623. /**
  8624. * This method is like `_.intersection` except that it accepts `iteratee`
  8625. * which is invoked for each element of each `arrays` to generate the criterion
  8626. * by which they're compared. The order and references of result values are
  8627. * determined by the first array. The iteratee is invoked with one argument:
  8628. * (value).
  8629. *
  8630. * @static
  8631. * @memberOf _
  8632. * @since 4.0.0
  8633. * @category Array
  8634. * @param {...Array} [arrays] The arrays to inspect.
  8635. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8636. * @returns {Array} Returns the new array of intersecting values.
  8637. * @example
  8638. *
  8639. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  8640. * // => [2.1]
  8641. *
  8642. * // The `_.property` iteratee shorthand.
  8643. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  8644. * // => [{ 'x': 1 }]
  8645. */
  8646. var intersectionBy = baseRest(function(arrays) {
  8647. var iteratee = last(arrays),
  8648. mapped = arrayMap(arrays, castArrayLikeObject);
  8649. if (iteratee === last(mapped)) {
  8650. iteratee = undefined;
  8651. } else {
  8652. mapped.pop();
  8653. }
  8654. return (mapped.length && mapped[0] === arrays[0])
  8655. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  8656. : [];
  8657. });
  8658. /**
  8659. * This method is like `_.intersection` except that it accepts `comparator`
  8660. * which is invoked to compare elements of `arrays`. The order and references
  8661. * of result values are determined by the first array. The comparator is
  8662. * invoked with two arguments: (arrVal, othVal).
  8663. *
  8664. * @static
  8665. * @memberOf _
  8666. * @since 4.0.0
  8667. * @category Array
  8668. * @param {...Array} [arrays] The arrays to inspect.
  8669. * @param {Function} [comparator] The comparator invoked per element.
  8670. * @returns {Array} Returns the new array of intersecting values.
  8671. * @example
  8672. *
  8673. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  8674. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  8675. *
  8676. * _.intersectionWith(objects, others, _.isEqual);
  8677. * // => [{ 'x': 1, 'y': 2 }]
  8678. */
  8679. var intersectionWith = baseRest(function(arrays) {
  8680. var comparator = last(arrays),
  8681. mapped = arrayMap(arrays, castArrayLikeObject);
  8682. comparator = typeof comparator == 'function' ? comparator : undefined;
  8683. if (comparator) {
  8684. mapped.pop();
  8685. }
  8686. return (mapped.length && mapped[0] === arrays[0])
  8687. ? baseIntersection(mapped, undefined, comparator)
  8688. : [];
  8689. });
  8690. /**
  8691. * Converts all elements in `array` into a string separated by `separator`.
  8692. *
  8693. * @static
  8694. * @memberOf _
  8695. * @since 4.0.0
  8696. * @category Array
  8697. * @param {Array} array The array to convert.
  8698. * @param {string} [separator=','] The element separator.
  8699. * @returns {string} Returns the joined string.
  8700. * @example
  8701. *
  8702. * _.join(['a', 'b', 'c'], '~');
  8703. * // => 'a~b~c'
  8704. */
  8705. function join(array, separator) {
  8706. return array == null ? '' : nativeJoin.call(array, separator);
  8707. }
  8708. /**
  8709. * Gets the last element of `array`.
  8710. *
  8711. * @static
  8712. * @memberOf _
  8713. * @since 0.1.0
  8714. * @category Array
  8715. * @param {Array} array The array to query.
  8716. * @returns {*} Returns the last element of `array`.
  8717. * @example
  8718. *
  8719. * _.last([1, 2, 3]);
  8720. * // => 3
  8721. */
  8722. function last(array) {
  8723. var length = array == null ? 0 : array.length;
  8724. return length ? array[length - 1] : undefined;
  8725. }
  8726. /**
  8727. * This method is like `_.indexOf` except that it iterates over elements of
  8728. * `array` from right to left.
  8729. *
  8730. * @static
  8731. * @memberOf _
  8732. * @since 0.1.0
  8733. * @category Array
  8734. * @param {Array} array The array to inspect.
  8735. * @param {*} value The value to search for.
  8736. * @param {number} [fromIndex=array.length-1] The index to search from.
  8737. * @returns {number} Returns the index of the matched value, else `-1`.
  8738. * @example
  8739. *
  8740. * _.lastIndexOf([1, 2, 1, 2], 2);
  8741. * // => 3
  8742. *
  8743. * // Search from the `fromIndex`.
  8744. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  8745. * // => 1
  8746. */
  8747. function lastIndexOf(array, value, fromIndex) {
  8748. var length = array == null ? 0 : array.length;
  8749. if (!length) {
  8750. return -1;
  8751. }
  8752. var index = length;
  8753. if (fromIndex !== undefined) {
  8754. index = toInteger(fromIndex);
  8755. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  8756. }
  8757. return value === value
  8758. ? strictLastIndexOf(array, value, index)
  8759. : baseFindIndex(array, baseIsNaN, index, true);
  8760. }
  8761. /**
  8762. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  8763. * element from the end is returned.
  8764. *
  8765. * @static
  8766. * @memberOf _
  8767. * @since 4.11.0
  8768. * @category Array
  8769. * @param {Array} array The array to query.
  8770. * @param {number} [n=0] The index of the element to return.
  8771. * @returns {*} Returns the nth element of `array`.
  8772. * @example
  8773. *
  8774. * var array = ['a', 'b', 'c', 'd'];
  8775. *
  8776. * _.nth(array, 1);
  8777. * // => 'b'
  8778. *
  8779. * _.nth(array, -2);
  8780. * // => 'c';
  8781. */
  8782. function nth(array, n) {
  8783. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  8784. }
  8785. /**
  8786. * Removes all given values from `array` using
  8787. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8788. * for equality comparisons.
  8789. *
  8790. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  8791. * to remove elements from an array by predicate.
  8792. *
  8793. * @static
  8794. * @memberOf _
  8795. * @since 2.0.0
  8796. * @category Array
  8797. * @param {Array} array The array to modify.
  8798. * @param {...*} [values] The values to remove.
  8799. * @returns {Array} Returns `array`.
  8800. * @example
  8801. *
  8802. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  8803. *
  8804. * _.pull(array, 'a', 'c');
  8805. * console.log(array);
  8806. * // => ['b', 'b']
  8807. */
  8808. var pull = baseRest(pullAll);
  8809. /**
  8810. * This method is like `_.pull` except that it accepts an array of values to remove.
  8811. *
  8812. * **Note:** Unlike `_.difference`, this method mutates `array`.
  8813. *
  8814. * @static
  8815. * @memberOf _
  8816. * @since 4.0.0
  8817. * @category Array
  8818. * @param {Array} array The array to modify.
  8819. * @param {Array} values The values to remove.
  8820. * @returns {Array} Returns `array`.
  8821. * @example
  8822. *
  8823. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  8824. *
  8825. * _.pullAll(array, ['a', 'c']);
  8826. * console.log(array);
  8827. * // => ['b', 'b']
  8828. */
  8829. function pullAll(array, values) {
  8830. return (array && array.length && values && values.length)
  8831. ? basePullAll(array, values)
  8832. : array;
  8833. }
  8834. /**
  8835. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  8836. * invoked for each element of `array` and `values` to generate the criterion
  8837. * by which they're compared. The iteratee is invoked with one argument: (value).
  8838. *
  8839. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  8840. *
  8841. * @static
  8842. * @memberOf _
  8843. * @since 4.0.0
  8844. * @category Array
  8845. * @param {Array} array The array to modify.
  8846. * @param {Array} values The values to remove.
  8847. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8848. * @returns {Array} Returns `array`.
  8849. * @example
  8850. *
  8851. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  8852. *
  8853. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  8854. * console.log(array);
  8855. * // => [{ 'x': 2 }]
  8856. */
  8857. function pullAllBy(array, values, iteratee) {
  8858. return (array && array.length && values && values.length)
  8859. ? basePullAll(array, values, getIteratee(iteratee, 2))
  8860. : array;
  8861. }
  8862. /**
  8863. * This method is like `_.pullAll` except that it accepts `comparator` which
  8864. * is invoked to compare elements of `array` to `values`. The comparator is
  8865. * invoked with two arguments: (arrVal, othVal).
  8866. *
  8867. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  8868. *
  8869. * @static
  8870. * @memberOf _
  8871. * @since 4.6.0
  8872. * @category Array
  8873. * @param {Array} array The array to modify.
  8874. * @param {Array} values The values to remove.
  8875. * @param {Function} [comparator] The comparator invoked per element.
  8876. * @returns {Array} Returns `array`.
  8877. * @example
  8878. *
  8879. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  8880. *
  8881. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  8882. * console.log(array);
  8883. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  8884. */
  8885. function pullAllWith(array, values, comparator) {
  8886. return (array && array.length && values && values.length)
  8887. ? basePullAll(array, values, undefined, comparator)
  8888. : array;
  8889. }
  8890. /**
  8891. * Removes elements from `array` corresponding to `indexes` and returns an
  8892. * array of removed elements.
  8893. *
  8894. * **Note:** Unlike `_.at`, this method mutates `array`.
  8895. *
  8896. * @static
  8897. * @memberOf _
  8898. * @since 3.0.0
  8899. * @category Array
  8900. * @param {Array} array The array to modify.
  8901. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  8902. * @returns {Array} Returns the new array of removed elements.
  8903. * @example
  8904. *
  8905. * var array = ['a', 'b', 'c', 'd'];
  8906. * var pulled = _.pullAt(array, [1, 3]);
  8907. *
  8908. * console.log(array);
  8909. * // => ['a', 'c']
  8910. *
  8911. * console.log(pulled);
  8912. * // => ['b', 'd']
  8913. */
  8914. var pullAt = flatRest(function(array, indexes) {
  8915. var length = array == null ? 0 : array.length,
  8916. result = baseAt(array, indexes);
  8917. basePullAt(array, arrayMap(indexes, function(index) {
  8918. return isIndex(index, length) ? +index : index;
  8919. }).sort(compareAscending));
  8920. return result;
  8921. });
  8922. /**
  8923. * Removes all elements from `array` that `predicate` returns truthy for
  8924. * and returns an array of the removed elements. The predicate is invoked
  8925. * with three arguments: (value, index, array).
  8926. *
  8927. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  8928. * to pull elements from an array by value.
  8929. *
  8930. * @static
  8931. * @memberOf _
  8932. * @since 2.0.0
  8933. * @category Array
  8934. * @param {Array} array The array to modify.
  8935. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8936. * @returns {Array} Returns the new array of removed elements.
  8937. * @example
  8938. *
  8939. * var array = [1, 2, 3, 4];
  8940. * var evens = _.remove(array, function(n) {
  8941. * return n % 2 == 0;
  8942. * });
  8943. *
  8944. * console.log(array);
  8945. * // => [1, 3]
  8946. *
  8947. * console.log(evens);
  8948. * // => [2, 4]
  8949. */
  8950. function remove(array, predicate) {
  8951. var result = [];
  8952. if (!(array && array.length)) {
  8953. return result;
  8954. }
  8955. var index = -1,
  8956. indexes = [],
  8957. length = array.length;
  8958. predicate = getIteratee(predicate, 3);
  8959. while (++index < length) {
  8960. var value = array[index];
  8961. if (predicate(value, index, array)) {
  8962. result.push(value);
  8963. indexes.push(index);
  8964. }
  8965. }
  8966. basePullAt(array, indexes);
  8967. return result;
  8968. }
  8969. /**
  8970. * Reverses `array` so that the first element becomes the last, the second
  8971. * element becomes the second to last, and so on.
  8972. *
  8973. * **Note:** This method mutates `array` and is based on
  8974. * [`Array#reverse`](https://mdn.io/Array/reverse).
  8975. *
  8976. * @static
  8977. * @memberOf _
  8978. * @since 4.0.0
  8979. * @category Array
  8980. * @param {Array} array The array to modify.
  8981. * @returns {Array} Returns `array`.
  8982. * @example
  8983. *
  8984. * var array = [1, 2, 3];
  8985. *
  8986. * _.reverse(array);
  8987. * // => [3, 2, 1]
  8988. *
  8989. * console.log(array);
  8990. * // => [3, 2, 1]
  8991. */
  8992. function reverse(array) {
  8993. return array == null ? array : nativeReverse.call(array);
  8994. }
  8995. /**
  8996. * Creates a slice of `array` from `start` up to, but not including, `end`.
  8997. *
  8998. * **Note:** This method is used instead of
  8999. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  9000. * returned.
  9001. *
  9002. * @static
  9003. * @memberOf _
  9004. * @since 3.0.0
  9005. * @category Array
  9006. * @param {Array} array The array to slice.
  9007. * @param {number} [start=0] The start position.
  9008. * @param {number} [end=array.length] The end position.
  9009. * @returns {Array} Returns the slice of `array`.
  9010. */
  9011. function slice(array, start, end) {
  9012. var length = array == null ? 0 : array.length;
  9013. if (!length) {
  9014. return [];
  9015. }
  9016. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  9017. start = 0;
  9018. end = length;
  9019. }
  9020. else {
  9021. start = start == null ? 0 : toInteger(start);
  9022. end = end === undefined ? length : toInteger(end);
  9023. }
  9024. return baseSlice(array, start, end);
  9025. }
  9026. /**
  9027. * Uses a binary search to determine the lowest index at which `value`
  9028. * should be inserted into `array` in order to maintain its sort order.
  9029. *
  9030. * @static
  9031. * @memberOf _
  9032. * @since 0.1.0
  9033. * @category Array
  9034. * @param {Array} array The sorted array to inspect.
  9035. * @param {*} value The value to evaluate.
  9036. * @returns {number} Returns the index at which `value` should be inserted
  9037. * into `array`.
  9038. * @example
  9039. *
  9040. * _.sortedIndex([30, 50], 40);
  9041. * // => 1
  9042. */
  9043. function sortedIndex(array, value) {
  9044. return baseSortedIndex(array, value);
  9045. }
  9046. /**
  9047. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  9048. * which is invoked for `value` and each element of `array` to compute their
  9049. * sort ranking. The iteratee is invoked with one argument: (value).
  9050. *
  9051. * @static
  9052. * @memberOf _
  9053. * @since 4.0.0
  9054. * @category Array
  9055. * @param {Array} array The sorted array to inspect.
  9056. * @param {*} value The value to evaluate.
  9057. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  9058. * @returns {number} Returns the index at which `value` should be inserted
  9059. * into `array`.
  9060. * @example
  9061. *
  9062. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  9063. *
  9064. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  9065. * // => 0
  9066. *
  9067. * // The `_.property` iteratee shorthand.
  9068. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  9069. * // => 0
  9070. */
  9071. function sortedIndexBy(array, value, iteratee) {
  9072. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  9073. }
  9074. /**
  9075. * This method is like `_.indexOf` except that it performs a binary
  9076. * search on a sorted `array`.
  9077. *
  9078. * @static
  9079. * @memberOf _
  9080. * @since 4.0.0
  9081. * @category Array
  9082. * @param {Array} array The array to inspect.
  9083. * @param {*} value The value to search for.
  9084. * @returns {number} Returns the index of the matched value, else `-1`.
  9085. * @example
  9086. *
  9087. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  9088. * // => 1
  9089. */
  9090. function sortedIndexOf(array, value) {
  9091. var length = array == null ? 0 : array.length;
  9092. if (length) {
  9093. var index = baseSortedIndex(array, value);
  9094. if (index < length && eq(array[index], value)) {
  9095. return index;
  9096. }
  9097. }
  9098. return -1;
  9099. }
  9100. /**
  9101. * This method is like `_.sortedIndex` except that it returns the highest
  9102. * index at which `value` should be inserted into `array` in order to
  9103. * maintain its sort order.
  9104. *
  9105. * @static
  9106. * @memberOf _
  9107. * @since 3.0.0
  9108. * @category Array
  9109. * @param {Array} array The sorted array to inspect.
  9110. * @param {*} value The value to evaluate.
  9111. * @returns {number} Returns the index at which `value` should be inserted
  9112. * into `array`.
  9113. * @example
  9114. *
  9115. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  9116. * // => 4
  9117. */
  9118. function sortedLastIndex(array, value) {
  9119. return baseSortedIndex(array, value, true);
  9120. }
  9121. /**
  9122. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  9123. * which is invoked for `value` and each element of `array` to compute their
  9124. * sort ranking. The iteratee is invoked with one argument: (value).
  9125. *
  9126. * @static
  9127. * @memberOf _
  9128. * @since 4.0.0
  9129. * @category Array
  9130. * @param {Array} array The sorted array to inspect.
  9131. * @param {*} value The value to evaluate.
  9132. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  9133. * @returns {number} Returns the index at which `value` should be inserted
  9134. * into `array`.
  9135. * @example
  9136. *
  9137. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  9138. *
  9139. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  9140. * // => 1
  9141. *
  9142. * // The `_.property` iteratee shorthand.
  9143. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  9144. * // => 1
  9145. */
  9146. function sortedLastIndexBy(array, value, iteratee) {
  9147. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  9148. }
  9149. /**
  9150. * This method is like `_.lastIndexOf` except that it performs a binary
  9151. * search on a sorted `array`.
  9152. *
  9153. * @static
  9154. * @memberOf _
  9155. * @since 4.0.0
  9156. * @category Array
  9157. * @param {Array} array The array to inspect.
  9158. * @param {*} value The value to search for.
  9159. * @returns {number} Returns the index of the matched value, else `-1`.
  9160. * @example
  9161. *
  9162. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  9163. * // => 3
  9164. */
  9165. function sortedLastIndexOf(array, value) {
  9166. var length = array == null ? 0 : array.length;
  9167. if (length) {
  9168. var index = baseSortedIndex(array, value, true) - 1;
  9169. if (eq(array[index], value)) {
  9170. return index;
  9171. }
  9172. }
  9173. return -1;
  9174. }
  9175. /**
  9176. * This method is like `_.uniq` except that it's designed and optimized
  9177. * for sorted arrays.
  9178. *
  9179. * @static
  9180. * @memberOf _
  9181. * @since 4.0.0
  9182. * @category Array
  9183. * @param {Array} array The array to inspect.
  9184. * @returns {Array} Returns the new duplicate free array.
  9185. * @example
  9186. *
  9187. * _.sortedUniq([1, 1, 2]);
  9188. * // => [1, 2]
  9189. */
  9190. function sortedUniq(array) {
  9191. return (array && array.length)
  9192. ? baseSortedUniq(array)
  9193. : [];
  9194. }
  9195. /**
  9196. * This method is like `_.uniqBy` except that it's designed and optimized
  9197. * for sorted arrays.
  9198. *
  9199. * @static
  9200. * @memberOf _
  9201. * @since 4.0.0
  9202. * @category Array
  9203. * @param {Array} array The array to inspect.
  9204. * @param {Function} [iteratee] The iteratee invoked per element.
  9205. * @returns {Array} Returns the new duplicate free array.
  9206. * @example
  9207. *
  9208. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  9209. * // => [1.1, 2.3]
  9210. */
  9211. function sortedUniqBy(array, iteratee) {
  9212. return (array && array.length)
  9213. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  9214. : [];
  9215. }
  9216. /**
  9217. * Gets all but the first element of `array`.
  9218. *
  9219. * @static
  9220. * @memberOf _
  9221. * @since 4.0.0
  9222. * @category Array
  9223. * @param {Array} array The array to query.
  9224. * @returns {Array} Returns the slice of `array`.
  9225. * @example
  9226. *
  9227. * _.tail([1, 2, 3]);
  9228. * // => [2, 3]
  9229. */
  9230. function tail(array) {
  9231. var length = array == null ? 0 : array.length;
  9232. return length ? baseSlice(array, 1, length) : [];
  9233. }
  9234. /**
  9235. * Creates a slice of `array` with `n` elements taken from the beginning.
  9236. *
  9237. * @static
  9238. * @memberOf _
  9239. * @since 0.1.0
  9240. * @category Array
  9241. * @param {Array} array The array to query.
  9242. * @param {number} [n=1] The number of elements to take.
  9243. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  9244. * @returns {Array} Returns the slice of `array`.
  9245. * @example
  9246. *
  9247. * _.take([1, 2, 3]);
  9248. * // => [1]
  9249. *
  9250. * _.take([1, 2, 3], 2);
  9251. * // => [1, 2]
  9252. *
  9253. * _.take([1, 2, 3], 5);
  9254. * // => [1, 2, 3]
  9255. *
  9256. * _.take([1, 2, 3], 0);
  9257. * // => []
  9258. */
  9259. function take(array, n, guard) {
  9260. if (!(array && array.length)) {
  9261. return [];
  9262. }
  9263. n = (guard || n === undefined) ? 1 : toInteger(n);
  9264. return baseSlice(array, 0, n < 0 ? 0 : n);
  9265. }
  9266. /**
  9267. * Creates a slice of `array` with `n` elements taken from the end.
  9268. *
  9269. * @static
  9270. * @memberOf _
  9271. * @since 3.0.0
  9272. * @category Array
  9273. * @param {Array} array The array to query.
  9274. * @param {number} [n=1] The number of elements to take.
  9275. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  9276. * @returns {Array} Returns the slice of `array`.
  9277. * @example
  9278. *
  9279. * _.takeRight([1, 2, 3]);
  9280. * // => [3]
  9281. *
  9282. * _.takeRight([1, 2, 3], 2);
  9283. * // => [2, 3]
  9284. *
  9285. * _.takeRight([1, 2, 3], 5);
  9286. * // => [1, 2, 3]
  9287. *
  9288. * _.takeRight([1, 2, 3], 0);
  9289. * // => []
  9290. */
  9291. function takeRight(array, n, guard) {
  9292. var length = array == null ? 0 : array.length;
  9293. if (!length) {
  9294. return [];
  9295. }
  9296. n = (guard || n === undefined) ? 1 : toInteger(n);
  9297. n = length - n;
  9298. return baseSlice(array, n < 0 ? 0 : n, length);
  9299. }
  9300. /**
  9301. * Creates a slice of `array` with elements taken from the end. Elements are
  9302. * taken until `predicate` returns falsey. The predicate is invoked with
  9303. * three arguments: (value, index, array).
  9304. *
  9305. * @static
  9306. * @memberOf _
  9307. * @since 3.0.0
  9308. * @category Array
  9309. * @param {Array} array The array to query.
  9310. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9311. * @returns {Array} Returns the slice of `array`.
  9312. * @example
  9313. *
  9314. * var users = [
  9315. * { 'user': 'barney', 'active': true },
  9316. * { 'user': 'fred', 'active': false },
  9317. * { 'user': 'pebbles', 'active': false }
  9318. * ];
  9319. *
  9320. * _.takeRightWhile(users, function(o) { return !o.active; });
  9321. * // => objects for ['fred', 'pebbles']
  9322. *
  9323. * // The `_.matches` iteratee shorthand.
  9324. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  9325. * // => objects for ['pebbles']
  9326. *
  9327. * // The `_.matchesProperty` iteratee shorthand.
  9328. * _.takeRightWhile(users, ['active', false]);
  9329. * // => objects for ['fred', 'pebbles']
  9330. *
  9331. * // The `_.property` iteratee shorthand.
  9332. * _.takeRightWhile(users, 'active');
  9333. * // => []
  9334. */
  9335. function takeRightWhile(array, predicate) {
  9336. return (array && array.length)
  9337. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  9338. : [];
  9339. }
  9340. /**
  9341. * Creates a slice of `array` with elements taken from the beginning. Elements
  9342. * are taken until `predicate` returns falsey. The predicate is invoked with
  9343. * three arguments: (value, index, array).
  9344. *
  9345. * @static
  9346. * @memberOf _
  9347. * @since 3.0.0
  9348. * @category Array
  9349. * @param {Array} array The array to query.
  9350. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9351. * @returns {Array} Returns the slice of `array`.
  9352. * @example
  9353. *
  9354. * var users = [
  9355. * { 'user': 'barney', 'active': false },
  9356. * { 'user': 'fred', 'active': false },
  9357. * { 'user': 'pebbles', 'active': true }
  9358. * ];
  9359. *
  9360. * _.takeWhile(users, function(o) { return !o.active; });
  9361. * // => objects for ['barney', 'fred']
  9362. *
  9363. * // The `_.matches` iteratee shorthand.
  9364. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  9365. * // => objects for ['barney']
  9366. *
  9367. * // The `_.matchesProperty` iteratee shorthand.
  9368. * _.takeWhile(users, ['active', false]);
  9369. * // => objects for ['barney', 'fred']
  9370. *
  9371. * // The `_.property` iteratee shorthand.
  9372. * _.takeWhile(users, 'active');
  9373. * // => []
  9374. */
  9375. function takeWhile(array, predicate) {
  9376. return (array && array.length)
  9377. ? baseWhile(array, getIteratee(predicate, 3))
  9378. : [];
  9379. }
  9380. /**
  9381. * Creates an array of unique values, in order, from all given arrays using
  9382. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  9383. * for equality comparisons.
  9384. *
  9385. * @static
  9386. * @memberOf _
  9387. * @since 0.1.0
  9388. * @category Array
  9389. * @param {...Array} [arrays] The arrays to inspect.
  9390. * @returns {Array} Returns the new array of combined values.
  9391. * @example
  9392. *
  9393. * _.union([2], [1, 2]);
  9394. * // => [2, 1]
  9395. */
  9396. var union = baseRest(function(arrays) {
  9397. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  9398. });
  9399. /**
  9400. * This method is like `_.union` except that it accepts `iteratee` which is
  9401. * invoked for each element of each `arrays` to generate the criterion by
  9402. * which uniqueness is computed. Result values are chosen from the first
  9403. * array in which the value occurs. The iteratee is invoked with one argument:
  9404. * (value).
  9405. *
  9406. * @static
  9407. * @memberOf _
  9408. * @since 4.0.0
  9409. * @category Array
  9410. * @param {...Array} [arrays] The arrays to inspect.
  9411. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  9412. * @returns {Array} Returns the new array of combined values.
  9413. * @example
  9414. *
  9415. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  9416. * // => [2.1, 1.2]
  9417. *
  9418. * // The `_.property` iteratee shorthand.
  9419. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  9420. * // => [{ 'x': 1 }, { 'x': 2 }]
  9421. */
  9422. var unionBy = baseRest(function(arrays) {
  9423. var iteratee = last(arrays);
  9424. if (isArrayLikeObject(iteratee)) {
  9425. iteratee = undefined;
  9426. }
  9427. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  9428. });
  9429. /**
  9430. * This method is like `_.union` except that it accepts `comparator` which
  9431. * is invoked to compare elements of `arrays`. Result values are chosen from
  9432. * the first array in which the value occurs. The comparator is invoked
  9433. * with two arguments: (arrVal, othVal).
  9434. *
  9435. * @static
  9436. * @memberOf _
  9437. * @since 4.0.0
  9438. * @category Array
  9439. * @param {...Array} [arrays] The arrays to inspect.
  9440. * @param {Function} [comparator] The comparator invoked per element.
  9441. * @returns {Array} Returns the new array of combined values.
  9442. * @example
  9443. *
  9444. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  9445. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  9446. *
  9447. * _.unionWith(objects, others, _.isEqual);
  9448. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  9449. */
  9450. var unionWith = baseRest(function(arrays) {
  9451. var comparator = last(arrays);
  9452. comparator = typeof comparator == 'function' ? comparator : undefined;
  9453. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  9454. });
  9455. /**
  9456. * Creates a duplicate-free version of an array, using
  9457. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  9458. * for equality comparisons, in which only the first occurrence of each element
  9459. * is kept. The order of result values is determined by the order they occur
  9460. * in the array.
  9461. *
  9462. * @static
  9463. * @memberOf _
  9464. * @since 0.1.0
  9465. * @category Array
  9466. * @param {Array} array The array to inspect.
  9467. * @returns {Array} Returns the new duplicate free array.
  9468. * @example
  9469. *
  9470. * _.uniq([2, 1, 2]);
  9471. * // => [2, 1]
  9472. */
  9473. function uniq(array) {
  9474. return (array && array.length) ? baseUniq(array) : [];
  9475. }
  9476. /**
  9477. * This method is like `_.uniq` except that it accepts `iteratee` which is
  9478. * invoked for each element in `array` to generate the criterion by which
  9479. * uniqueness is computed. The order of result values is determined by the
  9480. * order they occur in the array. The iteratee is invoked with one argument:
  9481. * (value).
  9482. *
  9483. * @static
  9484. * @memberOf _
  9485. * @since 4.0.0
  9486. * @category Array
  9487. * @param {Array} array The array to inspect.
  9488. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  9489. * @returns {Array} Returns the new duplicate free array.
  9490. * @example
  9491. *
  9492. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  9493. * // => [2.1, 1.2]
  9494. *
  9495. * // The `_.property` iteratee shorthand.
  9496. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  9497. * // => [{ 'x': 1 }, { 'x': 2 }]
  9498. */
  9499. function uniqBy(array, iteratee) {
  9500. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  9501. }
  9502. /**
  9503. * This method is like `_.uniq` except that it accepts `comparator` which
  9504. * is invoked to compare elements of `array`. The order of result values is
  9505. * determined by the order they occur in the array.The comparator is invoked
  9506. * with two arguments: (arrVal, othVal).
  9507. *
  9508. * @static
  9509. * @memberOf _
  9510. * @since 4.0.0
  9511. * @category Array
  9512. * @param {Array} array The array to inspect.
  9513. * @param {Function} [comparator] The comparator invoked per element.
  9514. * @returns {Array} Returns the new duplicate free array.
  9515. * @example
  9516. *
  9517. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  9518. *
  9519. * _.uniqWith(objects, _.isEqual);
  9520. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  9521. */
  9522. function uniqWith(array, comparator) {
  9523. comparator = typeof comparator == 'function' ? comparator : undefined;
  9524. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  9525. }
  9526. /**
  9527. * This method is like `_.zip` except that it accepts an array of grouped
  9528. * elements and creates an array regrouping the elements to their pre-zip
  9529. * configuration.
  9530. *
  9531. * @static
  9532. * @memberOf _
  9533. * @since 1.2.0
  9534. * @category Array
  9535. * @param {Array} array The array of grouped elements to process.
  9536. * @returns {Array} Returns the new array of regrouped elements.
  9537. * @example
  9538. *
  9539. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  9540. * // => [['a', 1, true], ['b', 2, false]]
  9541. *
  9542. * _.unzip(zipped);
  9543. * // => [['a', 'b'], [1, 2], [true, false]]
  9544. */
  9545. function unzip(array) {
  9546. if (!(array && array.length)) {
  9547. return [];
  9548. }
  9549. var length = 0;
  9550. array = arrayFilter(array, function(group) {
  9551. if (isArrayLikeObject(group)) {
  9552. length = nativeMax(group.length, length);
  9553. return true;
  9554. }
  9555. });
  9556. return baseTimes(length, function(index) {
  9557. return arrayMap(array, baseProperty(index));
  9558. });
  9559. }
  9560. /**
  9561. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  9562. * how regrouped values should be combined. The iteratee is invoked with the
  9563. * elements of each group: (...group).
  9564. *
  9565. * @static
  9566. * @memberOf _
  9567. * @since 3.8.0
  9568. * @category Array
  9569. * @param {Array} array The array of grouped elements to process.
  9570. * @param {Function} [iteratee=_.identity] The function to combine
  9571. * regrouped values.
  9572. * @returns {Array} Returns the new array of regrouped elements.
  9573. * @example
  9574. *
  9575. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  9576. * // => [[1, 10, 100], [2, 20, 200]]
  9577. *
  9578. * _.unzipWith(zipped, _.add);
  9579. * // => [3, 30, 300]
  9580. */
  9581. function unzipWith(array, iteratee) {
  9582. if (!(array && array.length)) {
  9583. return [];
  9584. }
  9585. var result = unzip(array);
  9586. if (iteratee == null) {
  9587. return result;
  9588. }
  9589. return arrayMap(result, function(group) {
  9590. return apply(iteratee, undefined, group);
  9591. });
  9592. }
  9593. /**
  9594. * Creates an array excluding all given values using
  9595. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  9596. * for equality comparisons.
  9597. *
  9598. * **Note:** Unlike `_.pull`, this method returns a new array.
  9599. *
  9600. * @static
  9601. * @memberOf _
  9602. * @since 0.1.0
  9603. * @category Array
  9604. * @param {Array} array The array to inspect.
  9605. * @param {...*} [values] The values to exclude.
  9606. * @returns {Array} Returns the new array of filtered values.
  9607. * @see _.difference, _.xor
  9608. * @example
  9609. *
  9610. * _.without([2, 1, 2, 3], 1, 2);
  9611. * // => [3]
  9612. */
  9613. var without = baseRest(function(array, values) {
  9614. return isArrayLikeObject(array)
  9615. ? baseDifference(array, values)
  9616. : [];
  9617. });
  9618. /**
  9619. * Creates an array of unique values that is the
  9620. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  9621. * of the given arrays. The order of result values is determined by the order
  9622. * they occur in the arrays.
  9623. *
  9624. * @static
  9625. * @memberOf _
  9626. * @since 2.4.0
  9627. * @category Array
  9628. * @param {...Array} [arrays] The arrays to inspect.
  9629. * @returns {Array} Returns the new array of filtered values.
  9630. * @see _.difference, _.without
  9631. * @example
  9632. *
  9633. * _.xor([2, 1], [2, 3]);
  9634. * // => [1, 3]
  9635. */
  9636. var xor = baseRest(function(arrays) {
  9637. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  9638. });
  9639. /**
  9640. * This method is like `_.xor` except that it accepts `iteratee` which is
  9641. * invoked for each element of each `arrays` to generate the criterion by
  9642. * which by which they're compared. The order of result values is determined
  9643. * by the order they occur in the arrays. The iteratee is invoked with one
  9644. * argument: (value).
  9645. *
  9646. * @static
  9647. * @memberOf _
  9648. * @since 4.0.0
  9649. * @category Array
  9650. * @param {...Array} [arrays] The arrays to inspect.
  9651. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  9652. * @returns {Array} Returns the new array of filtered values.
  9653. * @example
  9654. *
  9655. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  9656. * // => [1.2, 3.4]
  9657. *
  9658. * // The `_.property` iteratee shorthand.
  9659. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  9660. * // => [{ 'x': 2 }]
  9661. */
  9662. var xorBy = baseRest(function(arrays) {
  9663. var iteratee = last(arrays);
  9664. if (isArrayLikeObject(iteratee)) {
  9665. iteratee = undefined;
  9666. }
  9667. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  9668. });
  9669. /**
  9670. * This method is like `_.xor` except that it accepts `comparator` which is
  9671. * invoked to compare elements of `arrays`. The order of result values is
  9672. * determined by the order they occur in the arrays. The comparator is invoked
  9673. * with two arguments: (arrVal, othVal).
  9674. *
  9675. * @static
  9676. * @memberOf _
  9677. * @since 4.0.0
  9678. * @category Array
  9679. * @param {...Array} [arrays] The arrays to inspect.
  9680. * @param {Function} [comparator] The comparator invoked per element.
  9681. * @returns {Array} Returns the new array of filtered values.
  9682. * @example
  9683. *
  9684. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  9685. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  9686. *
  9687. * _.xorWith(objects, others, _.isEqual);
  9688. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  9689. */
  9690. var xorWith = baseRest(function(arrays) {
  9691. var comparator = last(arrays);
  9692. comparator = typeof comparator == 'function' ? comparator : undefined;
  9693. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  9694. });
  9695. /**
  9696. * Creates an array of grouped elements, the first of which contains the
  9697. * first elements of the given arrays, the second of which contains the
  9698. * second elements of the given arrays, and so on.
  9699. *
  9700. * @static
  9701. * @memberOf _
  9702. * @since 0.1.0
  9703. * @category Array
  9704. * @param {...Array} [arrays] The arrays to process.
  9705. * @returns {Array} Returns the new array of grouped elements.
  9706. * @example
  9707. *
  9708. * _.zip(['a', 'b'], [1, 2], [true, false]);
  9709. * // => [['a', 1, true], ['b', 2, false]]
  9710. */
  9711. var zip = baseRest(unzip);
  9712. /**
  9713. * This method is like `_.fromPairs` except that it accepts two arrays,
  9714. * one of property identifiers and one of corresponding values.
  9715. *
  9716. * @static
  9717. * @memberOf _
  9718. * @since 0.4.0
  9719. * @category Array
  9720. * @param {Array} [props=[]] The property identifiers.
  9721. * @param {Array} [values=[]] The property values.
  9722. * @returns {Object} Returns the new object.
  9723. * @example
  9724. *
  9725. * _.zipObject(['a', 'b'], [1, 2]);
  9726. * // => { 'a': 1, 'b': 2 }
  9727. */
  9728. function zipObject(props, values) {
  9729. return baseZipObject(props || [], values || [], assignValue);
  9730. }
  9731. /**
  9732. * This method is like `_.zipObject` except that it supports property paths.
  9733. *
  9734. * @static
  9735. * @memberOf _
  9736. * @since 4.1.0
  9737. * @category Array
  9738. * @param {Array} [props=[]] The property identifiers.
  9739. * @param {Array} [values=[]] The property values.
  9740. * @returns {Object} Returns the new object.
  9741. * @example
  9742. *
  9743. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  9744. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  9745. */
  9746. function zipObjectDeep(props, values) {
  9747. return baseZipObject(props || [], values || [], baseSet);
  9748. }
  9749. /**
  9750. * This method is like `_.zip` except that it accepts `iteratee` to specify
  9751. * how grouped values should be combined. The iteratee is invoked with the
  9752. * elements of each group: (...group).
  9753. *
  9754. * @static
  9755. * @memberOf _
  9756. * @since 3.8.0
  9757. * @category Array
  9758. * @param {...Array} [arrays] The arrays to process.
  9759. * @param {Function} [iteratee=_.identity] The function to combine
  9760. * grouped values.
  9761. * @returns {Array} Returns the new array of grouped elements.
  9762. * @example
  9763. *
  9764. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  9765. * return a + b + c;
  9766. * });
  9767. * // => [111, 222]
  9768. */
  9769. var zipWith = baseRest(function(arrays) {
  9770. var length = arrays.length,
  9771. iteratee = length > 1 ? arrays[length - 1] : undefined;
  9772. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  9773. return unzipWith(arrays, iteratee);
  9774. });
  9775. /*------------------------------------------------------------------------*/
  9776. /**
  9777. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  9778. * chain sequences enabled. The result of such sequences must be unwrapped
  9779. * with `_#value`.
  9780. *
  9781. * @static
  9782. * @memberOf _
  9783. * @since 1.3.0
  9784. * @category Seq
  9785. * @param {*} value The value to wrap.
  9786. * @returns {Object} Returns the new `lodash` wrapper instance.
  9787. * @example
  9788. *
  9789. * var users = [
  9790. * { 'user': 'barney', 'age': 36 },
  9791. * { 'user': 'fred', 'age': 40 },
  9792. * { 'user': 'pebbles', 'age': 1 }
  9793. * ];
  9794. *
  9795. * var youngest = _
  9796. * .chain(users)
  9797. * .sortBy('age')
  9798. * .map(function(o) {
  9799. * return o.user + ' is ' + o.age;
  9800. * })
  9801. * .head()
  9802. * .value();
  9803. * // => 'pebbles is 1'
  9804. */
  9805. function chain(value) {
  9806. var result = lodash(value);
  9807. result.__chain__ = true;
  9808. return result;
  9809. }
  9810. /**
  9811. * This method invokes `interceptor` and returns `value`. The interceptor
  9812. * is invoked with one argument; (value). The purpose of this method is to
  9813. * "tap into" a method chain sequence in order to modify intermediate results.
  9814. *
  9815. * @static
  9816. * @memberOf _
  9817. * @since 0.1.0
  9818. * @category Seq
  9819. * @param {*} value The value to provide to `interceptor`.
  9820. * @param {Function} interceptor The function to invoke.
  9821. * @returns {*} Returns `value`.
  9822. * @example
  9823. *
  9824. * _([1, 2, 3])
  9825. * .tap(function(array) {
  9826. * // Mutate input array.
  9827. * array.pop();
  9828. * })
  9829. * .reverse()
  9830. * .value();
  9831. * // => [2, 1]
  9832. */
  9833. function tap(value, interceptor) {
  9834. interceptor(value);
  9835. return value;
  9836. }
  9837. /**
  9838. * This method is like `_.tap` except that it returns the result of `interceptor`.
  9839. * The purpose of this method is to "pass thru" values replacing intermediate
  9840. * results in a method chain sequence.
  9841. *
  9842. * @static
  9843. * @memberOf _
  9844. * @since 3.0.0
  9845. * @category Seq
  9846. * @param {*} value The value to provide to `interceptor`.
  9847. * @param {Function} interceptor The function to invoke.
  9848. * @returns {*} Returns the result of `interceptor`.
  9849. * @example
  9850. *
  9851. * _(' abc ')
  9852. * .chain()
  9853. * .trim()
  9854. * .thru(function(value) {
  9855. * return [value];
  9856. * })
  9857. * .value();
  9858. * // => ['abc']
  9859. */
  9860. function thru(value, interceptor) {
  9861. return interceptor(value);
  9862. }
  9863. /**
  9864. * This method is the wrapper version of `_.at`.
  9865. *
  9866. * @name at
  9867. * @memberOf _
  9868. * @since 1.0.0
  9869. * @category Seq
  9870. * @param {...(string|string[])} [paths] The property paths to pick.
  9871. * @returns {Object} Returns the new `lodash` wrapper instance.
  9872. * @example
  9873. *
  9874. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  9875. *
  9876. * _(object).at(['a[0].b.c', 'a[1]']).value();
  9877. * // => [3, 4]
  9878. */
  9879. var wrapperAt = flatRest(function(paths) {
  9880. var length = paths.length,
  9881. start = length ? paths[0] : 0,
  9882. value = this.__wrapped__,
  9883. interceptor = function(object) { return baseAt(object, paths); };
  9884. if (length > 1 || this.__actions__.length ||
  9885. !(value instanceof LazyWrapper) || !isIndex(start)) {
  9886. return this.thru(interceptor);
  9887. }
  9888. value = value.slice(start, +start + (length ? 1 : 0));
  9889. value.__actions__.push({
  9890. 'func': thru,
  9891. 'args': [interceptor],
  9892. 'thisArg': undefined
  9893. });
  9894. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  9895. if (length && !array.length) {
  9896. array.push(undefined);
  9897. }
  9898. return array;
  9899. });
  9900. });
  9901. /**
  9902. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  9903. *
  9904. * @name chain
  9905. * @memberOf _
  9906. * @since 0.1.0
  9907. * @category Seq
  9908. * @returns {Object} Returns the new `lodash` wrapper instance.
  9909. * @example
  9910. *
  9911. * var users = [
  9912. * { 'user': 'barney', 'age': 36 },
  9913. * { 'user': 'fred', 'age': 40 }
  9914. * ];
  9915. *
  9916. * // A sequence without explicit chaining.
  9917. * _(users).head();
  9918. * // => { 'user': 'barney', 'age': 36 }
  9919. *
  9920. * // A sequence with explicit chaining.
  9921. * _(users)
  9922. * .chain()
  9923. * .head()
  9924. * .pick('user')
  9925. * .value();
  9926. * // => { 'user': 'barney' }
  9927. */
  9928. function wrapperChain() {
  9929. return chain(this);
  9930. }
  9931. /**
  9932. * Executes the chain sequence and returns the wrapped result.
  9933. *
  9934. * @name commit
  9935. * @memberOf _
  9936. * @since 3.2.0
  9937. * @category Seq
  9938. * @returns {Object} Returns the new `lodash` wrapper instance.
  9939. * @example
  9940. *
  9941. * var array = [1, 2];
  9942. * var wrapped = _(array).push(3);
  9943. *
  9944. * console.log(array);
  9945. * // => [1, 2]
  9946. *
  9947. * wrapped = wrapped.commit();
  9948. * console.log(array);
  9949. * // => [1, 2, 3]
  9950. *
  9951. * wrapped.last();
  9952. * // => 3
  9953. *
  9954. * console.log(array);
  9955. * // => [1, 2, 3]
  9956. */
  9957. function wrapperCommit() {
  9958. return new LodashWrapper(this.value(), this.__chain__);
  9959. }
  9960. /**
  9961. * Gets the next value on a wrapped object following the
  9962. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  9963. *
  9964. * @name next
  9965. * @memberOf _
  9966. * @since 4.0.0
  9967. * @category Seq
  9968. * @returns {Object} Returns the next iterator value.
  9969. * @example
  9970. *
  9971. * var wrapped = _([1, 2]);
  9972. *
  9973. * wrapped.next();
  9974. * // => { 'done': false, 'value': 1 }
  9975. *
  9976. * wrapped.next();
  9977. * // => { 'done': false, 'value': 2 }
  9978. *
  9979. * wrapped.next();
  9980. * // => { 'done': true, 'value': undefined }
  9981. */
  9982. function wrapperNext() {
  9983. if (this.__values__ === undefined) {
  9984. this.__values__ = toArray(this.value());
  9985. }
  9986. var done = this.__index__ >= this.__values__.length,
  9987. value = done ? undefined : this.__values__[this.__index__++];
  9988. return { 'done': done, 'value': value };
  9989. }
  9990. /**
  9991. * Enables the wrapper to be iterable.
  9992. *
  9993. * @name Symbol.iterator
  9994. * @memberOf _
  9995. * @since 4.0.0
  9996. * @category Seq
  9997. * @returns {Object} Returns the wrapper object.
  9998. * @example
  9999. *
  10000. * var wrapped = _([1, 2]);
  10001. *
  10002. * wrapped[Symbol.iterator]() === wrapped;
  10003. * // => true
  10004. *
  10005. * Array.from(wrapped);
  10006. * // => [1, 2]
  10007. */
  10008. function wrapperToIterator() {
  10009. return this;
  10010. }
  10011. /**
  10012. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  10013. *
  10014. * @name plant
  10015. * @memberOf _
  10016. * @since 3.2.0
  10017. * @category Seq
  10018. * @param {*} value The value to plant.
  10019. * @returns {Object} Returns the new `lodash` wrapper instance.
  10020. * @example
  10021. *
  10022. * function square(n) {
  10023. * return n * n;
  10024. * }
  10025. *
  10026. * var wrapped = _([1, 2]).map(square);
  10027. * var other = wrapped.plant([3, 4]);
  10028. *
  10029. * other.value();
  10030. * // => [9, 16]
  10031. *
  10032. * wrapped.value();
  10033. * // => [1, 4]
  10034. */
  10035. function wrapperPlant(value) {
  10036. var result,
  10037. parent = this;
  10038. while (parent instanceof baseLodash) {
  10039. var clone = wrapperClone(parent);
  10040. clone.__index__ = 0;
  10041. clone.__values__ = undefined;
  10042. if (result) {
  10043. previous.__wrapped__ = clone;
  10044. } else {
  10045. result = clone;
  10046. }
  10047. var previous = clone;
  10048. parent = parent.__wrapped__;
  10049. }
  10050. previous.__wrapped__ = value;
  10051. return result;
  10052. }
  10053. /**
  10054. * This method is the wrapper version of `_.reverse`.
  10055. *
  10056. * **Note:** This method mutates the wrapped array.
  10057. *
  10058. * @name reverse
  10059. * @memberOf _
  10060. * @since 0.1.0
  10061. * @category Seq
  10062. * @returns {Object} Returns the new `lodash` wrapper instance.
  10063. * @example
  10064. *
  10065. * var array = [1, 2, 3];
  10066. *
  10067. * _(array).reverse().value()
  10068. * // => [3, 2, 1]
  10069. *
  10070. * console.log(array);
  10071. * // => [3, 2, 1]
  10072. */
  10073. function wrapperReverse() {
  10074. var value = this.__wrapped__;
  10075. if (value instanceof LazyWrapper) {
  10076. var wrapped = value;
  10077. if (this.__actions__.length) {
  10078. wrapped = new LazyWrapper(this);
  10079. }
  10080. wrapped = wrapped.reverse();
  10081. wrapped.__actions__.push({
  10082. 'func': thru,
  10083. 'args': [reverse],
  10084. 'thisArg': undefined
  10085. });
  10086. return new LodashWrapper(wrapped, this.__chain__);
  10087. }
  10088. return this.thru(reverse);
  10089. }
  10090. /**
  10091. * Executes the chain sequence to resolve the unwrapped value.
  10092. *
  10093. * @name value
  10094. * @memberOf _
  10095. * @since 0.1.0
  10096. * @alias toJSON, valueOf
  10097. * @category Seq
  10098. * @returns {*} Returns the resolved unwrapped value.
  10099. * @example
  10100. *
  10101. * _([1, 2, 3]).value();
  10102. * // => [1, 2, 3]
  10103. */
  10104. function wrapperValue() {
  10105. return baseWrapperValue(this.__wrapped__, this.__actions__);
  10106. }
  10107. /*------------------------------------------------------------------------*/
  10108. /**
  10109. * Creates an object composed of keys generated from the results of running
  10110. * each element of `collection` thru `iteratee`. The corresponding value of
  10111. * each key is the number of times the key was returned by `iteratee`. The
  10112. * iteratee is invoked with one argument: (value).
  10113. *
  10114. * @static
  10115. * @memberOf _
  10116. * @since 0.5.0
  10117. * @category Collection
  10118. * @param {Array|Object} collection The collection to iterate over.
  10119. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  10120. * @returns {Object} Returns the composed aggregate object.
  10121. * @example
  10122. *
  10123. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  10124. * // => { '4': 1, '6': 2 }
  10125. *
  10126. * // The `_.property` iteratee shorthand.
  10127. * _.countBy(['one', 'two', 'three'], 'length');
  10128. * // => { '3': 2, '5': 1 }
  10129. */
  10130. var countBy = createAggregator(function(result, value, key) {
  10131. if (hasOwnProperty.call(result, key)) {
  10132. ++result[key];
  10133. } else {
  10134. baseAssignValue(result, key, 1);
  10135. }
  10136. });
  10137. /**
  10138. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  10139. * Iteration is stopped once `predicate` returns falsey. The predicate is
  10140. * invoked with three arguments: (value, index|key, collection).
  10141. *
  10142. * **Note:** This method returns `true` for
  10143. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  10144. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  10145. * elements of empty collections.
  10146. *
  10147. * @static
  10148. * @memberOf _
  10149. * @since 0.1.0
  10150. * @category Collection
  10151. * @param {Array|Object} collection The collection to iterate over.
  10152. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  10153. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10154. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  10155. * else `false`.
  10156. * @example
  10157. *
  10158. * _.every([true, 1, null, 'yes'], Boolean);
  10159. * // => false
  10160. *
  10161. * var users = [
  10162. * { 'user': 'barney', 'age': 36, 'active': false },
  10163. * { 'user': 'fred', 'age': 40, 'active': false }
  10164. * ];
  10165. *
  10166. * // The `_.matches` iteratee shorthand.
  10167. * _.every(users, { 'user': 'barney', 'active': false });
  10168. * // => false
  10169. *
  10170. * // The `_.matchesProperty` iteratee shorthand.
  10171. * _.every(users, ['active', false]);
  10172. * // => true
  10173. *
  10174. * // The `_.property` iteratee shorthand.
  10175. * _.every(users, 'active');
  10176. * // => false
  10177. */
  10178. function every(collection, predicate, guard) {
  10179. var func = isArray(collection) ? arrayEvery : baseEvery;
  10180. if (guard && isIterateeCall(collection, predicate, guard)) {
  10181. predicate = undefined;
  10182. }
  10183. return func(collection, getIteratee(predicate, 3));
  10184. }
  10185. /**
  10186. * Iterates over elements of `collection`, returning an array of all elements
  10187. * `predicate` returns truthy for. The predicate is invoked with three
  10188. * arguments: (value, index|key, collection).
  10189. *
  10190. * **Note:** Unlike `_.remove`, this method returns a new array.
  10191. *
  10192. * @static
  10193. * @memberOf _
  10194. * @since 0.1.0
  10195. * @category Collection
  10196. * @param {Array|Object} collection The collection to iterate over.
  10197. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  10198. * @returns {Array} Returns the new filtered array.
  10199. * @see _.reject
  10200. * @example
  10201. *
  10202. * var users = [
  10203. * { 'user': 'barney', 'age': 36, 'active': true },
  10204. * { 'user': 'fred', 'age': 40, 'active': false }
  10205. * ];
  10206. *
  10207. * _.filter(users, function(o) { return !o.active; });
  10208. * // => objects for ['fred']
  10209. *
  10210. * // The `_.matches` iteratee shorthand.
  10211. * _.filter(users, { 'age': 36, 'active': true });
  10212. * // => objects for ['barney']
  10213. *
  10214. * // The `_.matchesProperty` iteratee shorthand.
  10215. * _.filter(users, ['active', false]);
  10216. * // => objects for ['fred']
  10217. *
  10218. * // The `_.property` iteratee shorthand.
  10219. * _.filter(users, 'active');
  10220. * // => objects for ['barney']
  10221. *
  10222. * // Combining several predicates using `_.overEvery` or `_.overSome`.
  10223. * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));
  10224. * // => objects for ['fred', 'barney']
  10225. */
  10226. function filter(collection, predicate) {
  10227. var func = isArray(collection) ? arrayFilter : baseFilter;
  10228. return func(collection, getIteratee(predicate, 3));
  10229. }
  10230. /**
  10231. * Iterates over elements of `collection`, returning the first element
  10232. * `predicate` returns truthy for. The predicate is invoked with three
  10233. * arguments: (value, index|key, collection).
  10234. *
  10235. * @static
  10236. * @memberOf _
  10237. * @since 0.1.0
  10238. * @category Collection
  10239. * @param {Array|Object} collection The collection to inspect.
  10240. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  10241. * @param {number} [fromIndex=0] The index to search from.
  10242. * @returns {*} Returns the matched element, else `undefined`.
  10243. * @example
  10244. *
  10245. * var users = [
  10246. * { 'user': 'barney', 'age': 36, 'active': true },
  10247. * { 'user': 'fred', 'age': 40, 'active': false },
  10248. * { 'user': 'pebbles', 'age': 1, 'active': true }
  10249. * ];
  10250. *
  10251. * _.find(users, function(o) { return o.age < 40; });
  10252. * // => object for 'barney'
  10253. *
  10254. * // The `_.matches` iteratee shorthand.
  10255. * _.find(users, { 'age': 1, 'active': true });
  10256. * // => object for 'pebbles'
  10257. *
  10258. * // The `_.matchesProperty` iteratee shorthand.
  10259. * _.find(users, ['active', false]);
  10260. * // => object for 'fred'
  10261. *
  10262. * // The `_.property` iteratee shorthand.
  10263. * _.find(users, 'active');
  10264. * // => object for 'barney'
  10265. */
  10266. var find = createFind(findIndex);
  10267. /**
  10268. * This method is like `_.find` except that it iterates over elements of
  10269. * `collection` from right to left.
  10270. *
  10271. * @static
  10272. * @memberOf _
  10273. * @since 2.0.0
  10274. * @category Collection
  10275. * @param {Array|Object} collection The collection to inspect.
  10276. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  10277. * @param {number} [fromIndex=collection.length-1] The index to search from.
  10278. * @returns {*} Returns the matched element, else `undefined`.
  10279. * @example
  10280. *
  10281. * _.findLast([1, 2, 3, 4], function(n) {
  10282. * return n % 2 == 1;
  10283. * });
  10284. * // => 3
  10285. */
  10286. var findLast = createFind(findLastIndex);
  10287. /**
  10288. * Creates a flattened array of values by running each element in `collection`
  10289. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  10290. * with three arguments: (value, index|key, collection).
  10291. *
  10292. * @static
  10293. * @memberOf _
  10294. * @since 4.0.0
  10295. * @category Collection
  10296. * @param {Array|Object} collection The collection to iterate over.
  10297. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10298. * @returns {Array} Returns the new flattened array.
  10299. * @example
  10300. *
  10301. * function duplicate(n) {
  10302. * return [n, n];
  10303. * }
  10304. *
  10305. * _.flatMap([1, 2], duplicate);
  10306. * // => [1, 1, 2, 2]
  10307. */
  10308. function flatMap(collection, iteratee) {
  10309. return baseFlatten(map(collection, iteratee), 1);
  10310. }
  10311. /**
  10312. * This method is like `_.flatMap` except that it recursively flattens the
  10313. * mapped results.
  10314. *
  10315. * @static
  10316. * @memberOf _
  10317. * @since 4.7.0
  10318. * @category Collection
  10319. * @param {Array|Object} collection The collection to iterate over.
  10320. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10321. * @returns {Array} Returns the new flattened array.
  10322. * @example
  10323. *
  10324. * function duplicate(n) {
  10325. * return [[[n, n]]];
  10326. * }
  10327. *
  10328. * _.flatMapDeep([1, 2], duplicate);
  10329. * // => [1, 1, 2, 2]
  10330. */
  10331. function flatMapDeep(collection, iteratee) {
  10332. return baseFlatten(map(collection, iteratee), INFINITY);
  10333. }
  10334. /**
  10335. * This method is like `_.flatMap` except that it recursively flattens the
  10336. * mapped results up to `depth` times.
  10337. *
  10338. * @static
  10339. * @memberOf _
  10340. * @since 4.7.0
  10341. * @category Collection
  10342. * @param {Array|Object} collection The collection to iterate over.
  10343. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10344. * @param {number} [depth=1] The maximum recursion depth.
  10345. * @returns {Array} Returns the new flattened array.
  10346. * @example
  10347. *
  10348. * function duplicate(n) {
  10349. * return [[[n, n]]];
  10350. * }
  10351. *
  10352. * _.flatMapDepth([1, 2], duplicate, 2);
  10353. * // => [[1, 1], [2, 2]]
  10354. */
  10355. function flatMapDepth(collection, iteratee, depth) {
  10356. depth = depth === undefined ? 1 : toInteger(depth);
  10357. return baseFlatten(map(collection, iteratee), depth);
  10358. }
  10359. /**
  10360. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  10361. * The iteratee is invoked with three arguments: (value, index|key, collection).
  10362. * Iteratee functions may exit iteration early by explicitly returning `false`.
  10363. *
  10364. * **Note:** As with other "Collections" methods, objects with a "length"
  10365. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  10366. * or `_.forOwn` for object iteration.
  10367. *
  10368. * @static
  10369. * @memberOf _
  10370. * @since 0.1.0
  10371. * @alias each
  10372. * @category Collection
  10373. * @param {Array|Object} collection The collection to iterate over.
  10374. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10375. * @returns {Array|Object} Returns `collection`.
  10376. * @see _.forEachRight
  10377. * @example
  10378. *
  10379. * _.forEach([1, 2], function(value) {
  10380. * console.log(value);
  10381. * });
  10382. * // => Logs `1` then `2`.
  10383. *
  10384. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  10385. * console.log(key);
  10386. * });
  10387. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  10388. */
  10389. function forEach(collection, iteratee) {
  10390. var func = isArray(collection) ? arrayEach : baseEach;
  10391. return func(collection, getIteratee(iteratee, 3));
  10392. }
  10393. /**
  10394. * This method is like `_.forEach` except that it iterates over elements of
  10395. * `collection` from right to left.
  10396. *
  10397. * @static
  10398. * @memberOf _
  10399. * @since 2.0.0
  10400. * @alias eachRight
  10401. * @category Collection
  10402. * @param {Array|Object} collection The collection to iterate over.
  10403. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10404. * @returns {Array|Object} Returns `collection`.
  10405. * @see _.forEach
  10406. * @example
  10407. *
  10408. * _.forEachRight([1, 2], function(value) {
  10409. * console.log(value);
  10410. * });
  10411. * // => Logs `2` then `1`.
  10412. */
  10413. function forEachRight(collection, iteratee) {
  10414. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  10415. return func(collection, getIteratee(iteratee, 3));
  10416. }
  10417. /**
  10418. * Creates an object composed of keys generated from the results of running
  10419. * each element of `collection` thru `iteratee`. The order of grouped values
  10420. * is determined by the order they occur in `collection`. The corresponding
  10421. * value of each key is an array of elements responsible for generating the
  10422. * key. The iteratee is invoked with one argument: (value).
  10423. *
  10424. * @static
  10425. * @memberOf _
  10426. * @since 0.1.0
  10427. * @category Collection
  10428. * @param {Array|Object} collection The collection to iterate over.
  10429. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  10430. * @returns {Object} Returns the composed aggregate object.
  10431. * @example
  10432. *
  10433. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  10434. * // => { '4': [4.2], '6': [6.1, 6.3] }
  10435. *
  10436. * // The `_.property` iteratee shorthand.
  10437. * _.groupBy(['one', 'two', 'three'], 'length');
  10438. * // => { '3': ['one', 'two'], '5': ['three'] }
  10439. */
  10440. var groupBy = createAggregator(function(result, value, key) {
  10441. if (hasOwnProperty.call(result, key)) {
  10442. result[key].push(value);
  10443. } else {
  10444. baseAssignValue(result, key, [value]);
  10445. }
  10446. });
  10447. /**
  10448. * Checks if `value` is in `collection`. If `collection` is a string, it's
  10449. * checked for a substring of `value`, otherwise
  10450. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  10451. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  10452. * the offset from the end of `collection`.
  10453. *
  10454. * @static
  10455. * @memberOf _
  10456. * @since 0.1.0
  10457. * @category Collection
  10458. * @param {Array|Object|string} collection The collection to inspect.
  10459. * @param {*} value The value to search for.
  10460. * @param {number} [fromIndex=0] The index to search from.
  10461. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  10462. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  10463. * @example
  10464. *
  10465. * _.includes([1, 2, 3], 1);
  10466. * // => true
  10467. *
  10468. * _.includes([1, 2, 3], 1, 2);
  10469. * // => false
  10470. *
  10471. * _.includes({ 'a': 1, 'b': 2 }, 1);
  10472. * // => true
  10473. *
  10474. * _.includes('abcd', 'bc');
  10475. * // => true
  10476. */
  10477. function includes(collection, value, fromIndex, guard) {
  10478. collection = isArrayLike(collection) ? collection : values(collection);
  10479. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  10480. var length = collection.length;
  10481. if (fromIndex < 0) {
  10482. fromIndex = nativeMax(length + fromIndex, 0);
  10483. }
  10484. return isString(collection)
  10485. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  10486. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  10487. }
  10488. /**
  10489. * Invokes the method at `path` of each element in `collection`, returning
  10490. * an array of the results of each invoked method. Any additional arguments
  10491. * are provided to each invoked method. If `path` is a function, it's invoked
  10492. * for, and `this` bound to, each element in `collection`.
  10493. *
  10494. * @static
  10495. * @memberOf _
  10496. * @since 4.0.0
  10497. * @category Collection
  10498. * @param {Array|Object} collection The collection to iterate over.
  10499. * @param {Array|Function|string} path The path of the method to invoke or
  10500. * the function invoked per iteration.
  10501. * @param {...*} [args] The arguments to invoke each method with.
  10502. * @returns {Array} Returns the array of results.
  10503. * @example
  10504. *
  10505. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  10506. * // => [[1, 5, 7], [1, 2, 3]]
  10507. *
  10508. * _.invokeMap([123, 456], String.prototype.split, '');
  10509. * // => [['1', '2', '3'], ['4', '5', '6']]
  10510. */
  10511. var invokeMap = baseRest(function(collection, path, args) {
  10512. var index = -1,
  10513. isFunc = typeof path == 'function',
  10514. result = isArrayLike(collection) ? Array(collection.length) : [];
  10515. baseEach(collection, function(value) {
  10516. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  10517. });
  10518. return result;
  10519. });
  10520. /**
  10521. * Creates an object composed of keys generated from the results of running
  10522. * each element of `collection` thru `iteratee`. The corresponding value of
  10523. * each key is the last element responsible for generating the key. The
  10524. * iteratee is invoked with one argument: (value).
  10525. *
  10526. * @static
  10527. * @memberOf _
  10528. * @since 4.0.0
  10529. * @category Collection
  10530. * @param {Array|Object} collection The collection to iterate over.
  10531. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  10532. * @returns {Object} Returns the composed aggregate object.
  10533. * @example
  10534. *
  10535. * var array = [
  10536. * { 'dir': 'left', 'code': 97 },
  10537. * { 'dir': 'right', 'code': 100 }
  10538. * ];
  10539. *
  10540. * _.keyBy(array, function(o) {
  10541. * return String.fromCharCode(o.code);
  10542. * });
  10543. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  10544. *
  10545. * _.keyBy(array, 'dir');
  10546. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  10547. */
  10548. var keyBy = createAggregator(function(result, value, key) {
  10549. baseAssignValue(result, key, value);
  10550. });
  10551. /**
  10552. * Creates an array of values by running each element in `collection` thru
  10553. * `iteratee`. The iteratee is invoked with three arguments:
  10554. * (value, index|key, collection).
  10555. *
  10556. * Many lodash methods are guarded to work as iteratees for methods like
  10557. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  10558. *
  10559. * The guarded methods are:
  10560. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  10561. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  10562. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  10563. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  10564. *
  10565. * @static
  10566. * @memberOf _
  10567. * @since 0.1.0
  10568. * @category Collection
  10569. * @param {Array|Object} collection The collection to iterate over.
  10570. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10571. * @returns {Array} Returns the new mapped array.
  10572. * @example
  10573. *
  10574. * function square(n) {
  10575. * return n * n;
  10576. * }
  10577. *
  10578. * _.map([4, 8], square);
  10579. * // => [16, 64]
  10580. *
  10581. * _.map({ 'a': 4, 'b': 8 }, square);
  10582. * // => [16, 64] (iteration order is not guaranteed)
  10583. *
  10584. * var users = [
  10585. * { 'user': 'barney' },
  10586. * { 'user': 'fred' }
  10587. * ];
  10588. *
  10589. * // The `_.property` iteratee shorthand.
  10590. * _.map(users, 'user');
  10591. * // => ['barney', 'fred']
  10592. */
  10593. function map(collection, iteratee) {
  10594. var func = isArray(collection) ? arrayMap : baseMap;
  10595. return func(collection, getIteratee(iteratee, 3));
  10596. }
  10597. /**
  10598. * This method is like `_.sortBy` except that it allows specifying the sort
  10599. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  10600. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  10601. * descending or "asc" for ascending sort order of corresponding values.
  10602. *
  10603. * @static
  10604. * @memberOf _
  10605. * @since 4.0.0
  10606. * @category Collection
  10607. * @param {Array|Object} collection The collection to iterate over.
  10608. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  10609. * The iteratees to sort by.
  10610. * @param {string[]} [orders] The sort orders of `iteratees`.
  10611. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  10612. * @returns {Array} Returns the new sorted array.
  10613. * @example
  10614. *
  10615. * var users = [
  10616. * { 'user': 'fred', 'age': 48 },
  10617. * { 'user': 'barney', 'age': 34 },
  10618. * { 'user': 'fred', 'age': 40 },
  10619. * { 'user': 'barney', 'age': 36 }
  10620. * ];
  10621. *
  10622. * // Sort by `user` in ascending order and by `age` in descending order.
  10623. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  10624. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  10625. */
  10626. function orderBy(collection, iteratees, orders, guard) {
  10627. if (collection == null) {
  10628. return [];
  10629. }
  10630. if (!isArray(iteratees)) {
  10631. iteratees = iteratees == null ? [] : [iteratees];
  10632. }
  10633. orders = guard ? undefined : orders;
  10634. if (!isArray(orders)) {
  10635. orders = orders == null ? [] : [orders];
  10636. }
  10637. return baseOrderBy(collection, iteratees, orders);
  10638. }
  10639. /**
  10640. * Creates an array of elements split into two groups, the first of which
  10641. * contains elements `predicate` returns truthy for, the second of which
  10642. * contains elements `predicate` returns falsey for. The predicate is
  10643. * invoked with one argument: (value).
  10644. *
  10645. * @static
  10646. * @memberOf _
  10647. * @since 3.0.0
  10648. * @category Collection
  10649. * @param {Array|Object} collection The collection to iterate over.
  10650. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  10651. * @returns {Array} Returns the array of grouped elements.
  10652. * @example
  10653. *
  10654. * var users = [
  10655. * { 'user': 'barney', 'age': 36, 'active': false },
  10656. * { 'user': 'fred', 'age': 40, 'active': true },
  10657. * { 'user': 'pebbles', 'age': 1, 'active': false }
  10658. * ];
  10659. *
  10660. * _.partition(users, function(o) { return o.active; });
  10661. * // => objects for [['fred'], ['barney', 'pebbles']]
  10662. *
  10663. * // The `_.matches` iteratee shorthand.
  10664. * _.partition(users, { 'age': 1, 'active': false });
  10665. * // => objects for [['pebbles'], ['barney', 'fred']]
  10666. *
  10667. * // The `_.matchesProperty` iteratee shorthand.
  10668. * _.partition(users, ['active', false]);
  10669. * // => objects for [['barney', 'pebbles'], ['fred']]
  10670. *
  10671. * // The `_.property` iteratee shorthand.
  10672. * _.partition(users, 'active');
  10673. * // => objects for [['fred'], ['barney', 'pebbles']]
  10674. */
  10675. var partition = createAggregator(function(result, value, key) {
  10676. result[key ? 0 : 1].push(value);
  10677. }, function() { return [[], []]; });
  10678. /**
  10679. * Reduces `collection` to a value which is the accumulated result of running
  10680. * each element in `collection` thru `iteratee`, where each successive
  10681. * invocation is supplied the return value of the previous. If `accumulator`
  10682. * is not given, the first element of `collection` is used as the initial
  10683. * value. The iteratee is invoked with four arguments:
  10684. * (accumulator, value, index|key, collection).
  10685. *
  10686. * Many lodash methods are guarded to work as iteratees for methods like
  10687. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  10688. *
  10689. * The guarded methods are:
  10690. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  10691. * and `sortBy`
  10692. *
  10693. * @static
  10694. * @memberOf _
  10695. * @since 0.1.0
  10696. * @category Collection
  10697. * @param {Array|Object} collection The collection to iterate over.
  10698. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10699. * @param {*} [accumulator] The initial value.
  10700. * @returns {*} Returns the accumulated value.
  10701. * @see _.reduceRight
  10702. * @example
  10703. *
  10704. * _.reduce([1, 2], function(sum, n) {
  10705. * return sum + n;
  10706. * }, 0);
  10707. * // => 3
  10708. *
  10709. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  10710. * (result[value] || (result[value] = [])).push(key);
  10711. * return result;
  10712. * }, {});
  10713. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  10714. */
  10715. function reduce(collection, iteratee, accumulator) {
  10716. var func = isArray(collection) ? arrayReduce : baseReduce,
  10717. initAccum = arguments.length < 3;
  10718. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  10719. }
  10720. /**
  10721. * This method is like `_.reduce` except that it iterates over elements of
  10722. * `collection` from right to left.
  10723. *
  10724. * @static
  10725. * @memberOf _
  10726. * @since 0.1.0
  10727. * @category Collection
  10728. * @param {Array|Object} collection The collection to iterate over.
  10729. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10730. * @param {*} [accumulator] The initial value.
  10731. * @returns {*} Returns the accumulated value.
  10732. * @see _.reduce
  10733. * @example
  10734. *
  10735. * var array = [[0, 1], [2, 3], [4, 5]];
  10736. *
  10737. * _.reduceRight(array, function(flattened, other) {
  10738. * return flattened.concat(other);
  10739. * }, []);
  10740. * // => [4, 5, 2, 3, 0, 1]
  10741. */
  10742. function reduceRight(collection, iteratee, accumulator) {
  10743. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  10744. initAccum = arguments.length < 3;
  10745. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  10746. }
  10747. /**
  10748. * The opposite of `_.filter`; this method returns the elements of `collection`
  10749. * that `predicate` does **not** return truthy for.
  10750. *
  10751. * @static
  10752. * @memberOf _
  10753. * @since 0.1.0
  10754. * @category Collection
  10755. * @param {Array|Object} collection The collection to iterate over.
  10756. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  10757. * @returns {Array} Returns the new filtered array.
  10758. * @see _.filter
  10759. * @example
  10760. *
  10761. * var users = [
  10762. * { 'user': 'barney', 'age': 36, 'active': false },
  10763. * { 'user': 'fred', 'age': 40, 'active': true }
  10764. * ];
  10765. *
  10766. * _.reject(users, function(o) { return !o.active; });
  10767. * // => objects for ['fred']
  10768. *
  10769. * // The `_.matches` iteratee shorthand.
  10770. * _.reject(users, { 'age': 40, 'active': true });
  10771. * // => objects for ['barney']
  10772. *
  10773. * // The `_.matchesProperty` iteratee shorthand.
  10774. * _.reject(users, ['active', false]);
  10775. * // => objects for ['fred']
  10776. *
  10777. * // The `_.property` iteratee shorthand.
  10778. * _.reject(users, 'active');
  10779. * // => objects for ['barney']
  10780. */
  10781. function reject(collection, predicate) {
  10782. var func = isArray(collection) ? arrayFilter : baseFilter;
  10783. return func(collection, negate(getIteratee(predicate, 3)));
  10784. }
  10785. /**
  10786. * Gets a random element from `collection`.
  10787. *
  10788. * @static
  10789. * @memberOf _
  10790. * @since 2.0.0
  10791. * @category Collection
  10792. * @param {Array|Object} collection The collection to sample.
  10793. * @returns {*} Returns the random element.
  10794. * @example
  10795. *
  10796. * _.sample([1, 2, 3, 4]);
  10797. * // => 2
  10798. */
  10799. function sample(collection) {
  10800. var func = isArray(collection) ? arraySample : baseSample;
  10801. return func(collection);
  10802. }
  10803. /**
  10804. * Gets `n` random elements at unique keys from `collection` up to the
  10805. * size of `collection`.
  10806. *
  10807. * @static
  10808. * @memberOf _
  10809. * @since 4.0.0
  10810. * @category Collection
  10811. * @param {Array|Object} collection The collection to sample.
  10812. * @param {number} [n=1] The number of elements to sample.
  10813. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10814. * @returns {Array} Returns the random elements.
  10815. * @example
  10816. *
  10817. * _.sampleSize([1, 2, 3], 2);
  10818. * // => [3, 1]
  10819. *
  10820. * _.sampleSize([1, 2, 3], 4);
  10821. * // => [2, 3, 1]
  10822. */
  10823. function sampleSize(collection, n, guard) {
  10824. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  10825. n = 1;
  10826. } else {
  10827. n = toInteger(n);
  10828. }
  10829. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  10830. return func(collection, n);
  10831. }
  10832. /**
  10833. * Creates an array of shuffled values, using a version of the
  10834. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  10835. *
  10836. * @static
  10837. * @memberOf _
  10838. * @since 0.1.0
  10839. * @category Collection
  10840. * @param {Array|Object} collection The collection to shuffle.
  10841. * @returns {Array} Returns the new shuffled array.
  10842. * @example
  10843. *
  10844. * _.shuffle([1, 2, 3, 4]);
  10845. * // => [4, 1, 3, 2]
  10846. */
  10847. function shuffle(collection) {
  10848. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  10849. return func(collection);
  10850. }
  10851. /**
  10852. * Gets the size of `collection` by returning its length for array-like
  10853. * values or the number of own enumerable string keyed properties for objects.
  10854. *
  10855. * @static
  10856. * @memberOf _
  10857. * @since 0.1.0
  10858. * @category Collection
  10859. * @param {Array|Object|string} collection The collection to inspect.
  10860. * @returns {number} Returns the collection size.
  10861. * @example
  10862. *
  10863. * _.size([1, 2, 3]);
  10864. * // => 3
  10865. *
  10866. * _.size({ 'a': 1, 'b': 2 });
  10867. * // => 2
  10868. *
  10869. * _.size('pebbles');
  10870. * // => 7
  10871. */
  10872. function size(collection) {
  10873. if (collection == null) {
  10874. return 0;
  10875. }
  10876. if (isArrayLike(collection)) {
  10877. return isString(collection) ? stringSize(collection) : collection.length;
  10878. }
  10879. var tag = getTag(collection);
  10880. if (tag == mapTag || tag == setTag) {
  10881. return collection.size;
  10882. }
  10883. return baseKeys(collection).length;
  10884. }
  10885. /**
  10886. * Checks if `predicate` returns truthy for **any** element of `collection`.
  10887. * Iteration is stopped once `predicate` returns truthy. The predicate is
  10888. * invoked with three arguments: (value, index|key, collection).
  10889. *
  10890. * @static
  10891. * @memberOf _
  10892. * @since 0.1.0
  10893. * @category Collection
  10894. * @param {Array|Object} collection The collection to iterate over.
  10895. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  10896. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10897. * @returns {boolean} Returns `true` if any element passes the predicate check,
  10898. * else `false`.
  10899. * @example
  10900. *
  10901. * _.some([null, 0, 'yes', false], Boolean);
  10902. * // => true
  10903. *
  10904. * var users = [
  10905. * { 'user': 'barney', 'active': true },
  10906. * { 'user': 'fred', 'active': false }
  10907. * ];
  10908. *
  10909. * // The `_.matches` iteratee shorthand.
  10910. * _.some(users, { 'user': 'barney', 'active': false });
  10911. * // => false
  10912. *
  10913. * // The `_.matchesProperty` iteratee shorthand.
  10914. * _.some(users, ['active', false]);
  10915. * // => true
  10916. *
  10917. * // The `_.property` iteratee shorthand.
  10918. * _.some(users, 'active');
  10919. * // => true
  10920. */
  10921. function some(collection, predicate, guard) {
  10922. var func = isArray(collection) ? arraySome : baseSome;
  10923. if (guard && isIterateeCall(collection, predicate, guard)) {
  10924. predicate = undefined;
  10925. }
  10926. return func(collection, getIteratee(predicate, 3));
  10927. }
  10928. /**
  10929. * Creates an array of elements, sorted in ascending order by the results of
  10930. * running each element in a collection thru each iteratee. This method
  10931. * performs a stable sort, that is, it preserves the original sort order of
  10932. * equal elements. The iteratees are invoked with one argument: (value).
  10933. *
  10934. * @static
  10935. * @memberOf _
  10936. * @since 0.1.0
  10937. * @category Collection
  10938. * @param {Array|Object} collection The collection to iterate over.
  10939. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  10940. * The iteratees to sort by.
  10941. * @returns {Array} Returns the new sorted array.
  10942. * @example
  10943. *
  10944. * var users = [
  10945. * { 'user': 'fred', 'age': 48 },
  10946. * { 'user': 'barney', 'age': 36 },
  10947. * { 'user': 'fred', 'age': 30 },
  10948. * { 'user': 'barney', 'age': 34 }
  10949. * ];
  10950. *
  10951. * _.sortBy(users, [function(o) { return o.user; }]);
  10952. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
  10953. *
  10954. * _.sortBy(users, ['user', 'age']);
  10955. * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
  10956. */
  10957. var sortBy = baseRest(function(collection, iteratees) {
  10958. if (collection == null) {
  10959. return [];
  10960. }
  10961. var length = iteratees.length;
  10962. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  10963. iteratees = [];
  10964. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  10965. iteratees = [iteratees[0]];
  10966. }
  10967. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  10968. });
  10969. /*------------------------------------------------------------------------*/
  10970. /**
  10971. * Gets the timestamp of the number of milliseconds that have elapsed since
  10972. * the Unix epoch (1 January 1970 00:00:00 UTC).
  10973. *
  10974. * @static
  10975. * @memberOf _
  10976. * @since 2.4.0
  10977. * @category Date
  10978. * @returns {number} Returns the timestamp.
  10979. * @example
  10980. *
  10981. * _.defer(function(stamp) {
  10982. * console.log(_.now() - stamp);
  10983. * }, _.now());
  10984. * // => Logs the number of milliseconds it took for the deferred invocation.
  10985. */
  10986. var now = ctxNow || function() {
  10987. return root.Date.now();
  10988. };
  10989. /*------------------------------------------------------------------------*/
  10990. /**
  10991. * The opposite of `_.before`; this method creates a function that invokes
  10992. * `func` once it's called `n` or more times.
  10993. *
  10994. * @static
  10995. * @memberOf _
  10996. * @since 0.1.0
  10997. * @category Function
  10998. * @param {number} n The number of calls before `func` is invoked.
  10999. * @param {Function} func The function to restrict.
  11000. * @returns {Function} Returns the new restricted function.
  11001. * @example
  11002. *
  11003. * var saves = ['profile', 'settings'];
  11004. *
  11005. * var done = _.after(saves.length, function() {
  11006. * console.log('done saving!');
  11007. * });
  11008. *
  11009. * _.forEach(saves, function(type) {
  11010. * asyncSave({ 'type': type, 'complete': done });
  11011. * });
  11012. * // => Logs 'done saving!' after the two async saves have completed.
  11013. */
  11014. function after(n, func) {
  11015. if (typeof func != 'function') {
  11016. throw new TypeError(FUNC_ERROR_TEXT);
  11017. }
  11018. n = toInteger(n);
  11019. return function() {
  11020. if (--n < 1) {
  11021. return func.apply(this, arguments);
  11022. }
  11023. };
  11024. }
  11025. /**
  11026. * Creates a function that invokes `func`, with up to `n` arguments,
  11027. * ignoring any additional arguments.
  11028. *
  11029. * @static
  11030. * @memberOf _
  11031. * @since 3.0.0
  11032. * @category Function
  11033. * @param {Function} func The function to cap arguments for.
  11034. * @param {number} [n=func.length] The arity cap.
  11035. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  11036. * @returns {Function} Returns the new capped function.
  11037. * @example
  11038. *
  11039. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  11040. * // => [6, 8, 10]
  11041. */
  11042. function ary(func, n, guard) {
  11043. n = guard ? undefined : n;
  11044. n = (func && n == null) ? func.length : n;
  11045. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  11046. }
  11047. /**
  11048. * Creates a function that invokes `func`, with the `this` binding and arguments
  11049. * of the created function, while it's called less than `n` times. Subsequent
  11050. * calls to the created function return the result of the last `func` invocation.
  11051. *
  11052. * @static
  11053. * @memberOf _
  11054. * @since 3.0.0
  11055. * @category Function
  11056. * @param {number} n The number of calls at which `func` is no longer invoked.
  11057. * @param {Function} func The function to restrict.
  11058. * @returns {Function} Returns the new restricted function.
  11059. * @example
  11060. *
  11061. * jQuery(element).on('click', _.before(5, addContactToList));
  11062. * // => Allows adding up to 4 contacts to the list.
  11063. */
  11064. function before(n, func) {
  11065. var result;
  11066. if (typeof func != 'function') {
  11067. throw new TypeError(FUNC_ERROR_TEXT);
  11068. }
  11069. n = toInteger(n);
  11070. return function() {
  11071. if (--n > 0) {
  11072. result = func.apply(this, arguments);
  11073. }
  11074. if (n <= 1) {
  11075. func = undefined;
  11076. }
  11077. return result;
  11078. };
  11079. }
  11080. /**
  11081. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  11082. * and `partials` prepended to the arguments it receives.
  11083. *
  11084. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  11085. * may be used as a placeholder for partially applied arguments.
  11086. *
  11087. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  11088. * property of bound functions.
  11089. *
  11090. * @static
  11091. * @memberOf _
  11092. * @since 0.1.0
  11093. * @category Function
  11094. * @param {Function} func The function to bind.
  11095. * @param {*} thisArg The `this` binding of `func`.
  11096. * @param {...*} [partials] The arguments to be partially applied.
  11097. * @returns {Function} Returns the new bound function.
  11098. * @example
  11099. *
  11100. * function greet(greeting, punctuation) {
  11101. * return greeting + ' ' + this.user + punctuation;
  11102. * }
  11103. *
  11104. * var object = { 'user': 'fred' };
  11105. *
  11106. * var bound = _.bind(greet, object, 'hi');
  11107. * bound('!');
  11108. * // => 'hi fred!'
  11109. *
  11110. * // Bound with placeholders.
  11111. * var bound = _.bind(greet, object, _, '!');
  11112. * bound('hi');
  11113. * // => 'hi fred!'
  11114. */
  11115. var bind = baseRest(function(func, thisArg, partials) {
  11116. var bitmask = WRAP_BIND_FLAG;
  11117. if (partials.length) {
  11118. var holders = replaceHolders(partials, getHolder(bind));
  11119. bitmask |= WRAP_PARTIAL_FLAG;
  11120. }
  11121. return createWrap(func, bitmask, thisArg, partials, holders);
  11122. });
  11123. /**
  11124. * Creates a function that invokes the method at `object[key]` with `partials`
  11125. * prepended to the arguments it receives.
  11126. *
  11127. * This method differs from `_.bind` by allowing bound functions to reference
  11128. * methods that may be redefined or don't yet exist. See
  11129. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  11130. * for more details.
  11131. *
  11132. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  11133. * builds, may be used as a placeholder for partially applied arguments.
  11134. *
  11135. * @static
  11136. * @memberOf _
  11137. * @since 0.10.0
  11138. * @category Function
  11139. * @param {Object} object The object to invoke the method on.
  11140. * @param {string} key The key of the method.
  11141. * @param {...*} [partials] The arguments to be partially applied.
  11142. * @returns {Function} Returns the new bound function.
  11143. * @example
  11144. *
  11145. * var object = {
  11146. * 'user': 'fred',
  11147. * 'greet': function(greeting, punctuation) {
  11148. * return greeting + ' ' + this.user + punctuation;
  11149. * }
  11150. * };
  11151. *
  11152. * var bound = _.bindKey(object, 'greet', 'hi');
  11153. * bound('!');
  11154. * // => 'hi fred!'
  11155. *
  11156. * object.greet = function(greeting, punctuation) {
  11157. * return greeting + 'ya ' + this.user + punctuation;
  11158. * };
  11159. *
  11160. * bound('!');
  11161. * // => 'hiya fred!'
  11162. *
  11163. * // Bound with placeholders.
  11164. * var bound = _.bindKey(object, 'greet', _, '!');
  11165. * bound('hi');
  11166. * // => 'hiya fred!'
  11167. */
  11168. var bindKey = baseRest(function(object, key, partials) {
  11169. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  11170. if (partials.length) {
  11171. var holders = replaceHolders(partials, getHolder(bindKey));
  11172. bitmask |= WRAP_PARTIAL_FLAG;
  11173. }
  11174. return createWrap(key, bitmask, object, partials, holders);
  11175. });
  11176. /**
  11177. * Creates a function that accepts arguments of `func` and either invokes
  11178. * `func` returning its result, if at least `arity` number of arguments have
  11179. * been provided, or returns a function that accepts the remaining `func`
  11180. * arguments, and so on. The arity of `func` may be specified if `func.length`
  11181. * is not sufficient.
  11182. *
  11183. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  11184. * may be used as a placeholder for provided arguments.
  11185. *
  11186. * **Note:** This method doesn't set the "length" property of curried functions.
  11187. *
  11188. * @static
  11189. * @memberOf _
  11190. * @since 2.0.0
  11191. * @category Function
  11192. * @param {Function} func The function to curry.
  11193. * @param {number} [arity=func.length] The arity of `func`.
  11194. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  11195. * @returns {Function} Returns the new curried function.
  11196. * @example
  11197. *
  11198. * var abc = function(a, b, c) {
  11199. * return [a, b, c];
  11200. * };
  11201. *
  11202. * var curried = _.curry(abc);
  11203. *
  11204. * curried(1)(2)(3);
  11205. * // => [1, 2, 3]
  11206. *
  11207. * curried(1, 2)(3);
  11208. * // => [1, 2, 3]
  11209. *
  11210. * curried(1, 2, 3);
  11211. * // => [1, 2, 3]
  11212. *
  11213. * // Curried with placeholders.
  11214. * curried(1)(_, 3)(2);
  11215. * // => [1, 2, 3]
  11216. */
  11217. function curry(func, arity, guard) {
  11218. arity = guard ? undefined : arity;
  11219. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  11220. result.placeholder = curry.placeholder;
  11221. return result;
  11222. }
  11223. /**
  11224. * This method is like `_.curry` except that arguments are applied to `func`
  11225. * in the manner of `_.partialRight` instead of `_.partial`.
  11226. *
  11227. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  11228. * builds, may be used as a placeholder for provided arguments.
  11229. *
  11230. * **Note:** This method doesn't set the "length" property of curried functions.
  11231. *
  11232. * @static
  11233. * @memberOf _
  11234. * @since 3.0.0
  11235. * @category Function
  11236. * @param {Function} func The function to curry.
  11237. * @param {number} [arity=func.length] The arity of `func`.
  11238. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  11239. * @returns {Function} Returns the new curried function.
  11240. * @example
  11241. *
  11242. * var abc = function(a, b, c) {
  11243. * return [a, b, c];
  11244. * };
  11245. *
  11246. * var curried = _.curryRight(abc);
  11247. *
  11248. * curried(3)(2)(1);
  11249. * // => [1, 2, 3]
  11250. *
  11251. * curried(2, 3)(1);
  11252. * // => [1, 2, 3]
  11253. *
  11254. * curried(1, 2, 3);
  11255. * // => [1, 2, 3]
  11256. *
  11257. * // Curried with placeholders.
  11258. * curried(3)(1, _)(2);
  11259. * // => [1, 2, 3]
  11260. */
  11261. function curryRight(func, arity, guard) {
  11262. arity = guard ? undefined : arity;
  11263. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  11264. result.placeholder = curryRight.placeholder;
  11265. return result;
  11266. }
  11267. /**
  11268. * Creates a debounced function that delays invoking `func` until after `wait`
  11269. * milliseconds have elapsed since the last time the debounced function was
  11270. * invoked. The debounced function comes with a `cancel` method to cancel
  11271. * delayed `func` invocations and a `flush` method to immediately invoke them.
  11272. * Provide `options` to indicate whether `func` should be invoked on the
  11273. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  11274. * with the last arguments provided to the debounced function. Subsequent
  11275. * calls to the debounced function return the result of the last `func`
  11276. * invocation.
  11277. *
  11278. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  11279. * invoked on the trailing edge of the timeout only if the debounced function
  11280. * is invoked more than once during the `wait` timeout.
  11281. *
  11282. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  11283. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  11284. *
  11285. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  11286. * for details over the differences between `_.debounce` and `_.throttle`.
  11287. *
  11288. * @static
  11289. * @memberOf _
  11290. * @since 0.1.0
  11291. * @category Function
  11292. * @param {Function} func The function to debounce.
  11293. * @param {number} [wait=0] The number of milliseconds to delay.
  11294. * @param {Object} [options={}] The options object.
  11295. * @param {boolean} [options.leading=false]
  11296. * Specify invoking on the leading edge of the timeout.
  11297. * @param {number} [options.maxWait]
  11298. * The maximum time `func` is allowed to be delayed before it's invoked.
  11299. * @param {boolean} [options.trailing=true]
  11300. * Specify invoking on the trailing edge of the timeout.
  11301. * @returns {Function} Returns the new debounced function.
  11302. * @example
  11303. *
  11304. * // Avoid costly calculations while the window size is in flux.
  11305. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  11306. *
  11307. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  11308. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  11309. * 'leading': true,
  11310. * 'trailing': false
  11311. * }));
  11312. *
  11313. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  11314. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  11315. * var source = new EventSource('/stream');
  11316. * jQuery(source).on('message', debounced);
  11317. *
  11318. * // Cancel the trailing debounced invocation.
  11319. * jQuery(window).on('popstate', debounced.cancel);
  11320. */
  11321. function debounce(func, wait, options) {
  11322. var lastArgs,
  11323. lastThis,
  11324. maxWait,
  11325. result,
  11326. timerId,
  11327. lastCallTime,
  11328. lastInvokeTime = 0,
  11329. leading = false,
  11330. maxing = false,
  11331. trailing = true;
  11332. if (typeof func != 'function') {
  11333. throw new TypeError(FUNC_ERROR_TEXT);
  11334. }
  11335. wait = toNumber(wait) || 0;
  11336. if (isObject(options)) {
  11337. leading = !!options.leading;
  11338. maxing = 'maxWait' in options;
  11339. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  11340. trailing = 'trailing' in options ? !!options.trailing : trailing;
  11341. }
  11342. function invokeFunc(time) {
  11343. var args = lastArgs,
  11344. thisArg = lastThis;
  11345. lastArgs = lastThis = undefined;
  11346. lastInvokeTime = time;
  11347. result = func.apply(thisArg, args);
  11348. return result;
  11349. }
  11350. function leadingEdge(time) {
  11351. // Reset any `maxWait` timer.
  11352. lastInvokeTime = time;
  11353. // Start the timer for the trailing edge.
  11354. timerId = setTimeout(timerExpired, wait);
  11355. // Invoke the leading edge.
  11356. return leading ? invokeFunc(time) : result;
  11357. }
  11358. function remainingWait(time) {
  11359. var timeSinceLastCall = time - lastCallTime,
  11360. timeSinceLastInvoke = time - lastInvokeTime,
  11361. timeWaiting = wait - timeSinceLastCall;
  11362. return maxing
  11363. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  11364. : timeWaiting;
  11365. }
  11366. function shouldInvoke(time) {
  11367. var timeSinceLastCall = time - lastCallTime,
  11368. timeSinceLastInvoke = time - lastInvokeTime;
  11369. // Either this is the first call, activity has stopped and we're at the
  11370. // trailing edge, the system time has gone backwards and we're treating
  11371. // it as the trailing edge, or we've hit the `maxWait` limit.
  11372. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  11373. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  11374. }
  11375. function timerExpired() {
  11376. var time = now();
  11377. if (shouldInvoke(time)) {
  11378. return trailingEdge(time);
  11379. }
  11380. // Restart the timer.
  11381. timerId = setTimeout(timerExpired, remainingWait(time));
  11382. }
  11383. function trailingEdge(time) {
  11384. timerId = undefined;
  11385. // Only invoke if we have `lastArgs` which means `func` has been
  11386. // debounced at least once.
  11387. if (trailing && lastArgs) {
  11388. return invokeFunc(time);
  11389. }
  11390. lastArgs = lastThis = undefined;
  11391. return result;
  11392. }
  11393. function cancel() {
  11394. if (timerId !== undefined) {
  11395. clearTimeout(timerId);
  11396. }
  11397. lastInvokeTime = 0;
  11398. lastArgs = lastCallTime = lastThis = timerId = undefined;
  11399. }
  11400. function flush() {
  11401. return timerId === undefined ? result : trailingEdge(now());
  11402. }
  11403. function debounced() {
  11404. var time = now(),
  11405. isInvoking = shouldInvoke(time);
  11406. lastArgs = arguments;
  11407. lastThis = this;
  11408. lastCallTime = time;
  11409. if (isInvoking) {
  11410. if (timerId === undefined) {
  11411. return leadingEdge(lastCallTime);
  11412. }
  11413. if (maxing) {
  11414. // Handle invocations in a tight loop.
  11415. clearTimeout(timerId);
  11416. timerId = setTimeout(timerExpired, wait);
  11417. return invokeFunc(lastCallTime);
  11418. }
  11419. }
  11420. if (timerId === undefined) {
  11421. timerId = setTimeout(timerExpired, wait);
  11422. }
  11423. return result;
  11424. }
  11425. debounced.cancel = cancel;
  11426. debounced.flush = flush;
  11427. return debounced;
  11428. }
  11429. /**
  11430. * Defers invoking the `func` until the current call stack has cleared. Any
  11431. * additional arguments are provided to `func` when it's invoked.
  11432. *
  11433. * @static
  11434. * @memberOf _
  11435. * @since 0.1.0
  11436. * @category Function
  11437. * @param {Function} func The function to defer.
  11438. * @param {...*} [args] The arguments to invoke `func` with.
  11439. * @returns {number} Returns the timer id.
  11440. * @example
  11441. *
  11442. * _.defer(function(text) {
  11443. * console.log(text);
  11444. * }, 'deferred');
  11445. * // => Logs 'deferred' after one millisecond.
  11446. */
  11447. var defer = baseRest(function(func, args) {
  11448. return baseDelay(func, 1, args);
  11449. });
  11450. /**
  11451. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  11452. * provided to `func` when it's invoked.
  11453. *
  11454. * @static
  11455. * @memberOf _
  11456. * @since 0.1.0
  11457. * @category Function
  11458. * @param {Function} func The function to delay.
  11459. * @param {number} wait The number of milliseconds to delay invocation.
  11460. * @param {...*} [args] The arguments to invoke `func` with.
  11461. * @returns {number} Returns the timer id.
  11462. * @example
  11463. *
  11464. * _.delay(function(text) {
  11465. * console.log(text);
  11466. * }, 1000, 'later');
  11467. * // => Logs 'later' after one second.
  11468. */
  11469. var delay = baseRest(function(func, wait, args) {
  11470. return baseDelay(func, toNumber(wait) || 0, args);
  11471. });
  11472. /**
  11473. * Creates a function that invokes `func` with arguments reversed.
  11474. *
  11475. * @static
  11476. * @memberOf _
  11477. * @since 4.0.0
  11478. * @category Function
  11479. * @param {Function} func The function to flip arguments for.
  11480. * @returns {Function} Returns the new flipped function.
  11481. * @example
  11482. *
  11483. * var flipped = _.flip(function() {
  11484. * return _.toArray(arguments);
  11485. * });
  11486. *
  11487. * flipped('a', 'b', 'c', 'd');
  11488. * // => ['d', 'c', 'b', 'a']
  11489. */
  11490. function flip(func) {
  11491. return createWrap(func, WRAP_FLIP_FLAG);
  11492. }
  11493. /**
  11494. * Creates a function that memoizes the result of `func`. If `resolver` is
  11495. * provided, it determines the cache key for storing the result based on the
  11496. * arguments provided to the memoized function. By default, the first argument
  11497. * provided to the memoized function is used as the map cache key. The `func`
  11498. * is invoked with the `this` binding of the memoized function.
  11499. *
  11500. * **Note:** The cache is exposed as the `cache` property on the memoized
  11501. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  11502. * constructor with one whose instances implement the
  11503. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  11504. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  11505. *
  11506. * @static
  11507. * @memberOf _
  11508. * @since 0.1.0
  11509. * @category Function
  11510. * @param {Function} func The function to have its output memoized.
  11511. * @param {Function} [resolver] The function to resolve the cache key.
  11512. * @returns {Function} Returns the new memoized function.
  11513. * @example
  11514. *
  11515. * var object = { 'a': 1, 'b': 2 };
  11516. * var other = { 'c': 3, 'd': 4 };
  11517. *
  11518. * var values = _.memoize(_.values);
  11519. * values(object);
  11520. * // => [1, 2]
  11521. *
  11522. * values(other);
  11523. * // => [3, 4]
  11524. *
  11525. * object.a = 2;
  11526. * values(object);
  11527. * // => [1, 2]
  11528. *
  11529. * // Modify the result cache.
  11530. * values.cache.set(object, ['a', 'b']);
  11531. * values(object);
  11532. * // => ['a', 'b']
  11533. *
  11534. * // Replace `_.memoize.Cache`.
  11535. * _.memoize.Cache = WeakMap;
  11536. */
  11537. function memoize(func, resolver) {
  11538. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  11539. throw new TypeError(FUNC_ERROR_TEXT);
  11540. }
  11541. var memoized = function() {
  11542. var args = arguments,
  11543. key = resolver ? resolver.apply(this, args) : args[0],
  11544. cache = memoized.cache;
  11545. if (cache.has(key)) {
  11546. return cache.get(key);
  11547. }
  11548. var result = func.apply(this, args);
  11549. memoized.cache = cache.set(key, result) || cache;
  11550. return result;
  11551. };
  11552. memoized.cache = new (memoize.Cache || MapCache);
  11553. return memoized;
  11554. }
  11555. // Expose `MapCache`.
  11556. memoize.Cache = MapCache;
  11557. /**
  11558. * Creates a function that negates the result of the predicate `func`. The
  11559. * `func` predicate is invoked with the `this` binding and arguments of the
  11560. * created function.
  11561. *
  11562. * @static
  11563. * @memberOf _
  11564. * @since 3.0.0
  11565. * @category Function
  11566. * @param {Function} predicate The predicate to negate.
  11567. * @returns {Function} Returns the new negated function.
  11568. * @example
  11569. *
  11570. * function isEven(n) {
  11571. * return n % 2 == 0;
  11572. * }
  11573. *
  11574. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  11575. * // => [1, 3, 5]
  11576. */
  11577. function negate(predicate) {
  11578. if (typeof predicate != 'function') {
  11579. throw new TypeError(FUNC_ERROR_TEXT);
  11580. }
  11581. return function() {
  11582. var args = arguments;
  11583. switch (args.length) {
  11584. case 0: return !predicate.call(this);
  11585. case 1: return !predicate.call(this, args[0]);
  11586. case 2: return !predicate.call(this, args[0], args[1]);
  11587. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  11588. }
  11589. return !predicate.apply(this, args);
  11590. };
  11591. }
  11592. /**
  11593. * Creates a function that is restricted to invoking `func` once. Repeat calls
  11594. * to the function return the value of the first invocation. The `func` is
  11595. * invoked with the `this` binding and arguments of the created function.
  11596. *
  11597. * @static
  11598. * @memberOf _
  11599. * @since 0.1.0
  11600. * @category Function
  11601. * @param {Function} func The function to restrict.
  11602. * @returns {Function} Returns the new restricted function.
  11603. * @example
  11604. *
  11605. * var initialize = _.once(createApplication);
  11606. * initialize();
  11607. * initialize();
  11608. * // => `createApplication` is invoked once
  11609. */
  11610. function once(func) {
  11611. return before(2, func);
  11612. }
  11613. /**
  11614. * Creates a function that invokes `func` with its arguments transformed.
  11615. *
  11616. * @static
  11617. * @since 4.0.0
  11618. * @memberOf _
  11619. * @category Function
  11620. * @param {Function} func The function to wrap.
  11621. * @param {...(Function|Function[])} [transforms=[_.identity]]
  11622. * The argument transforms.
  11623. * @returns {Function} Returns the new function.
  11624. * @example
  11625. *
  11626. * function doubled(n) {
  11627. * return n * 2;
  11628. * }
  11629. *
  11630. * function square(n) {
  11631. * return n * n;
  11632. * }
  11633. *
  11634. * var func = _.overArgs(function(x, y) {
  11635. * return [x, y];
  11636. * }, [square, doubled]);
  11637. *
  11638. * func(9, 3);
  11639. * // => [81, 6]
  11640. *
  11641. * func(10, 5);
  11642. * // => [100, 10]
  11643. */
  11644. var overArgs = castRest(function(func, transforms) {
  11645. transforms = (transforms.length == 1 && isArray(transforms[0]))
  11646. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  11647. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  11648. var funcsLength = transforms.length;
  11649. return baseRest(function(args) {
  11650. var index = -1,
  11651. length = nativeMin(args.length, funcsLength);
  11652. while (++index < length) {
  11653. args[index] = transforms[index].call(this, args[index]);
  11654. }
  11655. return apply(func, this, args);
  11656. });
  11657. });
  11658. /**
  11659. * Creates a function that invokes `func` with `partials` prepended to the
  11660. * arguments it receives. This method is like `_.bind` except it does **not**
  11661. * alter the `this` binding.
  11662. *
  11663. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  11664. * builds, may be used as a placeholder for partially applied arguments.
  11665. *
  11666. * **Note:** This method doesn't set the "length" property of partially
  11667. * applied functions.
  11668. *
  11669. * @static
  11670. * @memberOf _
  11671. * @since 0.2.0
  11672. * @category Function
  11673. * @param {Function} func The function to partially apply arguments to.
  11674. * @param {...*} [partials] The arguments to be partially applied.
  11675. * @returns {Function} Returns the new partially applied function.
  11676. * @example
  11677. *
  11678. * function greet(greeting, name) {
  11679. * return greeting + ' ' + name;
  11680. * }
  11681. *
  11682. * var sayHelloTo = _.partial(greet, 'hello');
  11683. * sayHelloTo('fred');
  11684. * // => 'hello fred'
  11685. *
  11686. * // Partially applied with placeholders.
  11687. * var greetFred = _.partial(greet, _, 'fred');
  11688. * greetFred('hi');
  11689. * // => 'hi fred'
  11690. */
  11691. var partial = baseRest(function(func, partials) {
  11692. var holders = replaceHolders(partials, getHolder(partial));
  11693. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  11694. });
  11695. /**
  11696. * This method is like `_.partial` except that partially applied arguments
  11697. * are appended to the arguments it receives.
  11698. *
  11699. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  11700. * builds, may be used as a placeholder for partially applied arguments.
  11701. *
  11702. * **Note:** This method doesn't set the "length" property of partially
  11703. * applied functions.
  11704. *
  11705. * @static
  11706. * @memberOf _
  11707. * @since 1.0.0
  11708. * @category Function
  11709. * @param {Function} func The function to partially apply arguments to.
  11710. * @param {...*} [partials] The arguments to be partially applied.
  11711. * @returns {Function} Returns the new partially applied function.
  11712. * @example
  11713. *
  11714. * function greet(greeting, name) {
  11715. * return greeting + ' ' + name;
  11716. * }
  11717. *
  11718. * var greetFred = _.partialRight(greet, 'fred');
  11719. * greetFred('hi');
  11720. * // => 'hi fred'
  11721. *
  11722. * // Partially applied with placeholders.
  11723. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  11724. * sayHelloTo('fred');
  11725. * // => 'hello fred'
  11726. */
  11727. var partialRight = baseRest(function(func, partials) {
  11728. var holders = replaceHolders(partials, getHolder(partialRight));
  11729. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  11730. });
  11731. /**
  11732. * Creates a function that invokes `func` with arguments arranged according
  11733. * to the specified `indexes` where the argument value at the first index is
  11734. * provided as the first argument, the argument value at the second index is
  11735. * provided as the second argument, and so on.
  11736. *
  11737. * @static
  11738. * @memberOf _
  11739. * @since 3.0.0
  11740. * @category Function
  11741. * @param {Function} func The function to rearrange arguments for.
  11742. * @param {...(number|number[])} indexes The arranged argument indexes.
  11743. * @returns {Function} Returns the new function.
  11744. * @example
  11745. *
  11746. * var rearged = _.rearg(function(a, b, c) {
  11747. * return [a, b, c];
  11748. * }, [2, 0, 1]);
  11749. *
  11750. * rearged('b', 'c', 'a')
  11751. * // => ['a', 'b', 'c']
  11752. */
  11753. var rearg = flatRest(function(func, indexes) {
  11754. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  11755. });
  11756. /**
  11757. * Creates a function that invokes `func` with the `this` binding of the
  11758. * created function and arguments from `start` and beyond provided as
  11759. * an array.
  11760. *
  11761. * **Note:** This method is based on the
  11762. * [rest parameter](https://mdn.io/rest_parameters).
  11763. *
  11764. * @static
  11765. * @memberOf _
  11766. * @since 4.0.0
  11767. * @category Function
  11768. * @param {Function} func The function to apply a rest parameter to.
  11769. * @param {number} [start=func.length-1] The start position of the rest parameter.
  11770. * @returns {Function} Returns the new function.
  11771. * @example
  11772. *
  11773. * var say = _.rest(function(what, names) {
  11774. * return what + ' ' + _.initial(names).join(', ') +
  11775. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  11776. * });
  11777. *
  11778. * say('hello', 'fred', 'barney', 'pebbles');
  11779. * // => 'hello fred, barney, & pebbles'
  11780. */
  11781. function rest(func, start) {
  11782. if (typeof func != 'function') {
  11783. throw new TypeError(FUNC_ERROR_TEXT);
  11784. }
  11785. start = start === undefined ? start : toInteger(start);
  11786. return baseRest(func, start);
  11787. }
  11788. /**
  11789. * Creates a function that invokes `func` with the `this` binding of the
  11790. * create function and an array of arguments much like
  11791. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  11792. *
  11793. * **Note:** This method is based on the
  11794. * [spread operator](https://mdn.io/spread_operator).
  11795. *
  11796. * @static
  11797. * @memberOf _
  11798. * @since 3.2.0
  11799. * @category Function
  11800. * @param {Function} func The function to spread arguments over.
  11801. * @param {number} [start=0] The start position of the spread.
  11802. * @returns {Function} Returns the new function.
  11803. * @example
  11804. *
  11805. * var say = _.spread(function(who, what) {
  11806. * return who + ' says ' + what;
  11807. * });
  11808. *
  11809. * say(['fred', 'hello']);
  11810. * // => 'fred says hello'
  11811. *
  11812. * var numbers = Promise.all([
  11813. * Promise.resolve(40),
  11814. * Promise.resolve(36)
  11815. * ]);
  11816. *
  11817. * numbers.then(_.spread(function(x, y) {
  11818. * return x + y;
  11819. * }));
  11820. * // => a Promise of 76
  11821. */
  11822. function spread(func, start) {
  11823. if (typeof func != 'function') {
  11824. throw new TypeError(FUNC_ERROR_TEXT);
  11825. }
  11826. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  11827. return baseRest(function(args) {
  11828. var array = args[start],
  11829. otherArgs = castSlice(args, 0, start);
  11830. if (array) {
  11831. arrayPush(otherArgs, array);
  11832. }
  11833. return apply(func, this, otherArgs);
  11834. });
  11835. }
  11836. /**
  11837. * Creates a throttled function that only invokes `func` at most once per
  11838. * every `wait` milliseconds. The throttled function comes with a `cancel`
  11839. * method to cancel delayed `func` invocations and a `flush` method to
  11840. * immediately invoke them. Provide `options` to indicate whether `func`
  11841. * should be invoked on the leading and/or trailing edge of the `wait`
  11842. * timeout. The `func` is invoked with the last arguments provided to the
  11843. * throttled function. Subsequent calls to the throttled function return the
  11844. * result of the last `func` invocation.
  11845. *
  11846. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  11847. * invoked on the trailing edge of the timeout only if the throttled function
  11848. * is invoked more than once during the `wait` timeout.
  11849. *
  11850. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  11851. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  11852. *
  11853. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  11854. * for details over the differences between `_.throttle` and `_.debounce`.
  11855. *
  11856. * @static
  11857. * @memberOf _
  11858. * @since 0.1.0
  11859. * @category Function
  11860. * @param {Function} func The function to throttle.
  11861. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  11862. * @param {Object} [options={}] The options object.
  11863. * @param {boolean} [options.leading=true]
  11864. * Specify invoking on the leading edge of the timeout.
  11865. * @param {boolean} [options.trailing=true]
  11866. * Specify invoking on the trailing edge of the timeout.
  11867. * @returns {Function} Returns the new throttled function.
  11868. * @example
  11869. *
  11870. * // Avoid excessively updating the position while scrolling.
  11871. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  11872. *
  11873. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  11874. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  11875. * jQuery(element).on('click', throttled);
  11876. *
  11877. * // Cancel the trailing throttled invocation.
  11878. * jQuery(window).on('popstate', throttled.cancel);
  11879. */
  11880. function throttle(func, wait, options) {
  11881. var leading = true,
  11882. trailing = true;
  11883. if (typeof func != 'function') {
  11884. throw new TypeError(FUNC_ERROR_TEXT);
  11885. }
  11886. if (isObject(options)) {
  11887. leading = 'leading' in options ? !!options.leading : leading;
  11888. trailing = 'trailing' in options ? !!options.trailing : trailing;
  11889. }
  11890. return debounce(func, wait, {
  11891. 'leading': leading,
  11892. 'maxWait': wait,
  11893. 'trailing': trailing
  11894. });
  11895. }
  11896. /**
  11897. * Creates a function that accepts up to one argument, ignoring any
  11898. * additional arguments.
  11899. *
  11900. * @static
  11901. * @memberOf _
  11902. * @since 4.0.0
  11903. * @category Function
  11904. * @param {Function} func The function to cap arguments for.
  11905. * @returns {Function} Returns the new capped function.
  11906. * @example
  11907. *
  11908. * _.map(['6', '8', '10'], _.unary(parseInt));
  11909. * // => [6, 8, 10]
  11910. */
  11911. function unary(func) {
  11912. return ary(func, 1);
  11913. }
  11914. /**
  11915. * Creates a function that provides `value` to `wrapper` as its first
  11916. * argument. Any additional arguments provided to the function are appended
  11917. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  11918. * binding of the created function.
  11919. *
  11920. * @static
  11921. * @memberOf _
  11922. * @since 0.1.0
  11923. * @category Function
  11924. * @param {*} value The value to wrap.
  11925. * @param {Function} [wrapper=identity] The wrapper function.
  11926. * @returns {Function} Returns the new function.
  11927. * @example
  11928. *
  11929. * var p = _.wrap(_.escape, function(func, text) {
  11930. * return '<p>' + func(text) + '</p>';
  11931. * });
  11932. *
  11933. * p('fred, barney, & pebbles');
  11934. * // => '<p>fred, barney, &amp; pebbles</p>'
  11935. */
  11936. function wrap(value, wrapper) {
  11937. return partial(castFunction(wrapper), value);
  11938. }
  11939. /*------------------------------------------------------------------------*/
  11940. /**
  11941. * Casts `value` as an array if it's not one.
  11942. *
  11943. * @static
  11944. * @memberOf _
  11945. * @since 4.4.0
  11946. * @category Lang
  11947. * @param {*} value The value to inspect.
  11948. * @returns {Array} Returns the cast array.
  11949. * @example
  11950. *
  11951. * _.castArray(1);
  11952. * // => [1]
  11953. *
  11954. * _.castArray({ 'a': 1 });
  11955. * // => [{ 'a': 1 }]
  11956. *
  11957. * _.castArray('abc');
  11958. * // => ['abc']
  11959. *
  11960. * _.castArray(null);
  11961. * // => [null]
  11962. *
  11963. * _.castArray(undefined);
  11964. * // => [undefined]
  11965. *
  11966. * _.castArray();
  11967. * // => []
  11968. *
  11969. * var array = [1, 2, 3];
  11970. * console.log(_.castArray(array) === array);
  11971. * // => true
  11972. */
  11973. function castArray() {
  11974. if (!arguments.length) {
  11975. return [];
  11976. }
  11977. var value = arguments[0];
  11978. return isArray(value) ? value : [value];
  11979. }
  11980. /**
  11981. * Creates a shallow clone of `value`.
  11982. *
  11983. * **Note:** This method is loosely based on the
  11984. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  11985. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  11986. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  11987. * arrays. The own enumerable properties of `arguments` objects are cloned
  11988. * as plain objects. An empty object is returned for uncloneable values such
  11989. * as error objects, functions, DOM nodes, and WeakMaps.
  11990. *
  11991. * @static
  11992. * @memberOf _
  11993. * @since 0.1.0
  11994. * @category Lang
  11995. * @param {*} value The value to clone.
  11996. * @returns {*} Returns the cloned value.
  11997. * @see _.cloneDeep
  11998. * @example
  11999. *
  12000. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  12001. *
  12002. * var shallow = _.clone(objects);
  12003. * console.log(shallow[0] === objects[0]);
  12004. * // => true
  12005. */
  12006. function clone(value) {
  12007. return baseClone(value, CLONE_SYMBOLS_FLAG);
  12008. }
  12009. /**
  12010. * This method is like `_.clone` except that it accepts `customizer` which
  12011. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  12012. * cloning is handled by the method instead. The `customizer` is invoked with
  12013. * up to four arguments; (value [, index|key, object, stack]).
  12014. *
  12015. * @static
  12016. * @memberOf _
  12017. * @since 4.0.0
  12018. * @category Lang
  12019. * @param {*} value The value to clone.
  12020. * @param {Function} [customizer] The function to customize cloning.
  12021. * @returns {*} Returns the cloned value.
  12022. * @see _.cloneDeepWith
  12023. * @example
  12024. *
  12025. * function customizer(value) {
  12026. * if (_.isElement(value)) {
  12027. * return value.cloneNode(false);
  12028. * }
  12029. * }
  12030. *
  12031. * var el = _.cloneWith(document.body, customizer);
  12032. *
  12033. * console.log(el === document.body);
  12034. * // => false
  12035. * console.log(el.nodeName);
  12036. * // => 'BODY'
  12037. * console.log(el.childNodes.length);
  12038. * // => 0
  12039. */
  12040. function cloneWith(value, customizer) {
  12041. customizer = typeof customizer == 'function' ? customizer : undefined;
  12042. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  12043. }
  12044. /**
  12045. * This method is like `_.clone` except that it recursively clones `value`.
  12046. *
  12047. * @static
  12048. * @memberOf _
  12049. * @since 1.0.0
  12050. * @category Lang
  12051. * @param {*} value The value to recursively clone.
  12052. * @returns {*} Returns the deep cloned value.
  12053. * @see _.clone
  12054. * @example
  12055. *
  12056. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  12057. *
  12058. * var deep = _.cloneDeep(objects);
  12059. * console.log(deep[0] === objects[0]);
  12060. * // => false
  12061. */
  12062. function cloneDeep(value) {
  12063. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  12064. }
  12065. /**
  12066. * This method is like `_.cloneWith` except that it recursively clones `value`.
  12067. *
  12068. * @static
  12069. * @memberOf _
  12070. * @since 4.0.0
  12071. * @category Lang
  12072. * @param {*} value The value to recursively clone.
  12073. * @param {Function} [customizer] The function to customize cloning.
  12074. * @returns {*} Returns the deep cloned value.
  12075. * @see _.cloneWith
  12076. * @example
  12077. *
  12078. * function customizer(value) {
  12079. * if (_.isElement(value)) {
  12080. * return value.cloneNode(true);
  12081. * }
  12082. * }
  12083. *
  12084. * var el = _.cloneDeepWith(document.body, customizer);
  12085. *
  12086. * console.log(el === document.body);
  12087. * // => false
  12088. * console.log(el.nodeName);
  12089. * // => 'BODY'
  12090. * console.log(el.childNodes.length);
  12091. * // => 20
  12092. */
  12093. function cloneDeepWith(value, customizer) {
  12094. customizer = typeof customizer == 'function' ? customizer : undefined;
  12095. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  12096. }
  12097. /**
  12098. * Checks if `object` conforms to `source` by invoking the predicate
  12099. * properties of `source` with the corresponding property values of `object`.
  12100. *
  12101. * **Note:** This method is equivalent to `_.conforms` when `source` is
  12102. * partially applied.
  12103. *
  12104. * @static
  12105. * @memberOf _
  12106. * @since 4.14.0
  12107. * @category Lang
  12108. * @param {Object} object The object to inspect.
  12109. * @param {Object} source The object of property predicates to conform to.
  12110. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  12111. * @example
  12112. *
  12113. * var object = { 'a': 1, 'b': 2 };
  12114. *
  12115. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  12116. * // => true
  12117. *
  12118. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  12119. * // => false
  12120. */
  12121. function conformsTo(object, source) {
  12122. return source == null || baseConformsTo(object, source, keys(source));
  12123. }
  12124. /**
  12125. * Performs a
  12126. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  12127. * comparison between two values to determine if they are equivalent.
  12128. *
  12129. * @static
  12130. * @memberOf _
  12131. * @since 4.0.0
  12132. * @category Lang
  12133. * @param {*} value The value to compare.
  12134. * @param {*} other The other value to compare.
  12135. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  12136. * @example
  12137. *
  12138. * var object = { 'a': 1 };
  12139. * var other = { 'a': 1 };
  12140. *
  12141. * _.eq(object, object);
  12142. * // => true
  12143. *
  12144. * _.eq(object, other);
  12145. * // => false
  12146. *
  12147. * _.eq('a', 'a');
  12148. * // => true
  12149. *
  12150. * _.eq('a', Object('a'));
  12151. * // => false
  12152. *
  12153. * _.eq(NaN, NaN);
  12154. * // => true
  12155. */
  12156. function eq(value, other) {
  12157. return value === other || (value !== value && other !== other);
  12158. }
  12159. /**
  12160. * Checks if `value` is greater than `other`.
  12161. *
  12162. * @static
  12163. * @memberOf _
  12164. * @since 3.9.0
  12165. * @category Lang
  12166. * @param {*} value The value to compare.
  12167. * @param {*} other The other value to compare.
  12168. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  12169. * else `false`.
  12170. * @see _.lt
  12171. * @example
  12172. *
  12173. * _.gt(3, 1);
  12174. * // => true
  12175. *
  12176. * _.gt(3, 3);
  12177. * // => false
  12178. *
  12179. * _.gt(1, 3);
  12180. * // => false
  12181. */
  12182. var gt = createRelationalOperation(baseGt);
  12183. /**
  12184. * Checks if `value` is greater than or equal to `other`.
  12185. *
  12186. * @static
  12187. * @memberOf _
  12188. * @since 3.9.0
  12189. * @category Lang
  12190. * @param {*} value The value to compare.
  12191. * @param {*} other The other value to compare.
  12192. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  12193. * `other`, else `false`.
  12194. * @see _.lte
  12195. * @example
  12196. *
  12197. * _.gte(3, 1);
  12198. * // => true
  12199. *
  12200. * _.gte(3, 3);
  12201. * // => true
  12202. *
  12203. * _.gte(1, 3);
  12204. * // => false
  12205. */
  12206. var gte = createRelationalOperation(function(value, other) {
  12207. return value >= other;
  12208. });
  12209. /**
  12210. * Checks if `value` is likely an `arguments` object.
  12211. *
  12212. * @static
  12213. * @memberOf _
  12214. * @since 0.1.0
  12215. * @category Lang
  12216. * @param {*} value The value to check.
  12217. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  12218. * else `false`.
  12219. * @example
  12220. *
  12221. * _.isArguments(function() { return arguments; }());
  12222. * // => true
  12223. *
  12224. * _.isArguments([1, 2, 3]);
  12225. * // => false
  12226. */
  12227. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  12228. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  12229. !propertyIsEnumerable.call(value, 'callee');
  12230. };
  12231. /**
  12232. * Checks if `value` is classified as an `Array` object.
  12233. *
  12234. * @static
  12235. * @memberOf _
  12236. * @since 0.1.0
  12237. * @category Lang
  12238. * @param {*} value The value to check.
  12239. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  12240. * @example
  12241. *
  12242. * _.isArray([1, 2, 3]);
  12243. * // => true
  12244. *
  12245. * _.isArray(document.body.children);
  12246. * // => false
  12247. *
  12248. * _.isArray('abc');
  12249. * // => false
  12250. *
  12251. * _.isArray(_.noop);
  12252. * // => false
  12253. */
  12254. var isArray = Array.isArray;
  12255. /**
  12256. * Checks if `value` is classified as an `ArrayBuffer` object.
  12257. *
  12258. * @static
  12259. * @memberOf _
  12260. * @since 4.3.0
  12261. * @category Lang
  12262. * @param {*} value The value to check.
  12263. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  12264. * @example
  12265. *
  12266. * _.isArrayBuffer(new ArrayBuffer(2));
  12267. * // => true
  12268. *
  12269. * _.isArrayBuffer(new Array(2));
  12270. * // => false
  12271. */
  12272. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  12273. /**
  12274. * Checks if `value` is array-like. A value is considered array-like if it's
  12275. * not a function and has a `value.length` that's an integer greater than or
  12276. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  12277. *
  12278. * @static
  12279. * @memberOf _
  12280. * @since 4.0.0
  12281. * @category Lang
  12282. * @param {*} value The value to check.
  12283. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  12284. * @example
  12285. *
  12286. * _.isArrayLike([1, 2, 3]);
  12287. * // => true
  12288. *
  12289. * _.isArrayLike(document.body.children);
  12290. * // => true
  12291. *
  12292. * _.isArrayLike('abc');
  12293. * // => true
  12294. *
  12295. * _.isArrayLike(_.noop);
  12296. * // => false
  12297. */
  12298. function isArrayLike(value) {
  12299. return value != null && isLength(value.length) && !isFunction(value);
  12300. }
  12301. /**
  12302. * This method is like `_.isArrayLike` except that it also checks if `value`
  12303. * is an object.
  12304. *
  12305. * @static
  12306. * @memberOf _
  12307. * @since 4.0.0
  12308. * @category Lang
  12309. * @param {*} value The value to check.
  12310. * @returns {boolean} Returns `true` if `value` is an array-like object,
  12311. * else `false`.
  12312. * @example
  12313. *
  12314. * _.isArrayLikeObject([1, 2, 3]);
  12315. * // => true
  12316. *
  12317. * _.isArrayLikeObject(document.body.children);
  12318. * // => true
  12319. *
  12320. * _.isArrayLikeObject('abc');
  12321. * // => false
  12322. *
  12323. * _.isArrayLikeObject(_.noop);
  12324. * // => false
  12325. */
  12326. function isArrayLikeObject(value) {
  12327. return isObjectLike(value) && isArrayLike(value);
  12328. }
  12329. /**
  12330. * Checks if `value` is classified as a boolean primitive or object.
  12331. *
  12332. * @static
  12333. * @memberOf _
  12334. * @since 0.1.0
  12335. * @category Lang
  12336. * @param {*} value The value to check.
  12337. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  12338. * @example
  12339. *
  12340. * _.isBoolean(false);
  12341. * // => true
  12342. *
  12343. * _.isBoolean(null);
  12344. * // => false
  12345. */
  12346. function isBoolean(value) {
  12347. return value === true || value === false ||
  12348. (isObjectLike(value) && baseGetTag(value) == boolTag);
  12349. }
  12350. /**
  12351. * Checks if `value` is a buffer.
  12352. *
  12353. * @static
  12354. * @memberOf _
  12355. * @since 4.3.0
  12356. * @category Lang
  12357. * @param {*} value The value to check.
  12358. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  12359. * @example
  12360. *
  12361. * _.isBuffer(new Buffer(2));
  12362. * // => true
  12363. *
  12364. * _.isBuffer(new Uint8Array(2));
  12365. * // => false
  12366. */
  12367. var isBuffer = nativeIsBuffer || stubFalse;
  12368. /**
  12369. * Checks if `value` is classified as a `Date` object.
  12370. *
  12371. * @static
  12372. * @memberOf _
  12373. * @since 0.1.0
  12374. * @category Lang
  12375. * @param {*} value The value to check.
  12376. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  12377. * @example
  12378. *
  12379. * _.isDate(new Date);
  12380. * // => true
  12381. *
  12382. * _.isDate('Mon April 23 2012');
  12383. * // => false
  12384. */
  12385. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  12386. /**
  12387. * Checks if `value` is likely a DOM element.
  12388. *
  12389. * @static
  12390. * @memberOf _
  12391. * @since 0.1.0
  12392. * @category Lang
  12393. * @param {*} value The value to check.
  12394. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  12395. * @example
  12396. *
  12397. * _.isElement(document.body);
  12398. * // => true
  12399. *
  12400. * _.isElement('<body>');
  12401. * // => false
  12402. */
  12403. function isElement(value) {
  12404. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  12405. }
  12406. /**
  12407. * Checks if `value` is an empty object, collection, map, or set.
  12408. *
  12409. * Objects are considered empty if they have no own enumerable string keyed
  12410. * properties.
  12411. *
  12412. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  12413. * jQuery-like collections are considered empty if they have a `length` of `0`.
  12414. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  12415. *
  12416. * @static
  12417. * @memberOf _
  12418. * @since 0.1.0
  12419. * @category Lang
  12420. * @param {*} value The value to check.
  12421. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  12422. * @example
  12423. *
  12424. * _.isEmpty(null);
  12425. * // => true
  12426. *
  12427. * _.isEmpty(true);
  12428. * // => true
  12429. *
  12430. * _.isEmpty(1);
  12431. * // => true
  12432. *
  12433. * _.isEmpty([1, 2, 3]);
  12434. * // => false
  12435. *
  12436. * _.isEmpty({ 'a': 1 });
  12437. * // => false
  12438. */
  12439. function isEmpty(value) {
  12440. if (value == null) {
  12441. return true;
  12442. }
  12443. if (isArrayLike(value) &&
  12444. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  12445. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  12446. return !value.length;
  12447. }
  12448. var tag = getTag(value);
  12449. if (tag == mapTag || tag == setTag) {
  12450. return !value.size;
  12451. }
  12452. if (isPrototype(value)) {
  12453. return !baseKeys(value).length;
  12454. }
  12455. for (var key in value) {
  12456. if (hasOwnProperty.call(value, key)) {
  12457. return false;
  12458. }
  12459. }
  12460. return true;
  12461. }
  12462. /**
  12463. * Performs a deep comparison between two values to determine if they are
  12464. * equivalent.
  12465. *
  12466. * **Note:** This method supports comparing arrays, array buffers, booleans,
  12467. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  12468. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  12469. * by their own, not inherited, enumerable properties. Functions and DOM
  12470. * nodes are compared by strict equality, i.e. `===`.
  12471. *
  12472. * @static
  12473. * @memberOf _
  12474. * @since 0.1.0
  12475. * @category Lang
  12476. * @param {*} value The value to compare.
  12477. * @param {*} other The other value to compare.
  12478. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  12479. * @example
  12480. *
  12481. * var object = { 'a': 1 };
  12482. * var other = { 'a': 1 };
  12483. *
  12484. * _.isEqual(object, other);
  12485. * // => true
  12486. *
  12487. * object === other;
  12488. * // => false
  12489. */
  12490. function isEqual(value, other) {
  12491. return baseIsEqual(value, other);
  12492. }
  12493. /**
  12494. * This method is like `_.isEqual` except that it accepts `customizer` which
  12495. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  12496. * are handled by the method instead. The `customizer` is invoked with up to
  12497. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  12498. *
  12499. * @static
  12500. * @memberOf _
  12501. * @since 4.0.0
  12502. * @category Lang
  12503. * @param {*} value The value to compare.
  12504. * @param {*} other The other value to compare.
  12505. * @param {Function} [customizer] The function to customize comparisons.
  12506. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  12507. * @example
  12508. *
  12509. * function isGreeting(value) {
  12510. * return /^h(?:i|ello)$/.test(value);
  12511. * }
  12512. *
  12513. * function customizer(objValue, othValue) {
  12514. * if (isGreeting(objValue) && isGreeting(othValue)) {
  12515. * return true;
  12516. * }
  12517. * }
  12518. *
  12519. * var array = ['hello', 'goodbye'];
  12520. * var other = ['hi', 'goodbye'];
  12521. *
  12522. * _.isEqualWith(array, other, customizer);
  12523. * // => true
  12524. */
  12525. function isEqualWith(value, other, customizer) {
  12526. customizer = typeof customizer == 'function' ? customizer : undefined;
  12527. var result = customizer ? customizer(value, other) : undefined;
  12528. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  12529. }
  12530. /**
  12531. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  12532. * `SyntaxError`, `TypeError`, or `URIError` object.
  12533. *
  12534. * @static
  12535. * @memberOf _
  12536. * @since 3.0.0
  12537. * @category Lang
  12538. * @param {*} value The value to check.
  12539. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  12540. * @example
  12541. *
  12542. * _.isError(new Error);
  12543. * // => true
  12544. *
  12545. * _.isError(Error);
  12546. * // => false
  12547. */
  12548. function isError(value) {
  12549. if (!isObjectLike(value)) {
  12550. return false;
  12551. }
  12552. var tag = baseGetTag(value);
  12553. return tag == errorTag || tag == domExcTag ||
  12554. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  12555. }
  12556. /**
  12557. * Checks if `value` is a finite primitive number.
  12558. *
  12559. * **Note:** This method is based on
  12560. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  12561. *
  12562. * @static
  12563. * @memberOf _
  12564. * @since 0.1.0
  12565. * @category Lang
  12566. * @param {*} value The value to check.
  12567. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  12568. * @example
  12569. *
  12570. * _.isFinite(3);
  12571. * // => true
  12572. *
  12573. * _.isFinite(Number.MIN_VALUE);
  12574. * // => true
  12575. *
  12576. * _.isFinite(Infinity);
  12577. * // => false
  12578. *
  12579. * _.isFinite('3');
  12580. * // => false
  12581. */
  12582. function isFinite(value) {
  12583. return typeof value == 'number' && nativeIsFinite(value);
  12584. }
  12585. /**
  12586. * Checks if `value` is classified as a `Function` object.
  12587. *
  12588. * @static
  12589. * @memberOf _
  12590. * @since 0.1.0
  12591. * @category Lang
  12592. * @param {*} value The value to check.
  12593. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  12594. * @example
  12595. *
  12596. * _.isFunction(_);
  12597. * // => true
  12598. *
  12599. * _.isFunction(/abc/);
  12600. * // => false
  12601. */
  12602. function isFunction(value) {
  12603. if (!isObject(value)) {
  12604. return false;
  12605. }
  12606. // The use of `Object#toString` avoids issues with the `typeof` operator
  12607. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  12608. var tag = baseGetTag(value);
  12609. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  12610. }
  12611. /**
  12612. * Checks if `value` is an integer.
  12613. *
  12614. * **Note:** This method is based on
  12615. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  12616. *
  12617. * @static
  12618. * @memberOf _
  12619. * @since 4.0.0
  12620. * @category Lang
  12621. * @param {*} value The value to check.
  12622. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  12623. * @example
  12624. *
  12625. * _.isInteger(3);
  12626. * // => true
  12627. *
  12628. * _.isInteger(Number.MIN_VALUE);
  12629. * // => false
  12630. *
  12631. * _.isInteger(Infinity);
  12632. * // => false
  12633. *
  12634. * _.isInteger('3');
  12635. * // => false
  12636. */
  12637. function isInteger(value) {
  12638. return typeof value == 'number' && value == toInteger(value);
  12639. }
  12640. /**
  12641. * Checks if `value` is a valid array-like length.
  12642. *
  12643. * **Note:** This method is loosely based on
  12644. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  12645. *
  12646. * @static
  12647. * @memberOf _
  12648. * @since 4.0.0
  12649. * @category Lang
  12650. * @param {*} value The value to check.
  12651. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  12652. * @example
  12653. *
  12654. * _.isLength(3);
  12655. * // => true
  12656. *
  12657. * _.isLength(Number.MIN_VALUE);
  12658. * // => false
  12659. *
  12660. * _.isLength(Infinity);
  12661. * // => false
  12662. *
  12663. * _.isLength('3');
  12664. * // => false
  12665. */
  12666. function isLength(value) {
  12667. return typeof value == 'number' &&
  12668. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  12669. }
  12670. /**
  12671. * Checks if `value` is the
  12672. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  12673. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  12674. *
  12675. * @static
  12676. * @memberOf _
  12677. * @since 0.1.0
  12678. * @category Lang
  12679. * @param {*} value The value to check.
  12680. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  12681. * @example
  12682. *
  12683. * _.isObject({});
  12684. * // => true
  12685. *
  12686. * _.isObject([1, 2, 3]);
  12687. * // => true
  12688. *
  12689. * _.isObject(_.noop);
  12690. * // => true
  12691. *
  12692. * _.isObject(null);
  12693. * // => false
  12694. */
  12695. function isObject(value) {
  12696. var type = typeof value;
  12697. return value != null && (type == 'object' || type == 'function');
  12698. }
  12699. /**
  12700. * Checks if `value` is object-like. A value is object-like if it's not `null`
  12701. * and has a `typeof` result of "object".
  12702. *
  12703. * @static
  12704. * @memberOf _
  12705. * @since 4.0.0
  12706. * @category Lang
  12707. * @param {*} value The value to check.
  12708. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  12709. * @example
  12710. *
  12711. * _.isObjectLike({});
  12712. * // => true
  12713. *
  12714. * _.isObjectLike([1, 2, 3]);
  12715. * // => true
  12716. *
  12717. * _.isObjectLike(_.noop);
  12718. * // => false
  12719. *
  12720. * _.isObjectLike(null);
  12721. * // => false
  12722. */
  12723. function isObjectLike(value) {
  12724. return value != null && typeof value == 'object';
  12725. }
  12726. /**
  12727. * Checks if `value` is classified as a `Map` object.
  12728. *
  12729. * @static
  12730. * @memberOf _
  12731. * @since 4.3.0
  12732. * @category Lang
  12733. * @param {*} value The value to check.
  12734. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  12735. * @example
  12736. *
  12737. * _.isMap(new Map);
  12738. * // => true
  12739. *
  12740. * _.isMap(new WeakMap);
  12741. * // => false
  12742. */
  12743. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  12744. /**
  12745. * Performs a partial deep comparison between `object` and `source` to
  12746. * determine if `object` contains equivalent property values.
  12747. *
  12748. * **Note:** This method is equivalent to `_.matches` when `source` is
  12749. * partially applied.
  12750. *
  12751. * Partial comparisons will match empty array and empty object `source`
  12752. * values against any array or object value, respectively. See `_.isEqual`
  12753. * for a list of supported value comparisons.
  12754. *
  12755. * @static
  12756. * @memberOf _
  12757. * @since 3.0.0
  12758. * @category Lang
  12759. * @param {Object} object The object to inspect.
  12760. * @param {Object} source The object of property values to match.
  12761. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  12762. * @example
  12763. *
  12764. * var object = { 'a': 1, 'b': 2 };
  12765. *
  12766. * _.isMatch(object, { 'b': 2 });
  12767. * // => true
  12768. *
  12769. * _.isMatch(object, { 'b': 1 });
  12770. * // => false
  12771. */
  12772. function isMatch(object, source) {
  12773. return object === source || baseIsMatch(object, source, getMatchData(source));
  12774. }
  12775. /**
  12776. * This method is like `_.isMatch` except that it accepts `customizer` which
  12777. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  12778. * are handled by the method instead. The `customizer` is invoked with five
  12779. * arguments: (objValue, srcValue, index|key, object, source).
  12780. *
  12781. * @static
  12782. * @memberOf _
  12783. * @since 4.0.0
  12784. * @category Lang
  12785. * @param {Object} object The object to inspect.
  12786. * @param {Object} source The object of property values to match.
  12787. * @param {Function} [customizer] The function to customize comparisons.
  12788. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  12789. * @example
  12790. *
  12791. * function isGreeting(value) {
  12792. * return /^h(?:i|ello)$/.test(value);
  12793. * }
  12794. *
  12795. * function customizer(objValue, srcValue) {
  12796. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  12797. * return true;
  12798. * }
  12799. * }
  12800. *
  12801. * var object = { 'greeting': 'hello' };
  12802. * var source = { 'greeting': 'hi' };
  12803. *
  12804. * _.isMatchWith(object, source, customizer);
  12805. * // => true
  12806. */
  12807. function isMatchWith(object, source, customizer) {
  12808. customizer = typeof customizer == 'function' ? customizer : undefined;
  12809. return baseIsMatch(object, source, getMatchData(source), customizer);
  12810. }
  12811. /**
  12812. * Checks if `value` is `NaN`.
  12813. *
  12814. * **Note:** This method is based on
  12815. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  12816. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  12817. * `undefined` and other non-number values.
  12818. *
  12819. * @static
  12820. * @memberOf _
  12821. * @since 0.1.0
  12822. * @category Lang
  12823. * @param {*} value The value to check.
  12824. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  12825. * @example
  12826. *
  12827. * _.isNaN(NaN);
  12828. * // => true
  12829. *
  12830. * _.isNaN(new Number(NaN));
  12831. * // => true
  12832. *
  12833. * isNaN(undefined);
  12834. * // => true
  12835. *
  12836. * _.isNaN(undefined);
  12837. * // => false
  12838. */
  12839. function isNaN(value) {
  12840. // An `NaN` primitive is the only value that is not equal to itself.
  12841. // Perform the `toStringTag` check first to avoid errors with some
  12842. // ActiveX objects in IE.
  12843. return isNumber(value) && value != +value;
  12844. }
  12845. /**
  12846. * Checks if `value` is a pristine native function.
  12847. *
  12848. * **Note:** This method can't reliably detect native functions in the presence
  12849. * of the core-js package because core-js circumvents this kind of detection.
  12850. * Despite multiple requests, the core-js maintainer has made it clear: any
  12851. * attempt to fix the detection will be obstructed. As a result, we're left
  12852. * with little choice but to throw an error. Unfortunately, this also affects
  12853. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  12854. * which rely on core-js.
  12855. *
  12856. * @static
  12857. * @memberOf _
  12858. * @since 3.0.0
  12859. * @category Lang
  12860. * @param {*} value The value to check.
  12861. * @returns {boolean} Returns `true` if `value` is a native function,
  12862. * else `false`.
  12863. * @example
  12864. *
  12865. * _.isNative(Array.prototype.push);
  12866. * // => true
  12867. *
  12868. * _.isNative(_);
  12869. * // => false
  12870. */
  12871. function isNative(value) {
  12872. if (isMaskable(value)) {
  12873. throw new Error(CORE_ERROR_TEXT);
  12874. }
  12875. return baseIsNative(value);
  12876. }
  12877. /**
  12878. * Checks if `value` is `null`.
  12879. *
  12880. * @static
  12881. * @memberOf _
  12882. * @since 0.1.0
  12883. * @category Lang
  12884. * @param {*} value The value to check.
  12885. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  12886. * @example
  12887. *
  12888. * _.isNull(null);
  12889. * // => true
  12890. *
  12891. * _.isNull(void 0);
  12892. * // => false
  12893. */
  12894. function isNull(value) {
  12895. return value === null;
  12896. }
  12897. /**
  12898. * Checks if `value` is `null` or `undefined`.
  12899. *
  12900. * @static
  12901. * @memberOf _
  12902. * @since 4.0.0
  12903. * @category Lang
  12904. * @param {*} value The value to check.
  12905. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  12906. * @example
  12907. *
  12908. * _.isNil(null);
  12909. * // => true
  12910. *
  12911. * _.isNil(void 0);
  12912. * // => true
  12913. *
  12914. * _.isNil(NaN);
  12915. * // => false
  12916. */
  12917. function isNil(value) {
  12918. return value == null;
  12919. }
  12920. /**
  12921. * Checks if `value` is classified as a `Number` primitive or object.
  12922. *
  12923. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  12924. * classified as numbers, use the `_.isFinite` method.
  12925. *
  12926. * @static
  12927. * @memberOf _
  12928. * @since 0.1.0
  12929. * @category Lang
  12930. * @param {*} value The value to check.
  12931. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  12932. * @example
  12933. *
  12934. * _.isNumber(3);
  12935. * // => true
  12936. *
  12937. * _.isNumber(Number.MIN_VALUE);
  12938. * // => true
  12939. *
  12940. * _.isNumber(Infinity);
  12941. * // => true
  12942. *
  12943. * _.isNumber('3');
  12944. * // => false
  12945. */
  12946. function isNumber(value) {
  12947. return typeof value == 'number' ||
  12948. (isObjectLike(value) && baseGetTag(value) == numberTag);
  12949. }
  12950. /**
  12951. * Checks if `value` is a plain object, that is, an object created by the
  12952. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  12953. *
  12954. * @static
  12955. * @memberOf _
  12956. * @since 0.8.0
  12957. * @category Lang
  12958. * @param {*} value The value to check.
  12959. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  12960. * @example
  12961. *
  12962. * function Foo() {
  12963. * this.a = 1;
  12964. * }
  12965. *
  12966. * _.isPlainObject(new Foo);
  12967. * // => false
  12968. *
  12969. * _.isPlainObject([1, 2, 3]);
  12970. * // => false
  12971. *
  12972. * _.isPlainObject({ 'x': 0, 'y': 0 });
  12973. * // => true
  12974. *
  12975. * _.isPlainObject(Object.create(null));
  12976. * // => true
  12977. */
  12978. function isPlainObject(value) {
  12979. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  12980. return false;
  12981. }
  12982. var proto = getPrototype(value);
  12983. if (proto === null) {
  12984. return true;
  12985. }
  12986. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  12987. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  12988. funcToString.call(Ctor) == objectCtorString;
  12989. }
  12990. /**
  12991. * Checks if `value` is classified as a `RegExp` object.
  12992. *
  12993. * @static
  12994. * @memberOf _
  12995. * @since 0.1.0
  12996. * @category Lang
  12997. * @param {*} value The value to check.
  12998. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  12999. * @example
  13000. *
  13001. * _.isRegExp(/abc/);
  13002. * // => true
  13003. *
  13004. * _.isRegExp('/abc/');
  13005. * // => false
  13006. */
  13007. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  13008. /**
  13009. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  13010. * double precision number which isn't the result of a rounded unsafe integer.
  13011. *
  13012. * **Note:** This method is based on
  13013. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  13014. *
  13015. * @static
  13016. * @memberOf _
  13017. * @since 4.0.0
  13018. * @category Lang
  13019. * @param {*} value The value to check.
  13020. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  13021. * @example
  13022. *
  13023. * _.isSafeInteger(3);
  13024. * // => true
  13025. *
  13026. * _.isSafeInteger(Number.MIN_VALUE);
  13027. * // => false
  13028. *
  13029. * _.isSafeInteger(Infinity);
  13030. * // => false
  13031. *
  13032. * _.isSafeInteger('3');
  13033. * // => false
  13034. */
  13035. function isSafeInteger(value) {
  13036. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  13037. }
  13038. /**
  13039. * Checks if `value` is classified as a `Set` object.
  13040. *
  13041. * @static
  13042. * @memberOf _
  13043. * @since 4.3.0
  13044. * @category Lang
  13045. * @param {*} value The value to check.
  13046. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  13047. * @example
  13048. *
  13049. * _.isSet(new Set);
  13050. * // => true
  13051. *
  13052. * _.isSet(new WeakSet);
  13053. * // => false
  13054. */
  13055. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  13056. /**
  13057. * Checks if `value` is classified as a `String` primitive or object.
  13058. *
  13059. * @static
  13060. * @since 0.1.0
  13061. * @memberOf _
  13062. * @category Lang
  13063. * @param {*} value The value to check.
  13064. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  13065. * @example
  13066. *
  13067. * _.isString('abc');
  13068. * // => true
  13069. *
  13070. * _.isString(1);
  13071. * // => false
  13072. */
  13073. function isString(value) {
  13074. return typeof value == 'string' ||
  13075. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  13076. }
  13077. /**
  13078. * Checks if `value` is classified as a `Symbol` primitive or object.
  13079. *
  13080. * @static
  13081. * @memberOf _
  13082. * @since 4.0.0
  13083. * @category Lang
  13084. * @param {*} value The value to check.
  13085. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  13086. * @example
  13087. *
  13088. * _.isSymbol(Symbol.iterator);
  13089. * // => true
  13090. *
  13091. * _.isSymbol('abc');
  13092. * // => false
  13093. */
  13094. function isSymbol(value) {
  13095. return typeof value == 'symbol' ||
  13096. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  13097. }
  13098. /**
  13099. * Checks if `value` is classified as a typed array.
  13100. *
  13101. * @static
  13102. * @memberOf _
  13103. * @since 3.0.0
  13104. * @category Lang
  13105. * @param {*} value The value to check.
  13106. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  13107. * @example
  13108. *
  13109. * _.isTypedArray(new Uint8Array);
  13110. * // => true
  13111. *
  13112. * _.isTypedArray([]);
  13113. * // => false
  13114. */
  13115. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  13116. /**
  13117. * Checks if `value` is `undefined`.
  13118. *
  13119. * @static
  13120. * @since 0.1.0
  13121. * @memberOf _
  13122. * @category Lang
  13123. * @param {*} value The value to check.
  13124. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  13125. * @example
  13126. *
  13127. * _.isUndefined(void 0);
  13128. * // => true
  13129. *
  13130. * _.isUndefined(null);
  13131. * // => false
  13132. */
  13133. function isUndefined(value) {
  13134. return value === undefined;
  13135. }
  13136. /**
  13137. * Checks if `value` is classified as a `WeakMap` object.
  13138. *
  13139. * @static
  13140. * @memberOf _
  13141. * @since 4.3.0
  13142. * @category Lang
  13143. * @param {*} value The value to check.
  13144. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  13145. * @example
  13146. *
  13147. * _.isWeakMap(new WeakMap);
  13148. * // => true
  13149. *
  13150. * _.isWeakMap(new Map);
  13151. * // => false
  13152. */
  13153. function isWeakMap(value) {
  13154. return isObjectLike(value) && getTag(value) == weakMapTag;
  13155. }
  13156. /**
  13157. * Checks if `value` is classified as a `WeakSet` object.
  13158. *
  13159. * @static
  13160. * @memberOf _
  13161. * @since 4.3.0
  13162. * @category Lang
  13163. * @param {*} value The value to check.
  13164. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  13165. * @example
  13166. *
  13167. * _.isWeakSet(new WeakSet);
  13168. * // => true
  13169. *
  13170. * _.isWeakSet(new Set);
  13171. * // => false
  13172. */
  13173. function isWeakSet(value) {
  13174. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  13175. }
  13176. /**
  13177. * Checks if `value` is less than `other`.
  13178. *
  13179. * @static
  13180. * @memberOf _
  13181. * @since 3.9.0
  13182. * @category Lang
  13183. * @param {*} value The value to compare.
  13184. * @param {*} other The other value to compare.
  13185. * @returns {boolean} Returns `true` if `value` is less than `other`,
  13186. * else `false`.
  13187. * @see _.gt
  13188. * @example
  13189. *
  13190. * _.lt(1, 3);
  13191. * // => true
  13192. *
  13193. * _.lt(3, 3);
  13194. * // => false
  13195. *
  13196. * _.lt(3, 1);
  13197. * // => false
  13198. */
  13199. var lt = createRelationalOperation(baseLt);
  13200. /**
  13201. * Checks if `value` is less than or equal to `other`.
  13202. *
  13203. * @static
  13204. * @memberOf _
  13205. * @since 3.9.0
  13206. * @category Lang
  13207. * @param {*} value The value to compare.
  13208. * @param {*} other The other value to compare.
  13209. * @returns {boolean} Returns `true` if `value` is less than or equal to
  13210. * `other`, else `false`.
  13211. * @see _.gte
  13212. * @example
  13213. *
  13214. * _.lte(1, 3);
  13215. * // => true
  13216. *
  13217. * _.lte(3, 3);
  13218. * // => true
  13219. *
  13220. * _.lte(3, 1);
  13221. * // => false
  13222. */
  13223. var lte = createRelationalOperation(function(value, other) {
  13224. return value <= other;
  13225. });
  13226. /**
  13227. * Converts `value` to an array.
  13228. *
  13229. * @static
  13230. * @since 0.1.0
  13231. * @memberOf _
  13232. * @category Lang
  13233. * @param {*} value The value to convert.
  13234. * @returns {Array} Returns the converted array.
  13235. * @example
  13236. *
  13237. * _.toArray({ 'a': 1, 'b': 2 });
  13238. * // => [1, 2]
  13239. *
  13240. * _.toArray('abc');
  13241. * // => ['a', 'b', 'c']
  13242. *
  13243. * _.toArray(1);
  13244. * // => []
  13245. *
  13246. * _.toArray(null);
  13247. * // => []
  13248. */
  13249. function toArray(value) {
  13250. if (!value) {
  13251. return [];
  13252. }
  13253. if (isArrayLike(value)) {
  13254. return isString(value) ? stringToArray(value) : copyArray(value);
  13255. }
  13256. if (symIterator && value[symIterator]) {
  13257. return iteratorToArray(value[symIterator]());
  13258. }
  13259. var tag = getTag(value),
  13260. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  13261. return func(value);
  13262. }
  13263. /**
  13264. * Converts `value` to a finite number.
  13265. *
  13266. * @static
  13267. * @memberOf _
  13268. * @since 4.12.0
  13269. * @category Lang
  13270. * @param {*} value The value to convert.
  13271. * @returns {number} Returns the converted number.
  13272. * @example
  13273. *
  13274. * _.toFinite(3.2);
  13275. * // => 3.2
  13276. *
  13277. * _.toFinite(Number.MIN_VALUE);
  13278. * // => 5e-324
  13279. *
  13280. * _.toFinite(Infinity);
  13281. * // => 1.7976931348623157e+308
  13282. *
  13283. * _.toFinite('3.2');
  13284. * // => 3.2
  13285. */
  13286. function toFinite(value) {
  13287. if (!value) {
  13288. return value === 0 ? value : 0;
  13289. }
  13290. value = toNumber(value);
  13291. if (value === INFINITY || value === -INFINITY) {
  13292. var sign = (value < 0 ? -1 : 1);
  13293. return sign * MAX_INTEGER;
  13294. }
  13295. return value === value ? value : 0;
  13296. }
  13297. /**
  13298. * Converts `value` to an integer.
  13299. *
  13300. * **Note:** This method is loosely based on
  13301. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  13302. *
  13303. * @static
  13304. * @memberOf _
  13305. * @since 4.0.0
  13306. * @category Lang
  13307. * @param {*} value The value to convert.
  13308. * @returns {number} Returns the converted integer.
  13309. * @example
  13310. *
  13311. * _.toInteger(3.2);
  13312. * // => 3
  13313. *
  13314. * _.toInteger(Number.MIN_VALUE);
  13315. * // => 0
  13316. *
  13317. * _.toInteger(Infinity);
  13318. * // => 1.7976931348623157e+308
  13319. *
  13320. * _.toInteger('3.2');
  13321. * // => 3
  13322. */
  13323. function toInteger(value) {
  13324. var result = toFinite(value),
  13325. remainder = result % 1;
  13326. return result === result ? (remainder ? result - remainder : result) : 0;
  13327. }
  13328. /**
  13329. * Converts `value` to an integer suitable for use as the length of an
  13330. * array-like object.
  13331. *
  13332. * **Note:** This method is based on
  13333. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  13334. *
  13335. * @static
  13336. * @memberOf _
  13337. * @since 4.0.0
  13338. * @category Lang
  13339. * @param {*} value The value to convert.
  13340. * @returns {number} Returns the converted integer.
  13341. * @example
  13342. *
  13343. * _.toLength(3.2);
  13344. * // => 3
  13345. *
  13346. * _.toLength(Number.MIN_VALUE);
  13347. * // => 0
  13348. *
  13349. * _.toLength(Infinity);
  13350. * // => 4294967295
  13351. *
  13352. * _.toLength('3.2');
  13353. * // => 3
  13354. */
  13355. function toLength(value) {
  13356. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  13357. }
  13358. /**
  13359. * Converts `value` to a number.
  13360. *
  13361. * @static
  13362. * @memberOf _
  13363. * @since 4.0.0
  13364. * @category Lang
  13365. * @param {*} value The value to process.
  13366. * @returns {number} Returns the number.
  13367. * @example
  13368. *
  13369. * _.toNumber(3.2);
  13370. * // => 3.2
  13371. *
  13372. * _.toNumber(Number.MIN_VALUE);
  13373. * // => 5e-324
  13374. *
  13375. * _.toNumber(Infinity);
  13376. * // => Infinity
  13377. *
  13378. * _.toNumber('3.2');
  13379. * // => 3.2
  13380. */
  13381. function toNumber(value) {
  13382. if (typeof value == 'number') {
  13383. return value;
  13384. }
  13385. if (isSymbol(value)) {
  13386. return NAN;
  13387. }
  13388. if (isObject(value)) {
  13389. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  13390. value = isObject(other) ? (other + '') : other;
  13391. }
  13392. if (typeof value != 'string') {
  13393. return value === 0 ? value : +value;
  13394. }
  13395. value = baseTrim(value);
  13396. var isBinary = reIsBinary.test(value);
  13397. return (isBinary || reIsOctal.test(value))
  13398. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  13399. : (reIsBadHex.test(value) ? NAN : +value);
  13400. }
  13401. /**
  13402. * Converts `value` to a plain object flattening inherited enumerable string
  13403. * keyed properties of `value` to own properties of the plain object.
  13404. *
  13405. * @static
  13406. * @memberOf _
  13407. * @since 3.0.0
  13408. * @category Lang
  13409. * @param {*} value The value to convert.
  13410. * @returns {Object} Returns the converted plain object.
  13411. * @example
  13412. *
  13413. * function Foo() {
  13414. * this.b = 2;
  13415. * }
  13416. *
  13417. * Foo.prototype.c = 3;
  13418. *
  13419. * _.assign({ 'a': 1 }, new Foo);
  13420. * // => { 'a': 1, 'b': 2 }
  13421. *
  13422. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  13423. * // => { 'a': 1, 'b': 2, 'c': 3 }
  13424. */
  13425. function toPlainObject(value) {
  13426. return copyObject(value, keysIn(value));
  13427. }
  13428. /**
  13429. * Converts `value` to a safe integer. A safe integer can be compared and
  13430. * represented correctly.
  13431. *
  13432. * @static
  13433. * @memberOf _
  13434. * @since 4.0.0
  13435. * @category Lang
  13436. * @param {*} value The value to convert.
  13437. * @returns {number} Returns the converted integer.
  13438. * @example
  13439. *
  13440. * _.toSafeInteger(3.2);
  13441. * // => 3
  13442. *
  13443. * _.toSafeInteger(Number.MIN_VALUE);
  13444. * // => 0
  13445. *
  13446. * _.toSafeInteger(Infinity);
  13447. * // => 9007199254740991
  13448. *
  13449. * _.toSafeInteger('3.2');
  13450. * // => 3
  13451. */
  13452. function toSafeInteger(value) {
  13453. return value
  13454. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  13455. : (value === 0 ? value : 0);
  13456. }
  13457. /**
  13458. * Converts `value` to a string. An empty string is returned for `null`
  13459. * and `undefined` values. The sign of `-0` is preserved.
  13460. *
  13461. * @static
  13462. * @memberOf _
  13463. * @since 4.0.0
  13464. * @category Lang
  13465. * @param {*} value The value to convert.
  13466. * @returns {string} Returns the converted string.
  13467. * @example
  13468. *
  13469. * _.toString(null);
  13470. * // => ''
  13471. *
  13472. * _.toString(-0);
  13473. * // => '-0'
  13474. *
  13475. * _.toString([1, 2, 3]);
  13476. * // => '1,2,3'
  13477. */
  13478. function toString(value) {
  13479. return value == null ? '' : baseToString(value);
  13480. }
  13481. /*------------------------------------------------------------------------*/
  13482. /**
  13483. * Assigns own enumerable string keyed properties of source objects to the
  13484. * destination object. Source objects are applied from left to right.
  13485. * Subsequent sources overwrite property assignments of previous sources.
  13486. *
  13487. * **Note:** This method mutates `object` and is loosely based on
  13488. * [`Object.assign`](https://mdn.io/Object/assign).
  13489. *
  13490. * @static
  13491. * @memberOf _
  13492. * @since 0.10.0
  13493. * @category Object
  13494. * @param {Object} object The destination object.
  13495. * @param {...Object} [sources] The source objects.
  13496. * @returns {Object} Returns `object`.
  13497. * @see _.assignIn
  13498. * @example
  13499. *
  13500. * function Foo() {
  13501. * this.a = 1;
  13502. * }
  13503. *
  13504. * function Bar() {
  13505. * this.c = 3;
  13506. * }
  13507. *
  13508. * Foo.prototype.b = 2;
  13509. * Bar.prototype.d = 4;
  13510. *
  13511. * _.assign({ 'a': 0 }, new Foo, new Bar);
  13512. * // => { 'a': 1, 'c': 3 }
  13513. */
  13514. var assign = createAssigner(function(object, source) {
  13515. if (isPrototype(source) || isArrayLike(source)) {
  13516. copyObject(source, keys(source), object);
  13517. return;
  13518. }
  13519. for (var key in source) {
  13520. if (hasOwnProperty.call(source, key)) {
  13521. assignValue(object, key, source[key]);
  13522. }
  13523. }
  13524. });
  13525. /**
  13526. * This method is like `_.assign` except that it iterates over own and
  13527. * inherited source properties.
  13528. *
  13529. * **Note:** This method mutates `object`.
  13530. *
  13531. * @static
  13532. * @memberOf _
  13533. * @since 4.0.0
  13534. * @alias extend
  13535. * @category Object
  13536. * @param {Object} object The destination object.
  13537. * @param {...Object} [sources] The source objects.
  13538. * @returns {Object} Returns `object`.
  13539. * @see _.assign
  13540. * @example
  13541. *
  13542. * function Foo() {
  13543. * this.a = 1;
  13544. * }
  13545. *
  13546. * function Bar() {
  13547. * this.c = 3;
  13548. * }
  13549. *
  13550. * Foo.prototype.b = 2;
  13551. * Bar.prototype.d = 4;
  13552. *
  13553. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  13554. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  13555. */
  13556. var assignIn = createAssigner(function(object, source) {
  13557. copyObject(source, keysIn(source), object);
  13558. });
  13559. /**
  13560. * This method is like `_.assignIn` except that it accepts `customizer`
  13561. * which is invoked to produce the assigned values. If `customizer` returns
  13562. * `undefined`, assignment is handled by the method instead. The `customizer`
  13563. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  13564. *
  13565. * **Note:** This method mutates `object`.
  13566. *
  13567. * @static
  13568. * @memberOf _
  13569. * @since 4.0.0
  13570. * @alias extendWith
  13571. * @category Object
  13572. * @param {Object} object The destination object.
  13573. * @param {...Object} sources The source objects.
  13574. * @param {Function} [customizer] The function to customize assigned values.
  13575. * @returns {Object} Returns `object`.
  13576. * @see _.assignWith
  13577. * @example
  13578. *
  13579. * function customizer(objValue, srcValue) {
  13580. * return _.isUndefined(objValue) ? srcValue : objValue;
  13581. * }
  13582. *
  13583. * var defaults = _.partialRight(_.assignInWith, customizer);
  13584. *
  13585. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  13586. * // => { 'a': 1, 'b': 2 }
  13587. */
  13588. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  13589. copyObject(source, keysIn(source), object, customizer);
  13590. });
  13591. /**
  13592. * This method is like `_.assign` except that it accepts `customizer`
  13593. * which is invoked to produce the assigned values. If `customizer` returns
  13594. * `undefined`, assignment is handled by the method instead. The `customizer`
  13595. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  13596. *
  13597. * **Note:** This method mutates `object`.
  13598. *
  13599. * @static
  13600. * @memberOf _
  13601. * @since 4.0.0
  13602. * @category Object
  13603. * @param {Object} object The destination object.
  13604. * @param {...Object} sources The source objects.
  13605. * @param {Function} [customizer] The function to customize assigned values.
  13606. * @returns {Object} Returns `object`.
  13607. * @see _.assignInWith
  13608. * @example
  13609. *
  13610. * function customizer(objValue, srcValue) {
  13611. * return _.isUndefined(objValue) ? srcValue : objValue;
  13612. * }
  13613. *
  13614. * var defaults = _.partialRight(_.assignWith, customizer);
  13615. *
  13616. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  13617. * // => { 'a': 1, 'b': 2 }
  13618. */
  13619. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  13620. copyObject(source, keys(source), object, customizer);
  13621. });
  13622. /**
  13623. * Creates an array of values corresponding to `paths` of `object`.
  13624. *
  13625. * @static
  13626. * @memberOf _
  13627. * @since 1.0.0
  13628. * @category Object
  13629. * @param {Object} object The object to iterate over.
  13630. * @param {...(string|string[])} [paths] The property paths to pick.
  13631. * @returns {Array} Returns the picked values.
  13632. * @example
  13633. *
  13634. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  13635. *
  13636. * _.at(object, ['a[0].b.c', 'a[1]']);
  13637. * // => [3, 4]
  13638. */
  13639. var at = flatRest(baseAt);
  13640. /**
  13641. * Creates an object that inherits from the `prototype` object. If a
  13642. * `properties` object is given, its own enumerable string keyed properties
  13643. * are assigned to the created object.
  13644. *
  13645. * @static
  13646. * @memberOf _
  13647. * @since 2.3.0
  13648. * @category Object
  13649. * @param {Object} prototype The object to inherit from.
  13650. * @param {Object} [properties] The properties to assign to the object.
  13651. * @returns {Object} Returns the new object.
  13652. * @example
  13653. *
  13654. * function Shape() {
  13655. * this.x = 0;
  13656. * this.y = 0;
  13657. * }
  13658. *
  13659. * function Circle() {
  13660. * Shape.call(this);
  13661. * }
  13662. *
  13663. * Circle.prototype = _.create(Shape.prototype, {
  13664. * 'constructor': Circle
  13665. * });
  13666. *
  13667. * var circle = new Circle;
  13668. * circle instanceof Circle;
  13669. * // => true
  13670. *
  13671. * circle instanceof Shape;
  13672. * // => true
  13673. */
  13674. function create(prototype, properties) {
  13675. var result = baseCreate(prototype);
  13676. return properties == null ? result : baseAssign(result, properties);
  13677. }
  13678. /**
  13679. * Assigns own and inherited enumerable string keyed properties of source
  13680. * objects to the destination object for all destination properties that
  13681. * resolve to `undefined`. Source objects are applied from left to right.
  13682. * Once a property is set, additional values of the same property are ignored.
  13683. *
  13684. * **Note:** This method mutates `object`.
  13685. *
  13686. * @static
  13687. * @since 0.1.0
  13688. * @memberOf _
  13689. * @category Object
  13690. * @param {Object} object The destination object.
  13691. * @param {...Object} [sources] The source objects.
  13692. * @returns {Object} Returns `object`.
  13693. * @see _.defaultsDeep
  13694. * @example
  13695. *
  13696. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  13697. * // => { 'a': 1, 'b': 2 }
  13698. */
  13699. var defaults = baseRest(function(object, sources) {
  13700. object = Object(object);
  13701. var index = -1;
  13702. var length = sources.length;
  13703. var guard = length > 2 ? sources[2] : undefined;
  13704. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  13705. length = 1;
  13706. }
  13707. while (++index < length) {
  13708. var source = sources[index];
  13709. var props = keysIn(source);
  13710. var propsIndex = -1;
  13711. var propsLength = props.length;
  13712. while (++propsIndex < propsLength) {
  13713. var key = props[propsIndex];
  13714. var value = object[key];
  13715. if (value === undefined ||
  13716. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  13717. object[key] = source[key];
  13718. }
  13719. }
  13720. }
  13721. return object;
  13722. });
  13723. /**
  13724. * This method is like `_.defaults` except that it recursively assigns
  13725. * default properties.
  13726. *
  13727. * **Note:** This method mutates `object`.
  13728. *
  13729. * @static
  13730. * @memberOf _
  13731. * @since 3.10.0
  13732. * @category Object
  13733. * @param {Object} object The destination object.
  13734. * @param {...Object} [sources] The source objects.
  13735. * @returns {Object} Returns `object`.
  13736. * @see _.defaults
  13737. * @example
  13738. *
  13739. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  13740. * // => { 'a': { 'b': 2, 'c': 3 } }
  13741. */
  13742. var defaultsDeep = baseRest(function(args) {
  13743. args.push(undefined, customDefaultsMerge);
  13744. return apply(mergeWith, undefined, args);
  13745. });
  13746. /**
  13747. * This method is like `_.find` except that it returns the key of the first
  13748. * element `predicate` returns truthy for instead of the element itself.
  13749. *
  13750. * @static
  13751. * @memberOf _
  13752. * @since 1.1.0
  13753. * @category Object
  13754. * @param {Object} object The object to inspect.
  13755. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  13756. * @returns {string|undefined} Returns the key of the matched element,
  13757. * else `undefined`.
  13758. * @example
  13759. *
  13760. * var users = {
  13761. * 'barney': { 'age': 36, 'active': true },
  13762. * 'fred': { 'age': 40, 'active': false },
  13763. * 'pebbles': { 'age': 1, 'active': true }
  13764. * };
  13765. *
  13766. * _.findKey(users, function(o) { return o.age < 40; });
  13767. * // => 'barney' (iteration order is not guaranteed)
  13768. *
  13769. * // The `_.matches` iteratee shorthand.
  13770. * _.findKey(users, { 'age': 1, 'active': true });
  13771. * // => 'pebbles'
  13772. *
  13773. * // The `_.matchesProperty` iteratee shorthand.
  13774. * _.findKey(users, ['active', false]);
  13775. * // => 'fred'
  13776. *
  13777. * // The `_.property` iteratee shorthand.
  13778. * _.findKey(users, 'active');
  13779. * // => 'barney'
  13780. */
  13781. function findKey(object, predicate) {
  13782. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  13783. }
  13784. /**
  13785. * This method is like `_.findKey` except that it iterates over elements of
  13786. * a collection in the opposite order.
  13787. *
  13788. * @static
  13789. * @memberOf _
  13790. * @since 2.0.0
  13791. * @category Object
  13792. * @param {Object} object The object to inspect.
  13793. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  13794. * @returns {string|undefined} Returns the key of the matched element,
  13795. * else `undefined`.
  13796. * @example
  13797. *
  13798. * var users = {
  13799. * 'barney': { 'age': 36, 'active': true },
  13800. * 'fred': { 'age': 40, 'active': false },
  13801. * 'pebbles': { 'age': 1, 'active': true }
  13802. * };
  13803. *
  13804. * _.findLastKey(users, function(o) { return o.age < 40; });
  13805. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  13806. *
  13807. * // The `_.matches` iteratee shorthand.
  13808. * _.findLastKey(users, { 'age': 36, 'active': true });
  13809. * // => 'barney'
  13810. *
  13811. * // The `_.matchesProperty` iteratee shorthand.
  13812. * _.findLastKey(users, ['active', false]);
  13813. * // => 'fred'
  13814. *
  13815. * // The `_.property` iteratee shorthand.
  13816. * _.findLastKey(users, 'active');
  13817. * // => 'pebbles'
  13818. */
  13819. function findLastKey(object, predicate) {
  13820. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  13821. }
  13822. /**
  13823. * Iterates over own and inherited enumerable string keyed properties of an
  13824. * object and invokes `iteratee` for each property. The iteratee is invoked
  13825. * with three arguments: (value, key, object). Iteratee functions may exit
  13826. * iteration early by explicitly returning `false`.
  13827. *
  13828. * @static
  13829. * @memberOf _
  13830. * @since 0.3.0
  13831. * @category Object
  13832. * @param {Object} object The object to iterate over.
  13833. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13834. * @returns {Object} Returns `object`.
  13835. * @see _.forInRight
  13836. * @example
  13837. *
  13838. * function Foo() {
  13839. * this.a = 1;
  13840. * this.b = 2;
  13841. * }
  13842. *
  13843. * Foo.prototype.c = 3;
  13844. *
  13845. * _.forIn(new Foo, function(value, key) {
  13846. * console.log(key);
  13847. * });
  13848. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  13849. */
  13850. function forIn(object, iteratee) {
  13851. return object == null
  13852. ? object
  13853. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  13854. }
  13855. /**
  13856. * This method is like `_.forIn` except that it iterates over properties of
  13857. * `object` in the opposite order.
  13858. *
  13859. * @static
  13860. * @memberOf _
  13861. * @since 2.0.0
  13862. * @category Object
  13863. * @param {Object} object The object to iterate over.
  13864. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13865. * @returns {Object} Returns `object`.
  13866. * @see _.forIn
  13867. * @example
  13868. *
  13869. * function Foo() {
  13870. * this.a = 1;
  13871. * this.b = 2;
  13872. * }
  13873. *
  13874. * Foo.prototype.c = 3;
  13875. *
  13876. * _.forInRight(new Foo, function(value, key) {
  13877. * console.log(key);
  13878. * });
  13879. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  13880. */
  13881. function forInRight(object, iteratee) {
  13882. return object == null
  13883. ? object
  13884. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  13885. }
  13886. /**
  13887. * Iterates over own enumerable string keyed properties of an object and
  13888. * invokes `iteratee` for each property. The iteratee is invoked with three
  13889. * arguments: (value, key, object). Iteratee functions may exit iteration
  13890. * early by explicitly returning `false`.
  13891. *
  13892. * @static
  13893. * @memberOf _
  13894. * @since 0.3.0
  13895. * @category Object
  13896. * @param {Object} object The object to iterate over.
  13897. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13898. * @returns {Object} Returns `object`.
  13899. * @see _.forOwnRight
  13900. * @example
  13901. *
  13902. * function Foo() {
  13903. * this.a = 1;
  13904. * this.b = 2;
  13905. * }
  13906. *
  13907. * Foo.prototype.c = 3;
  13908. *
  13909. * _.forOwn(new Foo, function(value, key) {
  13910. * console.log(key);
  13911. * });
  13912. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  13913. */
  13914. function forOwn(object, iteratee) {
  13915. return object && baseForOwn(object, getIteratee(iteratee, 3));
  13916. }
  13917. /**
  13918. * This method is like `_.forOwn` except that it iterates over properties of
  13919. * `object` in the opposite order.
  13920. *
  13921. * @static
  13922. * @memberOf _
  13923. * @since 2.0.0
  13924. * @category Object
  13925. * @param {Object} object The object to iterate over.
  13926. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13927. * @returns {Object} Returns `object`.
  13928. * @see _.forOwn
  13929. * @example
  13930. *
  13931. * function Foo() {
  13932. * this.a = 1;
  13933. * this.b = 2;
  13934. * }
  13935. *
  13936. * Foo.prototype.c = 3;
  13937. *
  13938. * _.forOwnRight(new Foo, function(value, key) {
  13939. * console.log(key);
  13940. * });
  13941. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  13942. */
  13943. function forOwnRight(object, iteratee) {
  13944. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  13945. }
  13946. /**
  13947. * Creates an array of function property names from own enumerable properties
  13948. * of `object`.
  13949. *
  13950. * @static
  13951. * @since 0.1.0
  13952. * @memberOf _
  13953. * @category Object
  13954. * @param {Object} object The object to inspect.
  13955. * @returns {Array} Returns the function names.
  13956. * @see _.functionsIn
  13957. * @example
  13958. *
  13959. * function Foo() {
  13960. * this.a = _.constant('a');
  13961. * this.b = _.constant('b');
  13962. * }
  13963. *
  13964. * Foo.prototype.c = _.constant('c');
  13965. *
  13966. * _.functions(new Foo);
  13967. * // => ['a', 'b']
  13968. */
  13969. function functions(object) {
  13970. return object == null ? [] : baseFunctions(object, keys(object));
  13971. }
  13972. /**
  13973. * Creates an array of function property names from own and inherited
  13974. * enumerable properties of `object`.
  13975. *
  13976. * @static
  13977. * @memberOf _
  13978. * @since 4.0.0
  13979. * @category Object
  13980. * @param {Object} object The object to inspect.
  13981. * @returns {Array} Returns the function names.
  13982. * @see _.functions
  13983. * @example
  13984. *
  13985. * function Foo() {
  13986. * this.a = _.constant('a');
  13987. * this.b = _.constant('b');
  13988. * }
  13989. *
  13990. * Foo.prototype.c = _.constant('c');
  13991. *
  13992. * _.functionsIn(new Foo);
  13993. * // => ['a', 'b', 'c']
  13994. */
  13995. function functionsIn(object) {
  13996. return object == null ? [] : baseFunctions(object, keysIn(object));
  13997. }
  13998. /**
  13999. * Gets the value at `path` of `object`. If the resolved value is
  14000. * `undefined`, the `defaultValue` is returned in its place.
  14001. *
  14002. * @static
  14003. * @memberOf _
  14004. * @since 3.7.0
  14005. * @category Object
  14006. * @param {Object} object The object to query.
  14007. * @param {Array|string} path The path of the property to get.
  14008. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  14009. * @returns {*} Returns the resolved value.
  14010. * @example
  14011. *
  14012. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  14013. *
  14014. * _.get(object, 'a[0].b.c');
  14015. * // => 3
  14016. *
  14017. * _.get(object, ['a', '0', 'b', 'c']);
  14018. * // => 3
  14019. *
  14020. * _.get(object, 'a.b.c', 'default');
  14021. * // => 'default'
  14022. */
  14023. function get(object, path, defaultValue) {
  14024. var result = object == null ? undefined : baseGet(object, path);
  14025. return result === undefined ? defaultValue : result;
  14026. }
  14027. /**
  14028. * Checks if `path` is a direct property of `object`.
  14029. *
  14030. * @static
  14031. * @since 0.1.0
  14032. * @memberOf _
  14033. * @category Object
  14034. * @param {Object} object The object to query.
  14035. * @param {Array|string} path The path to check.
  14036. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  14037. * @example
  14038. *
  14039. * var object = { 'a': { 'b': 2 } };
  14040. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  14041. *
  14042. * _.has(object, 'a');
  14043. * // => true
  14044. *
  14045. * _.has(object, 'a.b');
  14046. * // => true
  14047. *
  14048. * _.has(object, ['a', 'b']);
  14049. * // => true
  14050. *
  14051. * _.has(other, 'a');
  14052. * // => false
  14053. */
  14054. function has(object, path) {
  14055. return object != null && hasPath(object, path, baseHas);
  14056. }
  14057. /**
  14058. * Checks if `path` is a direct or inherited property of `object`.
  14059. *
  14060. * @static
  14061. * @memberOf _
  14062. * @since 4.0.0
  14063. * @category Object
  14064. * @param {Object} object The object to query.
  14065. * @param {Array|string} path The path to check.
  14066. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  14067. * @example
  14068. *
  14069. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  14070. *
  14071. * _.hasIn(object, 'a');
  14072. * // => true
  14073. *
  14074. * _.hasIn(object, 'a.b');
  14075. * // => true
  14076. *
  14077. * _.hasIn(object, ['a', 'b']);
  14078. * // => true
  14079. *
  14080. * _.hasIn(object, 'b');
  14081. * // => false
  14082. */
  14083. function hasIn(object, path) {
  14084. return object != null && hasPath(object, path, baseHasIn);
  14085. }
  14086. /**
  14087. * Creates an object composed of the inverted keys and values of `object`.
  14088. * If `object` contains duplicate values, subsequent values overwrite
  14089. * property assignments of previous values.
  14090. *
  14091. * @static
  14092. * @memberOf _
  14093. * @since 0.7.0
  14094. * @category Object
  14095. * @param {Object} object The object to invert.
  14096. * @returns {Object} Returns the new inverted object.
  14097. * @example
  14098. *
  14099. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  14100. *
  14101. * _.invert(object);
  14102. * // => { '1': 'c', '2': 'b' }
  14103. */
  14104. var invert = createInverter(function(result, value, key) {
  14105. if (value != null &&
  14106. typeof value.toString != 'function') {
  14107. value = nativeObjectToString.call(value);
  14108. }
  14109. result[value] = key;
  14110. }, constant(identity));
  14111. /**
  14112. * This method is like `_.invert` except that the inverted object is generated
  14113. * from the results of running each element of `object` thru `iteratee`. The
  14114. * corresponding inverted value of each inverted key is an array of keys
  14115. * responsible for generating the inverted value. The iteratee is invoked
  14116. * with one argument: (value).
  14117. *
  14118. * @static
  14119. * @memberOf _
  14120. * @since 4.1.0
  14121. * @category Object
  14122. * @param {Object} object The object to invert.
  14123. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  14124. * @returns {Object} Returns the new inverted object.
  14125. * @example
  14126. *
  14127. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  14128. *
  14129. * _.invertBy(object);
  14130. * // => { '1': ['a', 'c'], '2': ['b'] }
  14131. *
  14132. * _.invertBy(object, function(value) {
  14133. * return 'group' + value;
  14134. * });
  14135. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  14136. */
  14137. var invertBy = createInverter(function(result, value, key) {
  14138. if (value != null &&
  14139. typeof value.toString != 'function') {
  14140. value = nativeObjectToString.call(value);
  14141. }
  14142. if (hasOwnProperty.call(result, value)) {
  14143. result[value].push(key);
  14144. } else {
  14145. result[value] = [key];
  14146. }
  14147. }, getIteratee);
  14148. /**
  14149. * Invokes the method at `path` of `object`.
  14150. *
  14151. * @static
  14152. * @memberOf _
  14153. * @since 4.0.0
  14154. * @category Object
  14155. * @param {Object} object The object to query.
  14156. * @param {Array|string} path The path of the method to invoke.
  14157. * @param {...*} [args] The arguments to invoke the method with.
  14158. * @returns {*} Returns the result of the invoked method.
  14159. * @example
  14160. *
  14161. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  14162. *
  14163. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  14164. * // => [2, 3]
  14165. */
  14166. var invoke = baseRest(baseInvoke);
  14167. /**
  14168. * Creates an array of the own enumerable property names of `object`.
  14169. *
  14170. * **Note:** Non-object values are coerced to objects. See the
  14171. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  14172. * for more details.
  14173. *
  14174. * @static
  14175. * @since 0.1.0
  14176. * @memberOf _
  14177. * @category Object
  14178. * @param {Object} object The object to query.
  14179. * @returns {Array} Returns the array of property names.
  14180. * @example
  14181. *
  14182. * function Foo() {
  14183. * this.a = 1;
  14184. * this.b = 2;
  14185. * }
  14186. *
  14187. * Foo.prototype.c = 3;
  14188. *
  14189. * _.keys(new Foo);
  14190. * // => ['a', 'b'] (iteration order is not guaranteed)
  14191. *
  14192. * _.keys('hi');
  14193. * // => ['0', '1']
  14194. */
  14195. function keys(object) {
  14196. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  14197. }
  14198. /**
  14199. * Creates an array of the own and inherited enumerable property names of `object`.
  14200. *
  14201. * **Note:** Non-object values are coerced to objects.
  14202. *
  14203. * @static
  14204. * @memberOf _
  14205. * @since 3.0.0
  14206. * @category Object
  14207. * @param {Object} object The object to query.
  14208. * @returns {Array} Returns the array of property names.
  14209. * @example
  14210. *
  14211. * function Foo() {
  14212. * this.a = 1;
  14213. * this.b = 2;
  14214. * }
  14215. *
  14216. * Foo.prototype.c = 3;
  14217. *
  14218. * _.keysIn(new Foo);
  14219. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  14220. */
  14221. function keysIn(object) {
  14222. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  14223. }
  14224. /**
  14225. * The opposite of `_.mapValues`; this method creates an object with the
  14226. * same values as `object` and keys generated by running each own enumerable
  14227. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  14228. * with three arguments: (value, key, object).
  14229. *
  14230. * @static
  14231. * @memberOf _
  14232. * @since 3.8.0
  14233. * @category Object
  14234. * @param {Object} object The object to iterate over.
  14235. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  14236. * @returns {Object} Returns the new mapped object.
  14237. * @see _.mapValues
  14238. * @example
  14239. *
  14240. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  14241. * return key + value;
  14242. * });
  14243. * // => { 'a1': 1, 'b2': 2 }
  14244. */
  14245. function mapKeys(object, iteratee) {
  14246. var result = {};
  14247. iteratee = getIteratee(iteratee, 3);
  14248. baseForOwn(object, function(value, key, object) {
  14249. baseAssignValue(result, iteratee(value, key, object), value);
  14250. });
  14251. return result;
  14252. }
  14253. /**
  14254. * Creates an object with the same keys as `object` and values generated
  14255. * by running each own enumerable string keyed property of `object` thru
  14256. * `iteratee`. The iteratee is invoked with three arguments:
  14257. * (value, key, object).
  14258. *
  14259. * @static
  14260. * @memberOf _
  14261. * @since 2.4.0
  14262. * @category Object
  14263. * @param {Object} object The object to iterate over.
  14264. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  14265. * @returns {Object} Returns the new mapped object.
  14266. * @see _.mapKeys
  14267. * @example
  14268. *
  14269. * var users = {
  14270. * 'fred': { 'user': 'fred', 'age': 40 },
  14271. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  14272. * };
  14273. *
  14274. * _.mapValues(users, function(o) { return o.age; });
  14275. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  14276. *
  14277. * // The `_.property` iteratee shorthand.
  14278. * _.mapValues(users, 'age');
  14279. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  14280. */
  14281. function mapValues(object, iteratee) {
  14282. var result = {};
  14283. iteratee = getIteratee(iteratee, 3);
  14284. baseForOwn(object, function(value, key, object) {
  14285. baseAssignValue(result, key, iteratee(value, key, object));
  14286. });
  14287. return result;
  14288. }
  14289. /**
  14290. * This method is like `_.assign` except that it recursively merges own and
  14291. * inherited enumerable string keyed properties of source objects into the
  14292. * destination object. Source properties that resolve to `undefined` are
  14293. * skipped if a destination value exists. Array and plain object properties
  14294. * are merged recursively. Other objects and value types are overridden by
  14295. * assignment. Source objects are applied from left to right. Subsequent
  14296. * sources overwrite property assignments of previous sources.
  14297. *
  14298. * **Note:** This method mutates `object`.
  14299. *
  14300. * @static
  14301. * @memberOf _
  14302. * @since 0.5.0
  14303. * @category Object
  14304. * @param {Object} object The destination object.
  14305. * @param {...Object} [sources] The source objects.
  14306. * @returns {Object} Returns `object`.
  14307. * @example
  14308. *
  14309. * var object = {
  14310. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  14311. * };
  14312. *
  14313. * var other = {
  14314. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  14315. * };
  14316. *
  14317. * _.merge(object, other);
  14318. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  14319. */
  14320. var merge = createAssigner(function(object, source, srcIndex) {
  14321. baseMerge(object, source, srcIndex);
  14322. });
  14323. /**
  14324. * This method is like `_.merge` except that it accepts `customizer` which
  14325. * is invoked to produce the merged values of the destination and source
  14326. * properties. If `customizer` returns `undefined`, merging is handled by the
  14327. * method instead. The `customizer` is invoked with six arguments:
  14328. * (objValue, srcValue, key, object, source, stack).
  14329. *
  14330. * **Note:** This method mutates `object`.
  14331. *
  14332. * @static
  14333. * @memberOf _
  14334. * @since 4.0.0
  14335. * @category Object
  14336. * @param {Object} object The destination object.
  14337. * @param {...Object} sources The source objects.
  14338. * @param {Function} customizer The function to customize assigned values.
  14339. * @returns {Object} Returns `object`.
  14340. * @example
  14341. *
  14342. * function customizer(objValue, srcValue) {
  14343. * if (_.isArray(objValue)) {
  14344. * return objValue.concat(srcValue);
  14345. * }
  14346. * }
  14347. *
  14348. * var object = { 'a': [1], 'b': [2] };
  14349. * var other = { 'a': [3], 'b': [4] };
  14350. *
  14351. * _.mergeWith(object, other, customizer);
  14352. * // => { 'a': [1, 3], 'b': [2, 4] }
  14353. */
  14354. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  14355. baseMerge(object, source, srcIndex, customizer);
  14356. });
  14357. /**
  14358. * The opposite of `_.pick`; this method creates an object composed of the
  14359. * own and inherited enumerable property paths of `object` that are not omitted.
  14360. *
  14361. * **Note:** This method is considerably slower than `_.pick`.
  14362. *
  14363. * @static
  14364. * @since 0.1.0
  14365. * @memberOf _
  14366. * @category Object
  14367. * @param {Object} object The source object.
  14368. * @param {...(string|string[])} [paths] The property paths to omit.
  14369. * @returns {Object} Returns the new object.
  14370. * @example
  14371. *
  14372. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  14373. *
  14374. * _.omit(object, ['a', 'c']);
  14375. * // => { 'b': '2' }
  14376. */
  14377. var omit = flatRest(function(object, paths) {
  14378. var result = {};
  14379. if (object == null) {
  14380. return result;
  14381. }
  14382. var isDeep = false;
  14383. paths = arrayMap(paths, function(path) {
  14384. path = castPath(path, object);
  14385. isDeep || (isDeep = path.length > 1);
  14386. return path;
  14387. });
  14388. copyObject(object, getAllKeysIn(object), result);
  14389. if (isDeep) {
  14390. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  14391. }
  14392. var length = paths.length;
  14393. while (length--) {
  14394. baseUnset(result, paths[length]);
  14395. }
  14396. return result;
  14397. });
  14398. /**
  14399. * The opposite of `_.pickBy`; this method creates an object composed of
  14400. * the own and inherited enumerable string keyed properties of `object` that
  14401. * `predicate` doesn't return truthy for. The predicate is invoked with two
  14402. * arguments: (value, key).
  14403. *
  14404. * @static
  14405. * @memberOf _
  14406. * @since 4.0.0
  14407. * @category Object
  14408. * @param {Object} object The source object.
  14409. * @param {Function} [predicate=_.identity] The function invoked per property.
  14410. * @returns {Object} Returns the new object.
  14411. * @example
  14412. *
  14413. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  14414. *
  14415. * _.omitBy(object, _.isNumber);
  14416. * // => { 'b': '2' }
  14417. */
  14418. function omitBy(object, predicate) {
  14419. return pickBy(object, negate(getIteratee(predicate)));
  14420. }
  14421. /**
  14422. * Creates an object composed of the picked `object` properties.
  14423. *
  14424. * @static
  14425. * @since 0.1.0
  14426. * @memberOf _
  14427. * @category Object
  14428. * @param {Object} object The source object.
  14429. * @param {...(string|string[])} [paths] The property paths to pick.
  14430. * @returns {Object} Returns the new object.
  14431. * @example
  14432. *
  14433. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  14434. *
  14435. * _.pick(object, ['a', 'c']);
  14436. * // => { 'a': 1, 'c': 3 }
  14437. */
  14438. var pick = flatRest(function(object, paths) {
  14439. return object == null ? {} : basePick(object, paths);
  14440. });
  14441. /**
  14442. * Creates an object composed of the `object` properties `predicate` returns
  14443. * truthy for. The predicate is invoked with two arguments: (value, key).
  14444. *
  14445. * @static
  14446. * @memberOf _
  14447. * @since 4.0.0
  14448. * @category Object
  14449. * @param {Object} object The source object.
  14450. * @param {Function} [predicate=_.identity] The function invoked per property.
  14451. * @returns {Object} Returns the new object.
  14452. * @example
  14453. *
  14454. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  14455. *
  14456. * _.pickBy(object, _.isNumber);
  14457. * // => { 'a': 1, 'c': 3 }
  14458. */
  14459. function pickBy(object, predicate) {
  14460. if (object == null) {
  14461. return {};
  14462. }
  14463. var props = arrayMap(getAllKeysIn(object), function(prop) {
  14464. return [prop];
  14465. });
  14466. predicate = getIteratee(predicate);
  14467. return basePickBy(object, props, function(value, path) {
  14468. return predicate(value, path[0]);
  14469. });
  14470. }
  14471. /**
  14472. * This method is like `_.get` except that if the resolved value is a
  14473. * function it's invoked with the `this` binding of its parent object and
  14474. * its result is returned.
  14475. *
  14476. * @static
  14477. * @since 0.1.0
  14478. * @memberOf _
  14479. * @category Object
  14480. * @param {Object} object The object to query.
  14481. * @param {Array|string} path The path of the property to resolve.
  14482. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  14483. * @returns {*} Returns the resolved value.
  14484. * @example
  14485. *
  14486. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  14487. *
  14488. * _.result(object, 'a[0].b.c1');
  14489. * // => 3
  14490. *
  14491. * _.result(object, 'a[0].b.c2');
  14492. * // => 4
  14493. *
  14494. * _.result(object, 'a[0].b.c3', 'default');
  14495. * // => 'default'
  14496. *
  14497. * _.result(object, 'a[0].b.c3', _.constant('default'));
  14498. * // => 'default'
  14499. */
  14500. function result(object, path, defaultValue) {
  14501. path = castPath(path, object);
  14502. var index = -1,
  14503. length = path.length;
  14504. // Ensure the loop is entered when path is empty.
  14505. if (!length) {
  14506. length = 1;
  14507. object = undefined;
  14508. }
  14509. while (++index < length) {
  14510. var value = object == null ? undefined : object[toKey(path[index])];
  14511. if (value === undefined) {
  14512. index = length;
  14513. value = defaultValue;
  14514. }
  14515. object = isFunction(value) ? value.call(object) : value;
  14516. }
  14517. return object;
  14518. }
  14519. /**
  14520. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  14521. * it's created. Arrays are created for missing index properties while objects
  14522. * are created for all other missing properties. Use `_.setWith` to customize
  14523. * `path` creation.
  14524. *
  14525. * **Note:** This method mutates `object`.
  14526. *
  14527. * @static
  14528. * @memberOf _
  14529. * @since 3.7.0
  14530. * @category Object
  14531. * @param {Object} object The object to modify.
  14532. * @param {Array|string} path The path of the property to set.
  14533. * @param {*} value The value to set.
  14534. * @returns {Object} Returns `object`.
  14535. * @example
  14536. *
  14537. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  14538. *
  14539. * _.set(object, 'a[0].b.c', 4);
  14540. * console.log(object.a[0].b.c);
  14541. * // => 4
  14542. *
  14543. * _.set(object, ['x', '0', 'y', 'z'], 5);
  14544. * console.log(object.x[0].y.z);
  14545. * // => 5
  14546. */
  14547. function set(object, path, value) {
  14548. return object == null ? object : baseSet(object, path, value);
  14549. }
  14550. /**
  14551. * This method is like `_.set` except that it accepts `customizer` which is
  14552. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  14553. * path creation is handled by the method instead. The `customizer` is invoked
  14554. * with three arguments: (nsValue, key, nsObject).
  14555. *
  14556. * **Note:** This method mutates `object`.
  14557. *
  14558. * @static
  14559. * @memberOf _
  14560. * @since 4.0.0
  14561. * @category Object
  14562. * @param {Object} object The object to modify.
  14563. * @param {Array|string} path The path of the property to set.
  14564. * @param {*} value The value to set.
  14565. * @param {Function} [customizer] The function to customize assigned values.
  14566. * @returns {Object} Returns `object`.
  14567. * @example
  14568. *
  14569. * var object = {};
  14570. *
  14571. * _.setWith(object, '[0][1]', 'a', Object);
  14572. * // => { '0': { '1': 'a' } }
  14573. */
  14574. function setWith(object, path, value, customizer) {
  14575. customizer = typeof customizer == 'function' ? customizer : undefined;
  14576. return object == null ? object : baseSet(object, path, value, customizer);
  14577. }
  14578. /**
  14579. * Creates an array of own enumerable string keyed-value pairs for `object`
  14580. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  14581. * entries are returned.
  14582. *
  14583. * @static
  14584. * @memberOf _
  14585. * @since 4.0.0
  14586. * @alias entries
  14587. * @category Object
  14588. * @param {Object} object The object to query.
  14589. * @returns {Array} Returns the key-value pairs.
  14590. * @example
  14591. *
  14592. * function Foo() {
  14593. * this.a = 1;
  14594. * this.b = 2;
  14595. * }
  14596. *
  14597. * Foo.prototype.c = 3;
  14598. *
  14599. * _.toPairs(new Foo);
  14600. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  14601. */
  14602. var toPairs = createToPairs(keys);
  14603. /**
  14604. * Creates an array of own and inherited enumerable string keyed-value pairs
  14605. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  14606. * or set, its entries are returned.
  14607. *
  14608. * @static
  14609. * @memberOf _
  14610. * @since 4.0.0
  14611. * @alias entriesIn
  14612. * @category Object
  14613. * @param {Object} object The object to query.
  14614. * @returns {Array} Returns the key-value pairs.
  14615. * @example
  14616. *
  14617. * function Foo() {
  14618. * this.a = 1;
  14619. * this.b = 2;
  14620. * }
  14621. *
  14622. * Foo.prototype.c = 3;
  14623. *
  14624. * _.toPairsIn(new Foo);
  14625. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  14626. */
  14627. var toPairsIn = createToPairs(keysIn);
  14628. /**
  14629. * An alternative to `_.reduce`; this method transforms `object` to a new
  14630. * `accumulator` object which is the result of running each of its own
  14631. * enumerable string keyed properties thru `iteratee`, with each invocation
  14632. * potentially mutating the `accumulator` object. If `accumulator` is not
  14633. * provided, a new object with the same `[[Prototype]]` will be used. The
  14634. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  14635. * Iteratee functions may exit iteration early by explicitly returning `false`.
  14636. *
  14637. * @static
  14638. * @memberOf _
  14639. * @since 1.3.0
  14640. * @category Object
  14641. * @param {Object} object The object to iterate over.
  14642. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  14643. * @param {*} [accumulator] The custom accumulator value.
  14644. * @returns {*} Returns the accumulated value.
  14645. * @example
  14646. *
  14647. * _.transform([2, 3, 4], function(result, n) {
  14648. * result.push(n *= n);
  14649. * return n % 2 == 0;
  14650. * }, []);
  14651. * // => [4, 9]
  14652. *
  14653. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  14654. * (result[value] || (result[value] = [])).push(key);
  14655. * }, {});
  14656. * // => { '1': ['a', 'c'], '2': ['b'] }
  14657. */
  14658. function transform(object, iteratee, accumulator) {
  14659. var isArr = isArray(object),
  14660. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  14661. iteratee = getIteratee(iteratee, 4);
  14662. if (accumulator == null) {
  14663. var Ctor = object && object.constructor;
  14664. if (isArrLike) {
  14665. accumulator = isArr ? new Ctor : [];
  14666. }
  14667. else if (isObject(object)) {
  14668. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  14669. }
  14670. else {
  14671. accumulator = {};
  14672. }
  14673. }
  14674. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  14675. return iteratee(accumulator, value, index, object);
  14676. });
  14677. return accumulator;
  14678. }
  14679. /**
  14680. * Removes the property at `path` of `object`.
  14681. *
  14682. * **Note:** This method mutates `object`.
  14683. *
  14684. * @static
  14685. * @memberOf _
  14686. * @since 4.0.0
  14687. * @category Object
  14688. * @param {Object} object The object to modify.
  14689. * @param {Array|string} path The path of the property to unset.
  14690. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  14691. * @example
  14692. *
  14693. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  14694. * _.unset(object, 'a[0].b.c');
  14695. * // => true
  14696. *
  14697. * console.log(object);
  14698. * // => { 'a': [{ 'b': {} }] };
  14699. *
  14700. * _.unset(object, ['a', '0', 'b', 'c']);
  14701. * // => true
  14702. *
  14703. * console.log(object);
  14704. * // => { 'a': [{ 'b': {} }] };
  14705. */
  14706. function unset(object, path) {
  14707. return object == null ? true : baseUnset(object, path);
  14708. }
  14709. /**
  14710. * This method is like `_.set` except that accepts `updater` to produce the
  14711. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  14712. * is invoked with one argument: (value).
  14713. *
  14714. * **Note:** This method mutates `object`.
  14715. *
  14716. * @static
  14717. * @memberOf _
  14718. * @since 4.6.0
  14719. * @category Object
  14720. * @param {Object} object The object to modify.
  14721. * @param {Array|string} path The path of the property to set.
  14722. * @param {Function} updater The function to produce the updated value.
  14723. * @returns {Object} Returns `object`.
  14724. * @example
  14725. *
  14726. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  14727. *
  14728. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  14729. * console.log(object.a[0].b.c);
  14730. * // => 9
  14731. *
  14732. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  14733. * console.log(object.x[0].y.z);
  14734. * // => 0
  14735. */
  14736. function update(object, path, updater) {
  14737. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  14738. }
  14739. /**
  14740. * This method is like `_.update` except that it accepts `customizer` which is
  14741. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  14742. * path creation is handled by the method instead. The `customizer` is invoked
  14743. * with three arguments: (nsValue, key, nsObject).
  14744. *
  14745. * **Note:** This method mutates `object`.
  14746. *
  14747. * @static
  14748. * @memberOf _
  14749. * @since 4.6.0
  14750. * @category Object
  14751. * @param {Object} object The object to modify.
  14752. * @param {Array|string} path The path of the property to set.
  14753. * @param {Function} updater The function to produce the updated value.
  14754. * @param {Function} [customizer] The function to customize assigned values.
  14755. * @returns {Object} Returns `object`.
  14756. * @example
  14757. *
  14758. * var object = {};
  14759. *
  14760. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  14761. * // => { '0': { '1': 'a' } }
  14762. */
  14763. function updateWith(object, path, updater, customizer) {
  14764. customizer = typeof customizer == 'function' ? customizer : undefined;
  14765. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  14766. }
  14767. /**
  14768. * Creates an array of the own enumerable string keyed property values of `object`.
  14769. *
  14770. * **Note:** Non-object values are coerced to objects.
  14771. *
  14772. * @static
  14773. * @since 0.1.0
  14774. * @memberOf _
  14775. * @category Object
  14776. * @param {Object} object The object to query.
  14777. * @returns {Array} Returns the array of property values.
  14778. * @example
  14779. *
  14780. * function Foo() {
  14781. * this.a = 1;
  14782. * this.b = 2;
  14783. * }
  14784. *
  14785. * Foo.prototype.c = 3;
  14786. *
  14787. * _.values(new Foo);
  14788. * // => [1, 2] (iteration order is not guaranteed)
  14789. *
  14790. * _.values('hi');
  14791. * // => ['h', 'i']
  14792. */
  14793. function values(object) {
  14794. return object == null ? [] : baseValues(object, keys(object));
  14795. }
  14796. /**
  14797. * Creates an array of the own and inherited enumerable string keyed property
  14798. * values of `object`.
  14799. *
  14800. * **Note:** Non-object values are coerced to objects.
  14801. *
  14802. * @static
  14803. * @memberOf _
  14804. * @since 3.0.0
  14805. * @category Object
  14806. * @param {Object} object The object to query.
  14807. * @returns {Array} Returns the array of property values.
  14808. * @example
  14809. *
  14810. * function Foo() {
  14811. * this.a = 1;
  14812. * this.b = 2;
  14813. * }
  14814. *
  14815. * Foo.prototype.c = 3;
  14816. *
  14817. * _.valuesIn(new Foo);
  14818. * // => [1, 2, 3] (iteration order is not guaranteed)
  14819. */
  14820. function valuesIn(object) {
  14821. return object == null ? [] : baseValues(object, keysIn(object));
  14822. }
  14823. /*------------------------------------------------------------------------*/
  14824. /**
  14825. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  14826. *
  14827. * @static
  14828. * @memberOf _
  14829. * @since 4.0.0
  14830. * @category Number
  14831. * @param {number} number The number to clamp.
  14832. * @param {number} [lower] The lower bound.
  14833. * @param {number} upper The upper bound.
  14834. * @returns {number} Returns the clamped number.
  14835. * @example
  14836. *
  14837. * _.clamp(-10, -5, 5);
  14838. * // => -5
  14839. *
  14840. * _.clamp(10, -5, 5);
  14841. * // => 5
  14842. */
  14843. function clamp(number, lower, upper) {
  14844. if (upper === undefined) {
  14845. upper = lower;
  14846. lower = undefined;
  14847. }
  14848. if (upper !== undefined) {
  14849. upper = toNumber(upper);
  14850. upper = upper === upper ? upper : 0;
  14851. }
  14852. if (lower !== undefined) {
  14853. lower = toNumber(lower);
  14854. lower = lower === lower ? lower : 0;
  14855. }
  14856. return baseClamp(toNumber(number), lower, upper);
  14857. }
  14858. /**
  14859. * Checks if `n` is between `start` and up to, but not including, `end`. If
  14860. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  14861. * If `start` is greater than `end` the params are swapped to support
  14862. * negative ranges.
  14863. *
  14864. * @static
  14865. * @memberOf _
  14866. * @since 3.3.0
  14867. * @category Number
  14868. * @param {number} number The number to check.
  14869. * @param {number} [start=0] The start of the range.
  14870. * @param {number} end The end of the range.
  14871. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  14872. * @see _.range, _.rangeRight
  14873. * @example
  14874. *
  14875. * _.inRange(3, 2, 4);
  14876. * // => true
  14877. *
  14878. * _.inRange(4, 8);
  14879. * // => true
  14880. *
  14881. * _.inRange(4, 2);
  14882. * // => false
  14883. *
  14884. * _.inRange(2, 2);
  14885. * // => false
  14886. *
  14887. * _.inRange(1.2, 2);
  14888. * // => true
  14889. *
  14890. * _.inRange(5.2, 4);
  14891. * // => false
  14892. *
  14893. * _.inRange(-3, -2, -6);
  14894. * // => true
  14895. */
  14896. function inRange(number, start, end) {
  14897. start = toFinite(start);
  14898. if (end === undefined) {
  14899. end = start;
  14900. start = 0;
  14901. } else {
  14902. end = toFinite(end);
  14903. }
  14904. number = toNumber(number);
  14905. return baseInRange(number, start, end);
  14906. }
  14907. /**
  14908. * Produces a random number between the inclusive `lower` and `upper` bounds.
  14909. * If only one argument is provided a number between `0` and the given number
  14910. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  14911. * floats, a floating-point number is returned instead of an integer.
  14912. *
  14913. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  14914. * floating-point values which can produce unexpected results.
  14915. *
  14916. * @static
  14917. * @memberOf _
  14918. * @since 0.7.0
  14919. * @category Number
  14920. * @param {number} [lower=0] The lower bound.
  14921. * @param {number} [upper=1] The upper bound.
  14922. * @param {boolean} [floating] Specify returning a floating-point number.
  14923. * @returns {number} Returns the random number.
  14924. * @example
  14925. *
  14926. * _.random(0, 5);
  14927. * // => an integer between 0 and 5
  14928. *
  14929. * _.random(5);
  14930. * // => also an integer between 0 and 5
  14931. *
  14932. * _.random(5, true);
  14933. * // => a floating-point number between 0 and 5
  14934. *
  14935. * _.random(1.2, 5.2);
  14936. * // => a floating-point number between 1.2 and 5.2
  14937. */
  14938. function random(lower, upper, floating) {
  14939. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  14940. upper = floating = undefined;
  14941. }
  14942. if (floating === undefined) {
  14943. if (typeof upper == 'boolean') {
  14944. floating = upper;
  14945. upper = undefined;
  14946. }
  14947. else if (typeof lower == 'boolean') {
  14948. floating = lower;
  14949. lower = undefined;
  14950. }
  14951. }
  14952. if (lower === undefined && upper === undefined) {
  14953. lower = 0;
  14954. upper = 1;
  14955. }
  14956. else {
  14957. lower = toFinite(lower);
  14958. if (upper === undefined) {
  14959. upper = lower;
  14960. lower = 0;
  14961. } else {
  14962. upper = toFinite(upper);
  14963. }
  14964. }
  14965. if (lower > upper) {
  14966. var temp = lower;
  14967. lower = upper;
  14968. upper = temp;
  14969. }
  14970. if (floating || lower % 1 || upper % 1) {
  14971. var rand = nativeRandom();
  14972. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  14973. }
  14974. return baseRandom(lower, upper);
  14975. }
  14976. /*------------------------------------------------------------------------*/
  14977. /**
  14978. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  14979. *
  14980. * @static
  14981. * @memberOf _
  14982. * @since 3.0.0
  14983. * @category String
  14984. * @param {string} [string=''] The string to convert.
  14985. * @returns {string} Returns the camel cased string.
  14986. * @example
  14987. *
  14988. * _.camelCase('Foo Bar');
  14989. * // => 'fooBar'
  14990. *
  14991. * _.camelCase('--foo-bar--');
  14992. * // => 'fooBar'
  14993. *
  14994. * _.camelCase('__FOO_BAR__');
  14995. * // => 'fooBar'
  14996. */
  14997. var camelCase = createCompounder(function(result, word, index) {
  14998. word = word.toLowerCase();
  14999. return result + (index ? capitalize(word) : word);
  15000. });
  15001. /**
  15002. * Converts the first character of `string` to upper case and the remaining
  15003. * to lower case.
  15004. *
  15005. * @static
  15006. * @memberOf _
  15007. * @since 3.0.0
  15008. * @category String
  15009. * @param {string} [string=''] The string to capitalize.
  15010. * @returns {string} Returns the capitalized string.
  15011. * @example
  15012. *
  15013. * _.capitalize('FRED');
  15014. * // => 'Fred'
  15015. */
  15016. function capitalize(string) {
  15017. return upperFirst(toString(string).toLowerCase());
  15018. }
  15019. /**
  15020. * Deburrs `string` by converting
  15021. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  15022. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  15023. * letters to basic Latin letters and removing
  15024. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  15025. *
  15026. * @static
  15027. * @memberOf _
  15028. * @since 3.0.0
  15029. * @category String
  15030. * @param {string} [string=''] The string to deburr.
  15031. * @returns {string} Returns the deburred string.
  15032. * @example
  15033. *
  15034. * _.deburr('déjà vu');
  15035. * // => 'deja vu'
  15036. */
  15037. function deburr(string) {
  15038. string = toString(string);
  15039. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  15040. }
  15041. /**
  15042. * Checks if `string` ends with the given target string.
  15043. *
  15044. * @static
  15045. * @memberOf _
  15046. * @since 3.0.0
  15047. * @category String
  15048. * @param {string} [string=''] The string to inspect.
  15049. * @param {string} [target] The string to search for.
  15050. * @param {number} [position=string.length] The position to search up to.
  15051. * @returns {boolean} Returns `true` if `string` ends with `target`,
  15052. * else `false`.
  15053. * @example
  15054. *
  15055. * _.endsWith('abc', 'c');
  15056. * // => true
  15057. *
  15058. * _.endsWith('abc', 'b');
  15059. * // => false
  15060. *
  15061. * _.endsWith('abc', 'b', 2);
  15062. * // => true
  15063. */
  15064. function endsWith(string, target, position) {
  15065. string = toString(string);
  15066. target = baseToString(target);
  15067. var length = string.length;
  15068. position = position === undefined
  15069. ? length
  15070. : baseClamp(toInteger(position), 0, length);
  15071. var end = position;
  15072. position -= target.length;
  15073. return position >= 0 && string.slice(position, end) == target;
  15074. }
  15075. /**
  15076. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  15077. * corresponding HTML entities.
  15078. *
  15079. * **Note:** No other characters are escaped. To escape additional
  15080. * characters use a third-party library like [_he_](https://mths.be/he).
  15081. *
  15082. * Though the ">" character is escaped for symmetry, characters like
  15083. * ">" and "/" don't need escaping in HTML and have no special meaning
  15084. * unless they're part of a tag or unquoted attribute value. See
  15085. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  15086. * (under "semi-related fun fact") for more details.
  15087. *
  15088. * When working with HTML you should always
  15089. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  15090. * XSS vectors.
  15091. *
  15092. * @static
  15093. * @since 0.1.0
  15094. * @memberOf _
  15095. * @category String
  15096. * @param {string} [string=''] The string to escape.
  15097. * @returns {string} Returns the escaped string.
  15098. * @example
  15099. *
  15100. * _.escape('fred, barney, & pebbles');
  15101. * // => 'fred, barney, &amp; pebbles'
  15102. */
  15103. function escape(string) {
  15104. string = toString(string);
  15105. return (string && reHasUnescapedHtml.test(string))
  15106. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  15107. : string;
  15108. }
  15109. /**
  15110. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  15111. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  15112. *
  15113. * @static
  15114. * @memberOf _
  15115. * @since 3.0.0
  15116. * @category String
  15117. * @param {string} [string=''] The string to escape.
  15118. * @returns {string} Returns the escaped string.
  15119. * @example
  15120. *
  15121. * _.escapeRegExp('[lodash](https://lodash.com/)');
  15122. * // => '\[lodash\]\(https://lodash\.com/\)'
  15123. */
  15124. function escapeRegExp(string) {
  15125. string = toString(string);
  15126. return (string && reHasRegExpChar.test(string))
  15127. ? string.replace(reRegExpChar, '\\$&')
  15128. : string;
  15129. }
  15130. /**
  15131. * Converts `string` to
  15132. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  15133. *
  15134. * @static
  15135. * @memberOf _
  15136. * @since 3.0.0
  15137. * @category String
  15138. * @param {string} [string=''] The string to convert.
  15139. * @returns {string} Returns the kebab cased string.
  15140. * @example
  15141. *
  15142. * _.kebabCase('Foo Bar');
  15143. * // => 'foo-bar'
  15144. *
  15145. * _.kebabCase('fooBar');
  15146. * // => 'foo-bar'
  15147. *
  15148. * _.kebabCase('__FOO_BAR__');
  15149. * // => 'foo-bar'
  15150. */
  15151. var kebabCase = createCompounder(function(result, word, index) {
  15152. return result + (index ? '-' : '') + word.toLowerCase();
  15153. });
  15154. /**
  15155. * Converts `string`, as space separated words, to lower case.
  15156. *
  15157. * @static
  15158. * @memberOf _
  15159. * @since 4.0.0
  15160. * @category String
  15161. * @param {string} [string=''] The string to convert.
  15162. * @returns {string} Returns the lower cased string.
  15163. * @example
  15164. *
  15165. * _.lowerCase('--Foo-Bar--');
  15166. * // => 'foo bar'
  15167. *
  15168. * _.lowerCase('fooBar');
  15169. * // => 'foo bar'
  15170. *
  15171. * _.lowerCase('__FOO_BAR__');
  15172. * // => 'foo bar'
  15173. */
  15174. var lowerCase = createCompounder(function(result, word, index) {
  15175. return result + (index ? ' ' : '') + word.toLowerCase();
  15176. });
  15177. /**
  15178. * Converts the first character of `string` to lower case.
  15179. *
  15180. * @static
  15181. * @memberOf _
  15182. * @since 4.0.0
  15183. * @category String
  15184. * @param {string} [string=''] The string to convert.
  15185. * @returns {string} Returns the converted string.
  15186. * @example
  15187. *
  15188. * _.lowerFirst('Fred');
  15189. * // => 'fred'
  15190. *
  15191. * _.lowerFirst('FRED');
  15192. * // => 'fRED'
  15193. */
  15194. var lowerFirst = createCaseFirst('toLowerCase');
  15195. /**
  15196. * Pads `string` on the left and right sides if it's shorter than `length`.
  15197. * Padding characters are truncated if they can't be evenly divided by `length`.
  15198. *
  15199. * @static
  15200. * @memberOf _
  15201. * @since 3.0.0
  15202. * @category String
  15203. * @param {string} [string=''] The string to pad.
  15204. * @param {number} [length=0] The padding length.
  15205. * @param {string} [chars=' '] The string used as padding.
  15206. * @returns {string} Returns the padded string.
  15207. * @example
  15208. *
  15209. * _.pad('abc', 8);
  15210. * // => ' abc '
  15211. *
  15212. * _.pad('abc', 8, '_-');
  15213. * // => '_-abc_-_'
  15214. *
  15215. * _.pad('abc', 3);
  15216. * // => 'abc'
  15217. */
  15218. function pad(string, length, chars) {
  15219. string = toString(string);
  15220. length = toInteger(length);
  15221. var strLength = length ? stringSize(string) : 0;
  15222. if (!length || strLength >= length) {
  15223. return string;
  15224. }
  15225. var mid = (length - strLength) / 2;
  15226. return (
  15227. createPadding(nativeFloor(mid), chars) +
  15228. string +
  15229. createPadding(nativeCeil(mid), chars)
  15230. );
  15231. }
  15232. /**
  15233. * Pads `string` on the right side if it's shorter than `length`. Padding
  15234. * characters are truncated if they exceed `length`.
  15235. *
  15236. * @static
  15237. * @memberOf _
  15238. * @since 4.0.0
  15239. * @category String
  15240. * @param {string} [string=''] The string to pad.
  15241. * @param {number} [length=0] The padding length.
  15242. * @param {string} [chars=' '] The string used as padding.
  15243. * @returns {string} Returns the padded string.
  15244. * @example
  15245. *
  15246. * _.padEnd('abc', 6);
  15247. * // => 'abc '
  15248. *
  15249. * _.padEnd('abc', 6, '_-');
  15250. * // => 'abc_-_'
  15251. *
  15252. * _.padEnd('abc', 3);
  15253. * // => 'abc'
  15254. */
  15255. function padEnd(string, length, chars) {
  15256. string = toString(string);
  15257. length = toInteger(length);
  15258. var strLength = length ? stringSize(string) : 0;
  15259. return (length && strLength < length)
  15260. ? (string + createPadding(length - strLength, chars))
  15261. : string;
  15262. }
  15263. /**
  15264. * Pads `string` on the left side if it's shorter than `length`. Padding
  15265. * characters are truncated if they exceed `length`.
  15266. *
  15267. * @static
  15268. * @memberOf _
  15269. * @since 4.0.0
  15270. * @category String
  15271. * @param {string} [string=''] The string to pad.
  15272. * @param {number} [length=0] The padding length.
  15273. * @param {string} [chars=' '] The string used as padding.
  15274. * @returns {string} Returns the padded string.
  15275. * @example
  15276. *
  15277. * _.padStart('abc', 6);
  15278. * // => ' abc'
  15279. *
  15280. * _.padStart('abc', 6, '_-');
  15281. * // => '_-_abc'
  15282. *
  15283. * _.padStart('abc', 3);
  15284. * // => 'abc'
  15285. */
  15286. function padStart(string, length, chars) {
  15287. string = toString(string);
  15288. length = toInteger(length);
  15289. var strLength = length ? stringSize(string) : 0;
  15290. return (length && strLength < length)
  15291. ? (createPadding(length - strLength, chars) + string)
  15292. : string;
  15293. }
  15294. /**
  15295. * Converts `string` to an integer of the specified radix. If `radix` is
  15296. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  15297. * hexadecimal, in which case a `radix` of `16` is used.
  15298. *
  15299. * **Note:** This method aligns with the
  15300. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  15301. *
  15302. * @static
  15303. * @memberOf _
  15304. * @since 1.1.0
  15305. * @category String
  15306. * @param {string} string The string to convert.
  15307. * @param {number} [radix=10] The radix to interpret `value` by.
  15308. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15309. * @returns {number} Returns the converted integer.
  15310. * @example
  15311. *
  15312. * _.parseInt('08');
  15313. * // => 8
  15314. *
  15315. * _.map(['6', '08', '10'], _.parseInt);
  15316. * // => [6, 8, 10]
  15317. */
  15318. function parseInt(string, radix, guard) {
  15319. if (guard || radix == null) {
  15320. radix = 0;
  15321. } else if (radix) {
  15322. radix = +radix;
  15323. }
  15324. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  15325. }
  15326. /**
  15327. * Repeats the given string `n` times.
  15328. *
  15329. * @static
  15330. * @memberOf _
  15331. * @since 3.0.0
  15332. * @category String
  15333. * @param {string} [string=''] The string to repeat.
  15334. * @param {number} [n=1] The number of times to repeat the string.
  15335. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15336. * @returns {string} Returns the repeated string.
  15337. * @example
  15338. *
  15339. * _.repeat('*', 3);
  15340. * // => '***'
  15341. *
  15342. * _.repeat('abc', 2);
  15343. * // => 'abcabc'
  15344. *
  15345. * _.repeat('abc', 0);
  15346. * // => ''
  15347. */
  15348. function repeat(string, n, guard) {
  15349. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  15350. n = 1;
  15351. } else {
  15352. n = toInteger(n);
  15353. }
  15354. return baseRepeat(toString(string), n);
  15355. }
  15356. /**
  15357. * Replaces matches for `pattern` in `string` with `replacement`.
  15358. *
  15359. * **Note:** This method is based on
  15360. * [`String#replace`](https://mdn.io/String/replace).
  15361. *
  15362. * @static
  15363. * @memberOf _
  15364. * @since 4.0.0
  15365. * @category String
  15366. * @param {string} [string=''] The string to modify.
  15367. * @param {RegExp|string} pattern The pattern to replace.
  15368. * @param {Function|string} replacement The match replacement.
  15369. * @returns {string} Returns the modified string.
  15370. * @example
  15371. *
  15372. * _.replace('Hi Fred', 'Fred', 'Barney');
  15373. * // => 'Hi Barney'
  15374. */
  15375. function replace() {
  15376. var args = arguments,
  15377. string = toString(args[0]);
  15378. return args.length < 3 ? string : string.replace(args[1], args[2]);
  15379. }
  15380. /**
  15381. * Converts `string` to
  15382. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  15383. *
  15384. * @static
  15385. * @memberOf _
  15386. * @since 3.0.0
  15387. * @category String
  15388. * @param {string} [string=''] The string to convert.
  15389. * @returns {string} Returns the snake cased string.
  15390. * @example
  15391. *
  15392. * _.snakeCase('Foo Bar');
  15393. * // => 'foo_bar'
  15394. *
  15395. * _.snakeCase('fooBar');
  15396. * // => 'foo_bar'
  15397. *
  15398. * _.snakeCase('--FOO-BAR--');
  15399. * // => 'foo_bar'
  15400. */
  15401. var snakeCase = createCompounder(function(result, word, index) {
  15402. return result + (index ? '_' : '') + word.toLowerCase();
  15403. });
  15404. /**
  15405. * Splits `string` by `separator`.
  15406. *
  15407. * **Note:** This method is based on
  15408. * [`String#split`](https://mdn.io/String/split).
  15409. *
  15410. * @static
  15411. * @memberOf _
  15412. * @since 4.0.0
  15413. * @category String
  15414. * @param {string} [string=''] The string to split.
  15415. * @param {RegExp|string} separator The separator pattern to split by.
  15416. * @param {number} [limit] The length to truncate results to.
  15417. * @returns {Array} Returns the string segments.
  15418. * @example
  15419. *
  15420. * _.split('a-b-c', '-', 2);
  15421. * // => ['a', 'b']
  15422. */
  15423. function split(string, separator, limit) {
  15424. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  15425. separator = limit = undefined;
  15426. }
  15427. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  15428. if (!limit) {
  15429. return [];
  15430. }
  15431. string = toString(string);
  15432. if (string && (
  15433. typeof separator == 'string' ||
  15434. (separator != null && !isRegExp(separator))
  15435. )) {
  15436. separator = baseToString(separator);
  15437. if (!separator && hasUnicode(string)) {
  15438. return castSlice(stringToArray(string), 0, limit);
  15439. }
  15440. }
  15441. return string.split(separator, limit);
  15442. }
  15443. /**
  15444. * Converts `string` to
  15445. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  15446. *
  15447. * @static
  15448. * @memberOf _
  15449. * @since 3.1.0
  15450. * @category String
  15451. * @param {string} [string=''] The string to convert.
  15452. * @returns {string} Returns the start cased string.
  15453. * @example
  15454. *
  15455. * _.startCase('--foo-bar--');
  15456. * // => 'Foo Bar'
  15457. *
  15458. * _.startCase('fooBar');
  15459. * // => 'Foo Bar'
  15460. *
  15461. * _.startCase('__FOO_BAR__');
  15462. * // => 'FOO BAR'
  15463. */
  15464. var startCase = createCompounder(function(result, word, index) {
  15465. return result + (index ? ' ' : '') + upperFirst(word);
  15466. });
  15467. /**
  15468. * Checks if `string` starts with the given target string.
  15469. *
  15470. * @static
  15471. * @memberOf _
  15472. * @since 3.0.0
  15473. * @category String
  15474. * @param {string} [string=''] The string to inspect.
  15475. * @param {string} [target] The string to search for.
  15476. * @param {number} [position=0] The position to search from.
  15477. * @returns {boolean} Returns `true` if `string` starts with `target`,
  15478. * else `false`.
  15479. * @example
  15480. *
  15481. * _.startsWith('abc', 'a');
  15482. * // => true
  15483. *
  15484. * _.startsWith('abc', 'b');
  15485. * // => false
  15486. *
  15487. * _.startsWith('abc', 'b', 1);
  15488. * // => true
  15489. */
  15490. function startsWith(string, target, position) {
  15491. string = toString(string);
  15492. position = position == null
  15493. ? 0
  15494. : baseClamp(toInteger(position), 0, string.length);
  15495. target = baseToString(target);
  15496. return string.slice(position, position + target.length) == target;
  15497. }
  15498. /**
  15499. * Creates a compiled template function that can interpolate data properties
  15500. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  15501. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  15502. * properties may be accessed as free variables in the template. If a setting
  15503. * object is given, it takes precedence over `_.templateSettings` values.
  15504. *
  15505. * **Note:** In the development build `_.template` utilizes
  15506. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  15507. * for easier debugging.
  15508. *
  15509. * For more information on precompiling templates see
  15510. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  15511. *
  15512. * For more information on Chrome extension sandboxes see
  15513. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  15514. *
  15515. * @static
  15516. * @since 0.1.0
  15517. * @memberOf _
  15518. * @category String
  15519. * @param {string} [string=''] The template string.
  15520. * @param {Object} [options={}] The options object.
  15521. * @param {RegExp} [options.escape=_.templateSettings.escape]
  15522. * The HTML "escape" delimiter.
  15523. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  15524. * The "evaluate" delimiter.
  15525. * @param {Object} [options.imports=_.templateSettings.imports]
  15526. * An object to import into the template as free variables.
  15527. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  15528. * The "interpolate" delimiter.
  15529. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  15530. * The sourceURL of the compiled template.
  15531. * @param {string} [options.variable='obj']
  15532. * The data object variable name.
  15533. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15534. * @returns {Function} Returns the compiled template function.
  15535. * @example
  15536. *
  15537. * // Use the "interpolate" delimiter to create a compiled template.
  15538. * var compiled = _.template('hello <%= user %>!');
  15539. * compiled({ 'user': 'fred' });
  15540. * // => 'hello fred!'
  15541. *
  15542. * // Use the HTML "escape" delimiter to escape data property values.
  15543. * var compiled = _.template('<b><%- value %></b>');
  15544. * compiled({ 'value': '<script>' });
  15545. * // => '<b>&lt;script&gt;</b>'
  15546. *
  15547. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  15548. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  15549. * compiled({ 'users': ['fred', 'barney'] });
  15550. * // => '<li>fred</li><li>barney</li>'
  15551. *
  15552. * // Use the internal `print` function in "evaluate" delimiters.
  15553. * var compiled = _.template('<% print("hello " + user); %>!');
  15554. * compiled({ 'user': 'barney' });
  15555. * // => 'hello barney!'
  15556. *
  15557. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  15558. * // Disable support by replacing the "interpolate" delimiter.
  15559. * var compiled = _.template('hello ${ user }!');
  15560. * compiled({ 'user': 'pebbles' });
  15561. * // => 'hello pebbles!'
  15562. *
  15563. * // Use backslashes to treat delimiters as plain text.
  15564. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  15565. * compiled({ 'value': 'ignored' });
  15566. * // => '<%- value %>'
  15567. *
  15568. * // Use the `imports` option to import `jQuery` as `jq`.
  15569. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  15570. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  15571. * compiled({ 'users': ['fred', 'barney'] });
  15572. * // => '<li>fred</li><li>barney</li>'
  15573. *
  15574. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  15575. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  15576. * compiled(data);
  15577. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  15578. *
  15579. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  15580. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  15581. * compiled.source;
  15582. * // => function(data) {
  15583. * // var __t, __p = '';
  15584. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  15585. * // return __p;
  15586. * // }
  15587. *
  15588. * // Use custom template delimiters.
  15589. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  15590. * var compiled = _.template('hello {{ user }}!');
  15591. * compiled({ 'user': 'mustache' });
  15592. * // => 'hello mustache!'
  15593. *
  15594. * // Use the `source` property to inline compiled templates for meaningful
  15595. * // line numbers in error messages and stack traces.
  15596. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  15597. * var JST = {\
  15598. * "main": ' + _.template(mainText).source + '\
  15599. * };\
  15600. * ');
  15601. */
  15602. function template(string, options, guard) {
  15603. // Based on John Resig's `tmpl` implementation
  15604. // (http://ejohn.org/blog/javascript-micro-templating/)
  15605. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  15606. var settings = lodash.templateSettings;
  15607. if (guard && isIterateeCall(string, options, guard)) {
  15608. options = undefined;
  15609. }
  15610. string = toString(string);
  15611. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  15612. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  15613. importsKeys = keys(imports),
  15614. importsValues = baseValues(imports, importsKeys);
  15615. var isEscaping,
  15616. isEvaluating,
  15617. index = 0,
  15618. interpolate = options.interpolate || reNoMatch,
  15619. source = "__p += '";
  15620. // Compile the regexp to match each delimiter.
  15621. var reDelimiters = RegExp(
  15622. (options.escape || reNoMatch).source + '|' +
  15623. interpolate.source + '|' +
  15624. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  15625. (options.evaluate || reNoMatch).source + '|$'
  15626. , 'g');
  15627. // Use a sourceURL for easier debugging.
  15628. // The sourceURL gets injected into the source that's eval-ed, so be careful
  15629. // to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in
  15630. // and escape the comment, thus injecting code that gets evaled.
  15631. var sourceURL = '//# sourceURL=' +
  15632. (hasOwnProperty.call(options, 'sourceURL')
  15633. ? (options.sourceURL + '').replace(/\s/g, ' ')
  15634. : ('lodash.templateSources[' + (++templateCounter) + ']')
  15635. ) + '\n';
  15636. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  15637. interpolateValue || (interpolateValue = esTemplateValue);
  15638. // Escape characters that can't be included in string literals.
  15639. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  15640. // Replace delimiters with snippets.
  15641. if (escapeValue) {
  15642. isEscaping = true;
  15643. source += "' +\n__e(" + escapeValue + ") +\n'";
  15644. }
  15645. if (evaluateValue) {
  15646. isEvaluating = true;
  15647. source += "';\n" + evaluateValue + ";\n__p += '";
  15648. }
  15649. if (interpolateValue) {
  15650. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  15651. }
  15652. index = offset + match.length;
  15653. // The JS engine embedded in Adobe products needs `match` returned in
  15654. // order to produce the correct `offset` value.
  15655. return match;
  15656. });
  15657. source += "';\n";
  15658. // If `variable` is not specified wrap a with-statement around the generated
  15659. // code to add the data object to the top of the scope chain.
  15660. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  15661. if (!variable) {
  15662. source = 'with (obj) {\n' + source + '\n}\n';
  15663. }
  15664. // Throw an error if a forbidden character was found in `variable`, to prevent
  15665. // potential command injection attacks.
  15666. else if (reForbiddenIdentifierChars.test(variable)) {
  15667. throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);
  15668. }
  15669. // Cleanup code by stripping empty strings.
  15670. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  15671. .replace(reEmptyStringMiddle, '$1')
  15672. .replace(reEmptyStringTrailing, '$1;');
  15673. // Frame code as the function body.
  15674. source = 'function(' + (variable || 'obj') + ') {\n' +
  15675. (variable
  15676. ? ''
  15677. : 'obj || (obj = {});\n'
  15678. ) +
  15679. "var __t, __p = ''" +
  15680. (isEscaping
  15681. ? ', __e = _.escape'
  15682. : ''
  15683. ) +
  15684. (isEvaluating
  15685. ? ', __j = Array.prototype.join;\n' +
  15686. "function print() { __p += __j.call(arguments, '') }\n"
  15687. : ';\n'
  15688. ) +
  15689. source +
  15690. 'return __p\n}';
  15691. var result = attempt(function() {
  15692. return Function(importsKeys, sourceURL + 'return ' + source)
  15693. .apply(undefined, importsValues);
  15694. });
  15695. // Provide the compiled function's source by its `toString` method or
  15696. // the `source` property as a convenience for inlining compiled templates.
  15697. result.source = source;
  15698. if (isError(result)) {
  15699. throw result;
  15700. }
  15701. return result;
  15702. }
  15703. /**
  15704. * Converts `string`, as a whole, to lower case just like
  15705. * [String#toLowerCase](https://mdn.io/toLowerCase).
  15706. *
  15707. * @static
  15708. * @memberOf _
  15709. * @since 4.0.0
  15710. * @category String
  15711. * @param {string} [string=''] The string to convert.
  15712. * @returns {string} Returns the lower cased string.
  15713. * @example
  15714. *
  15715. * _.toLower('--Foo-Bar--');
  15716. * // => '--foo-bar--'
  15717. *
  15718. * _.toLower('fooBar');
  15719. * // => 'foobar'
  15720. *
  15721. * _.toLower('__FOO_BAR__');
  15722. * // => '__foo_bar__'
  15723. */
  15724. function toLower(value) {
  15725. return toString(value).toLowerCase();
  15726. }
  15727. /**
  15728. * Converts `string`, as a whole, to upper case just like
  15729. * [String#toUpperCase](https://mdn.io/toUpperCase).
  15730. *
  15731. * @static
  15732. * @memberOf _
  15733. * @since 4.0.0
  15734. * @category String
  15735. * @param {string} [string=''] The string to convert.
  15736. * @returns {string} Returns the upper cased string.
  15737. * @example
  15738. *
  15739. * _.toUpper('--foo-bar--');
  15740. * // => '--FOO-BAR--'
  15741. *
  15742. * _.toUpper('fooBar');
  15743. * // => 'FOOBAR'
  15744. *
  15745. * _.toUpper('__foo_bar__');
  15746. * // => '__FOO_BAR__'
  15747. */
  15748. function toUpper(value) {
  15749. return toString(value).toUpperCase();
  15750. }
  15751. /**
  15752. * Removes leading and trailing whitespace or specified characters from `string`.
  15753. *
  15754. * @static
  15755. * @memberOf _
  15756. * @since 3.0.0
  15757. * @category String
  15758. * @param {string} [string=''] The string to trim.
  15759. * @param {string} [chars=whitespace] The characters to trim.
  15760. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15761. * @returns {string} Returns the trimmed string.
  15762. * @example
  15763. *
  15764. * _.trim(' abc ');
  15765. * // => 'abc'
  15766. *
  15767. * _.trim('-_-abc-_-', '_-');
  15768. * // => 'abc'
  15769. *
  15770. * _.map([' foo ', ' bar '], _.trim);
  15771. * // => ['foo', 'bar']
  15772. */
  15773. function trim(string, chars, guard) {
  15774. string = toString(string);
  15775. if (string && (guard || chars === undefined)) {
  15776. return baseTrim(string);
  15777. }
  15778. if (!string || !(chars = baseToString(chars))) {
  15779. return string;
  15780. }
  15781. var strSymbols = stringToArray(string),
  15782. chrSymbols = stringToArray(chars),
  15783. start = charsStartIndex(strSymbols, chrSymbols),
  15784. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  15785. return castSlice(strSymbols, start, end).join('');
  15786. }
  15787. /**
  15788. * Removes trailing whitespace or specified characters from `string`.
  15789. *
  15790. * @static
  15791. * @memberOf _
  15792. * @since 4.0.0
  15793. * @category String
  15794. * @param {string} [string=''] The string to trim.
  15795. * @param {string} [chars=whitespace] The characters to trim.
  15796. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15797. * @returns {string} Returns the trimmed string.
  15798. * @example
  15799. *
  15800. * _.trimEnd(' abc ');
  15801. * // => ' abc'
  15802. *
  15803. * _.trimEnd('-_-abc-_-', '_-');
  15804. * // => '-_-abc'
  15805. */
  15806. function trimEnd(string, chars, guard) {
  15807. string = toString(string);
  15808. if (string && (guard || chars === undefined)) {
  15809. return string.slice(0, trimmedEndIndex(string) + 1);
  15810. }
  15811. if (!string || !(chars = baseToString(chars))) {
  15812. return string;
  15813. }
  15814. var strSymbols = stringToArray(string),
  15815. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  15816. return castSlice(strSymbols, 0, end).join('');
  15817. }
  15818. /**
  15819. * Removes leading whitespace or specified characters from `string`.
  15820. *
  15821. * @static
  15822. * @memberOf _
  15823. * @since 4.0.0
  15824. * @category String
  15825. * @param {string} [string=''] The string to trim.
  15826. * @param {string} [chars=whitespace] The characters to trim.
  15827. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15828. * @returns {string} Returns the trimmed string.
  15829. * @example
  15830. *
  15831. * _.trimStart(' abc ');
  15832. * // => 'abc '
  15833. *
  15834. * _.trimStart('-_-abc-_-', '_-');
  15835. * // => 'abc-_-'
  15836. */
  15837. function trimStart(string, chars, guard) {
  15838. string = toString(string);
  15839. if (string && (guard || chars === undefined)) {
  15840. return string.replace(reTrimStart, '');
  15841. }
  15842. if (!string || !(chars = baseToString(chars))) {
  15843. return string;
  15844. }
  15845. var strSymbols = stringToArray(string),
  15846. start = charsStartIndex(strSymbols, stringToArray(chars));
  15847. return castSlice(strSymbols, start).join('');
  15848. }
  15849. /**
  15850. * Truncates `string` if it's longer than the given maximum string length.
  15851. * The last characters of the truncated string are replaced with the omission
  15852. * string which defaults to "...".
  15853. *
  15854. * @static
  15855. * @memberOf _
  15856. * @since 4.0.0
  15857. * @category String
  15858. * @param {string} [string=''] The string to truncate.
  15859. * @param {Object} [options={}] The options object.
  15860. * @param {number} [options.length=30] The maximum string length.
  15861. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  15862. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  15863. * @returns {string} Returns the truncated string.
  15864. * @example
  15865. *
  15866. * _.truncate('hi-diddly-ho there, neighborino');
  15867. * // => 'hi-diddly-ho there, neighbo...'
  15868. *
  15869. * _.truncate('hi-diddly-ho there, neighborino', {
  15870. * 'length': 24,
  15871. * 'separator': ' '
  15872. * });
  15873. * // => 'hi-diddly-ho there,...'
  15874. *
  15875. * _.truncate('hi-diddly-ho there, neighborino', {
  15876. * 'length': 24,
  15877. * 'separator': /,? +/
  15878. * });
  15879. * // => 'hi-diddly-ho there...'
  15880. *
  15881. * _.truncate('hi-diddly-ho there, neighborino', {
  15882. * 'omission': ' [...]'
  15883. * });
  15884. * // => 'hi-diddly-ho there, neig [...]'
  15885. */
  15886. function truncate(string, options) {
  15887. var length = DEFAULT_TRUNC_LENGTH,
  15888. omission = DEFAULT_TRUNC_OMISSION;
  15889. if (isObject(options)) {
  15890. var separator = 'separator' in options ? options.separator : separator;
  15891. length = 'length' in options ? toInteger(options.length) : length;
  15892. omission = 'omission' in options ? baseToString(options.omission) : omission;
  15893. }
  15894. string = toString(string);
  15895. var strLength = string.length;
  15896. if (hasUnicode(string)) {
  15897. var strSymbols = stringToArray(string);
  15898. strLength = strSymbols.length;
  15899. }
  15900. if (length >= strLength) {
  15901. return string;
  15902. }
  15903. var end = length - stringSize(omission);
  15904. if (end < 1) {
  15905. return omission;
  15906. }
  15907. var result = strSymbols
  15908. ? castSlice(strSymbols, 0, end).join('')
  15909. : string.slice(0, end);
  15910. if (separator === undefined) {
  15911. return result + omission;
  15912. }
  15913. if (strSymbols) {
  15914. end += (result.length - end);
  15915. }
  15916. if (isRegExp(separator)) {
  15917. if (string.slice(end).search(separator)) {
  15918. var match,
  15919. substring = result;
  15920. if (!separator.global) {
  15921. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  15922. }
  15923. separator.lastIndex = 0;
  15924. while ((match = separator.exec(substring))) {
  15925. var newEnd = match.index;
  15926. }
  15927. result = result.slice(0, newEnd === undefined ? end : newEnd);
  15928. }
  15929. } else if (string.indexOf(baseToString(separator), end) != end) {
  15930. var index = result.lastIndexOf(separator);
  15931. if (index > -1) {
  15932. result = result.slice(0, index);
  15933. }
  15934. }
  15935. return result + omission;
  15936. }
  15937. /**
  15938. * The inverse of `_.escape`; this method converts the HTML entities
  15939. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  15940. * their corresponding characters.
  15941. *
  15942. * **Note:** No other HTML entities are unescaped. To unescape additional
  15943. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  15944. *
  15945. * @static
  15946. * @memberOf _
  15947. * @since 0.6.0
  15948. * @category String
  15949. * @param {string} [string=''] The string to unescape.
  15950. * @returns {string} Returns the unescaped string.
  15951. * @example
  15952. *
  15953. * _.unescape('fred, barney, &amp; pebbles');
  15954. * // => 'fred, barney, & pebbles'
  15955. */
  15956. function unescape(string) {
  15957. string = toString(string);
  15958. return (string && reHasEscapedHtml.test(string))
  15959. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  15960. : string;
  15961. }
  15962. /**
  15963. * Converts `string`, as space separated words, to upper case.
  15964. *
  15965. * @static
  15966. * @memberOf _
  15967. * @since 4.0.0
  15968. * @category String
  15969. * @param {string} [string=''] The string to convert.
  15970. * @returns {string} Returns the upper cased string.
  15971. * @example
  15972. *
  15973. * _.upperCase('--foo-bar');
  15974. * // => 'FOO BAR'
  15975. *
  15976. * _.upperCase('fooBar');
  15977. * // => 'FOO BAR'
  15978. *
  15979. * _.upperCase('__foo_bar__');
  15980. * // => 'FOO BAR'
  15981. */
  15982. var upperCase = createCompounder(function(result, word, index) {
  15983. return result + (index ? ' ' : '') + word.toUpperCase();
  15984. });
  15985. /**
  15986. * Converts the first character of `string` to upper case.
  15987. *
  15988. * @static
  15989. * @memberOf _
  15990. * @since 4.0.0
  15991. * @category String
  15992. * @param {string} [string=''] The string to convert.
  15993. * @returns {string} Returns the converted string.
  15994. * @example
  15995. *
  15996. * _.upperFirst('fred');
  15997. * // => 'Fred'
  15998. *
  15999. * _.upperFirst('FRED');
  16000. * // => 'FRED'
  16001. */
  16002. var upperFirst = createCaseFirst('toUpperCase');
  16003. /**
  16004. * Splits `string` into an array of its words.
  16005. *
  16006. * @static
  16007. * @memberOf _
  16008. * @since 3.0.0
  16009. * @category String
  16010. * @param {string} [string=''] The string to inspect.
  16011. * @param {RegExp|string} [pattern] The pattern to match words.
  16012. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  16013. * @returns {Array} Returns the words of `string`.
  16014. * @example
  16015. *
  16016. * _.words('fred, barney, & pebbles');
  16017. * // => ['fred', 'barney', 'pebbles']
  16018. *
  16019. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  16020. * // => ['fred', 'barney', '&', 'pebbles']
  16021. */
  16022. function words(string, pattern, guard) {
  16023. string = toString(string);
  16024. pattern = guard ? undefined : pattern;
  16025. if (pattern === undefined) {
  16026. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  16027. }
  16028. return string.match(pattern) || [];
  16029. }
  16030. /*------------------------------------------------------------------------*/
  16031. /**
  16032. * Attempts to invoke `func`, returning either the result or the caught error
  16033. * object. Any additional arguments are provided to `func` when it's invoked.
  16034. *
  16035. * @static
  16036. * @memberOf _
  16037. * @since 3.0.0
  16038. * @category Util
  16039. * @param {Function} func The function to attempt.
  16040. * @param {...*} [args] The arguments to invoke `func` with.
  16041. * @returns {*} Returns the `func` result or error object.
  16042. * @example
  16043. *
  16044. * // Avoid throwing errors for invalid selectors.
  16045. * var elements = _.attempt(function(selector) {
  16046. * return document.querySelectorAll(selector);
  16047. * }, '>_>');
  16048. *
  16049. * if (_.isError(elements)) {
  16050. * elements = [];
  16051. * }
  16052. */
  16053. var attempt = baseRest(function(func, args) {
  16054. try {
  16055. return apply(func, undefined, args);
  16056. } catch (e) {
  16057. return isError(e) ? e : new Error(e);
  16058. }
  16059. });
  16060. /**
  16061. * Binds methods of an object to the object itself, overwriting the existing
  16062. * method.
  16063. *
  16064. * **Note:** This method doesn't set the "length" property of bound functions.
  16065. *
  16066. * @static
  16067. * @since 0.1.0
  16068. * @memberOf _
  16069. * @category Util
  16070. * @param {Object} object The object to bind and assign the bound methods to.
  16071. * @param {...(string|string[])} methodNames The object method names to bind.
  16072. * @returns {Object} Returns `object`.
  16073. * @example
  16074. *
  16075. * var view = {
  16076. * 'label': 'docs',
  16077. * 'click': function() {
  16078. * console.log('clicked ' + this.label);
  16079. * }
  16080. * };
  16081. *
  16082. * _.bindAll(view, ['click']);
  16083. * jQuery(element).on('click', view.click);
  16084. * // => Logs 'clicked docs' when clicked.
  16085. */
  16086. var bindAll = flatRest(function(object, methodNames) {
  16087. arrayEach(methodNames, function(key) {
  16088. key = toKey(key);
  16089. baseAssignValue(object, key, bind(object[key], object));
  16090. });
  16091. return object;
  16092. });
  16093. /**
  16094. * Creates a function that iterates over `pairs` and invokes the corresponding
  16095. * function of the first predicate to return truthy. The predicate-function
  16096. * pairs are invoked with the `this` binding and arguments of the created
  16097. * function.
  16098. *
  16099. * @static
  16100. * @memberOf _
  16101. * @since 4.0.0
  16102. * @category Util
  16103. * @param {Array} pairs The predicate-function pairs.
  16104. * @returns {Function} Returns the new composite function.
  16105. * @example
  16106. *
  16107. * var func = _.cond([
  16108. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  16109. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  16110. * [_.stubTrue, _.constant('no match')]
  16111. * ]);
  16112. *
  16113. * func({ 'a': 1, 'b': 2 });
  16114. * // => 'matches A'
  16115. *
  16116. * func({ 'a': 0, 'b': 1 });
  16117. * // => 'matches B'
  16118. *
  16119. * func({ 'a': '1', 'b': '2' });
  16120. * // => 'no match'
  16121. */
  16122. function cond(pairs) {
  16123. var length = pairs == null ? 0 : pairs.length,
  16124. toIteratee = getIteratee();
  16125. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  16126. if (typeof pair[1] != 'function') {
  16127. throw new TypeError(FUNC_ERROR_TEXT);
  16128. }
  16129. return [toIteratee(pair[0]), pair[1]];
  16130. });
  16131. return baseRest(function(args) {
  16132. var index = -1;
  16133. while (++index < length) {
  16134. var pair = pairs[index];
  16135. if (apply(pair[0], this, args)) {
  16136. return apply(pair[1], this, args);
  16137. }
  16138. }
  16139. });
  16140. }
  16141. /**
  16142. * Creates a function that invokes the predicate properties of `source` with
  16143. * the corresponding property values of a given object, returning `true` if
  16144. * all predicates return truthy, else `false`.
  16145. *
  16146. * **Note:** The created function is equivalent to `_.conformsTo` with
  16147. * `source` partially applied.
  16148. *
  16149. * @static
  16150. * @memberOf _
  16151. * @since 4.0.0
  16152. * @category Util
  16153. * @param {Object} source The object of property predicates to conform to.
  16154. * @returns {Function} Returns the new spec function.
  16155. * @example
  16156. *
  16157. * var objects = [
  16158. * { 'a': 2, 'b': 1 },
  16159. * { 'a': 1, 'b': 2 }
  16160. * ];
  16161. *
  16162. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  16163. * // => [{ 'a': 1, 'b': 2 }]
  16164. */
  16165. function conforms(source) {
  16166. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  16167. }
  16168. /**
  16169. * Creates a function that returns `value`.
  16170. *
  16171. * @static
  16172. * @memberOf _
  16173. * @since 2.4.0
  16174. * @category Util
  16175. * @param {*} value The value to return from the new function.
  16176. * @returns {Function} Returns the new constant function.
  16177. * @example
  16178. *
  16179. * var objects = _.times(2, _.constant({ 'a': 1 }));
  16180. *
  16181. * console.log(objects);
  16182. * // => [{ 'a': 1 }, { 'a': 1 }]
  16183. *
  16184. * console.log(objects[0] === objects[1]);
  16185. * // => true
  16186. */
  16187. function constant(value) {
  16188. return function() {
  16189. return value;
  16190. };
  16191. }
  16192. /**
  16193. * Checks `value` to determine whether a default value should be returned in
  16194. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  16195. * or `undefined`.
  16196. *
  16197. * @static
  16198. * @memberOf _
  16199. * @since 4.14.0
  16200. * @category Util
  16201. * @param {*} value The value to check.
  16202. * @param {*} defaultValue The default value.
  16203. * @returns {*} Returns the resolved value.
  16204. * @example
  16205. *
  16206. * _.defaultTo(1, 10);
  16207. * // => 1
  16208. *
  16209. * _.defaultTo(undefined, 10);
  16210. * // => 10
  16211. */
  16212. function defaultTo(value, defaultValue) {
  16213. return (value == null || value !== value) ? defaultValue : value;
  16214. }
  16215. /**
  16216. * Creates a function that returns the result of invoking the given functions
  16217. * with the `this` binding of the created function, where each successive
  16218. * invocation is supplied the return value of the previous.
  16219. *
  16220. * @static
  16221. * @memberOf _
  16222. * @since 3.0.0
  16223. * @category Util
  16224. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  16225. * @returns {Function} Returns the new composite function.
  16226. * @see _.flowRight
  16227. * @example
  16228. *
  16229. * function square(n) {
  16230. * return n * n;
  16231. * }
  16232. *
  16233. * var addSquare = _.flow([_.add, square]);
  16234. * addSquare(1, 2);
  16235. * // => 9
  16236. */
  16237. var flow = createFlow();
  16238. /**
  16239. * This method is like `_.flow` except that it creates a function that
  16240. * invokes the given functions from right to left.
  16241. *
  16242. * @static
  16243. * @since 3.0.0
  16244. * @memberOf _
  16245. * @category Util
  16246. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  16247. * @returns {Function} Returns the new composite function.
  16248. * @see _.flow
  16249. * @example
  16250. *
  16251. * function square(n) {
  16252. * return n * n;
  16253. * }
  16254. *
  16255. * var addSquare = _.flowRight([square, _.add]);
  16256. * addSquare(1, 2);
  16257. * // => 9
  16258. */
  16259. var flowRight = createFlow(true);
  16260. /**
  16261. * This method returns the first argument it receives.
  16262. *
  16263. * @static
  16264. * @since 0.1.0
  16265. * @memberOf _
  16266. * @category Util
  16267. * @param {*} value Any value.
  16268. * @returns {*} Returns `value`.
  16269. * @example
  16270. *
  16271. * var object = { 'a': 1 };
  16272. *
  16273. * console.log(_.identity(object) === object);
  16274. * // => true
  16275. */
  16276. function identity(value) {
  16277. return value;
  16278. }
  16279. /**
  16280. * Creates a function that invokes `func` with the arguments of the created
  16281. * function. If `func` is a property name, the created function returns the
  16282. * property value for a given element. If `func` is an array or object, the
  16283. * created function returns `true` for elements that contain the equivalent
  16284. * source properties, otherwise it returns `false`.
  16285. *
  16286. * @static
  16287. * @since 4.0.0
  16288. * @memberOf _
  16289. * @category Util
  16290. * @param {*} [func=_.identity] The value to convert to a callback.
  16291. * @returns {Function} Returns the callback.
  16292. * @example
  16293. *
  16294. * var users = [
  16295. * { 'user': 'barney', 'age': 36, 'active': true },
  16296. * { 'user': 'fred', 'age': 40, 'active': false }
  16297. * ];
  16298. *
  16299. * // The `_.matches` iteratee shorthand.
  16300. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  16301. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  16302. *
  16303. * // The `_.matchesProperty` iteratee shorthand.
  16304. * _.filter(users, _.iteratee(['user', 'fred']));
  16305. * // => [{ 'user': 'fred', 'age': 40 }]
  16306. *
  16307. * // The `_.property` iteratee shorthand.
  16308. * _.map(users, _.iteratee('user'));
  16309. * // => ['barney', 'fred']
  16310. *
  16311. * // Create custom iteratee shorthands.
  16312. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  16313. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  16314. * return func.test(string);
  16315. * };
  16316. * });
  16317. *
  16318. * _.filter(['abc', 'def'], /ef/);
  16319. * // => ['def']
  16320. */
  16321. function iteratee(func) {
  16322. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  16323. }
  16324. /**
  16325. * Creates a function that performs a partial deep comparison between a given
  16326. * object and `source`, returning `true` if the given object has equivalent
  16327. * property values, else `false`.
  16328. *
  16329. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  16330. * partially applied.
  16331. *
  16332. * Partial comparisons will match empty array and empty object `source`
  16333. * values against any array or object value, respectively. See `_.isEqual`
  16334. * for a list of supported value comparisons.
  16335. *
  16336. * **Note:** Multiple values can be checked by combining several matchers
  16337. * using `_.overSome`
  16338. *
  16339. * @static
  16340. * @memberOf _
  16341. * @since 3.0.0
  16342. * @category Util
  16343. * @param {Object} source The object of property values to match.
  16344. * @returns {Function} Returns the new spec function.
  16345. * @example
  16346. *
  16347. * var objects = [
  16348. * { 'a': 1, 'b': 2, 'c': 3 },
  16349. * { 'a': 4, 'b': 5, 'c': 6 }
  16350. * ];
  16351. *
  16352. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  16353. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  16354. *
  16355. * // Checking for several possible values
  16356. * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));
  16357. * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
  16358. */
  16359. function matches(source) {
  16360. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  16361. }
  16362. /**
  16363. * Creates a function that performs a partial deep comparison between the
  16364. * value at `path` of a given object to `srcValue`, returning `true` if the
  16365. * object value is equivalent, else `false`.
  16366. *
  16367. * **Note:** Partial comparisons will match empty array and empty object
  16368. * `srcValue` values against any array or object value, respectively. See
  16369. * `_.isEqual` for a list of supported value comparisons.
  16370. *
  16371. * **Note:** Multiple values can be checked by combining several matchers
  16372. * using `_.overSome`
  16373. *
  16374. * @static
  16375. * @memberOf _
  16376. * @since 3.2.0
  16377. * @category Util
  16378. * @param {Array|string} path The path of the property to get.
  16379. * @param {*} srcValue The value to match.
  16380. * @returns {Function} Returns the new spec function.
  16381. * @example
  16382. *
  16383. * var objects = [
  16384. * { 'a': 1, 'b': 2, 'c': 3 },
  16385. * { 'a': 4, 'b': 5, 'c': 6 }
  16386. * ];
  16387. *
  16388. * _.find(objects, _.matchesProperty('a', 4));
  16389. * // => { 'a': 4, 'b': 5, 'c': 6 }
  16390. *
  16391. * // Checking for several possible values
  16392. * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)]));
  16393. * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
  16394. */
  16395. function matchesProperty(path, srcValue) {
  16396. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  16397. }
  16398. /**
  16399. * Creates a function that invokes the method at `path` of a given object.
  16400. * Any additional arguments are provided to the invoked method.
  16401. *
  16402. * @static
  16403. * @memberOf _
  16404. * @since 3.7.0
  16405. * @category Util
  16406. * @param {Array|string} path The path of the method to invoke.
  16407. * @param {...*} [args] The arguments to invoke the method with.
  16408. * @returns {Function} Returns the new invoker function.
  16409. * @example
  16410. *
  16411. * var objects = [
  16412. * { 'a': { 'b': _.constant(2) } },
  16413. * { 'a': { 'b': _.constant(1) } }
  16414. * ];
  16415. *
  16416. * _.map(objects, _.method('a.b'));
  16417. * // => [2, 1]
  16418. *
  16419. * _.map(objects, _.method(['a', 'b']));
  16420. * // => [2, 1]
  16421. */
  16422. var method = baseRest(function(path, args) {
  16423. return function(object) {
  16424. return baseInvoke(object, path, args);
  16425. };
  16426. });
  16427. /**
  16428. * The opposite of `_.method`; this method creates a function that invokes
  16429. * the method at a given path of `object`. Any additional arguments are
  16430. * provided to the invoked method.
  16431. *
  16432. * @static
  16433. * @memberOf _
  16434. * @since 3.7.0
  16435. * @category Util
  16436. * @param {Object} object The object to query.
  16437. * @param {...*} [args] The arguments to invoke the method with.
  16438. * @returns {Function} Returns the new invoker function.
  16439. * @example
  16440. *
  16441. * var array = _.times(3, _.constant),
  16442. * object = { 'a': array, 'b': array, 'c': array };
  16443. *
  16444. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  16445. * // => [2, 0]
  16446. *
  16447. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  16448. * // => [2, 0]
  16449. */
  16450. var methodOf = baseRest(function(object, args) {
  16451. return function(path) {
  16452. return baseInvoke(object, path, args);
  16453. };
  16454. });
  16455. /**
  16456. * Adds all own enumerable string keyed function properties of a source
  16457. * object to the destination object. If `object` is a function, then methods
  16458. * are added to its prototype as well.
  16459. *
  16460. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  16461. * avoid conflicts caused by modifying the original.
  16462. *
  16463. * @static
  16464. * @since 0.1.0
  16465. * @memberOf _
  16466. * @category Util
  16467. * @param {Function|Object} [object=lodash] The destination object.
  16468. * @param {Object} source The object of functions to add.
  16469. * @param {Object} [options={}] The options object.
  16470. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  16471. * @returns {Function|Object} Returns `object`.
  16472. * @example
  16473. *
  16474. * function vowels(string) {
  16475. * return _.filter(string, function(v) {
  16476. * return /[aeiou]/i.test(v);
  16477. * });
  16478. * }
  16479. *
  16480. * _.mixin({ 'vowels': vowels });
  16481. * _.vowels('fred');
  16482. * // => ['e']
  16483. *
  16484. * _('fred').vowels().value();
  16485. * // => ['e']
  16486. *
  16487. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  16488. * _('fred').vowels();
  16489. * // => ['e']
  16490. */
  16491. function mixin(object, source, options) {
  16492. var props = keys(source),
  16493. methodNames = baseFunctions(source, props);
  16494. if (options == null &&
  16495. !(isObject(source) && (methodNames.length || !props.length))) {
  16496. options = source;
  16497. source = object;
  16498. object = this;
  16499. methodNames = baseFunctions(source, keys(source));
  16500. }
  16501. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  16502. isFunc = isFunction(object);
  16503. arrayEach(methodNames, function(methodName) {
  16504. var func = source[methodName];
  16505. object[methodName] = func;
  16506. if (isFunc) {
  16507. object.prototype[methodName] = function() {
  16508. var chainAll = this.__chain__;
  16509. if (chain || chainAll) {
  16510. var result = object(this.__wrapped__),
  16511. actions = result.__actions__ = copyArray(this.__actions__);
  16512. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  16513. result.__chain__ = chainAll;
  16514. return result;
  16515. }
  16516. return func.apply(object, arrayPush([this.value()], arguments));
  16517. };
  16518. }
  16519. });
  16520. return object;
  16521. }
  16522. /**
  16523. * Reverts the `_` variable to its previous value and returns a reference to
  16524. * the `lodash` function.
  16525. *
  16526. * @static
  16527. * @since 0.1.0
  16528. * @memberOf _
  16529. * @category Util
  16530. * @returns {Function} Returns the `lodash` function.
  16531. * @example
  16532. *
  16533. * var lodash = _.noConflict();
  16534. */
  16535. function noConflict() {
  16536. if (root._ === this) {
  16537. root._ = oldDash;
  16538. }
  16539. return this;
  16540. }
  16541. /**
  16542. * This method returns `undefined`.
  16543. *
  16544. * @static
  16545. * @memberOf _
  16546. * @since 2.3.0
  16547. * @category Util
  16548. * @example
  16549. *
  16550. * _.times(2, _.noop);
  16551. * // => [undefined, undefined]
  16552. */
  16553. function noop() {
  16554. // No operation performed.
  16555. }
  16556. /**
  16557. * Creates a function that gets the argument at index `n`. If `n` is negative,
  16558. * the nth argument from the end is returned.
  16559. *
  16560. * @static
  16561. * @memberOf _
  16562. * @since 4.0.0
  16563. * @category Util
  16564. * @param {number} [n=0] The index of the argument to return.
  16565. * @returns {Function} Returns the new pass-thru function.
  16566. * @example
  16567. *
  16568. * var func = _.nthArg(1);
  16569. * func('a', 'b', 'c', 'd');
  16570. * // => 'b'
  16571. *
  16572. * var func = _.nthArg(-2);
  16573. * func('a', 'b', 'c', 'd');
  16574. * // => 'c'
  16575. */
  16576. function nthArg(n) {
  16577. n = toInteger(n);
  16578. return baseRest(function(args) {
  16579. return baseNth(args, n);
  16580. });
  16581. }
  16582. /**
  16583. * Creates a function that invokes `iteratees` with the arguments it receives
  16584. * and returns their results.
  16585. *
  16586. * @static
  16587. * @memberOf _
  16588. * @since 4.0.0
  16589. * @category Util
  16590. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  16591. * The iteratees to invoke.
  16592. * @returns {Function} Returns the new function.
  16593. * @example
  16594. *
  16595. * var func = _.over([Math.max, Math.min]);
  16596. *
  16597. * func(1, 2, 3, 4);
  16598. * // => [4, 1]
  16599. */
  16600. var over = createOver(arrayMap);
  16601. /**
  16602. * Creates a function that checks if **all** of the `predicates` return
  16603. * truthy when invoked with the arguments it receives.
  16604. *
  16605. * Following shorthands are possible for providing predicates.
  16606. * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
  16607. * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
  16608. *
  16609. * @static
  16610. * @memberOf _
  16611. * @since 4.0.0
  16612. * @category Util
  16613. * @param {...(Function|Function[])} [predicates=[_.identity]]
  16614. * The predicates to check.
  16615. * @returns {Function} Returns the new function.
  16616. * @example
  16617. *
  16618. * var func = _.overEvery([Boolean, isFinite]);
  16619. *
  16620. * func('1');
  16621. * // => true
  16622. *
  16623. * func(null);
  16624. * // => false
  16625. *
  16626. * func(NaN);
  16627. * // => false
  16628. */
  16629. var overEvery = createOver(arrayEvery);
  16630. /**
  16631. * Creates a function that checks if **any** of the `predicates` return
  16632. * truthy when invoked with the arguments it receives.
  16633. *
  16634. * Following shorthands are possible for providing predicates.
  16635. * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
  16636. * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
  16637. *
  16638. * @static
  16639. * @memberOf _
  16640. * @since 4.0.0
  16641. * @category Util
  16642. * @param {...(Function|Function[])} [predicates=[_.identity]]
  16643. * The predicates to check.
  16644. * @returns {Function} Returns the new function.
  16645. * @example
  16646. *
  16647. * var func = _.overSome([Boolean, isFinite]);
  16648. *
  16649. * func('1');
  16650. * // => true
  16651. *
  16652. * func(null);
  16653. * // => true
  16654. *
  16655. * func(NaN);
  16656. * // => false
  16657. *
  16658. * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }])
  16659. * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]])
  16660. */
  16661. var overSome = createOver(arraySome);
  16662. /**
  16663. * Creates a function that returns the value at `path` of a given object.
  16664. *
  16665. * @static
  16666. * @memberOf _
  16667. * @since 2.4.0
  16668. * @category Util
  16669. * @param {Array|string} path The path of the property to get.
  16670. * @returns {Function} Returns the new accessor function.
  16671. * @example
  16672. *
  16673. * var objects = [
  16674. * { 'a': { 'b': 2 } },
  16675. * { 'a': { 'b': 1 } }
  16676. * ];
  16677. *
  16678. * _.map(objects, _.property('a.b'));
  16679. * // => [2, 1]
  16680. *
  16681. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  16682. * // => [1, 2]
  16683. */
  16684. function property(path) {
  16685. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  16686. }
  16687. /**
  16688. * The opposite of `_.property`; this method creates a function that returns
  16689. * the value at a given path of `object`.
  16690. *
  16691. * @static
  16692. * @memberOf _
  16693. * @since 3.0.0
  16694. * @category Util
  16695. * @param {Object} object The object to query.
  16696. * @returns {Function} Returns the new accessor function.
  16697. * @example
  16698. *
  16699. * var array = [0, 1, 2],
  16700. * object = { 'a': array, 'b': array, 'c': array };
  16701. *
  16702. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  16703. * // => [2, 0]
  16704. *
  16705. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  16706. * // => [2, 0]
  16707. */
  16708. function propertyOf(object) {
  16709. return function(path) {
  16710. return object == null ? undefined : baseGet(object, path);
  16711. };
  16712. }
  16713. /**
  16714. * Creates an array of numbers (positive and/or negative) progressing from
  16715. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  16716. * `start` is specified without an `end` or `step`. If `end` is not specified,
  16717. * it's set to `start` with `start` then set to `0`.
  16718. *
  16719. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  16720. * floating-point values which can produce unexpected results.
  16721. *
  16722. * @static
  16723. * @since 0.1.0
  16724. * @memberOf _
  16725. * @category Util
  16726. * @param {number} [start=0] The start of the range.
  16727. * @param {number} end The end of the range.
  16728. * @param {number} [step=1] The value to increment or decrement by.
  16729. * @returns {Array} Returns the range of numbers.
  16730. * @see _.inRange, _.rangeRight
  16731. * @example
  16732. *
  16733. * _.range(4);
  16734. * // => [0, 1, 2, 3]
  16735. *
  16736. * _.range(-4);
  16737. * // => [0, -1, -2, -3]
  16738. *
  16739. * _.range(1, 5);
  16740. * // => [1, 2, 3, 4]
  16741. *
  16742. * _.range(0, 20, 5);
  16743. * // => [0, 5, 10, 15]
  16744. *
  16745. * _.range(0, -4, -1);
  16746. * // => [0, -1, -2, -3]
  16747. *
  16748. * _.range(1, 4, 0);
  16749. * // => [1, 1, 1]
  16750. *
  16751. * _.range(0);
  16752. * // => []
  16753. */
  16754. var range = createRange();
  16755. /**
  16756. * This method is like `_.range` except that it populates values in
  16757. * descending order.
  16758. *
  16759. * @static
  16760. * @memberOf _
  16761. * @since 4.0.0
  16762. * @category Util
  16763. * @param {number} [start=0] The start of the range.
  16764. * @param {number} end The end of the range.
  16765. * @param {number} [step=1] The value to increment or decrement by.
  16766. * @returns {Array} Returns the range of numbers.
  16767. * @see _.inRange, _.range
  16768. * @example
  16769. *
  16770. * _.rangeRight(4);
  16771. * // => [3, 2, 1, 0]
  16772. *
  16773. * _.rangeRight(-4);
  16774. * // => [-3, -2, -1, 0]
  16775. *
  16776. * _.rangeRight(1, 5);
  16777. * // => [4, 3, 2, 1]
  16778. *
  16779. * _.rangeRight(0, 20, 5);
  16780. * // => [15, 10, 5, 0]
  16781. *
  16782. * _.rangeRight(0, -4, -1);
  16783. * // => [-3, -2, -1, 0]
  16784. *
  16785. * _.rangeRight(1, 4, 0);
  16786. * // => [1, 1, 1]
  16787. *
  16788. * _.rangeRight(0);
  16789. * // => []
  16790. */
  16791. var rangeRight = createRange(true);
  16792. /**
  16793. * This method returns a new empty array.
  16794. *
  16795. * @static
  16796. * @memberOf _
  16797. * @since 4.13.0
  16798. * @category Util
  16799. * @returns {Array} Returns the new empty array.
  16800. * @example
  16801. *
  16802. * var arrays = _.times(2, _.stubArray);
  16803. *
  16804. * console.log(arrays);
  16805. * // => [[], []]
  16806. *
  16807. * console.log(arrays[0] === arrays[1]);
  16808. * // => false
  16809. */
  16810. function stubArray() {
  16811. return [];
  16812. }
  16813. /**
  16814. * This method returns `false`.
  16815. *
  16816. * @static
  16817. * @memberOf _
  16818. * @since 4.13.0
  16819. * @category Util
  16820. * @returns {boolean} Returns `false`.
  16821. * @example
  16822. *
  16823. * _.times(2, _.stubFalse);
  16824. * // => [false, false]
  16825. */
  16826. function stubFalse() {
  16827. return false;
  16828. }
  16829. /**
  16830. * This method returns a new empty object.
  16831. *
  16832. * @static
  16833. * @memberOf _
  16834. * @since 4.13.0
  16835. * @category Util
  16836. * @returns {Object} Returns the new empty object.
  16837. * @example
  16838. *
  16839. * var objects = _.times(2, _.stubObject);
  16840. *
  16841. * console.log(objects);
  16842. * // => [{}, {}]
  16843. *
  16844. * console.log(objects[0] === objects[1]);
  16845. * // => false
  16846. */
  16847. function stubObject() {
  16848. return {};
  16849. }
  16850. /**
  16851. * This method returns an empty string.
  16852. *
  16853. * @static
  16854. * @memberOf _
  16855. * @since 4.13.0
  16856. * @category Util
  16857. * @returns {string} Returns the empty string.
  16858. * @example
  16859. *
  16860. * _.times(2, _.stubString);
  16861. * // => ['', '']
  16862. */
  16863. function stubString() {
  16864. return '';
  16865. }
  16866. /**
  16867. * This method returns `true`.
  16868. *
  16869. * @static
  16870. * @memberOf _
  16871. * @since 4.13.0
  16872. * @category Util
  16873. * @returns {boolean} Returns `true`.
  16874. * @example
  16875. *
  16876. * _.times(2, _.stubTrue);
  16877. * // => [true, true]
  16878. */
  16879. function stubTrue() {
  16880. return true;
  16881. }
  16882. /**
  16883. * Invokes the iteratee `n` times, returning an array of the results of
  16884. * each invocation. The iteratee is invoked with one argument; (index).
  16885. *
  16886. * @static
  16887. * @since 0.1.0
  16888. * @memberOf _
  16889. * @category Util
  16890. * @param {number} n The number of times to invoke `iteratee`.
  16891. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  16892. * @returns {Array} Returns the array of results.
  16893. * @example
  16894. *
  16895. * _.times(3, String);
  16896. * // => ['0', '1', '2']
  16897. *
  16898. * _.times(4, _.constant(0));
  16899. * // => [0, 0, 0, 0]
  16900. */
  16901. function times(n, iteratee) {
  16902. n = toInteger(n);
  16903. if (n < 1 || n > MAX_SAFE_INTEGER) {
  16904. return [];
  16905. }
  16906. var index = MAX_ARRAY_LENGTH,
  16907. length = nativeMin(n, MAX_ARRAY_LENGTH);
  16908. iteratee = getIteratee(iteratee);
  16909. n -= MAX_ARRAY_LENGTH;
  16910. var result = baseTimes(length, iteratee);
  16911. while (++index < n) {
  16912. iteratee(index);
  16913. }
  16914. return result;
  16915. }
  16916. /**
  16917. * Converts `value` to a property path array.
  16918. *
  16919. * @static
  16920. * @memberOf _
  16921. * @since 4.0.0
  16922. * @category Util
  16923. * @param {*} value The value to convert.
  16924. * @returns {Array} Returns the new property path array.
  16925. * @example
  16926. *
  16927. * _.toPath('a.b.c');
  16928. * // => ['a', 'b', 'c']
  16929. *
  16930. * _.toPath('a[0].b.c');
  16931. * // => ['a', '0', 'b', 'c']
  16932. */
  16933. function toPath(value) {
  16934. if (isArray(value)) {
  16935. return arrayMap(value, toKey);
  16936. }
  16937. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  16938. }
  16939. /**
  16940. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  16941. *
  16942. * @static
  16943. * @since 0.1.0
  16944. * @memberOf _
  16945. * @category Util
  16946. * @param {string} [prefix=''] The value to prefix the ID with.
  16947. * @returns {string} Returns the unique ID.
  16948. * @example
  16949. *
  16950. * _.uniqueId('contact_');
  16951. * // => 'contact_104'
  16952. *
  16953. * _.uniqueId();
  16954. * // => '105'
  16955. */
  16956. function uniqueId(prefix) {
  16957. var id = ++idCounter;
  16958. return toString(prefix) + id;
  16959. }
  16960. /*------------------------------------------------------------------------*/
  16961. /**
  16962. * Adds two numbers.
  16963. *
  16964. * @static
  16965. * @memberOf _
  16966. * @since 3.4.0
  16967. * @category Math
  16968. * @param {number} augend The first number in an addition.
  16969. * @param {number} addend The second number in an addition.
  16970. * @returns {number} Returns the total.
  16971. * @example
  16972. *
  16973. * _.add(6, 4);
  16974. * // => 10
  16975. */
  16976. var add = createMathOperation(function(augend, addend) {
  16977. return augend + addend;
  16978. }, 0);
  16979. /**
  16980. * Computes `number` rounded up to `precision`.
  16981. *
  16982. * @static
  16983. * @memberOf _
  16984. * @since 3.10.0
  16985. * @category Math
  16986. * @param {number} number The number to round up.
  16987. * @param {number} [precision=0] The precision to round up to.
  16988. * @returns {number} Returns the rounded up number.
  16989. * @example
  16990. *
  16991. * _.ceil(4.006);
  16992. * // => 5
  16993. *
  16994. * _.ceil(6.004, 2);
  16995. * // => 6.01
  16996. *
  16997. * _.ceil(6040, -2);
  16998. * // => 6100
  16999. */
  17000. var ceil = createRound('ceil');
  17001. /**
  17002. * Divide two numbers.
  17003. *
  17004. * @static
  17005. * @memberOf _
  17006. * @since 4.7.0
  17007. * @category Math
  17008. * @param {number} dividend The first number in a division.
  17009. * @param {number} divisor The second number in a division.
  17010. * @returns {number} Returns the quotient.
  17011. * @example
  17012. *
  17013. * _.divide(6, 4);
  17014. * // => 1.5
  17015. */
  17016. var divide = createMathOperation(function(dividend, divisor) {
  17017. return dividend / divisor;
  17018. }, 1);
  17019. /**
  17020. * Computes `number` rounded down to `precision`.
  17021. *
  17022. * @static
  17023. * @memberOf _
  17024. * @since 3.10.0
  17025. * @category Math
  17026. * @param {number} number The number to round down.
  17027. * @param {number} [precision=0] The precision to round down to.
  17028. * @returns {number} Returns the rounded down number.
  17029. * @example
  17030. *
  17031. * _.floor(4.006);
  17032. * // => 4
  17033. *
  17034. * _.floor(0.046, 2);
  17035. * // => 0.04
  17036. *
  17037. * _.floor(4060, -2);
  17038. * // => 4000
  17039. */
  17040. var floor = createRound('floor');
  17041. /**
  17042. * Computes the maximum value of `array`. If `array` is empty or falsey,
  17043. * `undefined` is returned.
  17044. *
  17045. * @static
  17046. * @since 0.1.0
  17047. * @memberOf _
  17048. * @category Math
  17049. * @param {Array} array The array to iterate over.
  17050. * @returns {*} Returns the maximum value.
  17051. * @example
  17052. *
  17053. * _.max([4, 2, 8, 6]);
  17054. * // => 8
  17055. *
  17056. * _.max([]);
  17057. * // => undefined
  17058. */
  17059. function max(array) {
  17060. return (array && array.length)
  17061. ? baseExtremum(array, identity, baseGt)
  17062. : undefined;
  17063. }
  17064. /**
  17065. * This method is like `_.max` except that it accepts `iteratee` which is
  17066. * invoked for each element in `array` to generate the criterion by which
  17067. * the value is ranked. The iteratee is invoked with one argument: (value).
  17068. *
  17069. * @static
  17070. * @memberOf _
  17071. * @since 4.0.0
  17072. * @category Math
  17073. * @param {Array} array The array to iterate over.
  17074. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  17075. * @returns {*} Returns the maximum value.
  17076. * @example
  17077. *
  17078. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  17079. *
  17080. * _.maxBy(objects, function(o) { return o.n; });
  17081. * // => { 'n': 2 }
  17082. *
  17083. * // The `_.property` iteratee shorthand.
  17084. * _.maxBy(objects, 'n');
  17085. * // => { 'n': 2 }
  17086. */
  17087. function maxBy(array, iteratee) {
  17088. return (array && array.length)
  17089. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  17090. : undefined;
  17091. }
  17092. /**
  17093. * Computes the mean of the values in `array`.
  17094. *
  17095. * @static
  17096. * @memberOf _
  17097. * @since 4.0.0
  17098. * @category Math
  17099. * @param {Array} array The array to iterate over.
  17100. * @returns {number} Returns the mean.
  17101. * @example
  17102. *
  17103. * _.mean([4, 2, 8, 6]);
  17104. * // => 5
  17105. */
  17106. function mean(array) {
  17107. return baseMean(array, identity);
  17108. }
  17109. /**
  17110. * This method is like `_.mean` except that it accepts `iteratee` which is
  17111. * invoked for each element in `array` to generate the value to be averaged.
  17112. * The iteratee is invoked with one argument: (value).
  17113. *
  17114. * @static
  17115. * @memberOf _
  17116. * @since 4.7.0
  17117. * @category Math
  17118. * @param {Array} array The array to iterate over.
  17119. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  17120. * @returns {number} Returns the mean.
  17121. * @example
  17122. *
  17123. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  17124. *
  17125. * _.meanBy(objects, function(o) { return o.n; });
  17126. * // => 5
  17127. *
  17128. * // The `_.property` iteratee shorthand.
  17129. * _.meanBy(objects, 'n');
  17130. * // => 5
  17131. */
  17132. function meanBy(array, iteratee) {
  17133. return baseMean(array, getIteratee(iteratee, 2));
  17134. }
  17135. /**
  17136. * Computes the minimum value of `array`. If `array` is empty or falsey,
  17137. * `undefined` is returned.
  17138. *
  17139. * @static
  17140. * @since 0.1.0
  17141. * @memberOf _
  17142. * @category Math
  17143. * @param {Array} array The array to iterate over.
  17144. * @returns {*} Returns the minimum value.
  17145. * @example
  17146. *
  17147. * _.min([4, 2, 8, 6]);
  17148. * // => 2
  17149. *
  17150. * _.min([]);
  17151. * // => undefined
  17152. */
  17153. function min(array) {
  17154. return (array && array.length)
  17155. ? baseExtremum(array, identity, baseLt)
  17156. : undefined;
  17157. }
  17158. /**
  17159. * This method is like `_.min` except that it accepts `iteratee` which is
  17160. * invoked for each element in `array` to generate the criterion by which
  17161. * the value is ranked. The iteratee is invoked with one argument: (value).
  17162. *
  17163. * @static
  17164. * @memberOf _
  17165. * @since 4.0.0
  17166. * @category Math
  17167. * @param {Array} array The array to iterate over.
  17168. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  17169. * @returns {*} Returns the minimum value.
  17170. * @example
  17171. *
  17172. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  17173. *
  17174. * _.minBy(objects, function(o) { return o.n; });
  17175. * // => { 'n': 1 }
  17176. *
  17177. * // The `_.property` iteratee shorthand.
  17178. * _.minBy(objects, 'n');
  17179. * // => { 'n': 1 }
  17180. */
  17181. function minBy(array, iteratee) {
  17182. return (array && array.length)
  17183. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  17184. : undefined;
  17185. }
  17186. /**
  17187. * Multiply two numbers.
  17188. *
  17189. * @static
  17190. * @memberOf _
  17191. * @since 4.7.0
  17192. * @category Math
  17193. * @param {number} multiplier The first number in a multiplication.
  17194. * @param {number} multiplicand The second number in a multiplication.
  17195. * @returns {number} Returns the product.
  17196. * @example
  17197. *
  17198. * _.multiply(6, 4);
  17199. * // => 24
  17200. */
  17201. var multiply = createMathOperation(function(multiplier, multiplicand) {
  17202. return multiplier * multiplicand;
  17203. }, 1);
  17204. /**
  17205. * Computes `number` rounded to `precision`.
  17206. *
  17207. * @static
  17208. * @memberOf _
  17209. * @since 3.10.0
  17210. * @category Math
  17211. * @param {number} number The number to round.
  17212. * @param {number} [precision=0] The precision to round to.
  17213. * @returns {number} Returns the rounded number.
  17214. * @example
  17215. *
  17216. * _.round(4.006);
  17217. * // => 4
  17218. *
  17219. * _.round(4.006, 2);
  17220. * // => 4.01
  17221. *
  17222. * _.round(4060, -2);
  17223. * // => 4100
  17224. */
  17225. var round = createRound('round');
  17226. /**
  17227. * Subtract two numbers.
  17228. *
  17229. * @static
  17230. * @memberOf _
  17231. * @since 4.0.0
  17232. * @category Math
  17233. * @param {number} minuend The first number in a subtraction.
  17234. * @param {number} subtrahend The second number in a subtraction.
  17235. * @returns {number} Returns the difference.
  17236. * @example
  17237. *
  17238. * _.subtract(6, 4);
  17239. * // => 2
  17240. */
  17241. var subtract = createMathOperation(function(minuend, subtrahend) {
  17242. return minuend - subtrahend;
  17243. }, 0);
  17244. /**
  17245. * Computes the sum of the values in `array`.
  17246. *
  17247. * @static
  17248. * @memberOf _
  17249. * @since 3.4.0
  17250. * @category Math
  17251. * @param {Array} array The array to iterate over.
  17252. * @returns {number} Returns the sum.
  17253. * @example
  17254. *
  17255. * _.sum([4, 2, 8, 6]);
  17256. * // => 20
  17257. */
  17258. function sum(array) {
  17259. return (array && array.length)
  17260. ? baseSum(array, identity)
  17261. : 0;
  17262. }
  17263. /**
  17264. * This method is like `_.sum` except that it accepts `iteratee` which is
  17265. * invoked for each element in `array` to generate the value to be summed.
  17266. * The iteratee is invoked with one argument: (value).
  17267. *
  17268. * @static
  17269. * @memberOf _
  17270. * @since 4.0.0
  17271. * @category Math
  17272. * @param {Array} array The array to iterate over.
  17273. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  17274. * @returns {number} Returns the sum.
  17275. * @example
  17276. *
  17277. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  17278. *
  17279. * _.sumBy(objects, function(o) { return o.n; });
  17280. * // => 20
  17281. *
  17282. * // The `_.property` iteratee shorthand.
  17283. * _.sumBy(objects, 'n');
  17284. * // => 20
  17285. */
  17286. function sumBy(array, iteratee) {
  17287. return (array && array.length)
  17288. ? baseSum(array, getIteratee(iteratee, 2))
  17289. : 0;
  17290. }
  17291. /*------------------------------------------------------------------------*/
  17292. // Add methods that return wrapped values in chain sequences.
  17293. lodash.after = after;
  17294. lodash.ary = ary;
  17295. lodash.assign = assign;
  17296. lodash.assignIn = assignIn;
  17297. lodash.assignInWith = assignInWith;
  17298. lodash.assignWith = assignWith;
  17299. lodash.at = at;
  17300. lodash.before = before;
  17301. lodash.bind = bind;
  17302. lodash.bindAll = bindAll;
  17303. lodash.bindKey = bindKey;
  17304. lodash.castArray = castArray;
  17305. lodash.chain = chain;
  17306. lodash.chunk = chunk;
  17307. lodash.compact = compact;
  17308. lodash.concat = concat;
  17309. lodash.cond = cond;
  17310. lodash.conforms = conforms;
  17311. lodash.constant = constant;
  17312. lodash.countBy = countBy;
  17313. lodash.create = create;
  17314. lodash.curry = curry;
  17315. lodash.curryRight = curryRight;
  17316. lodash.debounce = debounce;
  17317. lodash.defaults = defaults;
  17318. lodash.defaultsDeep = defaultsDeep;
  17319. lodash.defer = defer;
  17320. lodash.delay = delay;
  17321. lodash.difference = difference;
  17322. lodash.differenceBy = differenceBy;
  17323. lodash.differenceWith = differenceWith;
  17324. lodash.drop = drop;
  17325. lodash.dropRight = dropRight;
  17326. lodash.dropRightWhile = dropRightWhile;
  17327. lodash.dropWhile = dropWhile;
  17328. lodash.fill = fill;
  17329. lodash.filter = filter;
  17330. lodash.flatMap = flatMap;
  17331. lodash.flatMapDeep = flatMapDeep;
  17332. lodash.flatMapDepth = flatMapDepth;
  17333. lodash.flatten = flatten;
  17334. lodash.flattenDeep = flattenDeep;
  17335. lodash.flattenDepth = flattenDepth;
  17336. lodash.flip = flip;
  17337. lodash.flow = flow;
  17338. lodash.flowRight = flowRight;
  17339. lodash.fromPairs = fromPairs;
  17340. lodash.functions = functions;
  17341. lodash.functionsIn = functionsIn;
  17342. lodash.groupBy = groupBy;
  17343. lodash.initial = initial;
  17344. lodash.intersection = intersection;
  17345. lodash.intersectionBy = intersectionBy;
  17346. lodash.intersectionWith = intersectionWith;
  17347. lodash.invert = invert;
  17348. lodash.invertBy = invertBy;
  17349. lodash.invokeMap = invokeMap;
  17350. lodash.iteratee = iteratee;
  17351. lodash.keyBy = keyBy;
  17352. lodash.keys = keys;
  17353. lodash.keysIn = keysIn;
  17354. lodash.map = map;
  17355. lodash.mapKeys = mapKeys;
  17356. lodash.mapValues = mapValues;
  17357. lodash.matches = matches;
  17358. lodash.matchesProperty = matchesProperty;
  17359. lodash.memoize = memoize;
  17360. lodash.merge = merge;
  17361. lodash.mergeWith = mergeWith;
  17362. lodash.method = method;
  17363. lodash.methodOf = methodOf;
  17364. lodash.mixin = mixin;
  17365. lodash.negate = negate;
  17366. lodash.nthArg = nthArg;
  17367. lodash.omit = omit;
  17368. lodash.omitBy = omitBy;
  17369. lodash.once = once;
  17370. lodash.orderBy = orderBy;
  17371. lodash.over = over;
  17372. lodash.overArgs = overArgs;
  17373. lodash.overEvery = overEvery;
  17374. lodash.overSome = overSome;
  17375. lodash.partial = partial;
  17376. lodash.partialRight = partialRight;
  17377. lodash.partition = partition;
  17378. lodash.pick = pick;
  17379. lodash.pickBy = pickBy;
  17380. lodash.property = property;
  17381. lodash.propertyOf = propertyOf;
  17382. lodash.pull = pull;
  17383. lodash.pullAll = pullAll;
  17384. lodash.pullAllBy = pullAllBy;
  17385. lodash.pullAllWith = pullAllWith;
  17386. lodash.pullAt = pullAt;
  17387. lodash.range = range;
  17388. lodash.rangeRight = rangeRight;
  17389. lodash.rearg = rearg;
  17390. lodash.reject = reject;
  17391. lodash.remove = remove;
  17392. lodash.rest = rest;
  17393. lodash.reverse = reverse;
  17394. lodash.sampleSize = sampleSize;
  17395. lodash.set = set;
  17396. lodash.setWith = setWith;
  17397. lodash.shuffle = shuffle;
  17398. lodash.slice = slice;
  17399. lodash.sortBy = sortBy;
  17400. lodash.sortedUniq = sortedUniq;
  17401. lodash.sortedUniqBy = sortedUniqBy;
  17402. lodash.split = split;
  17403. lodash.spread = spread;
  17404. lodash.tail = tail;
  17405. lodash.take = take;
  17406. lodash.takeRight = takeRight;
  17407. lodash.takeRightWhile = takeRightWhile;
  17408. lodash.takeWhile = takeWhile;
  17409. lodash.tap = tap;
  17410. lodash.throttle = throttle;
  17411. lodash.thru = thru;
  17412. lodash.toArray = toArray;
  17413. lodash.toPairs = toPairs;
  17414. lodash.toPairsIn = toPairsIn;
  17415. lodash.toPath = toPath;
  17416. lodash.toPlainObject = toPlainObject;
  17417. lodash.transform = transform;
  17418. lodash.unary = unary;
  17419. lodash.union = union;
  17420. lodash.unionBy = unionBy;
  17421. lodash.unionWith = unionWith;
  17422. lodash.uniq = uniq;
  17423. lodash.uniqBy = uniqBy;
  17424. lodash.uniqWith = uniqWith;
  17425. lodash.unset = unset;
  17426. lodash.unzip = unzip;
  17427. lodash.unzipWith = unzipWith;
  17428. lodash.update = update;
  17429. lodash.updateWith = updateWith;
  17430. lodash.values = values;
  17431. lodash.valuesIn = valuesIn;
  17432. lodash.without = without;
  17433. lodash.words = words;
  17434. lodash.wrap = wrap;
  17435. lodash.xor = xor;
  17436. lodash.xorBy = xorBy;
  17437. lodash.xorWith = xorWith;
  17438. lodash.zip = zip;
  17439. lodash.zipObject = zipObject;
  17440. lodash.zipObjectDeep = zipObjectDeep;
  17441. lodash.zipWith = zipWith;
  17442. // Add aliases.
  17443. lodash.entries = toPairs;
  17444. lodash.entriesIn = toPairsIn;
  17445. lodash.extend = assignIn;
  17446. lodash.extendWith = assignInWith;
  17447. // Add methods to `lodash.prototype`.
  17448. mixin(lodash, lodash);
  17449. /*------------------------------------------------------------------------*/
  17450. // Add methods that return unwrapped values in chain sequences.
  17451. lodash.add = add;
  17452. lodash.attempt = attempt;
  17453. lodash.camelCase = camelCase;
  17454. lodash.capitalize = capitalize;
  17455. lodash.ceil = ceil;
  17456. lodash.clamp = clamp;
  17457. lodash.clone = clone;
  17458. lodash.cloneDeep = cloneDeep;
  17459. lodash.cloneDeepWith = cloneDeepWith;
  17460. lodash.cloneWith = cloneWith;
  17461. lodash.conformsTo = conformsTo;
  17462. lodash.deburr = deburr;
  17463. lodash.defaultTo = defaultTo;
  17464. lodash.divide = divide;
  17465. lodash.endsWith = endsWith;
  17466. lodash.eq = eq;
  17467. lodash.escape = escape;
  17468. lodash.escapeRegExp = escapeRegExp;
  17469. lodash.every = every;
  17470. lodash.find = find;
  17471. lodash.findIndex = findIndex;
  17472. lodash.findKey = findKey;
  17473. lodash.findLast = findLast;
  17474. lodash.findLastIndex = findLastIndex;
  17475. lodash.findLastKey = findLastKey;
  17476. lodash.floor = floor;
  17477. lodash.forEach = forEach;
  17478. lodash.forEachRight = forEachRight;
  17479. lodash.forIn = forIn;
  17480. lodash.forInRight = forInRight;
  17481. lodash.forOwn = forOwn;
  17482. lodash.forOwnRight = forOwnRight;
  17483. lodash.get = get;
  17484. lodash.gt = gt;
  17485. lodash.gte = gte;
  17486. lodash.has = has;
  17487. lodash.hasIn = hasIn;
  17488. lodash.head = head;
  17489. lodash.identity = identity;
  17490. lodash.includes = includes;
  17491. lodash.indexOf = indexOf;
  17492. lodash.inRange = inRange;
  17493. lodash.invoke = invoke;
  17494. lodash.isArguments = isArguments;
  17495. lodash.isArray = isArray;
  17496. lodash.isArrayBuffer = isArrayBuffer;
  17497. lodash.isArrayLike = isArrayLike;
  17498. lodash.isArrayLikeObject = isArrayLikeObject;
  17499. lodash.isBoolean = isBoolean;
  17500. lodash.isBuffer = isBuffer;
  17501. lodash.isDate = isDate;
  17502. lodash.isElement = isElement;
  17503. lodash.isEmpty = isEmpty;
  17504. lodash.isEqual = isEqual;
  17505. lodash.isEqualWith = isEqualWith;
  17506. lodash.isError = isError;
  17507. lodash.isFinite = isFinite;
  17508. lodash.isFunction = isFunction;
  17509. lodash.isInteger = isInteger;
  17510. lodash.isLength = isLength;
  17511. lodash.isMap = isMap;
  17512. lodash.isMatch = isMatch;
  17513. lodash.isMatchWith = isMatchWith;
  17514. lodash.isNaN = isNaN;
  17515. lodash.isNative = isNative;
  17516. lodash.isNil = isNil;
  17517. lodash.isNull = isNull;
  17518. lodash.isNumber = isNumber;
  17519. lodash.isObject = isObject;
  17520. lodash.isObjectLike = isObjectLike;
  17521. lodash.isPlainObject = isPlainObject;
  17522. lodash.isRegExp = isRegExp;
  17523. lodash.isSafeInteger = isSafeInteger;
  17524. lodash.isSet = isSet;
  17525. lodash.isString = isString;
  17526. lodash.isSymbol = isSymbol;
  17527. lodash.isTypedArray = isTypedArray;
  17528. lodash.isUndefined = isUndefined;
  17529. lodash.isWeakMap = isWeakMap;
  17530. lodash.isWeakSet = isWeakSet;
  17531. lodash.join = join;
  17532. lodash.kebabCase = kebabCase;
  17533. lodash.last = last;
  17534. lodash.lastIndexOf = lastIndexOf;
  17535. lodash.lowerCase = lowerCase;
  17536. lodash.lowerFirst = lowerFirst;
  17537. lodash.lt = lt;
  17538. lodash.lte = lte;
  17539. lodash.max = max;
  17540. lodash.maxBy = maxBy;
  17541. lodash.mean = mean;
  17542. lodash.meanBy = meanBy;
  17543. lodash.min = min;
  17544. lodash.minBy = minBy;
  17545. lodash.stubArray = stubArray;
  17546. lodash.stubFalse = stubFalse;
  17547. lodash.stubObject = stubObject;
  17548. lodash.stubString = stubString;
  17549. lodash.stubTrue = stubTrue;
  17550. lodash.multiply = multiply;
  17551. lodash.nth = nth;
  17552. lodash.noConflict = noConflict;
  17553. lodash.noop = noop;
  17554. lodash.now = now;
  17555. lodash.pad = pad;
  17556. lodash.padEnd = padEnd;
  17557. lodash.padStart = padStart;
  17558. lodash.parseInt = parseInt;
  17559. lodash.random = random;
  17560. lodash.reduce = reduce;
  17561. lodash.reduceRight = reduceRight;
  17562. lodash.repeat = repeat;
  17563. lodash.replace = replace;
  17564. lodash.result = result;
  17565. lodash.round = round;
  17566. lodash.runInContext = runInContext;
  17567. lodash.sample = sample;
  17568. lodash.size = size;
  17569. lodash.snakeCase = snakeCase;
  17570. lodash.some = some;
  17571. lodash.sortedIndex = sortedIndex;
  17572. lodash.sortedIndexBy = sortedIndexBy;
  17573. lodash.sortedIndexOf = sortedIndexOf;
  17574. lodash.sortedLastIndex = sortedLastIndex;
  17575. lodash.sortedLastIndexBy = sortedLastIndexBy;
  17576. lodash.sortedLastIndexOf = sortedLastIndexOf;
  17577. lodash.startCase = startCase;
  17578. lodash.startsWith = startsWith;
  17579. lodash.subtract = subtract;
  17580. lodash.sum = sum;
  17581. lodash.sumBy = sumBy;
  17582. lodash.template = template;
  17583. lodash.times = times;
  17584. lodash.toFinite = toFinite;
  17585. lodash.toInteger = toInteger;
  17586. lodash.toLength = toLength;
  17587. lodash.toLower = toLower;
  17588. lodash.toNumber = toNumber;
  17589. lodash.toSafeInteger = toSafeInteger;
  17590. lodash.toString = toString;
  17591. lodash.toUpper = toUpper;
  17592. lodash.trim = trim;
  17593. lodash.trimEnd = trimEnd;
  17594. lodash.trimStart = trimStart;
  17595. lodash.truncate = truncate;
  17596. lodash.unescape = unescape;
  17597. lodash.uniqueId = uniqueId;
  17598. lodash.upperCase = upperCase;
  17599. lodash.upperFirst = upperFirst;
  17600. // Add aliases.
  17601. lodash.each = forEach;
  17602. lodash.eachRight = forEachRight;
  17603. lodash.first = head;
  17604. mixin(lodash, (function() {
  17605. var source = {};
  17606. baseForOwn(lodash, function(func, methodName) {
  17607. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  17608. source[methodName] = func;
  17609. }
  17610. });
  17611. return source;
  17612. }()), { 'chain': false });
  17613. /*------------------------------------------------------------------------*/
  17614. /**
  17615. * The semantic version number.
  17616. *
  17617. * @static
  17618. * @memberOf _
  17619. * @type {string}
  17620. */
  17621. lodash.VERSION = VERSION;
  17622. // Assign default placeholders.
  17623. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  17624. lodash[methodName].placeholder = lodash;
  17625. });
  17626. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  17627. arrayEach(['drop', 'take'], function(methodName, index) {
  17628. LazyWrapper.prototype[methodName] = function(n) {
  17629. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  17630. var result = (this.__filtered__ && !index)
  17631. ? new LazyWrapper(this)
  17632. : this.clone();
  17633. if (result.__filtered__) {
  17634. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  17635. } else {
  17636. result.__views__.push({
  17637. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  17638. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  17639. });
  17640. }
  17641. return result;
  17642. };
  17643. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  17644. return this.reverse()[methodName](n).reverse();
  17645. };
  17646. });
  17647. // Add `LazyWrapper` methods that accept an `iteratee` value.
  17648. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  17649. var type = index + 1,
  17650. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  17651. LazyWrapper.prototype[methodName] = function(iteratee) {
  17652. var result = this.clone();
  17653. result.__iteratees__.push({
  17654. 'iteratee': getIteratee(iteratee, 3),
  17655. 'type': type
  17656. });
  17657. result.__filtered__ = result.__filtered__ || isFilter;
  17658. return result;
  17659. };
  17660. });
  17661. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  17662. arrayEach(['head', 'last'], function(methodName, index) {
  17663. var takeName = 'take' + (index ? 'Right' : '');
  17664. LazyWrapper.prototype[methodName] = function() {
  17665. return this[takeName](1).value()[0];
  17666. };
  17667. });
  17668. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  17669. arrayEach(['initial', 'tail'], function(methodName, index) {
  17670. var dropName = 'drop' + (index ? '' : 'Right');
  17671. LazyWrapper.prototype[methodName] = function() {
  17672. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  17673. };
  17674. });
  17675. LazyWrapper.prototype.compact = function() {
  17676. return this.filter(identity);
  17677. };
  17678. LazyWrapper.prototype.find = function(predicate) {
  17679. return this.filter(predicate).head();
  17680. };
  17681. LazyWrapper.prototype.findLast = function(predicate) {
  17682. return this.reverse().find(predicate);
  17683. };
  17684. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  17685. if (typeof path == 'function') {
  17686. return new LazyWrapper(this);
  17687. }
  17688. return this.map(function(value) {
  17689. return baseInvoke(value, path, args);
  17690. });
  17691. });
  17692. LazyWrapper.prototype.reject = function(predicate) {
  17693. return this.filter(negate(getIteratee(predicate)));
  17694. };
  17695. LazyWrapper.prototype.slice = function(start, end) {
  17696. start = toInteger(start);
  17697. var result = this;
  17698. if (result.__filtered__ && (start > 0 || end < 0)) {
  17699. return new LazyWrapper(result);
  17700. }
  17701. if (start < 0) {
  17702. result = result.takeRight(-start);
  17703. } else if (start) {
  17704. result = result.drop(start);
  17705. }
  17706. if (end !== undefined) {
  17707. end = toInteger(end);
  17708. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  17709. }
  17710. return result;
  17711. };
  17712. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  17713. return this.reverse().takeWhile(predicate).reverse();
  17714. };
  17715. LazyWrapper.prototype.toArray = function() {
  17716. return this.take(MAX_ARRAY_LENGTH);
  17717. };
  17718. // Add `LazyWrapper` methods to `lodash.prototype`.
  17719. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  17720. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  17721. isTaker = /^(?:head|last)$/.test(methodName),
  17722. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  17723. retUnwrapped = isTaker || /^find/.test(methodName);
  17724. if (!lodashFunc) {
  17725. return;
  17726. }
  17727. lodash.prototype[methodName] = function() {
  17728. var value = this.__wrapped__,
  17729. args = isTaker ? [1] : arguments,
  17730. isLazy = value instanceof LazyWrapper,
  17731. iteratee = args[0],
  17732. useLazy = isLazy || isArray(value);
  17733. var interceptor = function(value) {
  17734. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  17735. return (isTaker && chainAll) ? result[0] : result;
  17736. };
  17737. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  17738. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  17739. isLazy = useLazy = false;
  17740. }
  17741. var chainAll = this.__chain__,
  17742. isHybrid = !!this.__actions__.length,
  17743. isUnwrapped = retUnwrapped && !chainAll,
  17744. onlyLazy = isLazy && !isHybrid;
  17745. if (!retUnwrapped && useLazy) {
  17746. value = onlyLazy ? value : new LazyWrapper(this);
  17747. var result = func.apply(value, args);
  17748. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  17749. return new LodashWrapper(result, chainAll);
  17750. }
  17751. if (isUnwrapped && onlyLazy) {
  17752. return func.apply(this, args);
  17753. }
  17754. result = this.thru(interceptor);
  17755. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  17756. };
  17757. });
  17758. // Add `Array` methods to `lodash.prototype`.
  17759. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  17760. var func = arrayProto[methodName],
  17761. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  17762. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  17763. lodash.prototype[methodName] = function() {
  17764. var args = arguments;
  17765. if (retUnwrapped && !this.__chain__) {
  17766. var value = this.value();
  17767. return func.apply(isArray(value) ? value : [], args);
  17768. }
  17769. return this[chainName](function(value) {
  17770. return func.apply(isArray(value) ? value : [], args);
  17771. });
  17772. };
  17773. });
  17774. // Map minified method names to their real names.
  17775. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  17776. var lodashFunc = lodash[methodName];
  17777. if (lodashFunc) {
  17778. var key = lodashFunc.name + '';
  17779. if (!hasOwnProperty.call(realNames, key)) {
  17780. realNames[key] = [];
  17781. }
  17782. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  17783. }
  17784. });
  17785. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  17786. 'name': 'wrapper',
  17787. 'func': undefined
  17788. }];
  17789. // Add methods to `LazyWrapper`.
  17790. LazyWrapper.prototype.clone = lazyClone;
  17791. LazyWrapper.prototype.reverse = lazyReverse;
  17792. LazyWrapper.prototype.value = lazyValue;
  17793. // Add chain sequence methods to the `lodash` wrapper.
  17794. lodash.prototype.at = wrapperAt;
  17795. lodash.prototype.chain = wrapperChain;
  17796. lodash.prototype.commit = wrapperCommit;
  17797. lodash.prototype.next = wrapperNext;
  17798. lodash.prototype.plant = wrapperPlant;
  17799. lodash.prototype.reverse = wrapperReverse;
  17800. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  17801. // Add lazy aliases.
  17802. lodash.prototype.first = lodash.prototype.head;
  17803. if (symIterator) {
  17804. lodash.prototype[symIterator] = wrapperToIterator;
  17805. }
  17806. return lodash;
  17807. });
  17808. /*--------------------------------------------------------------------------*/
  17809. // Export lodash.
  17810. var _ = runInContext();
  17811. // Some AMD build optimizers, like r.js, check for condition patterns like:
  17812. if (true) {
  17813. // Expose Lodash on the global object to prevent errors when Lodash is
  17814. // loaded by a script tag in the presence of an AMD loader.
  17815. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  17816. // Use `_.noConflict` to remove Lodash from the global object.
  17817. root._ = _;
  17818. // Define as an anonymous module so, through path mapping, it can be
  17819. // referenced as the "underscore" module.
  17820. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  17821. return _;
  17822. }).call(exports, __webpack_require__, exports, module),
  17823. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17824. }
  17825. // Check for `exports` after `define` in case a build optimizer adds it.
  17826. else {}
  17827. }.call(this));
  17828. /***/ }),
  17829. /***/ "./node_modules/vue-loader/dist/exportHelper.js":
  17830. /*!******************************************************!*\
  17831. !*** ./node_modules/vue-loader/dist/exportHelper.js ***!
  17832. \******************************************************/
  17833. /***/ ((__unused_webpack_module, exports) => {
  17834. "use strict";
  17835. Object.defineProperty(exports, "__esModule", ({ value: true }));
  17836. // runtime helper for setting properties on components
  17837. // in a tree-shakable way
  17838. exports["default"] = (sfc, props) => {
  17839. const target = sfc.__vccOpts || sfc;
  17840. for (const [key, val] of props) {
  17841. target[key] = val;
  17842. }
  17843. return target;
  17844. };
  17845. /***/ }),
  17846. /***/ "./resources/js/components/AppDropdown.vue":
  17847. /*!*************************************************!*\
  17848. !*** ./resources/js/components/AppDropdown.vue ***!
  17849. \*************************************************/
  17850. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17851. "use strict";
  17852. __webpack_require__.r(__webpack_exports__);
  17853. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17854. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17855. /* harmony export */ });
  17856. /* 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");
  17857. /* 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");
  17858. /* 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");
  17859. ;
  17860. 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"]])
  17861. /* hot reload */
  17862. if (false) {}
  17863. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17864. /***/ }),
  17865. /***/ "./resources/js/components/AppFooter.vue":
  17866. /*!***********************************************!*\
  17867. !*** ./resources/js/components/AppFooter.vue ***!
  17868. \***********************************************/
  17869. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17870. "use strict";
  17871. __webpack_require__.r(__webpack_exports__);
  17872. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17873. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17874. /* harmony export */ });
  17875. /* 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");
  17876. /* 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");
  17877. const script = {}
  17878. ;
  17879. 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"]])
  17880. /* hot reload */
  17881. if (false) {}
  17882. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17883. /***/ }),
  17884. /***/ "./resources/js/components/AppInputText.vue":
  17885. /*!**************************************************!*\
  17886. !*** ./resources/js/components/AppInputText.vue ***!
  17887. \**************************************************/
  17888. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17889. "use strict";
  17890. __webpack_require__.r(__webpack_exports__);
  17891. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17892. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17893. /* harmony export */ });
  17894. /* 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");
  17895. /* 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");
  17896. /* 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");
  17897. ;
  17898. 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"]])
  17899. /* hot reload */
  17900. if (false) {}
  17901. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17902. /***/ }),
  17903. /***/ "./resources/js/components/AppMessage.vue":
  17904. /*!************************************************!*\
  17905. !*** ./resources/js/components/AppMessage.vue ***!
  17906. \************************************************/
  17907. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17908. "use strict";
  17909. __webpack_require__.r(__webpack_exports__);
  17910. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17911. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17912. /* harmony export */ });
  17913. /* 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");
  17914. /* 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");
  17915. /* 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");
  17916. ;
  17917. 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"]])
  17918. /* hot reload */
  17919. if (false) {}
  17920. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17921. /***/ }),
  17922. /***/ "./resources/js/components/AppSidebar.vue":
  17923. /*!************************************************!*\
  17924. !*** ./resources/js/components/AppSidebar.vue ***!
  17925. \************************************************/
  17926. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17927. "use strict";
  17928. __webpack_require__.r(__webpack_exports__);
  17929. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17930. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17931. /* harmony export */ });
  17932. /* 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");
  17933. /* 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");
  17934. /* 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");
  17935. ;
  17936. 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"]])
  17937. /* hot reload */
  17938. if (false) {}
  17939. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17940. /***/ }),
  17941. /***/ "./resources/js/components/AppSubSidebar.vue":
  17942. /*!***************************************************!*\
  17943. !*** ./resources/js/components/AppSubSidebar.vue ***!
  17944. \***************************************************/
  17945. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17946. "use strict";
  17947. __webpack_require__.r(__webpack_exports__);
  17948. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17949. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17950. /* harmony export */ });
  17951. /* 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");
  17952. /* 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");
  17953. /* 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");
  17954. ;
  17955. 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"]])
  17956. /* hot reload */
  17957. if (false) {}
  17958. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17959. /***/ }),
  17960. /***/ "./resources/js/components/AppTopBar.vue":
  17961. /*!***********************************************!*\
  17962. !*** ./resources/js/components/AppTopBar.vue ***!
  17963. \***********************************************/
  17964. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17965. "use strict";
  17966. __webpack_require__.r(__webpack_exports__);
  17967. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17968. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17969. /* harmony export */ });
  17970. /* 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");
  17971. /* 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");
  17972. /* 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");
  17973. ;
  17974. 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"]])
  17975. /* hot reload */
  17976. if (false) {}
  17977. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17978. /***/ }),
  17979. /***/ "./resources/js/layouts/AppLayout.vue":
  17980. /*!********************************************!*\
  17981. !*** ./resources/js/layouts/AppLayout.vue ***!
  17982. \********************************************/
  17983. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  17984. "use strict";
  17985. __webpack_require__.r(__webpack_exports__);
  17986. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  17987. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  17988. /* harmony export */ });
  17989. /* 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");
  17990. /* 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");
  17991. /* 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");
  17992. ;
  17993. 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"]])
  17994. /* hot reload */
  17995. if (false) {}
  17996. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  17997. /***/ }),
  17998. /***/ "./resources/js/pages/member/Edit.vue":
  17999. /*!********************************************!*\
  18000. !*** ./resources/js/pages/member/Edit.vue ***!
  18001. \********************************************/
  18002. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18003. "use strict";
  18004. __webpack_require__.r(__webpack_exports__);
  18005. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18006. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  18007. /* harmony export */ });
  18008. /* 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");
  18009. /* 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");
  18010. /* 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");
  18011. ;
  18012. 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"]])
  18013. /* hot reload */
  18014. if (false) {}
  18015. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__exports__);
  18016. /***/ }),
  18017. /***/ "./resources/js/components/AppDropdown.vue?vue&type=script&setup=true&lang=js":
  18018. /*!************************************************************************************!*\
  18019. !*** ./resources/js/components/AppDropdown.vue?vue&type=script&setup=true&lang=js ***!
  18020. \************************************************************************************/
  18021. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18022. "use strict";
  18023. __webpack_require__.r(__webpack_exports__);
  18024. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18025. /* 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"])
  18026. /* harmony export */ });
  18027. /* 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");
  18028. /***/ }),
  18029. /***/ "./resources/js/components/AppInputText.vue?vue&type=script&setup=true&lang=js":
  18030. /*!*************************************************************************************!*\
  18031. !*** ./resources/js/components/AppInputText.vue?vue&type=script&setup=true&lang=js ***!
  18032. \*************************************************************************************/
  18033. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18034. "use strict";
  18035. __webpack_require__.r(__webpack_exports__);
  18036. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18037. /* 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"])
  18038. /* harmony export */ });
  18039. /* 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");
  18040. /***/ }),
  18041. /***/ "./resources/js/components/AppMessage.vue?vue&type=script&setup=true&lang=js":
  18042. /*!***********************************************************************************!*\
  18043. !*** ./resources/js/components/AppMessage.vue?vue&type=script&setup=true&lang=js ***!
  18044. \***********************************************************************************/
  18045. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18046. "use strict";
  18047. __webpack_require__.r(__webpack_exports__);
  18048. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18049. /* 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"])
  18050. /* harmony export */ });
  18051. /* 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");
  18052. /***/ }),
  18053. /***/ "./resources/js/components/AppSidebar.vue?vue&type=script&setup=true&lang=js":
  18054. /*!***********************************************************************************!*\
  18055. !*** ./resources/js/components/AppSidebar.vue?vue&type=script&setup=true&lang=js ***!
  18056. \***********************************************************************************/
  18057. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18058. "use strict";
  18059. __webpack_require__.r(__webpack_exports__);
  18060. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18061. /* 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"])
  18062. /* harmony export */ });
  18063. /* 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");
  18064. /***/ }),
  18065. /***/ "./resources/js/components/AppSubSidebar.vue?vue&type=script&setup=true&lang=js":
  18066. /*!**************************************************************************************!*\
  18067. !*** ./resources/js/components/AppSubSidebar.vue?vue&type=script&setup=true&lang=js ***!
  18068. \**************************************************************************************/
  18069. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18070. "use strict";
  18071. __webpack_require__.r(__webpack_exports__);
  18072. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18073. /* 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"])
  18074. /* harmony export */ });
  18075. /* 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");
  18076. /***/ }),
  18077. /***/ "./resources/js/components/AppTopBar.vue?vue&type=script&setup=true&lang=js":
  18078. /*!**********************************************************************************!*\
  18079. !*** ./resources/js/components/AppTopBar.vue?vue&type=script&setup=true&lang=js ***!
  18080. \**********************************************************************************/
  18081. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18082. "use strict";
  18083. __webpack_require__.r(__webpack_exports__);
  18084. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18085. /* 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"])
  18086. /* harmony export */ });
  18087. /* 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");
  18088. /***/ }),
  18089. /***/ "./resources/js/layouts/AppLayout.vue?vue&type=script&setup=true&lang=js":
  18090. /*!*******************************************************************************!*\
  18091. !*** ./resources/js/layouts/AppLayout.vue?vue&type=script&setup=true&lang=js ***!
  18092. \*******************************************************************************/
  18093. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18094. "use strict";
  18095. __webpack_require__.r(__webpack_exports__);
  18096. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18097. /* 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"])
  18098. /* harmony export */ });
  18099. /* 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");
  18100. /***/ }),
  18101. /***/ "./resources/js/pages/member/Edit.vue?vue&type=script&setup=true&lang=js":
  18102. /*!*******************************************************************************!*\
  18103. !*** ./resources/js/pages/member/Edit.vue?vue&type=script&setup=true&lang=js ***!
  18104. \*******************************************************************************/
  18105. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18106. "use strict";
  18107. __webpack_require__.r(__webpack_exports__);
  18108. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18109. /* 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"])
  18110. /* harmony export */ });
  18111. /* 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");
  18112. /***/ }),
  18113. /***/ "./resources/js/components/AppDropdown.vue?vue&type=template&id=ce0d1992":
  18114. /*!*******************************************************************************!*\
  18115. !*** ./resources/js/components/AppDropdown.vue?vue&type=template&id=ce0d1992 ***!
  18116. \*******************************************************************************/
  18117. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18118. "use strict";
  18119. __webpack_require__.r(__webpack_exports__);
  18120. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18121. /* 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)
  18122. /* harmony export */ });
  18123. /* 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");
  18124. /***/ }),
  18125. /***/ "./resources/js/components/AppFooter.vue?vue&type=template&id=4ab6097e":
  18126. /*!*****************************************************************************!*\
  18127. !*** ./resources/js/components/AppFooter.vue?vue&type=template&id=4ab6097e ***!
  18128. \*****************************************************************************/
  18129. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18130. "use strict";
  18131. __webpack_require__.r(__webpack_exports__);
  18132. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18133. /* 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)
  18134. /* harmony export */ });
  18135. /* 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");
  18136. /***/ }),
  18137. /***/ "./resources/js/components/AppInputText.vue?vue&type=template&id=16729fe1":
  18138. /*!********************************************************************************!*\
  18139. !*** ./resources/js/components/AppInputText.vue?vue&type=template&id=16729fe1 ***!
  18140. \********************************************************************************/
  18141. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18142. "use strict";
  18143. __webpack_require__.r(__webpack_exports__);
  18144. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18145. /* 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)
  18146. /* harmony export */ });
  18147. /* 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");
  18148. /***/ }),
  18149. /***/ "./resources/js/components/AppMessage.vue?vue&type=template&id=07159051":
  18150. /*!******************************************************************************!*\
  18151. !*** ./resources/js/components/AppMessage.vue?vue&type=template&id=07159051 ***!
  18152. \******************************************************************************/
  18153. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18154. "use strict";
  18155. __webpack_require__.r(__webpack_exports__);
  18156. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18157. /* 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)
  18158. /* harmony export */ });
  18159. /* 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");
  18160. /***/ }),
  18161. /***/ "./resources/js/components/AppSidebar.vue?vue&type=template&id=22a4e926":
  18162. /*!******************************************************************************!*\
  18163. !*** ./resources/js/components/AppSidebar.vue?vue&type=template&id=22a4e926 ***!
  18164. \******************************************************************************/
  18165. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18166. "use strict";
  18167. __webpack_require__.r(__webpack_exports__);
  18168. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18169. /* 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)
  18170. /* harmony export */ });
  18171. /* 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");
  18172. /***/ }),
  18173. /***/ "./resources/js/components/AppSubSidebar.vue?vue&type=template&id=0addd9bc":
  18174. /*!*********************************************************************************!*\
  18175. !*** ./resources/js/components/AppSubSidebar.vue?vue&type=template&id=0addd9bc ***!
  18176. \*********************************************************************************/
  18177. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18178. "use strict";
  18179. __webpack_require__.r(__webpack_exports__);
  18180. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18181. /* 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)
  18182. /* harmony export */ });
  18183. /* 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");
  18184. /***/ }),
  18185. /***/ "./resources/js/components/AppTopBar.vue?vue&type=template&id=42bf62a4":
  18186. /*!*****************************************************************************!*\
  18187. !*** ./resources/js/components/AppTopBar.vue?vue&type=template&id=42bf62a4 ***!
  18188. \*****************************************************************************/
  18189. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18190. "use strict";
  18191. __webpack_require__.r(__webpack_exports__);
  18192. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18193. /* 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)
  18194. /* harmony export */ });
  18195. /* 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");
  18196. /***/ }),
  18197. /***/ "./resources/js/layouts/AppLayout.vue?vue&type=template&id=2cfb4112":
  18198. /*!**************************************************************************!*\
  18199. !*** ./resources/js/layouts/AppLayout.vue?vue&type=template&id=2cfb4112 ***!
  18200. \**************************************************************************/
  18201. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18202. "use strict";
  18203. __webpack_require__.r(__webpack_exports__);
  18204. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18205. /* 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)
  18206. /* harmony export */ });
  18207. /* 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");
  18208. /***/ }),
  18209. /***/ "./resources/js/pages/member/Edit.vue?vue&type=template&id=1a9fb226":
  18210. /*!**************************************************************************!*\
  18211. !*** ./resources/js/pages/member/Edit.vue?vue&type=template&id=1a9fb226 ***!
  18212. \**************************************************************************/
  18213. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  18214. "use strict";
  18215. __webpack_require__.r(__webpack_exports__);
  18216. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  18217. /* 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)
  18218. /* harmony export */ });
  18219. /* 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");
  18220. /***/ })
  18221. }]);