app.js 1.2 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127
  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/ // The module cache
  3. /******/ var installedModules = {};
  4. /******/
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/
  8. /******/ // Check if module is in cache
  9. /******/ if(installedModules[moduleId]) {
  10. /******/ return installedModules[moduleId].exports;
  11. /******/ }
  12. /******/ // Create a new module (and put it into the cache)
  13. /******/ var module = installedModules[moduleId] = {
  14. /******/ i: moduleId,
  15. /******/ l: false,
  16. /******/ exports: {}
  17. /******/ };
  18. /******/
  19. /******/ // Execute the module function
  20. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  21. /******/
  22. /******/ // Flag the module as loaded
  23. /******/ module.l = true;
  24. /******/
  25. /******/ // Return the exports of the module
  26. /******/ return module.exports;
  27. /******/ }
  28. /******/
  29. /******/
  30. /******/ // expose the modules object (__webpack_modules__)
  31. /******/ __webpack_require__.m = modules;
  32. /******/
  33. /******/ // expose the module cache
  34. /******/ __webpack_require__.c = installedModules;
  35. /******/
  36. /******/ // define getter function for harmony exports
  37. /******/ __webpack_require__.d = function(exports, name, getter) {
  38. /******/ if(!__webpack_require__.o(exports, name)) {
  39. /******/ Object.defineProperty(exports, name, {
  40. /******/ configurable: false,
  41. /******/ enumerable: true,
  42. /******/ get: getter
  43. /******/ });
  44. /******/ }
  45. /******/ };
  46. /******/
  47. /******/ // getDefaultExport function for compatibility with non-harmony modules
  48. /******/ __webpack_require__.n = function(module) {
  49. /******/ var getter = module && module.__esModule ?
  50. /******/ function getDefault() { return module['default']; } :
  51. /******/ function getModuleExports() { return module; };
  52. /******/ __webpack_require__.d(getter, 'a', getter);
  53. /******/ return getter;
  54. /******/ };
  55. /******/
  56. /******/ // Object.prototype.hasOwnProperty.call
  57. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  58. /******/
  59. /******/ // __webpack_public_path__
  60. /******/ __webpack_require__.p = "";
  61. /******/
  62. /******/ // Load entry module and return exports
  63. /******/ return __webpack_require__(__webpack_require__.s = 9);
  64. /******/ })
  65. /************************************************************************/
  66. /******/ ([
  67. /* 0 */
  68. /***/ (function(module, exports, __webpack_require__) {
  69. "use strict";
  70. var bind = __webpack_require__(3);
  71. var isBuffer = __webpack_require__(18);
  72. /*global toString:true*/
  73. // utils is a library of generic helper functions non-specific to axios
  74. var toString = Object.prototype.toString;
  75. /**
  76. * Determine if a value is an Array
  77. *
  78. * @param {Object} val The value to test
  79. * @returns {boolean} True if value is an Array, otherwise false
  80. */
  81. function isArray(val) {
  82. return toString.call(val) === '[object Array]';
  83. }
  84. /**
  85. * Determine if a value is an ArrayBuffer
  86. *
  87. * @param {Object} val The value to test
  88. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  89. */
  90. function isArrayBuffer(val) {
  91. return toString.call(val) === '[object ArrayBuffer]';
  92. }
  93. /**
  94. * Determine if a value is a FormData
  95. *
  96. * @param {Object} val The value to test
  97. * @returns {boolean} True if value is an FormData, otherwise false
  98. */
  99. function isFormData(val) {
  100. return (typeof FormData !== 'undefined') && (val instanceof FormData);
  101. }
  102. /**
  103. * Determine if a value is a view on an ArrayBuffer
  104. *
  105. * @param {Object} val The value to test
  106. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  107. */
  108. function isArrayBufferView(val) {
  109. var result;
  110. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  111. result = ArrayBuffer.isView(val);
  112. } else {
  113. result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
  114. }
  115. return result;
  116. }
  117. /**
  118. * Determine if a value is a String
  119. *
  120. * @param {Object} val The value to test
  121. * @returns {boolean} True if value is a String, otherwise false
  122. */
  123. function isString(val) {
  124. return typeof val === 'string';
  125. }
  126. /**
  127. * Determine if a value is a Number
  128. *
  129. * @param {Object} val The value to test
  130. * @returns {boolean} True if value is a Number, otherwise false
  131. */
  132. function isNumber(val) {
  133. return typeof val === 'number';
  134. }
  135. /**
  136. * Determine if a value is undefined
  137. *
  138. * @param {Object} val The value to test
  139. * @returns {boolean} True if the value is undefined, otherwise false
  140. */
  141. function isUndefined(val) {
  142. return typeof val === 'undefined';
  143. }
  144. /**
  145. * Determine if a value is an Object
  146. *
  147. * @param {Object} val The value to test
  148. * @returns {boolean} True if value is an Object, otherwise false
  149. */
  150. function isObject(val) {
  151. return val !== null && typeof val === 'object';
  152. }
  153. /**
  154. * Determine if a value is a Date
  155. *
  156. * @param {Object} val The value to test
  157. * @returns {boolean} True if value is a Date, otherwise false
  158. */
  159. function isDate(val) {
  160. return toString.call(val) === '[object Date]';
  161. }
  162. /**
  163. * Determine if a value is a File
  164. *
  165. * @param {Object} val The value to test
  166. * @returns {boolean} True if value is a File, otherwise false
  167. */
  168. function isFile(val) {
  169. return toString.call(val) === '[object File]';
  170. }
  171. /**
  172. * Determine if a value is a Blob
  173. *
  174. * @param {Object} val The value to test
  175. * @returns {boolean} True if value is a Blob, otherwise false
  176. */
  177. function isBlob(val) {
  178. return toString.call(val) === '[object Blob]';
  179. }
  180. /**
  181. * Determine if a value is a Function
  182. *
  183. * @param {Object} val The value to test
  184. * @returns {boolean} True if value is a Function, otherwise false
  185. */
  186. function isFunction(val) {
  187. return toString.call(val) === '[object Function]';
  188. }
  189. /**
  190. * Determine if a value is a Stream
  191. *
  192. * @param {Object} val The value to test
  193. * @returns {boolean} True if value is a Stream, otherwise false
  194. */
  195. function isStream(val) {
  196. return isObject(val) && isFunction(val.pipe);
  197. }
  198. /**
  199. * Determine if a value is a URLSearchParams object
  200. *
  201. * @param {Object} val The value to test
  202. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  203. */
  204. function isURLSearchParams(val) {
  205. return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  206. }
  207. /**
  208. * Trim excess whitespace off the beginning and end of a string
  209. *
  210. * @param {String} str The String to trim
  211. * @returns {String} The String freed of excess whitespace
  212. */
  213. function trim(str) {
  214. return str.replace(/^\s*/, '').replace(/\s*$/, '');
  215. }
  216. /**
  217. * Determine if we're running in a standard browser environment
  218. *
  219. * This allows axios to run in a web worker, and react-native.
  220. * Both environments support XMLHttpRequest, but not fully standard globals.
  221. *
  222. * web workers:
  223. * typeof window -> undefined
  224. * typeof document -> undefined
  225. *
  226. * react-native:
  227. * navigator.product -> 'ReactNative'
  228. */
  229. function isStandardBrowserEnv() {
  230. if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
  231. return false;
  232. }
  233. return (
  234. typeof window !== 'undefined' &&
  235. typeof document !== 'undefined'
  236. );
  237. }
  238. /**
  239. * Iterate over an Array or an Object invoking a function for each item.
  240. *
  241. * If `obj` is an Array callback will be called passing
  242. * the value, index, and complete array for each item.
  243. *
  244. * If 'obj' is an Object callback will be called passing
  245. * the value, key, and complete object for each property.
  246. *
  247. * @param {Object|Array} obj The object to iterate
  248. * @param {Function} fn The callback to invoke for each item
  249. */
  250. function forEach(obj, fn) {
  251. // Don't bother if no value provided
  252. if (obj === null || typeof obj === 'undefined') {
  253. return;
  254. }
  255. // Force an array if not already something iterable
  256. if (typeof obj !== 'object' && !isArray(obj)) {
  257. /*eslint no-param-reassign:0*/
  258. obj = [obj];
  259. }
  260. if (isArray(obj)) {
  261. // Iterate over array values
  262. for (var i = 0, l = obj.length; i < l; i++) {
  263. fn.call(null, obj[i], i, obj);
  264. }
  265. } else {
  266. // Iterate over object keys
  267. for (var key in obj) {
  268. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  269. fn.call(null, obj[key], key, obj);
  270. }
  271. }
  272. }
  273. }
  274. /**
  275. * Accepts varargs expecting each argument to be an object, then
  276. * immutably merges the properties of each object and returns result.
  277. *
  278. * When multiple objects contain the same key the later object in
  279. * the arguments list will take precedence.
  280. *
  281. * Example:
  282. *
  283. * ```js
  284. * var result = merge({foo: 123}, {foo: 456});
  285. * console.log(result.foo); // outputs 456
  286. * ```
  287. *
  288. * @param {Object} obj1 Object to merge
  289. * @returns {Object} Result of all merge properties
  290. */
  291. function merge(/* obj1, obj2, obj3, ... */) {
  292. var result = {};
  293. function assignValue(val, key) {
  294. if (typeof result[key] === 'object' && typeof val === 'object') {
  295. result[key] = merge(result[key], val);
  296. } else {
  297. result[key] = val;
  298. }
  299. }
  300. for (var i = 0, l = arguments.length; i < l; i++) {
  301. forEach(arguments[i], assignValue);
  302. }
  303. return result;
  304. }
  305. /**
  306. * Extends object a by mutably adding to it the properties of object b.
  307. *
  308. * @param {Object} a The object to be extended
  309. * @param {Object} b The object to copy properties from
  310. * @param {Object} thisArg The object to bind function to
  311. * @return {Object} The resulting value of object a
  312. */
  313. function extend(a, b, thisArg) {
  314. forEach(b, function assignValue(val, key) {
  315. if (thisArg && typeof val === 'function') {
  316. a[key] = bind(val, thisArg);
  317. } else {
  318. a[key] = val;
  319. }
  320. });
  321. return a;
  322. }
  323. module.exports = {
  324. isArray: isArray,
  325. isArrayBuffer: isArrayBuffer,
  326. isBuffer: isBuffer,
  327. isFormData: isFormData,
  328. isArrayBufferView: isArrayBufferView,
  329. isString: isString,
  330. isNumber: isNumber,
  331. isObject: isObject,
  332. isUndefined: isUndefined,
  333. isDate: isDate,
  334. isFile: isFile,
  335. isBlob: isBlob,
  336. isFunction: isFunction,
  337. isStream: isStream,
  338. isURLSearchParams: isURLSearchParams,
  339. isStandardBrowserEnv: isStandardBrowserEnv,
  340. forEach: forEach,
  341. merge: merge,
  342. extend: extend,
  343. trim: trim
  344. };
  345. /***/ }),
  346. /* 1 */
  347. /***/ (function(module, exports) {
  348. var g;
  349. // This works in non-strict mode
  350. g = (function() {
  351. return this;
  352. })();
  353. try {
  354. // This works if eval is allowed (see CSP)
  355. g = g || Function("return this")() || (1,eval)("this");
  356. } catch(e) {
  357. // This works if the window reference is available
  358. if(typeof window === "object")
  359. g = window;
  360. }
  361. // g can still be undefined, but nothing to do about it...
  362. // We return undefined, instead of nothing here, so it's
  363. // easier to handle this case. if(!global) { ...}
  364. module.exports = g;
  365. /***/ }),
  366. /* 2 */
  367. /***/ (function(module, exports, __webpack_require__) {
  368. "use strict";
  369. /* WEBPACK VAR INJECTION */(function(process) {
  370. var utils = __webpack_require__(0);
  371. var normalizeHeaderName = __webpack_require__(20);
  372. var DEFAULT_CONTENT_TYPE = {
  373. 'Content-Type': 'application/x-www-form-urlencoded'
  374. };
  375. function setContentTypeIfUnset(headers, value) {
  376. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  377. headers['Content-Type'] = value;
  378. }
  379. }
  380. function getDefaultAdapter() {
  381. var adapter;
  382. if (typeof XMLHttpRequest !== 'undefined') {
  383. // For browsers use XHR adapter
  384. adapter = __webpack_require__(5);
  385. } else if (typeof process !== 'undefined') {
  386. // For node use HTTP adapter
  387. adapter = __webpack_require__(5);
  388. }
  389. return adapter;
  390. }
  391. var defaults = {
  392. adapter: getDefaultAdapter(),
  393. transformRequest: [function transformRequest(data, headers) {
  394. normalizeHeaderName(headers, 'Content-Type');
  395. if (utils.isFormData(data) ||
  396. utils.isArrayBuffer(data) ||
  397. utils.isBuffer(data) ||
  398. utils.isStream(data) ||
  399. utils.isFile(data) ||
  400. utils.isBlob(data)
  401. ) {
  402. return data;
  403. }
  404. if (utils.isArrayBufferView(data)) {
  405. return data.buffer;
  406. }
  407. if (utils.isURLSearchParams(data)) {
  408. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  409. return data.toString();
  410. }
  411. if (utils.isObject(data)) {
  412. setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  413. return JSON.stringify(data);
  414. }
  415. return data;
  416. }],
  417. transformResponse: [function transformResponse(data) {
  418. /*eslint no-param-reassign:0*/
  419. if (typeof data === 'string') {
  420. try {
  421. data = JSON.parse(data);
  422. } catch (e) { /* Ignore */ }
  423. }
  424. return data;
  425. }],
  426. timeout: 0,
  427. xsrfCookieName: 'XSRF-TOKEN',
  428. xsrfHeaderName: 'X-XSRF-TOKEN',
  429. maxContentLength: -1,
  430. validateStatus: function validateStatus(status) {
  431. return status >= 200 && status < 300;
  432. }
  433. };
  434. defaults.headers = {
  435. common: {
  436. 'Accept': 'application/json, text/plain, */*'
  437. }
  438. };
  439. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  440. defaults.headers[method] = {};
  441. });
  442. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  443. defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
  444. });
  445. module.exports = defaults;
  446. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4)))
  447. /***/ }),
  448. /* 3 */
  449. /***/ (function(module, exports, __webpack_require__) {
  450. "use strict";
  451. module.exports = function bind(fn, thisArg) {
  452. return function wrap() {
  453. var args = new Array(arguments.length);
  454. for (var i = 0; i < args.length; i++) {
  455. args[i] = arguments[i];
  456. }
  457. return fn.apply(thisArg, args);
  458. };
  459. };
  460. /***/ }),
  461. /* 4 */
  462. /***/ (function(module, exports) {
  463. // shim for using process in browser
  464. var process = module.exports = {};
  465. // cached from whatever global is present so that test runners that stub it
  466. // don't break things. But we need to wrap it in a try catch in case it is
  467. // wrapped in strict mode code which doesn't define any globals. It's inside a
  468. // function because try/catches deoptimize in certain engines.
  469. var cachedSetTimeout;
  470. var cachedClearTimeout;
  471. function defaultSetTimout() {
  472. throw new Error('setTimeout has not been defined');
  473. }
  474. function defaultClearTimeout () {
  475. throw new Error('clearTimeout has not been defined');
  476. }
  477. (function () {
  478. try {
  479. if (typeof setTimeout === 'function') {
  480. cachedSetTimeout = setTimeout;
  481. } else {
  482. cachedSetTimeout = defaultSetTimout;
  483. }
  484. } catch (e) {
  485. cachedSetTimeout = defaultSetTimout;
  486. }
  487. try {
  488. if (typeof clearTimeout === 'function') {
  489. cachedClearTimeout = clearTimeout;
  490. } else {
  491. cachedClearTimeout = defaultClearTimeout;
  492. }
  493. } catch (e) {
  494. cachedClearTimeout = defaultClearTimeout;
  495. }
  496. } ())
  497. function runTimeout(fun) {
  498. if (cachedSetTimeout === setTimeout) {
  499. //normal enviroments in sane situations
  500. return setTimeout(fun, 0);
  501. }
  502. // if setTimeout wasn't available but was latter defined
  503. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  504. cachedSetTimeout = setTimeout;
  505. return setTimeout(fun, 0);
  506. }
  507. try {
  508. // when when somebody has screwed with setTimeout but no I.E. maddness
  509. return cachedSetTimeout(fun, 0);
  510. } catch(e){
  511. try {
  512. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  513. return cachedSetTimeout.call(null, fun, 0);
  514. } catch(e){
  515. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
  516. return cachedSetTimeout.call(this, fun, 0);
  517. }
  518. }
  519. }
  520. function runClearTimeout(marker) {
  521. if (cachedClearTimeout === clearTimeout) {
  522. //normal enviroments in sane situations
  523. return clearTimeout(marker);
  524. }
  525. // if clearTimeout wasn't available but was latter defined
  526. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  527. cachedClearTimeout = clearTimeout;
  528. return clearTimeout(marker);
  529. }
  530. try {
  531. // when when somebody has screwed with setTimeout but no I.E. maddness
  532. return cachedClearTimeout(marker);
  533. } catch (e){
  534. try {
  535. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  536. return cachedClearTimeout.call(null, marker);
  537. } catch (e){
  538. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
  539. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  540. return cachedClearTimeout.call(this, marker);
  541. }
  542. }
  543. }
  544. var queue = [];
  545. var draining = false;
  546. var currentQueue;
  547. var queueIndex = -1;
  548. function cleanUpNextTick() {
  549. if (!draining || !currentQueue) {
  550. return;
  551. }
  552. draining = false;
  553. if (currentQueue.length) {
  554. queue = currentQueue.concat(queue);
  555. } else {
  556. queueIndex = -1;
  557. }
  558. if (queue.length) {
  559. drainQueue();
  560. }
  561. }
  562. function drainQueue() {
  563. if (draining) {
  564. return;
  565. }
  566. var timeout = runTimeout(cleanUpNextTick);
  567. draining = true;
  568. var len = queue.length;
  569. while(len) {
  570. currentQueue = queue;
  571. queue = [];
  572. while (++queueIndex < len) {
  573. if (currentQueue) {
  574. currentQueue[queueIndex].run();
  575. }
  576. }
  577. queueIndex = -1;
  578. len = queue.length;
  579. }
  580. currentQueue = null;
  581. draining = false;
  582. runClearTimeout(timeout);
  583. }
  584. process.nextTick = function (fun) {
  585. var args = new Array(arguments.length - 1);
  586. if (arguments.length > 1) {
  587. for (var i = 1; i < arguments.length; i++) {
  588. args[i - 1] = arguments[i];
  589. }
  590. }
  591. queue.push(new Item(fun, args));
  592. if (queue.length === 1 && !draining) {
  593. runTimeout(drainQueue);
  594. }
  595. };
  596. // v8 likes predictible objects
  597. function Item(fun, array) {
  598. this.fun = fun;
  599. this.array = array;
  600. }
  601. Item.prototype.run = function () {
  602. this.fun.apply(null, this.array);
  603. };
  604. process.title = 'browser';
  605. process.browser = true;
  606. process.env = {};
  607. process.argv = [];
  608. process.version = ''; // empty string to avoid regexp issues
  609. process.versions = {};
  610. function noop() {}
  611. process.on = noop;
  612. process.addListener = noop;
  613. process.once = noop;
  614. process.off = noop;
  615. process.removeListener = noop;
  616. process.removeAllListeners = noop;
  617. process.emit = noop;
  618. process.prependListener = noop;
  619. process.prependOnceListener = noop;
  620. process.listeners = function (name) { return [] }
  621. process.binding = function (name) {
  622. throw new Error('process.binding is not supported');
  623. };
  624. process.cwd = function () { return '/' };
  625. process.chdir = function (dir) {
  626. throw new Error('process.chdir is not supported');
  627. };
  628. process.umask = function() { return 0; };
  629. /***/ }),
  630. /* 5 */
  631. /***/ (function(module, exports, __webpack_require__) {
  632. "use strict";
  633. var utils = __webpack_require__(0);
  634. var settle = __webpack_require__(21);
  635. var buildURL = __webpack_require__(23);
  636. var parseHeaders = __webpack_require__(24);
  637. var isURLSameOrigin = __webpack_require__(25);
  638. var createError = __webpack_require__(6);
  639. var btoa = (typeof window !== 'undefined' && window.btoa && window.btoa.bind(window)) || __webpack_require__(26);
  640. module.exports = function xhrAdapter(config) {
  641. return new Promise(function dispatchXhrRequest(resolve, reject) {
  642. var requestData = config.data;
  643. var requestHeaders = config.headers;
  644. if (utils.isFormData(requestData)) {
  645. delete requestHeaders['Content-Type']; // Let the browser set it
  646. }
  647. var request = new XMLHttpRequest();
  648. var loadEvent = 'onreadystatechange';
  649. var xDomain = false;
  650. // For IE 8/9 CORS support
  651. // Only supports POST and GET calls and doesn't returns the response headers.
  652. // DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest.
  653. if ("development" !== 'test' &&
  654. typeof window !== 'undefined' &&
  655. window.XDomainRequest && !('withCredentials' in request) &&
  656. !isURLSameOrigin(config.url)) {
  657. request = new window.XDomainRequest();
  658. loadEvent = 'onload';
  659. xDomain = true;
  660. request.onprogress = function handleProgress() {};
  661. request.ontimeout = function handleTimeout() {};
  662. }
  663. // HTTP basic authentication
  664. if (config.auth) {
  665. var username = config.auth.username || '';
  666. var password = config.auth.password || '';
  667. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  668. }
  669. request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);
  670. // Set the request timeout in MS
  671. request.timeout = config.timeout;
  672. // Listen for ready state
  673. request[loadEvent] = function handleLoad() {
  674. if (!request || (request.readyState !== 4 && !xDomain)) {
  675. return;
  676. }
  677. // The request errored out and we didn't get a response, this will be
  678. // handled by onerror instead
  679. // With one exception: request that using file: protocol, most browsers
  680. // will return status as 0 even though it's a successful request
  681. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  682. return;
  683. }
  684. // Prepare the response
  685. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  686. var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  687. var response = {
  688. data: responseData,
  689. // IE sends 1223 instead of 204 (https://github.com/mzabriskie/axios/issues/201)
  690. status: request.status === 1223 ? 204 : request.status,
  691. statusText: request.status === 1223 ? 'No Content' : request.statusText,
  692. headers: responseHeaders,
  693. config: config,
  694. request: request
  695. };
  696. settle(resolve, reject, response);
  697. // Clean up request
  698. request = null;
  699. };
  700. // Handle low level network errors
  701. request.onerror = function handleError() {
  702. // Real errors are hidden from us by the browser
  703. // onerror should only fire if it's a network error
  704. reject(createError('Network Error', config, null, request));
  705. // Clean up request
  706. request = null;
  707. };
  708. // Handle timeout
  709. request.ontimeout = function handleTimeout() {
  710. reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED',
  711. request));
  712. // Clean up request
  713. request = null;
  714. };
  715. // Add xsrf header
  716. // This is only done if running in a standard browser environment.
  717. // Specifically not if we're in a web worker, or react-native.
  718. if (utils.isStandardBrowserEnv()) {
  719. var cookies = __webpack_require__(27);
  720. // Add xsrf header
  721. var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
  722. cookies.read(config.xsrfCookieName) :
  723. undefined;
  724. if (xsrfValue) {
  725. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  726. }
  727. }
  728. // Add headers to the request
  729. if ('setRequestHeader' in request) {
  730. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  731. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  732. // Remove Content-Type if data is undefined
  733. delete requestHeaders[key];
  734. } else {
  735. // Otherwise add header to the request
  736. request.setRequestHeader(key, val);
  737. }
  738. });
  739. }
  740. // Add withCredentials to request if needed
  741. if (config.withCredentials) {
  742. request.withCredentials = true;
  743. }
  744. // Add responseType to request if needed
  745. if (config.responseType) {
  746. try {
  747. request.responseType = config.responseType;
  748. } catch (e) {
  749. // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
  750. // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
  751. if (config.responseType !== 'json') {
  752. throw e;
  753. }
  754. }
  755. }
  756. // Handle progress if needed
  757. if (typeof config.onDownloadProgress === 'function') {
  758. request.addEventListener('progress', config.onDownloadProgress);
  759. }
  760. // Not all browsers support upload events
  761. if (typeof config.onUploadProgress === 'function' && request.upload) {
  762. request.upload.addEventListener('progress', config.onUploadProgress);
  763. }
  764. if (config.cancelToken) {
  765. // Handle cancellation
  766. config.cancelToken.promise.then(function onCanceled(cancel) {
  767. if (!request) {
  768. return;
  769. }
  770. request.abort();
  771. reject(cancel);
  772. // Clean up request
  773. request = null;
  774. });
  775. }
  776. if (requestData === undefined) {
  777. requestData = null;
  778. }
  779. // Send the request
  780. request.send(requestData);
  781. });
  782. };
  783. /***/ }),
  784. /* 6 */
  785. /***/ (function(module, exports, __webpack_require__) {
  786. "use strict";
  787. var enhanceError = __webpack_require__(22);
  788. /**
  789. * Create an Error with the specified message, config, error code, request and response.
  790. *
  791. * @param {string} message The error message.
  792. * @param {Object} config The config.
  793. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  794. * @param {Object} [request] The request.
  795. * @param {Object} [response] The response.
  796. * @returns {Error} The created error.
  797. */
  798. module.exports = function createError(message, config, code, request, response) {
  799. var error = new Error(message);
  800. return enhanceError(error, config, code, request, response);
  801. };
  802. /***/ }),
  803. /* 7 */
  804. /***/ (function(module, exports, __webpack_require__) {
  805. "use strict";
  806. module.exports = function isCancel(value) {
  807. return !!(value && value.__CANCEL__);
  808. };
  809. /***/ }),
  810. /* 8 */
  811. /***/ (function(module, exports, __webpack_require__) {
  812. "use strict";
  813. /**
  814. * A `Cancel` is an object that is thrown when an operation is canceled.
  815. *
  816. * @class
  817. * @param {string=} message The message.
  818. */
  819. function Cancel(message) {
  820. this.message = message;
  821. }
  822. Cancel.prototype.toString = function toString() {
  823. return 'Cancel' + (this.message ? ': ' + this.message : '');
  824. };
  825. Cancel.prototype.__CANCEL__ = true;
  826. module.exports = Cancel;
  827. /***/ }),
  828. /* 9 */
  829. /***/ (function(module, exports, __webpack_require__) {
  830. __webpack_require__(10);
  831. module.exports = __webpack_require__(42);
  832. /***/ }),
  833. /* 10 */
  834. /***/ (function(module, exports, __webpack_require__) {
  835. /**
  836. * First we will load all of this project's JavaScript dependencies which
  837. * includes Vue and other libraries. It is a great starting point when
  838. * building robust, powerful web applications using Vue and Laravel.
  839. */
  840. __webpack_require__(11);
  841. window.Vue = __webpack_require__(35);
  842. /**
  843. * Next, we will create a fresh Vue application instance and attach it to
  844. * the page. Then, you may begin adding components to this application
  845. * or customize the JavaScript scaffolding to fit your unique needs.
  846. */
  847. Vue.component('example', __webpack_require__(38));
  848. var app = new Vue({
  849. el: '#app'
  850. });
  851. /***/ }),
  852. /* 11 */
  853. /***/ (function(module, exports, __webpack_require__) {
  854. window._ = __webpack_require__(12);
  855. /**
  856. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  857. * for JavaScript based Bootstrap features such as modals and tabs. This
  858. * code may be modified to fit the specific needs of your application.
  859. */
  860. try {
  861. window.$ = window.jQuery = __webpack_require__(14);
  862. __webpack_require__(15);
  863. } catch (e) {}
  864. /**
  865. * We'll load the axios HTTP library which allows us to easily issue requests
  866. * to our Laravel back-end. This library automatically handles sending the
  867. * CSRF token as a header based on the value of the "XSRF" token cookie.
  868. */
  869. window.axios = __webpack_require__(16);
  870. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  871. /**
  872. * Next we will register the CSRF Token as a common header with Axios so that
  873. * all outgoing HTTP requests automatically have it attached. This is just
  874. * a simple convenience so we don't have to attach every token manually.
  875. */
  876. var token = document.head.querySelector('meta[name="csrf-token"]');
  877. if (token) {
  878. window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
  879. } else {
  880. console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
  881. }
  882. /**
  883. * Echo exposes an expressive API for subscribing to channels and listening
  884. * for events that are broadcast by Laravel. Echo and event broadcasting
  885. * allows your team to easily build robust real-time web applications.
  886. */
  887. // import Echo from 'laravel-echo'
  888. // window.Pusher = require('pusher-js');
  889. // window.Echo = new Echo({
  890. // broadcaster: 'pusher',
  891. // key: 'your-pusher-key'
  892. // });
  893. /***/ }),
  894. /* 12 */
  895. /***/ (function(module, exports, __webpack_require__) {
  896. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  897. * @license
  898. * Lodash <https://lodash.com/>
  899. * Copyright JS Foundation and other contributors <https://js.foundation/>
  900. * Released under MIT license <https://lodash.com/license>
  901. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  902. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  903. */
  904. ;(function() {
  905. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  906. var undefined;
  907. /** Used as the semantic version number. */
  908. var VERSION = '4.17.5';
  909. /** Used as the size to enable large array optimizations. */
  910. var LARGE_ARRAY_SIZE = 200;
  911. /** Error message constants. */
  912. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  913. FUNC_ERROR_TEXT = 'Expected a function';
  914. /** Used to stand-in for `undefined` hash values. */
  915. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  916. /** Used as the maximum memoize cache size. */
  917. var MAX_MEMOIZE_SIZE = 500;
  918. /** Used as the internal argument placeholder. */
  919. var PLACEHOLDER = '__lodash_placeholder__';
  920. /** Used to compose bitmasks for cloning. */
  921. var CLONE_DEEP_FLAG = 1,
  922. CLONE_FLAT_FLAG = 2,
  923. CLONE_SYMBOLS_FLAG = 4;
  924. /** Used to compose bitmasks for value comparisons. */
  925. var COMPARE_PARTIAL_FLAG = 1,
  926. COMPARE_UNORDERED_FLAG = 2;
  927. /** Used to compose bitmasks for function metadata. */
  928. var WRAP_BIND_FLAG = 1,
  929. WRAP_BIND_KEY_FLAG = 2,
  930. WRAP_CURRY_BOUND_FLAG = 4,
  931. WRAP_CURRY_FLAG = 8,
  932. WRAP_CURRY_RIGHT_FLAG = 16,
  933. WRAP_PARTIAL_FLAG = 32,
  934. WRAP_PARTIAL_RIGHT_FLAG = 64,
  935. WRAP_ARY_FLAG = 128,
  936. WRAP_REARG_FLAG = 256,
  937. WRAP_FLIP_FLAG = 512;
  938. /** Used as default options for `_.truncate`. */
  939. var DEFAULT_TRUNC_LENGTH = 30,
  940. DEFAULT_TRUNC_OMISSION = '...';
  941. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  942. var HOT_COUNT = 800,
  943. HOT_SPAN = 16;
  944. /** Used to indicate the type of lazy iteratees. */
  945. var LAZY_FILTER_FLAG = 1,
  946. LAZY_MAP_FLAG = 2,
  947. LAZY_WHILE_FLAG = 3;
  948. /** Used as references for various `Number` constants. */
  949. var INFINITY = 1 / 0,
  950. MAX_SAFE_INTEGER = 9007199254740991,
  951. MAX_INTEGER = 1.7976931348623157e+308,
  952. NAN = 0 / 0;
  953. /** Used as references for the maximum length and index of an array. */
  954. var MAX_ARRAY_LENGTH = 4294967295,
  955. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  956. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  957. /** Used to associate wrap methods with their bit flags. */
  958. var wrapFlags = [
  959. ['ary', WRAP_ARY_FLAG],
  960. ['bind', WRAP_BIND_FLAG],
  961. ['bindKey', WRAP_BIND_KEY_FLAG],
  962. ['curry', WRAP_CURRY_FLAG],
  963. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  964. ['flip', WRAP_FLIP_FLAG],
  965. ['partial', WRAP_PARTIAL_FLAG],
  966. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  967. ['rearg', WRAP_REARG_FLAG]
  968. ];
  969. /** `Object#toString` result references. */
  970. var argsTag = '[object Arguments]',
  971. arrayTag = '[object Array]',
  972. asyncTag = '[object AsyncFunction]',
  973. boolTag = '[object Boolean]',
  974. dateTag = '[object Date]',
  975. domExcTag = '[object DOMException]',
  976. errorTag = '[object Error]',
  977. funcTag = '[object Function]',
  978. genTag = '[object GeneratorFunction]',
  979. mapTag = '[object Map]',
  980. numberTag = '[object Number]',
  981. nullTag = '[object Null]',
  982. objectTag = '[object Object]',
  983. promiseTag = '[object Promise]',
  984. proxyTag = '[object Proxy]',
  985. regexpTag = '[object RegExp]',
  986. setTag = '[object Set]',
  987. stringTag = '[object String]',
  988. symbolTag = '[object Symbol]',
  989. undefinedTag = '[object Undefined]',
  990. weakMapTag = '[object WeakMap]',
  991. weakSetTag = '[object WeakSet]';
  992. var arrayBufferTag = '[object ArrayBuffer]',
  993. dataViewTag = '[object DataView]',
  994. float32Tag = '[object Float32Array]',
  995. float64Tag = '[object Float64Array]',
  996. int8Tag = '[object Int8Array]',
  997. int16Tag = '[object Int16Array]',
  998. int32Tag = '[object Int32Array]',
  999. uint8Tag = '[object Uint8Array]',
  1000. uint8ClampedTag = '[object Uint8ClampedArray]',
  1001. uint16Tag = '[object Uint16Array]',
  1002. uint32Tag = '[object Uint32Array]';
  1003. /** Used to match empty string literals in compiled template source. */
  1004. var reEmptyStringLeading = /\b__p \+= '';/g,
  1005. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  1006. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  1007. /** Used to match HTML entities and HTML characters. */
  1008. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  1009. reUnescapedHtml = /[&<>"']/g,
  1010. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  1011. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  1012. /** Used to match template delimiters. */
  1013. var reEscape = /<%-([\s\S]+?)%>/g,
  1014. reEvaluate = /<%([\s\S]+?)%>/g,
  1015. reInterpolate = /<%=([\s\S]+?)%>/g;
  1016. /** Used to match property names within property paths. */
  1017. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  1018. reIsPlainProp = /^\w*$/,
  1019. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  1020. /**
  1021. * Used to match `RegExp`
  1022. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  1023. */
  1024. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  1025. reHasRegExpChar = RegExp(reRegExpChar.source);
  1026. /** Used to match leading and trailing whitespace. */
  1027. var reTrim = /^\s+|\s+$/g,
  1028. reTrimStart = /^\s+/,
  1029. reTrimEnd = /\s+$/;
  1030. /** Used to match wrap detail comments. */
  1031. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  1032. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  1033. reSplitDetails = /,? & /;
  1034. /** Used to match words composed of alphanumeric characters. */
  1035. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  1036. /** Used to match backslashes in property paths. */
  1037. var reEscapeChar = /\\(\\)?/g;
  1038. /**
  1039. * Used to match
  1040. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  1041. */
  1042. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  1043. /** Used to match `RegExp` flags from their coerced string values. */
  1044. var reFlags = /\w*$/;
  1045. /** Used to detect bad signed hexadecimal string values. */
  1046. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  1047. /** Used to detect binary string values. */
  1048. var reIsBinary = /^0b[01]+$/i;
  1049. /** Used to detect host constructors (Safari). */
  1050. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  1051. /** Used to detect octal string values. */
  1052. var reIsOctal = /^0o[0-7]+$/i;
  1053. /** Used to detect unsigned integer values. */
  1054. var reIsUint = /^(?:0|[1-9]\d*)$/;
  1055. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  1056. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  1057. /** Used to ensure capturing order of template delimiters. */
  1058. var reNoMatch = /($^)/;
  1059. /** Used to match unescaped characters in compiled string literals. */
  1060. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  1061. /** Used to compose unicode character classes. */
  1062. var rsAstralRange = '\\ud800-\\udfff',
  1063. rsComboMarksRange = '\\u0300-\\u036f',
  1064. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  1065. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  1066. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  1067. rsDingbatRange = '\\u2700-\\u27bf',
  1068. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  1069. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  1070. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  1071. rsPunctuationRange = '\\u2000-\\u206f',
  1072. 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',
  1073. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  1074. rsVarRange = '\\ufe0e\\ufe0f',
  1075. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  1076. /** Used to compose unicode capture groups. */
  1077. var rsApos = "['\u2019]",
  1078. rsAstral = '[' + rsAstralRange + ']',
  1079. rsBreak = '[' + rsBreakRange + ']',
  1080. rsCombo = '[' + rsComboRange + ']',
  1081. rsDigits = '\\d+',
  1082. rsDingbat = '[' + rsDingbatRange + ']',
  1083. rsLower = '[' + rsLowerRange + ']',
  1084. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  1085. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  1086. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  1087. rsNonAstral = '[^' + rsAstralRange + ']',
  1088. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  1089. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  1090. rsUpper = '[' + rsUpperRange + ']',
  1091. rsZWJ = '\\u200d';
  1092. /** Used to compose unicode regexes. */
  1093. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  1094. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  1095. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  1096. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  1097. reOptMod = rsModifier + '?',
  1098. rsOptVar = '[' + rsVarRange + ']?',
  1099. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  1100. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  1101. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  1102. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  1103. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  1104. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  1105. /** Used to match apostrophes. */
  1106. var reApos = RegExp(rsApos, 'g');
  1107. /**
  1108. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  1109. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  1110. */
  1111. var reComboMark = RegExp(rsCombo, 'g');
  1112. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  1113. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  1114. /** Used to match complex or compound words. */
  1115. var reUnicodeWord = RegExp([
  1116. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  1117. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  1118. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  1119. rsUpper + '+' + rsOptContrUpper,
  1120. rsOrdUpper,
  1121. rsOrdLower,
  1122. rsDigits,
  1123. rsEmoji
  1124. ].join('|'), 'g');
  1125. /** 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/). */
  1126. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  1127. /** Used to detect strings that need a more robust regexp to match words. */
  1128. 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 ]/;
  1129. /** Used to assign default `context` object properties. */
  1130. var contextProps = [
  1131. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  1132. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  1133. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  1134. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  1135. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  1136. ];
  1137. /** Used to make template sourceURLs easier to identify. */
  1138. var templateCounter = -1;
  1139. /** Used to identify `toStringTag` values of typed arrays. */
  1140. var typedArrayTags = {};
  1141. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  1142. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  1143. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  1144. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  1145. typedArrayTags[uint32Tag] = true;
  1146. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  1147. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  1148. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  1149. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  1150. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  1151. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  1152. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  1153. typedArrayTags[weakMapTag] = false;
  1154. /** Used to identify `toStringTag` values supported by `_.clone`. */
  1155. var cloneableTags = {};
  1156. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  1157. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  1158. cloneableTags[boolTag] = cloneableTags[dateTag] =
  1159. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  1160. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  1161. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  1162. cloneableTags[numberTag] = cloneableTags[objectTag] =
  1163. cloneableTags[regexpTag] = cloneableTags[setTag] =
  1164. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  1165. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  1166. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  1167. cloneableTags[errorTag] = cloneableTags[funcTag] =
  1168. cloneableTags[weakMapTag] = false;
  1169. /** Used to map Latin Unicode letters to basic Latin letters. */
  1170. var deburredLetters = {
  1171. // Latin-1 Supplement block.
  1172. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  1173. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  1174. '\xc7': 'C', '\xe7': 'c',
  1175. '\xd0': 'D', '\xf0': 'd',
  1176. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  1177. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  1178. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  1179. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  1180. '\xd1': 'N', '\xf1': 'n',
  1181. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  1182. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  1183. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  1184. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  1185. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  1186. '\xc6': 'Ae', '\xe6': 'ae',
  1187. '\xde': 'Th', '\xfe': 'th',
  1188. '\xdf': 'ss',
  1189. // Latin Extended-A block.
  1190. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  1191. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  1192. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  1193. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  1194. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  1195. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  1196. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  1197. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  1198. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  1199. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  1200. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  1201. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  1202. '\u0134': 'J', '\u0135': 'j',
  1203. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  1204. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  1205. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  1206. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  1207. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  1208. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  1209. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  1210. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  1211. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  1212. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  1213. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  1214. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  1215. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  1216. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  1217. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  1218. '\u0174': 'W', '\u0175': 'w',
  1219. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  1220. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  1221. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  1222. '\u0132': 'IJ', '\u0133': 'ij',
  1223. '\u0152': 'Oe', '\u0153': 'oe',
  1224. '\u0149': "'n", '\u017f': 's'
  1225. };
  1226. /** Used to map characters to HTML entities. */
  1227. var htmlEscapes = {
  1228. '&': '&amp;',
  1229. '<': '&lt;',
  1230. '>': '&gt;',
  1231. '"': '&quot;',
  1232. "'": '&#39;'
  1233. };
  1234. /** Used to map HTML entities to characters. */
  1235. var htmlUnescapes = {
  1236. '&amp;': '&',
  1237. '&lt;': '<',
  1238. '&gt;': '>',
  1239. '&quot;': '"',
  1240. '&#39;': "'"
  1241. };
  1242. /** Used to escape characters for inclusion in compiled string literals. */
  1243. var stringEscapes = {
  1244. '\\': '\\',
  1245. "'": "'",
  1246. '\n': 'n',
  1247. '\r': 'r',
  1248. '\u2028': 'u2028',
  1249. '\u2029': 'u2029'
  1250. };
  1251. /** Built-in method references without a dependency on `root`. */
  1252. var freeParseFloat = parseFloat,
  1253. freeParseInt = parseInt;
  1254. /** Detect free variable `global` from Node.js. */
  1255. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  1256. /** Detect free variable `self`. */
  1257. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  1258. /** Used as a reference to the global object. */
  1259. var root = freeGlobal || freeSelf || Function('return this')();
  1260. /** Detect free variable `exports`. */
  1261. var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
  1262. /** Detect free variable `module`. */
  1263. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  1264. /** Detect the popular CommonJS extension `module.exports`. */
  1265. var moduleExports = freeModule && freeModule.exports === freeExports;
  1266. /** Detect free variable `process` from Node.js. */
  1267. var freeProcess = moduleExports && freeGlobal.process;
  1268. /** Used to access faster Node.js helpers. */
  1269. var nodeUtil = (function() {
  1270. try {
  1271. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  1272. } catch (e) {}
  1273. }());
  1274. /* Node.js helper references. */
  1275. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  1276. nodeIsDate = nodeUtil && nodeUtil.isDate,
  1277. nodeIsMap = nodeUtil && nodeUtil.isMap,
  1278. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  1279. nodeIsSet = nodeUtil && nodeUtil.isSet,
  1280. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  1281. /*--------------------------------------------------------------------------*/
  1282. /**
  1283. * A faster alternative to `Function#apply`, this function invokes `func`
  1284. * with the `this` binding of `thisArg` and the arguments of `args`.
  1285. *
  1286. * @private
  1287. * @param {Function} func The function to invoke.
  1288. * @param {*} thisArg The `this` binding of `func`.
  1289. * @param {Array} args The arguments to invoke `func` with.
  1290. * @returns {*} Returns the result of `func`.
  1291. */
  1292. function apply(func, thisArg, args) {
  1293. switch (args.length) {
  1294. case 0: return func.call(thisArg);
  1295. case 1: return func.call(thisArg, args[0]);
  1296. case 2: return func.call(thisArg, args[0], args[1]);
  1297. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  1298. }
  1299. return func.apply(thisArg, args);
  1300. }
  1301. /**
  1302. * A specialized version of `baseAggregator` for arrays.
  1303. *
  1304. * @private
  1305. * @param {Array} [array] The array to iterate over.
  1306. * @param {Function} setter The function to set `accumulator` values.
  1307. * @param {Function} iteratee The iteratee to transform keys.
  1308. * @param {Object} accumulator The initial aggregated object.
  1309. * @returns {Function} Returns `accumulator`.
  1310. */
  1311. function arrayAggregator(array, setter, iteratee, accumulator) {
  1312. var index = -1,
  1313. length = array == null ? 0 : array.length;
  1314. while (++index < length) {
  1315. var value = array[index];
  1316. setter(accumulator, value, iteratee(value), array);
  1317. }
  1318. return accumulator;
  1319. }
  1320. /**
  1321. * A specialized version of `_.forEach` for arrays without support for
  1322. * iteratee shorthands.
  1323. *
  1324. * @private
  1325. * @param {Array} [array] The array to iterate over.
  1326. * @param {Function} iteratee The function invoked per iteration.
  1327. * @returns {Array} Returns `array`.
  1328. */
  1329. function arrayEach(array, iteratee) {
  1330. var index = -1,
  1331. length = array == null ? 0 : array.length;
  1332. while (++index < length) {
  1333. if (iteratee(array[index], index, array) === false) {
  1334. break;
  1335. }
  1336. }
  1337. return array;
  1338. }
  1339. /**
  1340. * A specialized version of `_.forEachRight` for arrays without support for
  1341. * iteratee shorthands.
  1342. *
  1343. * @private
  1344. * @param {Array} [array] The array to iterate over.
  1345. * @param {Function} iteratee The function invoked per iteration.
  1346. * @returns {Array} Returns `array`.
  1347. */
  1348. function arrayEachRight(array, iteratee) {
  1349. var length = array == null ? 0 : array.length;
  1350. while (length--) {
  1351. if (iteratee(array[length], length, array) === false) {
  1352. break;
  1353. }
  1354. }
  1355. return array;
  1356. }
  1357. /**
  1358. * A specialized version of `_.every` for arrays without support for
  1359. * iteratee shorthands.
  1360. *
  1361. * @private
  1362. * @param {Array} [array] The array to iterate over.
  1363. * @param {Function} predicate The function invoked per iteration.
  1364. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  1365. * else `false`.
  1366. */
  1367. function arrayEvery(array, predicate) {
  1368. var index = -1,
  1369. length = array == null ? 0 : array.length;
  1370. while (++index < length) {
  1371. if (!predicate(array[index], index, array)) {
  1372. return false;
  1373. }
  1374. }
  1375. return true;
  1376. }
  1377. /**
  1378. * A specialized version of `_.filter` for arrays without support for
  1379. * iteratee shorthands.
  1380. *
  1381. * @private
  1382. * @param {Array} [array] The array to iterate over.
  1383. * @param {Function} predicate The function invoked per iteration.
  1384. * @returns {Array} Returns the new filtered array.
  1385. */
  1386. function arrayFilter(array, predicate) {
  1387. var index = -1,
  1388. length = array == null ? 0 : array.length,
  1389. resIndex = 0,
  1390. result = [];
  1391. while (++index < length) {
  1392. var value = array[index];
  1393. if (predicate(value, index, array)) {
  1394. result[resIndex++] = value;
  1395. }
  1396. }
  1397. return result;
  1398. }
  1399. /**
  1400. * A specialized version of `_.includes` for arrays without support for
  1401. * specifying an index to search from.
  1402. *
  1403. * @private
  1404. * @param {Array} [array] The array to inspect.
  1405. * @param {*} target The value to search for.
  1406. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  1407. */
  1408. function arrayIncludes(array, value) {
  1409. var length = array == null ? 0 : array.length;
  1410. return !!length && baseIndexOf(array, value, 0) > -1;
  1411. }
  1412. /**
  1413. * This function is like `arrayIncludes` except that it accepts a comparator.
  1414. *
  1415. * @private
  1416. * @param {Array} [array] The array to inspect.
  1417. * @param {*} target The value to search for.
  1418. * @param {Function} comparator The comparator invoked per element.
  1419. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  1420. */
  1421. function arrayIncludesWith(array, value, comparator) {
  1422. var index = -1,
  1423. length = array == null ? 0 : array.length;
  1424. while (++index < length) {
  1425. if (comparator(value, array[index])) {
  1426. return true;
  1427. }
  1428. }
  1429. return false;
  1430. }
  1431. /**
  1432. * A specialized version of `_.map` for arrays without support for iteratee
  1433. * shorthands.
  1434. *
  1435. * @private
  1436. * @param {Array} [array] The array to iterate over.
  1437. * @param {Function} iteratee The function invoked per iteration.
  1438. * @returns {Array} Returns the new mapped array.
  1439. */
  1440. function arrayMap(array, iteratee) {
  1441. var index = -1,
  1442. length = array == null ? 0 : array.length,
  1443. result = Array(length);
  1444. while (++index < length) {
  1445. result[index] = iteratee(array[index], index, array);
  1446. }
  1447. return result;
  1448. }
  1449. /**
  1450. * Appends the elements of `values` to `array`.
  1451. *
  1452. * @private
  1453. * @param {Array} array The array to modify.
  1454. * @param {Array} values The values to append.
  1455. * @returns {Array} Returns `array`.
  1456. */
  1457. function arrayPush(array, values) {
  1458. var index = -1,
  1459. length = values.length,
  1460. offset = array.length;
  1461. while (++index < length) {
  1462. array[offset + index] = values[index];
  1463. }
  1464. return array;
  1465. }
  1466. /**
  1467. * A specialized version of `_.reduce` for arrays without support for
  1468. * iteratee shorthands.
  1469. *
  1470. * @private
  1471. * @param {Array} [array] The array to iterate over.
  1472. * @param {Function} iteratee The function invoked per iteration.
  1473. * @param {*} [accumulator] The initial value.
  1474. * @param {boolean} [initAccum] Specify using the first element of `array` as
  1475. * the initial value.
  1476. * @returns {*} Returns the accumulated value.
  1477. */
  1478. function arrayReduce(array, iteratee, accumulator, initAccum) {
  1479. var index = -1,
  1480. length = array == null ? 0 : array.length;
  1481. if (initAccum && length) {
  1482. accumulator = array[++index];
  1483. }
  1484. while (++index < length) {
  1485. accumulator = iteratee(accumulator, array[index], index, array);
  1486. }
  1487. return accumulator;
  1488. }
  1489. /**
  1490. * A specialized version of `_.reduceRight` for arrays without support for
  1491. * iteratee shorthands.
  1492. *
  1493. * @private
  1494. * @param {Array} [array] The array to iterate over.
  1495. * @param {Function} iteratee The function invoked per iteration.
  1496. * @param {*} [accumulator] The initial value.
  1497. * @param {boolean} [initAccum] Specify using the last element of `array` as
  1498. * the initial value.
  1499. * @returns {*} Returns the accumulated value.
  1500. */
  1501. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  1502. var length = array == null ? 0 : array.length;
  1503. if (initAccum && length) {
  1504. accumulator = array[--length];
  1505. }
  1506. while (length--) {
  1507. accumulator = iteratee(accumulator, array[length], length, array);
  1508. }
  1509. return accumulator;
  1510. }
  1511. /**
  1512. * A specialized version of `_.some` for arrays without support for iteratee
  1513. * shorthands.
  1514. *
  1515. * @private
  1516. * @param {Array} [array] The array to iterate over.
  1517. * @param {Function} predicate The function invoked per iteration.
  1518. * @returns {boolean} Returns `true` if any element passes the predicate check,
  1519. * else `false`.
  1520. */
  1521. function arraySome(array, predicate) {
  1522. var index = -1,
  1523. length = array == null ? 0 : array.length;
  1524. while (++index < length) {
  1525. if (predicate(array[index], index, array)) {
  1526. return true;
  1527. }
  1528. }
  1529. return false;
  1530. }
  1531. /**
  1532. * Gets the size of an ASCII `string`.
  1533. *
  1534. * @private
  1535. * @param {string} string The string inspect.
  1536. * @returns {number} Returns the string size.
  1537. */
  1538. var asciiSize = baseProperty('length');
  1539. /**
  1540. * Converts an ASCII `string` to an array.
  1541. *
  1542. * @private
  1543. * @param {string} string The string to convert.
  1544. * @returns {Array} Returns the converted array.
  1545. */
  1546. function asciiToArray(string) {
  1547. return string.split('');
  1548. }
  1549. /**
  1550. * Splits an ASCII `string` into an array of its words.
  1551. *
  1552. * @private
  1553. * @param {string} The string to inspect.
  1554. * @returns {Array} Returns the words of `string`.
  1555. */
  1556. function asciiWords(string) {
  1557. return string.match(reAsciiWord) || [];
  1558. }
  1559. /**
  1560. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  1561. * without support for iteratee shorthands, which iterates over `collection`
  1562. * using `eachFunc`.
  1563. *
  1564. * @private
  1565. * @param {Array|Object} collection The collection to inspect.
  1566. * @param {Function} predicate The function invoked per iteration.
  1567. * @param {Function} eachFunc The function to iterate over `collection`.
  1568. * @returns {*} Returns the found element or its key, else `undefined`.
  1569. */
  1570. function baseFindKey(collection, predicate, eachFunc) {
  1571. var result;
  1572. eachFunc(collection, function(value, key, collection) {
  1573. if (predicate(value, key, collection)) {
  1574. result = key;
  1575. return false;
  1576. }
  1577. });
  1578. return result;
  1579. }
  1580. /**
  1581. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  1582. * support for iteratee shorthands.
  1583. *
  1584. * @private
  1585. * @param {Array} array The array to inspect.
  1586. * @param {Function} predicate The function invoked per iteration.
  1587. * @param {number} fromIndex The index to search from.
  1588. * @param {boolean} [fromRight] Specify iterating from right to left.
  1589. * @returns {number} Returns the index of the matched value, else `-1`.
  1590. */
  1591. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  1592. var length = array.length,
  1593. index = fromIndex + (fromRight ? 1 : -1);
  1594. while ((fromRight ? index-- : ++index < length)) {
  1595. if (predicate(array[index], index, array)) {
  1596. return index;
  1597. }
  1598. }
  1599. return -1;
  1600. }
  1601. /**
  1602. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  1603. *
  1604. * @private
  1605. * @param {Array} array The array to inspect.
  1606. * @param {*} value The value to search for.
  1607. * @param {number} fromIndex The index to search from.
  1608. * @returns {number} Returns the index of the matched value, else `-1`.
  1609. */
  1610. function baseIndexOf(array, value, fromIndex) {
  1611. return value === value
  1612. ? strictIndexOf(array, value, fromIndex)
  1613. : baseFindIndex(array, baseIsNaN, fromIndex);
  1614. }
  1615. /**
  1616. * This function is like `baseIndexOf` except that it accepts a comparator.
  1617. *
  1618. * @private
  1619. * @param {Array} array The array to inspect.
  1620. * @param {*} value The value to search for.
  1621. * @param {number} fromIndex The index to search from.
  1622. * @param {Function} comparator The comparator invoked per element.
  1623. * @returns {number} Returns the index of the matched value, else `-1`.
  1624. */
  1625. function baseIndexOfWith(array, value, fromIndex, comparator) {
  1626. var index = fromIndex - 1,
  1627. length = array.length;
  1628. while (++index < length) {
  1629. if (comparator(array[index], value)) {
  1630. return index;
  1631. }
  1632. }
  1633. return -1;
  1634. }
  1635. /**
  1636. * The base implementation of `_.isNaN` without support for number objects.
  1637. *
  1638. * @private
  1639. * @param {*} value The value to check.
  1640. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  1641. */
  1642. function baseIsNaN(value) {
  1643. return value !== value;
  1644. }
  1645. /**
  1646. * The base implementation of `_.mean` and `_.meanBy` without support for
  1647. * iteratee shorthands.
  1648. *
  1649. * @private
  1650. * @param {Array} array The array to iterate over.
  1651. * @param {Function} iteratee The function invoked per iteration.
  1652. * @returns {number} Returns the mean.
  1653. */
  1654. function baseMean(array, iteratee) {
  1655. var length = array == null ? 0 : array.length;
  1656. return length ? (baseSum(array, iteratee) / length) : NAN;
  1657. }
  1658. /**
  1659. * The base implementation of `_.property` without support for deep paths.
  1660. *
  1661. * @private
  1662. * @param {string} key The key of the property to get.
  1663. * @returns {Function} Returns the new accessor function.
  1664. */
  1665. function baseProperty(key) {
  1666. return function(object) {
  1667. return object == null ? undefined : object[key];
  1668. };
  1669. }
  1670. /**
  1671. * The base implementation of `_.propertyOf` without support for deep paths.
  1672. *
  1673. * @private
  1674. * @param {Object} object The object to query.
  1675. * @returns {Function} Returns the new accessor function.
  1676. */
  1677. function basePropertyOf(object) {
  1678. return function(key) {
  1679. return object == null ? undefined : object[key];
  1680. };
  1681. }
  1682. /**
  1683. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  1684. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  1685. *
  1686. * @private
  1687. * @param {Array|Object} collection The collection to iterate over.
  1688. * @param {Function} iteratee The function invoked per iteration.
  1689. * @param {*} accumulator The initial value.
  1690. * @param {boolean} initAccum Specify using the first or last element of
  1691. * `collection` as the initial value.
  1692. * @param {Function} eachFunc The function to iterate over `collection`.
  1693. * @returns {*} Returns the accumulated value.
  1694. */
  1695. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  1696. eachFunc(collection, function(value, index, collection) {
  1697. accumulator = initAccum
  1698. ? (initAccum = false, value)
  1699. : iteratee(accumulator, value, index, collection);
  1700. });
  1701. return accumulator;
  1702. }
  1703. /**
  1704. * The base implementation of `_.sortBy` which uses `comparer` to define the
  1705. * sort order of `array` and replaces criteria objects with their corresponding
  1706. * values.
  1707. *
  1708. * @private
  1709. * @param {Array} array The array to sort.
  1710. * @param {Function} comparer The function to define sort order.
  1711. * @returns {Array} Returns `array`.
  1712. */
  1713. function baseSortBy(array, comparer) {
  1714. var length = array.length;
  1715. array.sort(comparer);
  1716. while (length--) {
  1717. array[length] = array[length].value;
  1718. }
  1719. return array;
  1720. }
  1721. /**
  1722. * The base implementation of `_.sum` and `_.sumBy` without support for
  1723. * iteratee shorthands.
  1724. *
  1725. * @private
  1726. * @param {Array} array The array to iterate over.
  1727. * @param {Function} iteratee The function invoked per iteration.
  1728. * @returns {number} Returns the sum.
  1729. */
  1730. function baseSum(array, iteratee) {
  1731. var result,
  1732. index = -1,
  1733. length = array.length;
  1734. while (++index < length) {
  1735. var current = iteratee(array[index]);
  1736. if (current !== undefined) {
  1737. result = result === undefined ? current : (result + current);
  1738. }
  1739. }
  1740. return result;
  1741. }
  1742. /**
  1743. * The base implementation of `_.times` without support for iteratee shorthands
  1744. * or max array length checks.
  1745. *
  1746. * @private
  1747. * @param {number} n The number of times to invoke `iteratee`.
  1748. * @param {Function} iteratee The function invoked per iteration.
  1749. * @returns {Array} Returns the array of results.
  1750. */
  1751. function baseTimes(n, iteratee) {
  1752. var index = -1,
  1753. result = Array(n);
  1754. while (++index < n) {
  1755. result[index] = iteratee(index);
  1756. }
  1757. return result;
  1758. }
  1759. /**
  1760. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  1761. * of key-value pairs for `object` corresponding to the property names of `props`.
  1762. *
  1763. * @private
  1764. * @param {Object} object The object to query.
  1765. * @param {Array} props The property names to get values for.
  1766. * @returns {Object} Returns the key-value pairs.
  1767. */
  1768. function baseToPairs(object, props) {
  1769. return arrayMap(props, function(key) {
  1770. return [key, object[key]];
  1771. });
  1772. }
  1773. /**
  1774. * The base implementation of `_.unary` without support for storing metadata.
  1775. *
  1776. * @private
  1777. * @param {Function} func The function to cap arguments for.
  1778. * @returns {Function} Returns the new capped function.
  1779. */
  1780. function baseUnary(func) {
  1781. return function(value) {
  1782. return func(value);
  1783. };
  1784. }
  1785. /**
  1786. * The base implementation of `_.values` and `_.valuesIn` which creates an
  1787. * array of `object` property values corresponding to the property names
  1788. * of `props`.
  1789. *
  1790. * @private
  1791. * @param {Object} object The object to query.
  1792. * @param {Array} props The property names to get values for.
  1793. * @returns {Object} Returns the array of property values.
  1794. */
  1795. function baseValues(object, props) {
  1796. return arrayMap(props, function(key) {
  1797. return object[key];
  1798. });
  1799. }
  1800. /**
  1801. * Checks if a `cache` value for `key` exists.
  1802. *
  1803. * @private
  1804. * @param {Object} cache The cache to query.
  1805. * @param {string} key The key of the entry to check.
  1806. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  1807. */
  1808. function cacheHas(cache, key) {
  1809. return cache.has(key);
  1810. }
  1811. /**
  1812. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  1813. * that is not found in the character symbols.
  1814. *
  1815. * @private
  1816. * @param {Array} strSymbols The string symbols to inspect.
  1817. * @param {Array} chrSymbols The character symbols to find.
  1818. * @returns {number} Returns the index of the first unmatched string symbol.
  1819. */
  1820. function charsStartIndex(strSymbols, chrSymbols) {
  1821. var index = -1,
  1822. length = strSymbols.length;
  1823. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  1824. return index;
  1825. }
  1826. /**
  1827. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  1828. * that is not found in the character symbols.
  1829. *
  1830. * @private
  1831. * @param {Array} strSymbols The string symbols to inspect.
  1832. * @param {Array} chrSymbols The character symbols to find.
  1833. * @returns {number} Returns the index of the last unmatched string symbol.
  1834. */
  1835. function charsEndIndex(strSymbols, chrSymbols) {
  1836. var index = strSymbols.length;
  1837. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  1838. return index;
  1839. }
  1840. /**
  1841. * Gets the number of `placeholder` occurrences in `array`.
  1842. *
  1843. * @private
  1844. * @param {Array} array The array to inspect.
  1845. * @param {*} placeholder The placeholder to search for.
  1846. * @returns {number} Returns the placeholder count.
  1847. */
  1848. function countHolders(array, placeholder) {
  1849. var length = array.length,
  1850. result = 0;
  1851. while (length--) {
  1852. if (array[length] === placeholder) {
  1853. ++result;
  1854. }
  1855. }
  1856. return result;
  1857. }
  1858. /**
  1859. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  1860. * letters to basic Latin letters.
  1861. *
  1862. * @private
  1863. * @param {string} letter The matched letter to deburr.
  1864. * @returns {string} Returns the deburred letter.
  1865. */
  1866. var deburrLetter = basePropertyOf(deburredLetters);
  1867. /**
  1868. * Used by `_.escape` to convert characters to HTML entities.
  1869. *
  1870. * @private
  1871. * @param {string} chr The matched character to escape.
  1872. * @returns {string} Returns the escaped character.
  1873. */
  1874. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  1875. /**
  1876. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  1877. *
  1878. * @private
  1879. * @param {string} chr The matched character to escape.
  1880. * @returns {string} Returns the escaped character.
  1881. */
  1882. function escapeStringChar(chr) {
  1883. return '\\' + stringEscapes[chr];
  1884. }
  1885. /**
  1886. * Gets the value at `key` of `object`.
  1887. *
  1888. * @private
  1889. * @param {Object} [object] The object to query.
  1890. * @param {string} key The key of the property to get.
  1891. * @returns {*} Returns the property value.
  1892. */
  1893. function getValue(object, key) {
  1894. return object == null ? undefined : object[key];
  1895. }
  1896. /**
  1897. * Checks if `string` contains Unicode symbols.
  1898. *
  1899. * @private
  1900. * @param {string} string The string to inspect.
  1901. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  1902. */
  1903. function hasUnicode(string) {
  1904. return reHasUnicode.test(string);
  1905. }
  1906. /**
  1907. * Checks if `string` contains a word composed of Unicode symbols.
  1908. *
  1909. * @private
  1910. * @param {string} string The string to inspect.
  1911. * @returns {boolean} Returns `true` if a word is found, else `false`.
  1912. */
  1913. function hasUnicodeWord(string) {
  1914. return reHasUnicodeWord.test(string);
  1915. }
  1916. /**
  1917. * Converts `iterator` to an array.
  1918. *
  1919. * @private
  1920. * @param {Object} iterator The iterator to convert.
  1921. * @returns {Array} Returns the converted array.
  1922. */
  1923. function iteratorToArray(iterator) {
  1924. var data,
  1925. result = [];
  1926. while (!(data = iterator.next()).done) {
  1927. result.push(data.value);
  1928. }
  1929. return result;
  1930. }
  1931. /**
  1932. * Converts `map` to its key-value pairs.
  1933. *
  1934. * @private
  1935. * @param {Object} map The map to convert.
  1936. * @returns {Array} Returns the key-value pairs.
  1937. */
  1938. function mapToArray(map) {
  1939. var index = -1,
  1940. result = Array(map.size);
  1941. map.forEach(function(value, key) {
  1942. result[++index] = [key, value];
  1943. });
  1944. return result;
  1945. }
  1946. /**
  1947. * Creates a unary function that invokes `func` with its argument transformed.
  1948. *
  1949. * @private
  1950. * @param {Function} func The function to wrap.
  1951. * @param {Function} transform The argument transform.
  1952. * @returns {Function} Returns the new function.
  1953. */
  1954. function overArg(func, transform) {
  1955. return function(arg) {
  1956. return func(transform(arg));
  1957. };
  1958. }
  1959. /**
  1960. * Replaces all `placeholder` elements in `array` with an internal placeholder
  1961. * and returns an array of their indexes.
  1962. *
  1963. * @private
  1964. * @param {Array} array The array to modify.
  1965. * @param {*} placeholder The placeholder to replace.
  1966. * @returns {Array} Returns the new array of placeholder indexes.
  1967. */
  1968. function replaceHolders(array, placeholder) {
  1969. var index = -1,
  1970. length = array.length,
  1971. resIndex = 0,
  1972. result = [];
  1973. while (++index < length) {
  1974. var value = array[index];
  1975. if (value === placeholder || value === PLACEHOLDER) {
  1976. array[index] = PLACEHOLDER;
  1977. result[resIndex++] = index;
  1978. }
  1979. }
  1980. return result;
  1981. }
  1982. /**
  1983. * Gets the value at `key`, unless `key` is "__proto__".
  1984. *
  1985. * @private
  1986. * @param {Object} object The object to query.
  1987. * @param {string} key The key of the property to get.
  1988. * @returns {*} Returns the property value.
  1989. */
  1990. function safeGet(object, key) {
  1991. return key == '__proto__'
  1992. ? undefined
  1993. : object[key];
  1994. }
  1995. /**
  1996. * Converts `set` to an array of its values.
  1997. *
  1998. * @private
  1999. * @param {Object} set The set to convert.
  2000. * @returns {Array} Returns the values.
  2001. */
  2002. function setToArray(set) {
  2003. var index = -1,
  2004. result = Array(set.size);
  2005. set.forEach(function(value) {
  2006. result[++index] = value;
  2007. });
  2008. return result;
  2009. }
  2010. /**
  2011. * Converts `set` to its value-value pairs.
  2012. *
  2013. * @private
  2014. * @param {Object} set The set to convert.
  2015. * @returns {Array} Returns the value-value pairs.
  2016. */
  2017. function setToPairs(set) {
  2018. var index = -1,
  2019. result = Array(set.size);
  2020. set.forEach(function(value) {
  2021. result[++index] = [value, value];
  2022. });
  2023. return result;
  2024. }
  2025. /**
  2026. * A specialized version of `_.indexOf` which performs strict equality
  2027. * comparisons of values, i.e. `===`.
  2028. *
  2029. * @private
  2030. * @param {Array} array The array to inspect.
  2031. * @param {*} value The value to search for.
  2032. * @param {number} fromIndex The index to search from.
  2033. * @returns {number} Returns the index of the matched value, else `-1`.
  2034. */
  2035. function strictIndexOf(array, value, fromIndex) {
  2036. var index = fromIndex - 1,
  2037. length = array.length;
  2038. while (++index < length) {
  2039. if (array[index] === value) {
  2040. return index;
  2041. }
  2042. }
  2043. return -1;
  2044. }
  2045. /**
  2046. * A specialized version of `_.lastIndexOf` which performs strict equality
  2047. * comparisons of values, i.e. `===`.
  2048. *
  2049. * @private
  2050. * @param {Array} array The array to inspect.
  2051. * @param {*} value The value to search for.
  2052. * @param {number} fromIndex The index to search from.
  2053. * @returns {number} Returns the index of the matched value, else `-1`.
  2054. */
  2055. function strictLastIndexOf(array, value, fromIndex) {
  2056. var index = fromIndex + 1;
  2057. while (index--) {
  2058. if (array[index] === value) {
  2059. return index;
  2060. }
  2061. }
  2062. return index;
  2063. }
  2064. /**
  2065. * Gets the number of symbols in `string`.
  2066. *
  2067. * @private
  2068. * @param {string} string The string to inspect.
  2069. * @returns {number} Returns the string size.
  2070. */
  2071. function stringSize(string) {
  2072. return hasUnicode(string)
  2073. ? unicodeSize(string)
  2074. : asciiSize(string);
  2075. }
  2076. /**
  2077. * Converts `string` to an array.
  2078. *
  2079. * @private
  2080. * @param {string} string The string to convert.
  2081. * @returns {Array} Returns the converted array.
  2082. */
  2083. function stringToArray(string) {
  2084. return hasUnicode(string)
  2085. ? unicodeToArray(string)
  2086. : asciiToArray(string);
  2087. }
  2088. /**
  2089. * Used by `_.unescape` to convert HTML entities to characters.
  2090. *
  2091. * @private
  2092. * @param {string} chr The matched character to unescape.
  2093. * @returns {string} Returns the unescaped character.
  2094. */
  2095. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  2096. /**
  2097. * Gets the size of a Unicode `string`.
  2098. *
  2099. * @private
  2100. * @param {string} string The string inspect.
  2101. * @returns {number} Returns the string size.
  2102. */
  2103. function unicodeSize(string) {
  2104. var result = reUnicode.lastIndex = 0;
  2105. while (reUnicode.test(string)) {
  2106. ++result;
  2107. }
  2108. return result;
  2109. }
  2110. /**
  2111. * Converts a Unicode `string` to an array.
  2112. *
  2113. * @private
  2114. * @param {string} string The string to convert.
  2115. * @returns {Array} Returns the converted array.
  2116. */
  2117. function unicodeToArray(string) {
  2118. return string.match(reUnicode) || [];
  2119. }
  2120. /**
  2121. * Splits a Unicode `string` into an array of its words.
  2122. *
  2123. * @private
  2124. * @param {string} The string to inspect.
  2125. * @returns {Array} Returns the words of `string`.
  2126. */
  2127. function unicodeWords(string) {
  2128. return string.match(reUnicodeWord) || [];
  2129. }
  2130. /*--------------------------------------------------------------------------*/
  2131. /**
  2132. * Create a new pristine `lodash` function using the `context` object.
  2133. *
  2134. * @static
  2135. * @memberOf _
  2136. * @since 1.1.0
  2137. * @category Util
  2138. * @param {Object} [context=root] The context object.
  2139. * @returns {Function} Returns a new `lodash` function.
  2140. * @example
  2141. *
  2142. * _.mixin({ 'foo': _.constant('foo') });
  2143. *
  2144. * var lodash = _.runInContext();
  2145. * lodash.mixin({ 'bar': lodash.constant('bar') });
  2146. *
  2147. * _.isFunction(_.foo);
  2148. * // => true
  2149. * _.isFunction(_.bar);
  2150. * // => false
  2151. *
  2152. * lodash.isFunction(lodash.foo);
  2153. * // => false
  2154. * lodash.isFunction(lodash.bar);
  2155. * // => true
  2156. *
  2157. * // Create a suped-up `defer` in Node.js.
  2158. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  2159. */
  2160. var runInContext = (function runInContext(context) {
  2161. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  2162. /** Built-in constructor references. */
  2163. var Array = context.Array,
  2164. Date = context.Date,
  2165. Error = context.Error,
  2166. Function = context.Function,
  2167. Math = context.Math,
  2168. Object = context.Object,
  2169. RegExp = context.RegExp,
  2170. String = context.String,
  2171. TypeError = context.TypeError;
  2172. /** Used for built-in method references. */
  2173. var arrayProto = Array.prototype,
  2174. funcProto = Function.prototype,
  2175. objectProto = Object.prototype;
  2176. /** Used to detect overreaching core-js shims. */
  2177. var coreJsData = context['__core-js_shared__'];
  2178. /** Used to resolve the decompiled source of functions. */
  2179. var funcToString = funcProto.toString;
  2180. /** Used to check objects for own properties. */
  2181. var hasOwnProperty = objectProto.hasOwnProperty;
  2182. /** Used to generate unique IDs. */
  2183. var idCounter = 0;
  2184. /** Used to detect methods masquerading as native. */
  2185. var maskSrcKey = (function() {
  2186. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  2187. return uid ? ('Symbol(src)_1.' + uid) : '';
  2188. }());
  2189. /**
  2190. * Used to resolve the
  2191. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  2192. * of values.
  2193. */
  2194. var nativeObjectToString = objectProto.toString;
  2195. /** Used to infer the `Object` constructor. */
  2196. var objectCtorString = funcToString.call(Object);
  2197. /** Used to restore the original `_` reference in `_.noConflict`. */
  2198. var oldDash = root._;
  2199. /** Used to detect if a method is native. */
  2200. var reIsNative = RegExp('^' +
  2201. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  2202. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  2203. );
  2204. /** Built-in value references. */
  2205. var Buffer = moduleExports ? context.Buffer : undefined,
  2206. Symbol = context.Symbol,
  2207. Uint8Array = context.Uint8Array,
  2208. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  2209. getPrototype = overArg(Object.getPrototypeOf, Object),
  2210. objectCreate = Object.create,
  2211. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  2212. splice = arrayProto.splice,
  2213. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  2214. symIterator = Symbol ? Symbol.iterator : undefined,
  2215. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  2216. var defineProperty = (function() {
  2217. try {
  2218. var func = getNative(Object, 'defineProperty');
  2219. func({}, '', {});
  2220. return func;
  2221. } catch (e) {}
  2222. }());
  2223. /** Mocked built-ins. */
  2224. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  2225. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  2226. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  2227. /* Built-in method references for those with the same name as other `lodash` methods. */
  2228. var nativeCeil = Math.ceil,
  2229. nativeFloor = Math.floor,
  2230. nativeGetSymbols = Object.getOwnPropertySymbols,
  2231. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  2232. nativeIsFinite = context.isFinite,
  2233. nativeJoin = arrayProto.join,
  2234. nativeKeys = overArg(Object.keys, Object),
  2235. nativeMax = Math.max,
  2236. nativeMin = Math.min,
  2237. nativeNow = Date.now,
  2238. nativeParseInt = context.parseInt,
  2239. nativeRandom = Math.random,
  2240. nativeReverse = arrayProto.reverse;
  2241. /* Built-in method references that are verified to be native. */
  2242. var DataView = getNative(context, 'DataView'),
  2243. Map = getNative(context, 'Map'),
  2244. Promise = getNative(context, 'Promise'),
  2245. Set = getNative(context, 'Set'),
  2246. WeakMap = getNative(context, 'WeakMap'),
  2247. nativeCreate = getNative(Object, 'create');
  2248. /** Used to store function metadata. */
  2249. var metaMap = WeakMap && new WeakMap;
  2250. /** Used to lookup unminified function names. */
  2251. var realNames = {};
  2252. /** Used to detect maps, sets, and weakmaps. */
  2253. var dataViewCtorString = toSource(DataView),
  2254. mapCtorString = toSource(Map),
  2255. promiseCtorString = toSource(Promise),
  2256. setCtorString = toSource(Set),
  2257. weakMapCtorString = toSource(WeakMap);
  2258. /** Used to convert symbols to primitives and strings. */
  2259. var symbolProto = Symbol ? Symbol.prototype : undefined,
  2260. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  2261. symbolToString = symbolProto ? symbolProto.toString : undefined;
  2262. /*------------------------------------------------------------------------*/
  2263. /**
  2264. * Creates a `lodash` object which wraps `value` to enable implicit method
  2265. * chain sequences. Methods that operate on and return arrays, collections,
  2266. * and functions can be chained together. Methods that retrieve a single value
  2267. * or may return a primitive value will automatically end the chain sequence
  2268. * and return the unwrapped value. Otherwise, the value must be unwrapped
  2269. * with `_#value`.
  2270. *
  2271. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  2272. * enabled using `_.chain`.
  2273. *
  2274. * The execution of chained methods is lazy, that is, it's deferred until
  2275. * `_#value` is implicitly or explicitly called.
  2276. *
  2277. * Lazy evaluation allows several methods to support shortcut fusion.
  2278. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  2279. * the creation of intermediate arrays and can greatly reduce the number of
  2280. * iteratee executions. Sections of a chain sequence qualify for shortcut
  2281. * fusion if the section is applied to an array and iteratees accept only
  2282. * one argument. The heuristic for whether a section qualifies for shortcut
  2283. * fusion is subject to change.
  2284. *
  2285. * Chaining is supported in custom builds as long as the `_#value` method is
  2286. * directly or indirectly included in the build.
  2287. *
  2288. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  2289. *
  2290. * The wrapper `Array` methods are:
  2291. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  2292. *
  2293. * The wrapper `String` methods are:
  2294. * `replace` and `split`
  2295. *
  2296. * The wrapper methods that support shortcut fusion are:
  2297. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  2298. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  2299. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  2300. *
  2301. * The chainable wrapper methods are:
  2302. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  2303. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  2304. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  2305. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  2306. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  2307. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  2308. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  2309. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  2310. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  2311. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  2312. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  2313. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  2314. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  2315. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  2316. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  2317. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  2318. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  2319. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  2320. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  2321. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  2322. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  2323. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  2324. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  2325. * `zipObject`, `zipObjectDeep`, and `zipWith`
  2326. *
  2327. * The wrapper methods that are **not** chainable by default are:
  2328. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  2329. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  2330. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  2331. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  2332. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  2333. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  2334. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  2335. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  2336. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  2337. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  2338. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  2339. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  2340. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  2341. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  2342. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  2343. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  2344. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  2345. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  2346. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  2347. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  2348. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  2349. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  2350. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  2351. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  2352. * `upperFirst`, `value`, and `words`
  2353. *
  2354. * @name _
  2355. * @constructor
  2356. * @category Seq
  2357. * @param {*} value The value to wrap in a `lodash` instance.
  2358. * @returns {Object} Returns the new `lodash` wrapper instance.
  2359. * @example
  2360. *
  2361. * function square(n) {
  2362. * return n * n;
  2363. * }
  2364. *
  2365. * var wrapped = _([1, 2, 3]);
  2366. *
  2367. * // Returns an unwrapped value.
  2368. * wrapped.reduce(_.add);
  2369. * // => 6
  2370. *
  2371. * // Returns a wrapped value.
  2372. * var squares = wrapped.map(square);
  2373. *
  2374. * _.isArray(squares);
  2375. * // => false
  2376. *
  2377. * _.isArray(squares.value());
  2378. * // => true
  2379. */
  2380. function lodash(value) {
  2381. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  2382. if (value instanceof LodashWrapper) {
  2383. return value;
  2384. }
  2385. if (hasOwnProperty.call(value, '__wrapped__')) {
  2386. return wrapperClone(value);
  2387. }
  2388. }
  2389. return new LodashWrapper(value);
  2390. }
  2391. /**
  2392. * The base implementation of `_.create` without support for assigning
  2393. * properties to the created object.
  2394. *
  2395. * @private
  2396. * @param {Object} proto The object to inherit from.
  2397. * @returns {Object} Returns the new object.
  2398. */
  2399. var baseCreate = (function() {
  2400. function object() {}
  2401. return function(proto) {
  2402. if (!isObject(proto)) {
  2403. return {};
  2404. }
  2405. if (objectCreate) {
  2406. return objectCreate(proto);
  2407. }
  2408. object.prototype = proto;
  2409. var result = new object;
  2410. object.prototype = undefined;
  2411. return result;
  2412. };
  2413. }());
  2414. /**
  2415. * The function whose prototype chain sequence wrappers inherit from.
  2416. *
  2417. * @private
  2418. */
  2419. function baseLodash() {
  2420. // No operation performed.
  2421. }
  2422. /**
  2423. * The base constructor for creating `lodash` wrapper objects.
  2424. *
  2425. * @private
  2426. * @param {*} value The value to wrap.
  2427. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  2428. */
  2429. function LodashWrapper(value, chainAll) {
  2430. this.__wrapped__ = value;
  2431. this.__actions__ = [];
  2432. this.__chain__ = !!chainAll;
  2433. this.__index__ = 0;
  2434. this.__values__ = undefined;
  2435. }
  2436. /**
  2437. * By default, the template delimiters used by lodash are like those in
  2438. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  2439. * following template settings to use alternative delimiters.
  2440. *
  2441. * @static
  2442. * @memberOf _
  2443. * @type {Object}
  2444. */
  2445. lodash.templateSettings = {
  2446. /**
  2447. * Used to detect `data` property values to be HTML-escaped.
  2448. *
  2449. * @memberOf _.templateSettings
  2450. * @type {RegExp}
  2451. */
  2452. 'escape': reEscape,
  2453. /**
  2454. * Used to detect code to be evaluated.
  2455. *
  2456. * @memberOf _.templateSettings
  2457. * @type {RegExp}
  2458. */
  2459. 'evaluate': reEvaluate,
  2460. /**
  2461. * Used to detect `data` property values to inject.
  2462. *
  2463. * @memberOf _.templateSettings
  2464. * @type {RegExp}
  2465. */
  2466. 'interpolate': reInterpolate,
  2467. /**
  2468. * Used to reference the data object in the template text.
  2469. *
  2470. * @memberOf _.templateSettings
  2471. * @type {string}
  2472. */
  2473. 'variable': '',
  2474. /**
  2475. * Used to import variables into the compiled template.
  2476. *
  2477. * @memberOf _.templateSettings
  2478. * @type {Object}
  2479. */
  2480. 'imports': {
  2481. /**
  2482. * A reference to the `lodash` function.
  2483. *
  2484. * @memberOf _.templateSettings.imports
  2485. * @type {Function}
  2486. */
  2487. '_': lodash
  2488. }
  2489. };
  2490. // Ensure wrappers are instances of `baseLodash`.
  2491. lodash.prototype = baseLodash.prototype;
  2492. lodash.prototype.constructor = lodash;
  2493. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  2494. LodashWrapper.prototype.constructor = LodashWrapper;
  2495. /*------------------------------------------------------------------------*/
  2496. /**
  2497. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  2498. *
  2499. * @private
  2500. * @constructor
  2501. * @param {*} value The value to wrap.
  2502. */
  2503. function LazyWrapper(value) {
  2504. this.__wrapped__ = value;
  2505. this.__actions__ = [];
  2506. this.__dir__ = 1;
  2507. this.__filtered__ = false;
  2508. this.__iteratees__ = [];
  2509. this.__takeCount__ = MAX_ARRAY_LENGTH;
  2510. this.__views__ = [];
  2511. }
  2512. /**
  2513. * Creates a clone of the lazy wrapper object.
  2514. *
  2515. * @private
  2516. * @name clone
  2517. * @memberOf LazyWrapper
  2518. * @returns {Object} Returns the cloned `LazyWrapper` object.
  2519. */
  2520. function lazyClone() {
  2521. var result = new LazyWrapper(this.__wrapped__);
  2522. result.__actions__ = copyArray(this.__actions__);
  2523. result.__dir__ = this.__dir__;
  2524. result.__filtered__ = this.__filtered__;
  2525. result.__iteratees__ = copyArray(this.__iteratees__);
  2526. result.__takeCount__ = this.__takeCount__;
  2527. result.__views__ = copyArray(this.__views__);
  2528. return result;
  2529. }
  2530. /**
  2531. * Reverses the direction of lazy iteration.
  2532. *
  2533. * @private
  2534. * @name reverse
  2535. * @memberOf LazyWrapper
  2536. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  2537. */
  2538. function lazyReverse() {
  2539. if (this.__filtered__) {
  2540. var result = new LazyWrapper(this);
  2541. result.__dir__ = -1;
  2542. result.__filtered__ = true;
  2543. } else {
  2544. result = this.clone();
  2545. result.__dir__ *= -1;
  2546. }
  2547. return result;
  2548. }
  2549. /**
  2550. * Extracts the unwrapped value from its lazy wrapper.
  2551. *
  2552. * @private
  2553. * @name value
  2554. * @memberOf LazyWrapper
  2555. * @returns {*} Returns the unwrapped value.
  2556. */
  2557. function lazyValue() {
  2558. var array = this.__wrapped__.value(),
  2559. dir = this.__dir__,
  2560. isArr = isArray(array),
  2561. isRight = dir < 0,
  2562. arrLength = isArr ? array.length : 0,
  2563. view = getView(0, arrLength, this.__views__),
  2564. start = view.start,
  2565. end = view.end,
  2566. length = end - start,
  2567. index = isRight ? end : (start - 1),
  2568. iteratees = this.__iteratees__,
  2569. iterLength = iteratees.length,
  2570. resIndex = 0,
  2571. takeCount = nativeMin(length, this.__takeCount__);
  2572. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  2573. return baseWrapperValue(array, this.__actions__);
  2574. }
  2575. var result = [];
  2576. outer:
  2577. while (length-- && resIndex < takeCount) {
  2578. index += dir;
  2579. var iterIndex = -1,
  2580. value = array[index];
  2581. while (++iterIndex < iterLength) {
  2582. var data = iteratees[iterIndex],
  2583. iteratee = data.iteratee,
  2584. type = data.type,
  2585. computed = iteratee(value);
  2586. if (type == LAZY_MAP_FLAG) {
  2587. value = computed;
  2588. } else if (!computed) {
  2589. if (type == LAZY_FILTER_FLAG) {
  2590. continue outer;
  2591. } else {
  2592. break outer;
  2593. }
  2594. }
  2595. }
  2596. result[resIndex++] = value;
  2597. }
  2598. return result;
  2599. }
  2600. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  2601. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  2602. LazyWrapper.prototype.constructor = LazyWrapper;
  2603. /*------------------------------------------------------------------------*/
  2604. /**
  2605. * Creates a hash object.
  2606. *
  2607. * @private
  2608. * @constructor
  2609. * @param {Array} [entries] The key-value pairs to cache.
  2610. */
  2611. function Hash(entries) {
  2612. var index = -1,
  2613. length = entries == null ? 0 : entries.length;
  2614. this.clear();
  2615. while (++index < length) {
  2616. var entry = entries[index];
  2617. this.set(entry[0], entry[1]);
  2618. }
  2619. }
  2620. /**
  2621. * Removes all key-value entries from the hash.
  2622. *
  2623. * @private
  2624. * @name clear
  2625. * @memberOf Hash
  2626. */
  2627. function hashClear() {
  2628. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  2629. this.size = 0;
  2630. }
  2631. /**
  2632. * Removes `key` and its value from the hash.
  2633. *
  2634. * @private
  2635. * @name delete
  2636. * @memberOf Hash
  2637. * @param {Object} hash The hash to modify.
  2638. * @param {string} key The key of the value to remove.
  2639. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2640. */
  2641. function hashDelete(key) {
  2642. var result = this.has(key) && delete this.__data__[key];
  2643. this.size -= result ? 1 : 0;
  2644. return result;
  2645. }
  2646. /**
  2647. * Gets the hash value for `key`.
  2648. *
  2649. * @private
  2650. * @name get
  2651. * @memberOf Hash
  2652. * @param {string} key The key of the value to get.
  2653. * @returns {*} Returns the entry value.
  2654. */
  2655. function hashGet(key) {
  2656. var data = this.__data__;
  2657. if (nativeCreate) {
  2658. var result = data[key];
  2659. return result === HASH_UNDEFINED ? undefined : result;
  2660. }
  2661. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  2662. }
  2663. /**
  2664. * Checks if a hash value for `key` exists.
  2665. *
  2666. * @private
  2667. * @name has
  2668. * @memberOf Hash
  2669. * @param {string} key The key of the entry to check.
  2670. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2671. */
  2672. function hashHas(key) {
  2673. var data = this.__data__;
  2674. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  2675. }
  2676. /**
  2677. * Sets the hash `key` to `value`.
  2678. *
  2679. * @private
  2680. * @name set
  2681. * @memberOf Hash
  2682. * @param {string} key The key of the value to set.
  2683. * @param {*} value The value to set.
  2684. * @returns {Object} Returns the hash instance.
  2685. */
  2686. function hashSet(key, value) {
  2687. var data = this.__data__;
  2688. this.size += this.has(key) ? 0 : 1;
  2689. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  2690. return this;
  2691. }
  2692. // Add methods to `Hash`.
  2693. Hash.prototype.clear = hashClear;
  2694. Hash.prototype['delete'] = hashDelete;
  2695. Hash.prototype.get = hashGet;
  2696. Hash.prototype.has = hashHas;
  2697. Hash.prototype.set = hashSet;
  2698. /*------------------------------------------------------------------------*/
  2699. /**
  2700. * Creates an list cache object.
  2701. *
  2702. * @private
  2703. * @constructor
  2704. * @param {Array} [entries] The key-value pairs to cache.
  2705. */
  2706. function ListCache(entries) {
  2707. var index = -1,
  2708. length = entries == null ? 0 : entries.length;
  2709. this.clear();
  2710. while (++index < length) {
  2711. var entry = entries[index];
  2712. this.set(entry[0], entry[1]);
  2713. }
  2714. }
  2715. /**
  2716. * Removes all key-value entries from the list cache.
  2717. *
  2718. * @private
  2719. * @name clear
  2720. * @memberOf ListCache
  2721. */
  2722. function listCacheClear() {
  2723. this.__data__ = [];
  2724. this.size = 0;
  2725. }
  2726. /**
  2727. * Removes `key` and its value from the list cache.
  2728. *
  2729. * @private
  2730. * @name delete
  2731. * @memberOf ListCache
  2732. * @param {string} key The key of the value to remove.
  2733. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2734. */
  2735. function listCacheDelete(key) {
  2736. var data = this.__data__,
  2737. index = assocIndexOf(data, key);
  2738. if (index < 0) {
  2739. return false;
  2740. }
  2741. var lastIndex = data.length - 1;
  2742. if (index == lastIndex) {
  2743. data.pop();
  2744. } else {
  2745. splice.call(data, index, 1);
  2746. }
  2747. --this.size;
  2748. return true;
  2749. }
  2750. /**
  2751. * Gets the list cache value for `key`.
  2752. *
  2753. * @private
  2754. * @name get
  2755. * @memberOf ListCache
  2756. * @param {string} key The key of the value to get.
  2757. * @returns {*} Returns the entry value.
  2758. */
  2759. function listCacheGet(key) {
  2760. var data = this.__data__,
  2761. index = assocIndexOf(data, key);
  2762. return index < 0 ? undefined : data[index][1];
  2763. }
  2764. /**
  2765. * Checks if a list cache value for `key` exists.
  2766. *
  2767. * @private
  2768. * @name has
  2769. * @memberOf ListCache
  2770. * @param {string} key The key of the entry to check.
  2771. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2772. */
  2773. function listCacheHas(key) {
  2774. return assocIndexOf(this.__data__, key) > -1;
  2775. }
  2776. /**
  2777. * Sets the list cache `key` to `value`.
  2778. *
  2779. * @private
  2780. * @name set
  2781. * @memberOf ListCache
  2782. * @param {string} key The key of the value to set.
  2783. * @param {*} value The value to set.
  2784. * @returns {Object} Returns the list cache instance.
  2785. */
  2786. function listCacheSet(key, value) {
  2787. var data = this.__data__,
  2788. index = assocIndexOf(data, key);
  2789. if (index < 0) {
  2790. ++this.size;
  2791. data.push([key, value]);
  2792. } else {
  2793. data[index][1] = value;
  2794. }
  2795. return this;
  2796. }
  2797. // Add methods to `ListCache`.
  2798. ListCache.prototype.clear = listCacheClear;
  2799. ListCache.prototype['delete'] = listCacheDelete;
  2800. ListCache.prototype.get = listCacheGet;
  2801. ListCache.prototype.has = listCacheHas;
  2802. ListCache.prototype.set = listCacheSet;
  2803. /*------------------------------------------------------------------------*/
  2804. /**
  2805. * Creates a map cache object to store key-value pairs.
  2806. *
  2807. * @private
  2808. * @constructor
  2809. * @param {Array} [entries] The key-value pairs to cache.
  2810. */
  2811. function MapCache(entries) {
  2812. var index = -1,
  2813. length = entries == null ? 0 : entries.length;
  2814. this.clear();
  2815. while (++index < length) {
  2816. var entry = entries[index];
  2817. this.set(entry[0], entry[1]);
  2818. }
  2819. }
  2820. /**
  2821. * Removes all key-value entries from the map.
  2822. *
  2823. * @private
  2824. * @name clear
  2825. * @memberOf MapCache
  2826. */
  2827. function mapCacheClear() {
  2828. this.size = 0;
  2829. this.__data__ = {
  2830. 'hash': new Hash,
  2831. 'map': new (Map || ListCache),
  2832. 'string': new Hash
  2833. };
  2834. }
  2835. /**
  2836. * Removes `key` and its value from the map.
  2837. *
  2838. * @private
  2839. * @name delete
  2840. * @memberOf MapCache
  2841. * @param {string} key The key of the value to remove.
  2842. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2843. */
  2844. function mapCacheDelete(key) {
  2845. var result = getMapData(this, key)['delete'](key);
  2846. this.size -= result ? 1 : 0;
  2847. return result;
  2848. }
  2849. /**
  2850. * Gets the map value for `key`.
  2851. *
  2852. * @private
  2853. * @name get
  2854. * @memberOf MapCache
  2855. * @param {string} key The key of the value to get.
  2856. * @returns {*} Returns the entry value.
  2857. */
  2858. function mapCacheGet(key) {
  2859. return getMapData(this, key).get(key);
  2860. }
  2861. /**
  2862. * Checks if a map value for `key` exists.
  2863. *
  2864. * @private
  2865. * @name has
  2866. * @memberOf MapCache
  2867. * @param {string} key The key of the entry to check.
  2868. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2869. */
  2870. function mapCacheHas(key) {
  2871. return getMapData(this, key).has(key);
  2872. }
  2873. /**
  2874. * Sets the map `key` to `value`.
  2875. *
  2876. * @private
  2877. * @name set
  2878. * @memberOf MapCache
  2879. * @param {string} key The key of the value to set.
  2880. * @param {*} value The value to set.
  2881. * @returns {Object} Returns the map cache instance.
  2882. */
  2883. function mapCacheSet(key, value) {
  2884. var data = getMapData(this, key),
  2885. size = data.size;
  2886. data.set(key, value);
  2887. this.size += data.size == size ? 0 : 1;
  2888. return this;
  2889. }
  2890. // Add methods to `MapCache`.
  2891. MapCache.prototype.clear = mapCacheClear;
  2892. MapCache.prototype['delete'] = mapCacheDelete;
  2893. MapCache.prototype.get = mapCacheGet;
  2894. MapCache.prototype.has = mapCacheHas;
  2895. MapCache.prototype.set = mapCacheSet;
  2896. /*------------------------------------------------------------------------*/
  2897. /**
  2898. *
  2899. * Creates an array cache object to store unique values.
  2900. *
  2901. * @private
  2902. * @constructor
  2903. * @param {Array} [values] The values to cache.
  2904. */
  2905. function SetCache(values) {
  2906. var index = -1,
  2907. length = values == null ? 0 : values.length;
  2908. this.__data__ = new MapCache;
  2909. while (++index < length) {
  2910. this.add(values[index]);
  2911. }
  2912. }
  2913. /**
  2914. * Adds `value` to the array cache.
  2915. *
  2916. * @private
  2917. * @name add
  2918. * @memberOf SetCache
  2919. * @alias push
  2920. * @param {*} value The value to cache.
  2921. * @returns {Object} Returns the cache instance.
  2922. */
  2923. function setCacheAdd(value) {
  2924. this.__data__.set(value, HASH_UNDEFINED);
  2925. return this;
  2926. }
  2927. /**
  2928. * Checks if `value` is in the array cache.
  2929. *
  2930. * @private
  2931. * @name has
  2932. * @memberOf SetCache
  2933. * @param {*} value The value to search for.
  2934. * @returns {number} Returns `true` if `value` is found, else `false`.
  2935. */
  2936. function setCacheHas(value) {
  2937. return this.__data__.has(value);
  2938. }
  2939. // Add methods to `SetCache`.
  2940. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  2941. SetCache.prototype.has = setCacheHas;
  2942. /*------------------------------------------------------------------------*/
  2943. /**
  2944. * Creates a stack cache object to store key-value pairs.
  2945. *
  2946. * @private
  2947. * @constructor
  2948. * @param {Array} [entries] The key-value pairs to cache.
  2949. */
  2950. function Stack(entries) {
  2951. var data = this.__data__ = new ListCache(entries);
  2952. this.size = data.size;
  2953. }
  2954. /**
  2955. * Removes all key-value entries from the stack.
  2956. *
  2957. * @private
  2958. * @name clear
  2959. * @memberOf Stack
  2960. */
  2961. function stackClear() {
  2962. this.__data__ = new ListCache;
  2963. this.size = 0;
  2964. }
  2965. /**
  2966. * Removes `key` and its value from the stack.
  2967. *
  2968. * @private
  2969. * @name delete
  2970. * @memberOf Stack
  2971. * @param {string} key The key of the value to remove.
  2972. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2973. */
  2974. function stackDelete(key) {
  2975. var data = this.__data__,
  2976. result = data['delete'](key);
  2977. this.size = data.size;
  2978. return result;
  2979. }
  2980. /**
  2981. * Gets the stack value for `key`.
  2982. *
  2983. * @private
  2984. * @name get
  2985. * @memberOf Stack
  2986. * @param {string} key The key of the value to get.
  2987. * @returns {*} Returns the entry value.
  2988. */
  2989. function stackGet(key) {
  2990. return this.__data__.get(key);
  2991. }
  2992. /**
  2993. * Checks if a stack value for `key` exists.
  2994. *
  2995. * @private
  2996. * @name has
  2997. * @memberOf Stack
  2998. * @param {string} key The key of the entry to check.
  2999. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3000. */
  3001. function stackHas(key) {
  3002. return this.__data__.has(key);
  3003. }
  3004. /**
  3005. * Sets the stack `key` to `value`.
  3006. *
  3007. * @private
  3008. * @name set
  3009. * @memberOf Stack
  3010. * @param {string} key The key of the value to set.
  3011. * @param {*} value The value to set.
  3012. * @returns {Object} Returns the stack cache instance.
  3013. */
  3014. function stackSet(key, value) {
  3015. var data = this.__data__;
  3016. if (data instanceof ListCache) {
  3017. var pairs = data.__data__;
  3018. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  3019. pairs.push([key, value]);
  3020. this.size = ++data.size;
  3021. return this;
  3022. }
  3023. data = this.__data__ = new MapCache(pairs);
  3024. }
  3025. data.set(key, value);
  3026. this.size = data.size;
  3027. return this;
  3028. }
  3029. // Add methods to `Stack`.
  3030. Stack.prototype.clear = stackClear;
  3031. Stack.prototype['delete'] = stackDelete;
  3032. Stack.prototype.get = stackGet;
  3033. Stack.prototype.has = stackHas;
  3034. Stack.prototype.set = stackSet;
  3035. /*------------------------------------------------------------------------*/
  3036. /**
  3037. * Creates an array of the enumerable property names of the array-like `value`.
  3038. *
  3039. * @private
  3040. * @param {*} value The value to query.
  3041. * @param {boolean} inherited Specify returning inherited property names.
  3042. * @returns {Array} Returns the array of property names.
  3043. */
  3044. function arrayLikeKeys(value, inherited) {
  3045. var isArr = isArray(value),
  3046. isArg = !isArr && isArguments(value),
  3047. isBuff = !isArr && !isArg && isBuffer(value),
  3048. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  3049. skipIndexes = isArr || isArg || isBuff || isType,
  3050. result = skipIndexes ? baseTimes(value.length, String) : [],
  3051. length = result.length;
  3052. for (var key in value) {
  3053. if ((inherited || hasOwnProperty.call(value, key)) &&
  3054. !(skipIndexes && (
  3055. // Safari 9 has enumerable `arguments.length` in strict mode.
  3056. key == 'length' ||
  3057. // Node.js 0.10 has enumerable non-index properties on buffers.
  3058. (isBuff && (key == 'offset' || key == 'parent')) ||
  3059. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  3060. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  3061. // Skip index properties.
  3062. isIndex(key, length)
  3063. ))) {
  3064. result.push(key);
  3065. }
  3066. }
  3067. return result;
  3068. }
  3069. /**
  3070. * A specialized version of `_.sample` for arrays.
  3071. *
  3072. * @private
  3073. * @param {Array} array The array to sample.
  3074. * @returns {*} Returns the random element.
  3075. */
  3076. function arraySample(array) {
  3077. var length = array.length;
  3078. return length ? array[baseRandom(0, length - 1)] : undefined;
  3079. }
  3080. /**
  3081. * A specialized version of `_.sampleSize` for arrays.
  3082. *
  3083. * @private
  3084. * @param {Array} array The array to sample.
  3085. * @param {number} n The number of elements to sample.
  3086. * @returns {Array} Returns the random elements.
  3087. */
  3088. function arraySampleSize(array, n) {
  3089. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  3090. }
  3091. /**
  3092. * A specialized version of `_.shuffle` for arrays.
  3093. *
  3094. * @private
  3095. * @param {Array} array The array to shuffle.
  3096. * @returns {Array} Returns the new shuffled array.
  3097. */
  3098. function arrayShuffle(array) {
  3099. return shuffleSelf(copyArray(array));
  3100. }
  3101. /**
  3102. * This function is like `assignValue` except that it doesn't assign
  3103. * `undefined` values.
  3104. *
  3105. * @private
  3106. * @param {Object} object The object to modify.
  3107. * @param {string} key The key of the property to assign.
  3108. * @param {*} value The value to assign.
  3109. */
  3110. function assignMergeValue(object, key, value) {
  3111. if ((value !== undefined && !eq(object[key], value)) ||
  3112. (value === undefined && !(key in object))) {
  3113. baseAssignValue(object, key, value);
  3114. }
  3115. }
  3116. /**
  3117. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  3118. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  3119. * for equality comparisons.
  3120. *
  3121. * @private
  3122. * @param {Object} object The object to modify.
  3123. * @param {string} key The key of the property to assign.
  3124. * @param {*} value The value to assign.
  3125. */
  3126. function assignValue(object, key, value) {
  3127. var objValue = object[key];
  3128. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  3129. (value === undefined && !(key in object))) {
  3130. baseAssignValue(object, key, value);
  3131. }
  3132. }
  3133. /**
  3134. * Gets the index at which the `key` is found in `array` of key-value pairs.
  3135. *
  3136. * @private
  3137. * @param {Array} array The array to inspect.
  3138. * @param {*} key The key to search for.
  3139. * @returns {number} Returns the index of the matched value, else `-1`.
  3140. */
  3141. function assocIndexOf(array, key) {
  3142. var length = array.length;
  3143. while (length--) {
  3144. if (eq(array[length][0], key)) {
  3145. return length;
  3146. }
  3147. }
  3148. return -1;
  3149. }
  3150. /**
  3151. * Aggregates elements of `collection` on `accumulator` with keys transformed
  3152. * by `iteratee` and values set by `setter`.
  3153. *
  3154. * @private
  3155. * @param {Array|Object} collection The collection to iterate over.
  3156. * @param {Function} setter The function to set `accumulator` values.
  3157. * @param {Function} iteratee The iteratee to transform keys.
  3158. * @param {Object} accumulator The initial aggregated object.
  3159. * @returns {Function} Returns `accumulator`.
  3160. */
  3161. function baseAggregator(collection, setter, iteratee, accumulator) {
  3162. baseEach(collection, function(value, key, collection) {
  3163. setter(accumulator, value, iteratee(value), collection);
  3164. });
  3165. return accumulator;
  3166. }
  3167. /**
  3168. * The base implementation of `_.assign` without support for multiple sources
  3169. * or `customizer` functions.
  3170. *
  3171. * @private
  3172. * @param {Object} object The destination object.
  3173. * @param {Object} source The source object.
  3174. * @returns {Object} Returns `object`.
  3175. */
  3176. function baseAssign(object, source) {
  3177. return object && copyObject(source, keys(source), object);
  3178. }
  3179. /**
  3180. * The base implementation of `_.assignIn` without support for multiple sources
  3181. * or `customizer` functions.
  3182. *
  3183. * @private
  3184. * @param {Object} object The destination object.
  3185. * @param {Object} source The source object.
  3186. * @returns {Object} Returns `object`.
  3187. */
  3188. function baseAssignIn(object, source) {
  3189. return object && copyObject(source, keysIn(source), object);
  3190. }
  3191. /**
  3192. * The base implementation of `assignValue` and `assignMergeValue` without
  3193. * value checks.
  3194. *
  3195. * @private
  3196. * @param {Object} object The object to modify.
  3197. * @param {string} key The key of the property to assign.
  3198. * @param {*} value The value to assign.
  3199. */
  3200. function baseAssignValue(object, key, value) {
  3201. if (key == '__proto__' && defineProperty) {
  3202. defineProperty(object, key, {
  3203. 'configurable': true,
  3204. 'enumerable': true,
  3205. 'value': value,
  3206. 'writable': true
  3207. });
  3208. } else {
  3209. object[key] = value;
  3210. }
  3211. }
  3212. /**
  3213. * The base implementation of `_.at` without support for individual paths.
  3214. *
  3215. * @private
  3216. * @param {Object} object The object to iterate over.
  3217. * @param {string[]} paths The property paths to pick.
  3218. * @returns {Array} Returns the picked elements.
  3219. */
  3220. function baseAt(object, paths) {
  3221. var index = -1,
  3222. length = paths.length,
  3223. result = Array(length),
  3224. skip = object == null;
  3225. while (++index < length) {
  3226. result[index] = skip ? undefined : get(object, paths[index]);
  3227. }
  3228. return result;
  3229. }
  3230. /**
  3231. * The base implementation of `_.clamp` which doesn't coerce arguments.
  3232. *
  3233. * @private
  3234. * @param {number} number The number to clamp.
  3235. * @param {number} [lower] The lower bound.
  3236. * @param {number} upper The upper bound.
  3237. * @returns {number} Returns the clamped number.
  3238. */
  3239. function baseClamp(number, lower, upper) {
  3240. if (number === number) {
  3241. if (upper !== undefined) {
  3242. number = number <= upper ? number : upper;
  3243. }
  3244. if (lower !== undefined) {
  3245. number = number >= lower ? number : lower;
  3246. }
  3247. }
  3248. return number;
  3249. }
  3250. /**
  3251. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  3252. * traversed objects.
  3253. *
  3254. * @private
  3255. * @param {*} value The value to clone.
  3256. * @param {boolean} bitmask The bitmask flags.
  3257. * 1 - Deep clone
  3258. * 2 - Flatten inherited properties
  3259. * 4 - Clone symbols
  3260. * @param {Function} [customizer] The function to customize cloning.
  3261. * @param {string} [key] The key of `value`.
  3262. * @param {Object} [object] The parent object of `value`.
  3263. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  3264. * @returns {*} Returns the cloned value.
  3265. */
  3266. function baseClone(value, bitmask, customizer, key, object, stack) {
  3267. var result,
  3268. isDeep = bitmask & CLONE_DEEP_FLAG,
  3269. isFlat = bitmask & CLONE_FLAT_FLAG,
  3270. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  3271. if (customizer) {
  3272. result = object ? customizer(value, key, object, stack) : customizer(value);
  3273. }
  3274. if (result !== undefined) {
  3275. return result;
  3276. }
  3277. if (!isObject(value)) {
  3278. return value;
  3279. }
  3280. var isArr = isArray(value);
  3281. if (isArr) {
  3282. result = initCloneArray(value);
  3283. if (!isDeep) {
  3284. return copyArray(value, result);
  3285. }
  3286. } else {
  3287. var tag = getTag(value),
  3288. isFunc = tag == funcTag || tag == genTag;
  3289. if (isBuffer(value)) {
  3290. return cloneBuffer(value, isDeep);
  3291. }
  3292. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  3293. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  3294. if (!isDeep) {
  3295. return isFlat
  3296. ? copySymbolsIn(value, baseAssignIn(result, value))
  3297. : copySymbols(value, baseAssign(result, value));
  3298. }
  3299. } else {
  3300. if (!cloneableTags[tag]) {
  3301. return object ? value : {};
  3302. }
  3303. result = initCloneByTag(value, tag, isDeep);
  3304. }
  3305. }
  3306. // Check for circular references and return its corresponding clone.
  3307. stack || (stack = new Stack);
  3308. var stacked = stack.get(value);
  3309. if (stacked) {
  3310. return stacked;
  3311. }
  3312. stack.set(value, result);
  3313. if (isSet(value)) {
  3314. value.forEach(function(subValue) {
  3315. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  3316. });
  3317. return result;
  3318. }
  3319. if (isMap(value)) {
  3320. value.forEach(function(subValue, key) {
  3321. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  3322. });
  3323. return result;
  3324. }
  3325. var keysFunc = isFull
  3326. ? (isFlat ? getAllKeysIn : getAllKeys)
  3327. : (isFlat ? keysIn : keys);
  3328. var props = isArr ? undefined : keysFunc(value);
  3329. arrayEach(props || value, function(subValue, key) {
  3330. if (props) {
  3331. key = subValue;
  3332. subValue = value[key];
  3333. }
  3334. // Recursively populate clone (susceptible to call stack limits).
  3335. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  3336. });
  3337. return result;
  3338. }
  3339. /**
  3340. * The base implementation of `_.conforms` which doesn't clone `source`.
  3341. *
  3342. * @private
  3343. * @param {Object} source The object of property predicates to conform to.
  3344. * @returns {Function} Returns the new spec function.
  3345. */
  3346. function baseConforms(source) {
  3347. var props = keys(source);
  3348. return function(object) {
  3349. return baseConformsTo(object, source, props);
  3350. };
  3351. }
  3352. /**
  3353. * The base implementation of `_.conformsTo` which accepts `props` to check.
  3354. *
  3355. * @private
  3356. * @param {Object} object The object to inspect.
  3357. * @param {Object} source The object of property predicates to conform to.
  3358. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  3359. */
  3360. function baseConformsTo(object, source, props) {
  3361. var length = props.length;
  3362. if (object == null) {
  3363. return !length;
  3364. }
  3365. object = Object(object);
  3366. while (length--) {
  3367. var key = props[length],
  3368. predicate = source[key],
  3369. value = object[key];
  3370. if ((value === undefined && !(key in object)) || !predicate(value)) {
  3371. return false;
  3372. }
  3373. }
  3374. return true;
  3375. }
  3376. /**
  3377. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  3378. * to provide to `func`.
  3379. *
  3380. * @private
  3381. * @param {Function} func The function to delay.
  3382. * @param {number} wait The number of milliseconds to delay invocation.
  3383. * @param {Array} args The arguments to provide to `func`.
  3384. * @returns {number|Object} Returns the timer id or timeout object.
  3385. */
  3386. function baseDelay(func, wait, args) {
  3387. if (typeof func != 'function') {
  3388. throw new TypeError(FUNC_ERROR_TEXT);
  3389. }
  3390. return setTimeout(function() { func.apply(undefined, args); }, wait);
  3391. }
  3392. /**
  3393. * The base implementation of methods like `_.difference` without support
  3394. * for excluding multiple arrays or iteratee shorthands.
  3395. *
  3396. * @private
  3397. * @param {Array} array The array to inspect.
  3398. * @param {Array} values The values to exclude.
  3399. * @param {Function} [iteratee] The iteratee invoked per element.
  3400. * @param {Function} [comparator] The comparator invoked per element.
  3401. * @returns {Array} Returns the new array of filtered values.
  3402. */
  3403. function baseDifference(array, values, iteratee, comparator) {
  3404. var index = -1,
  3405. includes = arrayIncludes,
  3406. isCommon = true,
  3407. length = array.length,
  3408. result = [],
  3409. valuesLength = values.length;
  3410. if (!length) {
  3411. return result;
  3412. }
  3413. if (iteratee) {
  3414. values = arrayMap(values, baseUnary(iteratee));
  3415. }
  3416. if (comparator) {
  3417. includes = arrayIncludesWith;
  3418. isCommon = false;
  3419. }
  3420. else if (values.length >= LARGE_ARRAY_SIZE) {
  3421. includes = cacheHas;
  3422. isCommon = false;
  3423. values = new SetCache(values);
  3424. }
  3425. outer:
  3426. while (++index < length) {
  3427. var value = array[index],
  3428. computed = iteratee == null ? value : iteratee(value);
  3429. value = (comparator || value !== 0) ? value : 0;
  3430. if (isCommon && computed === computed) {
  3431. var valuesIndex = valuesLength;
  3432. while (valuesIndex--) {
  3433. if (values[valuesIndex] === computed) {
  3434. continue outer;
  3435. }
  3436. }
  3437. result.push(value);
  3438. }
  3439. else if (!includes(values, computed, comparator)) {
  3440. result.push(value);
  3441. }
  3442. }
  3443. return result;
  3444. }
  3445. /**
  3446. * The base implementation of `_.forEach` without support for iteratee shorthands.
  3447. *
  3448. * @private
  3449. * @param {Array|Object} collection The collection to iterate over.
  3450. * @param {Function} iteratee The function invoked per iteration.
  3451. * @returns {Array|Object} Returns `collection`.
  3452. */
  3453. var baseEach = createBaseEach(baseForOwn);
  3454. /**
  3455. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  3456. *
  3457. * @private
  3458. * @param {Array|Object} collection The collection to iterate over.
  3459. * @param {Function} iteratee The function invoked per iteration.
  3460. * @returns {Array|Object} Returns `collection`.
  3461. */
  3462. var baseEachRight = createBaseEach(baseForOwnRight, true);
  3463. /**
  3464. * The base implementation of `_.every` without support for iteratee shorthands.
  3465. *
  3466. * @private
  3467. * @param {Array|Object} collection The collection to iterate over.
  3468. * @param {Function} predicate The function invoked per iteration.
  3469. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  3470. * else `false`
  3471. */
  3472. function baseEvery(collection, predicate) {
  3473. var result = true;
  3474. baseEach(collection, function(value, index, collection) {
  3475. result = !!predicate(value, index, collection);
  3476. return result;
  3477. });
  3478. return result;
  3479. }
  3480. /**
  3481. * The base implementation of methods like `_.max` and `_.min` which accepts a
  3482. * `comparator` to determine the extremum value.
  3483. *
  3484. * @private
  3485. * @param {Array} array The array to iterate over.
  3486. * @param {Function} iteratee The iteratee invoked per iteration.
  3487. * @param {Function} comparator The comparator used to compare values.
  3488. * @returns {*} Returns the extremum value.
  3489. */
  3490. function baseExtremum(array, iteratee, comparator) {
  3491. var index = -1,
  3492. length = array.length;
  3493. while (++index < length) {
  3494. var value = array[index],
  3495. current = iteratee(value);
  3496. if (current != null && (computed === undefined
  3497. ? (current === current && !isSymbol(current))
  3498. : comparator(current, computed)
  3499. )) {
  3500. var computed = current,
  3501. result = value;
  3502. }
  3503. }
  3504. return result;
  3505. }
  3506. /**
  3507. * The base implementation of `_.fill` without an iteratee call guard.
  3508. *
  3509. * @private
  3510. * @param {Array} array The array to fill.
  3511. * @param {*} value The value to fill `array` with.
  3512. * @param {number} [start=0] The start position.
  3513. * @param {number} [end=array.length] The end position.
  3514. * @returns {Array} Returns `array`.
  3515. */
  3516. function baseFill(array, value, start, end) {
  3517. var length = array.length;
  3518. start = toInteger(start);
  3519. if (start < 0) {
  3520. start = -start > length ? 0 : (length + start);
  3521. }
  3522. end = (end === undefined || end > length) ? length : toInteger(end);
  3523. if (end < 0) {
  3524. end += length;
  3525. }
  3526. end = start > end ? 0 : toLength(end);
  3527. while (start < end) {
  3528. array[start++] = value;
  3529. }
  3530. return array;
  3531. }
  3532. /**
  3533. * The base implementation of `_.filter` without support for iteratee shorthands.
  3534. *
  3535. * @private
  3536. * @param {Array|Object} collection The collection to iterate over.
  3537. * @param {Function} predicate The function invoked per iteration.
  3538. * @returns {Array} Returns the new filtered array.
  3539. */
  3540. function baseFilter(collection, predicate) {
  3541. var result = [];
  3542. baseEach(collection, function(value, index, collection) {
  3543. if (predicate(value, index, collection)) {
  3544. result.push(value);
  3545. }
  3546. });
  3547. return result;
  3548. }
  3549. /**
  3550. * The base implementation of `_.flatten` with support for restricting flattening.
  3551. *
  3552. * @private
  3553. * @param {Array} array The array to flatten.
  3554. * @param {number} depth The maximum recursion depth.
  3555. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  3556. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  3557. * @param {Array} [result=[]] The initial result value.
  3558. * @returns {Array} Returns the new flattened array.
  3559. */
  3560. function baseFlatten(array, depth, predicate, isStrict, result) {
  3561. var index = -1,
  3562. length = array.length;
  3563. predicate || (predicate = isFlattenable);
  3564. result || (result = []);
  3565. while (++index < length) {
  3566. var value = array[index];
  3567. if (depth > 0 && predicate(value)) {
  3568. if (depth > 1) {
  3569. // Recursively flatten arrays (susceptible to call stack limits).
  3570. baseFlatten(value, depth - 1, predicate, isStrict, result);
  3571. } else {
  3572. arrayPush(result, value);
  3573. }
  3574. } else if (!isStrict) {
  3575. result[result.length] = value;
  3576. }
  3577. }
  3578. return result;
  3579. }
  3580. /**
  3581. * The base implementation of `baseForOwn` which iterates over `object`
  3582. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  3583. * Iteratee functions may exit iteration early by explicitly returning `false`.
  3584. *
  3585. * @private
  3586. * @param {Object} object The object to iterate over.
  3587. * @param {Function} iteratee The function invoked per iteration.
  3588. * @param {Function} keysFunc The function to get the keys of `object`.
  3589. * @returns {Object} Returns `object`.
  3590. */
  3591. var baseFor = createBaseFor();
  3592. /**
  3593. * This function is like `baseFor` except that it iterates over properties
  3594. * in the opposite order.
  3595. *
  3596. * @private
  3597. * @param {Object} object The object to iterate over.
  3598. * @param {Function} iteratee The function invoked per iteration.
  3599. * @param {Function} keysFunc The function to get the keys of `object`.
  3600. * @returns {Object} Returns `object`.
  3601. */
  3602. var baseForRight = createBaseFor(true);
  3603. /**
  3604. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  3605. *
  3606. * @private
  3607. * @param {Object} object The object to iterate over.
  3608. * @param {Function} iteratee The function invoked per iteration.
  3609. * @returns {Object} Returns `object`.
  3610. */
  3611. function baseForOwn(object, iteratee) {
  3612. return object && baseFor(object, iteratee, keys);
  3613. }
  3614. /**
  3615. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  3616. *
  3617. * @private
  3618. * @param {Object} object The object to iterate over.
  3619. * @param {Function} iteratee The function invoked per iteration.
  3620. * @returns {Object} Returns `object`.
  3621. */
  3622. function baseForOwnRight(object, iteratee) {
  3623. return object && baseForRight(object, iteratee, keys);
  3624. }
  3625. /**
  3626. * The base implementation of `_.functions` which creates an array of
  3627. * `object` function property names filtered from `props`.
  3628. *
  3629. * @private
  3630. * @param {Object} object The object to inspect.
  3631. * @param {Array} props The property names to filter.
  3632. * @returns {Array} Returns the function names.
  3633. */
  3634. function baseFunctions(object, props) {
  3635. return arrayFilter(props, function(key) {
  3636. return isFunction(object[key]);
  3637. });
  3638. }
  3639. /**
  3640. * The base implementation of `_.get` without support for default values.
  3641. *
  3642. * @private
  3643. * @param {Object} object The object to query.
  3644. * @param {Array|string} path The path of the property to get.
  3645. * @returns {*} Returns the resolved value.
  3646. */
  3647. function baseGet(object, path) {
  3648. path = castPath(path, object);
  3649. var index = 0,
  3650. length = path.length;
  3651. while (object != null && index < length) {
  3652. object = object[toKey(path[index++])];
  3653. }
  3654. return (index && index == length) ? object : undefined;
  3655. }
  3656. /**
  3657. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  3658. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  3659. * symbols of `object`.
  3660. *
  3661. * @private
  3662. * @param {Object} object The object to query.
  3663. * @param {Function} keysFunc The function to get the keys of `object`.
  3664. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  3665. * @returns {Array} Returns the array of property names and symbols.
  3666. */
  3667. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  3668. var result = keysFunc(object);
  3669. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  3670. }
  3671. /**
  3672. * The base implementation of `getTag` without fallbacks for buggy environments.
  3673. *
  3674. * @private
  3675. * @param {*} value The value to query.
  3676. * @returns {string} Returns the `toStringTag`.
  3677. */
  3678. function baseGetTag(value) {
  3679. if (value == null) {
  3680. return value === undefined ? undefinedTag : nullTag;
  3681. }
  3682. return (symToStringTag && symToStringTag in Object(value))
  3683. ? getRawTag(value)
  3684. : objectToString(value);
  3685. }
  3686. /**
  3687. * The base implementation of `_.gt` which doesn't coerce arguments.
  3688. *
  3689. * @private
  3690. * @param {*} value The value to compare.
  3691. * @param {*} other The other value to compare.
  3692. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  3693. * else `false`.
  3694. */
  3695. function baseGt(value, other) {
  3696. return value > other;
  3697. }
  3698. /**
  3699. * The base implementation of `_.has` without support for deep paths.
  3700. *
  3701. * @private
  3702. * @param {Object} [object] The object to query.
  3703. * @param {Array|string} key The key to check.
  3704. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  3705. */
  3706. function baseHas(object, key) {
  3707. return object != null && hasOwnProperty.call(object, key);
  3708. }
  3709. /**
  3710. * The base implementation of `_.hasIn` without support for deep paths.
  3711. *
  3712. * @private
  3713. * @param {Object} [object] The object to query.
  3714. * @param {Array|string} key The key to check.
  3715. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  3716. */
  3717. function baseHasIn(object, key) {
  3718. return object != null && key in Object(object);
  3719. }
  3720. /**
  3721. * The base implementation of `_.inRange` which doesn't coerce arguments.
  3722. *
  3723. * @private
  3724. * @param {number} number The number to check.
  3725. * @param {number} start The start of the range.
  3726. * @param {number} end The end of the range.
  3727. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  3728. */
  3729. function baseInRange(number, start, end) {
  3730. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  3731. }
  3732. /**
  3733. * The base implementation of methods like `_.intersection`, without support
  3734. * for iteratee shorthands, that accepts an array of arrays to inspect.
  3735. *
  3736. * @private
  3737. * @param {Array} arrays The arrays to inspect.
  3738. * @param {Function} [iteratee] The iteratee invoked per element.
  3739. * @param {Function} [comparator] The comparator invoked per element.
  3740. * @returns {Array} Returns the new array of shared values.
  3741. */
  3742. function baseIntersection(arrays, iteratee, comparator) {
  3743. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  3744. length = arrays[0].length,
  3745. othLength = arrays.length,
  3746. othIndex = othLength,
  3747. caches = Array(othLength),
  3748. maxLength = Infinity,
  3749. result = [];
  3750. while (othIndex--) {
  3751. var array = arrays[othIndex];
  3752. if (othIndex && iteratee) {
  3753. array = arrayMap(array, baseUnary(iteratee));
  3754. }
  3755. maxLength = nativeMin(array.length, maxLength);
  3756. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  3757. ? new SetCache(othIndex && array)
  3758. : undefined;
  3759. }
  3760. array = arrays[0];
  3761. var index = -1,
  3762. seen = caches[0];
  3763. outer:
  3764. while (++index < length && result.length < maxLength) {
  3765. var value = array[index],
  3766. computed = iteratee ? iteratee(value) : value;
  3767. value = (comparator || value !== 0) ? value : 0;
  3768. if (!(seen
  3769. ? cacheHas(seen, computed)
  3770. : includes(result, computed, comparator)
  3771. )) {
  3772. othIndex = othLength;
  3773. while (--othIndex) {
  3774. var cache = caches[othIndex];
  3775. if (!(cache
  3776. ? cacheHas(cache, computed)
  3777. : includes(arrays[othIndex], computed, comparator))
  3778. ) {
  3779. continue outer;
  3780. }
  3781. }
  3782. if (seen) {
  3783. seen.push(computed);
  3784. }
  3785. result.push(value);
  3786. }
  3787. }
  3788. return result;
  3789. }
  3790. /**
  3791. * The base implementation of `_.invert` and `_.invertBy` which inverts
  3792. * `object` with values transformed by `iteratee` and set by `setter`.
  3793. *
  3794. * @private
  3795. * @param {Object} object The object to iterate over.
  3796. * @param {Function} setter The function to set `accumulator` values.
  3797. * @param {Function} iteratee The iteratee to transform values.
  3798. * @param {Object} accumulator The initial inverted object.
  3799. * @returns {Function} Returns `accumulator`.
  3800. */
  3801. function baseInverter(object, setter, iteratee, accumulator) {
  3802. baseForOwn(object, function(value, key, object) {
  3803. setter(accumulator, iteratee(value), key, object);
  3804. });
  3805. return accumulator;
  3806. }
  3807. /**
  3808. * The base implementation of `_.invoke` without support for individual
  3809. * method arguments.
  3810. *
  3811. * @private
  3812. * @param {Object} object The object to query.
  3813. * @param {Array|string} path The path of the method to invoke.
  3814. * @param {Array} args The arguments to invoke the method with.
  3815. * @returns {*} Returns the result of the invoked method.
  3816. */
  3817. function baseInvoke(object, path, args) {
  3818. path = castPath(path, object);
  3819. object = parent(object, path);
  3820. var func = object == null ? object : object[toKey(last(path))];
  3821. return func == null ? undefined : apply(func, object, args);
  3822. }
  3823. /**
  3824. * The base implementation of `_.isArguments`.
  3825. *
  3826. * @private
  3827. * @param {*} value The value to check.
  3828. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  3829. */
  3830. function baseIsArguments(value) {
  3831. return isObjectLike(value) && baseGetTag(value) == argsTag;
  3832. }
  3833. /**
  3834. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  3835. *
  3836. * @private
  3837. * @param {*} value The value to check.
  3838. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  3839. */
  3840. function baseIsArrayBuffer(value) {
  3841. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  3842. }
  3843. /**
  3844. * The base implementation of `_.isDate` without Node.js optimizations.
  3845. *
  3846. * @private
  3847. * @param {*} value The value to check.
  3848. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  3849. */
  3850. function baseIsDate(value) {
  3851. return isObjectLike(value) && baseGetTag(value) == dateTag;
  3852. }
  3853. /**
  3854. * The base implementation of `_.isEqual` which supports partial comparisons
  3855. * and tracks traversed objects.
  3856. *
  3857. * @private
  3858. * @param {*} value The value to compare.
  3859. * @param {*} other The other value to compare.
  3860. * @param {boolean} bitmask The bitmask flags.
  3861. * 1 - Unordered comparison
  3862. * 2 - Partial comparison
  3863. * @param {Function} [customizer] The function to customize comparisons.
  3864. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  3865. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  3866. */
  3867. function baseIsEqual(value, other, bitmask, customizer, stack) {
  3868. if (value === other) {
  3869. return true;
  3870. }
  3871. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  3872. return value !== value && other !== other;
  3873. }
  3874. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  3875. }
  3876. /**
  3877. * A specialized version of `baseIsEqual` for arrays and objects which performs
  3878. * deep comparisons and tracks traversed objects enabling objects with circular
  3879. * references to be compared.
  3880. *
  3881. * @private
  3882. * @param {Object} object The object to compare.
  3883. * @param {Object} other The other object to compare.
  3884. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  3885. * @param {Function} customizer The function to customize comparisons.
  3886. * @param {Function} equalFunc The function to determine equivalents of values.
  3887. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  3888. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  3889. */
  3890. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  3891. var objIsArr = isArray(object),
  3892. othIsArr = isArray(other),
  3893. objTag = objIsArr ? arrayTag : getTag(object),
  3894. othTag = othIsArr ? arrayTag : getTag(other);
  3895. objTag = objTag == argsTag ? objectTag : objTag;
  3896. othTag = othTag == argsTag ? objectTag : othTag;
  3897. var objIsObj = objTag == objectTag,
  3898. othIsObj = othTag == objectTag,
  3899. isSameTag = objTag == othTag;
  3900. if (isSameTag && isBuffer(object)) {
  3901. if (!isBuffer(other)) {
  3902. return false;
  3903. }
  3904. objIsArr = true;
  3905. objIsObj = false;
  3906. }
  3907. if (isSameTag && !objIsObj) {
  3908. stack || (stack = new Stack);
  3909. return (objIsArr || isTypedArray(object))
  3910. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  3911. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  3912. }
  3913. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  3914. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  3915. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  3916. if (objIsWrapped || othIsWrapped) {
  3917. var objUnwrapped = objIsWrapped ? object.value() : object,
  3918. othUnwrapped = othIsWrapped ? other.value() : other;
  3919. stack || (stack = new Stack);
  3920. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  3921. }
  3922. }
  3923. if (!isSameTag) {
  3924. return false;
  3925. }
  3926. stack || (stack = new Stack);
  3927. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  3928. }
  3929. /**
  3930. * The base implementation of `_.isMap` without Node.js optimizations.
  3931. *
  3932. * @private
  3933. * @param {*} value The value to check.
  3934. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  3935. */
  3936. function baseIsMap(value) {
  3937. return isObjectLike(value) && getTag(value) == mapTag;
  3938. }
  3939. /**
  3940. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  3941. *
  3942. * @private
  3943. * @param {Object} object The object to inspect.
  3944. * @param {Object} source The object of property values to match.
  3945. * @param {Array} matchData The property names, values, and compare flags to match.
  3946. * @param {Function} [customizer] The function to customize comparisons.
  3947. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  3948. */
  3949. function baseIsMatch(object, source, matchData, customizer) {
  3950. var index = matchData.length,
  3951. length = index,
  3952. noCustomizer = !customizer;
  3953. if (object == null) {
  3954. return !length;
  3955. }
  3956. object = Object(object);
  3957. while (index--) {
  3958. var data = matchData[index];
  3959. if ((noCustomizer && data[2])
  3960. ? data[1] !== object[data[0]]
  3961. : !(data[0] in object)
  3962. ) {
  3963. return false;
  3964. }
  3965. }
  3966. while (++index < length) {
  3967. data = matchData[index];
  3968. var key = data[0],
  3969. objValue = object[key],
  3970. srcValue = data[1];
  3971. if (noCustomizer && data[2]) {
  3972. if (objValue === undefined && !(key in object)) {
  3973. return false;
  3974. }
  3975. } else {
  3976. var stack = new Stack;
  3977. if (customizer) {
  3978. var result = customizer(objValue, srcValue, key, object, source, stack);
  3979. }
  3980. if (!(result === undefined
  3981. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  3982. : result
  3983. )) {
  3984. return false;
  3985. }
  3986. }
  3987. }
  3988. return true;
  3989. }
  3990. /**
  3991. * The base implementation of `_.isNative` without bad shim checks.
  3992. *
  3993. * @private
  3994. * @param {*} value The value to check.
  3995. * @returns {boolean} Returns `true` if `value` is a native function,
  3996. * else `false`.
  3997. */
  3998. function baseIsNative(value) {
  3999. if (!isObject(value) || isMasked(value)) {
  4000. return false;
  4001. }
  4002. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  4003. return pattern.test(toSource(value));
  4004. }
  4005. /**
  4006. * The base implementation of `_.isRegExp` without Node.js optimizations.
  4007. *
  4008. * @private
  4009. * @param {*} value The value to check.
  4010. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  4011. */
  4012. function baseIsRegExp(value) {
  4013. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  4014. }
  4015. /**
  4016. * The base implementation of `_.isSet` without Node.js optimizations.
  4017. *
  4018. * @private
  4019. * @param {*} value The value to check.
  4020. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  4021. */
  4022. function baseIsSet(value) {
  4023. return isObjectLike(value) && getTag(value) == setTag;
  4024. }
  4025. /**
  4026. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  4027. *
  4028. * @private
  4029. * @param {*} value The value to check.
  4030. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  4031. */
  4032. function baseIsTypedArray(value) {
  4033. return isObjectLike(value) &&
  4034. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  4035. }
  4036. /**
  4037. * The base implementation of `_.iteratee`.
  4038. *
  4039. * @private
  4040. * @param {*} [value=_.identity] The value to convert to an iteratee.
  4041. * @returns {Function} Returns the iteratee.
  4042. */
  4043. function baseIteratee(value) {
  4044. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  4045. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  4046. if (typeof value == 'function') {
  4047. return value;
  4048. }
  4049. if (value == null) {
  4050. return identity;
  4051. }
  4052. if (typeof value == 'object') {
  4053. return isArray(value)
  4054. ? baseMatchesProperty(value[0], value[1])
  4055. : baseMatches(value);
  4056. }
  4057. return property(value);
  4058. }
  4059. /**
  4060. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  4061. *
  4062. * @private
  4063. * @param {Object} object The object to query.
  4064. * @returns {Array} Returns the array of property names.
  4065. */
  4066. function baseKeys(object) {
  4067. if (!isPrototype(object)) {
  4068. return nativeKeys(object);
  4069. }
  4070. var result = [];
  4071. for (var key in Object(object)) {
  4072. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  4073. result.push(key);
  4074. }
  4075. }
  4076. return result;
  4077. }
  4078. /**
  4079. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  4080. *
  4081. * @private
  4082. * @param {Object} object The object to query.
  4083. * @returns {Array} Returns the array of property names.
  4084. */
  4085. function baseKeysIn(object) {
  4086. if (!isObject(object)) {
  4087. return nativeKeysIn(object);
  4088. }
  4089. var isProto = isPrototype(object),
  4090. result = [];
  4091. for (var key in object) {
  4092. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  4093. result.push(key);
  4094. }
  4095. }
  4096. return result;
  4097. }
  4098. /**
  4099. * The base implementation of `_.lt` which doesn't coerce arguments.
  4100. *
  4101. * @private
  4102. * @param {*} value The value to compare.
  4103. * @param {*} other The other value to compare.
  4104. * @returns {boolean} Returns `true` if `value` is less than `other`,
  4105. * else `false`.
  4106. */
  4107. function baseLt(value, other) {
  4108. return value < other;
  4109. }
  4110. /**
  4111. * The base implementation of `_.map` without support for iteratee shorthands.
  4112. *
  4113. * @private
  4114. * @param {Array|Object} collection The collection to iterate over.
  4115. * @param {Function} iteratee The function invoked per iteration.
  4116. * @returns {Array} Returns the new mapped array.
  4117. */
  4118. function baseMap(collection, iteratee) {
  4119. var index = -1,
  4120. result = isArrayLike(collection) ? Array(collection.length) : [];
  4121. baseEach(collection, function(value, key, collection) {
  4122. result[++index] = iteratee(value, key, collection);
  4123. });
  4124. return result;
  4125. }
  4126. /**
  4127. * The base implementation of `_.matches` which doesn't clone `source`.
  4128. *
  4129. * @private
  4130. * @param {Object} source The object of property values to match.
  4131. * @returns {Function} Returns the new spec function.
  4132. */
  4133. function baseMatches(source) {
  4134. var matchData = getMatchData(source);
  4135. if (matchData.length == 1 && matchData[0][2]) {
  4136. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  4137. }
  4138. return function(object) {
  4139. return object === source || baseIsMatch(object, source, matchData);
  4140. };
  4141. }
  4142. /**
  4143. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  4144. *
  4145. * @private
  4146. * @param {string} path The path of the property to get.
  4147. * @param {*} srcValue The value to match.
  4148. * @returns {Function} Returns the new spec function.
  4149. */
  4150. function baseMatchesProperty(path, srcValue) {
  4151. if (isKey(path) && isStrictComparable(srcValue)) {
  4152. return matchesStrictComparable(toKey(path), srcValue);
  4153. }
  4154. return function(object) {
  4155. var objValue = get(object, path);
  4156. return (objValue === undefined && objValue === srcValue)
  4157. ? hasIn(object, path)
  4158. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  4159. };
  4160. }
  4161. /**
  4162. * The base implementation of `_.merge` without support for multiple sources.
  4163. *
  4164. * @private
  4165. * @param {Object} object The destination object.
  4166. * @param {Object} source The source object.
  4167. * @param {number} srcIndex The index of `source`.
  4168. * @param {Function} [customizer] The function to customize merged values.
  4169. * @param {Object} [stack] Tracks traversed source values and their merged
  4170. * counterparts.
  4171. */
  4172. function baseMerge(object, source, srcIndex, customizer, stack) {
  4173. if (object === source) {
  4174. return;
  4175. }
  4176. baseFor(source, function(srcValue, key) {
  4177. if (isObject(srcValue)) {
  4178. stack || (stack = new Stack);
  4179. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  4180. }
  4181. else {
  4182. var newValue = customizer
  4183. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  4184. : undefined;
  4185. if (newValue === undefined) {
  4186. newValue = srcValue;
  4187. }
  4188. assignMergeValue(object, key, newValue);
  4189. }
  4190. }, keysIn);
  4191. }
  4192. /**
  4193. * A specialized version of `baseMerge` for arrays and objects which performs
  4194. * deep merges and tracks traversed objects enabling objects with circular
  4195. * references to be merged.
  4196. *
  4197. * @private
  4198. * @param {Object} object The destination object.
  4199. * @param {Object} source The source object.
  4200. * @param {string} key The key of the value to merge.
  4201. * @param {number} srcIndex The index of `source`.
  4202. * @param {Function} mergeFunc The function to merge values.
  4203. * @param {Function} [customizer] The function to customize assigned values.
  4204. * @param {Object} [stack] Tracks traversed source values and their merged
  4205. * counterparts.
  4206. */
  4207. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  4208. var objValue = safeGet(object, key),
  4209. srcValue = safeGet(source, key),
  4210. stacked = stack.get(srcValue);
  4211. if (stacked) {
  4212. assignMergeValue(object, key, stacked);
  4213. return;
  4214. }
  4215. var newValue = customizer
  4216. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  4217. : undefined;
  4218. var isCommon = newValue === undefined;
  4219. if (isCommon) {
  4220. var isArr = isArray(srcValue),
  4221. isBuff = !isArr && isBuffer(srcValue),
  4222. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  4223. newValue = srcValue;
  4224. if (isArr || isBuff || isTyped) {
  4225. if (isArray(objValue)) {
  4226. newValue = objValue;
  4227. }
  4228. else if (isArrayLikeObject(objValue)) {
  4229. newValue = copyArray(objValue);
  4230. }
  4231. else if (isBuff) {
  4232. isCommon = false;
  4233. newValue = cloneBuffer(srcValue, true);
  4234. }
  4235. else if (isTyped) {
  4236. isCommon = false;
  4237. newValue = cloneTypedArray(srcValue, true);
  4238. }
  4239. else {
  4240. newValue = [];
  4241. }
  4242. }
  4243. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  4244. newValue = objValue;
  4245. if (isArguments(objValue)) {
  4246. newValue = toPlainObject(objValue);
  4247. }
  4248. else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
  4249. newValue = initCloneObject(srcValue);
  4250. }
  4251. }
  4252. else {
  4253. isCommon = false;
  4254. }
  4255. }
  4256. if (isCommon) {
  4257. // Recursively merge objects and arrays (susceptible to call stack limits).
  4258. stack.set(srcValue, newValue);
  4259. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  4260. stack['delete'](srcValue);
  4261. }
  4262. assignMergeValue(object, key, newValue);
  4263. }
  4264. /**
  4265. * The base implementation of `_.nth` which doesn't coerce arguments.
  4266. *
  4267. * @private
  4268. * @param {Array} array The array to query.
  4269. * @param {number} n The index of the element to return.
  4270. * @returns {*} Returns the nth element of `array`.
  4271. */
  4272. function baseNth(array, n) {
  4273. var length = array.length;
  4274. if (!length) {
  4275. return;
  4276. }
  4277. n += n < 0 ? length : 0;
  4278. return isIndex(n, length) ? array[n] : undefined;
  4279. }
  4280. /**
  4281. * The base implementation of `_.orderBy` without param guards.
  4282. *
  4283. * @private
  4284. * @param {Array|Object} collection The collection to iterate over.
  4285. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  4286. * @param {string[]} orders The sort orders of `iteratees`.
  4287. * @returns {Array} Returns the new sorted array.
  4288. */
  4289. function baseOrderBy(collection, iteratees, orders) {
  4290. var index = -1;
  4291. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  4292. var result = baseMap(collection, function(value, key, collection) {
  4293. var criteria = arrayMap(iteratees, function(iteratee) {
  4294. return iteratee(value);
  4295. });
  4296. return { 'criteria': criteria, 'index': ++index, 'value': value };
  4297. });
  4298. return baseSortBy(result, function(object, other) {
  4299. return compareMultiple(object, other, orders);
  4300. });
  4301. }
  4302. /**
  4303. * The base implementation of `_.pick` without support for individual
  4304. * property identifiers.
  4305. *
  4306. * @private
  4307. * @param {Object} object The source object.
  4308. * @param {string[]} paths The property paths to pick.
  4309. * @returns {Object} Returns the new object.
  4310. */
  4311. function basePick(object, paths) {
  4312. return basePickBy(object, paths, function(value, path) {
  4313. return hasIn(object, path);
  4314. });
  4315. }
  4316. /**
  4317. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  4318. *
  4319. * @private
  4320. * @param {Object} object The source object.
  4321. * @param {string[]} paths The property paths to pick.
  4322. * @param {Function} predicate The function invoked per property.
  4323. * @returns {Object} Returns the new object.
  4324. */
  4325. function basePickBy(object, paths, predicate) {
  4326. var index = -1,
  4327. length = paths.length,
  4328. result = {};
  4329. while (++index < length) {
  4330. var path = paths[index],
  4331. value = baseGet(object, path);
  4332. if (predicate(value, path)) {
  4333. baseSet(result, castPath(path, object), value);
  4334. }
  4335. }
  4336. return result;
  4337. }
  4338. /**
  4339. * A specialized version of `baseProperty` which supports deep paths.
  4340. *
  4341. * @private
  4342. * @param {Array|string} path The path of the property to get.
  4343. * @returns {Function} Returns the new accessor function.
  4344. */
  4345. function basePropertyDeep(path) {
  4346. return function(object) {
  4347. return baseGet(object, path);
  4348. };
  4349. }
  4350. /**
  4351. * The base implementation of `_.pullAllBy` without support for iteratee
  4352. * shorthands.
  4353. *
  4354. * @private
  4355. * @param {Array} array The array to modify.
  4356. * @param {Array} values The values to remove.
  4357. * @param {Function} [iteratee] The iteratee invoked per element.
  4358. * @param {Function} [comparator] The comparator invoked per element.
  4359. * @returns {Array} Returns `array`.
  4360. */
  4361. function basePullAll(array, values, iteratee, comparator) {
  4362. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  4363. index = -1,
  4364. length = values.length,
  4365. seen = array;
  4366. if (array === values) {
  4367. values = copyArray(values);
  4368. }
  4369. if (iteratee) {
  4370. seen = arrayMap(array, baseUnary(iteratee));
  4371. }
  4372. while (++index < length) {
  4373. var fromIndex = 0,
  4374. value = values[index],
  4375. computed = iteratee ? iteratee(value) : value;
  4376. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  4377. if (seen !== array) {
  4378. splice.call(seen, fromIndex, 1);
  4379. }
  4380. splice.call(array, fromIndex, 1);
  4381. }
  4382. }
  4383. return array;
  4384. }
  4385. /**
  4386. * The base implementation of `_.pullAt` without support for individual
  4387. * indexes or capturing the removed elements.
  4388. *
  4389. * @private
  4390. * @param {Array} array The array to modify.
  4391. * @param {number[]} indexes The indexes of elements to remove.
  4392. * @returns {Array} Returns `array`.
  4393. */
  4394. function basePullAt(array, indexes) {
  4395. var length = array ? indexes.length : 0,
  4396. lastIndex = length - 1;
  4397. while (length--) {
  4398. var index = indexes[length];
  4399. if (length == lastIndex || index !== previous) {
  4400. var previous = index;
  4401. if (isIndex(index)) {
  4402. splice.call(array, index, 1);
  4403. } else {
  4404. baseUnset(array, index);
  4405. }
  4406. }
  4407. }
  4408. return array;
  4409. }
  4410. /**
  4411. * The base implementation of `_.random` without support for returning
  4412. * floating-point numbers.
  4413. *
  4414. * @private
  4415. * @param {number} lower The lower bound.
  4416. * @param {number} upper The upper bound.
  4417. * @returns {number} Returns the random number.
  4418. */
  4419. function baseRandom(lower, upper) {
  4420. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  4421. }
  4422. /**
  4423. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  4424. * coerce arguments.
  4425. *
  4426. * @private
  4427. * @param {number} start The start of the range.
  4428. * @param {number} end The end of the range.
  4429. * @param {number} step The value to increment or decrement by.
  4430. * @param {boolean} [fromRight] Specify iterating from right to left.
  4431. * @returns {Array} Returns the range of numbers.
  4432. */
  4433. function baseRange(start, end, step, fromRight) {
  4434. var index = -1,
  4435. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  4436. result = Array(length);
  4437. while (length--) {
  4438. result[fromRight ? length : ++index] = start;
  4439. start += step;
  4440. }
  4441. return result;
  4442. }
  4443. /**
  4444. * The base implementation of `_.repeat` which doesn't coerce arguments.
  4445. *
  4446. * @private
  4447. * @param {string} string The string to repeat.
  4448. * @param {number} n The number of times to repeat the string.
  4449. * @returns {string} Returns the repeated string.
  4450. */
  4451. function baseRepeat(string, n) {
  4452. var result = '';
  4453. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  4454. return result;
  4455. }
  4456. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  4457. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  4458. do {
  4459. if (n % 2) {
  4460. result += string;
  4461. }
  4462. n = nativeFloor(n / 2);
  4463. if (n) {
  4464. string += string;
  4465. }
  4466. } while (n);
  4467. return result;
  4468. }
  4469. /**
  4470. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  4471. *
  4472. * @private
  4473. * @param {Function} func The function to apply a rest parameter to.
  4474. * @param {number} [start=func.length-1] The start position of the rest parameter.
  4475. * @returns {Function} Returns the new function.
  4476. */
  4477. function baseRest(func, start) {
  4478. return setToString(overRest(func, start, identity), func + '');
  4479. }
  4480. /**
  4481. * The base implementation of `_.sample`.
  4482. *
  4483. * @private
  4484. * @param {Array|Object} collection The collection to sample.
  4485. * @returns {*} Returns the random element.
  4486. */
  4487. function baseSample(collection) {
  4488. return arraySample(values(collection));
  4489. }
  4490. /**
  4491. * The base implementation of `_.sampleSize` without param guards.
  4492. *
  4493. * @private
  4494. * @param {Array|Object} collection The collection to sample.
  4495. * @param {number} n The number of elements to sample.
  4496. * @returns {Array} Returns the random elements.
  4497. */
  4498. function baseSampleSize(collection, n) {
  4499. var array = values(collection);
  4500. return shuffleSelf(array, baseClamp(n, 0, array.length));
  4501. }
  4502. /**
  4503. * The base implementation of `_.set`.
  4504. *
  4505. * @private
  4506. * @param {Object} object The object to modify.
  4507. * @param {Array|string} path The path of the property to set.
  4508. * @param {*} value The value to set.
  4509. * @param {Function} [customizer] The function to customize path creation.
  4510. * @returns {Object} Returns `object`.
  4511. */
  4512. function baseSet(object, path, value, customizer) {
  4513. if (!isObject(object)) {
  4514. return object;
  4515. }
  4516. path = castPath(path, object);
  4517. var index = -1,
  4518. length = path.length,
  4519. lastIndex = length - 1,
  4520. nested = object;
  4521. while (nested != null && ++index < length) {
  4522. var key = toKey(path[index]),
  4523. newValue = value;
  4524. if (index != lastIndex) {
  4525. var objValue = nested[key];
  4526. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  4527. if (newValue === undefined) {
  4528. newValue = isObject(objValue)
  4529. ? objValue
  4530. : (isIndex(path[index + 1]) ? [] : {});
  4531. }
  4532. }
  4533. assignValue(nested, key, newValue);
  4534. nested = nested[key];
  4535. }
  4536. return object;
  4537. }
  4538. /**
  4539. * The base implementation of `setData` without support for hot loop shorting.
  4540. *
  4541. * @private
  4542. * @param {Function} func The function to associate metadata with.
  4543. * @param {*} data The metadata.
  4544. * @returns {Function} Returns `func`.
  4545. */
  4546. var baseSetData = !metaMap ? identity : function(func, data) {
  4547. metaMap.set(func, data);
  4548. return func;
  4549. };
  4550. /**
  4551. * The base implementation of `setToString` without support for hot loop shorting.
  4552. *
  4553. * @private
  4554. * @param {Function} func The function to modify.
  4555. * @param {Function} string The `toString` result.
  4556. * @returns {Function} Returns `func`.
  4557. */
  4558. var baseSetToString = !defineProperty ? identity : function(func, string) {
  4559. return defineProperty(func, 'toString', {
  4560. 'configurable': true,
  4561. 'enumerable': false,
  4562. 'value': constant(string),
  4563. 'writable': true
  4564. });
  4565. };
  4566. /**
  4567. * The base implementation of `_.shuffle`.
  4568. *
  4569. * @private
  4570. * @param {Array|Object} collection The collection to shuffle.
  4571. * @returns {Array} Returns the new shuffled array.
  4572. */
  4573. function baseShuffle(collection) {
  4574. return shuffleSelf(values(collection));
  4575. }
  4576. /**
  4577. * The base implementation of `_.slice` without an iteratee call guard.
  4578. *
  4579. * @private
  4580. * @param {Array} array The array to slice.
  4581. * @param {number} [start=0] The start position.
  4582. * @param {number} [end=array.length] The end position.
  4583. * @returns {Array} Returns the slice of `array`.
  4584. */
  4585. function baseSlice(array, start, end) {
  4586. var index = -1,
  4587. length = array.length;
  4588. if (start < 0) {
  4589. start = -start > length ? 0 : (length + start);
  4590. }
  4591. end = end > length ? length : end;
  4592. if (end < 0) {
  4593. end += length;
  4594. }
  4595. length = start > end ? 0 : ((end - start) >>> 0);
  4596. start >>>= 0;
  4597. var result = Array(length);
  4598. while (++index < length) {
  4599. result[index] = array[index + start];
  4600. }
  4601. return result;
  4602. }
  4603. /**
  4604. * The base implementation of `_.some` without support for iteratee shorthands.
  4605. *
  4606. * @private
  4607. * @param {Array|Object} collection The collection to iterate over.
  4608. * @param {Function} predicate The function invoked per iteration.
  4609. * @returns {boolean} Returns `true` if any element passes the predicate check,
  4610. * else `false`.
  4611. */
  4612. function baseSome(collection, predicate) {
  4613. var result;
  4614. baseEach(collection, function(value, index, collection) {
  4615. result = predicate(value, index, collection);
  4616. return !result;
  4617. });
  4618. return !!result;
  4619. }
  4620. /**
  4621. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  4622. * performs a binary search of `array` to determine the index at which `value`
  4623. * should be inserted into `array` in order to maintain its sort order.
  4624. *
  4625. * @private
  4626. * @param {Array} array The sorted array to inspect.
  4627. * @param {*} value The value to evaluate.
  4628. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  4629. * @returns {number} Returns the index at which `value` should be inserted
  4630. * into `array`.
  4631. */
  4632. function baseSortedIndex(array, value, retHighest) {
  4633. var low = 0,
  4634. high = array == null ? low : array.length;
  4635. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  4636. while (low < high) {
  4637. var mid = (low + high) >>> 1,
  4638. computed = array[mid];
  4639. if (computed !== null && !isSymbol(computed) &&
  4640. (retHighest ? (computed <= value) : (computed < value))) {
  4641. low = mid + 1;
  4642. } else {
  4643. high = mid;
  4644. }
  4645. }
  4646. return high;
  4647. }
  4648. return baseSortedIndexBy(array, value, identity, retHighest);
  4649. }
  4650. /**
  4651. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  4652. * which invokes `iteratee` for `value` and each element of `array` to compute
  4653. * their sort ranking. The iteratee is invoked with one argument; (value).
  4654. *
  4655. * @private
  4656. * @param {Array} array The sorted array to inspect.
  4657. * @param {*} value The value to evaluate.
  4658. * @param {Function} iteratee The iteratee invoked per element.
  4659. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  4660. * @returns {number} Returns the index at which `value` should be inserted
  4661. * into `array`.
  4662. */
  4663. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  4664. value = iteratee(value);
  4665. var low = 0,
  4666. high = array == null ? 0 : array.length,
  4667. valIsNaN = value !== value,
  4668. valIsNull = value === null,
  4669. valIsSymbol = isSymbol(value),
  4670. valIsUndefined = value === undefined;
  4671. while (low < high) {
  4672. var mid = nativeFloor((low + high) / 2),
  4673. computed = iteratee(array[mid]),
  4674. othIsDefined = computed !== undefined,
  4675. othIsNull = computed === null,
  4676. othIsReflexive = computed === computed,
  4677. othIsSymbol = isSymbol(computed);
  4678. if (valIsNaN) {
  4679. var setLow = retHighest || othIsReflexive;
  4680. } else if (valIsUndefined) {
  4681. setLow = othIsReflexive && (retHighest || othIsDefined);
  4682. } else if (valIsNull) {
  4683. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  4684. } else if (valIsSymbol) {
  4685. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  4686. } else if (othIsNull || othIsSymbol) {
  4687. setLow = false;
  4688. } else {
  4689. setLow = retHighest ? (computed <= value) : (computed < value);
  4690. }
  4691. if (setLow) {
  4692. low = mid + 1;
  4693. } else {
  4694. high = mid;
  4695. }
  4696. }
  4697. return nativeMin(high, MAX_ARRAY_INDEX);
  4698. }
  4699. /**
  4700. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  4701. * support for iteratee shorthands.
  4702. *
  4703. * @private
  4704. * @param {Array} array The array to inspect.
  4705. * @param {Function} [iteratee] The iteratee invoked per element.
  4706. * @returns {Array} Returns the new duplicate free array.
  4707. */
  4708. function baseSortedUniq(array, iteratee) {
  4709. var index = -1,
  4710. length = array.length,
  4711. resIndex = 0,
  4712. result = [];
  4713. while (++index < length) {
  4714. var value = array[index],
  4715. computed = iteratee ? iteratee(value) : value;
  4716. if (!index || !eq(computed, seen)) {
  4717. var seen = computed;
  4718. result[resIndex++] = value === 0 ? 0 : value;
  4719. }
  4720. }
  4721. return result;
  4722. }
  4723. /**
  4724. * The base implementation of `_.toNumber` which doesn't ensure correct
  4725. * conversions of binary, hexadecimal, or octal string values.
  4726. *
  4727. * @private
  4728. * @param {*} value The value to process.
  4729. * @returns {number} Returns the number.
  4730. */
  4731. function baseToNumber(value) {
  4732. if (typeof value == 'number') {
  4733. return value;
  4734. }
  4735. if (isSymbol(value)) {
  4736. return NAN;
  4737. }
  4738. return +value;
  4739. }
  4740. /**
  4741. * The base implementation of `_.toString` which doesn't convert nullish
  4742. * values to empty strings.
  4743. *
  4744. * @private
  4745. * @param {*} value The value to process.
  4746. * @returns {string} Returns the string.
  4747. */
  4748. function baseToString(value) {
  4749. // Exit early for strings to avoid a performance hit in some environments.
  4750. if (typeof value == 'string') {
  4751. return value;
  4752. }
  4753. if (isArray(value)) {
  4754. // Recursively convert values (susceptible to call stack limits).
  4755. return arrayMap(value, baseToString) + '';
  4756. }
  4757. if (isSymbol(value)) {
  4758. return symbolToString ? symbolToString.call(value) : '';
  4759. }
  4760. var result = (value + '');
  4761. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  4762. }
  4763. /**
  4764. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  4765. *
  4766. * @private
  4767. * @param {Array} array The array to inspect.
  4768. * @param {Function} [iteratee] The iteratee invoked per element.
  4769. * @param {Function} [comparator] The comparator invoked per element.
  4770. * @returns {Array} Returns the new duplicate free array.
  4771. */
  4772. function baseUniq(array, iteratee, comparator) {
  4773. var index = -1,
  4774. includes = arrayIncludes,
  4775. length = array.length,
  4776. isCommon = true,
  4777. result = [],
  4778. seen = result;
  4779. if (comparator) {
  4780. isCommon = false;
  4781. includes = arrayIncludesWith;
  4782. }
  4783. else if (length >= LARGE_ARRAY_SIZE) {
  4784. var set = iteratee ? null : createSet(array);
  4785. if (set) {
  4786. return setToArray(set);
  4787. }
  4788. isCommon = false;
  4789. includes = cacheHas;
  4790. seen = new SetCache;
  4791. }
  4792. else {
  4793. seen = iteratee ? [] : result;
  4794. }
  4795. outer:
  4796. while (++index < length) {
  4797. var value = array[index],
  4798. computed = iteratee ? iteratee(value) : value;
  4799. value = (comparator || value !== 0) ? value : 0;
  4800. if (isCommon && computed === computed) {
  4801. var seenIndex = seen.length;
  4802. while (seenIndex--) {
  4803. if (seen[seenIndex] === computed) {
  4804. continue outer;
  4805. }
  4806. }
  4807. if (iteratee) {
  4808. seen.push(computed);
  4809. }
  4810. result.push(value);
  4811. }
  4812. else if (!includes(seen, computed, comparator)) {
  4813. if (seen !== result) {
  4814. seen.push(computed);
  4815. }
  4816. result.push(value);
  4817. }
  4818. }
  4819. return result;
  4820. }
  4821. /**
  4822. * The base implementation of `_.unset`.
  4823. *
  4824. * @private
  4825. * @param {Object} object The object to modify.
  4826. * @param {Array|string} path The property path to unset.
  4827. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  4828. */
  4829. function baseUnset(object, path) {
  4830. path = castPath(path, object);
  4831. object = parent(object, path);
  4832. return object == null || delete object[toKey(last(path))];
  4833. }
  4834. /**
  4835. * The base implementation of `_.update`.
  4836. *
  4837. * @private
  4838. * @param {Object} object The object to modify.
  4839. * @param {Array|string} path The path of the property to update.
  4840. * @param {Function} updater The function to produce the updated value.
  4841. * @param {Function} [customizer] The function to customize path creation.
  4842. * @returns {Object} Returns `object`.
  4843. */
  4844. function baseUpdate(object, path, updater, customizer) {
  4845. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  4846. }
  4847. /**
  4848. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  4849. * without support for iteratee shorthands.
  4850. *
  4851. * @private
  4852. * @param {Array} array The array to query.
  4853. * @param {Function} predicate The function invoked per iteration.
  4854. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  4855. * @param {boolean} [fromRight] Specify iterating from right to left.
  4856. * @returns {Array} Returns the slice of `array`.
  4857. */
  4858. function baseWhile(array, predicate, isDrop, fromRight) {
  4859. var length = array.length,
  4860. index = fromRight ? length : -1;
  4861. while ((fromRight ? index-- : ++index < length) &&
  4862. predicate(array[index], index, array)) {}
  4863. return isDrop
  4864. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  4865. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  4866. }
  4867. /**
  4868. * The base implementation of `wrapperValue` which returns the result of
  4869. * performing a sequence of actions on the unwrapped `value`, where each
  4870. * successive action is supplied the return value of the previous.
  4871. *
  4872. * @private
  4873. * @param {*} value The unwrapped value.
  4874. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  4875. * @returns {*} Returns the resolved value.
  4876. */
  4877. function baseWrapperValue(value, actions) {
  4878. var result = value;
  4879. if (result instanceof LazyWrapper) {
  4880. result = result.value();
  4881. }
  4882. return arrayReduce(actions, function(result, action) {
  4883. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  4884. }, result);
  4885. }
  4886. /**
  4887. * The base implementation of methods like `_.xor`, without support for
  4888. * iteratee shorthands, that accepts an array of arrays to inspect.
  4889. *
  4890. * @private
  4891. * @param {Array} arrays The arrays to inspect.
  4892. * @param {Function} [iteratee] The iteratee invoked per element.
  4893. * @param {Function} [comparator] The comparator invoked per element.
  4894. * @returns {Array} Returns the new array of values.
  4895. */
  4896. function baseXor(arrays, iteratee, comparator) {
  4897. var length = arrays.length;
  4898. if (length < 2) {
  4899. return length ? baseUniq(arrays[0]) : [];
  4900. }
  4901. var index = -1,
  4902. result = Array(length);
  4903. while (++index < length) {
  4904. var array = arrays[index],
  4905. othIndex = -1;
  4906. while (++othIndex < length) {
  4907. if (othIndex != index) {
  4908. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  4909. }
  4910. }
  4911. }
  4912. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  4913. }
  4914. /**
  4915. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  4916. *
  4917. * @private
  4918. * @param {Array} props The property identifiers.
  4919. * @param {Array} values The property values.
  4920. * @param {Function} assignFunc The function to assign values.
  4921. * @returns {Object} Returns the new object.
  4922. */
  4923. function baseZipObject(props, values, assignFunc) {
  4924. var index = -1,
  4925. length = props.length,
  4926. valsLength = values.length,
  4927. result = {};
  4928. while (++index < length) {
  4929. var value = index < valsLength ? values[index] : undefined;
  4930. assignFunc(result, props[index], value);
  4931. }
  4932. return result;
  4933. }
  4934. /**
  4935. * Casts `value` to an empty array if it's not an array like object.
  4936. *
  4937. * @private
  4938. * @param {*} value The value to inspect.
  4939. * @returns {Array|Object} Returns the cast array-like object.
  4940. */
  4941. function castArrayLikeObject(value) {
  4942. return isArrayLikeObject(value) ? value : [];
  4943. }
  4944. /**
  4945. * Casts `value` to `identity` if it's not a function.
  4946. *
  4947. * @private
  4948. * @param {*} value The value to inspect.
  4949. * @returns {Function} Returns cast function.
  4950. */
  4951. function castFunction(value) {
  4952. return typeof value == 'function' ? value : identity;
  4953. }
  4954. /**
  4955. * Casts `value` to a path array if it's not one.
  4956. *
  4957. * @private
  4958. * @param {*} value The value to inspect.
  4959. * @param {Object} [object] The object to query keys on.
  4960. * @returns {Array} Returns the cast property path array.
  4961. */
  4962. function castPath(value, object) {
  4963. if (isArray(value)) {
  4964. return value;
  4965. }
  4966. return isKey(value, object) ? [value] : stringToPath(toString(value));
  4967. }
  4968. /**
  4969. * A `baseRest` alias which can be replaced with `identity` by module
  4970. * replacement plugins.
  4971. *
  4972. * @private
  4973. * @type {Function}
  4974. * @param {Function} func The function to apply a rest parameter to.
  4975. * @returns {Function} Returns the new function.
  4976. */
  4977. var castRest = baseRest;
  4978. /**
  4979. * Casts `array` to a slice if it's needed.
  4980. *
  4981. * @private
  4982. * @param {Array} array The array to inspect.
  4983. * @param {number} start The start position.
  4984. * @param {number} [end=array.length] The end position.
  4985. * @returns {Array} Returns the cast slice.
  4986. */
  4987. function castSlice(array, start, end) {
  4988. var length = array.length;
  4989. end = end === undefined ? length : end;
  4990. return (!start && end >= length) ? array : baseSlice(array, start, end);
  4991. }
  4992. /**
  4993. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  4994. *
  4995. * @private
  4996. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  4997. */
  4998. var clearTimeout = ctxClearTimeout || function(id) {
  4999. return root.clearTimeout(id);
  5000. };
  5001. /**
  5002. * Creates a clone of `buffer`.
  5003. *
  5004. * @private
  5005. * @param {Buffer} buffer The buffer to clone.
  5006. * @param {boolean} [isDeep] Specify a deep clone.
  5007. * @returns {Buffer} Returns the cloned buffer.
  5008. */
  5009. function cloneBuffer(buffer, isDeep) {
  5010. if (isDeep) {
  5011. return buffer.slice();
  5012. }
  5013. var length = buffer.length,
  5014. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  5015. buffer.copy(result);
  5016. return result;
  5017. }
  5018. /**
  5019. * Creates a clone of `arrayBuffer`.
  5020. *
  5021. * @private
  5022. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  5023. * @returns {ArrayBuffer} Returns the cloned array buffer.
  5024. */
  5025. function cloneArrayBuffer(arrayBuffer) {
  5026. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  5027. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  5028. return result;
  5029. }
  5030. /**
  5031. * Creates a clone of `dataView`.
  5032. *
  5033. * @private
  5034. * @param {Object} dataView The data view to clone.
  5035. * @param {boolean} [isDeep] Specify a deep clone.
  5036. * @returns {Object} Returns the cloned data view.
  5037. */
  5038. function cloneDataView(dataView, isDeep) {
  5039. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  5040. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  5041. }
  5042. /**
  5043. * Creates a clone of `regexp`.
  5044. *
  5045. * @private
  5046. * @param {Object} regexp The regexp to clone.
  5047. * @returns {Object} Returns the cloned regexp.
  5048. */
  5049. function cloneRegExp(regexp) {
  5050. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  5051. result.lastIndex = regexp.lastIndex;
  5052. return result;
  5053. }
  5054. /**
  5055. * Creates a clone of the `symbol` object.
  5056. *
  5057. * @private
  5058. * @param {Object} symbol The symbol object to clone.
  5059. * @returns {Object} Returns the cloned symbol object.
  5060. */
  5061. function cloneSymbol(symbol) {
  5062. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  5063. }
  5064. /**
  5065. * Creates a clone of `typedArray`.
  5066. *
  5067. * @private
  5068. * @param {Object} typedArray The typed array to clone.
  5069. * @param {boolean} [isDeep] Specify a deep clone.
  5070. * @returns {Object} Returns the cloned typed array.
  5071. */
  5072. function cloneTypedArray(typedArray, isDeep) {
  5073. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  5074. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  5075. }
  5076. /**
  5077. * Compares values to sort them in ascending order.
  5078. *
  5079. * @private
  5080. * @param {*} value The value to compare.
  5081. * @param {*} other The other value to compare.
  5082. * @returns {number} Returns the sort order indicator for `value`.
  5083. */
  5084. function compareAscending(value, other) {
  5085. if (value !== other) {
  5086. var valIsDefined = value !== undefined,
  5087. valIsNull = value === null,
  5088. valIsReflexive = value === value,
  5089. valIsSymbol = isSymbol(value);
  5090. var othIsDefined = other !== undefined,
  5091. othIsNull = other === null,
  5092. othIsReflexive = other === other,
  5093. othIsSymbol = isSymbol(other);
  5094. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  5095. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  5096. (valIsNull && othIsDefined && othIsReflexive) ||
  5097. (!valIsDefined && othIsReflexive) ||
  5098. !valIsReflexive) {
  5099. return 1;
  5100. }
  5101. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  5102. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  5103. (othIsNull && valIsDefined && valIsReflexive) ||
  5104. (!othIsDefined && valIsReflexive) ||
  5105. !othIsReflexive) {
  5106. return -1;
  5107. }
  5108. }
  5109. return 0;
  5110. }
  5111. /**
  5112. * Used by `_.orderBy` to compare multiple properties of a value to another
  5113. * and stable sort them.
  5114. *
  5115. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  5116. * specify an order of "desc" for descending or "asc" for ascending sort order
  5117. * of corresponding values.
  5118. *
  5119. * @private
  5120. * @param {Object} object The object to compare.
  5121. * @param {Object} other The other object to compare.
  5122. * @param {boolean[]|string[]} orders The order to sort by for each property.
  5123. * @returns {number} Returns the sort order indicator for `object`.
  5124. */
  5125. function compareMultiple(object, other, orders) {
  5126. var index = -1,
  5127. objCriteria = object.criteria,
  5128. othCriteria = other.criteria,
  5129. length = objCriteria.length,
  5130. ordersLength = orders.length;
  5131. while (++index < length) {
  5132. var result = compareAscending(objCriteria[index], othCriteria[index]);
  5133. if (result) {
  5134. if (index >= ordersLength) {
  5135. return result;
  5136. }
  5137. var order = orders[index];
  5138. return result * (order == 'desc' ? -1 : 1);
  5139. }
  5140. }
  5141. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  5142. // that causes it, under certain circumstances, to provide the same value for
  5143. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  5144. // for more details.
  5145. //
  5146. // This also ensures a stable sort in V8 and other engines.
  5147. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  5148. return object.index - other.index;
  5149. }
  5150. /**
  5151. * Creates an array that is the composition of partially applied arguments,
  5152. * placeholders, and provided arguments into a single array of arguments.
  5153. *
  5154. * @private
  5155. * @param {Array} args The provided arguments.
  5156. * @param {Array} partials The arguments to prepend to those provided.
  5157. * @param {Array} holders The `partials` placeholder indexes.
  5158. * @params {boolean} [isCurried] Specify composing for a curried function.
  5159. * @returns {Array} Returns the new array of composed arguments.
  5160. */
  5161. function composeArgs(args, partials, holders, isCurried) {
  5162. var argsIndex = -1,
  5163. argsLength = args.length,
  5164. holdersLength = holders.length,
  5165. leftIndex = -1,
  5166. leftLength = partials.length,
  5167. rangeLength = nativeMax(argsLength - holdersLength, 0),
  5168. result = Array(leftLength + rangeLength),
  5169. isUncurried = !isCurried;
  5170. while (++leftIndex < leftLength) {
  5171. result[leftIndex] = partials[leftIndex];
  5172. }
  5173. while (++argsIndex < holdersLength) {
  5174. if (isUncurried || argsIndex < argsLength) {
  5175. result[holders[argsIndex]] = args[argsIndex];
  5176. }
  5177. }
  5178. while (rangeLength--) {
  5179. result[leftIndex++] = args[argsIndex++];
  5180. }
  5181. return result;
  5182. }
  5183. /**
  5184. * This function is like `composeArgs` except that the arguments composition
  5185. * is tailored for `_.partialRight`.
  5186. *
  5187. * @private
  5188. * @param {Array} args The provided arguments.
  5189. * @param {Array} partials The arguments to append to those provided.
  5190. * @param {Array} holders The `partials` placeholder indexes.
  5191. * @params {boolean} [isCurried] Specify composing for a curried function.
  5192. * @returns {Array} Returns the new array of composed arguments.
  5193. */
  5194. function composeArgsRight(args, partials, holders, isCurried) {
  5195. var argsIndex = -1,
  5196. argsLength = args.length,
  5197. holdersIndex = -1,
  5198. holdersLength = holders.length,
  5199. rightIndex = -1,
  5200. rightLength = partials.length,
  5201. rangeLength = nativeMax(argsLength - holdersLength, 0),
  5202. result = Array(rangeLength + rightLength),
  5203. isUncurried = !isCurried;
  5204. while (++argsIndex < rangeLength) {
  5205. result[argsIndex] = args[argsIndex];
  5206. }
  5207. var offset = argsIndex;
  5208. while (++rightIndex < rightLength) {
  5209. result[offset + rightIndex] = partials[rightIndex];
  5210. }
  5211. while (++holdersIndex < holdersLength) {
  5212. if (isUncurried || argsIndex < argsLength) {
  5213. result[offset + holders[holdersIndex]] = args[argsIndex++];
  5214. }
  5215. }
  5216. return result;
  5217. }
  5218. /**
  5219. * Copies the values of `source` to `array`.
  5220. *
  5221. * @private
  5222. * @param {Array} source The array to copy values from.
  5223. * @param {Array} [array=[]] The array to copy values to.
  5224. * @returns {Array} Returns `array`.
  5225. */
  5226. function copyArray(source, array) {
  5227. var index = -1,
  5228. length = source.length;
  5229. array || (array = Array(length));
  5230. while (++index < length) {
  5231. array[index] = source[index];
  5232. }
  5233. return array;
  5234. }
  5235. /**
  5236. * Copies properties of `source` to `object`.
  5237. *
  5238. * @private
  5239. * @param {Object} source The object to copy properties from.
  5240. * @param {Array} props The property identifiers to copy.
  5241. * @param {Object} [object={}] The object to copy properties to.
  5242. * @param {Function} [customizer] The function to customize copied values.
  5243. * @returns {Object} Returns `object`.
  5244. */
  5245. function copyObject(source, props, object, customizer) {
  5246. var isNew = !object;
  5247. object || (object = {});
  5248. var index = -1,
  5249. length = props.length;
  5250. while (++index < length) {
  5251. var key = props[index];
  5252. var newValue = customizer
  5253. ? customizer(object[key], source[key], key, object, source)
  5254. : undefined;
  5255. if (newValue === undefined) {
  5256. newValue = source[key];
  5257. }
  5258. if (isNew) {
  5259. baseAssignValue(object, key, newValue);
  5260. } else {
  5261. assignValue(object, key, newValue);
  5262. }
  5263. }
  5264. return object;
  5265. }
  5266. /**
  5267. * Copies own symbols of `source` to `object`.
  5268. *
  5269. * @private
  5270. * @param {Object} source The object to copy symbols from.
  5271. * @param {Object} [object={}] The object to copy symbols to.
  5272. * @returns {Object} Returns `object`.
  5273. */
  5274. function copySymbols(source, object) {
  5275. return copyObject(source, getSymbols(source), object);
  5276. }
  5277. /**
  5278. * Copies own and inherited symbols of `source` to `object`.
  5279. *
  5280. * @private
  5281. * @param {Object} source The object to copy symbols from.
  5282. * @param {Object} [object={}] The object to copy symbols to.
  5283. * @returns {Object} Returns `object`.
  5284. */
  5285. function copySymbolsIn(source, object) {
  5286. return copyObject(source, getSymbolsIn(source), object);
  5287. }
  5288. /**
  5289. * Creates a function like `_.groupBy`.
  5290. *
  5291. * @private
  5292. * @param {Function} setter The function to set accumulator values.
  5293. * @param {Function} [initializer] The accumulator object initializer.
  5294. * @returns {Function} Returns the new aggregator function.
  5295. */
  5296. function createAggregator(setter, initializer) {
  5297. return function(collection, iteratee) {
  5298. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  5299. accumulator = initializer ? initializer() : {};
  5300. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  5301. };
  5302. }
  5303. /**
  5304. * Creates a function like `_.assign`.
  5305. *
  5306. * @private
  5307. * @param {Function} assigner The function to assign values.
  5308. * @returns {Function} Returns the new assigner function.
  5309. */
  5310. function createAssigner(assigner) {
  5311. return baseRest(function(object, sources) {
  5312. var index = -1,
  5313. length = sources.length,
  5314. customizer = length > 1 ? sources[length - 1] : undefined,
  5315. guard = length > 2 ? sources[2] : undefined;
  5316. customizer = (assigner.length > 3 && typeof customizer == 'function')
  5317. ? (length--, customizer)
  5318. : undefined;
  5319. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  5320. customizer = length < 3 ? undefined : customizer;
  5321. length = 1;
  5322. }
  5323. object = Object(object);
  5324. while (++index < length) {
  5325. var source = sources[index];
  5326. if (source) {
  5327. assigner(object, source, index, customizer);
  5328. }
  5329. }
  5330. return object;
  5331. });
  5332. }
  5333. /**
  5334. * Creates a `baseEach` or `baseEachRight` function.
  5335. *
  5336. * @private
  5337. * @param {Function} eachFunc The function to iterate over a collection.
  5338. * @param {boolean} [fromRight] Specify iterating from right to left.
  5339. * @returns {Function} Returns the new base function.
  5340. */
  5341. function createBaseEach(eachFunc, fromRight) {
  5342. return function(collection, iteratee) {
  5343. if (collection == null) {
  5344. return collection;
  5345. }
  5346. if (!isArrayLike(collection)) {
  5347. return eachFunc(collection, iteratee);
  5348. }
  5349. var length = collection.length,
  5350. index = fromRight ? length : -1,
  5351. iterable = Object(collection);
  5352. while ((fromRight ? index-- : ++index < length)) {
  5353. if (iteratee(iterable[index], index, iterable) === false) {
  5354. break;
  5355. }
  5356. }
  5357. return collection;
  5358. };
  5359. }
  5360. /**
  5361. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  5362. *
  5363. * @private
  5364. * @param {boolean} [fromRight] Specify iterating from right to left.
  5365. * @returns {Function} Returns the new base function.
  5366. */
  5367. function createBaseFor(fromRight) {
  5368. return function(object, iteratee, keysFunc) {
  5369. var index = -1,
  5370. iterable = Object(object),
  5371. props = keysFunc(object),
  5372. length = props.length;
  5373. while (length--) {
  5374. var key = props[fromRight ? length : ++index];
  5375. if (iteratee(iterable[key], key, iterable) === false) {
  5376. break;
  5377. }
  5378. }
  5379. return object;
  5380. };
  5381. }
  5382. /**
  5383. * Creates a function that wraps `func` to invoke it with the optional `this`
  5384. * binding of `thisArg`.
  5385. *
  5386. * @private
  5387. * @param {Function} func The function to wrap.
  5388. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  5389. * @param {*} [thisArg] The `this` binding of `func`.
  5390. * @returns {Function} Returns the new wrapped function.
  5391. */
  5392. function createBind(func, bitmask, thisArg) {
  5393. var isBind = bitmask & WRAP_BIND_FLAG,
  5394. Ctor = createCtor(func);
  5395. function wrapper() {
  5396. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  5397. return fn.apply(isBind ? thisArg : this, arguments);
  5398. }
  5399. return wrapper;
  5400. }
  5401. /**
  5402. * Creates a function like `_.lowerFirst`.
  5403. *
  5404. * @private
  5405. * @param {string} methodName The name of the `String` case method to use.
  5406. * @returns {Function} Returns the new case function.
  5407. */
  5408. function createCaseFirst(methodName) {
  5409. return function(string) {
  5410. string = toString(string);
  5411. var strSymbols = hasUnicode(string)
  5412. ? stringToArray(string)
  5413. : undefined;
  5414. var chr = strSymbols
  5415. ? strSymbols[0]
  5416. : string.charAt(0);
  5417. var trailing = strSymbols
  5418. ? castSlice(strSymbols, 1).join('')
  5419. : string.slice(1);
  5420. return chr[methodName]() + trailing;
  5421. };
  5422. }
  5423. /**
  5424. * Creates a function like `_.camelCase`.
  5425. *
  5426. * @private
  5427. * @param {Function} callback The function to combine each word.
  5428. * @returns {Function} Returns the new compounder function.
  5429. */
  5430. function createCompounder(callback) {
  5431. return function(string) {
  5432. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  5433. };
  5434. }
  5435. /**
  5436. * Creates a function that produces an instance of `Ctor` regardless of
  5437. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  5438. *
  5439. * @private
  5440. * @param {Function} Ctor The constructor to wrap.
  5441. * @returns {Function} Returns the new wrapped function.
  5442. */
  5443. function createCtor(Ctor) {
  5444. return function() {
  5445. // Use a `switch` statement to work with class constructors. See
  5446. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  5447. // for more details.
  5448. var args = arguments;
  5449. switch (args.length) {
  5450. case 0: return new Ctor;
  5451. case 1: return new Ctor(args[0]);
  5452. case 2: return new Ctor(args[0], args[1]);
  5453. case 3: return new Ctor(args[0], args[1], args[2]);
  5454. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  5455. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  5456. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  5457. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  5458. }
  5459. var thisBinding = baseCreate(Ctor.prototype),
  5460. result = Ctor.apply(thisBinding, args);
  5461. // Mimic the constructor's `return` behavior.
  5462. // See https://es5.github.io/#x13.2.2 for more details.
  5463. return isObject(result) ? result : thisBinding;
  5464. };
  5465. }
  5466. /**
  5467. * Creates a function that wraps `func` to enable currying.
  5468. *
  5469. * @private
  5470. * @param {Function} func The function to wrap.
  5471. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  5472. * @param {number} arity The arity of `func`.
  5473. * @returns {Function} Returns the new wrapped function.
  5474. */
  5475. function createCurry(func, bitmask, arity) {
  5476. var Ctor = createCtor(func);
  5477. function wrapper() {
  5478. var length = arguments.length,
  5479. args = Array(length),
  5480. index = length,
  5481. placeholder = getHolder(wrapper);
  5482. while (index--) {
  5483. args[index] = arguments[index];
  5484. }
  5485. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  5486. ? []
  5487. : replaceHolders(args, placeholder);
  5488. length -= holders.length;
  5489. if (length < arity) {
  5490. return createRecurry(
  5491. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  5492. args, holders, undefined, undefined, arity - length);
  5493. }
  5494. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  5495. return apply(fn, this, args);
  5496. }
  5497. return wrapper;
  5498. }
  5499. /**
  5500. * Creates a `_.find` or `_.findLast` function.
  5501. *
  5502. * @private
  5503. * @param {Function} findIndexFunc The function to find the collection index.
  5504. * @returns {Function} Returns the new find function.
  5505. */
  5506. function createFind(findIndexFunc) {
  5507. return function(collection, predicate, fromIndex) {
  5508. var iterable = Object(collection);
  5509. if (!isArrayLike(collection)) {
  5510. var iteratee = getIteratee(predicate, 3);
  5511. collection = keys(collection);
  5512. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  5513. }
  5514. var index = findIndexFunc(collection, predicate, fromIndex);
  5515. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  5516. };
  5517. }
  5518. /**
  5519. * Creates a `_.flow` or `_.flowRight` function.
  5520. *
  5521. * @private
  5522. * @param {boolean} [fromRight] Specify iterating from right to left.
  5523. * @returns {Function} Returns the new flow function.
  5524. */
  5525. function createFlow(fromRight) {
  5526. return flatRest(function(funcs) {
  5527. var length = funcs.length,
  5528. index = length,
  5529. prereq = LodashWrapper.prototype.thru;
  5530. if (fromRight) {
  5531. funcs.reverse();
  5532. }
  5533. while (index--) {
  5534. var func = funcs[index];
  5535. if (typeof func != 'function') {
  5536. throw new TypeError(FUNC_ERROR_TEXT);
  5537. }
  5538. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  5539. var wrapper = new LodashWrapper([], true);
  5540. }
  5541. }
  5542. index = wrapper ? index : length;
  5543. while (++index < length) {
  5544. func = funcs[index];
  5545. var funcName = getFuncName(func),
  5546. data = funcName == 'wrapper' ? getData(func) : undefined;
  5547. if (data && isLaziable(data[0]) &&
  5548. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  5549. !data[4].length && data[9] == 1
  5550. ) {
  5551. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  5552. } else {
  5553. wrapper = (func.length == 1 && isLaziable(func))
  5554. ? wrapper[funcName]()
  5555. : wrapper.thru(func);
  5556. }
  5557. }
  5558. return function() {
  5559. var args = arguments,
  5560. value = args[0];
  5561. if (wrapper && args.length == 1 && isArray(value)) {
  5562. return wrapper.plant(value).value();
  5563. }
  5564. var index = 0,
  5565. result = length ? funcs[index].apply(this, args) : value;
  5566. while (++index < length) {
  5567. result = funcs[index].call(this, result);
  5568. }
  5569. return result;
  5570. };
  5571. });
  5572. }
  5573. /**
  5574. * Creates a function that wraps `func` to invoke it with optional `this`
  5575. * binding of `thisArg`, partial application, and currying.
  5576. *
  5577. * @private
  5578. * @param {Function|string} func The function or method name to wrap.
  5579. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  5580. * @param {*} [thisArg] The `this` binding of `func`.
  5581. * @param {Array} [partials] The arguments to prepend to those provided to
  5582. * the new function.
  5583. * @param {Array} [holders] The `partials` placeholder indexes.
  5584. * @param {Array} [partialsRight] The arguments to append to those provided
  5585. * to the new function.
  5586. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  5587. * @param {Array} [argPos] The argument positions of the new function.
  5588. * @param {number} [ary] The arity cap of `func`.
  5589. * @param {number} [arity] The arity of `func`.
  5590. * @returns {Function} Returns the new wrapped function.
  5591. */
  5592. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  5593. var isAry = bitmask & WRAP_ARY_FLAG,
  5594. isBind = bitmask & WRAP_BIND_FLAG,
  5595. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  5596. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  5597. isFlip = bitmask & WRAP_FLIP_FLAG,
  5598. Ctor = isBindKey ? undefined : createCtor(func);
  5599. function wrapper() {
  5600. var length = arguments.length,
  5601. args = Array(length),
  5602. index = length;
  5603. while (index--) {
  5604. args[index] = arguments[index];
  5605. }
  5606. if (isCurried) {
  5607. var placeholder = getHolder(wrapper),
  5608. holdersCount = countHolders(args, placeholder);
  5609. }
  5610. if (partials) {
  5611. args = composeArgs(args, partials, holders, isCurried);
  5612. }
  5613. if (partialsRight) {
  5614. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  5615. }
  5616. length -= holdersCount;
  5617. if (isCurried && length < arity) {
  5618. var newHolders = replaceHolders(args, placeholder);
  5619. return createRecurry(
  5620. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  5621. args, newHolders, argPos, ary, arity - length
  5622. );
  5623. }
  5624. var thisBinding = isBind ? thisArg : this,
  5625. fn = isBindKey ? thisBinding[func] : func;
  5626. length = args.length;
  5627. if (argPos) {
  5628. args = reorder(args, argPos);
  5629. } else if (isFlip && length > 1) {
  5630. args.reverse();
  5631. }
  5632. if (isAry && ary < length) {
  5633. args.length = ary;
  5634. }
  5635. if (this && this !== root && this instanceof wrapper) {
  5636. fn = Ctor || createCtor(fn);
  5637. }
  5638. return fn.apply(thisBinding, args);
  5639. }
  5640. return wrapper;
  5641. }
  5642. /**
  5643. * Creates a function like `_.invertBy`.
  5644. *
  5645. * @private
  5646. * @param {Function} setter The function to set accumulator values.
  5647. * @param {Function} toIteratee The function to resolve iteratees.
  5648. * @returns {Function} Returns the new inverter function.
  5649. */
  5650. function createInverter(setter, toIteratee) {
  5651. return function(object, iteratee) {
  5652. return baseInverter(object, setter, toIteratee(iteratee), {});
  5653. };
  5654. }
  5655. /**
  5656. * Creates a function that performs a mathematical operation on two values.
  5657. *
  5658. * @private
  5659. * @param {Function} operator The function to perform the operation.
  5660. * @param {number} [defaultValue] The value used for `undefined` arguments.
  5661. * @returns {Function} Returns the new mathematical operation function.
  5662. */
  5663. function createMathOperation(operator, defaultValue) {
  5664. return function(value, other) {
  5665. var result;
  5666. if (value === undefined && other === undefined) {
  5667. return defaultValue;
  5668. }
  5669. if (value !== undefined) {
  5670. result = value;
  5671. }
  5672. if (other !== undefined) {
  5673. if (result === undefined) {
  5674. return other;
  5675. }
  5676. if (typeof value == 'string' || typeof other == 'string') {
  5677. value = baseToString(value);
  5678. other = baseToString(other);
  5679. } else {
  5680. value = baseToNumber(value);
  5681. other = baseToNumber(other);
  5682. }
  5683. result = operator(value, other);
  5684. }
  5685. return result;
  5686. };
  5687. }
  5688. /**
  5689. * Creates a function like `_.over`.
  5690. *
  5691. * @private
  5692. * @param {Function} arrayFunc The function to iterate over iteratees.
  5693. * @returns {Function} Returns the new over function.
  5694. */
  5695. function createOver(arrayFunc) {
  5696. return flatRest(function(iteratees) {
  5697. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  5698. return baseRest(function(args) {
  5699. var thisArg = this;
  5700. return arrayFunc(iteratees, function(iteratee) {
  5701. return apply(iteratee, thisArg, args);
  5702. });
  5703. });
  5704. });
  5705. }
  5706. /**
  5707. * Creates the padding for `string` based on `length`. The `chars` string
  5708. * is truncated if the number of characters exceeds `length`.
  5709. *
  5710. * @private
  5711. * @param {number} length The padding length.
  5712. * @param {string} [chars=' '] The string used as padding.
  5713. * @returns {string} Returns the padding for `string`.
  5714. */
  5715. function createPadding(length, chars) {
  5716. chars = chars === undefined ? ' ' : baseToString(chars);
  5717. var charsLength = chars.length;
  5718. if (charsLength < 2) {
  5719. return charsLength ? baseRepeat(chars, length) : chars;
  5720. }
  5721. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  5722. return hasUnicode(chars)
  5723. ? castSlice(stringToArray(result), 0, length).join('')
  5724. : result.slice(0, length);
  5725. }
  5726. /**
  5727. * Creates a function that wraps `func` to invoke it with the `this` binding
  5728. * of `thisArg` and `partials` prepended to the arguments it receives.
  5729. *
  5730. * @private
  5731. * @param {Function} func The function to wrap.
  5732. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  5733. * @param {*} thisArg The `this` binding of `func`.
  5734. * @param {Array} partials The arguments to prepend to those provided to
  5735. * the new function.
  5736. * @returns {Function} Returns the new wrapped function.
  5737. */
  5738. function createPartial(func, bitmask, thisArg, partials) {
  5739. var isBind = bitmask & WRAP_BIND_FLAG,
  5740. Ctor = createCtor(func);
  5741. function wrapper() {
  5742. var argsIndex = -1,
  5743. argsLength = arguments.length,
  5744. leftIndex = -1,
  5745. leftLength = partials.length,
  5746. args = Array(leftLength + argsLength),
  5747. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  5748. while (++leftIndex < leftLength) {
  5749. args[leftIndex] = partials[leftIndex];
  5750. }
  5751. while (argsLength--) {
  5752. args[leftIndex++] = arguments[++argsIndex];
  5753. }
  5754. return apply(fn, isBind ? thisArg : this, args);
  5755. }
  5756. return wrapper;
  5757. }
  5758. /**
  5759. * Creates a `_.range` or `_.rangeRight` function.
  5760. *
  5761. * @private
  5762. * @param {boolean} [fromRight] Specify iterating from right to left.
  5763. * @returns {Function} Returns the new range function.
  5764. */
  5765. function createRange(fromRight) {
  5766. return function(start, end, step) {
  5767. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  5768. end = step = undefined;
  5769. }
  5770. // Ensure the sign of `-0` is preserved.
  5771. start = toFinite(start);
  5772. if (end === undefined) {
  5773. end = start;
  5774. start = 0;
  5775. } else {
  5776. end = toFinite(end);
  5777. }
  5778. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  5779. return baseRange(start, end, step, fromRight);
  5780. };
  5781. }
  5782. /**
  5783. * Creates a function that performs a relational operation on two values.
  5784. *
  5785. * @private
  5786. * @param {Function} operator The function to perform the operation.
  5787. * @returns {Function} Returns the new relational operation function.
  5788. */
  5789. function createRelationalOperation(operator) {
  5790. return function(value, other) {
  5791. if (!(typeof value == 'string' && typeof other == 'string')) {
  5792. value = toNumber(value);
  5793. other = toNumber(other);
  5794. }
  5795. return operator(value, other);
  5796. };
  5797. }
  5798. /**
  5799. * Creates a function that wraps `func` to continue currying.
  5800. *
  5801. * @private
  5802. * @param {Function} func The function to wrap.
  5803. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  5804. * @param {Function} wrapFunc The function to create the `func` wrapper.
  5805. * @param {*} placeholder The placeholder value.
  5806. * @param {*} [thisArg] The `this` binding of `func`.
  5807. * @param {Array} [partials] The arguments to prepend to those provided to
  5808. * the new function.
  5809. * @param {Array} [holders] The `partials` placeholder indexes.
  5810. * @param {Array} [argPos] The argument positions of the new function.
  5811. * @param {number} [ary] The arity cap of `func`.
  5812. * @param {number} [arity] The arity of `func`.
  5813. * @returns {Function} Returns the new wrapped function.
  5814. */
  5815. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  5816. var isCurry = bitmask & WRAP_CURRY_FLAG,
  5817. newHolders = isCurry ? holders : undefined,
  5818. newHoldersRight = isCurry ? undefined : holders,
  5819. newPartials = isCurry ? partials : undefined,
  5820. newPartialsRight = isCurry ? undefined : partials;
  5821. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  5822. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  5823. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  5824. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  5825. }
  5826. var newData = [
  5827. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  5828. newHoldersRight, argPos, ary, arity
  5829. ];
  5830. var result = wrapFunc.apply(undefined, newData);
  5831. if (isLaziable(func)) {
  5832. setData(result, newData);
  5833. }
  5834. result.placeholder = placeholder;
  5835. return setWrapToString(result, func, bitmask);
  5836. }
  5837. /**
  5838. * Creates a function like `_.round`.
  5839. *
  5840. * @private
  5841. * @param {string} methodName The name of the `Math` method to use when rounding.
  5842. * @returns {Function} Returns the new round function.
  5843. */
  5844. function createRound(methodName) {
  5845. var func = Math[methodName];
  5846. return function(number, precision) {
  5847. number = toNumber(number);
  5848. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  5849. if (precision) {
  5850. // Shift with exponential notation to avoid floating-point issues.
  5851. // See [MDN](https://mdn.io/round#Examples) for more details.
  5852. var pair = (toString(number) + 'e').split('e'),
  5853. value = func(pair[0] + 'e' + (+pair[1] + precision));
  5854. pair = (toString(value) + 'e').split('e');
  5855. return +(pair[0] + 'e' + (+pair[1] - precision));
  5856. }
  5857. return func(number);
  5858. };
  5859. }
  5860. /**
  5861. * Creates a set object of `values`.
  5862. *
  5863. * @private
  5864. * @param {Array} values The values to add to the set.
  5865. * @returns {Object} Returns the new set.
  5866. */
  5867. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  5868. return new Set(values);
  5869. };
  5870. /**
  5871. * Creates a `_.toPairs` or `_.toPairsIn` function.
  5872. *
  5873. * @private
  5874. * @param {Function} keysFunc The function to get the keys of a given object.
  5875. * @returns {Function} Returns the new pairs function.
  5876. */
  5877. function createToPairs(keysFunc) {
  5878. return function(object) {
  5879. var tag = getTag(object);
  5880. if (tag == mapTag) {
  5881. return mapToArray(object);
  5882. }
  5883. if (tag == setTag) {
  5884. return setToPairs(object);
  5885. }
  5886. return baseToPairs(object, keysFunc(object));
  5887. };
  5888. }
  5889. /**
  5890. * Creates a function that either curries or invokes `func` with optional
  5891. * `this` binding and partially applied arguments.
  5892. *
  5893. * @private
  5894. * @param {Function|string} func The function or method name to wrap.
  5895. * @param {number} bitmask The bitmask flags.
  5896. * 1 - `_.bind`
  5897. * 2 - `_.bindKey`
  5898. * 4 - `_.curry` or `_.curryRight` of a bound function
  5899. * 8 - `_.curry`
  5900. * 16 - `_.curryRight`
  5901. * 32 - `_.partial`
  5902. * 64 - `_.partialRight`
  5903. * 128 - `_.rearg`
  5904. * 256 - `_.ary`
  5905. * 512 - `_.flip`
  5906. * @param {*} [thisArg] The `this` binding of `func`.
  5907. * @param {Array} [partials] The arguments to be partially applied.
  5908. * @param {Array} [holders] The `partials` placeholder indexes.
  5909. * @param {Array} [argPos] The argument positions of the new function.
  5910. * @param {number} [ary] The arity cap of `func`.
  5911. * @param {number} [arity] The arity of `func`.
  5912. * @returns {Function} Returns the new wrapped function.
  5913. */
  5914. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  5915. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  5916. if (!isBindKey && typeof func != 'function') {
  5917. throw new TypeError(FUNC_ERROR_TEXT);
  5918. }
  5919. var length = partials ? partials.length : 0;
  5920. if (!length) {
  5921. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  5922. partials = holders = undefined;
  5923. }
  5924. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  5925. arity = arity === undefined ? arity : toInteger(arity);
  5926. length -= holders ? holders.length : 0;
  5927. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  5928. var partialsRight = partials,
  5929. holdersRight = holders;
  5930. partials = holders = undefined;
  5931. }
  5932. var data = isBindKey ? undefined : getData(func);
  5933. var newData = [
  5934. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  5935. argPos, ary, arity
  5936. ];
  5937. if (data) {
  5938. mergeData(newData, data);
  5939. }
  5940. func = newData[0];
  5941. bitmask = newData[1];
  5942. thisArg = newData[2];
  5943. partials = newData[3];
  5944. holders = newData[4];
  5945. arity = newData[9] = newData[9] === undefined
  5946. ? (isBindKey ? 0 : func.length)
  5947. : nativeMax(newData[9] - length, 0);
  5948. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  5949. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  5950. }
  5951. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  5952. var result = createBind(func, bitmask, thisArg);
  5953. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  5954. result = createCurry(func, bitmask, arity);
  5955. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  5956. result = createPartial(func, bitmask, thisArg, partials);
  5957. } else {
  5958. result = createHybrid.apply(undefined, newData);
  5959. }
  5960. var setter = data ? baseSetData : setData;
  5961. return setWrapToString(setter(result, newData), func, bitmask);
  5962. }
  5963. /**
  5964. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  5965. * of source objects to the destination object for all destination properties
  5966. * that resolve to `undefined`.
  5967. *
  5968. * @private
  5969. * @param {*} objValue The destination value.
  5970. * @param {*} srcValue The source value.
  5971. * @param {string} key The key of the property to assign.
  5972. * @param {Object} object The parent object of `objValue`.
  5973. * @returns {*} Returns the value to assign.
  5974. */
  5975. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  5976. if (objValue === undefined ||
  5977. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  5978. return srcValue;
  5979. }
  5980. return objValue;
  5981. }
  5982. /**
  5983. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  5984. * objects into destination objects that are passed thru.
  5985. *
  5986. * @private
  5987. * @param {*} objValue The destination value.
  5988. * @param {*} srcValue The source value.
  5989. * @param {string} key The key of the property to merge.
  5990. * @param {Object} object The parent object of `objValue`.
  5991. * @param {Object} source The parent object of `srcValue`.
  5992. * @param {Object} [stack] Tracks traversed source values and their merged
  5993. * counterparts.
  5994. * @returns {*} Returns the value to assign.
  5995. */
  5996. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  5997. if (isObject(objValue) && isObject(srcValue)) {
  5998. // Recursively merge objects and arrays (susceptible to call stack limits).
  5999. stack.set(srcValue, objValue);
  6000. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  6001. stack['delete'](srcValue);
  6002. }
  6003. return objValue;
  6004. }
  6005. /**
  6006. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  6007. * objects.
  6008. *
  6009. * @private
  6010. * @param {*} value The value to inspect.
  6011. * @param {string} key The key of the property to inspect.
  6012. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  6013. */
  6014. function customOmitClone(value) {
  6015. return isPlainObject(value) ? undefined : value;
  6016. }
  6017. /**
  6018. * A specialized version of `baseIsEqualDeep` for arrays with support for
  6019. * partial deep comparisons.
  6020. *
  6021. * @private
  6022. * @param {Array} array The array to compare.
  6023. * @param {Array} other The other array to compare.
  6024. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  6025. * @param {Function} customizer The function to customize comparisons.
  6026. * @param {Function} equalFunc The function to determine equivalents of values.
  6027. * @param {Object} stack Tracks traversed `array` and `other` objects.
  6028. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  6029. */
  6030. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  6031. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  6032. arrLength = array.length,
  6033. othLength = other.length;
  6034. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  6035. return false;
  6036. }
  6037. // Assume cyclic values are equal.
  6038. var stacked = stack.get(array);
  6039. if (stacked && stack.get(other)) {
  6040. return stacked == other;
  6041. }
  6042. var index = -1,
  6043. result = true,
  6044. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  6045. stack.set(array, other);
  6046. stack.set(other, array);
  6047. // Ignore non-index properties.
  6048. while (++index < arrLength) {
  6049. var arrValue = array[index],
  6050. othValue = other[index];
  6051. if (customizer) {
  6052. var compared = isPartial
  6053. ? customizer(othValue, arrValue, index, other, array, stack)
  6054. : customizer(arrValue, othValue, index, array, other, stack);
  6055. }
  6056. if (compared !== undefined) {
  6057. if (compared) {
  6058. continue;
  6059. }
  6060. result = false;
  6061. break;
  6062. }
  6063. // Recursively compare arrays (susceptible to call stack limits).
  6064. if (seen) {
  6065. if (!arraySome(other, function(othValue, othIndex) {
  6066. if (!cacheHas(seen, othIndex) &&
  6067. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  6068. return seen.push(othIndex);
  6069. }
  6070. })) {
  6071. result = false;
  6072. break;
  6073. }
  6074. } else if (!(
  6075. arrValue === othValue ||
  6076. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  6077. )) {
  6078. result = false;
  6079. break;
  6080. }
  6081. }
  6082. stack['delete'](array);
  6083. stack['delete'](other);
  6084. return result;
  6085. }
  6086. /**
  6087. * A specialized version of `baseIsEqualDeep` for comparing objects of
  6088. * the same `toStringTag`.
  6089. *
  6090. * **Note:** This function only supports comparing values with tags of
  6091. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  6092. *
  6093. * @private
  6094. * @param {Object} object The object to compare.
  6095. * @param {Object} other The other object to compare.
  6096. * @param {string} tag The `toStringTag` of the objects to compare.
  6097. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  6098. * @param {Function} customizer The function to customize comparisons.
  6099. * @param {Function} equalFunc The function to determine equivalents of values.
  6100. * @param {Object} stack Tracks traversed `object` and `other` objects.
  6101. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  6102. */
  6103. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  6104. switch (tag) {
  6105. case dataViewTag:
  6106. if ((object.byteLength != other.byteLength) ||
  6107. (object.byteOffset != other.byteOffset)) {
  6108. return false;
  6109. }
  6110. object = object.buffer;
  6111. other = other.buffer;
  6112. case arrayBufferTag:
  6113. if ((object.byteLength != other.byteLength) ||
  6114. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  6115. return false;
  6116. }
  6117. return true;
  6118. case boolTag:
  6119. case dateTag:
  6120. case numberTag:
  6121. // Coerce booleans to `1` or `0` and dates to milliseconds.
  6122. // Invalid dates are coerced to `NaN`.
  6123. return eq(+object, +other);
  6124. case errorTag:
  6125. return object.name == other.name && object.message == other.message;
  6126. case regexpTag:
  6127. case stringTag:
  6128. // Coerce regexes to strings and treat strings, primitives and objects,
  6129. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  6130. // for more details.
  6131. return object == (other + '');
  6132. case mapTag:
  6133. var convert = mapToArray;
  6134. case setTag:
  6135. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  6136. convert || (convert = setToArray);
  6137. if (object.size != other.size && !isPartial) {
  6138. return false;
  6139. }
  6140. // Assume cyclic values are equal.
  6141. var stacked = stack.get(object);
  6142. if (stacked) {
  6143. return stacked == other;
  6144. }
  6145. bitmask |= COMPARE_UNORDERED_FLAG;
  6146. // Recursively compare objects (susceptible to call stack limits).
  6147. stack.set(object, other);
  6148. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  6149. stack['delete'](object);
  6150. return result;
  6151. case symbolTag:
  6152. if (symbolValueOf) {
  6153. return symbolValueOf.call(object) == symbolValueOf.call(other);
  6154. }
  6155. }
  6156. return false;
  6157. }
  6158. /**
  6159. * A specialized version of `baseIsEqualDeep` for objects with support for
  6160. * partial deep comparisons.
  6161. *
  6162. * @private
  6163. * @param {Object} object The object to compare.
  6164. * @param {Object} other The other object to compare.
  6165. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  6166. * @param {Function} customizer The function to customize comparisons.
  6167. * @param {Function} equalFunc The function to determine equivalents of values.
  6168. * @param {Object} stack Tracks traversed `object` and `other` objects.
  6169. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  6170. */
  6171. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  6172. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  6173. objProps = getAllKeys(object),
  6174. objLength = objProps.length,
  6175. othProps = getAllKeys(other),
  6176. othLength = othProps.length;
  6177. if (objLength != othLength && !isPartial) {
  6178. return false;
  6179. }
  6180. var index = objLength;
  6181. while (index--) {
  6182. var key = objProps[index];
  6183. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  6184. return false;
  6185. }
  6186. }
  6187. // Assume cyclic values are equal.
  6188. var stacked = stack.get(object);
  6189. if (stacked && stack.get(other)) {
  6190. return stacked == other;
  6191. }
  6192. var result = true;
  6193. stack.set(object, other);
  6194. stack.set(other, object);
  6195. var skipCtor = isPartial;
  6196. while (++index < objLength) {
  6197. key = objProps[index];
  6198. var objValue = object[key],
  6199. othValue = other[key];
  6200. if (customizer) {
  6201. var compared = isPartial
  6202. ? customizer(othValue, objValue, key, other, object, stack)
  6203. : customizer(objValue, othValue, key, object, other, stack);
  6204. }
  6205. // Recursively compare objects (susceptible to call stack limits).
  6206. if (!(compared === undefined
  6207. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  6208. : compared
  6209. )) {
  6210. result = false;
  6211. break;
  6212. }
  6213. skipCtor || (skipCtor = key == 'constructor');
  6214. }
  6215. if (result && !skipCtor) {
  6216. var objCtor = object.constructor,
  6217. othCtor = other.constructor;
  6218. // Non `Object` object instances with different constructors are not equal.
  6219. if (objCtor != othCtor &&
  6220. ('constructor' in object && 'constructor' in other) &&
  6221. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  6222. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  6223. result = false;
  6224. }
  6225. }
  6226. stack['delete'](object);
  6227. stack['delete'](other);
  6228. return result;
  6229. }
  6230. /**
  6231. * A specialized version of `baseRest` which flattens the rest array.
  6232. *
  6233. * @private
  6234. * @param {Function} func The function to apply a rest parameter to.
  6235. * @returns {Function} Returns the new function.
  6236. */
  6237. function flatRest(func) {
  6238. return setToString(overRest(func, undefined, flatten), func + '');
  6239. }
  6240. /**
  6241. * Creates an array of own enumerable property names and symbols of `object`.
  6242. *
  6243. * @private
  6244. * @param {Object} object The object to query.
  6245. * @returns {Array} Returns the array of property names and symbols.
  6246. */
  6247. function getAllKeys(object) {
  6248. return baseGetAllKeys(object, keys, getSymbols);
  6249. }
  6250. /**
  6251. * Creates an array of own and inherited enumerable property names and
  6252. * symbols of `object`.
  6253. *
  6254. * @private
  6255. * @param {Object} object The object to query.
  6256. * @returns {Array} Returns the array of property names and symbols.
  6257. */
  6258. function getAllKeysIn(object) {
  6259. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  6260. }
  6261. /**
  6262. * Gets metadata for `func`.
  6263. *
  6264. * @private
  6265. * @param {Function} func The function to query.
  6266. * @returns {*} Returns the metadata for `func`.
  6267. */
  6268. var getData = !metaMap ? noop : function(func) {
  6269. return metaMap.get(func);
  6270. };
  6271. /**
  6272. * Gets the name of `func`.
  6273. *
  6274. * @private
  6275. * @param {Function} func The function to query.
  6276. * @returns {string} Returns the function name.
  6277. */
  6278. function getFuncName(func) {
  6279. var result = (func.name + ''),
  6280. array = realNames[result],
  6281. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  6282. while (length--) {
  6283. var data = array[length],
  6284. otherFunc = data.func;
  6285. if (otherFunc == null || otherFunc == func) {
  6286. return data.name;
  6287. }
  6288. }
  6289. return result;
  6290. }
  6291. /**
  6292. * Gets the argument placeholder value for `func`.
  6293. *
  6294. * @private
  6295. * @param {Function} func The function to inspect.
  6296. * @returns {*} Returns the placeholder value.
  6297. */
  6298. function getHolder(func) {
  6299. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  6300. return object.placeholder;
  6301. }
  6302. /**
  6303. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  6304. * this function returns the custom method, otherwise it returns `baseIteratee`.
  6305. * If arguments are provided, the chosen function is invoked with them and
  6306. * its result is returned.
  6307. *
  6308. * @private
  6309. * @param {*} [value] The value to convert to an iteratee.
  6310. * @param {number} [arity] The arity of the created iteratee.
  6311. * @returns {Function} Returns the chosen function or its result.
  6312. */
  6313. function getIteratee() {
  6314. var result = lodash.iteratee || iteratee;
  6315. result = result === iteratee ? baseIteratee : result;
  6316. return arguments.length ? result(arguments[0], arguments[1]) : result;
  6317. }
  6318. /**
  6319. * Gets the data for `map`.
  6320. *
  6321. * @private
  6322. * @param {Object} map The map to query.
  6323. * @param {string} key The reference key.
  6324. * @returns {*} Returns the map data.
  6325. */
  6326. function getMapData(map, key) {
  6327. var data = map.__data__;
  6328. return isKeyable(key)
  6329. ? data[typeof key == 'string' ? 'string' : 'hash']
  6330. : data.map;
  6331. }
  6332. /**
  6333. * Gets the property names, values, and compare flags of `object`.
  6334. *
  6335. * @private
  6336. * @param {Object} object The object to query.
  6337. * @returns {Array} Returns the match data of `object`.
  6338. */
  6339. function getMatchData(object) {
  6340. var result = keys(object),
  6341. length = result.length;
  6342. while (length--) {
  6343. var key = result[length],
  6344. value = object[key];
  6345. result[length] = [key, value, isStrictComparable(value)];
  6346. }
  6347. return result;
  6348. }
  6349. /**
  6350. * Gets the native function at `key` of `object`.
  6351. *
  6352. * @private
  6353. * @param {Object} object The object to query.
  6354. * @param {string} key The key of the method to get.
  6355. * @returns {*} Returns the function if it's native, else `undefined`.
  6356. */
  6357. function getNative(object, key) {
  6358. var value = getValue(object, key);
  6359. return baseIsNative(value) ? value : undefined;
  6360. }
  6361. /**
  6362. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  6363. *
  6364. * @private
  6365. * @param {*} value The value to query.
  6366. * @returns {string} Returns the raw `toStringTag`.
  6367. */
  6368. function getRawTag(value) {
  6369. var isOwn = hasOwnProperty.call(value, symToStringTag),
  6370. tag = value[symToStringTag];
  6371. try {
  6372. value[symToStringTag] = undefined;
  6373. var unmasked = true;
  6374. } catch (e) {}
  6375. var result = nativeObjectToString.call(value);
  6376. if (unmasked) {
  6377. if (isOwn) {
  6378. value[symToStringTag] = tag;
  6379. } else {
  6380. delete value[symToStringTag];
  6381. }
  6382. }
  6383. return result;
  6384. }
  6385. /**
  6386. * Creates an array of the own enumerable symbols of `object`.
  6387. *
  6388. * @private
  6389. * @param {Object} object The object to query.
  6390. * @returns {Array} Returns the array of symbols.
  6391. */
  6392. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  6393. if (object == null) {
  6394. return [];
  6395. }
  6396. object = Object(object);
  6397. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  6398. return propertyIsEnumerable.call(object, symbol);
  6399. });
  6400. };
  6401. /**
  6402. * Creates an array of the own and inherited enumerable symbols of `object`.
  6403. *
  6404. * @private
  6405. * @param {Object} object The object to query.
  6406. * @returns {Array} Returns the array of symbols.
  6407. */
  6408. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  6409. var result = [];
  6410. while (object) {
  6411. arrayPush(result, getSymbols(object));
  6412. object = getPrototype(object);
  6413. }
  6414. return result;
  6415. };
  6416. /**
  6417. * Gets the `toStringTag` of `value`.
  6418. *
  6419. * @private
  6420. * @param {*} value The value to query.
  6421. * @returns {string} Returns the `toStringTag`.
  6422. */
  6423. var getTag = baseGetTag;
  6424. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  6425. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  6426. (Map && getTag(new Map) != mapTag) ||
  6427. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  6428. (Set && getTag(new Set) != setTag) ||
  6429. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  6430. getTag = function(value) {
  6431. var result = baseGetTag(value),
  6432. Ctor = result == objectTag ? value.constructor : undefined,
  6433. ctorString = Ctor ? toSource(Ctor) : '';
  6434. if (ctorString) {
  6435. switch (ctorString) {
  6436. case dataViewCtorString: return dataViewTag;
  6437. case mapCtorString: return mapTag;
  6438. case promiseCtorString: return promiseTag;
  6439. case setCtorString: return setTag;
  6440. case weakMapCtorString: return weakMapTag;
  6441. }
  6442. }
  6443. return result;
  6444. };
  6445. }
  6446. /**
  6447. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  6448. *
  6449. * @private
  6450. * @param {number} start The start of the view.
  6451. * @param {number} end The end of the view.
  6452. * @param {Array} transforms The transformations to apply to the view.
  6453. * @returns {Object} Returns an object containing the `start` and `end`
  6454. * positions of the view.
  6455. */
  6456. function getView(start, end, transforms) {
  6457. var index = -1,
  6458. length = transforms.length;
  6459. while (++index < length) {
  6460. var data = transforms[index],
  6461. size = data.size;
  6462. switch (data.type) {
  6463. case 'drop': start += size; break;
  6464. case 'dropRight': end -= size; break;
  6465. case 'take': end = nativeMin(end, start + size); break;
  6466. case 'takeRight': start = nativeMax(start, end - size); break;
  6467. }
  6468. }
  6469. return { 'start': start, 'end': end };
  6470. }
  6471. /**
  6472. * Extracts wrapper details from the `source` body comment.
  6473. *
  6474. * @private
  6475. * @param {string} source The source to inspect.
  6476. * @returns {Array} Returns the wrapper details.
  6477. */
  6478. function getWrapDetails(source) {
  6479. var match = source.match(reWrapDetails);
  6480. return match ? match[1].split(reSplitDetails) : [];
  6481. }
  6482. /**
  6483. * Checks if `path` exists on `object`.
  6484. *
  6485. * @private
  6486. * @param {Object} object The object to query.
  6487. * @param {Array|string} path The path to check.
  6488. * @param {Function} hasFunc The function to check properties.
  6489. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  6490. */
  6491. function hasPath(object, path, hasFunc) {
  6492. path = castPath(path, object);
  6493. var index = -1,
  6494. length = path.length,
  6495. result = false;
  6496. while (++index < length) {
  6497. var key = toKey(path[index]);
  6498. if (!(result = object != null && hasFunc(object, key))) {
  6499. break;
  6500. }
  6501. object = object[key];
  6502. }
  6503. if (result || ++index != length) {
  6504. return result;
  6505. }
  6506. length = object == null ? 0 : object.length;
  6507. return !!length && isLength(length) && isIndex(key, length) &&
  6508. (isArray(object) || isArguments(object));
  6509. }
  6510. /**
  6511. * Initializes an array clone.
  6512. *
  6513. * @private
  6514. * @param {Array} array The array to clone.
  6515. * @returns {Array} Returns the initialized clone.
  6516. */
  6517. function initCloneArray(array) {
  6518. var length = array.length,
  6519. result = new array.constructor(length);
  6520. // Add properties assigned by `RegExp#exec`.
  6521. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  6522. result.index = array.index;
  6523. result.input = array.input;
  6524. }
  6525. return result;
  6526. }
  6527. /**
  6528. * Initializes an object clone.
  6529. *
  6530. * @private
  6531. * @param {Object} object The object to clone.
  6532. * @returns {Object} Returns the initialized clone.
  6533. */
  6534. function initCloneObject(object) {
  6535. return (typeof object.constructor == 'function' && !isPrototype(object))
  6536. ? baseCreate(getPrototype(object))
  6537. : {};
  6538. }
  6539. /**
  6540. * Initializes an object clone based on its `toStringTag`.
  6541. *
  6542. * **Note:** This function only supports cloning values with tags of
  6543. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  6544. *
  6545. * @private
  6546. * @param {Object} object The object to clone.
  6547. * @param {string} tag The `toStringTag` of the object to clone.
  6548. * @param {boolean} [isDeep] Specify a deep clone.
  6549. * @returns {Object} Returns the initialized clone.
  6550. */
  6551. function initCloneByTag(object, tag, isDeep) {
  6552. var Ctor = object.constructor;
  6553. switch (tag) {
  6554. case arrayBufferTag:
  6555. return cloneArrayBuffer(object);
  6556. case boolTag:
  6557. case dateTag:
  6558. return new Ctor(+object);
  6559. case dataViewTag:
  6560. return cloneDataView(object, isDeep);
  6561. case float32Tag: case float64Tag:
  6562. case int8Tag: case int16Tag: case int32Tag:
  6563. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  6564. return cloneTypedArray(object, isDeep);
  6565. case mapTag:
  6566. return new Ctor;
  6567. case numberTag:
  6568. case stringTag:
  6569. return new Ctor(object);
  6570. case regexpTag:
  6571. return cloneRegExp(object);
  6572. case setTag:
  6573. return new Ctor;
  6574. case symbolTag:
  6575. return cloneSymbol(object);
  6576. }
  6577. }
  6578. /**
  6579. * Inserts wrapper `details` in a comment at the top of the `source` body.
  6580. *
  6581. * @private
  6582. * @param {string} source The source to modify.
  6583. * @returns {Array} details The details to insert.
  6584. * @returns {string} Returns the modified source.
  6585. */
  6586. function insertWrapDetails(source, details) {
  6587. var length = details.length;
  6588. if (!length) {
  6589. return source;
  6590. }
  6591. var lastIndex = length - 1;
  6592. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  6593. details = details.join(length > 2 ? ', ' : ' ');
  6594. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  6595. }
  6596. /**
  6597. * Checks if `value` is a flattenable `arguments` object or array.
  6598. *
  6599. * @private
  6600. * @param {*} value The value to check.
  6601. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  6602. */
  6603. function isFlattenable(value) {
  6604. return isArray(value) || isArguments(value) ||
  6605. !!(spreadableSymbol && value && value[spreadableSymbol]);
  6606. }
  6607. /**
  6608. * Checks if `value` is a valid array-like index.
  6609. *
  6610. * @private
  6611. * @param {*} value The value to check.
  6612. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  6613. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  6614. */
  6615. function isIndex(value, length) {
  6616. var type = typeof value;
  6617. length = length == null ? MAX_SAFE_INTEGER : length;
  6618. return !!length &&
  6619. (type == 'number' ||
  6620. (type != 'symbol' && reIsUint.test(value))) &&
  6621. (value > -1 && value % 1 == 0 && value < length);
  6622. }
  6623. /**
  6624. * Checks if the given arguments are from an iteratee call.
  6625. *
  6626. * @private
  6627. * @param {*} value The potential iteratee value argument.
  6628. * @param {*} index The potential iteratee index or key argument.
  6629. * @param {*} object The potential iteratee object argument.
  6630. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  6631. * else `false`.
  6632. */
  6633. function isIterateeCall(value, index, object) {
  6634. if (!isObject(object)) {
  6635. return false;
  6636. }
  6637. var type = typeof index;
  6638. if (type == 'number'
  6639. ? (isArrayLike(object) && isIndex(index, object.length))
  6640. : (type == 'string' && index in object)
  6641. ) {
  6642. return eq(object[index], value);
  6643. }
  6644. return false;
  6645. }
  6646. /**
  6647. * Checks if `value` is a property name and not a property path.
  6648. *
  6649. * @private
  6650. * @param {*} value The value to check.
  6651. * @param {Object} [object] The object to query keys on.
  6652. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  6653. */
  6654. function isKey(value, object) {
  6655. if (isArray(value)) {
  6656. return false;
  6657. }
  6658. var type = typeof value;
  6659. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  6660. value == null || isSymbol(value)) {
  6661. return true;
  6662. }
  6663. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  6664. (object != null && value in Object(object));
  6665. }
  6666. /**
  6667. * Checks if `value` is suitable for use as unique object key.
  6668. *
  6669. * @private
  6670. * @param {*} value The value to check.
  6671. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  6672. */
  6673. function isKeyable(value) {
  6674. var type = typeof value;
  6675. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  6676. ? (value !== '__proto__')
  6677. : (value === null);
  6678. }
  6679. /**
  6680. * Checks if `func` has a lazy counterpart.
  6681. *
  6682. * @private
  6683. * @param {Function} func The function to check.
  6684. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  6685. * else `false`.
  6686. */
  6687. function isLaziable(func) {
  6688. var funcName = getFuncName(func),
  6689. other = lodash[funcName];
  6690. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  6691. return false;
  6692. }
  6693. if (func === other) {
  6694. return true;
  6695. }
  6696. var data = getData(other);
  6697. return !!data && func === data[0];
  6698. }
  6699. /**
  6700. * Checks if `func` has its source masked.
  6701. *
  6702. * @private
  6703. * @param {Function} func The function to check.
  6704. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  6705. */
  6706. function isMasked(func) {
  6707. return !!maskSrcKey && (maskSrcKey in func);
  6708. }
  6709. /**
  6710. * Checks if `func` is capable of being masked.
  6711. *
  6712. * @private
  6713. * @param {*} value The value to check.
  6714. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  6715. */
  6716. var isMaskable = coreJsData ? isFunction : stubFalse;
  6717. /**
  6718. * Checks if `value` is likely a prototype object.
  6719. *
  6720. * @private
  6721. * @param {*} value The value to check.
  6722. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  6723. */
  6724. function isPrototype(value) {
  6725. var Ctor = value && value.constructor,
  6726. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  6727. return value === proto;
  6728. }
  6729. /**
  6730. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  6731. *
  6732. * @private
  6733. * @param {*} value The value to check.
  6734. * @returns {boolean} Returns `true` if `value` if suitable for strict
  6735. * equality comparisons, else `false`.
  6736. */
  6737. function isStrictComparable(value) {
  6738. return value === value && !isObject(value);
  6739. }
  6740. /**
  6741. * A specialized version of `matchesProperty` for source values suitable
  6742. * for strict equality comparisons, i.e. `===`.
  6743. *
  6744. * @private
  6745. * @param {string} key The key of the property to get.
  6746. * @param {*} srcValue The value to match.
  6747. * @returns {Function} Returns the new spec function.
  6748. */
  6749. function matchesStrictComparable(key, srcValue) {
  6750. return function(object) {
  6751. if (object == null) {
  6752. return false;
  6753. }
  6754. return object[key] === srcValue &&
  6755. (srcValue !== undefined || (key in Object(object)));
  6756. };
  6757. }
  6758. /**
  6759. * A specialized version of `_.memoize` which clears the memoized function's
  6760. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  6761. *
  6762. * @private
  6763. * @param {Function} func The function to have its output memoized.
  6764. * @returns {Function} Returns the new memoized function.
  6765. */
  6766. function memoizeCapped(func) {
  6767. var result = memoize(func, function(key) {
  6768. if (cache.size === MAX_MEMOIZE_SIZE) {
  6769. cache.clear();
  6770. }
  6771. return key;
  6772. });
  6773. var cache = result.cache;
  6774. return result;
  6775. }
  6776. /**
  6777. * Merges the function metadata of `source` into `data`.
  6778. *
  6779. * Merging metadata reduces the number of wrappers used to invoke a function.
  6780. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  6781. * may be applied regardless of execution order. Methods like `_.ary` and
  6782. * `_.rearg` modify function arguments, making the order in which they are
  6783. * executed important, preventing the merging of metadata. However, we make
  6784. * an exception for a safe combined case where curried functions have `_.ary`
  6785. * and or `_.rearg` applied.
  6786. *
  6787. * @private
  6788. * @param {Array} data The destination metadata.
  6789. * @param {Array} source The source metadata.
  6790. * @returns {Array} Returns `data`.
  6791. */
  6792. function mergeData(data, source) {
  6793. var bitmask = data[1],
  6794. srcBitmask = source[1],
  6795. newBitmask = bitmask | srcBitmask,
  6796. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  6797. var isCombo =
  6798. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  6799. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  6800. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  6801. // Exit early if metadata can't be merged.
  6802. if (!(isCommon || isCombo)) {
  6803. return data;
  6804. }
  6805. // Use source `thisArg` if available.
  6806. if (srcBitmask & WRAP_BIND_FLAG) {
  6807. data[2] = source[2];
  6808. // Set when currying a bound function.
  6809. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  6810. }
  6811. // Compose partial arguments.
  6812. var value = source[3];
  6813. if (value) {
  6814. var partials = data[3];
  6815. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  6816. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  6817. }
  6818. // Compose partial right arguments.
  6819. value = source[5];
  6820. if (value) {
  6821. partials = data[5];
  6822. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  6823. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  6824. }
  6825. // Use source `argPos` if available.
  6826. value = source[7];
  6827. if (value) {
  6828. data[7] = value;
  6829. }
  6830. // Use source `ary` if it's smaller.
  6831. if (srcBitmask & WRAP_ARY_FLAG) {
  6832. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  6833. }
  6834. // Use source `arity` if one is not provided.
  6835. if (data[9] == null) {
  6836. data[9] = source[9];
  6837. }
  6838. // Use source `func` and merge bitmasks.
  6839. data[0] = source[0];
  6840. data[1] = newBitmask;
  6841. return data;
  6842. }
  6843. /**
  6844. * This function is like
  6845. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  6846. * except that it includes inherited enumerable properties.
  6847. *
  6848. * @private
  6849. * @param {Object} object The object to query.
  6850. * @returns {Array} Returns the array of property names.
  6851. */
  6852. function nativeKeysIn(object) {
  6853. var result = [];
  6854. if (object != null) {
  6855. for (var key in Object(object)) {
  6856. result.push(key);
  6857. }
  6858. }
  6859. return result;
  6860. }
  6861. /**
  6862. * Converts `value` to a string using `Object.prototype.toString`.
  6863. *
  6864. * @private
  6865. * @param {*} value The value to convert.
  6866. * @returns {string} Returns the converted string.
  6867. */
  6868. function objectToString(value) {
  6869. return nativeObjectToString.call(value);
  6870. }
  6871. /**
  6872. * A specialized version of `baseRest` which transforms the rest array.
  6873. *
  6874. * @private
  6875. * @param {Function} func The function to apply a rest parameter to.
  6876. * @param {number} [start=func.length-1] The start position of the rest parameter.
  6877. * @param {Function} transform The rest array transform.
  6878. * @returns {Function} Returns the new function.
  6879. */
  6880. function overRest(func, start, transform) {
  6881. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  6882. return function() {
  6883. var args = arguments,
  6884. index = -1,
  6885. length = nativeMax(args.length - start, 0),
  6886. array = Array(length);
  6887. while (++index < length) {
  6888. array[index] = args[start + index];
  6889. }
  6890. index = -1;
  6891. var otherArgs = Array(start + 1);
  6892. while (++index < start) {
  6893. otherArgs[index] = args[index];
  6894. }
  6895. otherArgs[start] = transform(array);
  6896. return apply(func, this, otherArgs);
  6897. };
  6898. }
  6899. /**
  6900. * Gets the parent value at `path` of `object`.
  6901. *
  6902. * @private
  6903. * @param {Object} object The object to query.
  6904. * @param {Array} path The path to get the parent value of.
  6905. * @returns {*} Returns the parent value.
  6906. */
  6907. function parent(object, path) {
  6908. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  6909. }
  6910. /**
  6911. * Reorder `array` according to the specified indexes where the element at
  6912. * the first index is assigned as the first element, the element at
  6913. * the second index is assigned as the second element, and so on.
  6914. *
  6915. * @private
  6916. * @param {Array} array The array to reorder.
  6917. * @param {Array} indexes The arranged array indexes.
  6918. * @returns {Array} Returns `array`.
  6919. */
  6920. function reorder(array, indexes) {
  6921. var arrLength = array.length,
  6922. length = nativeMin(indexes.length, arrLength),
  6923. oldArray = copyArray(array);
  6924. while (length--) {
  6925. var index = indexes[length];
  6926. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  6927. }
  6928. return array;
  6929. }
  6930. /**
  6931. * Sets metadata for `func`.
  6932. *
  6933. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  6934. * period of time, it will trip its breaker and transition to an identity
  6935. * function to avoid garbage collection pauses in V8. See
  6936. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  6937. * for more details.
  6938. *
  6939. * @private
  6940. * @param {Function} func The function to associate metadata with.
  6941. * @param {*} data The metadata.
  6942. * @returns {Function} Returns `func`.
  6943. */
  6944. var setData = shortOut(baseSetData);
  6945. /**
  6946. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  6947. *
  6948. * @private
  6949. * @param {Function} func The function to delay.
  6950. * @param {number} wait The number of milliseconds to delay invocation.
  6951. * @returns {number|Object} Returns the timer id or timeout object.
  6952. */
  6953. var setTimeout = ctxSetTimeout || function(func, wait) {
  6954. return root.setTimeout(func, wait);
  6955. };
  6956. /**
  6957. * Sets the `toString` method of `func` to return `string`.
  6958. *
  6959. * @private
  6960. * @param {Function} func The function to modify.
  6961. * @param {Function} string The `toString` result.
  6962. * @returns {Function} Returns `func`.
  6963. */
  6964. var setToString = shortOut(baseSetToString);
  6965. /**
  6966. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  6967. * with wrapper details in a comment at the top of the source body.
  6968. *
  6969. * @private
  6970. * @param {Function} wrapper The function to modify.
  6971. * @param {Function} reference The reference function.
  6972. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  6973. * @returns {Function} Returns `wrapper`.
  6974. */
  6975. function setWrapToString(wrapper, reference, bitmask) {
  6976. var source = (reference + '');
  6977. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  6978. }
  6979. /**
  6980. * Creates a function that'll short out and invoke `identity` instead
  6981. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  6982. * milliseconds.
  6983. *
  6984. * @private
  6985. * @param {Function} func The function to restrict.
  6986. * @returns {Function} Returns the new shortable function.
  6987. */
  6988. function shortOut(func) {
  6989. var count = 0,
  6990. lastCalled = 0;
  6991. return function() {
  6992. var stamp = nativeNow(),
  6993. remaining = HOT_SPAN - (stamp - lastCalled);
  6994. lastCalled = stamp;
  6995. if (remaining > 0) {
  6996. if (++count >= HOT_COUNT) {
  6997. return arguments[0];
  6998. }
  6999. } else {
  7000. count = 0;
  7001. }
  7002. return func.apply(undefined, arguments);
  7003. };
  7004. }
  7005. /**
  7006. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  7007. *
  7008. * @private
  7009. * @param {Array} array The array to shuffle.
  7010. * @param {number} [size=array.length] The size of `array`.
  7011. * @returns {Array} Returns `array`.
  7012. */
  7013. function shuffleSelf(array, size) {
  7014. var index = -1,
  7015. length = array.length,
  7016. lastIndex = length - 1;
  7017. size = size === undefined ? length : size;
  7018. while (++index < size) {
  7019. var rand = baseRandom(index, lastIndex),
  7020. value = array[rand];
  7021. array[rand] = array[index];
  7022. array[index] = value;
  7023. }
  7024. array.length = size;
  7025. return array;
  7026. }
  7027. /**
  7028. * Converts `string` to a property path array.
  7029. *
  7030. * @private
  7031. * @param {string} string The string to convert.
  7032. * @returns {Array} Returns the property path array.
  7033. */
  7034. var stringToPath = memoizeCapped(function(string) {
  7035. var result = [];
  7036. if (string.charCodeAt(0) === 46 /* . */) {
  7037. result.push('');
  7038. }
  7039. string.replace(rePropName, function(match, number, quote, subString) {
  7040. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  7041. });
  7042. return result;
  7043. });
  7044. /**
  7045. * Converts `value` to a string key if it's not a string or symbol.
  7046. *
  7047. * @private
  7048. * @param {*} value The value to inspect.
  7049. * @returns {string|symbol} Returns the key.
  7050. */
  7051. function toKey(value) {
  7052. if (typeof value == 'string' || isSymbol(value)) {
  7053. return value;
  7054. }
  7055. var result = (value + '');
  7056. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  7057. }
  7058. /**
  7059. * Converts `func` to its source code.
  7060. *
  7061. * @private
  7062. * @param {Function} func The function to convert.
  7063. * @returns {string} Returns the source code.
  7064. */
  7065. function toSource(func) {
  7066. if (func != null) {
  7067. try {
  7068. return funcToString.call(func);
  7069. } catch (e) {}
  7070. try {
  7071. return (func + '');
  7072. } catch (e) {}
  7073. }
  7074. return '';
  7075. }
  7076. /**
  7077. * Updates wrapper `details` based on `bitmask` flags.
  7078. *
  7079. * @private
  7080. * @returns {Array} details The details to modify.
  7081. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  7082. * @returns {Array} Returns `details`.
  7083. */
  7084. function updateWrapDetails(details, bitmask) {
  7085. arrayEach(wrapFlags, function(pair) {
  7086. var value = '_.' + pair[0];
  7087. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  7088. details.push(value);
  7089. }
  7090. });
  7091. return details.sort();
  7092. }
  7093. /**
  7094. * Creates a clone of `wrapper`.
  7095. *
  7096. * @private
  7097. * @param {Object} wrapper The wrapper to clone.
  7098. * @returns {Object} Returns the cloned wrapper.
  7099. */
  7100. function wrapperClone(wrapper) {
  7101. if (wrapper instanceof LazyWrapper) {
  7102. return wrapper.clone();
  7103. }
  7104. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  7105. result.__actions__ = copyArray(wrapper.__actions__);
  7106. result.__index__ = wrapper.__index__;
  7107. result.__values__ = wrapper.__values__;
  7108. return result;
  7109. }
  7110. /*------------------------------------------------------------------------*/
  7111. /**
  7112. * Creates an array of elements split into groups the length of `size`.
  7113. * If `array` can't be split evenly, the final chunk will be the remaining
  7114. * elements.
  7115. *
  7116. * @static
  7117. * @memberOf _
  7118. * @since 3.0.0
  7119. * @category Array
  7120. * @param {Array} array The array to process.
  7121. * @param {number} [size=1] The length of each chunk
  7122. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  7123. * @returns {Array} Returns the new array of chunks.
  7124. * @example
  7125. *
  7126. * _.chunk(['a', 'b', 'c', 'd'], 2);
  7127. * // => [['a', 'b'], ['c', 'd']]
  7128. *
  7129. * _.chunk(['a', 'b', 'c', 'd'], 3);
  7130. * // => [['a', 'b', 'c'], ['d']]
  7131. */
  7132. function chunk(array, size, guard) {
  7133. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  7134. size = 1;
  7135. } else {
  7136. size = nativeMax(toInteger(size), 0);
  7137. }
  7138. var length = array == null ? 0 : array.length;
  7139. if (!length || size < 1) {
  7140. return [];
  7141. }
  7142. var index = 0,
  7143. resIndex = 0,
  7144. result = Array(nativeCeil(length / size));
  7145. while (index < length) {
  7146. result[resIndex++] = baseSlice(array, index, (index += size));
  7147. }
  7148. return result;
  7149. }
  7150. /**
  7151. * Creates an array with all falsey values removed. The values `false`, `null`,
  7152. * `0`, `""`, `undefined`, and `NaN` are falsey.
  7153. *
  7154. * @static
  7155. * @memberOf _
  7156. * @since 0.1.0
  7157. * @category Array
  7158. * @param {Array} array The array to compact.
  7159. * @returns {Array} Returns the new array of filtered values.
  7160. * @example
  7161. *
  7162. * _.compact([0, 1, false, 2, '', 3]);
  7163. * // => [1, 2, 3]
  7164. */
  7165. function compact(array) {
  7166. var index = -1,
  7167. length = array == null ? 0 : array.length,
  7168. resIndex = 0,
  7169. result = [];
  7170. while (++index < length) {
  7171. var value = array[index];
  7172. if (value) {
  7173. result[resIndex++] = value;
  7174. }
  7175. }
  7176. return result;
  7177. }
  7178. /**
  7179. * Creates a new array concatenating `array` with any additional arrays
  7180. * and/or values.
  7181. *
  7182. * @static
  7183. * @memberOf _
  7184. * @since 4.0.0
  7185. * @category Array
  7186. * @param {Array} array The array to concatenate.
  7187. * @param {...*} [values] The values to concatenate.
  7188. * @returns {Array} Returns the new concatenated array.
  7189. * @example
  7190. *
  7191. * var array = [1];
  7192. * var other = _.concat(array, 2, [3], [[4]]);
  7193. *
  7194. * console.log(other);
  7195. * // => [1, 2, 3, [4]]
  7196. *
  7197. * console.log(array);
  7198. * // => [1]
  7199. */
  7200. function concat() {
  7201. var length = arguments.length;
  7202. if (!length) {
  7203. return [];
  7204. }
  7205. var args = Array(length - 1),
  7206. array = arguments[0],
  7207. index = length;
  7208. while (index--) {
  7209. args[index - 1] = arguments[index];
  7210. }
  7211. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  7212. }
  7213. /**
  7214. * Creates an array of `array` values not included in the other given arrays
  7215. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  7216. * for equality comparisons. The order and references of result values are
  7217. * determined by the first array.
  7218. *
  7219. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  7220. *
  7221. * @static
  7222. * @memberOf _
  7223. * @since 0.1.0
  7224. * @category Array
  7225. * @param {Array} array The array to inspect.
  7226. * @param {...Array} [values] The values to exclude.
  7227. * @returns {Array} Returns the new array of filtered values.
  7228. * @see _.without, _.xor
  7229. * @example
  7230. *
  7231. * _.difference([2, 1], [2, 3]);
  7232. * // => [1]
  7233. */
  7234. var difference = baseRest(function(array, values) {
  7235. return isArrayLikeObject(array)
  7236. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  7237. : [];
  7238. });
  7239. /**
  7240. * This method is like `_.difference` except that it accepts `iteratee` which
  7241. * is invoked for each element of `array` and `values` to generate the criterion
  7242. * by which they're compared. The order and references of result values are
  7243. * determined by the first array. The iteratee is invoked with one argument:
  7244. * (value).
  7245. *
  7246. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  7247. *
  7248. * @static
  7249. * @memberOf _
  7250. * @since 4.0.0
  7251. * @category Array
  7252. * @param {Array} array The array to inspect.
  7253. * @param {...Array} [values] The values to exclude.
  7254. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  7255. * @returns {Array} Returns the new array of filtered values.
  7256. * @example
  7257. *
  7258. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  7259. * // => [1.2]
  7260. *
  7261. * // The `_.property` iteratee shorthand.
  7262. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  7263. * // => [{ 'x': 2 }]
  7264. */
  7265. var differenceBy = baseRest(function(array, values) {
  7266. var iteratee = last(values);
  7267. if (isArrayLikeObject(iteratee)) {
  7268. iteratee = undefined;
  7269. }
  7270. return isArrayLikeObject(array)
  7271. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  7272. : [];
  7273. });
  7274. /**
  7275. * This method is like `_.difference` except that it accepts `comparator`
  7276. * which is invoked to compare elements of `array` to `values`. The order and
  7277. * references of result values are determined by the first array. The comparator
  7278. * is invoked with two arguments: (arrVal, othVal).
  7279. *
  7280. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  7281. *
  7282. * @static
  7283. * @memberOf _
  7284. * @since 4.0.0
  7285. * @category Array
  7286. * @param {Array} array The array to inspect.
  7287. * @param {...Array} [values] The values to exclude.
  7288. * @param {Function} [comparator] The comparator invoked per element.
  7289. * @returns {Array} Returns the new array of filtered values.
  7290. * @example
  7291. *
  7292. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  7293. *
  7294. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  7295. * // => [{ 'x': 2, 'y': 1 }]
  7296. */
  7297. var differenceWith = baseRest(function(array, values) {
  7298. var comparator = last(values);
  7299. if (isArrayLikeObject(comparator)) {
  7300. comparator = undefined;
  7301. }
  7302. return isArrayLikeObject(array)
  7303. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  7304. : [];
  7305. });
  7306. /**
  7307. * Creates a slice of `array` with `n` elements dropped from the beginning.
  7308. *
  7309. * @static
  7310. * @memberOf _
  7311. * @since 0.5.0
  7312. * @category Array
  7313. * @param {Array} array The array to query.
  7314. * @param {number} [n=1] The number of elements to drop.
  7315. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  7316. * @returns {Array} Returns the slice of `array`.
  7317. * @example
  7318. *
  7319. * _.drop([1, 2, 3]);
  7320. * // => [2, 3]
  7321. *
  7322. * _.drop([1, 2, 3], 2);
  7323. * // => [3]
  7324. *
  7325. * _.drop([1, 2, 3], 5);
  7326. * // => []
  7327. *
  7328. * _.drop([1, 2, 3], 0);
  7329. * // => [1, 2, 3]
  7330. */
  7331. function drop(array, n, guard) {
  7332. var length = array == null ? 0 : array.length;
  7333. if (!length) {
  7334. return [];
  7335. }
  7336. n = (guard || n === undefined) ? 1 : toInteger(n);
  7337. return baseSlice(array, n < 0 ? 0 : n, length);
  7338. }
  7339. /**
  7340. * Creates a slice of `array` with `n` elements dropped from the end.
  7341. *
  7342. * @static
  7343. * @memberOf _
  7344. * @since 3.0.0
  7345. * @category Array
  7346. * @param {Array} array The array to query.
  7347. * @param {number} [n=1] The number of elements to drop.
  7348. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  7349. * @returns {Array} Returns the slice of `array`.
  7350. * @example
  7351. *
  7352. * _.dropRight([1, 2, 3]);
  7353. * // => [1, 2]
  7354. *
  7355. * _.dropRight([1, 2, 3], 2);
  7356. * // => [1]
  7357. *
  7358. * _.dropRight([1, 2, 3], 5);
  7359. * // => []
  7360. *
  7361. * _.dropRight([1, 2, 3], 0);
  7362. * // => [1, 2, 3]
  7363. */
  7364. function dropRight(array, n, guard) {
  7365. var length = array == null ? 0 : array.length;
  7366. if (!length) {
  7367. return [];
  7368. }
  7369. n = (guard || n === undefined) ? 1 : toInteger(n);
  7370. n = length - n;
  7371. return baseSlice(array, 0, n < 0 ? 0 : n);
  7372. }
  7373. /**
  7374. * Creates a slice of `array` excluding elements dropped from the end.
  7375. * Elements are dropped until `predicate` returns falsey. The predicate is
  7376. * invoked with three arguments: (value, index, array).
  7377. *
  7378. * @static
  7379. * @memberOf _
  7380. * @since 3.0.0
  7381. * @category Array
  7382. * @param {Array} array The array to query.
  7383. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7384. * @returns {Array} Returns the slice of `array`.
  7385. * @example
  7386. *
  7387. * var users = [
  7388. * { 'user': 'barney', 'active': true },
  7389. * { 'user': 'fred', 'active': false },
  7390. * { 'user': 'pebbles', 'active': false }
  7391. * ];
  7392. *
  7393. * _.dropRightWhile(users, function(o) { return !o.active; });
  7394. * // => objects for ['barney']
  7395. *
  7396. * // The `_.matches` iteratee shorthand.
  7397. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  7398. * // => objects for ['barney', 'fred']
  7399. *
  7400. * // The `_.matchesProperty` iteratee shorthand.
  7401. * _.dropRightWhile(users, ['active', false]);
  7402. * // => objects for ['barney']
  7403. *
  7404. * // The `_.property` iteratee shorthand.
  7405. * _.dropRightWhile(users, 'active');
  7406. * // => objects for ['barney', 'fred', 'pebbles']
  7407. */
  7408. function dropRightWhile(array, predicate) {
  7409. return (array && array.length)
  7410. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  7411. : [];
  7412. }
  7413. /**
  7414. * Creates a slice of `array` excluding elements dropped from the beginning.
  7415. * Elements are dropped until `predicate` returns falsey. The predicate is
  7416. * invoked with three arguments: (value, index, array).
  7417. *
  7418. * @static
  7419. * @memberOf _
  7420. * @since 3.0.0
  7421. * @category Array
  7422. * @param {Array} array The array to query.
  7423. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7424. * @returns {Array} Returns the slice of `array`.
  7425. * @example
  7426. *
  7427. * var users = [
  7428. * { 'user': 'barney', 'active': false },
  7429. * { 'user': 'fred', 'active': false },
  7430. * { 'user': 'pebbles', 'active': true }
  7431. * ];
  7432. *
  7433. * _.dropWhile(users, function(o) { return !o.active; });
  7434. * // => objects for ['pebbles']
  7435. *
  7436. * // The `_.matches` iteratee shorthand.
  7437. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  7438. * // => objects for ['fred', 'pebbles']
  7439. *
  7440. * // The `_.matchesProperty` iteratee shorthand.
  7441. * _.dropWhile(users, ['active', false]);
  7442. * // => objects for ['pebbles']
  7443. *
  7444. * // The `_.property` iteratee shorthand.
  7445. * _.dropWhile(users, 'active');
  7446. * // => objects for ['barney', 'fred', 'pebbles']
  7447. */
  7448. function dropWhile(array, predicate) {
  7449. return (array && array.length)
  7450. ? baseWhile(array, getIteratee(predicate, 3), true)
  7451. : [];
  7452. }
  7453. /**
  7454. * Fills elements of `array` with `value` from `start` up to, but not
  7455. * including, `end`.
  7456. *
  7457. * **Note:** This method mutates `array`.
  7458. *
  7459. * @static
  7460. * @memberOf _
  7461. * @since 3.2.0
  7462. * @category Array
  7463. * @param {Array} array The array to fill.
  7464. * @param {*} value The value to fill `array` with.
  7465. * @param {number} [start=0] The start position.
  7466. * @param {number} [end=array.length] The end position.
  7467. * @returns {Array} Returns `array`.
  7468. * @example
  7469. *
  7470. * var array = [1, 2, 3];
  7471. *
  7472. * _.fill(array, 'a');
  7473. * console.log(array);
  7474. * // => ['a', 'a', 'a']
  7475. *
  7476. * _.fill(Array(3), 2);
  7477. * // => [2, 2, 2]
  7478. *
  7479. * _.fill([4, 6, 8, 10], '*', 1, 3);
  7480. * // => [4, '*', '*', 10]
  7481. */
  7482. function fill(array, value, start, end) {
  7483. var length = array == null ? 0 : array.length;
  7484. if (!length) {
  7485. return [];
  7486. }
  7487. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  7488. start = 0;
  7489. end = length;
  7490. }
  7491. return baseFill(array, value, start, end);
  7492. }
  7493. /**
  7494. * This method is like `_.find` except that it returns the index of the first
  7495. * element `predicate` returns truthy for instead of the element itself.
  7496. *
  7497. * @static
  7498. * @memberOf _
  7499. * @since 1.1.0
  7500. * @category Array
  7501. * @param {Array} array The array to inspect.
  7502. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7503. * @param {number} [fromIndex=0] The index to search from.
  7504. * @returns {number} Returns the index of the found element, else `-1`.
  7505. * @example
  7506. *
  7507. * var users = [
  7508. * { 'user': 'barney', 'active': false },
  7509. * { 'user': 'fred', 'active': false },
  7510. * { 'user': 'pebbles', 'active': true }
  7511. * ];
  7512. *
  7513. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  7514. * // => 0
  7515. *
  7516. * // The `_.matches` iteratee shorthand.
  7517. * _.findIndex(users, { 'user': 'fred', 'active': false });
  7518. * // => 1
  7519. *
  7520. * // The `_.matchesProperty` iteratee shorthand.
  7521. * _.findIndex(users, ['active', false]);
  7522. * // => 0
  7523. *
  7524. * // The `_.property` iteratee shorthand.
  7525. * _.findIndex(users, 'active');
  7526. * // => 2
  7527. */
  7528. function findIndex(array, predicate, fromIndex) {
  7529. var length = array == null ? 0 : array.length;
  7530. if (!length) {
  7531. return -1;
  7532. }
  7533. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  7534. if (index < 0) {
  7535. index = nativeMax(length + index, 0);
  7536. }
  7537. return baseFindIndex(array, getIteratee(predicate, 3), index);
  7538. }
  7539. /**
  7540. * This method is like `_.findIndex` except that it iterates over elements
  7541. * of `collection` from right to left.
  7542. *
  7543. * @static
  7544. * @memberOf _
  7545. * @since 2.0.0
  7546. * @category Array
  7547. * @param {Array} array The array to inspect.
  7548. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7549. * @param {number} [fromIndex=array.length-1] The index to search from.
  7550. * @returns {number} Returns the index of the found element, else `-1`.
  7551. * @example
  7552. *
  7553. * var users = [
  7554. * { 'user': 'barney', 'active': true },
  7555. * { 'user': 'fred', 'active': false },
  7556. * { 'user': 'pebbles', 'active': false }
  7557. * ];
  7558. *
  7559. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  7560. * // => 2
  7561. *
  7562. * // The `_.matches` iteratee shorthand.
  7563. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  7564. * // => 0
  7565. *
  7566. * // The `_.matchesProperty` iteratee shorthand.
  7567. * _.findLastIndex(users, ['active', false]);
  7568. * // => 2
  7569. *
  7570. * // The `_.property` iteratee shorthand.
  7571. * _.findLastIndex(users, 'active');
  7572. * // => 0
  7573. */
  7574. function findLastIndex(array, predicate, fromIndex) {
  7575. var length = array == null ? 0 : array.length;
  7576. if (!length) {
  7577. return -1;
  7578. }
  7579. var index = length - 1;
  7580. if (fromIndex !== undefined) {
  7581. index = toInteger(fromIndex);
  7582. index = fromIndex < 0
  7583. ? nativeMax(length + index, 0)
  7584. : nativeMin(index, length - 1);
  7585. }
  7586. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  7587. }
  7588. /**
  7589. * Flattens `array` a single level deep.
  7590. *
  7591. * @static
  7592. * @memberOf _
  7593. * @since 0.1.0
  7594. * @category Array
  7595. * @param {Array} array The array to flatten.
  7596. * @returns {Array} Returns the new flattened array.
  7597. * @example
  7598. *
  7599. * _.flatten([1, [2, [3, [4]], 5]]);
  7600. * // => [1, 2, [3, [4]], 5]
  7601. */
  7602. function flatten(array) {
  7603. var length = array == null ? 0 : array.length;
  7604. return length ? baseFlatten(array, 1) : [];
  7605. }
  7606. /**
  7607. * Recursively flattens `array`.
  7608. *
  7609. * @static
  7610. * @memberOf _
  7611. * @since 3.0.0
  7612. * @category Array
  7613. * @param {Array} array The array to flatten.
  7614. * @returns {Array} Returns the new flattened array.
  7615. * @example
  7616. *
  7617. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  7618. * // => [1, 2, 3, 4, 5]
  7619. */
  7620. function flattenDeep(array) {
  7621. var length = array == null ? 0 : array.length;
  7622. return length ? baseFlatten(array, INFINITY) : [];
  7623. }
  7624. /**
  7625. * Recursively flatten `array` up to `depth` times.
  7626. *
  7627. * @static
  7628. * @memberOf _
  7629. * @since 4.4.0
  7630. * @category Array
  7631. * @param {Array} array The array to flatten.
  7632. * @param {number} [depth=1] The maximum recursion depth.
  7633. * @returns {Array} Returns the new flattened array.
  7634. * @example
  7635. *
  7636. * var array = [1, [2, [3, [4]], 5]];
  7637. *
  7638. * _.flattenDepth(array, 1);
  7639. * // => [1, 2, [3, [4]], 5]
  7640. *
  7641. * _.flattenDepth(array, 2);
  7642. * // => [1, 2, 3, [4], 5]
  7643. */
  7644. function flattenDepth(array, depth) {
  7645. var length = array == null ? 0 : array.length;
  7646. if (!length) {
  7647. return [];
  7648. }
  7649. depth = depth === undefined ? 1 : toInteger(depth);
  7650. return baseFlatten(array, depth);
  7651. }
  7652. /**
  7653. * The inverse of `_.toPairs`; this method returns an object composed
  7654. * from key-value `pairs`.
  7655. *
  7656. * @static
  7657. * @memberOf _
  7658. * @since 4.0.0
  7659. * @category Array
  7660. * @param {Array} pairs The key-value pairs.
  7661. * @returns {Object} Returns the new object.
  7662. * @example
  7663. *
  7664. * _.fromPairs([['a', 1], ['b', 2]]);
  7665. * // => { 'a': 1, 'b': 2 }
  7666. */
  7667. function fromPairs(pairs) {
  7668. var index = -1,
  7669. length = pairs == null ? 0 : pairs.length,
  7670. result = {};
  7671. while (++index < length) {
  7672. var pair = pairs[index];
  7673. result[pair[0]] = pair[1];
  7674. }
  7675. return result;
  7676. }
  7677. /**
  7678. * Gets the first element of `array`.
  7679. *
  7680. * @static
  7681. * @memberOf _
  7682. * @since 0.1.0
  7683. * @alias first
  7684. * @category Array
  7685. * @param {Array} array The array to query.
  7686. * @returns {*} Returns the first element of `array`.
  7687. * @example
  7688. *
  7689. * _.head([1, 2, 3]);
  7690. * // => 1
  7691. *
  7692. * _.head([]);
  7693. * // => undefined
  7694. */
  7695. function head(array) {
  7696. return (array && array.length) ? array[0] : undefined;
  7697. }
  7698. /**
  7699. * Gets the index at which the first occurrence of `value` is found in `array`
  7700. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  7701. * for equality comparisons. If `fromIndex` is negative, it's used as the
  7702. * offset from the end of `array`.
  7703. *
  7704. * @static
  7705. * @memberOf _
  7706. * @since 0.1.0
  7707. * @category Array
  7708. * @param {Array} array The array to inspect.
  7709. * @param {*} value The value to search for.
  7710. * @param {number} [fromIndex=0] The index to search from.
  7711. * @returns {number} Returns the index of the matched value, else `-1`.
  7712. * @example
  7713. *
  7714. * _.indexOf([1, 2, 1, 2], 2);
  7715. * // => 1
  7716. *
  7717. * // Search from the `fromIndex`.
  7718. * _.indexOf([1, 2, 1, 2], 2, 2);
  7719. * // => 3
  7720. */
  7721. function indexOf(array, value, fromIndex) {
  7722. var length = array == null ? 0 : array.length;
  7723. if (!length) {
  7724. return -1;
  7725. }
  7726. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  7727. if (index < 0) {
  7728. index = nativeMax(length + index, 0);
  7729. }
  7730. return baseIndexOf(array, value, index);
  7731. }
  7732. /**
  7733. * Gets all but the last element of `array`.
  7734. *
  7735. * @static
  7736. * @memberOf _
  7737. * @since 0.1.0
  7738. * @category Array
  7739. * @param {Array} array The array to query.
  7740. * @returns {Array} Returns the slice of `array`.
  7741. * @example
  7742. *
  7743. * _.initial([1, 2, 3]);
  7744. * // => [1, 2]
  7745. */
  7746. function initial(array) {
  7747. var length = array == null ? 0 : array.length;
  7748. return length ? baseSlice(array, 0, -1) : [];
  7749. }
  7750. /**
  7751. * Creates an array of unique values that are included in all given arrays
  7752. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  7753. * for equality comparisons. The order and references of result values are
  7754. * determined by the first array.
  7755. *
  7756. * @static
  7757. * @memberOf _
  7758. * @since 0.1.0
  7759. * @category Array
  7760. * @param {...Array} [arrays] The arrays to inspect.
  7761. * @returns {Array} Returns the new array of intersecting values.
  7762. * @example
  7763. *
  7764. * _.intersection([2, 1], [2, 3]);
  7765. * // => [2]
  7766. */
  7767. var intersection = baseRest(function(arrays) {
  7768. var mapped = arrayMap(arrays, castArrayLikeObject);
  7769. return (mapped.length && mapped[0] === arrays[0])
  7770. ? baseIntersection(mapped)
  7771. : [];
  7772. });
  7773. /**
  7774. * This method is like `_.intersection` except that it accepts `iteratee`
  7775. * which is invoked for each element of each `arrays` to generate the criterion
  7776. * by which they're compared. The order and references of result values are
  7777. * determined by the first array. The iteratee is invoked with one argument:
  7778. * (value).
  7779. *
  7780. * @static
  7781. * @memberOf _
  7782. * @since 4.0.0
  7783. * @category Array
  7784. * @param {...Array} [arrays] The arrays to inspect.
  7785. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  7786. * @returns {Array} Returns the new array of intersecting values.
  7787. * @example
  7788. *
  7789. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  7790. * // => [2.1]
  7791. *
  7792. * // The `_.property` iteratee shorthand.
  7793. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  7794. * // => [{ 'x': 1 }]
  7795. */
  7796. var intersectionBy = baseRest(function(arrays) {
  7797. var iteratee = last(arrays),
  7798. mapped = arrayMap(arrays, castArrayLikeObject);
  7799. if (iteratee === last(mapped)) {
  7800. iteratee = undefined;
  7801. } else {
  7802. mapped.pop();
  7803. }
  7804. return (mapped.length && mapped[0] === arrays[0])
  7805. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  7806. : [];
  7807. });
  7808. /**
  7809. * This method is like `_.intersection` except that it accepts `comparator`
  7810. * which is invoked to compare elements of `arrays`. The order and references
  7811. * of result values are determined by the first array. The comparator is
  7812. * invoked with two arguments: (arrVal, othVal).
  7813. *
  7814. * @static
  7815. * @memberOf _
  7816. * @since 4.0.0
  7817. * @category Array
  7818. * @param {...Array} [arrays] The arrays to inspect.
  7819. * @param {Function} [comparator] The comparator invoked per element.
  7820. * @returns {Array} Returns the new array of intersecting values.
  7821. * @example
  7822. *
  7823. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  7824. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  7825. *
  7826. * _.intersectionWith(objects, others, _.isEqual);
  7827. * // => [{ 'x': 1, 'y': 2 }]
  7828. */
  7829. var intersectionWith = baseRest(function(arrays) {
  7830. var comparator = last(arrays),
  7831. mapped = arrayMap(arrays, castArrayLikeObject);
  7832. comparator = typeof comparator == 'function' ? comparator : undefined;
  7833. if (comparator) {
  7834. mapped.pop();
  7835. }
  7836. return (mapped.length && mapped[0] === arrays[0])
  7837. ? baseIntersection(mapped, undefined, comparator)
  7838. : [];
  7839. });
  7840. /**
  7841. * Converts all elements in `array` into a string separated by `separator`.
  7842. *
  7843. * @static
  7844. * @memberOf _
  7845. * @since 4.0.0
  7846. * @category Array
  7847. * @param {Array} array The array to convert.
  7848. * @param {string} [separator=','] The element separator.
  7849. * @returns {string} Returns the joined string.
  7850. * @example
  7851. *
  7852. * _.join(['a', 'b', 'c'], '~');
  7853. * // => 'a~b~c'
  7854. */
  7855. function join(array, separator) {
  7856. return array == null ? '' : nativeJoin.call(array, separator);
  7857. }
  7858. /**
  7859. * Gets the last element of `array`.
  7860. *
  7861. * @static
  7862. * @memberOf _
  7863. * @since 0.1.0
  7864. * @category Array
  7865. * @param {Array} array The array to query.
  7866. * @returns {*} Returns the last element of `array`.
  7867. * @example
  7868. *
  7869. * _.last([1, 2, 3]);
  7870. * // => 3
  7871. */
  7872. function last(array) {
  7873. var length = array == null ? 0 : array.length;
  7874. return length ? array[length - 1] : undefined;
  7875. }
  7876. /**
  7877. * This method is like `_.indexOf` except that it iterates over elements of
  7878. * `array` from right to left.
  7879. *
  7880. * @static
  7881. * @memberOf _
  7882. * @since 0.1.0
  7883. * @category Array
  7884. * @param {Array} array The array to inspect.
  7885. * @param {*} value The value to search for.
  7886. * @param {number} [fromIndex=array.length-1] The index to search from.
  7887. * @returns {number} Returns the index of the matched value, else `-1`.
  7888. * @example
  7889. *
  7890. * _.lastIndexOf([1, 2, 1, 2], 2);
  7891. * // => 3
  7892. *
  7893. * // Search from the `fromIndex`.
  7894. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  7895. * // => 1
  7896. */
  7897. function lastIndexOf(array, value, fromIndex) {
  7898. var length = array == null ? 0 : array.length;
  7899. if (!length) {
  7900. return -1;
  7901. }
  7902. var index = length;
  7903. if (fromIndex !== undefined) {
  7904. index = toInteger(fromIndex);
  7905. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  7906. }
  7907. return value === value
  7908. ? strictLastIndexOf(array, value, index)
  7909. : baseFindIndex(array, baseIsNaN, index, true);
  7910. }
  7911. /**
  7912. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  7913. * element from the end is returned.
  7914. *
  7915. * @static
  7916. * @memberOf _
  7917. * @since 4.11.0
  7918. * @category Array
  7919. * @param {Array} array The array to query.
  7920. * @param {number} [n=0] The index of the element to return.
  7921. * @returns {*} Returns the nth element of `array`.
  7922. * @example
  7923. *
  7924. * var array = ['a', 'b', 'c', 'd'];
  7925. *
  7926. * _.nth(array, 1);
  7927. * // => 'b'
  7928. *
  7929. * _.nth(array, -2);
  7930. * // => 'c';
  7931. */
  7932. function nth(array, n) {
  7933. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  7934. }
  7935. /**
  7936. * Removes all given values from `array` using
  7937. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  7938. * for equality comparisons.
  7939. *
  7940. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  7941. * to remove elements from an array by predicate.
  7942. *
  7943. * @static
  7944. * @memberOf _
  7945. * @since 2.0.0
  7946. * @category Array
  7947. * @param {Array} array The array to modify.
  7948. * @param {...*} [values] The values to remove.
  7949. * @returns {Array} Returns `array`.
  7950. * @example
  7951. *
  7952. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  7953. *
  7954. * _.pull(array, 'a', 'c');
  7955. * console.log(array);
  7956. * // => ['b', 'b']
  7957. */
  7958. var pull = baseRest(pullAll);
  7959. /**
  7960. * This method is like `_.pull` except that it accepts an array of values to remove.
  7961. *
  7962. * **Note:** Unlike `_.difference`, this method mutates `array`.
  7963. *
  7964. * @static
  7965. * @memberOf _
  7966. * @since 4.0.0
  7967. * @category Array
  7968. * @param {Array} array The array to modify.
  7969. * @param {Array} values The values to remove.
  7970. * @returns {Array} Returns `array`.
  7971. * @example
  7972. *
  7973. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  7974. *
  7975. * _.pullAll(array, ['a', 'c']);
  7976. * console.log(array);
  7977. * // => ['b', 'b']
  7978. */
  7979. function pullAll(array, values) {
  7980. return (array && array.length && values && values.length)
  7981. ? basePullAll(array, values)
  7982. : array;
  7983. }
  7984. /**
  7985. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  7986. * invoked for each element of `array` and `values` to generate the criterion
  7987. * by which they're compared. The iteratee is invoked with one argument: (value).
  7988. *
  7989. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  7990. *
  7991. * @static
  7992. * @memberOf _
  7993. * @since 4.0.0
  7994. * @category Array
  7995. * @param {Array} array The array to modify.
  7996. * @param {Array} values The values to remove.
  7997. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  7998. * @returns {Array} Returns `array`.
  7999. * @example
  8000. *
  8001. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  8002. *
  8003. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  8004. * console.log(array);
  8005. * // => [{ 'x': 2 }]
  8006. */
  8007. function pullAllBy(array, values, iteratee) {
  8008. return (array && array.length && values && values.length)
  8009. ? basePullAll(array, values, getIteratee(iteratee, 2))
  8010. : array;
  8011. }
  8012. /**
  8013. * This method is like `_.pullAll` except that it accepts `comparator` which
  8014. * is invoked to compare elements of `array` to `values`. The comparator is
  8015. * invoked with two arguments: (arrVal, othVal).
  8016. *
  8017. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  8018. *
  8019. * @static
  8020. * @memberOf _
  8021. * @since 4.6.0
  8022. * @category Array
  8023. * @param {Array} array The array to modify.
  8024. * @param {Array} values The values to remove.
  8025. * @param {Function} [comparator] The comparator invoked per element.
  8026. * @returns {Array} Returns `array`.
  8027. * @example
  8028. *
  8029. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  8030. *
  8031. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  8032. * console.log(array);
  8033. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  8034. */
  8035. function pullAllWith(array, values, comparator) {
  8036. return (array && array.length && values && values.length)
  8037. ? basePullAll(array, values, undefined, comparator)
  8038. : array;
  8039. }
  8040. /**
  8041. * Removes elements from `array` corresponding to `indexes` and returns an
  8042. * array of removed elements.
  8043. *
  8044. * **Note:** Unlike `_.at`, this method mutates `array`.
  8045. *
  8046. * @static
  8047. * @memberOf _
  8048. * @since 3.0.0
  8049. * @category Array
  8050. * @param {Array} array The array to modify.
  8051. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  8052. * @returns {Array} Returns the new array of removed elements.
  8053. * @example
  8054. *
  8055. * var array = ['a', 'b', 'c', 'd'];
  8056. * var pulled = _.pullAt(array, [1, 3]);
  8057. *
  8058. * console.log(array);
  8059. * // => ['a', 'c']
  8060. *
  8061. * console.log(pulled);
  8062. * // => ['b', 'd']
  8063. */
  8064. var pullAt = flatRest(function(array, indexes) {
  8065. var length = array == null ? 0 : array.length,
  8066. result = baseAt(array, indexes);
  8067. basePullAt(array, arrayMap(indexes, function(index) {
  8068. return isIndex(index, length) ? +index : index;
  8069. }).sort(compareAscending));
  8070. return result;
  8071. });
  8072. /**
  8073. * Removes all elements from `array` that `predicate` returns truthy for
  8074. * and returns an array of the removed elements. The predicate is invoked
  8075. * with three arguments: (value, index, array).
  8076. *
  8077. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  8078. * to pull elements from an array by value.
  8079. *
  8080. * @static
  8081. * @memberOf _
  8082. * @since 2.0.0
  8083. * @category Array
  8084. * @param {Array} array The array to modify.
  8085. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8086. * @returns {Array} Returns the new array of removed elements.
  8087. * @example
  8088. *
  8089. * var array = [1, 2, 3, 4];
  8090. * var evens = _.remove(array, function(n) {
  8091. * return n % 2 == 0;
  8092. * });
  8093. *
  8094. * console.log(array);
  8095. * // => [1, 3]
  8096. *
  8097. * console.log(evens);
  8098. * // => [2, 4]
  8099. */
  8100. function remove(array, predicate) {
  8101. var result = [];
  8102. if (!(array && array.length)) {
  8103. return result;
  8104. }
  8105. var index = -1,
  8106. indexes = [],
  8107. length = array.length;
  8108. predicate = getIteratee(predicate, 3);
  8109. while (++index < length) {
  8110. var value = array[index];
  8111. if (predicate(value, index, array)) {
  8112. result.push(value);
  8113. indexes.push(index);
  8114. }
  8115. }
  8116. basePullAt(array, indexes);
  8117. return result;
  8118. }
  8119. /**
  8120. * Reverses `array` so that the first element becomes the last, the second
  8121. * element becomes the second to last, and so on.
  8122. *
  8123. * **Note:** This method mutates `array` and is based on
  8124. * [`Array#reverse`](https://mdn.io/Array/reverse).
  8125. *
  8126. * @static
  8127. * @memberOf _
  8128. * @since 4.0.0
  8129. * @category Array
  8130. * @param {Array} array The array to modify.
  8131. * @returns {Array} Returns `array`.
  8132. * @example
  8133. *
  8134. * var array = [1, 2, 3];
  8135. *
  8136. * _.reverse(array);
  8137. * // => [3, 2, 1]
  8138. *
  8139. * console.log(array);
  8140. * // => [3, 2, 1]
  8141. */
  8142. function reverse(array) {
  8143. return array == null ? array : nativeReverse.call(array);
  8144. }
  8145. /**
  8146. * Creates a slice of `array` from `start` up to, but not including, `end`.
  8147. *
  8148. * **Note:** This method is used instead of
  8149. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  8150. * returned.
  8151. *
  8152. * @static
  8153. * @memberOf _
  8154. * @since 3.0.0
  8155. * @category Array
  8156. * @param {Array} array The array to slice.
  8157. * @param {number} [start=0] The start position.
  8158. * @param {number} [end=array.length] The end position.
  8159. * @returns {Array} Returns the slice of `array`.
  8160. */
  8161. function slice(array, start, end) {
  8162. var length = array == null ? 0 : array.length;
  8163. if (!length) {
  8164. return [];
  8165. }
  8166. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  8167. start = 0;
  8168. end = length;
  8169. }
  8170. else {
  8171. start = start == null ? 0 : toInteger(start);
  8172. end = end === undefined ? length : toInteger(end);
  8173. }
  8174. return baseSlice(array, start, end);
  8175. }
  8176. /**
  8177. * Uses a binary search to determine the lowest index at which `value`
  8178. * should be inserted into `array` in order to maintain its sort order.
  8179. *
  8180. * @static
  8181. * @memberOf _
  8182. * @since 0.1.0
  8183. * @category Array
  8184. * @param {Array} array The sorted array to inspect.
  8185. * @param {*} value The value to evaluate.
  8186. * @returns {number} Returns the index at which `value` should be inserted
  8187. * into `array`.
  8188. * @example
  8189. *
  8190. * _.sortedIndex([30, 50], 40);
  8191. * // => 1
  8192. */
  8193. function sortedIndex(array, value) {
  8194. return baseSortedIndex(array, value);
  8195. }
  8196. /**
  8197. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  8198. * which is invoked for `value` and each element of `array` to compute their
  8199. * sort ranking. The iteratee is invoked with one argument: (value).
  8200. *
  8201. * @static
  8202. * @memberOf _
  8203. * @since 4.0.0
  8204. * @category Array
  8205. * @param {Array} array The sorted array to inspect.
  8206. * @param {*} value The value to evaluate.
  8207. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8208. * @returns {number} Returns the index at which `value` should be inserted
  8209. * into `array`.
  8210. * @example
  8211. *
  8212. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  8213. *
  8214. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  8215. * // => 0
  8216. *
  8217. * // The `_.property` iteratee shorthand.
  8218. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  8219. * // => 0
  8220. */
  8221. function sortedIndexBy(array, value, iteratee) {
  8222. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  8223. }
  8224. /**
  8225. * This method is like `_.indexOf` except that it performs a binary
  8226. * search on a sorted `array`.
  8227. *
  8228. * @static
  8229. * @memberOf _
  8230. * @since 4.0.0
  8231. * @category Array
  8232. * @param {Array} array The array to inspect.
  8233. * @param {*} value The value to search for.
  8234. * @returns {number} Returns the index of the matched value, else `-1`.
  8235. * @example
  8236. *
  8237. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  8238. * // => 1
  8239. */
  8240. function sortedIndexOf(array, value) {
  8241. var length = array == null ? 0 : array.length;
  8242. if (length) {
  8243. var index = baseSortedIndex(array, value);
  8244. if (index < length && eq(array[index], value)) {
  8245. return index;
  8246. }
  8247. }
  8248. return -1;
  8249. }
  8250. /**
  8251. * This method is like `_.sortedIndex` except that it returns the highest
  8252. * index at which `value` should be inserted into `array` in order to
  8253. * maintain its sort order.
  8254. *
  8255. * @static
  8256. * @memberOf _
  8257. * @since 3.0.0
  8258. * @category Array
  8259. * @param {Array} array The sorted array to inspect.
  8260. * @param {*} value The value to evaluate.
  8261. * @returns {number} Returns the index at which `value` should be inserted
  8262. * into `array`.
  8263. * @example
  8264. *
  8265. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  8266. * // => 4
  8267. */
  8268. function sortedLastIndex(array, value) {
  8269. return baseSortedIndex(array, value, true);
  8270. }
  8271. /**
  8272. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  8273. * which is invoked for `value` and each element of `array` to compute their
  8274. * sort ranking. The iteratee is invoked with one argument: (value).
  8275. *
  8276. * @static
  8277. * @memberOf _
  8278. * @since 4.0.0
  8279. * @category Array
  8280. * @param {Array} array The sorted array to inspect.
  8281. * @param {*} value The value to evaluate.
  8282. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8283. * @returns {number} Returns the index at which `value` should be inserted
  8284. * into `array`.
  8285. * @example
  8286. *
  8287. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  8288. *
  8289. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  8290. * // => 1
  8291. *
  8292. * // The `_.property` iteratee shorthand.
  8293. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  8294. * // => 1
  8295. */
  8296. function sortedLastIndexBy(array, value, iteratee) {
  8297. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  8298. }
  8299. /**
  8300. * This method is like `_.lastIndexOf` except that it performs a binary
  8301. * search on a sorted `array`.
  8302. *
  8303. * @static
  8304. * @memberOf _
  8305. * @since 4.0.0
  8306. * @category Array
  8307. * @param {Array} array The array to inspect.
  8308. * @param {*} value The value to search for.
  8309. * @returns {number} Returns the index of the matched value, else `-1`.
  8310. * @example
  8311. *
  8312. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  8313. * // => 3
  8314. */
  8315. function sortedLastIndexOf(array, value) {
  8316. var length = array == null ? 0 : array.length;
  8317. if (length) {
  8318. var index = baseSortedIndex(array, value, true) - 1;
  8319. if (eq(array[index], value)) {
  8320. return index;
  8321. }
  8322. }
  8323. return -1;
  8324. }
  8325. /**
  8326. * This method is like `_.uniq` except that it's designed and optimized
  8327. * for sorted arrays.
  8328. *
  8329. * @static
  8330. * @memberOf _
  8331. * @since 4.0.0
  8332. * @category Array
  8333. * @param {Array} array The array to inspect.
  8334. * @returns {Array} Returns the new duplicate free array.
  8335. * @example
  8336. *
  8337. * _.sortedUniq([1, 1, 2]);
  8338. * // => [1, 2]
  8339. */
  8340. function sortedUniq(array) {
  8341. return (array && array.length)
  8342. ? baseSortedUniq(array)
  8343. : [];
  8344. }
  8345. /**
  8346. * This method is like `_.uniqBy` except that it's designed and optimized
  8347. * for sorted arrays.
  8348. *
  8349. * @static
  8350. * @memberOf _
  8351. * @since 4.0.0
  8352. * @category Array
  8353. * @param {Array} array The array to inspect.
  8354. * @param {Function} [iteratee] The iteratee invoked per element.
  8355. * @returns {Array} Returns the new duplicate free array.
  8356. * @example
  8357. *
  8358. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  8359. * // => [1.1, 2.3]
  8360. */
  8361. function sortedUniqBy(array, iteratee) {
  8362. return (array && array.length)
  8363. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  8364. : [];
  8365. }
  8366. /**
  8367. * Gets all but the first element of `array`.
  8368. *
  8369. * @static
  8370. * @memberOf _
  8371. * @since 4.0.0
  8372. * @category Array
  8373. * @param {Array} array The array to query.
  8374. * @returns {Array} Returns the slice of `array`.
  8375. * @example
  8376. *
  8377. * _.tail([1, 2, 3]);
  8378. * // => [2, 3]
  8379. */
  8380. function tail(array) {
  8381. var length = array == null ? 0 : array.length;
  8382. return length ? baseSlice(array, 1, length) : [];
  8383. }
  8384. /**
  8385. * Creates a slice of `array` with `n` elements taken from the beginning.
  8386. *
  8387. * @static
  8388. * @memberOf _
  8389. * @since 0.1.0
  8390. * @category Array
  8391. * @param {Array} array The array to query.
  8392. * @param {number} [n=1] The number of elements to take.
  8393. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8394. * @returns {Array} Returns the slice of `array`.
  8395. * @example
  8396. *
  8397. * _.take([1, 2, 3]);
  8398. * // => [1]
  8399. *
  8400. * _.take([1, 2, 3], 2);
  8401. * // => [1, 2]
  8402. *
  8403. * _.take([1, 2, 3], 5);
  8404. * // => [1, 2, 3]
  8405. *
  8406. * _.take([1, 2, 3], 0);
  8407. * // => []
  8408. */
  8409. function take(array, n, guard) {
  8410. if (!(array && array.length)) {
  8411. return [];
  8412. }
  8413. n = (guard || n === undefined) ? 1 : toInteger(n);
  8414. return baseSlice(array, 0, n < 0 ? 0 : n);
  8415. }
  8416. /**
  8417. * Creates a slice of `array` with `n` elements taken from the end.
  8418. *
  8419. * @static
  8420. * @memberOf _
  8421. * @since 3.0.0
  8422. * @category Array
  8423. * @param {Array} array The array to query.
  8424. * @param {number} [n=1] The number of elements to take.
  8425. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8426. * @returns {Array} Returns the slice of `array`.
  8427. * @example
  8428. *
  8429. * _.takeRight([1, 2, 3]);
  8430. * // => [3]
  8431. *
  8432. * _.takeRight([1, 2, 3], 2);
  8433. * // => [2, 3]
  8434. *
  8435. * _.takeRight([1, 2, 3], 5);
  8436. * // => [1, 2, 3]
  8437. *
  8438. * _.takeRight([1, 2, 3], 0);
  8439. * // => []
  8440. */
  8441. function takeRight(array, n, guard) {
  8442. var length = array == null ? 0 : array.length;
  8443. if (!length) {
  8444. return [];
  8445. }
  8446. n = (guard || n === undefined) ? 1 : toInteger(n);
  8447. n = length - n;
  8448. return baseSlice(array, n < 0 ? 0 : n, length);
  8449. }
  8450. /**
  8451. * Creates a slice of `array` with elements taken from the end. Elements are
  8452. * taken until `predicate` returns falsey. The predicate is invoked with
  8453. * three arguments: (value, index, array).
  8454. *
  8455. * @static
  8456. * @memberOf _
  8457. * @since 3.0.0
  8458. * @category Array
  8459. * @param {Array} array The array to query.
  8460. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8461. * @returns {Array} Returns the slice of `array`.
  8462. * @example
  8463. *
  8464. * var users = [
  8465. * { 'user': 'barney', 'active': true },
  8466. * { 'user': 'fred', 'active': false },
  8467. * { 'user': 'pebbles', 'active': false }
  8468. * ];
  8469. *
  8470. * _.takeRightWhile(users, function(o) { return !o.active; });
  8471. * // => objects for ['fred', 'pebbles']
  8472. *
  8473. * // The `_.matches` iteratee shorthand.
  8474. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  8475. * // => objects for ['pebbles']
  8476. *
  8477. * // The `_.matchesProperty` iteratee shorthand.
  8478. * _.takeRightWhile(users, ['active', false]);
  8479. * // => objects for ['fred', 'pebbles']
  8480. *
  8481. * // The `_.property` iteratee shorthand.
  8482. * _.takeRightWhile(users, 'active');
  8483. * // => []
  8484. */
  8485. function takeRightWhile(array, predicate) {
  8486. return (array && array.length)
  8487. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  8488. : [];
  8489. }
  8490. /**
  8491. * Creates a slice of `array` with elements taken from the beginning. Elements
  8492. * are taken until `predicate` returns falsey. The predicate is invoked with
  8493. * three arguments: (value, index, array).
  8494. *
  8495. * @static
  8496. * @memberOf _
  8497. * @since 3.0.0
  8498. * @category Array
  8499. * @param {Array} array The array to query.
  8500. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8501. * @returns {Array} Returns the slice of `array`.
  8502. * @example
  8503. *
  8504. * var users = [
  8505. * { 'user': 'barney', 'active': false },
  8506. * { 'user': 'fred', 'active': false },
  8507. * { 'user': 'pebbles', 'active': true }
  8508. * ];
  8509. *
  8510. * _.takeWhile(users, function(o) { return !o.active; });
  8511. * // => objects for ['barney', 'fred']
  8512. *
  8513. * // The `_.matches` iteratee shorthand.
  8514. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  8515. * // => objects for ['barney']
  8516. *
  8517. * // The `_.matchesProperty` iteratee shorthand.
  8518. * _.takeWhile(users, ['active', false]);
  8519. * // => objects for ['barney', 'fred']
  8520. *
  8521. * // The `_.property` iteratee shorthand.
  8522. * _.takeWhile(users, 'active');
  8523. * // => []
  8524. */
  8525. function takeWhile(array, predicate) {
  8526. return (array && array.length)
  8527. ? baseWhile(array, getIteratee(predicate, 3))
  8528. : [];
  8529. }
  8530. /**
  8531. * Creates an array of unique values, in order, from all given arrays using
  8532. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8533. * for equality comparisons.
  8534. *
  8535. * @static
  8536. * @memberOf _
  8537. * @since 0.1.0
  8538. * @category Array
  8539. * @param {...Array} [arrays] The arrays to inspect.
  8540. * @returns {Array} Returns the new array of combined values.
  8541. * @example
  8542. *
  8543. * _.union([2], [1, 2]);
  8544. * // => [2, 1]
  8545. */
  8546. var union = baseRest(function(arrays) {
  8547. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  8548. });
  8549. /**
  8550. * This method is like `_.union` except that it accepts `iteratee` which is
  8551. * invoked for each element of each `arrays` to generate the criterion by
  8552. * which uniqueness is computed. Result values are chosen from the first
  8553. * array in which the value occurs. The iteratee is invoked with one argument:
  8554. * (value).
  8555. *
  8556. * @static
  8557. * @memberOf _
  8558. * @since 4.0.0
  8559. * @category Array
  8560. * @param {...Array} [arrays] The arrays to inspect.
  8561. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8562. * @returns {Array} Returns the new array of combined values.
  8563. * @example
  8564. *
  8565. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  8566. * // => [2.1, 1.2]
  8567. *
  8568. * // The `_.property` iteratee shorthand.
  8569. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  8570. * // => [{ 'x': 1 }, { 'x': 2 }]
  8571. */
  8572. var unionBy = baseRest(function(arrays) {
  8573. var iteratee = last(arrays);
  8574. if (isArrayLikeObject(iteratee)) {
  8575. iteratee = undefined;
  8576. }
  8577. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  8578. });
  8579. /**
  8580. * This method is like `_.union` except that it accepts `comparator` which
  8581. * is invoked to compare elements of `arrays`. Result values are chosen from
  8582. * the first array in which the value occurs. The comparator is invoked
  8583. * with two arguments: (arrVal, othVal).
  8584. *
  8585. * @static
  8586. * @memberOf _
  8587. * @since 4.0.0
  8588. * @category Array
  8589. * @param {...Array} [arrays] The arrays to inspect.
  8590. * @param {Function} [comparator] The comparator invoked per element.
  8591. * @returns {Array} Returns the new array of combined values.
  8592. * @example
  8593. *
  8594. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  8595. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  8596. *
  8597. * _.unionWith(objects, others, _.isEqual);
  8598. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  8599. */
  8600. var unionWith = baseRest(function(arrays) {
  8601. var comparator = last(arrays);
  8602. comparator = typeof comparator == 'function' ? comparator : undefined;
  8603. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  8604. });
  8605. /**
  8606. * Creates a duplicate-free version of an array, using
  8607. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8608. * for equality comparisons, in which only the first occurrence of each element
  8609. * is kept. The order of result values is determined by the order they occur
  8610. * in the array.
  8611. *
  8612. * @static
  8613. * @memberOf _
  8614. * @since 0.1.0
  8615. * @category Array
  8616. * @param {Array} array The array to inspect.
  8617. * @returns {Array} Returns the new duplicate free array.
  8618. * @example
  8619. *
  8620. * _.uniq([2, 1, 2]);
  8621. * // => [2, 1]
  8622. */
  8623. function uniq(array) {
  8624. return (array && array.length) ? baseUniq(array) : [];
  8625. }
  8626. /**
  8627. * This method is like `_.uniq` except that it accepts `iteratee` which is
  8628. * invoked for each element in `array` to generate the criterion by which
  8629. * uniqueness is computed. The order of result values is determined by the
  8630. * order they occur in the array. The iteratee is invoked with one argument:
  8631. * (value).
  8632. *
  8633. * @static
  8634. * @memberOf _
  8635. * @since 4.0.0
  8636. * @category Array
  8637. * @param {Array} array The array to inspect.
  8638. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8639. * @returns {Array} Returns the new duplicate free array.
  8640. * @example
  8641. *
  8642. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  8643. * // => [2.1, 1.2]
  8644. *
  8645. * // The `_.property` iteratee shorthand.
  8646. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  8647. * // => [{ 'x': 1 }, { 'x': 2 }]
  8648. */
  8649. function uniqBy(array, iteratee) {
  8650. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  8651. }
  8652. /**
  8653. * This method is like `_.uniq` except that it accepts `comparator` which
  8654. * is invoked to compare elements of `array`. The order of result values is
  8655. * determined by the order they occur in the array.The comparator is invoked
  8656. * with two arguments: (arrVal, othVal).
  8657. *
  8658. * @static
  8659. * @memberOf _
  8660. * @since 4.0.0
  8661. * @category Array
  8662. * @param {Array} array The array to inspect.
  8663. * @param {Function} [comparator] The comparator invoked per element.
  8664. * @returns {Array} Returns the new duplicate free array.
  8665. * @example
  8666. *
  8667. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  8668. *
  8669. * _.uniqWith(objects, _.isEqual);
  8670. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  8671. */
  8672. function uniqWith(array, comparator) {
  8673. comparator = typeof comparator == 'function' ? comparator : undefined;
  8674. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  8675. }
  8676. /**
  8677. * This method is like `_.zip` except that it accepts an array of grouped
  8678. * elements and creates an array regrouping the elements to their pre-zip
  8679. * configuration.
  8680. *
  8681. * @static
  8682. * @memberOf _
  8683. * @since 1.2.0
  8684. * @category Array
  8685. * @param {Array} array The array of grouped elements to process.
  8686. * @returns {Array} Returns the new array of regrouped elements.
  8687. * @example
  8688. *
  8689. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  8690. * // => [['a', 1, true], ['b', 2, false]]
  8691. *
  8692. * _.unzip(zipped);
  8693. * // => [['a', 'b'], [1, 2], [true, false]]
  8694. */
  8695. function unzip(array) {
  8696. if (!(array && array.length)) {
  8697. return [];
  8698. }
  8699. var length = 0;
  8700. array = arrayFilter(array, function(group) {
  8701. if (isArrayLikeObject(group)) {
  8702. length = nativeMax(group.length, length);
  8703. return true;
  8704. }
  8705. });
  8706. return baseTimes(length, function(index) {
  8707. return arrayMap(array, baseProperty(index));
  8708. });
  8709. }
  8710. /**
  8711. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  8712. * how regrouped values should be combined. The iteratee is invoked with the
  8713. * elements of each group: (...group).
  8714. *
  8715. * @static
  8716. * @memberOf _
  8717. * @since 3.8.0
  8718. * @category Array
  8719. * @param {Array} array The array of grouped elements to process.
  8720. * @param {Function} [iteratee=_.identity] The function to combine
  8721. * regrouped values.
  8722. * @returns {Array} Returns the new array of regrouped elements.
  8723. * @example
  8724. *
  8725. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  8726. * // => [[1, 10, 100], [2, 20, 200]]
  8727. *
  8728. * _.unzipWith(zipped, _.add);
  8729. * // => [3, 30, 300]
  8730. */
  8731. function unzipWith(array, iteratee) {
  8732. if (!(array && array.length)) {
  8733. return [];
  8734. }
  8735. var result = unzip(array);
  8736. if (iteratee == null) {
  8737. return result;
  8738. }
  8739. return arrayMap(result, function(group) {
  8740. return apply(iteratee, undefined, group);
  8741. });
  8742. }
  8743. /**
  8744. * Creates an array excluding all given values using
  8745. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8746. * for equality comparisons.
  8747. *
  8748. * **Note:** Unlike `_.pull`, this method returns a new array.
  8749. *
  8750. * @static
  8751. * @memberOf _
  8752. * @since 0.1.0
  8753. * @category Array
  8754. * @param {Array} array The array to inspect.
  8755. * @param {...*} [values] The values to exclude.
  8756. * @returns {Array} Returns the new array of filtered values.
  8757. * @see _.difference, _.xor
  8758. * @example
  8759. *
  8760. * _.without([2, 1, 2, 3], 1, 2);
  8761. * // => [3]
  8762. */
  8763. var without = baseRest(function(array, values) {
  8764. return isArrayLikeObject(array)
  8765. ? baseDifference(array, values)
  8766. : [];
  8767. });
  8768. /**
  8769. * Creates an array of unique values that is the
  8770. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  8771. * of the given arrays. The order of result values is determined by the order
  8772. * they occur in the arrays.
  8773. *
  8774. * @static
  8775. * @memberOf _
  8776. * @since 2.4.0
  8777. * @category Array
  8778. * @param {...Array} [arrays] The arrays to inspect.
  8779. * @returns {Array} Returns the new array of filtered values.
  8780. * @see _.difference, _.without
  8781. * @example
  8782. *
  8783. * _.xor([2, 1], [2, 3]);
  8784. * // => [1, 3]
  8785. */
  8786. var xor = baseRest(function(arrays) {
  8787. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  8788. });
  8789. /**
  8790. * This method is like `_.xor` except that it accepts `iteratee` which is
  8791. * invoked for each element of each `arrays` to generate the criterion by
  8792. * which by which they're compared. The order of result values is determined
  8793. * by the order they occur in the arrays. The iteratee is invoked with one
  8794. * argument: (value).
  8795. *
  8796. * @static
  8797. * @memberOf _
  8798. * @since 4.0.0
  8799. * @category Array
  8800. * @param {...Array} [arrays] The arrays to inspect.
  8801. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8802. * @returns {Array} Returns the new array of filtered values.
  8803. * @example
  8804. *
  8805. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  8806. * // => [1.2, 3.4]
  8807. *
  8808. * // The `_.property` iteratee shorthand.
  8809. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  8810. * // => [{ 'x': 2 }]
  8811. */
  8812. var xorBy = baseRest(function(arrays) {
  8813. var iteratee = last(arrays);
  8814. if (isArrayLikeObject(iteratee)) {
  8815. iteratee = undefined;
  8816. }
  8817. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  8818. });
  8819. /**
  8820. * This method is like `_.xor` except that it accepts `comparator` which is
  8821. * invoked to compare elements of `arrays`. The order of result values is
  8822. * determined by the order they occur in the arrays. The comparator is invoked
  8823. * with two arguments: (arrVal, othVal).
  8824. *
  8825. * @static
  8826. * @memberOf _
  8827. * @since 4.0.0
  8828. * @category Array
  8829. * @param {...Array} [arrays] The arrays to inspect.
  8830. * @param {Function} [comparator] The comparator invoked per element.
  8831. * @returns {Array} Returns the new array of filtered values.
  8832. * @example
  8833. *
  8834. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  8835. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  8836. *
  8837. * _.xorWith(objects, others, _.isEqual);
  8838. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  8839. */
  8840. var xorWith = baseRest(function(arrays) {
  8841. var comparator = last(arrays);
  8842. comparator = typeof comparator == 'function' ? comparator : undefined;
  8843. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  8844. });
  8845. /**
  8846. * Creates an array of grouped elements, the first of which contains the
  8847. * first elements of the given arrays, the second of which contains the
  8848. * second elements of the given arrays, and so on.
  8849. *
  8850. * @static
  8851. * @memberOf _
  8852. * @since 0.1.0
  8853. * @category Array
  8854. * @param {...Array} [arrays] The arrays to process.
  8855. * @returns {Array} Returns the new array of grouped elements.
  8856. * @example
  8857. *
  8858. * _.zip(['a', 'b'], [1, 2], [true, false]);
  8859. * // => [['a', 1, true], ['b', 2, false]]
  8860. */
  8861. var zip = baseRest(unzip);
  8862. /**
  8863. * This method is like `_.fromPairs` except that it accepts two arrays,
  8864. * one of property identifiers and one of corresponding values.
  8865. *
  8866. * @static
  8867. * @memberOf _
  8868. * @since 0.4.0
  8869. * @category Array
  8870. * @param {Array} [props=[]] The property identifiers.
  8871. * @param {Array} [values=[]] The property values.
  8872. * @returns {Object} Returns the new object.
  8873. * @example
  8874. *
  8875. * _.zipObject(['a', 'b'], [1, 2]);
  8876. * // => { 'a': 1, 'b': 2 }
  8877. */
  8878. function zipObject(props, values) {
  8879. return baseZipObject(props || [], values || [], assignValue);
  8880. }
  8881. /**
  8882. * This method is like `_.zipObject` except that it supports property paths.
  8883. *
  8884. * @static
  8885. * @memberOf _
  8886. * @since 4.1.0
  8887. * @category Array
  8888. * @param {Array} [props=[]] The property identifiers.
  8889. * @param {Array} [values=[]] The property values.
  8890. * @returns {Object} Returns the new object.
  8891. * @example
  8892. *
  8893. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  8894. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  8895. */
  8896. function zipObjectDeep(props, values) {
  8897. return baseZipObject(props || [], values || [], baseSet);
  8898. }
  8899. /**
  8900. * This method is like `_.zip` except that it accepts `iteratee` to specify
  8901. * how grouped values should be combined. The iteratee is invoked with the
  8902. * elements of each group: (...group).
  8903. *
  8904. * @static
  8905. * @memberOf _
  8906. * @since 3.8.0
  8907. * @category Array
  8908. * @param {...Array} [arrays] The arrays to process.
  8909. * @param {Function} [iteratee=_.identity] The function to combine
  8910. * grouped values.
  8911. * @returns {Array} Returns the new array of grouped elements.
  8912. * @example
  8913. *
  8914. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  8915. * return a + b + c;
  8916. * });
  8917. * // => [111, 222]
  8918. */
  8919. var zipWith = baseRest(function(arrays) {
  8920. var length = arrays.length,
  8921. iteratee = length > 1 ? arrays[length - 1] : undefined;
  8922. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  8923. return unzipWith(arrays, iteratee);
  8924. });
  8925. /*------------------------------------------------------------------------*/
  8926. /**
  8927. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  8928. * chain sequences enabled. The result of such sequences must be unwrapped
  8929. * with `_#value`.
  8930. *
  8931. * @static
  8932. * @memberOf _
  8933. * @since 1.3.0
  8934. * @category Seq
  8935. * @param {*} value The value to wrap.
  8936. * @returns {Object} Returns the new `lodash` wrapper instance.
  8937. * @example
  8938. *
  8939. * var users = [
  8940. * { 'user': 'barney', 'age': 36 },
  8941. * { 'user': 'fred', 'age': 40 },
  8942. * { 'user': 'pebbles', 'age': 1 }
  8943. * ];
  8944. *
  8945. * var youngest = _
  8946. * .chain(users)
  8947. * .sortBy('age')
  8948. * .map(function(o) {
  8949. * return o.user + ' is ' + o.age;
  8950. * })
  8951. * .head()
  8952. * .value();
  8953. * // => 'pebbles is 1'
  8954. */
  8955. function chain(value) {
  8956. var result = lodash(value);
  8957. result.__chain__ = true;
  8958. return result;
  8959. }
  8960. /**
  8961. * This method invokes `interceptor` and returns `value`. The interceptor
  8962. * is invoked with one argument; (value). The purpose of this method is to
  8963. * "tap into" a method chain sequence in order to modify intermediate results.
  8964. *
  8965. * @static
  8966. * @memberOf _
  8967. * @since 0.1.0
  8968. * @category Seq
  8969. * @param {*} value The value to provide to `interceptor`.
  8970. * @param {Function} interceptor The function to invoke.
  8971. * @returns {*} Returns `value`.
  8972. * @example
  8973. *
  8974. * _([1, 2, 3])
  8975. * .tap(function(array) {
  8976. * // Mutate input array.
  8977. * array.pop();
  8978. * })
  8979. * .reverse()
  8980. * .value();
  8981. * // => [2, 1]
  8982. */
  8983. function tap(value, interceptor) {
  8984. interceptor(value);
  8985. return value;
  8986. }
  8987. /**
  8988. * This method is like `_.tap` except that it returns the result of `interceptor`.
  8989. * The purpose of this method is to "pass thru" values replacing intermediate
  8990. * results in a method chain sequence.
  8991. *
  8992. * @static
  8993. * @memberOf _
  8994. * @since 3.0.0
  8995. * @category Seq
  8996. * @param {*} value The value to provide to `interceptor`.
  8997. * @param {Function} interceptor The function to invoke.
  8998. * @returns {*} Returns the result of `interceptor`.
  8999. * @example
  9000. *
  9001. * _(' abc ')
  9002. * .chain()
  9003. * .trim()
  9004. * .thru(function(value) {
  9005. * return [value];
  9006. * })
  9007. * .value();
  9008. * // => ['abc']
  9009. */
  9010. function thru(value, interceptor) {
  9011. return interceptor(value);
  9012. }
  9013. /**
  9014. * This method is the wrapper version of `_.at`.
  9015. *
  9016. * @name at
  9017. * @memberOf _
  9018. * @since 1.0.0
  9019. * @category Seq
  9020. * @param {...(string|string[])} [paths] The property paths to pick.
  9021. * @returns {Object} Returns the new `lodash` wrapper instance.
  9022. * @example
  9023. *
  9024. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  9025. *
  9026. * _(object).at(['a[0].b.c', 'a[1]']).value();
  9027. * // => [3, 4]
  9028. */
  9029. var wrapperAt = flatRest(function(paths) {
  9030. var length = paths.length,
  9031. start = length ? paths[0] : 0,
  9032. value = this.__wrapped__,
  9033. interceptor = function(object) { return baseAt(object, paths); };
  9034. if (length > 1 || this.__actions__.length ||
  9035. !(value instanceof LazyWrapper) || !isIndex(start)) {
  9036. return this.thru(interceptor);
  9037. }
  9038. value = value.slice(start, +start + (length ? 1 : 0));
  9039. value.__actions__.push({
  9040. 'func': thru,
  9041. 'args': [interceptor],
  9042. 'thisArg': undefined
  9043. });
  9044. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  9045. if (length && !array.length) {
  9046. array.push(undefined);
  9047. }
  9048. return array;
  9049. });
  9050. });
  9051. /**
  9052. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  9053. *
  9054. * @name chain
  9055. * @memberOf _
  9056. * @since 0.1.0
  9057. * @category Seq
  9058. * @returns {Object} Returns the new `lodash` wrapper instance.
  9059. * @example
  9060. *
  9061. * var users = [
  9062. * { 'user': 'barney', 'age': 36 },
  9063. * { 'user': 'fred', 'age': 40 }
  9064. * ];
  9065. *
  9066. * // A sequence without explicit chaining.
  9067. * _(users).head();
  9068. * // => { 'user': 'barney', 'age': 36 }
  9069. *
  9070. * // A sequence with explicit chaining.
  9071. * _(users)
  9072. * .chain()
  9073. * .head()
  9074. * .pick('user')
  9075. * .value();
  9076. * // => { 'user': 'barney' }
  9077. */
  9078. function wrapperChain() {
  9079. return chain(this);
  9080. }
  9081. /**
  9082. * Executes the chain sequence and returns the wrapped result.
  9083. *
  9084. * @name commit
  9085. * @memberOf _
  9086. * @since 3.2.0
  9087. * @category Seq
  9088. * @returns {Object} Returns the new `lodash` wrapper instance.
  9089. * @example
  9090. *
  9091. * var array = [1, 2];
  9092. * var wrapped = _(array).push(3);
  9093. *
  9094. * console.log(array);
  9095. * // => [1, 2]
  9096. *
  9097. * wrapped = wrapped.commit();
  9098. * console.log(array);
  9099. * // => [1, 2, 3]
  9100. *
  9101. * wrapped.last();
  9102. * // => 3
  9103. *
  9104. * console.log(array);
  9105. * // => [1, 2, 3]
  9106. */
  9107. function wrapperCommit() {
  9108. return new LodashWrapper(this.value(), this.__chain__);
  9109. }
  9110. /**
  9111. * Gets the next value on a wrapped object following the
  9112. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  9113. *
  9114. * @name next
  9115. * @memberOf _
  9116. * @since 4.0.0
  9117. * @category Seq
  9118. * @returns {Object} Returns the next iterator value.
  9119. * @example
  9120. *
  9121. * var wrapped = _([1, 2]);
  9122. *
  9123. * wrapped.next();
  9124. * // => { 'done': false, 'value': 1 }
  9125. *
  9126. * wrapped.next();
  9127. * // => { 'done': false, 'value': 2 }
  9128. *
  9129. * wrapped.next();
  9130. * // => { 'done': true, 'value': undefined }
  9131. */
  9132. function wrapperNext() {
  9133. if (this.__values__ === undefined) {
  9134. this.__values__ = toArray(this.value());
  9135. }
  9136. var done = this.__index__ >= this.__values__.length,
  9137. value = done ? undefined : this.__values__[this.__index__++];
  9138. return { 'done': done, 'value': value };
  9139. }
  9140. /**
  9141. * Enables the wrapper to be iterable.
  9142. *
  9143. * @name Symbol.iterator
  9144. * @memberOf _
  9145. * @since 4.0.0
  9146. * @category Seq
  9147. * @returns {Object} Returns the wrapper object.
  9148. * @example
  9149. *
  9150. * var wrapped = _([1, 2]);
  9151. *
  9152. * wrapped[Symbol.iterator]() === wrapped;
  9153. * // => true
  9154. *
  9155. * Array.from(wrapped);
  9156. * // => [1, 2]
  9157. */
  9158. function wrapperToIterator() {
  9159. return this;
  9160. }
  9161. /**
  9162. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  9163. *
  9164. * @name plant
  9165. * @memberOf _
  9166. * @since 3.2.0
  9167. * @category Seq
  9168. * @param {*} value The value to plant.
  9169. * @returns {Object} Returns the new `lodash` wrapper instance.
  9170. * @example
  9171. *
  9172. * function square(n) {
  9173. * return n * n;
  9174. * }
  9175. *
  9176. * var wrapped = _([1, 2]).map(square);
  9177. * var other = wrapped.plant([3, 4]);
  9178. *
  9179. * other.value();
  9180. * // => [9, 16]
  9181. *
  9182. * wrapped.value();
  9183. * // => [1, 4]
  9184. */
  9185. function wrapperPlant(value) {
  9186. var result,
  9187. parent = this;
  9188. while (parent instanceof baseLodash) {
  9189. var clone = wrapperClone(parent);
  9190. clone.__index__ = 0;
  9191. clone.__values__ = undefined;
  9192. if (result) {
  9193. previous.__wrapped__ = clone;
  9194. } else {
  9195. result = clone;
  9196. }
  9197. var previous = clone;
  9198. parent = parent.__wrapped__;
  9199. }
  9200. previous.__wrapped__ = value;
  9201. return result;
  9202. }
  9203. /**
  9204. * This method is the wrapper version of `_.reverse`.
  9205. *
  9206. * **Note:** This method mutates the wrapped array.
  9207. *
  9208. * @name reverse
  9209. * @memberOf _
  9210. * @since 0.1.0
  9211. * @category Seq
  9212. * @returns {Object} Returns the new `lodash` wrapper instance.
  9213. * @example
  9214. *
  9215. * var array = [1, 2, 3];
  9216. *
  9217. * _(array).reverse().value()
  9218. * // => [3, 2, 1]
  9219. *
  9220. * console.log(array);
  9221. * // => [3, 2, 1]
  9222. */
  9223. function wrapperReverse() {
  9224. var value = this.__wrapped__;
  9225. if (value instanceof LazyWrapper) {
  9226. var wrapped = value;
  9227. if (this.__actions__.length) {
  9228. wrapped = new LazyWrapper(this);
  9229. }
  9230. wrapped = wrapped.reverse();
  9231. wrapped.__actions__.push({
  9232. 'func': thru,
  9233. 'args': [reverse],
  9234. 'thisArg': undefined
  9235. });
  9236. return new LodashWrapper(wrapped, this.__chain__);
  9237. }
  9238. return this.thru(reverse);
  9239. }
  9240. /**
  9241. * Executes the chain sequence to resolve the unwrapped value.
  9242. *
  9243. * @name value
  9244. * @memberOf _
  9245. * @since 0.1.0
  9246. * @alias toJSON, valueOf
  9247. * @category Seq
  9248. * @returns {*} Returns the resolved unwrapped value.
  9249. * @example
  9250. *
  9251. * _([1, 2, 3]).value();
  9252. * // => [1, 2, 3]
  9253. */
  9254. function wrapperValue() {
  9255. return baseWrapperValue(this.__wrapped__, this.__actions__);
  9256. }
  9257. /*------------------------------------------------------------------------*/
  9258. /**
  9259. * Creates an object composed of keys generated from the results of running
  9260. * each element of `collection` thru `iteratee`. The corresponding value of
  9261. * each key is the number of times the key was returned by `iteratee`. The
  9262. * iteratee is invoked with one argument: (value).
  9263. *
  9264. * @static
  9265. * @memberOf _
  9266. * @since 0.5.0
  9267. * @category Collection
  9268. * @param {Array|Object} collection The collection to iterate over.
  9269. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  9270. * @returns {Object} Returns the composed aggregate object.
  9271. * @example
  9272. *
  9273. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  9274. * // => { '4': 1, '6': 2 }
  9275. *
  9276. * // The `_.property` iteratee shorthand.
  9277. * _.countBy(['one', 'two', 'three'], 'length');
  9278. * // => { '3': 2, '5': 1 }
  9279. */
  9280. var countBy = createAggregator(function(result, value, key) {
  9281. if (hasOwnProperty.call(result, key)) {
  9282. ++result[key];
  9283. } else {
  9284. baseAssignValue(result, key, 1);
  9285. }
  9286. });
  9287. /**
  9288. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  9289. * Iteration is stopped once `predicate` returns falsey. The predicate is
  9290. * invoked with three arguments: (value, index|key, collection).
  9291. *
  9292. * **Note:** This method returns `true` for
  9293. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  9294. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  9295. * elements of empty collections.
  9296. *
  9297. * @static
  9298. * @memberOf _
  9299. * @since 0.1.0
  9300. * @category Collection
  9301. * @param {Array|Object} collection The collection to iterate over.
  9302. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9303. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  9304. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  9305. * else `false`.
  9306. * @example
  9307. *
  9308. * _.every([true, 1, null, 'yes'], Boolean);
  9309. * // => false
  9310. *
  9311. * var users = [
  9312. * { 'user': 'barney', 'age': 36, 'active': false },
  9313. * { 'user': 'fred', 'age': 40, 'active': false }
  9314. * ];
  9315. *
  9316. * // The `_.matches` iteratee shorthand.
  9317. * _.every(users, { 'user': 'barney', 'active': false });
  9318. * // => false
  9319. *
  9320. * // The `_.matchesProperty` iteratee shorthand.
  9321. * _.every(users, ['active', false]);
  9322. * // => true
  9323. *
  9324. * // The `_.property` iteratee shorthand.
  9325. * _.every(users, 'active');
  9326. * // => false
  9327. */
  9328. function every(collection, predicate, guard) {
  9329. var func = isArray(collection) ? arrayEvery : baseEvery;
  9330. if (guard && isIterateeCall(collection, predicate, guard)) {
  9331. predicate = undefined;
  9332. }
  9333. return func(collection, getIteratee(predicate, 3));
  9334. }
  9335. /**
  9336. * Iterates over elements of `collection`, returning an array of all elements
  9337. * `predicate` returns truthy for. The predicate is invoked with three
  9338. * arguments: (value, index|key, collection).
  9339. *
  9340. * **Note:** Unlike `_.remove`, this method returns a new array.
  9341. *
  9342. * @static
  9343. * @memberOf _
  9344. * @since 0.1.0
  9345. * @category Collection
  9346. * @param {Array|Object} collection The collection to iterate over.
  9347. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9348. * @returns {Array} Returns the new filtered array.
  9349. * @see _.reject
  9350. * @example
  9351. *
  9352. * var users = [
  9353. * { 'user': 'barney', 'age': 36, 'active': true },
  9354. * { 'user': 'fred', 'age': 40, 'active': false }
  9355. * ];
  9356. *
  9357. * _.filter(users, function(o) { return !o.active; });
  9358. * // => objects for ['fred']
  9359. *
  9360. * // The `_.matches` iteratee shorthand.
  9361. * _.filter(users, { 'age': 36, 'active': true });
  9362. * // => objects for ['barney']
  9363. *
  9364. * // The `_.matchesProperty` iteratee shorthand.
  9365. * _.filter(users, ['active', false]);
  9366. * // => objects for ['fred']
  9367. *
  9368. * // The `_.property` iteratee shorthand.
  9369. * _.filter(users, 'active');
  9370. * // => objects for ['barney']
  9371. */
  9372. function filter(collection, predicate) {
  9373. var func = isArray(collection) ? arrayFilter : baseFilter;
  9374. return func(collection, getIteratee(predicate, 3));
  9375. }
  9376. /**
  9377. * Iterates over elements of `collection`, returning the first element
  9378. * `predicate` returns truthy for. The predicate is invoked with three
  9379. * arguments: (value, index|key, collection).
  9380. *
  9381. * @static
  9382. * @memberOf _
  9383. * @since 0.1.0
  9384. * @category Collection
  9385. * @param {Array|Object} collection The collection to inspect.
  9386. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9387. * @param {number} [fromIndex=0] The index to search from.
  9388. * @returns {*} Returns the matched element, else `undefined`.
  9389. * @example
  9390. *
  9391. * var users = [
  9392. * { 'user': 'barney', 'age': 36, 'active': true },
  9393. * { 'user': 'fred', 'age': 40, 'active': false },
  9394. * { 'user': 'pebbles', 'age': 1, 'active': true }
  9395. * ];
  9396. *
  9397. * _.find(users, function(o) { return o.age < 40; });
  9398. * // => object for 'barney'
  9399. *
  9400. * // The `_.matches` iteratee shorthand.
  9401. * _.find(users, { 'age': 1, 'active': true });
  9402. * // => object for 'pebbles'
  9403. *
  9404. * // The `_.matchesProperty` iteratee shorthand.
  9405. * _.find(users, ['active', false]);
  9406. * // => object for 'fred'
  9407. *
  9408. * // The `_.property` iteratee shorthand.
  9409. * _.find(users, 'active');
  9410. * // => object for 'barney'
  9411. */
  9412. var find = createFind(findIndex);
  9413. /**
  9414. * This method is like `_.find` except that it iterates over elements of
  9415. * `collection` from right to left.
  9416. *
  9417. * @static
  9418. * @memberOf _
  9419. * @since 2.0.0
  9420. * @category Collection
  9421. * @param {Array|Object} collection The collection to inspect.
  9422. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9423. * @param {number} [fromIndex=collection.length-1] The index to search from.
  9424. * @returns {*} Returns the matched element, else `undefined`.
  9425. * @example
  9426. *
  9427. * _.findLast([1, 2, 3, 4], function(n) {
  9428. * return n % 2 == 1;
  9429. * });
  9430. * // => 3
  9431. */
  9432. var findLast = createFind(findLastIndex);
  9433. /**
  9434. * Creates a flattened array of values by running each element in `collection`
  9435. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  9436. * with three arguments: (value, index|key, collection).
  9437. *
  9438. * @static
  9439. * @memberOf _
  9440. * @since 4.0.0
  9441. * @category Collection
  9442. * @param {Array|Object} collection The collection to iterate over.
  9443. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9444. * @returns {Array} Returns the new flattened array.
  9445. * @example
  9446. *
  9447. * function duplicate(n) {
  9448. * return [n, n];
  9449. * }
  9450. *
  9451. * _.flatMap([1, 2], duplicate);
  9452. * // => [1, 1, 2, 2]
  9453. */
  9454. function flatMap(collection, iteratee) {
  9455. return baseFlatten(map(collection, iteratee), 1);
  9456. }
  9457. /**
  9458. * This method is like `_.flatMap` except that it recursively flattens the
  9459. * mapped results.
  9460. *
  9461. * @static
  9462. * @memberOf _
  9463. * @since 4.7.0
  9464. * @category Collection
  9465. * @param {Array|Object} collection The collection to iterate over.
  9466. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9467. * @returns {Array} Returns the new flattened array.
  9468. * @example
  9469. *
  9470. * function duplicate(n) {
  9471. * return [[[n, n]]];
  9472. * }
  9473. *
  9474. * _.flatMapDeep([1, 2], duplicate);
  9475. * // => [1, 1, 2, 2]
  9476. */
  9477. function flatMapDeep(collection, iteratee) {
  9478. return baseFlatten(map(collection, iteratee), INFINITY);
  9479. }
  9480. /**
  9481. * This method is like `_.flatMap` except that it recursively flattens the
  9482. * mapped results up to `depth` times.
  9483. *
  9484. * @static
  9485. * @memberOf _
  9486. * @since 4.7.0
  9487. * @category Collection
  9488. * @param {Array|Object} collection The collection to iterate over.
  9489. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9490. * @param {number} [depth=1] The maximum recursion depth.
  9491. * @returns {Array} Returns the new flattened array.
  9492. * @example
  9493. *
  9494. * function duplicate(n) {
  9495. * return [[[n, n]]];
  9496. * }
  9497. *
  9498. * _.flatMapDepth([1, 2], duplicate, 2);
  9499. * // => [[1, 1], [2, 2]]
  9500. */
  9501. function flatMapDepth(collection, iteratee, depth) {
  9502. depth = depth === undefined ? 1 : toInteger(depth);
  9503. return baseFlatten(map(collection, iteratee), depth);
  9504. }
  9505. /**
  9506. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  9507. * The iteratee is invoked with three arguments: (value, index|key, collection).
  9508. * Iteratee functions may exit iteration early by explicitly returning `false`.
  9509. *
  9510. * **Note:** As with other "Collections" methods, objects with a "length"
  9511. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  9512. * or `_.forOwn` for object iteration.
  9513. *
  9514. * @static
  9515. * @memberOf _
  9516. * @since 0.1.0
  9517. * @alias each
  9518. * @category Collection
  9519. * @param {Array|Object} collection The collection to iterate over.
  9520. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9521. * @returns {Array|Object} Returns `collection`.
  9522. * @see _.forEachRight
  9523. * @example
  9524. *
  9525. * _.forEach([1, 2], function(value) {
  9526. * console.log(value);
  9527. * });
  9528. * // => Logs `1` then `2`.
  9529. *
  9530. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  9531. * console.log(key);
  9532. * });
  9533. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  9534. */
  9535. function forEach(collection, iteratee) {
  9536. var func = isArray(collection) ? arrayEach : baseEach;
  9537. return func(collection, getIteratee(iteratee, 3));
  9538. }
  9539. /**
  9540. * This method is like `_.forEach` except that it iterates over elements of
  9541. * `collection` from right to left.
  9542. *
  9543. * @static
  9544. * @memberOf _
  9545. * @since 2.0.0
  9546. * @alias eachRight
  9547. * @category Collection
  9548. * @param {Array|Object} collection The collection to iterate over.
  9549. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9550. * @returns {Array|Object} Returns `collection`.
  9551. * @see _.forEach
  9552. * @example
  9553. *
  9554. * _.forEachRight([1, 2], function(value) {
  9555. * console.log(value);
  9556. * });
  9557. * // => Logs `2` then `1`.
  9558. */
  9559. function forEachRight(collection, iteratee) {
  9560. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  9561. return func(collection, getIteratee(iteratee, 3));
  9562. }
  9563. /**
  9564. * Creates an object composed of keys generated from the results of running
  9565. * each element of `collection` thru `iteratee`. The order of grouped values
  9566. * is determined by the order they occur in `collection`. The corresponding
  9567. * value of each key is an array of elements responsible for generating the
  9568. * key. The iteratee is invoked with one argument: (value).
  9569. *
  9570. * @static
  9571. * @memberOf _
  9572. * @since 0.1.0
  9573. * @category Collection
  9574. * @param {Array|Object} collection The collection to iterate over.
  9575. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  9576. * @returns {Object} Returns the composed aggregate object.
  9577. * @example
  9578. *
  9579. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  9580. * // => { '4': [4.2], '6': [6.1, 6.3] }
  9581. *
  9582. * // The `_.property` iteratee shorthand.
  9583. * _.groupBy(['one', 'two', 'three'], 'length');
  9584. * // => { '3': ['one', 'two'], '5': ['three'] }
  9585. */
  9586. var groupBy = createAggregator(function(result, value, key) {
  9587. if (hasOwnProperty.call(result, key)) {
  9588. result[key].push(value);
  9589. } else {
  9590. baseAssignValue(result, key, [value]);
  9591. }
  9592. });
  9593. /**
  9594. * Checks if `value` is in `collection`. If `collection` is a string, it's
  9595. * checked for a substring of `value`, otherwise
  9596. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  9597. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  9598. * the offset from the end of `collection`.
  9599. *
  9600. * @static
  9601. * @memberOf _
  9602. * @since 0.1.0
  9603. * @category Collection
  9604. * @param {Array|Object|string} collection The collection to inspect.
  9605. * @param {*} value The value to search for.
  9606. * @param {number} [fromIndex=0] The index to search from.
  9607. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  9608. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  9609. * @example
  9610. *
  9611. * _.includes([1, 2, 3], 1);
  9612. * // => true
  9613. *
  9614. * _.includes([1, 2, 3], 1, 2);
  9615. * // => false
  9616. *
  9617. * _.includes({ 'a': 1, 'b': 2 }, 1);
  9618. * // => true
  9619. *
  9620. * _.includes('abcd', 'bc');
  9621. * // => true
  9622. */
  9623. function includes(collection, value, fromIndex, guard) {
  9624. collection = isArrayLike(collection) ? collection : values(collection);
  9625. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  9626. var length = collection.length;
  9627. if (fromIndex < 0) {
  9628. fromIndex = nativeMax(length + fromIndex, 0);
  9629. }
  9630. return isString(collection)
  9631. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  9632. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  9633. }
  9634. /**
  9635. * Invokes the method at `path` of each element in `collection`, returning
  9636. * an array of the results of each invoked method. Any additional arguments
  9637. * are provided to each invoked method. If `path` is a function, it's invoked
  9638. * for, and `this` bound to, each element in `collection`.
  9639. *
  9640. * @static
  9641. * @memberOf _
  9642. * @since 4.0.0
  9643. * @category Collection
  9644. * @param {Array|Object} collection The collection to iterate over.
  9645. * @param {Array|Function|string} path The path of the method to invoke or
  9646. * the function invoked per iteration.
  9647. * @param {...*} [args] The arguments to invoke each method with.
  9648. * @returns {Array} Returns the array of results.
  9649. * @example
  9650. *
  9651. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  9652. * // => [[1, 5, 7], [1, 2, 3]]
  9653. *
  9654. * _.invokeMap([123, 456], String.prototype.split, '');
  9655. * // => [['1', '2', '3'], ['4', '5', '6']]
  9656. */
  9657. var invokeMap = baseRest(function(collection, path, args) {
  9658. var index = -1,
  9659. isFunc = typeof path == 'function',
  9660. result = isArrayLike(collection) ? Array(collection.length) : [];
  9661. baseEach(collection, function(value) {
  9662. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  9663. });
  9664. return result;
  9665. });
  9666. /**
  9667. * Creates an object composed of keys generated from the results of running
  9668. * each element of `collection` thru `iteratee`. The corresponding value of
  9669. * each key is the last element responsible for generating the key. The
  9670. * iteratee is invoked with one argument: (value).
  9671. *
  9672. * @static
  9673. * @memberOf _
  9674. * @since 4.0.0
  9675. * @category Collection
  9676. * @param {Array|Object} collection The collection to iterate over.
  9677. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  9678. * @returns {Object} Returns the composed aggregate object.
  9679. * @example
  9680. *
  9681. * var array = [
  9682. * { 'dir': 'left', 'code': 97 },
  9683. * { 'dir': 'right', 'code': 100 }
  9684. * ];
  9685. *
  9686. * _.keyBy(array, function(o) {
  9687. * return String.fromCharCode(o.code);
  9688. * });
  9689. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  9690. *
  9691. * _.keyBy(array, 'dir');
  9692. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  9693. */
  9694. var keyBy = createAggregator(function(result, value, key) {
  9695. baseAssignValue(result, key, value);
  9696. });
  9697. /**
  9698. * Creates an array of values by running each element in `collection` thru
  9699. * `iteratee`. The iteratee is invoked with three arguments:
  9700. * (value, index|key, collection).
  9701. *
  9702. * Many lodash methods are guarded to work as iteratees for methods like
  9703. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  9704. *
  9705. * The guarded methods are:
  9706. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  9707. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  9708. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  9709. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  9710. *
  9711. * @static
  9712. * @memberOf _
  9713. * @since 0.1.0
  9714. * @category Collection
  9715. * @param {Array|Object} collection The collection to iterate over.
  9716. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9717. * @returns {Array} Returns the new mapped array.
  9718. * @example
  9719. *
  9720. * function square(n) {
  9721. * return n * n;
  9722. * }
  9723. *
  9724. * _.map([4, 8], square);
  9725. * // => [16, 64]
  9726. *
  9727. * _.map({ 'a': 4, 'b': 8 }, square);
  9728. * // => [16, 64] (iteration order is not guaranteed)
  9729. *
  9730. * var users = [
  9731. * { 'user': 'barney' },
  9732. * { 'user': 'fred' }
  9733. * ];
  9734. *
  9735. * // The `_.property` iteratee shorthand.
  9736. * _.map(users, 'user');
  9737. * // => ['barney', 'fred']
  9738. */
  9739. function map(collection, iteratee) {
  9740. var func = isArray(collection) ? arrayMap : baseMap;
  9741. return func(collection, getIteratee(iteratee, 3));
  9742. }
  9743. /**
  9744. * This method is like `_.sortBy` except that it allows specifying the sort
  9745. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  9746. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  9747. * descending or "asc" for ascending sort order of corresponding values.
  9748. *
  9749. * @static
  9750. * @memberOf _
  9751. * @since 4.0.0
  9752. * @category Collection
  9753. * @param {Array|Object} collection The collection to iterate over.
  9754. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  9755. * The iteratees to sort by.
  9756. * @param {string[]} [orders] The sort orders of `iteratees`.
  9757. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  9758. * @returns {Array} Returns the new sorted array.
  9759. * @example
  9760. *
  9761. * var users = [
  9762. * { 'user': 'fred', 'age': 48 },
  9763. * { 'user': 'barney', 'age': 34 },
  9764. * { 'user': 'fred', 'age': 40 },
  9765. * { 'user': 'barney', 'age': 36 }
  9766. * ];
  9767. *
  9768. * // Sort by `user` in ascending order and by `age` in descending order.
  9769. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  9770. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  9771. */
  9772. function orderBy(collection, iteratees, orders, guard) {
  9773. if (collection == null) {
  9774. return [];
  9775. }
  9776. if (!isArray(iteratees)) {
  9777. iteratees = iteratees == null ? [] : [iteratees];
  9778. }
  9779. orders = guard ? undefined : orders;
  9780. if (!isArray(orders)) {
  9781. orders = orders == null ? [] : [orders];
  9782. }
  9783. return baseOrderBy(collection, iteratees, orders);
  9784. }
  9785. /**
  9786. * Creates an array of elements split into two groups, the first of which
  9787. * contains elements `predicate` returns truthy for, the second of which
  9788. * contains elements `predicate` returns falsey for. The predicate is
  9789. * invoked with one argument: (value).
  9790. *
  9791. * @static
  9792. * @memberOf _
  9793. * @since 3.0.0
  9794. * @category Collection
  9795. * @param {Array|Object} collection The collection to iterate over.
  9796. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9797. * @returns {Array} Returns the array of grouped elements.
  9798. * @example
  9799. *
  9800. * var users = [
  9801. * { 'user': 'barney', 'age': 36, 'active': false },
  9802. * { 'user': 'fred', 'age': 40, 'active': true },
  9803. * { 'user': 'pebbles', 'age': 1, 'active': false }
  9804. * ];
  9805. *
  9806. * _.partition(users, function(o) { return o.active; });
  9807. * // => objects for [['fred'], ['barney', 'pebbles']]
  9808. *
  9809. * // The `_.matches` iteratee shorthand.
  9810. * _.partition(users, { 'age': 1, 'active': false });
  9811. * // => objects for [['pebbles'], ['barney', 'fred']]
  9812. *
  9813. * // The `_.matchesProperty` iteratee shorthand.
  9814. * _.partition(users, ['active', false]);
  9815. * // => objects for [['barney', 'pebbles'], ['fred']]
  9816. *
  9817. * // The `_.property` iteratee shorthand.
  9818. * _.partition(users, 'active');
  9819. * // => objects for [['fred'], ['barney', 'pebbles']]
  9820. */
  9821. var partition = createAggregator(function(result, value, key) {
  9822. result[key ? 0 : 1].push(value);
  9823. }, function() { return [[], []]; });
  9824. /**
  9825. * Reduces `collection` to a value which is the accumulated result of running
  9826. * each element in `collection` thru `iteratee`, where each successive
  9827. * invocation is supplied the return value of the previous. If `accumulator`
  9828. * is not given, the first element of `collection` is used as the initial
  9829. * value. The iteratee is invoked with four arguments:
  9830. * (accumulator, value, index|key, collection).
  9831. *
  9832. * Many lodash methods are guarded to work as iteratees for methods like
  9833. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  9834. *
  9835. * The guarded methods are:
  9836. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  9837. * and `sortBy`
  9838. *
  9839. * @static
  9840. * @memberOf _
  9841. * @since 0.1.0
  9842. * @category Collection
  9843. * @param {Array|Object} collection The collection to iterate over.
  9844. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9845. * @param {*} [accumulator] The initial value.
  9846. * @returns {*} Returns the accumulated value.
  9847. * @see _.reduceRight
  9848. * @example
  9849. *
  9850. * _.reduce([1, 2], function(sum, n) {
  9851. * return sum + n;
  9852. * }, 0);
  9853. * // => 3
  9854. *
  9855. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  9856. * (result[value] || (result[value] = [])).push(key);
  9857. * return result;
  9858. * }, {});
  9859. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  9860. */
  9861. function reduce(collection, iteratee, accumulator) {
  9862. var func = isArray(collection) ? arrayReduce : baseReduce,
  9863. initAccum = arguments.length < 3;
  9864. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  9865. }
  9866. /**
  9867. * This method is like `_.reduce` except that it iterates over elements of
  9868. * `collection` from right to left.
  9869. *
  9870. * @static
  9871. * @memberOf _
  9872. * @since 0.1.0
  9873. * @category Collection
  9874. * @param {Array|Object} collection The collection to iterate over.
  9875. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9876. * @param {*} [accumulator] The initial value.
  9877. * @returns {*} Returns the accumulated value.
  9878. * @see _.reduce
  9879. * @example
  9880. *
  9881. * var array = [[0, 1], [2, 3], [4, 5]];
  9882. *
  9883. * _.reduceRight(array, function(flattened, other) {
  9884. * return flattened.concat(other);
  9885. * }, []);
  9886. * // => [4, 5, 2, 3, 0, 1]
  9887. */
  9888. function reduceRight(collection, iteratee, accumulator) {
  9889. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  9890. initAccum = arguments.length < 3;
  9891. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  9892. }
  9893. /**
  9894. * The opposite of `_.filter`; this method returns the elements of `collection`
  9895. * that `predicate` does **not** return truthy for.
  9896. *
  9897. * @static
  9898. * @memberOf _
  9899. * @since 0.1.0
  9900. * @category Collection
  9901. * @param {Array|Object} collection The collection to iterate over.
  9902. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9903. * @returns {Array} Returns the new filtered array.
  9904. * @see _.filter
  9905. * @example
  9906. *
  9907. * var users = [
  9908. * { 'user': 'barney', 'age': 36, 'active': false },
  9909. * { 'user': 'fred', 'age': 40, 'active': true }
  9910. * ];
  9911. *
  9912. * _.reject(users, function(o) { return !o.active; });
  9913. * // => objects for ['fred']
  9914. *
  9915. * // The `_.matches` iteratee shorthand.
  9916. * _.reject(users, { 'age': 40, 'active': true });
  9917. * // => objects for ['barney']
  9918. *
  9919. * // The `_.matchesProperty` iteratee shorthand.
  9920. * _.reject(users, ['active', false]);
  9921. * // => objects for ['fred']
  9922. *
  9923. * // The `_.property` iteratee shorthand.
  9924. * _.reject(users, 'active');
  9925. * // => objects for ['barney']
  9926. */
  9927. function reject(collection, predicate) {
  9928. var func = isArray(collection) ? arrayFilter : baseFilter;
  9929. return func(collection, negate(getIteratee(predicate, 3)));
  9930. }
  9931. /**
  9932. * Gets a random element from `collection`.
  9933. *
  9934. * @static
  9935. * @memberOf _
  9936. * @since 2.0.0
  9937. * @category Collection
  9938. * @param {Array|Object} collection The collection to sample.
  9939. * @returns {*} Returns the random element.
  9940. * @example
  9941. *
  9942. * _.sample([1, 2, 3, 4]);
  9943. * // => 2
  9944. */
  9945. function sample(collection) {
  9946. var func = isArray(collection) ? arraySample : baseSample;
  9947. return func(collection);
  9948. }
  9949. /**
  9950. * Gets `n` random elements at unique keys from `collection` up to the
  9951. * size of `collection`.
  9952. *
  9953. * @static
  9954. * @memberOf _
  9955. * @since 4.0.0
  9956. * @category Collection
  9957. * @param {Array|Object} collection The collection to sample.
  9958. * @param {number} [n=1] The number of elements to sample.
  9959. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  9960. * @returns {Array} Returns the random elements.
  9961. * @example
  9962. *
  9963. * _.sampleSize([1, 2, 3], 2);
  9964. * // => [3, 1]
  9965. *
  9966. * _.sampleSize([1, 2, 3], 4);
  9967. * // => [2, 3, 1]
  9968. */
  9969. function sampleSize(collection, n, guard) {
  9970. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  9971. n = 1;
  9972. } else {
  9973. n = toInteger(n);
  9974. }
  9975. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  9976. return func(collection, n);
  9977. }
  9978. /**
  9979. * Creates an array of shuffled values, using a version of the
  9980. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  9981. *
  9982. * @static
  9983. * @memberOf _
  9984. * @since 0.1.0
  9985. * @category Collection
  9986. * @param {Array|Object} collection The collection to shuffle.
  9987. * @returns {Array} Returns the new shuffled array.
  9988. * @example
  9989. *
  9990. * _.shuffle([1, 2, 3, 4]);
  9991. * // => [4, 1, 3, 2]
  9992. */
  9993. function shuffle(collection) {
  9994. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  9995. return func(collection);
  9996. }
  9997. /**
  9998. * Gets the size of `collection` by returning its length for array-like
  9999. * values or the number of own enumerable string keyed properties for objects.
  10000. *
  10001. * @static
  10002. * @memberOf _
  10003. * @since 0.1.0
  10004. * @category Collection
  10005. * @param {Array|Object|string} collection The collection to inspect.
  10006. * @returns {number} Returns the collection size.
  10007. * @example
  10008. *
  10009. * _.size([1, 2, 3]);
  10010. * // => 3
  10011. *
  10012. * _.size({ 'a': 1, 'b': 2 });
  10013. * // => 2
  10014. *
  10015. * _.size('pebbles');
  10016. * // => 7
  10017. */
  10018. function size(collection) {
  10019. if (collection == null) {
  10020. return 0;
  10021. }
  10022. if (isArrayLike(collection)) {
  10023. return isString(collection) ? stringSize(collection) : collection.length;
  10024. }
  10025. var tag = getTag(collection);
  10026. if (tag == mapTag || tag == setTag) {
  10027. return collection.size;
  10028. }
  10029. return baseKeys(collection).length;
  10030. }
  10031. /**
  10032. * Checks if `predicate` returns truthy for **any** element of `collection`.
  10033. * Iteration is stopped once `predicate` returns truthy. The predicate is
  10034. * invoked with three arguments: (value, index|key, collection).
  10035. *
  10036. * @static
  10037. * @memberOf _
  10038. * @since 0.1.0
  10039. * @category Collection
  10040. * @param {Array|Object} collection The collection to iterate over.
  10041. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  10042. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10043. * @returns {boolean} Returns `true` if any element passes the predicate check,
  10044. * else `false`.
  10045. * @example
  10046. *
  10047. * _.some([null, 0, 'yes', false], Boolean);
  10048. * // => true
  10049. *
  10050. * var users = [
  10051. * { 'user': 'barney', 'active': true },
  10052. * { 'user': 'fred', 'active': false }
  10053. * ];
  10054. *
  10055. * // The `_.matches` iteratee shorthand.
  10056. * _.some(users, { 'user': 'barney', 'active': false });
  10057. * // => false
  10058. *
  10059. * // The `_.matchesProperty` iteratee shorthand.
  10060. * _.some(users, ['active', false]);
  10061. * // => true
  10062. *
  10063. * // The `_.property` iteratee shorthand.
  10064. * _.some(users, 'active');
  10065. * // => true
  10066. */
  10067. function some(collection, predicate, guard) {
  10068. var func = isArray(collection) ? arraySome : baseSome;
  10069. if (guard && isIterateeCall(collection, predicate, guard)) {
  10070. predicate = undefined;
  10071. }
  10072. return func(collection, getIteratee(predicate, 3));
  10073. }
  10074. /**
  10075. * Creates an array of elements, sorted in ascending order by the results of
  10076. * running each element in a collection thru each iteratee. This method
  10077. * performs a stable sort, that is, it preserves the original sort order of
  10078. * equal elements. The iteratees are invoked with one argument: (value).
  10079. *
  10080. * @static
  10081. * @memberOf _
  10082. * @since 0.1.0
  10083. * @category Collection
  10084. * @param {Array|Object} collection The collection to iterate over.
  10085. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  10086. * The iteratees to sort by.
  10087. * @returns {Array} Returns the new sorted array.
  10088. * @example
  10089. *
  10090. * var users = [
  10091. * { 'user': 'fred', 'age': 48 },
  10092. * { 'user': 'barney', 'age': 36 },
  10093. * { 'user': 'fred', 'age': 40 },
  10094. * { 'user': 'barney', 'age': 34 }
  10095. * ];
  10096. *
  10097. * _.sortBy(users, [function(o) { return o.user; }]);
  10098. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  10099. *
  10100. * _.sortBy(users, ['user', 'age']);
  10101. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  10102. */
  10103. var sortBy = baseRest(function(collection, iteratees) {
  10104. if (collection == null) {
  10105. return [];
  10106. }
  10107. var length = iteratees.length;
  10108. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  10109. iteratees = [];
  10110. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  10111. iteratees = [iteratees[0]];
  10112. }
  10113. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  10114. });
  10115. /*------------------------------------------------------------------------*/
  10116. /**
  10117. * Gets the timestamp of the number of milliseconds that have elapsed since
  10118. * the Unix epoch (1 January 1970 00:00:00 UTC).
  10119. *
  10120. * @static
  10121. * @memberOf _
  10122. * @since 2.4.0
  10123. * @category Date
  10124. * @returns {number} Returns the timestamp.
  10125. * @example
  10126. *
  10127. * _.defer(function(stamp) {
  10128. * console.log(_.now() - stamp);
  10129. * }, _.now());
  10130. * // => Logs the number of milliseconds it took for the deferred invocation.
  10131. */
  10132. var now = ctxNow || function() {
  10133. return root.Date.now();
  10134. };
  10135. /*------------------------------------------------------------------------*/
  10136. /**
  10137. * The opposite of `_.before`; this method creates a function that invokes
  10138. * `func` once it's called `n` or more times.
  10139. *
  10140. * @static
  10141. * @memberOf _
  10142. * @since 0.1.0
  10143. * @category Function
  10144. * @param {number} n The number of calls before `func` is invoked.
  10145. * @param {Function} func The function to restrict.
  10146. * @returns {Function} Returns the new restricted function.
  10147. * @example
  10148. *
  10149. * var saves = ['profile', 'settings'];
  10150. *
  10151. * var done = _.after(saves.length, function() {
  10152. * console.log('done saving!');
  10153. * });
  10154. *
  10155. * _.forEach(saves, function(type) {
  10156. * asyncSave({ 'type': type, 'complete': done });
  10157. * });
  10158. * // => Logs 'done saving!' after the two async saves have completed.
  10159. */
  10160. function after(n, func) {
  10161. if (typeof func != 'function') {
  10162. throw new TypeError(FUNC_ERROR_TEXT);
  10163. }
  10164. n = toInteger(n);
  10165. return function() {
  10166. if (--n < 1) {
  10167. return func.apply(this, arguments);
  10168. }
  10169. };
  10170. }
  10171. /**
  10172. * Creates a function that invokes `func`, with up to `n` arguments,
  10173. * ignoring any additional arguments.
  10174. *
  10175. * @static
  10176. * @memberOf _
  10177. * @since 3.0.0
  10178. * @category Function
  10179. * @param {Function} func The function to cap arguments for.
  10180. * @param {number} [n=func.length] The arity cap.
  10181. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10182. * @returns {Function} Returns the new capped function.
  10183. * @example
  10184. *
  10185. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  10186. * // => [6, 8, 10]
  10187. */
  10188. function ary(func, n, guard) {
  10189. n = guard ? undefined : n;
  10190. n = (func && n == null) ? func.length : n;
  10191. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  10192. }
  10193. /**
  10194. * Creates a function that invokes `func`, with the `this` binding and arguments
  10195. * of the created function, while it's called less than `n` times. Subsequent
  10196. * calls to the created function return the result of the last `func` invocation.
  10197. *
  10198. * @static
  10199. * @memberOf _
  10200. * @since 3.0.0
  10201. * @category Function
  10202. * @param {number} n The number of calls at which `func` is no longer invoked.
  10203. * @param {Function} func The function to restrict.
  10204. * @returns {Function} Returns the new restricted function.
  10205. * @example
  10206. *
  10207. * jQuery(element).on('click', _.before(5, addContactToList));
  10208. * // => Allows adding up to 4 contacts to the list.
  10209. */
  10210. function before(n, func) {
  10211. var result;
  10212. if (typeof func != 'function') {
  10213. throw new TypeError(FUNC_ERROR_TEXT);
  10214. }
  10215. n = toInteger(n);
  10216. return function() {
  10217. if (--n > 0) {
  10218. result = func.apply(this, arguments);
  10219. }
  10220. if (n <= 1) {
  10221. func = undefined;
  10222. }
  10223. return result;
  10224. };
  10225. }
  10226. /**
  10227. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  10228. * and `partials` prepended to the arguments it receives.
  10229. *
  10230. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  10231. * may be used as a placeholder for partially applied arguments.
  10232. *
  10233. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  10234. * property of bound functions.
  10235. *
  10236. * @static
  10237. * @memberOf _
  10238. * @since 0.1.0
  10239. * @category Function
  10240. * @param {Function} func The function to bind.
  10241. * @param {*} thisArg The `this` binding of `func`.
  10242. * @param {...*} [partials] The arguments to be partially applied.
  10243. * @returns {Function} Returns the new bound function.
  10244. * @example
  10245. *
  10246. * function greet(greeting, punctuation) {
  10247. * return greeting + ' ' + this.user + punctuation;
  10248. * }
  10249. *
  10250. * var object = { 'user': 'fred' };
  10251. *
  10252. * var bound = _.bind(greet, object, 'hi');
  10253. * bound('!');
  10254. * // => 'hi fred!'
  10255. *
  10256. * // Bound with placeholders.
  10257. * var bound = _.bind(greet, object, _, '!');
  10258. * bound('hi');
  10259. * // => 'hi fred!'
  10260. */
  10261. var bind = baseRest(function(func, thisArg, partials) {
  10262. var bitmask = WRAP_BIND_FLAG;
  10263. if (partials.length) {
  10264. var holders = replaceHolders(partials, getHolder(bind));
  10265. bitmask |= WRAP_PARTIAL_FLAG;
  10266. }
  10267. return createWrap(func, bitmask, thisArg, partials, holders);
  10268. });
  10269. /**
  10270. * Creates a function that invokes the method at `object[key]` with `partials`
  10271. * prepended to the arguments it receives.
  10272. *
  10273. * This method differs from `_.bind` by allowing bound functions to reference
  10274. * methods that may be redefined or don't yet exist. See
  10275. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  10276. * for more details.
  10277. *
  10278. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  10279. * builds, may be used as a placeholder for partially applied arguments.
  10280. *
  10281. * @static
  10282. * @memberOf _
  10283. * @since 0.10.0
  10284. * @category Function
  10285. * @param {Object} object The object to invoke the method on.
  10286. * @param {string} key The key of the method.
  10287. * @param {...*} [partials] The arguments to be partially applied.
  10288. * @returns {Function} Returns the new bound function.
  10289. * @example
  10290. *
  10291. * var object = {
  10292. * 'user': 'fred',
  10293. * 'greet': function(greeting, punctuation) {
  10294. * return greeting + ' ' + this.user + punctuation;
  10295. * }
  10296. * };
  10297. *
  10298. * var bound = _.bindKey(object, 'greet', 'hi');
  10299. * bound('!');
  10300. * // => 'hi fred!'
  10301. *
  10302. * object.greet = function(greeting, punctuation) {
  10303. * return greeting + 'ya ' + this.user + punctuation;
  10304. * };
  10305. *
  10306. * bound('!');
  10307. * // => 'hiya fred!'
  10308. *
  10309. * // Bound with placeholders.
  10310. * var bound = _.bindKey(object, 'greet', _, '!');
  10311. * bound('hi');
  10312. * // => 'hiya fred!'
  10313. */
  10314. var bindKey = baseRest(function(object, key, partials) {
  10315. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  10316. if (partials.length) {
  10317. var holders = replaceHolders(partials, getHolder(bindKey));
  10318. bitmask |= WRAP_PARTIAL_FLAG;
  10319. }
  10320. return createWrap(key, bitmask, object, partials, holders);
  10321. });
  10322. /**
  10323. * Creates a function that accepts arguments of `func` and either invokes
  10324. * `func` returning its result, if at least `arity` number of arguments have
  10325. * been provided, or returns a function that accepts the remaining `func`
  10326. * arguments, and so on. The arity of `func` may be specified if `func.length`
  10327. * is not sufficient.
  10328. *
  10329. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  10330. * may be used as a placeholder for provided arguments.
  10331. *
  10332. * **Note:** This method doesn't set the "length" property of curried functions.
  10333. *
  10334. * @static
  10335. * @memberOf _
  10336. * @since 2.0.0
  10337. * @category Function
  10338. * @param {Function} func The function to curry.
  10339. * @param {number} [arity=func.length] The arity of `func`.
  10340. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10341. * @returns {Function} Returns the new curried function.
  10342. * @example
  10343. *
  10344. * var abc = function(a, b, c) {
  10345. * return [a, b, c];
  10346. * };
  10347. *
  10348. * var curried = _.curry(abc);
  10349. *
  10350. * curried(1)(2)(3);
  10351. * // => [1, 2, 3]
  10352. *
  10353. * curried(1, 2)(3);
  10354. * // => [1, 2, 3]
  10355. *
  10356. * curried(1, 2, 3);
  10357. * // => [1, 2, 3]
  10358. *
  10359. * // Curried with placeholders.
  10360. * curried(1)(_, 3)(2);
  10361. * // => [1, 2, 3]
  10362. */
  10363. function curry(func, arity, guard) {
  10364. arity = guard ? undefined : arity;
  10365. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  10366. result.placeholder = curry.placeholder;
  10367. return result;
  10368. }
  10369. /**
  10370. * This method is like `_.curry` except that arguments are applied to `func`
  10371. * in the manner of `_.partialRight` instead of `_.partial`.
  10372. *
  10373. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  10374. * builds, may be used as a placeholder for provided arguments.
  10375. *
  10376. * **Note:** This method doesn't set the "length" property of curried functions.
  10377. *
  10378. * @static
  10379. * @memberOf _
  10380. * @since 3.0.0
  10381. * @category Function
  10382. * @param {Function} func The function to curry.
  10383. * @param {number} [arity=func.length] The arity of `func`.
  10384. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10385. * @returns {Function} Returns the new curried function.
  10386. * @example
  10387. *
  10388. * var abc = function(a, b, c) {
  10389. * return [a, b, c];
  10390. * };
  10391. *
  10392. * var curried = _.curryRight(abc);
  10393. *
  10394. * curried(3)(2)(1);
  10395. * // => [1, 2, 3]
  10396. *
  10397. * curried(2, 3)(1);
  10398. * // => [1, 2, 3]
  10399. *
  10400. * curried(1, 2, 3);
  10401. * // => [1, 2, 3]
  10402. *
  10403. * // Curried with placeholders.
  10404. * curried(3)(1, _)(2);
  10405. * // => [1, 2, 3]
  10406. */
  10407. function curryRight(func, arity, guard) {
  10408. arity = guard ? undefined : arity;
  10409. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  10410. result.placeholder = curryRight.placeholder;
  10411. return result;
  10412. }
  10413. /**
  10414. * Creates a debounced function that delays invoking `func` until after `wait`
  10415. * milliseconds have elapsed since the last time the debounced function was
  10416. * invoked. The debounced function comes with a `cancel` method to cancel
  10417. * delayed `func` invocations and a `flush` method to immediately invoke them.
  10418. * Provide `options` to indicate whether `func` should be invoked on the
  10419. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  10420. * with the last arguments provided to the debounced function. Subsequent
  10421. * calls to the debounced function return the result of the last `func`
  10422. * invocation.
  10423. *
  10424. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  10425. * invoked on the trailing edge of the timeout only if the debounced function
  10426. * is invoked more than once during the `wait` timeout.
  10427. *
  10428. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  10429. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  10430. *
  10431. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  10432. * for details over the differences between `_.debounce` and `_.throttle`.
  10433. *
  10434. * @static
  10435. * @memberOf _
  10436. * @since 0.1.0
  10437. * @category Function
  10438. * @param {Function} func The function to debounce.
  10439. * @param {number} [wait=0] The number of milliseconds to delay.
  10440. * @param {Object} [options={}] The options object.
  10441. * @param {boolean} [options.leading=false]
  10442. * Specify invoking on the leading edge of the timeout.
  10443. * @param {number} [options.maxWait]
  10444. * The maximum time `func` is allowed to be delayed before it's invoked.
  10445. * @param {boolean} [options.trailing=true]
  10446. * Specify invoking on the trailing edge of the timeout.
  10447. * @returns {Function} Returns the new debounced function.
  10448. * @example
  10449. *
  10450. * // Avoid costly calculations while the window size is in flux.
  10451. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  10452. *
  10453. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  10454. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  10455. * 'leading': true,
  10456. * 'trailing': false
  10457. * }));
  10458. *
  10459. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  10460. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  10461. * var source = new EventSource('/stream');
  10462. * jQuery(source).on('message', debounced);
  10463. *
  10464. * // Cancel the trailing debounced invocation.
  10465. * jQuery(window).on('popstate', debounced.cancel);
  10466. */
  10467. function debounce(func, wait, options) {
  10468. var lastArgs,
  10469. lastThis,
  10470. maxWait,
  10471. result,
  10472. timerId,
  10473. lastCallTime,
  10474. lastInvokeTime = 0,
  10475. leading = false,
  10476. maxing = false,
  10477. trailing = true;
  10478. if (typeof func != 'function') {
  10479. throw new TypeError(FUNC_ERROR_TEXT);
  10480. }
  10481. wait = toNumber(wait) || 0;
  10482. if (isObject(options)) {
  10483. leading = !!options.leading;
  10484. maxing = 'maxWait' in options;
  10485. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  10486. trailing = 'trailing' in options ? !!options.trailing : trailing;
  10487. }
  10488. function invokeFunc(time) {
  10489. var args = lastArgs,
  10490. thisArg = lastThis;
  10491. lastArgs = lastThis = undefined;
  10492. lastInvokeTime = time;
  10493. result = func.apply(thisArg, args);
  10494. return result;
  10495. }
  10496. function leadingEdge(time) {
  10497. // Reset any `maxWait` timer.
  10498. lastInvokeTime = time;
  10499. // Start the timer for the trailing edge.
  10500. timerId = setTimeout(timerExpired, wait);
  10501. // Invoke the leading edge.
  10502. return leading ? invokeFunc(time) : result;
  10503. }
  10504. function remainingWait(time) {
  10505. var timeSinceLastCall = time - lastCallTime,
  10506. timeSinceLastInvoke = time - lastInvokeTime,
  10507. timeWaiting = wait - timeSinceLastCall;
  10508. return maxing
  10509. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  10510. : timeWaiting;
  10511. }
  10512. function shouldInvoke(time) {
  10513. var timeSinceLastCall = time - lastCallTime,
  10514. timeSinceLastInvoke = time - lastInvokeTime;
  10515. // Either this is the first call, activity has stopped and we're at the
  10516. // trailing edge, the system time has gone backwards and we're treating
  10517. // it as the trailing edge, or we've hit the `maxWait` limit.
  10518. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  10519. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  10520. }
  10521. function timerExpired() {
  10522. var time = now();
  10523. if (shouldInvoke(time)) {
  10524. return trailingEdge(time);
  10525. }
  10526. // Restart the timer.
  10527. timerId = setTimeout(timerExpired, remainingWait(time));
  10528. }
  10529. function trailingEdge(time) {
  10530. timerId = undefined;
  10531. // Only invoke if we have `lastArgs` which means `func` has been
  10532. // debounced at least once.
  10533. if (trailing && lastArgs) {
  10534. return invokeFunc(time);
  10535. }
  10536. lastArgs = lastThis = undefined;
  10537. return result;
  10538. }
  10539. function cancel() {
  10540. if (timerId !== undefined) {
  10541. clearTimeout(timerId);
  10542. }
  10543. lastInvokeTime = 0;
  10544. lastArgs = lastCallTime = lastThis = timerId = undefined;
  10545. }
  10546. function flush() {
  10547. return timerId === undefined ? result : trailingEdge(now());
  10548. }
  10549. function debounced() {
  10550. var time = now(),
  10551. isInvoking = shouldInvoke(time);
  10552. lastArgs = arguments;
  10553. lastThis = this;
  10554. lastCallTime = time;
  10555. if (isInvoking) {
  10556. if (timerId === undefined) {
  10557. return leadingEdge(lastCallTime);
  10558. }
  10559. if (maxing) {
  10560. // Handle invocations in a tight loop.
  10561. timerId = setTimeout(timerExpired, wait);
  10562. return invokeFunc(lastCallTime);
  10563. }
  10564. }
  10565. if (timerId === undefined) {
  10566. timerId = setTimeout(timerExpired, wait);
  10567. }
  10568. return result;
  10569. }
  10570. debounced.cancel = cancel;
  10571. debounced.flush = flush;
  10572. return debounced;
  10573. }
  10574. /**
  10575. * Defers invoking the `func` until the current call stack has cleared. Any
  10576. * additional arguments are provided to `func` when it's invoked.
  10577. *
  10578. * @static
  10579. * @memberOf _
  10580. * @since 0.1.0
  10581. * @category Function
  10582. * @param {Function} func The function to defer.
  10583. * @param {...*} [args] The arguments to invoke `func` with.
  10584. * @returns {number} Returns the timer id.
  10585. * @example
  10586. *
  10587. * _.defer(function(text) {
  10588. * console.log(text);
  10589. * }, 'deferred');
  10590. * // => Logs 'deferred' after one millisecond.
  10591. */
  10592. var defer = baseRest(function(func, args) {
  10593. return baseDelay(func, 1, args);
  10594. });
  10595. /**
  10596. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  10597. * provided to `func` when it's invoked.
  10598. *
  10599. * @static
  10600. * @memberOf _
  10601. * @since 0.1.0
  10602. * @category Function
  10603. * @param {Function} func The function to delay.
  10604. * @param {number} wait The number of milliseconds to delay invocation.
  10605. * @param {...*} [args] The arguments to invoke `func` with.
  10606. * @returns {number} Returns the timer id.
  10607. * @example
  10608. *
  10609. * _.delay(function(text) {
  10610. * console.log(text);
  10611. * }, 1000, 'later');
  10612. * // => Logs 'later' after one second.
  10613. */
  10614. var delay = baseRest(function(func, wait, args) {
  10615. return baseDelay(func, toNumber(wait) || 0, args);
  10616. });
  10617. /**
  10618. * Creates a function that invokes `func` with arguments reversed.
  10619. *
  10620. * @static
  10621. * @memberOf _
  10622. * @since 4.0.0
  10623. * @category Function
  10624. * @param {Function} func The function to flip arguments for.
  10625. * @returns {Function} Returns the new flipped function.
  10626. * @example
  10627. *
  10628. * var flipped = _.flip(function() {
  10629. * return _.toArray(arguments);
  10630. * });
  10631. *
  10632. * flipped('a', 'b', 'c', 'd');
  10633. * // => ['d', 'c', 'b', 'a']
  10634. */
  10635. function flip(func) {
  10636. return createWrap(func, WRAP_FLIP_FLAG);
  10637. }
  10638. /**
  10639. * Creates a function that memoizes the result of `func`. If `resolver` is
  10640. * provided, it determines the cache key for storing the result based on the
  10641. * arguments provided to the memoized function. By default, the first argument
  10642. * provided to the memoized function is used as the map cache key. The `func`
  10643. * is invoked with the `this` binding of the memoized function.
  10644. *
  10645. * **Note:** The cache is exposed as the `cache` property on the memoized
  10646. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  10647. * constructor with one whose instances implement the
  10648. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  10649. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  10650. *
  10651. * @static
  10652. * @memberOf _
  10653. * @since 0.1.0
  10654. * @category Function
  10655. * @param {Function} func The function to have its output memoized.
  10656. * @param {Function} [resolver] The function to resolve the cache key.
  10657. * @returns {Function} Returns the new memoized function.
  10658. * @example
  10659. *
  10660. * var object = { 'a': 1, 'b': 2 };
  10661. * var other = { 'c': 3, 'd': 4 };
  10662. *
  10663. * var values = _.memoize(_.values);
  10664. * values(object);
  10665. * // => [1, 2]
  10666. *
  10667. * values(other);
  10668. * // => [3, 4]
  10669. *
  10670. * object.a = 2;
  10671. * values(object);
  10672. * // => [1, 2]
  10673. *
  10674. * // Modify the result cache.
  10675. * values.cache.set(object, ['a', 'b']);
  10676. * values(object);
  10677. * // => ['a', 'b']
  10678. *
  10679. * // Replace `_.memoize.Cache`.
  10680. * _.memoize.Cache = WeakMap;
  10681. */
  10682. function memoize(func, resolver) {
  10683. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  10684. throw new TypeError(FUNC_ERROR_TEXT);
  10685. }
  10686. var memoized = function() {
  10687. var args = arguments,
  10688. key = resolver ? resolver.apply(this, args) : args[0],
  10689. cache = memoized.cache;
  10690. if (cache.has(key)) {
  10691. return cache.get(key);
  10692. }
  10693. var result = func.apply(this, args);
  10694. memoized.cache = cache.set(key, result) || cache;
  10695. return result;
  10696. };
  10697. memoized.cache = new (memoize.Cache || MapCache);
  10698. return memoized;
  10699. }
  10700. // Expose `MapCache`.
  10701. memoize.Cache = MapCache;
  10702. /**
  10703. * Creates a function that negates the result of the predicate `func`. The
  10704. * `func` predicate is invoked with the `this` binding and arguments of the
  10705. * created function.
  10706. *
  10707. * @static
  10708. * @memberOf _
  10709. * @since 3.0.0
  10710. * @category Function
  10711. * @param {Function} predicate The predicate to negate.
  10712. * @returns {Function} Returns the new negated function.
  10713. * @example
  10714. *
  10715. * function isEven(n) {
  10716. * return n % 2 == 0;
  10717. * }
  10718. *
  10719. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  10720. * // => [1, 3, 5]
  10721. */
  10722. function negate(predicate) {
  10723. if (typeof predicate != 'function') {
  10724. throw new TypeError(FUNC_ERROR_TEXT);
  10725. }
  10726. return function() {
  10727. var args = arguments;
  10728. switch (args.length) {
  10729. case 0: return !predicate.call(this);
  10730. case 1: return !predicate.call(this, args[0]);
  10731. case 2: return !predicate.call(this, args[0], args[1]);
  10732. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  10733. }
  10734. return !predicate.apply(this, args);
  10735. };
  10736. }
  10737. /**
  10738. * Creates a function that is restricted to invoking `func` once. Repeat calls
  10739. * to the function return the value of the first invocation. The `func` is
  10740. * invoked with the `this` binding and arguments of the created function.
  10741. *
  10742. * @static
  10743. * @memberOf _
  10744. * @since 0.1.0
  10745. * @category Function
  10746. * @param {Function} func The function to restrict.
  10747. * @returns {Function} Returns the new restricted function.
  10748. * @example
  10749. *
  10750. * var initialize = _.once(createApplication);
  10751. * initialize();
  10752. * initialize();
  10753. * // => `createApplication` is invoked once
  10754. */
  10755. function once(func) {
  10756. return before(2, func);
  10757. }
  10758. /**
  10759. * Creates a function that invokes `func` with its arguments transformed.
  10760. *
  10761. * @static
  10762. * @since 4.0.0
  10763. * @memberOf _
  10764. * @category Function
  10765. * @param {Function} func The function to wrap.
  10766. * @param {...(Function|Function[])} [transforms=[_.identity]]
  10767. * The argument transforms.
  10768. * @returns {Function} Returns the new function.
  10769. * @example
  10770. *
  10771. * function doubled(n) {
  10772. * return n * 2;
  10773. * }
  10774. *
  10775. * function square(n) {
  10776. * return n * n;
  10777. * }
  10778. *
  10779. * var func = _.overArgs(function(x, y) {
  10780. * return [x, y];
  10781. * }, [square, doubled]);
  10782. *
  10783. * func(9, 3);
  10784. * // => [81, 6]
  10785. *
  10786. * func(10, 5);
  10787. * // => [100, 10]
  10788. */
  10789. var overArgs = castRest(function(func, transforms) {
  10790. transforms = (transforms.length == 1 && isArray(transforms[0]))
  10791. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  10792. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  10793. var funcsLength = transforms.length;
  10794. return baseRest(function(args) {
  10795. var index = -1,
  10796. length = nativeMin(args.length, funcsLength);
  10797. while (++index < length) {
  10798. args[index] = transforms[index].call(this, args[index]);
  10799. }
  10800. return apply(func, this, args);
  10801. });
  10802. });
  10803. /**
  10804. * Creates a function that invokes `func` with `partials` prepended to the
  10805. * arguments it receives. This method is like `_.bind` except it does **not**
  10806. * alter the `this` binding.
  10807. *
  10808. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  10809. * builds, may be used as a placeholder for partially applied arguments.
  10810. *
  10811. * **Note:** This method doesn't set the "length" property of partially
  10812. * applied functions.
  10813. *
  10814. * @static
  10815. * @memberOf _
  10816. * @since 0.2.0
  10817. * @category Function
  10818. * @param {Function} func The function to partially apply arguments to.
  10819. * @param {...*} [partials] The arguments to be partially applied.
  10820. * @returns {Function} Returns the new partially applied function.
  10821. * @example
  10822. *
  10823. * function greet(greeting, name) {
  10824. * return greeting + ' ' + name;
  10825. * }
  10826. *
  10827. * var sayHelloTo = _.partial(greet, 'hello');
  10828. * sayHelloTo('fred');
  10829. * // => 'hello fred'
  10830. *
  10831. * // Partially applied with placeholders.
  10832. * var greetFred = _.partial(greet, _, 'fred');
  10833. * greetFred('hi');
  10834. * // => 'hi fred'
  10835. */
  10836. var partial = baseRest(function(func, partials) {
  10837. var holders = replaceHolders(partials, getHolder(partial));
  10838. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  10839. });
  10840. /**
  10841. * This method is like `_.partial` except that partially applied arguments
  10842. * are appended to the arguments it receives.
  10843. *
  10844. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  10845. * builds, may be used as a placeholder for partially applied arguments.
  10846. *
  10847. * **Note:** This method doesn't set the "length" property of partially
  10848. * applied functions.
  10849. *
  10850. * @static
  10851. * @memberOf _
  10852. * @since 1.0.0
  10853. * @category Function
  10854. * @param {Function} func The function to partially apply arguments to.
  10855. * @param {...*} [partials] The arguments to be partially applied.
  10856. * @returns {Function} Returns the new partially applied function.
  10857. * @example
  10858. *
  10859. * function greet(greeting, name) {
  10860. * return greeting + ' ' + name;
  10861. * }
  10862. *
  10863. * var greetFred = _.partialRight(greet, 'fred');
  10864. * greetFred('hi');
  10865. * // => 'hi fred'
  10866. *
  10867. * // Partially applied with placeholders.
  10868. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  10869. * sayHelloTo('fred');
  10870. * // => 'hello fred'
  10871. */
  10872. var partialRight = baseRest(function(func, partials) {
  10873. var holders = replaceHolders(partials, getHolder(partialRight));
  10874. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  10875. });
  10876. /**
  10877. * Creates a function that invokes `func` with arguments arranged according
  10878. * to the specified `indexes` where the argument value at the first index is
  10879. * provided as the first argument, the argument value at the second index is
  10880. * provided as the second argument, and so on.
  10881. *
  10882. * @static
  10883. * @memberOf _
  10884. * @since 3.0.0
  10885. * @category Function
  10886. * @param {Function} func The function to rearrange arguments for.
  10887. * @param {...(number|number[])} indexes The arranged argument indexes.
  10888. * @returns {Function} Returns the new function.
  10889. * @example
  10890. *
  10891. * var rearged = _.rearg(function(a, b, c) {
  10892. * return [a, b, c];
  10893. * }, [2, 0, 1]);
  10894. *
  10895. * rearged('b', 'c', 'a')
  10896. * // => ['a', 'b', 'c']
  10897. */
  10898. var rearg = flatRest(function(func, indexes) {
  10899. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  10900. });
  10901. /**
  10902. * Creates a function that invokes `func` with the `this` binding of the
  10903. * created function and arguments from `start` and beyond provided as
  10904. * an array.
  10905. *
  10906. * **Note:** This method is based on the
  10907. * [rest parameter](https://mdn.io/rest_parameters).
  10908. *
  10909. * @static
  10910. * @memberOf _
  10911. * @since 4.0.0
  10912. * @category Function
  10913. * @param {Function} func The function to apply a rest parameter to.
  10914. * @param {number} [start=func.length-1] The start position of the rest parameter.
  10915. * @returns {Function} Returns the new function.
  10916. * @example
  10917. *
  10918. * var say = _.rest(function(what, names) {
  10919. * return what + ' ' + _.initial(names).join(', ') +
  10920. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  10921. * });
  10922. *
  10923. * say('hello', 'fred', 'barney', 'pebbles');
  10924. * // => 'hello fred, barney, & pebbles'
  10925. */
  10926. function rest(func, start) {
  10927. if (typeof func != 'function') {
  10928. throw new TypeError(FUNC_ERROR_TEXT);
  10929. }
  10930. start = start === undefined ? start : toInteger(start);
  10931. return baseRest(func, start);
  10932. }
  10933. /**
  10934. * Creates a function that invokes `func` with the `this` binding of the
  10935. * create function and an array of arguments much like
  10936. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  10937. *
  10938. * **Note:** This method is based on the
  10939. * [spread operator](https://mdn.io/spread_operator).
  10940. *
  10941. * @static
  10942. * @memberOf _
  10943. * @since 3.2.0
  10944. * @category Function
  10945. * @param {Function} func The function to spread arguments over.
  10946. * @param {number} [start=0] The start position of the spread.
  10947. * @returns {Function} Returns the new function.
  10948. * @example
  10949. *
  10950. * var say = _.spread(function(who, what) {
  10951. * return who + ' says ' + what;
  10952. * });
  10953. *
  10954. * say(['fred', 'hello']);
  10955. * // => 'fred says hello'
  10956. *
  10957. * var numbers = Promise.all([
  10958. * Promise.resolve(40),
  10959. * Promise.resolve(36)
  10960. * ]);
  10961. *
  10962. * numbers.then(_.spread(function(x, y) {
  10963. * return x + y;
  10964. * }));
  10965. * // => a Promise of 76
  10966. */
  10967. function spread(func, start) {
  10968. if (typeof func != 'function') {
  10969. throw new TypeError(FUNC_ERROR_TEXT);
  10970. }
  10971. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  10972. return baseRest(function(args) {
  10973. var array = args[start],
  10974. otherArgs = castSlice(args, 0, start);
  10975. if (array) {
  10976. arrayPush(otherArgs, array);
  10977. }
  10978. return apply(func, this, otherArgs);
  10979. });
  10980. }
  10981. /**
  10982. * Creates a throttled function that only invokes `func` at most once per
  10983. * every `wait` milliseconds. The throttled function comes with a `cancel`
  10984. * method to cancel delayed `func` invocations and a `flush` method to
  10985. * immediately invoke them. Provide `options` to indicate whether `func`
  10986. * should be invoked on the leading and/or trailing edge of the `wait`
  10987. * timeout. The `func` is invoked with the last arguments provided to the
  10988. * throttled function. Subsequent calls to the throttled function return the
  10989. * result of the last `func` invocation.
  10990. *
  10991. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  10992. * invoked on the trailing edge of the timeout only if the throttled function
  10993. * is invoked more than once during the `wait` timeout.
  10994. *
  10995. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  10996. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  10997. *
  10998. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  10999. * for details over the differences between `_.throttle` and `_.debounce`.
  11000. *
  11001. * @static
  11002. * @memberOf _
  11003. * @since 0.1.0
  11004. * @category Function
  11005. * @param {Function} func The function to throttle.
  11006. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  11007. * @param {Object} [options={}] The options object.
  11008. * @param {boolean} [options.leading=true]
  11009. * Specify invoking on the leading edge of the timeout.
  11010. * @param {boolean} [options.trailing=true]
  11011. * Specify invoking on the trailing edge of the timeout.
  11012. * @returns {Function} Returns the new throttled function.
  11013. * @example
  11014. *
  11015. * // Avoid excessively updating the position while scrolling.
  11016. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  11017. *
  11018. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  11019. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  11020. * jQuery(element).on('click', throttled);
  11021. *
  11022. * // Cancel the trailing throttled invocation.
  11023. * jQuery(window).on('popstate', throttled.cancel);
  11024. */
  11025. function throttle(func, wait, options) {
  11026. var leading = true,
  11027. trailing = true;
  11028. if (typeof func != 'function') {
  11029. throw new TypeError(FUNC_ERROR_TEXT);
  11030. }
  11031. if (isObject(options)) {
  11032. leading = 'leading' in options ? !!options.leading : leading;
  11033. trailing = 'trailing' in options ? !!options.trailing : trailing;
  11034. }
  11035. return debounce(func, wait, {
  11036. 'leading': leading,
  11037. 'maxWait': wait,
  11038. 'trailing': trailing
  11039. });
  11040. }
  11041. /**
  11042. * Creates a function that accepts up to one argument, ignoring any
  11043. * additional arguments.
  11044. *
  11045. * @static
  11046. * @memberOf _
  11047. * @since 4.0.0
  11048. * @category Function
  11049. * @param {Function} func The function to cap arguments for.
  11050. * @returns {Function} Returns the new capped function.
  11051. * @example
  11052. *
  11053. * _.map(['6', '8', '10'], _.unary(parseInt));
  11054. * // => [6, 8, 10]
  11055. */
  11056. function unary(func) {
  11057. return ary(func, 1);
  11058. }
  11059. /**
  11060. * Creates a function that provides `value` to `wrapper` as its first
  11061. * argument. Any additional arguments provided to the function are appended
  11062. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  11063. * binding of the created function.
  11064. *
  11065. * @static
  11066. * @memberOf _
  11067. * @since 0.1.0
  11068. * @category Function
  11069. * @param {*} value The value to wrap.
  11070. * @param {Function} [wrapper=identity] The wrapper function.
  11071. * @returns {Function} Returns the new function.
  11072. * @example
  11073. *
  11074. * var p = _.wrap(_.escape, function(func, text) {
  11075. * return '<p>' + func(text) + '</p>';
  11076. * });
  11077. *
  11078. * p('fred, barney, & pebbles');
  11079. * // => '<p>fred, barney, &amp; pebbles</p>'
  11080. */
  11081. function wrap(value, wrapper) {
  11082. return partial(castFunction(wrapper), value);
  11083. }
  11084. /*------------------------------------------------------------------------*/
  11085. /**
  11086. * Casts `value` as an array if it's not one.
  11087. *
  11088. * @static
  11089. * @memberOf _
  11090. * @since 4.4.0
  11091. * @category Lang
  11092. * @param {*} value The value to inspect.
  11093. * @returns {Array} Returns the cast array.
  11094. * @example
  11095. *
  11096. * _.castArray(1);
  11097. * // => [1]
  11098. *
  11099. * _.castArray({ 'a': 1 });
  11100. * // => [{ 'a': 1 }]
  11101. *
  11102. * _.castArray('abc');
  11103. * // => ['abc']
  11104. *
  11105. * _.castArray(null);
  11106. * // => [null]
  11107. *
  11108. * _.castArray(undefined);
  11109. * // => [undefined]
  11110. *
  11111. * _.castArray();
  11112. * // => []
  11113. *
  11114. * var array = [1, 2, 3];
  11115. * console.log(_.castArray(array) === array);
  11116. * // => true
  11117. */
  11118. function castArray() {
  11119. if (!arguments.length) {
  11120. return [];
  11121. }
  11122. var value = arguments[0];
  11123. return isArray(value) ? value : [value];
  11124. }
  11125. /**
  11126. * Creates a shallow clone of `value`.
  11127. *
  11128. * **Note:** This method is loosely based on the
  11129. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  11130. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  11131. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  11132. * arrays. The own enumerable properties of `arguments` objects are cloned
  11133. * as plain objects. An empty object is returned for uncloneable values such
  11134. * as error objects, functions, DOM nodes, and WeakMaps.
  11135. *
  11136. * @static
  11137. * @memberOf _
  11138. * @since 0.1.0
  11139. * @category Lang
  11140. * @param {*} value The value to clone.
  11141. * @returns {*} Returns the cloned value.
  11142. * @see _.cloneDeep
  11143. * @example
  11144. *
  11145. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  11146. *
  11147. * var shallow = _.clone(objects);
  11148. * console.log(shallow[0] === objects[0]);
  11149. * // => true
  11150. */
  11151. function clone(value) {
  11152. return baseClone(value, CLONE_SYMBOLS_FLAG);
  11153. }
  11154. /**
  11155. * This method is like `_.clone` except that it accepts `customizer` which
  11156. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  11157. * cloning is handled by the method instead. The `customizer` is invoked with
  11158. * up to four arguments; (value [, index|key, object, stack]).
  11159. *
  11160. * @static
  11161. * @memberOf _
  11162. * @since 4.0.0
  11163. * @category Lang
  11164. * @param {*} value The value to clone.
  11165. * @param {Function} [customizer] The function to customize cloning.
  11166. * @returns {*} Returns the cloned value.
  11167. * @see _.cloneDeepWith
  11168. * @example
  11169. *
  11170. * function customizer(value) {
  11171. * if (_.isElement(value)) {
  11172. * return value.cloneNode(false);
  11173. * }
  11174. * }
  11175. *
  11176. * var el = _.cloneWith(document.body, customizer);
  11177. *
  11178. * console.log(el === document.body);
  11179. * // => false
  11180. * console.log(el.nodeName);
  11181. * // => 'BODY'
  11182. * console.log(el.childNodes.length);
  11183. * // => 0
  11184. */
  11185. function cloneWith(value, customizer) {
  11186. customizer = typeof customizer == 'function' ? customizer : undefined;
  11187. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  11188. }
  11189. /**
  11190. * This method is like `_.clone` except that it recursively clones `value`.
  11191. *
  11192. * @static
  11193. * @memberOf _
  11194. * @since 1.0.0
  11195. * @category Lang
  11196. * @param {*} value The value to recursively clone.
  11197. * @returns {*} Returns the deep cloned value.
  11198. * @see _.clone
  11199. * @example
  11200. *
  11201. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  11202. *
  11203. * var deep = _.cloneDeep(objects);
  11204. * console.log(deep[0] === objects[0]);
  11205. * // => false
  11206. */
  11207. function cloneDeep(value) {
  11208. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  11209. }
  11210. /**
  11211. * This method is like `_.cloneWith` except that it recursively clones `value`.
  11212. *
  11213. * @static
  11214. * @memberOf _
  11215. * @since 4.0.0
  11216. * @category Lang
  11217. * @param {*} value The value to recursively clone.
  11218. * @param {Function} [customizer] The function to customize cloning.
  11219. * @returns {*} Returns the deep cloned value.
  11220. * @see _.cloneWith
  11221. * @example
  11222. *
  11223. * function customizer(value) {
  11224. * if (_.isElement(value)) {
  11225. * return value.cloneNode(true);
  11226. * }
  11227. * }
  11228. *
  11229. * var el = _.cloneDeepWith(document.body, customizer);
  11230. *
  11231. * console.log(el === document.body);
  11232. * // => false
  11233. * console.log(el.nodeName);
  11234. * // => 'BODY'
  11235. * console.log(el.childNodes.length);
  11236. * // => 20
  11237. */
  11238. function cloneDeepWith(value, customizer) {
  11239. customizer = typeof customizer == 'function' ? customizer : undefined;
  11240. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  11241. }
  11242. /**
  11243. * Checks if `object` conforms to `source` by invoking the predicate
  11244. * properties of `source` with the corresponding property values of `object`.
  11245. *
  11246. * **Note:** This method is equivalent to `_.conforms` when `source` is
  11247. * partially applied.
  11248. *
  11249. * @static
  11250. * @memberOf _
  11251. * @since 4.14.0
  11252. * @category Lang
  11253. * @param {Object} object The object to inspect.
  11254. * @param {Object} source The object of property predicates to conform to.
  11255. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  11256. * @example
  11257. *
  11258. * var object = { 'a': 1, 'b': 2 };
  11259. *
  11260. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  11261. * // => true
  11262. *
  11263. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  11264. * // => false
  11265. */
  11266. function conformsTo(object, source) {
  11267. return source == null || baseConformsTo(object, source, keys(source));
  11268. }
  11269. /**
  11270. * Performs a
  11271. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  11272. * comparison between two values to determine if they are equivalent.
  11273. *
  11274. * @static
  11275. * @memberOf _
  11276. * @since 4.0.0
  11277. * @category Lang
  11278. * @param {*} value The value to compare.
  11279. * @param {*} other The other value to compare.
  11280. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  11281. * @example
  11282. *
  11283. * var object = { 'a': 1 };
  11284. * var other = { 'a': 1 };
  11285. *
  11286. * _.eq(object, object);
  11287. * // => true
  11288. *
  11289. * _.eq(object, other);
  11290. * // => false
  11291. *
  11292. * _.eq('a', 'a');
  11293. * // => true
  11294. *
  11295. * _.eq('a', Object('a'));
  11296. * // => false
  11297. *
  11298. * _.eq(NaN, NaN);
  11299. * // => true
  11300. */
  11301. function eq(value, other) {
  11302. return value === other || (value !== value && other !== other);
  11303. }
  11304. /**
  11305. * Checks if `value` is greater than `other`.
  11306. *
  11307. * @static
  11308. * @memberOf _
  11309. * @since 3.9.0
  11310. * @category Lang
  11311. * @param {*} value The value to compare.
  11312. * @param {*} other The other value to compare.
  11313. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  11314. * else `false`.
  11315. * @see _.lt
  11316. * @example
  11317. *
  11318. * _.gt(3, 1);
  11319. * // => true
  11320. *
  11321. * _.gt(3, 3);
  11322. * // => false
  11323. *
  11324. * _.gt(1, 3);
  11325. * // => false
  11326. */
  11327. var gt = createRelationalOperation(baseGt);
  11328. /**
  11329. * Checks if `value` is greater than or equal to `other`.
  11330. *
  11331. * @static
  11332. * @memberOf _
  11333. * @since 3.9.0
  11334. * @category Lang
  11335. * @param {*} value The value to compare.
  11336. * @param {*} other The other value to compare.
  11337. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  11338. * `other`, else `false`.
  11339. * @see _.lte
  11340. * @example
  11341. *
  11342. * _.gte(3, 1);
  11343. * // => true
  11344. *
  11345. * _.gte(3, 3);
  11346. * // => true
  11347. *
  11348. * _.gte(1, 3);
  11349. * // => false
  11350. */
  11351. var gte = createRelationalOperation(function(value, other) {
  11352. return value >= other;
  11353. });
  11354. /**
  11355. * Checks if `value` is likely an `arguments` object.
  11356. *
  11357. * @static
  11358. * @memberOf _
  11359. * @since 0.1.0
  11360. * @category Lang
  11361. * @param {*} value The value to check.
  11362. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  11363. * else `false`.
  11364. * @example
  11365. *
  11366. * _.isArguments(function() { return arguments; }());
  11367. * // => true
  11368. *
  11369. * _.isArguments([1, 2, 3]);
  11370. * // => false
  11371. */
  11372. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  11373. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  11374. !propertyIsEnumerable.call(value, 'callee');
  11375. };
  11376. /**
  11377. * Checks if `value` is classified as an `Array` object.
  11378. *
  11379. * @static
  11380. * @memberOf _
  11381. * @since 0.1.0
  11382. * @category Lang
  11383. * @param {*} value The value to check.
  11384. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  11385. * @example
  11386. *
  11387. * _.isArray([1, 2, 3]);
  11388. * // => true
  11389. *
  11390. * _.isArray(document.body.children);
  11391. * // => false
  11392. *
  11393. * _.isArray('abc');
  11394. * // => false
  11395. *
  11396. * _.isArray(_.noop);
  11397. * // => false
  11398. */
  11399. var isArray = Array.isArray;
  11400. /**
  11401. * Checks if `value` is classified as an `ArrayBuffer` object.
  11402. *
  11403. * @static
  11404. * @memberOf _
  11405. * @since 4.3.0
  11406. * @category Lang
  11407. * @param {*} value The value to check.
  11408. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  11409. * @example
  11410. *
  11411. * _.isArrayBuffer(new ArrayBuffer(2));
  11412. * // => true
  11413. *
  11414. * _.isArrayBuffer(new Array(2));
  11415. * // => false
  11416. */
  11417. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  11418. /**
  11419. * Checks if `value` is array-like. A value is considered array-like if it's
  11420. * not a function and has a `value.length` that's an integer greater than or
  11421. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  11422. *
  11423. * @static
  11424. * @memberOf _
  11425. * @since 4.0.0
  11426. * @category Lang
  11427. * @param {*} value The value to check.
  11428. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  11429. * @example
  11430. *
  11431. * _.isArrayLike([1, 2, 3]);
  11432. * // => true
  11433. *
  11434. * _.isArrayLike(document.body.children);
  11435. * // => true
  11436. *
  11437. * _.isArrayLike('abc');
  11438. * // => true
  11439. *
  11440. * _.isArrayLike(_.noop);
  11441. * // => false
  11442. */
  11443. function isArrayLike(value) {
  11444. return value != null && isLength(value.length) && !isFunction(value);
  11445. }
  11446. /**
  11447. * This method is like `_.isArrayLike` except that it also checks if `value`
  11448. * is an object.
  11449. *
  11450. * @static
  11451. * @memberOf _
  11452. * @since 4.0.0
  11453. * @category Lang
  11454. * @param {*} value The value to check.
  11455. * @returns {boolean} Returns `true` if `value` is an array-like object,
  11456. * else `false`.
  11457. * @example
  11458. *
  11459. * _.isArrayLikeObject([1, 2, 3]);
  11460. * // => true
  11461. *
  11462. * _.isArrayLikeObject(document.body.children);
  11463. * // => true
  11464. *
  11465. * _.isArrayLikeObject('abc');
  11466. * // => false
  11467. *
  11468. * _.isArrayLikeObject(_.noop);
  11469. * // => false
  11470. */
  11471. function isArrayLikeObject(value) {
  11472. return isObjectLike(value) && isArrayLike(value);
  11473. }
  11474. /**
  11475. * Checks if `value` is classified as a boolean primitive or object.
  11476. *
  11477. * @static
  11478. * @memberOf _
  11479. * @since 0.1.0
  11480. * @category Lang
  11481. * @param {*} value The value to check.
  11482. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  11483. * @example
  11484. *
  11485. * _.isBoolean(false);
  11486. * // => true
  11487. *
  11488. * _.isBoolean(null);
  11489. * // => false
  11490. */
  11491. function isBoolean(value) {
  11492. return value === true || value === false ||
  11493. (isObjectLike(value) && baseGetTag(value) == boolTag);
  11494. }
  11495. /**
  11496. * Checks if `value` is a buffer.
  11497. *
  11498. * @static
  11499. * @memberOf _
  11500. * @since 4.3.0
  11501. * @category Lang
  11502. * @param {*} value The value to check.
  11503. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  11504. * @example
  11505. *
  11506. * _.isBuffer(new Buffer(2));
  11507. * // => true
  11508. *
  11509. * _.isBuffer(new Uint8Array(2));
  11510. * // => false
  11511. */
  11512. var isBuffer = nativeIsBuffer || stubFalse;
  11513. /**
  11514. * Checks if `value` is classified as a `Date` object.
  11515. *
  11516. * @static
  11517. * @memberOf _
  11518. * @since 0.1.0
  11519. * @category Lang
  11520. * @param {*} value The value to check.
  11521. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  11522. * @example
  11523. *
  11524. * _.isDate(new Date);
  11525. * // => true
  11526. *
  11527. * _.isDate('Mon April 23 2012');
  11528. * // => false
  11529. */
  11530. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  11531. /**
  11532. * Checks if `value` is likely a DOM element.
  11533. *
  11534. * @static
  11535. * @memberOf _
  11536. * @since 0.1.0
  11537. * @category Lang
  11538. * @param {*} value The value to check.
  11539. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  11540. * @example
  11541. *
  11542. * _.isElement(document.body);
  11543. * // => true
  11544. *
  11545. * _.isElement('<body>');
  11546. * // => false
  11547. */
  11548. function isElement(value) {
  11549. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  11550. }
  11551. /**
  11552. * Checks if `value` is an empty object, collection, map, or set.
  11553. *
  11554. * Objects are considered empty if they have no own enumerable string keyed
  11555. * properties.
  11556. *
  11557. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  11558. * jQuery-like collections are considered empty if they have a `length` of `0`.
  11559. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  11560. *
  11561. * @static
  11562. * @memberOf _
  11563. * @since 0.1.0
  11564. * @category Lang
  11565. * @param {*} value The value to check.
  11566. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  11567. * @example
  11568. *
  11569. * _.isEmpty(null);
  11570. * // => true
  11571. *
  11572. * _.isEmpty(true);
  11573. * // => true
  11574. *
  11575. * _.isEmpty(1);
  11576. * // => true
  11577. *
  11578. * _.isEmpty([1, 2, 3]);
  11579. * // => false
  11580. *
  11581. * _.isEmpty({ 'a': 1 });
  11582. * // => false
  11583. */
  11584. function isEmpty(value) {
  11585. if (value == null) {
  11586. return true;
  11587. }
  11588. if (isArrayLike(value) &&
  11589. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  11590. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  11591. return !value.length;
  11592. }
  11593. var tag = getTag(value);
  11594. if (tag == mapTag || tag == setTag) {
  11595. return !value.size;
  11596. }
  11597. if (isPrototype(value)) {
  11598. return !baseKeys(value).length;
  11599. }
  11600. for (var key in value) {
  11601. if (hasOwnProperty.call(value, key)) {
  11602. return false;
  11603. }
  11604. }
  11605. return true;
  11606. }
  11607. /**
  11608. * Performs a deep comparison between two values to determine if they are
  11609. * equivalent.
  11610. *
  11611. * **Note:** This method supports comparing arrays, array buffers, booleans,
  11612. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  11613. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  11614. * by their own, not inherited, enumerable properties. Functions and DOM
  11615. * nodes are compared by strict equality, i.e. `===`.
  11616. *
  11617. * @static
  11618. * @memberOf _
  11619. * @since 0.1.0
  11620. * @category Lang
  11621. * @param {*} value The value to compare.
  11622. * @param {*} other The other value to compare.
  11623. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  11624. * @example
  11625. *
  11626. * var object = { 'a': 1 };
  11627. * var other = { 'a': 1 };
  11628. *
  11629. * _.isEqual(object, other);
  11630. * // => true
  11631. *
  11632. * object === other;
  11633. * // => false
  11634. */
  11635. function isEqual(value, other) {
  11636. return baseIsEqual(value, other);
  11637. }
  11638. /**
  11639. * This method is like `_.isEqual` except that it accepts `customizer` which
  11640. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  11641. * are handled by the method instead. The `customizer` is invoked with up to
  11642. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  11643. *
  11644. * @static
  11645. * @memberOf _
  11646. * @since 4.0.0
  11647. * @category Lang
  11648. * @param {*} value The value to compare.
  11649. * @param {*} other The other value to compare.
  11650. * @param {Function} [customizer] The function to customize comparisons.
  11651. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  11652. * @example
  11653. *
  11654. * function isGreeting(value) {
  11655. * return /^h(?:i|ello)$/.test(value);
  11656. * }
  11657. *
  11658. * function customizer(objValue, othValue) {
  11659. * if (isGreeting(objValue) && isGreeting(othValue)) {
  11660. * return true;
  11661. * }
  11662. * }
  11663. *
  11664. * var array = ['hello', 'goodbye'];
  11665. * var other = ['hi', 'goodbye'];
  11666. *
  11667. * _.isEqualWith(array, other, customizer);
  11668. * // => true
  11669. */
  11670. function isEqualWith(value, other, customizer) {
  11671. customizer = typeof customizer == 'function' ? customizer : undefined;
  11672. var result = customizer ? customizer(value, other) : undefined;
  11673. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  11674. }
  11675. /**
  11676. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  11677. * `SyntaxError`, `TypeError`, or `URIError` object.
  11678. *
  11679. * @static
  11680. * @memberOf _
  11681. * @since 3.0.0
  11682. * @category Lang
  11683. * @param {*} value The value to check.
  11684. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  11685. * @example
  11686. *
  11687. * _.isError(new Error);
  11688. * // => true
  11689. *
  11690. * _.isError(Error);
  11691. * // => false
  11692. */
  11693. function isError(value) {
  11694. if (!isObjectLike(value)) {
  11695. return false;
  11696. }
  11697. var tag = baseGetTag(value);
  11698. return tag == errorTag || tag == domExcTag ||
  11699. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  11700. }
  11701. /**
  11702. * Checks if `value` is a finite primitive number.
  11703. *
  11704. * **Note:** This method is based on
  11705. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  11706. *
  11707. * @static
  11708. * @memberOf _
  11709. * @since 0.1.0
  11710. * @category Lang
  11711. * @param {*} value The value to check.
  11712. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  11713. * @example
  11714. *
  11715. * _.isFinite(3);
  11716. * // => true
  11717. *
  11718. * _.isFinite(Number.MIN_VALUE);
  11719. * // => true
  11720. *
  11721. * _.isFinite(Infinity);
  11722. * // => false
  11723. *
  11724. * _.isFinite('3');
  11725. * // => false
  11726. */
  11727. function isFinite(value) {
  11728. return typeof value == 'number' && nativeIsFinite(value);
  11729. }
  11730. /**
  11731. * Checks if `value` is classified as a `Function` object.
  11732. *
  11733. * @static
  11734. * @memberOf _
  11735. * @since 0.1.0
  11736. * @category Lang
  11737. * @param {*} value The value to check.
  11738. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  11739. * @example
  11740. *
  11741. * _.isFunction(_);
  11742. * // => true
  11743. *
  11744. * _.isFunction(/abc/);
  11745. * // => false
  11746. */
  11747. function isFunction(value) {
  11748. if (!isObject(value)) {
  11749. return false;
  11750. }
  11751. // The use of `Object#toString` avoids issues with the `typeof` operator
  11752. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  11753. var tag = baseGetTag(value);
  11754. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  11755. }
  11756. /**
  11757. * Checks if `value` is an integer.
  11758. *
  11759. * **Note:** This method is based on
  11760. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  11761. *
  11762. * @static
  11763. * @memberOf _
  11764. * @since 4.0.0
  11765. * @category Lang
  11766. * @param {*} value The value to check.
  11767. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  11768. * @example
  11769. *
  11770. * _.isInteger(3);
  11771. * // => true
  11772. *
  11773. * _.isInteger(Number.MIN_VALUE);
  11774. * // => false
  11775. *
  11776. * _.isInteger(Infinity);
  11777. * // => false
  11778. *
  11779. * _.isInteger('3');
  11780. * // => false
  11781. */
  11782. function isInteger(value) {
  11783. return typeof value == 'number' && value == toInteger(value);
  11784. }
  11785. /**
  11786. * Checks if `value` is a valid array-like length.
  11787. *
  11788. * **Note:** This method is loosely based on
  11789. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  11790. *
  11791. * @static
  11792. * @memberOf _
  11793. * @since 4.0.0
  11794. * @category Lang
  11795. * @param {*} value The value to check.
  11796. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  11797. * @example
  11798. *
  11799. * _.isLength(3);
  11800. * // => true
  11801. *
  11802. * _.isLength(Number.MIN_VALUE);
  11803. * // => false
  11804. *
  11805. * _.isLength(Infinity);
  11806. * // => false
  11807. *
  11808. * _.isLength('3');
  11809. * // => false
  11810. */
  11811. function isLength(value) {
  11812. return typeof value == 'number' &&
  11813. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  11814. }
  11815. /**
  11816. * Checks if `value` is the
  11817. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  11818. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  11819. *
  11820. * @static
  11821. * @memberOf _
  11822. * @since 0.1.0
  11823. * @category Lang
  11824. * @param {*} value The value to check.
  11825. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  11826. * @example
  11827. *
  11828. * _.isObject({});
  11829. * // => true
  11830. *
  11831. * _.isObject([1, 2, 3]);
  11832. * // => true
  11833. *
  11834. * _.isObject(_.noop);
  11835. * // => true
  11836. *
  11837. * _.isObject(null);
  11838. * // => false
  11839. */
  11840. function isObject(value) {
  11841. var type = typeof value;
  11842. return value != null && (type == 'object' || type == 'function');
  11843. }
  11844. /**
  11845. * Checks if `value` is object-like. A value is object-like if it's not `null`
  11846. * and has a `typeof` result of "object".
  11847. *
  11848. * @static
  11849. * @memberOf _
  11850. * @since 4.0.0
  11851. * @category Lang
  11852. * @param {*} value The value to check.
  11853. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  11854. * @example
  11855. *
  11856. * _.isObjectLike({});
  11857. * // => true
  11858. *
  11859. * _.isObjectLike([1, 2, 3]);
  11860. * // => true
  11861. *
  11862. * _.isObjectLike(_.noop);
  11863. * // => false
  11864. *
  11865. * _.isObjectLike(null);
  11866. * // => false
  11867. */
  11868. function isObjectLike(value) {
  11869. return value != null && typeof value == 'object';
  11870. }
  11871. /**
  11872. * Checks if `value` is classified as a `Map` object.
  11873. *
  11874. * @static
  11875. * @memberOf _
  11876. * @since 4.3.0
  11877. * @category Lang
  11878. * @param {*} value The value to check.
  11879. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  11880. * @example
  11881. *
  11882. * _.isMap(new Map);
  11883. * // => true
  11884. *
  11885. * _.isMap(new WeakMap);
  11886. * // => false
  11887. */
  11888. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  11889. /**
  11890. * Performs a partial deep comparison between `object` and `source` to
  11891. * determine if `object` contains equivalent property values.
  11892. *
  11893. * **Note:** This method is equivalent to `_.matches` when `source` is
  11894. * partially applied.
  11895. *
  11896. * Partial comparisons will match empty array and empty object `source`
  11897. * values against any array or object value, respectively. See `_.isEqual`
  11898. * for a list of supported value comparisons.
  11899. *
  11900. * @static
  11901. * @memberOf _
  11902. * @since 3.0.0
  11903. * @category Lang
  11904. * @param {Object} object The object to inspect.
  11905. * @param {Object} source The object of property values to match.
  11906. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  11907. * @example
  11908. *
  11909. * var object = { 'a': 1, 'b': 2 };
  11910. *
  11911. * _.isMatch(object, { 'b': 2 });
  11912. * // => true
  11913. *
  11914. * _.isMatch(object, { 'b': 1 });
  11915. * // => false
  11916. */
  11917. function isMatch(object, source) {
  11918. return object === source || baseIsMatch(object, source, getMatchData(source));
  11919. }
  11920. /**
  11921. * This method is like `_.isMatch` except that it accepts `customizer` which
  11922. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  11923. * are handled by the method instead. The `customizer` is invoked with five
  11924. * arguments: (objValue, srcValue, index|key, object, source).
  11925. *
  11926. * @static
  11927. * @memberOf _
  11928. * @since 4.0.0
  11929. * @category Lang
  11930. * @param {Object} object The object to inspect.
  11931. * @param {Object} source The object of property values to match.
  11932. * @param {Function} [customizer] The function to customize comparisons.
  11933. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  11934. * @example
  11935. *
  11936. * function isGreeting(value) {
  11937. * return /^h(?:i|ello)$/.test(value);
  11938. * }
  11939. *
  11940. * function customizer(objValue, srcValue) {
  11941. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  11942. * return true;
  11943. * }
  11944. * }
  11945. *
  11946. * var object = { 'greeting': 'hello' };
  11947. * var source = { 'greeting': 'hi' };
  11948. *
  11949. * _.isMatchWith(object, source, customizer);
  11950. * // => true
  11951. */
  11952. function isMatchWith(object, source, customizer) {
  11953. customizer = typeof customizer == 'function' ? customizer : undefined;
  11954. return baseIsMatch(object, source, getMatchData(source), customizer);
  11955. }
  11956. /**
  11957. * Checks if `value` is `NaN`.
  11958. *
  11959. * **Note:** This method is based on
  11960. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  11961. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  11962. * `undefined` and other non-number values.
  11963. *
  11964. * @static
  11965. * @memberOf _
  11966. * @since 0.1.0
  11967. * @category Lang
  11968. * @param {*} value The value to check.
  11969. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  11970. * @example
  11971. *
  11972. * _.isNaN(NaN);
  11973. * // => true
  11974. *
  11975. * _.isNaN(new Number(NaN));
  11976. * // => true
  11977. *
  11978. * isNaN(undefined);
  11979. * // => true
  11980. *
  11981. * _.isNaN(undefined);
  11982. * // => false
  11983. */
  11984. function isNaN(value) {
  11985. // An `NaN` primitive is the only value that is not equal to itself.
  11986. // Perform the `toStringTag` check first to avoid errors with some
  11987. // ActiveX objects in IE.
  11988. return isNumber(value) && value != +value;
  11989. }
  11990. /**
  11991. * Checks if `value` is a pristine native function.
  11992. *
  11993. * **Note:** This method can't reliably detect native functions in the presence
  11994. * of the core-js package because core-js circumvents this kind of detection.
  11995. * Despite multiple requests, the core-js maintainer has made it clear: any
  11996. * attempt to fix the detection will be obstructed. As a result, we're left
  11997. * with little choice but to throw an error. Unfortunately, this also affects
  11998. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  11999. * which rely on core-js.
  12000. *
  12001. * @static
  12002. * @memberOf _
  12003. * @since 3.0.0
  12004. * @category Lang
  12005. * @param {*} value The value to check.
  12006. * @returns {boolean} Returns `true` if `value` is a native function,
  12007. * else `false`.
  12008. * @example
  12009. *
  12010. * _.isNative(Array.prototype.push);
  12011. * // => true
  12012. *
  12013. * _.isNative(_);
  12014. * // => false
  12015. */
  12016. function isNative(value) {
  12017. if (isMaskable(value)) {
  12018. throw new Error(CORE_ERROR_TEXT);
  12019. }
  12020. return baseIsNative(value);
  12021. }
  12022. /**
  12023. * Checks if `value` is `null`.
  12024. *
  12025. * @static
  12026. * @memberOf _
  12027. * @since 0.1.0
  12028. * @category Lang
  12029. * @param {*} value The value to check.
  12030. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  12031. * @example
  12032. *
  12033. * _.isNull(null);
  12034. * // => true
  12035. *
  12036. * _.isNull(void 0);
  12037. * // => false
  12038. */
  12039. function isNull(value) {
  12040. return value === null;
  12041. }
  12042. /**
  12043. * Checks if `value` is `null` or `undefined`.
  12044. *
  12045. * @static
  12046. * @memberOf _
  12047. * @since 4.0.0
  12048. * @category Lang
  12049. * @param {*} value The value to check.
  12050. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  12051. * @example
  12052. *
  12053. * _.isNil(null);
  12054. * // => true
  12055. *
  12056. * _.isNil(void 0);
  12057. * // => true
  12058. *
  12059. * _.isNil(NaN);
  12060. * // => false
  12061. */
  12062. function isNil(value) {
  12063. return value == null;
  12064. }
  12065. /**
  12066. * Checks if `value` is classified as a `Number` primitive or object.
  12067. *
  12068. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  12069. * classified as numbers, use the `_.isFinite` method.
  12070. *
  12071. * @static
  12072. * @memberOf _
  12073. * @since 0.1.0
  12074. * @category Lang
  12075. * @param {*} value The value to check.
  12076. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  12077. * @example
  12078. *
  12079. * _.isNumber(3);
  12080. * // => true
  12081. *
  12082. * _.isNumber(Number.MIN_VALUE);
  12083. * // => true
  12084. *
  12085. * _.isNumber(Infinity);
  12086. * // => true
  12087. *
  12088. * _.isNumber('3');
  12089. * // => false
  12090. */
  12091. function isNumber(value) {
  12092. return typeof value == 'number' ||
  12093. (isObjectLike(value) && baseGetTag(value) == numberTag);
  12094. }
  12095. /**
  12096. * Checks if `value` is a plain object, that is, an object created by the
  12097. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  12098. *
  12099. * @static
  12100. * @memberOf _
  12101. * @since 0.8.0
  12102. * @category Lang
  12103. * @param {*} value The value to check.
  12104. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  12105. * @example
  12106. *
  12107. * function Foo() {
  12108. * this.a = 1;
  12109. * }
  12110. *
  12111. * _.isPlainObject(new Foo);
  12112. * // => false
  12113. *
  12114. * _.isPlainObject([1, 2, 3]);
  12115. * // => false
  12116. *
  12117. * _.isPlainObject({ 'x': 0, 'y': 0 });
  12118. * // => true
  12119. *
  12120. * _.isPlainObject(Object.create(null));
  12121. * // => true
  12122. */
  12123. function isPlainObject(value) {
  12124. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  12125. return false;
  12126. }
  12127. var proto = getPrototype(value);
  12128. if (proto === null) {
  12129. return true;
  12130. }
  12131. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  12132. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  12133. funcToString.call(Ctor) == objectCtorString;
  12134. }
  12135. /**
  12136. * Checks if `value` is classified as a `RegExp` object.
  12137. *
  12138. * @static
  12139. * @memberOf _
  12140. * @since 0.1.0
  12141. * @category Lang
  12142. * @param {*} value The value to check.
  12143. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  12144. * @example
  12145. *
  12146. * _.isRegExp(/abc/);
  12147. * // => true
  12148. *
  12149. * _.isRegExp('/abc/');
  12150. * // => false
  12151. */
  12152. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  12153. /**
  12154. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  12155. * double precision number which isn't the result of a rounded unsafe integer.
  12156. *
  12157. * **Note:** This method is based on
  12158. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  12159. *
  12160. * @static
  12161. * @memberOf _
  12162. * @since 4.0.0
  12163. * @category Lang
  12164. * @param {*} value The value to check.
  12165. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  12166. * @example
  12167. *
  12168. * _.isSafeInteger(3);
  12169. * // => true
  12170. *
  12171. * _.isSafeInteger(Number.MIN_VALUE);
  12172. * // => false
  12173. *
  12174. * _.isSafeInteger(Infinity);
  12175. * // => false
  12176. *
  12177. * _.isSafeInteger('3');
  12178. * // => false
  12179. */
  12180. function isSafeInteger(value) {
  12181. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  12182. }
  12183. /**
  12184. * Checks if `value` is classified as a `Set` object.
  12185. *
  12186. * @static
  12187. * @memberOf _
  12188. * @since 4.3.0
  12189. * @category Lang
  12190. * @param {*} value The value to check.
  12191. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  12192. * @example
  12193. *
  12194. * _.isSet(new Set);
  12195. * // => true
  12196. *
  12197. * _.isSet(new WeakSet);
  12198. * // => false
  12199. */
  12200. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  12201. /**
  12202. * Checks if `value` is classified as a `String` primitive or object.
  12203. *
  12204. * @static
  12205. * @since 0.1.0
  12206. * @memberOf _
  12207. * @category Lang
  12208. * @param {*} value The value to check.
  12209. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  12210. * @example
  12211. *
  12212. * _.isString('abc');
  12213. * // => true
  12214. *
  12215. * _.isString(1);
  12216. * // => false
  12217. */
  12218. function isString(value) {
  12219. return typeof value == 'string' ||
  12220. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  12221. }
  12222. /**
  12223. * Checks if `value` is classified as a `Symbol` primitive or object.
  12224. *
  12225. * @static
  12226. * @memberOf _
  12227. * @since 4.0.0
  12228. * @category Lang
  12229. * @param {*} value The value to check.
  12230. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  12231. * @example
  12232. *
  12233. * _.isSymbol(Symbol.iterator);
  12234. * // => true
  12235. *
  12236. * _.isSymbol('abc');
  12237. * // => false
  12238. */
  12239. function isSymbol(value) {
  12240. return typeof value == 'symbol' ||
  12241. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  12242. }
  12243. /**
  12244. * Checks if `value` is classified as a typed array.
  12245. *
  12246. * @static
  12247. * @memberOf _
  12248. * @since 3.0.0
  12249. * @category Lang
  12250. * @param {*} value The value to check.
  12251. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  12252. * @example
  12253. *
  12254. * _.isTypedArray(new Uint8Array);
  12255. * // => true
  12256. *
  12257. * _.isTypedArray([]);
  12258. * // => false
  12259. */
  12260. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  12261. /**
  12262. * Checks if `value` is `undefined`.
  12263. *
  12264. * @static
  12265. * @since 0.1.0
  12266. * @memberOf _
  12267. * @category Lang
  12268. * @param {*} value The value to check.
  12269. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  12270. * @example
  12271. *
  12272. * _.isUndefined(void 0);
  12273. * // => true
  12274. *
  12275. * _.isUndefined(null);
  12276. * // => false
  12277. */
  12278. function isUndefined(value) {
  12279. return value === undefined;
  12280. }
  12281. /**
  12282. * Checks if `value` is classified as a `WeakMap` object.
  12283. *
  12284. * @static
  12285. * @memberOf _
  12286. * @since 4.3.0
  12287. * @category Lang
  12288. * @param {*} value The value to check.
  12289. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  12290. * @example
  12291. *
  12292. * _.isWeakMap(new WeakMap);
  12293. * // => true
  12294. *
  12295. * _.isWeakMap(new Map);
  12296. * // => false
  12297. */
  12298. function isWeakMap(value) {
  12299. return isObjectLike(value) && getTag(value) == weakMapTag;
  12300. }
  12301. /**
  12302. * Checks if `value` is classified as a `WeakSet` object.
  12303. *
  12304. * @static
  12305. * @memberOf _
  12306. * @since 4.3.0
  12307. * @category Lang
  12308. * @param {*} value The value to check.
  12309. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  12310. * @example
  12311. *
  12312. * _.isWeakSet(new WeakSet);
  12313. * // => true
  12314. *
  12315. * _.isWeakSet(new Set);
  12316. * // => false
  12317. */
  12318. function isWeakSet(value) {
  12319. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  12320. }
  12321. /**
  12322. * Checks if `value` is less than `other`.
  12323. *
  12324. * @static
  12325. * @memberOf _
  12326. * @since 3.9.0
  12327. * @category Lang
  12328. * @param {*} value The value to compare.
  12329. * @param {*} other The other value to compare.
  12330. * @returns {boolean} Returns `true` if `value` is less than `other`,
  12331. * else `false`.
  12332. * @see _.gt
  12333. * @example
  12334. *
  12335. * _.lt(1, 3);
  12336. * // => true
  12337. *
  12338. * _.lt(3, 3);
  12339. * // => false
  12340. *
  12341. * _.lt(3, 1);
  12342. * // => false
  12343. */
  12344. var lt = createRelationalOperation(baseLt);
  12345. /**
  12346. * Checks if `value` is less than or equal to `other`.
  12347. *
  12348. * @static
  12349. * @memberOf _
  12350. * @since 3.9.0
  12351. * @category Lang
  12352. * @param {*} value The value to compare.
  12353. * @param {*} other The other value to compare.
  12354. * @returns {boolean} Returns `true` if `value` is less than or equal to
  12355. * `other`, else `false`.
  12356. * @see _.gte
  12357. * @example
  12358. *
  12359. * _.lte(1, 3);
  12360. * // => true
  12361. *
  12362. * _.lte(3, 3);
  12363. * // => true
  12364. *
  12365. * _.lte(3, 1);
  12366. * // => false
  12367. */
  12368. var lte = createRelationalOperation(function(value, other) {
  12369. return value <= other;
  12370. });
  12371. /**
  12372. * Converts `value` to an array.
  12373. *
  12374. * @static
  12375. * @since 0.1.0
  12376. * @memberOf _
  12377. * @category Lang
  12378. * @param {*} value The value to convert.
  12379. * @returns {Array} Returns the converted array.
  12380. * @example
  12381. *
  12382. * _.toArray({ 'a': 1, 'b': 2 });
  12383. * // => [1, 2]
  12384. *
  12385. * _.toArray('abc');
  12386. * // => ['a', 'b', 'c']
  12387. *
  12388. * _.toArray(1);
  12389. * // => []
  12390. *
  12391. * _.toArray(null);
  12392. * // => []
  12393. */
  12394. function toArray(value) {
  12395. if (!value) {
  12396. return [];
  12397. }
  12398. if (isArrayLike(value)) {
  12399. return isString(value) ? stringToArray(value) : copyArray(value);
  12400. }
  12401. if (symIterator && value[symIterator]) {
  12402. return iteratorToArray(value[symIterator]());
  12403. }
  12404. var tag = getTag(value),
  12405. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  12406. return func(value);
  12407. }
  12408. /**
  12409. * Converts `value` to a finite number.
  12410. *
  12411. * @static
  12412. * @memberOf _
  12413. * @since 4.12.0
  12414. * @category Lang
  12415. * @param {*} value The value to convert.
  12416. * @returns {number} Returns the converted number.
  12417. * @example
  12418. *
  12419. * _.toFinite(3.2);
  12420. * // => 3.2
  12421. *
  12422. * _.toFinite(Number.MIN_VALUE);
  12423. * // => 5e-324
  12424. *
  12425. * _.toFinite(Infinity);
  12426. * // => 1.7976931348623157e+308
  12427. *
  12428. * _.toFinite('3.2');
  12429. * // => 3.2
  12430. */
  12431. function toFinite(value) {
  12432. if (!value) {
  12433. return value === 0 ? value : 0;
  12434. }
  12435. value = toNumber(value);
  12436. if (value === INFINITY || value === -INFINITY) {
  12437. var sign = (value < 0 ? -1 : 1);
  12438. return sign * MAX_INTEGER;
  12439. }
  12440. return value === value ? value : 0;
  12441. }
  12442. /**
  12443. * Converts `value` to an integer.
  12444. *
  12445. * **Note:** This method is loosely based on
  12446. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  12447. *
  12448. * @static
  12449. * @memberOf _
  12450. * @since 4.0.0
  12451. * @category Lang
  12452. * @param {*} value The value to convert.
  12453. * @returns {number} Returns the converted integer.
  12454. * @example
  12455. *
  12456. * _.toInteger(3.2);
  12457. * // => 3
  12458. *
  12459. * _.toInteger(Number.MIN_VALUE);
  12460. * // => 0
  12461. *
  12462. * _.toInteger(Infinity);
  12463. * // => 1.7976931348623157e+308
  12464. *
  12465. * _.toInteger('3.2');
  12466. * // => 3
  12467. */
  12468. function toInteger(value) {
  12469. var result = toFinite(value),
  12470. remainder = result % 1;
  12471. return result === result ? (remainder ? result - remainder : result) : 0;
  12472. }
  12473. /**
  12474. * Converts `value` to an integer suitable for use as the length of an
  12475. * array-like object.
  12476. *
  12477. * **Note:** This method is based on
  12478. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  12479. *
  12480. * @static
  12481. * @memberOf _
  12482. * @since 4.0.0
  12483. * @category Lang
  12484. * @param {*} value The value to convert.
  12485. * @returns {number} Returns the converted integer.
  12486. * @example
  12487. *
  12488. * _.toLength(3.2);
  12489. * // => 3
  12490. *
  12491. * _.toLength(Number.MIN_VALUE);
  12492. * // => 0
  12493. *
  12494. * _.toLength(Infinity);
  12495. * // => 4294967295
  12496. *
  12497. * _.toLength('3.2');
  12498. * // => 3
  12499. */
  12500. function toLength(value) {
  12501. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  12502. }
  12503. /**
  12504. * Converts `value` to a number.
  12505. *
  12506. * @static
  12507. * @memberOf _
  12508. * @since 4.0.0
  12509. * @category Lang
  12510. * @param {*} value The value to process.
  12511. * @returns {number} Returns the number.
  12512. * @example
  12513. *
  12514. * _.toNumber(3.2);
  12515. * // => 3.2
  12516. *
  12517. * _.toNumber(Number.MIN_VALUE);
  12518. * // => 5e-324
  12519. *
  12520. * _.toNumber(Infinity);
  12521. * // => Infinity
  12522. *
  12523. * _.toNumber('3.2');
  12524. * // => 3.2
  12525. */
  12526. function toNumber(value) {
  12527. if (typeof value == 'number') {
  12528. return value;
  12529. }
  12530. if (isSymbol(value)) {
  12531. return NAN;
  12532. }
  12533. if (isObject(value)) {
  12534. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  12535. value = isObject(other) ? (other + '') : other;
  12536. }
  12537. if (typeof value != 'string') {
  12538. return value === 0 ? value : +value;
  12539. }
  12540. value = value.replace(reTrim, '');
  12541. var isBinary = reIsBinary.test(value);
  12542. return (isBinary || reIsOctal.test(value))
  12543. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  12544. : (reIsBadHex.test(value) ? NAN : +value);
  12545. }
  12546. /**
  12547. * Converts `value` to a plain object flattening inherited enumerable string
  12548. * keyed properties of `value` to own properties of the plain object.
  12549. *
  12550. * @static
  12551. * @memberOf _
  12552. * @since 3.0.0
  12553. * @category Lang
  12554. * @param {*} value The value to convert.
  12555. * @returns {Object} Returns the converted plain object.
  12556. * @example
  12557. *
  12558. * function Foo() {
  12559. * this.b = 2;
  12560. * }
  12561. *
  12562. * Foo.prototype.c = 3;
  12563. *
  12564. * _.assign({ 'a': 1 }, new Foo);
  12565. * // => { 'a': 1, 'b': 2 }
  12566. *
  12567. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  12568. * // => { 'a': 1, 'b': 2, 'c': 3 }
  12569. */
  12570. function toPlainObject(value) {
  12571. return copyObject(value, keysIn(value));
  12572. }
  12573. /**
  12574. * Converts `value` to a safe integer. A safe integer can be compared and
  12575. * represented correctly.
  12576. *
  12577. * @static
  12578. * @memberOf _
  12579. * @since 4.0.0
  12580. * @category Lang
  12581. * @param {*} value The value to convert.
  12582. * @returns {number} Returns the converted integer.
  12583. * @example
  12584. *
  12585. * _.toSafeInteger(3.2);
  12586. * // => 3
  12587. *
  12588. * _.toSafeInteger(Number.MIN_VALUE);
  12589. * // => 0
  12590. *
  12591. * _.toSafeInteger(Infinity);
  12592. * // => 9007199254740991
  12593. *
  12594. * _.toSafeInteger('3.2');
  12595. * // => 3
  12596. */
  12597. function toSafeInteger(value) {
  12598. return value
  12599. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  12600. : (value === 0 ? value : 0);
  12601. }
  12602. /**
  12603. * Converts `value` to a string. An empty string is returned for `null`
  12604. * and `undefined` values. The sign of `-0` is preserved.
  12605. *
  12606. * @static
  12607. * @memberOf _
  12608. * @since 4.0.0
  12609. * @category Lang
  12610. * @param {*} value The value to convert.
  12611. * @returns {string} Returns the converted string.
  12612. * @example
  12613. *
  12614. * _.toString(null);
  12615. * // => ''
  12616. *
  12617. * _.toString(-0);
  12618. * // => '-0'
  12619. *
  12620. * _.toString([1, 2, 3]);
  12621. * // => '1,2,3'
  12622. */
  12623. function toString(value) {
  12624. return value == null ? '' : baseToString(value);
  12625. }
  12626. /*------------------------------------------------------------------------*/
  12627. /**
  12628. * Assigns own enumerable string keyed properties of source objects to the
  12629. * destination object. Source objects are applied from left to right.
  12630. * Subsequent sources overwrite property assignments of previous sources.
  12631. *
  12632. * **Note:** This method mutates `object` and is loosely based on
  12633. * [`Object.assign`](https://mdn.io/Object/assign).
  12634. *
  12635. * @static
  12636. * @memberOf _
  12637. * @since 0.10.0
  12638. * @category Object
  12639. * @param {Object} object The destination object.
  12640. * @param {...Object} [sources] The source objects.
  12641. * @returns {Object} Returns `object`.
  12642. * @see _.assignIn
  12643. * @example
  12644. *
  12645. * function Foo() {
  12646. * this.a = 1;
  12647. * }
  12648. *
  12649. * function Bar() {
  12650. * this.c = 3;
  12651. * }
  12652. *
  12653. * Foo.prototype.b = 2;
  12654. * Bar.prototype.d = 4;
  12655. *
  12656. * _.assign({ 'a': 0 }, new Foo, new Bar);
  12657. * // => { 'a': 1, 'c': 3 }
  12658. */
  12659. var assign = createAssigner(function(object, source) {
  12660. if (isPrototype(source) || isArrayLike(source)) {
  12661. copyObject(source, keys(source), object);
  12662. return;
  12663. }
  12664. for (var key in source) {
  12665. if (hasOwnProperty.call(source, key)) {
  12666. assignValue(object, key, source[key]);
  12667. }
  12668. }
  12669. });
  12670. /**
  12671. * This method is like `_.assign` except that it iterates over own and
  12672. * inherited source properties.
  12673. *
  12674. * **Note:** This method mutates `object`.
  12675. *
  12676. * @static
  12677. * @memberOf _
  12678. * @since 4.0.0
  12679. * @alias extend
  12680. * @category Object
  12681. * @param {Object} object The destination object.
  12682. * @param {...Object} [sources] The source objects.
  12683. * @returns {Object} Returns `object`.
  12684. * @see _.assign
  12685. * @example
  12686. *
  12687. * function Foo() {
  12688. * this.a = 1;
  12689. * }
  12690. *
  12691. * function Bar() {
  12692. * this.c = 3;
  12693. * }
  12694. *
  12695. * Foo.prototype.b = 2;
  12696. * Bar.prototype.d = 4;
  12697. *
  12698. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  12699. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  12700. */
  12701. var assignIn = createAssigner(function(object, source) {
  12702. copyObject(source, keysIn(source), object);
  12703. });
  12704. /**
  12705. * This method is like `_.assignIn` except that it accepts `customizer`
  12706. * which is invoked to produce the assigned values. If `customizer` returns
  12707. * `undefined`, assignment is handled by the method instead. The `customizer`
  12708. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  12709. *
  12710. * **Note:** This method mutates `object`.
  12711. *
  12712. * @static
  12713. * @memberOf _
  12714. * @since 4.0.0
  12715. * @alias extendWith
  12716. * @category Object
  12717. * @param {Object} object The destination object.
  12718. * @param {...Object} sources The source objects.
  12719. * @param {Function} [customizer] The function to customize assigned values.
  12720. * @returns {Object} Returns `object`.
  12721. * @see _.assignWith
  12722. * @example
  12723. *
  12724. * function customizer(objValue, srcValue) {
  12725. * return _.isUndefined(objValue) ? srcValue : objValue;
  12726. * }
  12727. *
  12728. * var defaults = _.partialRight(_.assignInWith, customizer);
  12729. *
  12730. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  12731. * // => { 'a': 1, 'b': 2 }
  12732. */
  12733. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  12734. copyObject(source, keysIn(source), object, customizer);
  12735. });
  12736. /**
  12737. * This method is like `_.assign` except that it accepts `customizer`
  12738. * which is invoked to produce the assigned values. If `customizer` returns
  12739. * `undefined`, assignment is handled by the method instead. The `customizer`
  12740. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  12741. *
  12742. * **Note:** This method mutates `object`.
  12743. *
  12744. * @static
  12745. * @memberOf _
  12746. * @since 4.0.0
  12747. * @category Object
  12748. * @param {Object} object The destination object.
  12749. * @param {...Object} sources The source objects.
  12750. * @param {Function} [customizer] The function to customize assigned values.
  12751. * @returns {Object} Returns `object`.
  12752. * @see _.assignInWith
  12753. * @example
  12754. *
  12755. * function customizer(objValue, srcValue) {
  12756. * return _.isUndefined(objValue) ? srcValue : objValue;
  12757. * }
  12758. *
  12759. * var defaults = _.partialRight(_.assignWith, customizer);
  12760. *
  12761. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  12762. * // => { 'a': 1, 'b': 2 }
  12763. */
  12764. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  12765. copyObject(source, keys(source), object, customizer);
  12766. });
  12767. /**
  12768. * Creates an array of values corresponding to `paths` of `object`.
  12769. *
  12770. * @static
  12771. * @memberOf _
  12772. * @since 1.0.0
  12773. * @category Object
  12774. * @param {Object} object The object to iterate over.
  12775. * @param {...(string|string[])} [paths] The property paths to pick.
  12776. * @returns {Array} Returns the picked values.
  12777. * @example
  12778. *
  12779. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  12780. *
  12781. * _.at(object, ['a[0].b.c', 'a[1]']);
  12782. * // => [3, 4]
  12783. */
  12784. var at = flatRest(baseAt);
  12785. /**
  12786. * Creates an object that inherits from the `prototype` object. If a
  12787. * `properties` object is given, its own enumerable string keyed properties
  12788. * are assigned to the created object.
  12789. *
  12790. * @static
  12791. * @memberOf _
  12792. * @since 2.3.0
  12793. * @category Object
  12794. * @param {Object} prototype The object to inherit from.
  12795. * @param {Object} [properties] The properties to assign to the object.
  12796. * @returns {Object} Returns the new object.
  12797. * @example
  12798. *
  12799. * function Shape() {
  12800. * this.x = 0;
  12801. * this.y = 0;
  12802. * }
  12803. *
  12804. * function Circle() {
  12805. * Shape.call(this);
  12806. * }
  12807. *
  12808. * Circle.prototype = _.create(Shape.prototype, {
  12809. * 'constructor': Circle
  12810. * });
  12811. *
  12812. * var circle = new Circle;
  12813. * circle instanceof Circle;
  12814. * // => true
  12815. *
  12816. * circle instanceof Shape;
  12817. * // => true
  12818. */
  12819. function create(prototype, properties) {
  12820. var result = baseCreate(prototype);
  12821. return properties == null ? result : baseAssign(result, properties);
  12822. }
  12823. /**
  12824. * Assigns own and inherited enumerable string keyed properties of source
  12825. * objects to the destination object for all destination properties that
  12826. * resolve to `undefined`. Source objects are applied from left to right.
  12827. * Once a property is set, additional values of the same property are ignored.
  12828. *
  12829. * **Note:** This method mutates `object`.
  12830. *
  12831. * @static
  12832. * @since 0.1.0
  12833. * @memberOf _
  12834. * @category Object
  12835. * @param {Object} object The destination object.
  12836. * @param {...Object} [sources] The source objects.
  12837. * @returns {Object} Returns `object`.
  12838. * @see _.defaultsDeep
  12839. * @example
  12840. *
  12841. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  12842. * // => { 'a': 1, 'b': 2 }
  12843. */
  12844. var defaults = baseRest(function(object, sources) {
  12845. object = Object(object);
  12846. var index = -1;
  12847. var length = sources.length;
  12848. var guard = length > 2 ? sources[2] : undefined;
  12849. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  12850. length = 1;
  12851. }
  12852. while (++index < length) {
  12853. var source = sources[index];
  12854. var props = keysIn(source);
  12855. var propsIndex = -1;
  12856. var propsLength = props.length;
  12857. while (++propsIndex < propsLength) {
  12858. var key = props[propsIndex];
  12859. var value = object[key];
  12860. if (value === undefined ||
  12861. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  12862. object[key] = source[key];
  12863. }
  12864. }
  12865. }
  12866. return object;
  12867. });
  12868. /**
  12869. * This method is like `_.defaults` except that it recursively assigns
  12870. * default properties.
  12871. *
  12872. * **Note:** This method mutates `object`.
  12873. *
  12874. * @static
  12875. * @memberOf _
  12876. * @since 3.10.0
  12877. * @category Object
  12878. * @param {Object} object The destination object.
  12879. * @param {...Object} [sources] The source objects.
  12880. * @returns {Object} Returns `object`.
  12881. * @see _.defaults
  12882. * @example
  12883. *
  12884. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  12885. * // => { 'a': { 'b': 2, 'c': 3 } }
  12886. */
  12887. var defaultsDeep = baseRest(function(args) {
  12888. args.push(undefined, customDefaultsMerge);
  12889. return apply(mergeWith, undefined, args);
  12890. });
  12891. /**
  12892. * This method is like `_.find` except that it returns the key of the first
  12893. * element `predicate` returns truthy for instead of the element itself.
  12894. *
  12895. * @static
  12896. * @memberOf _
  12897. * @since 1.1.0
  12898. * @category Object
  12899. * @param {Object} object The object to inspect.
  12900. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  12901. * @returns {string|undefined} Returns the key of the matched element,
  12902. * else `undefined`.
  12903. * @example
  12904. *
  12905. * var users = {
  12906. * 'barney': { 'age': 36, 'active': true },
  12907. * 'fred': { 'age': 40, 'active': false },
  12908. * 'pebbles': { 'age': 1, 'active': true }
  12909. * };
  12910. *
  12911. * _.findKey(users, function(o) { return o.age < 40; });
  12912. * // => 'barney' (iteration order is not guaranteed)
  12913. *
  12914. * // The `_.matches` iteratee shorthand.
  12915. * _.findKey(users, { 'age': 1, 'active': true });
  12916. * // => 'pebbles'
  12917. *
  12918. * // The `_.matchesProperty` iteratee shorthand.
  12919. * _.findKey(users, ['active', false]);
  12920. * // => 'fred'
  12921. *
  12922. * // The `_.property` iteratee shorthand.
  12923. * _.findKey(users, 'active');
  12924. * // => 'barney'
  12925. */
  12926. function findKey(object, predicate) {
  12927. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  12928. }
  12929. /**
  12930. * This method is like `_.findKey` except that it iterates over elements of
  12931. * a collection in the opposite order.
  12932. *
  12933. * @static
  12934. * @memberOf _
  12935. * @since 2.0.0
  12936. * @category Object
  12937. * @param {Object} object The object to inspect.
  12938. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  12939. * @returns {string|undefined} Returns the key of the matched element,
  12940. * else `undefined`.
  12941. * @example
  12942. *
  12943. * var users = {
  12944. * 'barney': { 'age': 36, 'active': true },
  12945. * 'fred': { 'age': 40, 'active': false },
  12946. * 'pebbles': { 'age': 1, 'active': true }
  12947. * };
  12948. *
  12949. * _.findLastKey(users, function(o) { return o.age < 40; });
  12950. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  12951. *
  12952. * // The `_.matches` iteratee shorthand.
  12953. * _.findLastKey(users, { 'age': 36, 'active': true });
  12954. * // => 'barney'
  12955. *
  12956. * // The `_.matchesProperty` iteratee shorthand.
  12957. * _.findLastKey(users, ['active', false]);
  12958. * // => 'fred'
  12959. *
  12960. * // The `_.property` iteratee shorthand.
  12961. * _.findLastKey(users, 'active');
  12962. * // => 'pebbles'
  12963. */
  12964. function findLastKey(object, predicate) {
  12965. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  12966. }
  12967. /**
  12968. * Iterates over own and inherited enumerable string keyed properties of an
  12969. * object and invokes `iteratee` for each property. The iteratee is invoked
  12970. * with three arguments: (value, key, object). Iteratee functions may exit
  12971. * iteration early by explicitly returning `false`.
  12972. *
  12973. * @static
  12974. * @memberOf _
  12975. * @since 0.3.0
  12976. * @category Object
  12977. * @param {Object} object The object to iterate over.
  12978. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  12979. * @returns {Object} Returns `object`.
  12980. * @see _.forInRight
  12981. * @example
  12982. *
  12983. * function Foo() {
  12984. * this.a = 1;
  12985. * this.b = 2;
  12986. * }
  12987. *
  12988. * Foo.prototype.c = 3;
  12989. *
  12990. * _.forIn(new Foo, function(value, key) {
  12991. * console.log(key);
  12992. * });
  12993. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  12994. */
  12995. function forIn(object, iteratee) {
  12996. return object == null
  12997. ? object
  12998. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  12999. }
  13000. /**
  13001. * This method is like `_.forIn` except that it iterates over properties of
  13002. * `object` in the opposite order.
  13003. *
  13004. * @static
  13005. * @memberOf _
  13006. * @since 2.0.0
  13007. * @category Object
  13008. * @param {Object} object The object to iterate over.
  13009. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13010. * @returns {Object} Returns `object`.
  13011. * @see _.forIn
  13012. * @example
  13013. *
  13014. * function Foo() {
  13015. * this.a = 1;
  13016. * this.b = 2;
  13017. * }
  13018. *
  13019. * Foo.prototype.c = 3;
  13020. *
  13021. * _.forInRight(new Foo, function(value, key) {
  13022. * console.log(key);
  13023. * });
  13024. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  13025. */
  13026. function forInRight(object, iteratee) {
  13027. return object == null
  13028. ? object
  13029. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  13030. }
  13031. /**
  13032. * Iterates over own enumerable string keyed properties of an object and
  13033. * invokes `iteratee` for each property. The iteratee is invoked with three
  13034. * arguments: (value, key, object). Iteratee functions may exit iteration
  13035. * early by explicitly returning `false`.
  13036. *
  13037. * @static
  13038. * @memberOf _
  13039. * @since 0.3.0
  13040. * @category Object
  13041. * @param {Object} object The object to iterate over.
  13042. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13043. * @returns {Object} Returns `object`.
  13044. * @see _.forOwnRight
  13045. * @example
  13046. *
  13047. * function Foo() {
  13048. * this.a = 1;
  13049. * this.b = 2;
  13050. * }
  13051. *
  13052. * Foo.prototype.c = 3;
  13053. *
  13054. * _.forOwn(new Foo, function(value, key) {
  13055. * console.log(key);
  13056. * });
  13057. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  13058. */
  13059. function forOwn(object, iteratee) {
  13060. return object && baseForOwn(object, getIteratee(iteratee, 3));
  13061. }
  13062. /**
  13063. * This method is like `_.forOwn` except that it iterates over properties of
  13064. * `object` in the opposite order.
  13065. *
  13066. * @static
  13067. * @memberOf _
  13068. * @since 2.0.0
  13069. * @category Object
  13070. * @param {Object} object The object to iterate over.
  13071. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13072. * @returns {Object} Returns `object`.
  13073. * @see _.forOwn
  13074. * @example
  13075. *
  13076. * function Foo() {
  13077. * this.a = 1;
  13078. * this.b = 2;
  13079. * }
  13080. *
  13081. * Foo.prototype.c = 3;
  13082. *
  13083. * _.forOwnRight(new Foo, function(value, key) {
  13084. * console.log(key);
  13085. * });
  13086. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  13087. */
  13088. function forOwnRight(object, iteratee) {
  13089. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  13090. }
  13091. /**
  13092. * Creates an array of function property names from own enumerable properties
  13093. * of `object`.
  13094. *
  13095. * @static
  13096. * @since 0.1.0
  13097. * @memberOf _
  13098. * @category Object
  13099. * @param {Object} object The object to inspect.
  13100. * @returns {Array} Returns the function names.
  13101. * @see _.functionsIn
  13102. * @example
  13103. *
  13104. * function Foo() {
  13105. * this.a = _.constant('a');
  13106. * this.b = _.constant('b');
  13107. * }
  13108. *
  13109. * Foo.prototype.c = _.constant('c');
  13110. *
  13111. * _.functions(new Foo);
  13112. * // => ['a', 'b']
  13113. */
  13114. function functions(object) {
  13115. return object == null ? [] : baseFunctions(object, keys(object));
  13116. }
  13117. /**
  13118. * Creates an array of function property names from own and inherited
  13119. * enumerable properties of `object`.
  13120. *
  13121. * @static
  13122. * @memberOf _
  13123. * @since 4.0.0
  13124. * @category Object
  13125. * @param {Object} object The object to inspect.
  13126. * @returns {Array} Returns the function names.
  13127. * @see _.functions
  13128. * @example
  13129. *
  13130. * function Foo() {
  13131. * this.a = _.constant('a');
  13132. * this.b = _.constant('b');
  13133. * }
  13134. *
  13135. * Foo.prototype.c = _.constant('c');
  13136. *
  13137. * _.functionsIn(new Foo);
  13138. * // => ['a', 'b', 'c']
  13139. */
  13140. function functionsIn(object) {
  13141. return object == null ? [] : baseFunctions(object, keysIn(object));
  13142. }
  13143. /**
  13144. * Gets the value at `path` of `object`. If the resolved value is
  13145. * `undefined`, the `defaultValue` is returned in its place.
  13146. *
  13147. * @static
  13148. * @memberOf _
  13149. * @since 3.7.0
  13150. * @category Object
  13151. * @param {Object} object The object to query.
  13152. * @param {Array|string} path The path of the property to get.
  13153. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  13154. * @returns {*} Returns the resolved value.
  13155. * @example
  13156. *
  13157. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  13158. *
  13159. * _.get(object, 'a[0].b.c');
  13160. * // => 3
  13161. *
  13162. * _.get(object, ['a', '0', 'b', 'c']);
  13163. * // => 3
  13164. *
  13165. * _.get(object, 'a.b.c', 'default');
  13166. * // => 'default'
  13167. */
  13168. function get(object, path, defaultValue) {
  13169. var result = object == null ? undefined : baseGet(object, path);
  13170. return result === undefined ? defaultValue : result;
  13171. }
  13172. /**
  13173. * Checks if `path` is a direct property of `object`.
  13174. *
  13175. * @static
  13176. * @since 0.1.0
  13177. * @memberOf _
  13178. * @category Object
  13179. * @param {Object} object The object to query.
  13180. * @param {Array|string} path The path to check.
  13181. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  13182. * @example
  13183. *
  13184. * var object = { 'a': { 'b': 2 } };
  13185. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  13186. *
  13187. * _.has(object, 'a');
  13188. * // => true
  13189. *
  13190. * _.has(object, 'a.b');
  13191. * // => true
  13192. *
  13193. * _.has(object, ['a', 'b']);
  13194. * // => true
  13195. *
  13196. * _.has(other, 'a');
  13197. * // => false
  13198. */
  13199. function has(object, path) {
  13200. return object != null && hasPath(object, path, baseHas);
  13201. }
  13202. /**
  13203. * Checks if `path` is a direct or inherited property of `object`.
  13204. *
  13205. * @static
  13206. * @memberOf _
  13207. * @since 4.0.0
  13208. * @category Object
  13209. * @param {Object} object The object to query.
  13210. * @param {Array|string} path The path to check.
  13211. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  13212. * @example
  13213. *
  13214. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  13215. *
  13216. * _.hasIn(object, 'a');
  13217. * // => true
  13218. *
  13219. * _.hasIn(object, 'a.b');
  13220. * // => true
  13221. *
  13222. * _.hasIn(object, ['a', 'b']);
  13223. * // => true
  13224. *
  13225. * _.hasIn(object, 'b');
  13226. * // => false
  13227. */
  13228. function hasIn(object, path) {
  13229. return object != null && hasPath(object, path, baseHasIn);
  13230. }
  13231. /**
  13232. * Creates an object composed of the inverted keys and values of `object`.
  13233. * If `object` contains duplicate values, subsequent values overwrite
  13234. * property assignments of previous values.
  13235. *
  13236. * @static
  13237. * @memberOf _
  13238. * @since 0.7.0
  13239. * @category Object
  13240. * @param {Object} object The object to invert.
  13241. * @returns {Object} Returns the new inverted object.
  13242. * @example
  13243. *
  13244. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  13245. *
  13246. * _.invert(object);
  13247. * // => { '1': 'c', '2': 'b' }
  13248. */
  13249. var invert = createInverter(function(result, value, key) {
  13250. if (value != null &&
  13251. typeof value.toString != 'function') {
  13252. value = nativeObjectToString.call(value);
  13253. }
  13254. result[value] = key;
  13255. }, constant(identity));
  13256. /**
  13257. * This method is like `_.invert` except that the inverted object is generated
  13258. * from the results of running each element of `object` thru `iteratee`. The
  13259. * corresponding inverted value of each inverted key is an array of keys
  13260. * responsible for generating the inverted value. The iteratee is invoked
  13261. * with one argument: (value).
  13262. *
  13263. * @static
  13264. * @memberOf _
  13265. * @since 4.1.0
  13266. * @category Object
  13267. * @param {Object} object The object to invert.
  13268. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  13269. * @returns {Object} Returns the new inverted object.
  13270. * @example
  13271. *
  13272. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  13273. *
  13274. * _.invertBy(object);
  13275. * // => { '1': ['a', 'c'], '2': ['b'] }
  13276. *
  13277. * _.invertBy(object, function(value) {
  13278. * return 'group' + value;
  13279. * });
  13280. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  13281. */
  13282. var invertBy = createInverter(function(result, value, key) {
  13283. if (value != null &&
  13284. typeof value.toString != 'function') {
  13285. value = nativeObjectToString.call(value);
  13286. }
  13287. if (hasOwnProperty.call(result, value)) {
  13288. result[value].push(key);
  13289. } else {
  13290. result[value] = [key];
  13291. }
  13292. }, getIteratee);
  13293. /**
  13294. * Invokes the method at `path` of `object`.
  13295. *
  13296. * @static
  13297. * @memberOf _
  13298. * @since 4.0.0
  13299. * @category Object
  13300. * @param {Object} object The object to query.
  13301. * @param {Array|string} path The path of the method to invoke.
  13302. * @param {...*} [args] The arguments to invoke the method with.
  13303. * @returns {*} Returns the result of the invoked method.
  13304. * @example
  13305. *
  13306. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  13307. *
  13308. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  13309. * // => [2, 3]
  13310. */
  13311. var invoke = baseRest(baseInvoke);
  13312. /**
  13313. * Creates an array of the own enumerable property names of `object`.
  13314. *
  13315. * **Note:** Non-object values are coerced to objects. See the
  13316. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  13317. * for more details.
  13318. *
  13319. * @static
  13320. * @since 0.1.0
  13321. * @memberOf _
  13322. * @category Object
  13323. * @param {Object} object The object to query.
  13324. * @returns {Array} Returns the array of property names.
  13325. * @example
  13326. *
  13327. * function Foo() {
  13328. * this.a = 1;
  13329. * this.b = 2;
  13330. * }
  13331. *
  13332. * Foo.prototype.c = 3;
  13333. *
  13334. * _.keys(new Foo);
  13335. * // => ['a', 'b'] (iteration order is not guaranteed)
  13336. *
  13337. * _.keys('hi');
  13338. * // => ['0', '1']
  13339. */
  13340. function keys(object) {
  13341. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  13342. }
  13343. /**
  13344. * Creates an array of the own and inherited enumerable property names of `object`.
  13345. *
  13346. * **Note:** Non-object values are coerced to objects.
  13347. *
  13348. * @static
  13349. * @memberOf _
  13350. * @since 3.0.0
  13351. * @category Object
  13352. * @param {Object} object The object to query.
  13353. * @returns {Array} Returns the array of property names.
  13354. * @example
  13355. *
  13356. * function Foo() {
  13357. * this.a = 1;
  13358. * this.b = 2;
  13359. * }
  13360. *
  13361. * Foo.prototype.c = 3;
  13362. *
  13363. * _.keysIn(new Foo);
  13364. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  13365. */
  13366. function keysIn(object) {
  13367. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  13368. }
  13369. /**
  13370. * The opposite of `_.mapValues`; this method creates an object with the
  13371. * same values as `object` and keys generated by running each own enumerable
  13372. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  13373. * with three arguments: (value, key, object).
  13374. *
  13375. * @static
  13376. * @memberOf _
  13377. * @since 3.8.0
  13378. * @category Object
  13379. * @param {Object} object The object to iterate over.
  13380. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13381. * @returns {Object} Returns the new mapped object.
  13382. * @see _.mapValues
  13383. * @example
  13384. *
  13385. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  13386. * return key + value;
  13387. * });
  13388. * // => { 'a1': 1, 'b2': 2 }
  13389. */
  13390. function mapKeys(object, iteratee) {
  13391. var result = {};
  13392. iteratee = getIteratee(iteratee, 3);
  13393. baseForOwn(object, function(value, key, object) {
  13394. baseAssignValue(result, iteratee(value, key, object), value);
  13395. });
  13396. return result;
  13397. }
  13398. /**
  13399. * Creates an object with the same keys as `object` and values generated
  13400. * by running each own enumerable string keyed property of `object` thru
  13401. * `iteratee`. The iteratee is invoked with three arguments:
  13402. * (value, key, object).
  13403. *
  13404. * @static
  13405. * @memberOf _
  13406. * @since 2.4.0
  13407. * @category Object
  13408. * @param {Object} object The object to iterate over.
  13409. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13410. * @returns {Object} Returns the new mapped object.
  13411. * @see _.mapKeys
  13412. * @example
  13413. *
  13414. * var users = {
  13415. * 'fred': { 'user': 'fred', 'age': 40 },
  13416. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  13417. * };
  13418. *
  13419. * _.mapValues(users, function(o) { return o.age; });
  13420. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  13421. *
  13422. * // The `_.property` iteratee shorthand.
  13423. * _.mapValues(users, 'age');
  13424. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  13425. */
  13426. function mapValues(object, iteratee) {
  13427. var result = {};
  13428. iteratee = getIteratee(iteratee, 3);
  13429. baseForOwn(object, function(value, key, object) {
  13430. baseAssignValue(result, key, iteratee(value, key, object));
  13431. });
  13432. return result;
  13433. }
  13434. /**
  13435. * This method is like `_.assign` except that it recursively merges own and
  13436. * inherited enumerable string keyed properties of source objects into the
  13437. * destination object. Source properties that resolve to `undefined` are
  13438. * skipped if a destination value exists. Array and plain object properties
  13439. * are merged recursively. Other objects and value types are overridden by
  13440. * assignment. Source objects are applied from left to right. Subsequent
  13441. * sources overwrite property assignments of previous sources.
  13442. *
  13443. * **Note:** This method mutates `object`.
  13444. *
  13445. * @static
  13446. * @memberOf _
  13447. * @since 0.5.0
  13448. * @category Object
  13449. * @param {Object} object The destination object.
  13450. * @param {...Object} [sources] The source objects.
  13451. * @returns {Object} Returns `object`.
  13452. * @example
  13453. *
  13454. * var object = {
  13455. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  13456. * };
  13457. *
  13458. * var other = {
  13459. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  13460. * };
  13461. *
  13462. * _.merge(object, other);
  13463. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  13464. */
  13465. var merge = createAssigner(function(object, source, srcIndex) {
  13466. baseMerge(object, source, srcIndex);
  13467. });
  13468. /**
  13469. * This method is like `_.merge` except that it accepts `customizer` which
  13470. * is invoked to produce the merged values of the destination and source
  13471. * properties. If `customizer` returns `undefined`, merging is handled by the
  13472. * method instead. The `customizer` is invoked with six arguments:
  13473. * (objValue, srcValue, key, object, source, stack).
  13474. *
  13475. * **Note:** This method mutates `object`.
  13476. *
  13477. * @static
  13478. * @memberOf _
  13479. * @since 4.0.0
  13480. * @category Object
  13481. * @param {Object} object The destination object.
  13482. * @param {...Object} sources The source objects.
  13483. * @param {Function} customizer The function to customize assigned values.
  13484. * @returns {Object} Returns `object`.
  13485. * @example
  13486. *
  13487. * function customizer(objValue, srcValue) {
  13488. * if (_.isArray(objValue)) {
  13489. * return objValue.concat(srcValue);
  13490. * }
  13491. * }
  13492. *
  13493. * var object = { 'a': [1], 'b': [2] };
  13494. * var other = { 'a': [3], 'b': [4] };
  13495. *
  13496. * _.mergeWith(object, other, customizer);
  13497. * // => { 'a': [1, 3], 'b': [2, 4] }
  13498. */
  13499. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  13500. baseMerge(object, source, srcIndex, customizer);
  13501. });
  13502. /**
  13503. * The opposite of `_.pick`; this method creates an object composed of the
  13504. * own and inherited enumerable property paths of `object` that are not omitted.
  13505. *
  13506. * **Note:** This method is considerably slower than `_.pick`.
  13507. *
  13508. * @static
  13509. * @since 0.1.0
  13510. * @memberOf _
  13511. * @category Object
  13512. * @param {Object} object The source object.
  13513. * @param {...(string|string[])} [paths] The property paths to omit.
  13514. * @returns {Object} Returns the new object.
  13515. * @example
  13516. *
  13517. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  13518. *
  13519. * _.omit(object, ['a', 'c']);
  13520. * // => { 'b': '2' }
  13521. */
  13522. var omit = flatRest(function(object, paths) {
  13523. var result = {};
  13524. if (object == null) {
  13525. return result;
  13526. }
  13527. var isDeep = false;
  13528. paths = arrayMap(paths, function(path) {
  13529. path = castPath(path, object);
  13530. isDeep || (isDeep = path.length > 1);
  13531. return path;
  13532. });
  13533. copyObject(object, getAllKeysIn(object), result);
  13534. if (isDeep) {
  13535. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  13536. }
  13537. var length = paths.length;
  13538. while (length--) {
  13539. baseUnset(result, paths[length]);
  13540. }
  13541. return result;
  13542. });
  13543. /**
  13544. * The opposite of `_.pickBy`; this method creates an object composed of
  13545. * the own and inherited enumerable string keyed properties of `object` that
  13546. * `predicate` doesn't return truthy for. The predicate is invoked with two
  13547. * arguments: (value, key).
  13548. *
  13549. * @static
  13550. * @memberOf _
  13551. * @since 4.0.0
  13552. * @category Object
  13553. * @param {Object} object The source object.
  13554. * @param {Function} [predicate=_.identity] The function invoked per property.
  13555. * @returns {Object} Returns the new object.
  13556. * @example
  13557. *
  13558. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  13559. *
  13560. * _.omitBy(object, _.isNumber);
  13561. * // => { 'b': '2' }
  13562. */
  13563. function omitBy(object, predicate) {
  13564. return pickBy(object, negate(getIteratee(predicate)));
  13565. }
  13566. /**
  13567. * Creates an object composed of the picked `object` properties.
  13568. *
  13569. * @static
  13570. * @since 0.1.0
  13571. * @memberOf _
  13572. * @category Object
  13573. * @param {Object} object The source object.
  13574. * @param {...(string|string[])} [paths] The property paths to pick.
  13575. * @returns {Object} Returns the new object.
  13576. * @example
  13577. *
  13578. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  13579. *
  13580. * _.pick(object, ['a', 'c']);
  13581. * // => { 'a': 1, 'c': 3 }
  13582. */
  13583. var pick = flatRest(function(object, paths) {
  13584. return object == null ? {} : basePick(object, paths);
  13585. });
  13586. /**
  13587. * Creates an object composed of the `object` properties `predicate` returns
  13588. * truthy for. The predicate is invoked with two arguments: (value, key).
  13589. *
  13590. * @static
  13591. * @memberOf _
  13592. * @since 4.0.0
  13593. * @category Object
  13594. * @param {Object} object The source object.
  13595. * @param {Function} [predicate=_.identity] The function invoked per property.
  13596. * @returns {Object} Returns the new object.
  13597. * @example
  13598. *
  13599. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  13600. *
  13601. * _.pickBy(object, _.isNumber);
  13602. * // => { 'a': 1, 'c': 3 }
  13603. */
  13604. function pickBy(object, predicate) {
  13605. if (object == null) {
  13606. return {};
  13607. }
  13608. var props = arrayMap(getAllKeysIn(object), function(prop) {
  13609. return [prop];
  13610. });
  13611. predicate = getIteratee(predicate);
  13612. return basePickBy(object, props, function(value, path) {
  13613. return predicate(value, path[0]);
  13614. });
  13615. }
  13616. /**
  13617. * This method is like `_.get` except that if the resolved value is a
  13618. * function it's invoked with the `this` binding of its parent object and
  13619. * its result is returned.
  13620. *
  13621. * @static
  13622. * @since 0.1.0
  13623. * @memberOf _
  13624. * @category Object
  13625. * @param {Object} object The object to query.
  13626. * @param {Array|string} path The path of the property to resolve.
  13627. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  13628. * @returns {*} Returns the resolved value.
  13629. * @example
  13630. *
  13631. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  13632. *
  13633. * _.result(object, 'a[0].b.c1');
  13634. * // => 3
  13635. *
  13636. * _.result(object, 'a[0].b.c2');
  13637. * // => 4
  13638. *
  13639. * _.result(object, 'a[0].b.c3', 'default');
  13640. * // => 'default'
  13641. *
  13642. * _.result(object, 'a[0].b.c3', _.constant('default'));
  13643. * // => 'default'
  13644. */
  13645. function result(object, path, defaultValue) {
  13646. path = castPath(path, object);
  13647. var index = -1,
  13648. length = path.length;
  13649. // Ensure the loop is entered when path is empty.
  13650. if (!length) {
  13651. length = 1;
  13652. object = undefined;
  13653. }
  13654. while (++index < length) {
  13655. var value = object == null ? undefined : object[toKey(path[index])];
  13656. if (value === undefined) {
  13657. index = length;
  13658. value = defaultValue;
  13659. }
  13660. object = isFunction(value) ? value.call(object) : value;
  13661. }
  13662. return object;
  13663. }
  13664. /**
  13665. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  13666. * it's created. Arrays are created for missing index properties while objects
  13667. * are created for all other missing properties. Use `_.setWith` to customize
  13668. * `path` creation.
  13669. *
  13670. * **Note:** This method mutates `object`.
  13671. *
  13672. * @static
  13673. * @memberOf _
  13674. * @since 3.7.0
  13675. * @category Object
  13676. * @param {Object} object The object to modify.
  13677. * @param {Array|string} path The path of the property to set.
  13678. * @param {*} value The value to set.
  13679. * @returns {Object} Returns `object`.
  13680. * @example
  13681. *
  13682. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  13683. *
  13684. * _.set(object, 'a[0].b.c', 4);
  13685. * console.log(object.a[0].b.c);
  13686. * // => 4
  13687. *
  13688. * _.set(object, ['x', '0', 'y', 'z'], 5);
  13689. * console.log(object.x[0].y.z);
  13690. * // => 5
  13691. */
  13692. function set(object, path, value) {
  13693. return object == null ? object : baseSet(object, path, value);
  13694. }
  13695. /**
  13696. * This method is like `_.set` except that it accepts `customizer` which is
  13697. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  13698. * path creation is handled by the method instead. The `customizer` is invoked
  13699. * with three arguments: (nsValue, key, nsObject).
  13700. *
  13701. * **Note:** This method mutates `object`.
  13702. *
  13703. * @static
  13704. * @memberOf _
  13705. * @since 4.0.0
  13706. * @category Object
  13707. * @param {Object} object The object to modify.
  13708. * @param {Array|string} path The path of the property to set.
  13709. * @param {*} value The value to set.
  13710. * @param {Function} [customizer] The function to customize assigned values.
  13711. * @returns {Object} Returns `object`.
  13712. * @example
  13713. *
  13714. * var object = {};
  13715. *
  13716. * _.setWith(object, '[0][1]', 'a', Object);
  13717. * // => { '0': { '1': 'a' } }
  13718. */
  13719. function setWith(object, path, value, customizer) {
  13720. customizer = typeof customizer == 'function' ? customizer : undefined;
  13721. return object == null ? object : baseSet(object, path, value, customizer);
  13722. }
  13723. /**
  13724. * Creates an array of own enumerable string keyed-value pairs for `object`
  13725. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  13726. * entries are returned.
  13727. *
  13728. * @static
  13729. * @memberOf _
  13730. * @since 4.0.0
  13731. * @alias entries
  13732. * @category Object
  13733. * @param {Object} object The object to query.
  13734. * @returns {Array} Returns the key-value pairs.
  13735. * @example
  13736. *
  13737. * function Foo() {
  13738. * this.a = 1;
  13739. * this.b = 2;
  13740. * }
  13741. *
  13742. * Foo.prototype.c = 3;
  13743. *
  13744. * _.toPairs(new Foo);
  13745. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  13746. */
  13747. var toPairs = createToPairs(keys);
  13748. /**
  13749. * Creates an array of own and inherited enumerable string keyed-value pairs
  13750. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  13751. * or set, its entries are returned.
  13752. *
  13753. * @static
  13754. * @memberOf _
  13755. * @since 4.0.0
  13756. * @alias entriesIn
  13757. * @category Object
  13758. * @param {Object} object The object to query.
  13759. * @returns {Array} Returns the key-value pairs.
  13760. * @example
  13761. *
  13762. * function Foo() {
  13763. * this.a = 1;
  13764. * this.b = 2;
  13765. * }
  13766. *
  13767. * Foo.prototype.c = 3;
  13768. *
  13769. * _.toPairsIn(new Foo);
  13770. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  13771. */
  13772. var toPairsIn = createToPairs(keysIn);
  13773. /**
  13774. * An alternative to `_.reduce`; this method transforms `object` to a new
  13775. * `accumulator` object which is the result of running each of its own
  13776. * enumerable string keyed properties thru `iteratee`, with each invocation
  13777. * potentially mutating the `accumulator` object. If `accumulator` is not
  13778. * provided, a new object with the same `[[Prototype]]` will be used. The
  13779. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  13780. * Iteratee functions may exit iteration early by explicitly returning `false`.
  13781. *
  13782. * @static
  13783. * @memberOf _
  13784. * @since 1.3.0
  13785. * @category Object
  13786. * @param {Object} object The object to iterate over.
  13787. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13788. * @param {*} [accumulator] The custom accumulator value.
  13789. * @returns {*} Returns the accumulated value.
  13790. * @example
  13791. *
  13792. * _.transform([2, 3, 4], function(result, n) {
  13793. * result.push(n *= n);
  13794. * return n % 2 == 0;
  13795. * }, []);
  13796. * // => [4, 9]
  13797. *
  13798. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  13799. * (result[value] || (result[value] = [])).push(key);
  13800. * }, {});
  13801. * // => { '1': ['a', 'c'], '2': ['b'] }
  13802. */
  13803. function transform(object, iteratee, accumulator) {
  13804. var isArr = isArray(object),
  13805. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  13806. iteratee = getIteratee(iteratee, 4);
  13807. if (accumulator == null) {
  13808. var Ctor = object && object.constructor;
  13809. if (isArrLike) {
  13810. accumulator = isArr ? new Ctor : [];
  13811. }
  13812. else if (isObject(object)) {
  13813. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  13814. }
  13815. else {
  13816. accumulator = {};
  13817. }
  13818. }
  13819. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  13820. return iteratee(accumulator, value, index, object);
  13821. });
  13822. return accumulator;
  13823. }
  13824. /**
  13825. * Removes the property at `path` of `object`.
  13826. *
  13827. * **Note:** This method mutates `object`.
  13828. *
  13829. * @static
  13830. * @memberOf _
  13831. * @since 4.0.0
  13832. * @category Object
  13833. * @param {Object} object The object to modify.
  13834. * @param {Array|string} path The path of the property to unset.
  13835. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  13836. * @example
  13837. *
  13838. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  13839. * _.unset(object, 'a[0].b.c');
  13840. * // => true
  13841. *
  13842. * console.log(object);
  13843. * // => { 'a': [{ 'b': {} }] };
  13844. *
  13845. * _.unset(object, ['a', '0', 'b', 'c']);
  13846. * // => true
  13847. *
  13848. * console.log(object);
  13849. * // => { 'a': [{ 'b': {} }] };
  13850. */
  13851. function unset(object, path) {
  13852. return object == null ? true : baseUnset(object, path);
  13853. }
  13854. /**
  13855. * This method is like `_.set` except that accepts `updater` to produce the
  13856. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  13857. * is invoked with one argument: (value).
  13858. *
  13859. * **Note:** This method mutates `object`.
  13860. *
  13861. * @static
  13862. * @memberOf _
  13863. * @since 4.6.0
  13864. * @category Object
  13865. * @param {Object} object The object to modify.
  13866. * @param {Array|string} path The path of the property to set.
  13867. * @param {Function} updater The function to produce the updated value.
  13868. * @returns {Object} Returns `object`.
  13869. * @example
  13870. *
  13871. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  13872. *
  13873. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  13874. * console.log(object.a[0].b.c);
  13875. * // => 9
  13876. *
  13877. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  13878. * console.log(object.x[0].y.z);
  13879. * // => 0
  13880. */
  13881. function update(object, path, updater) {
  13882. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  13883. }
  13884. /**
  13885. * This method is like `_.update` except that it accepts `customizer` which is
  13886. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  13887. * path creation is handled by the method instead. The `customizer` is invoked
  13888. * with three arguments: (nsValue, key, nsObject).
  13889. *
  13890. * **Note:** This method mutates `object`.
  13891. *
  13892. * @static
  13893. * @memberOf _
  13894. * @since 4.6.0
  13895. * @category Object
  13896. * @param {Object} object The object to modify.
  13897. * @param {Array|string} path The path of the property to set.
  13898. * @param {Function} updater The function to produce the updated value.
  13899. * @param {Function} [customizer] The function to customize assigned values.
  13900. * @returns {Object} Returns `object`.
  13901. * @example
  13902. *
  13903. * var object = {};
  13904. *
  13905. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  13906. * // => { '0': { '1': 'a' } }
  13907. */
  13908. function updateWith(object, path, updater, customizer) {
  13909. customizer = typeof customizer == 'function' ? customizer : undefined;
  13910. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  13911. }
  13912. /**
  13913. * Creates an array of the own enumerable string keyed property values of `object`.
  13914. *
  13915. * **Note:** Non-object values are coerced to objects.
  13916. *
  13917. * @static
  13918. * @since 0.1.0
  13919. * @memberOf _
  13920. * @category Object
  13921. * @param {Object} object The object to query.
  13922. * @returns {Array} Returns the array of property values.
  13923. * @example
  13924. *
  13925. * function Foo() {
  13926. * this.a = 1;
  13927. * this.b = 2;
  13928. * }
  13929. *
  13930. * Foo.prototype.c = 3;
  13931. *
  13932. * _.values(new Foo);
  13933. * // => [1, 2] (iteration order is not guaranteed)
  13934. *
  13935. * _.values('hi');
  13936. * // => ['h', 'i']
  13937. */
  13938. function values(object) {
  13939. return object == null ? [] : baseValues(object, keys(object));
  13940. }
  13941. /**
  13942. * Creates an array of the own and inherited enumerable string keyed property
  13943. * values of `object`.
  13944. *
  13945. * **Note:** Non-object values are coerced to objects.
  13946. *
  13947. * @static
  13948. * @memberOf _
  13949. * @since 3.0.0
  13950. * @category Object
  13951. * @param {Object} object The object to query.
  13952. * @returns {Array} Returns the array of property values.
  13953. * @example
  13954. *
  13955. * function Foo() {
  13956. * this.a = 1;
  13957. * this.b = 2;
  13958. * }
  13959. *
  13960. * Foo.prototype.c = 3;
  13961. *
  13962. * _.valuesIn(new Foo);
  13963. * // => [1, 2, 3] (iteration order is not guaranteed)
  13964. */
  13965. function valuesIn(object) {
  13966. return object == null ? [] : baseValues(object, keysIn(object));
  13967. }
  13968. /*------------------------------------------------------------------------*/
  13969. /**
  13970. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  13971. *
  13972. * @static
  13973. * @memberOf _
  13974. * @since 4.0.0
  13975. * @category Number
  13976. * @param {number} number The number to clamp.
  13977. * @param {number} [lower] The lower bound.
  13978. * @param {number} upper The upper bound.
  13979. * @returns {number} Returns the clamped number.
  13980. * @example
  13981. *
  13982. * _.clamp(-10, -5, 5);
  13983. * // => -5
  13984. *
  13985. * _.clamp(10, -5, 5);
  13986. * // => 5
  13987. */
  13988. function clamp(number, lower, upper) {
  13989. if (upper === undefined) {
  13990. upper = lower;
  13991. lower = undefined;
  13992. }
  13993. if (upper !== undefined) {
  13994. upper = toNumber(upper);
  13995. upper = upper === upper ? upper : 0;
  13996. }
  13997. if (lower !== undefined) {
  13998. lower = toNumber(lower);
  13999. lower = lower === lower ? lower : 0;
  14000. }
  14001. return baseClamp(toNumber(number), lower, upper);
  14002. }
  14003. /**
  14004. * Checks if `n` is between `start` and up to, but not including, `end`. If
  14005. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  14006. * If `start` is greater than `end` the params are swapped to support
  14007. * negative ranges.
  14008. *
  14009. * @static
  14010. * @memberOf _
  14011. * @since 3.3.0
  14012. * @category Number
  14013. * @param {number} number The number to check.
  14014. * @param {number} [start=0] The start of the range.
  14015. * @param {number} end The end of the range.
  14016. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  14017. * @see _.range, _.rangeRight
  14018. * @example
  14019. *
  14020. * _.inRange(3, 2, 4);
  14021. * // => true
  14022. *
  14023. * _.inRange(4, 8);
  14024. * // => true
  14025. *
  14026. * _.inRange(4, 2);
  14027. * // => false
  14028. *
  14029. * _.inRange(2, 2);
  14030. * // => false
  14031. *
  14032. * _.inRange(1.2, 2);
  14033. * // => true
  14034. *
  14035. * _.inRange(5.2, 4);
  14036. * // => false
  14037. *
  14038. * _.inRange(-3, -2, -6);
  14039. * // => true
  14040. */
  14041. function inRange(number, start, end) {
  14042. start = toFinite(start);
  14043. if (end === undefined) {
  14044. end = start;
  14045. start = 0;
  14046. } else {
  14047. end = toFinite(end);
  14048. }
  14049. number = toNumber(number);
  14050. return baseInRange(number, start, end);
  14051. }
  14052. /**
  14053. * Produces a random number between the inclusive `lower` and `upper` bounds.
  14054. * If only one argument is provided a number between `0` and the given number
  14055. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  14056. * floats, a floating-point number is returned instead of an integer.
  14057. *
  14058. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  14059. * floating-point values which can produce unexpected results.
  14060. *
  14061. * @static
  14062. * @memberOf _
  14063. * @since 0.7.0
  14064. * @category Number
  14065. * @param {number} [lower=0] The lower bound.
  14066. * @param {number} [upper=1] The upper bound.
  14067. * @param {boolean} [floating] Specify returning a floating-point number.
  14068. * @returns {number} Returns the random number.
  14069. * @example
  14070. *
  14071. * _.random(0, 5);
  14072. * // => an integer between 0 and 5
  14073. *
  14074. * _.random(5);
  14075. * // => also an integer between 0 and 5
  14076. *
  14077. * _.random(5, true);
  14078. * // => a floating-point number between 0 and 5
  14079. *
  14080. * _.random(1.2, 5.2);
  14081. * // => a floating-point number between 1.2 and 5.2
  14082. */
  14083. function random(lower, upper, floating) {
  14084. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  14085. upper = floating = undefined;
  14086. }
  14087. if (floating === undefined) {
  14088. if (typeof upper == 'boolean') {
  14089. floating = upper;
  14090. upper = undefined;
  14091. }
  14092. else if (typeof lower == 'boolean') {
  14093. floating = lower;
  14094. lower = undefined;
  14095. }
  14096. }
  14097. if (lower === undefined && upper === undefined) {
  14098. lower = 0;
  14099. upper = 1;
  14100. }
  14101. else {
  14102. lower = toFinite(lower);
  14103. if (upper === undefined) {
  14104. upper = lower;
  14105. lower = 0;
  14106. } else {
  14107. upper = toFinite(upper);
  14108. }
  14109. }
  14110. if (lower > upper) {
  14111. var temp = lower;
  14112. lower = upper;
  14113. upper = temp;
  14114. }
  14115. if (floating || lower % 1 || upper % 1) {
  14116. var rand = nativeRandom();
  14117. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  14118. }
  14119. return baseRandom(lower, upper);
  14120. }
  14121. /*------------------------------------------------------------------------*/
  14122. /**
  14123. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  14124. *
  14125. * @static
  14126. * @memberOf _
  14127. * @since 3.0.0
  14128. * @category String
  14129. * @param {string} [string=''] The string to convert.
  14130. * @returns {string} Returns the camel cased string.
  14131. * @example
  14132. *
  14133. * _.camelCase('Foo Bar');
  14134. * // => 'fooBar'
  14135. *
  14136. * _.camelCase('--foo-bar--');
  14137. * // => 'fooBar'
  14138. *
  14139. * _.camelCase('__FOO_BAR__');
  14140. * // => 'fooBar'
  14141. */
  14142. var camelCase = createCompounder(function(result, word, index) {
  14143. word = word.toLowerCase();
  14144. return result + (index ? capitalize(word) : word);
  14145. });
  14146. /**
  14147. * Converts the first character of `string` to upper case and the remaining
  14148. * to lower case.
  14149. *
  14150. * @static
  14151. * @memberOf _
  14152. * @since 3.0.0
  14153. * @category String
  14154. * @param {string} [string=''] The string to capitalize.
  14155. * @returns {string} Returns the capitalized string.
  14156. * @example
  14157. *
  14158. * _.capitalize('FRED');
  14159. * // => 'Fred'
  14160. */
  14161. function capitalize(string) {
  14162. return upperFirst(toString(string).toLowerCase());
  14163. }
  14164. /**
  14165. * Deburrs `string` by converting
  14166. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  14167. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  14168. * letters to basic Latin letters and removing
  14169. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  14170. *
  14171. * @static
  14172. * @memberOf _
  14173. * @since 3.0.0
  14174. * @category String
  14175. * @param {string} [string=''] The string to deburr.
  14176. * @returns {string} Returns the deburred string.
  14177. * @example
  14178. *
  14179. * _.deburr('déjà vu');
  14180. * // => 'deja vu'
  14181. */
  14182. function deburr(string) {
  14183. string = toString(string);
  14184. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  14185. }
  14186. /**
  14187. * Checks if `string` ends with the given target string.
  14188. *
  14189. * @static
  14190. * @memberOf _
  14191. * @since 3.0.0
  14192. * @category String
  14193. * @param {string} [string=''] The string to inspect.
  14194. * @param {string} [target] The string to search for.
  14195. * @param {number} [position=string.length] The position to search up to.
  14196. * @returns {boolean} Returns `true` if `string` ends with `target`,
  14197. * else `false`.
  14198. * @example
  14199. *
  14200. * _.endsWith('abc', 'c');
  14201. * // => true
  14202. *
  14203. * _.endsWith('abc', 'b');
  14204. * // => false
  14205. *
  14206. * _.endsWith('abc', 'b', 2);
  14207. * // => true
  14208. */
  14209. function endsWith(string, target, position) {
  14210. string = toString(string);
  14211. target = baseToString(target);
  14212. var length = string.length;
  14213. position = position === undefined
  14214. ? length
  14215. : baseClamp(toInteger(position), 0, length);
  14216. var end = position;
  14217. position -= target.length;
  14218. return position >= 0 && string.slice(position, end) == target;
  14219. }
  14220. /**
  14221. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  14222. * corresponding HTML entities.
  14223. *
  14224. * **Note:** No other characters are escaped. To escape additional
  14225. * characters use a third-party library like [_he_](https://mths.be/he).
  14226. *
  14227. * Though the ">" character is escaped for symmetry, characters like
  14228. * ">" and "/" don't need escaping in HTML and have no special meaning
  14229. * unless they're part of a tag or unquoted attribute value. See
  14230. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  14231. * (under "semi-related fun fact") for more details.
  14232. *
  14233. * When working with HTML you should always
  14234. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  14235. * XSS vectors.
  14236. *
  14237. * @static
  14238. * @since 0.1.0
  14239. * @memberOf _
  14240. * @category String
  14241. * @param {string} [string=''] The string to escape.
  14242. * @returns {string} Returns the escaped string.
  14243. * @example
  14244. *
  14245. * _.escape('fred, barney, & pebbles');
  14246. * // => 'fred, barney, &amp; pebbles'
  14247. */
  14248. function escape(string) {
  14249. string = toString(string);
  14250. return (string && reHasUnescapedHtml.test(string))
  14251. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  14252. : string;
  14253. }
  14254. /**
  14255. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  14256. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  14257. *
  14258. * @static
  14259. * @memberOf _
  14260. * @since 3.0.0
  14261. * @category String
  14262. * @param {string} [string=''] The string to escape.
  14263. * @returns {string} Returns the escaped string.
  14264. * @example
  14265. *
  14266. * _.escapeRegExp('[lodash](https://lodash.com/)');
  14267. * // => '\[lodash\]\(https://lodash\.com/\)'
  14268. */
  14269. function escapeRegExp(string) {
  14270. string = toString(string);
  14271. return (string && reHasRegExpChar.test(string))
  14272. ? string.replace(reRegExpChar, '\\$&')
  14273. : string;
  14274. }
  14275. /**
  14276. * Converts `string` to
  14277. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  14278. *
  14279. * @static
  14280. * @memberOf _
  14281. * @since 3.0.0
  14282. * @category String
  14283. * @param {string} [string=''] The string to convert.
  14284. * @returns {string} Returns the kebab cased string.
  14285. * @example
  14286. *
  14287. * _.kebabCase('Foo Bar');
  14288. * // => 'foo-bar'
  14289. *
  14290. * _.kebabCase('fooBar');
  14291. * // => 'foo-bar'
  14292. *
  14293. * _.kebabCase('__FOO_BAR__');
  14294. * // => 'foo-bar'
  14295. */
  14296. var kebabCase = createCompounder(function(result, word, index) {
  14297. return result + (index ? '-' : '') + word.toLowerCase();
  14298. });
  14299. /**
  14300. * Converts `string`, as space separated words, to lower case.
  14301. *
  14302. * @static
  14303. * @memberOf _
  14304. * @since 4.0.0
  14305. * @category String
  14306. * @param {string} [string=''] The string to convert.
  14307. * @returns {string} Returns the lower cased string.
  14308. * @example
  14309. *
  14310. * _.lowerCase('--Foo-Bar--');
  14311. * // => 'foo bar'
  14312. *
  14313. * _.lowerCase('fooBar');
  14314. * // => 'foo bar'
  14315. *
  14316. * _.lowerCase('__FOO_BAR__');
  14317. * // => 'foo bar'
  14318. */
  14319. var lowerCase = createCompounder(function(result, word, index) {
  14320. return result + (index ? ' ' : '') + word.toLowerCase();
  14321. });
  14322. /**
  14323. * Converts the first character of `string` to lower case.
  14324. *
  14325. * @static
  14326. * @memberOf _
  14327. * @since 4.0.0
  14328. * @category String
  14329. * @param {string} [string=''] The string to convert.
  14330. * @returns {string} Returns the converted string.
  14331. * @example
  14332. *
  14333. * _.lowerFirst('Fred');
  14334. * // => 'fred'
  14335. *
  14336. * _.lowerFirst('FRED');
  14337. * // => 'fRED'
  14338. */
  14339. var lowerFirst = createCaseFirst('toLowerCase');
  14340. /**
  14341. * Pads `string` on the left and right sides if it's shorter than `length`.
  14342. * Padding characters are truncated if they can't be evenly divided by `length`.
  14343. *
  14344. * @static
  14345. * @memberOf _
  14346. * @since 3.0.0
  14347. * @category String
  14348. * @param {string} [string=''] The string to pad.
  14349. * @param {number} [length=0] The padding length.
  14350. * @param {string} [chars=' '] The string used as padding.
  14351. * @returns {string} Returns the padded string.
  14352. * @example
  14353. *
  14354. * _.pad('abc', 8);
  14355. * // => ' abc '
  14356. *
  14357. * _.pad('abc', 8, '_-');
  14358. * // => '_-abc_-_'
  14359. *
  14360. * _.pad('abc', 3);
  14361. * // => 'abc'
  14362. */
  14363. function pad(string, length, chars) {
  14364. string = toString(string);
  14365. length = toInteger(length);
  14366. var strLength = length ? stringSize(string) : 0;
  14367. if (!length || strLength >= length) {
  14368. return string;
  14369. }
  14370. var mid = (length - strLength) / 2;
  14371. return (
  14372. createPadding(nativeFloor(mid), chars) +
  14373. string +
  14374. createPadding(nativeCeil(mid), chars)
  14375. );
  14376. }
  14377. /**
  14378. * Pads `string` on the right side if it's shorter than `length`. Padding
  14379. * characters are truncated if they exceed `length`.
  14380. *
  14381. * @static
  14382. * @memberOf _
  14383. * @since 4.0.0
  14384. * @category String
  14385. * @param {string} [string=''] The string to pad.
  14386. * @param {number} [length=0] The padding length.
  14387. * @param {string} [chars=' '] The string used as padding.
  14388. * @returns {string} Returns the padded string.
  14389. * @example
  14390. *
  14391. * _.padEnd('abc', 6);
  14392. * // => 'abc '
  14393. *
  14394. * _.padEnd('abc', 6, '_-');
  14395. * // => 'abc_-_'
  14396. *
  14397. * _.padEnd('abc', 3);
  14398. * // => 'abc'
  14399. */
  14400. function padEnd(string, length, chars) {
  14401. string = toString(string);
  14402. length = toInteger(length);
  14403. var strLength = length ? stringSize(string) : 0;
  14404. return (length && strLength < length)
  14405. ? (string + createPadding(length - strLength, chars))
  14406. : string;
  14407. }
  14408. /**
  14409. * Pads `string` on the left side if it's shorter than `length`. Padding
  14410. * characters are truncated if they exceed `length`.
  14411. *
  14412. * @static
  14413. * @memberOf _
  14414. * @since 4.0.0
  14415. * @category String
  14416. * @param {string} [string=''] The string to pad.
  14417. * @param {number} [length=0] The padding length.
  14418. * @param {string} [chars=' '] The string used as padding.
  14419. * @returns {string} Returns the padded string.
  14420. * @example
  14421. *
  14422. * _.padStart('abc', 6);
  14423. * // => ' abc'
  14424. *
  14425. * _.padStart('abc', 6, '_-');
  14426. * // => '_-_abc'
  14427. *
  14428. * _.padStart('abc', 3);
  14429. * // => 'abc'
  14430. */
  14431. function padStart(string, length, chars) {
  14432. string = toString(string);
  14433. length = toInteger(length);
  14434. var strLength = length ? stringSize(string) : 0;
  14435. return (length && strLength < length)
  14436. ? (createPadding(length - strLength, chars) + string)
  14437. : string;
  14438. }
  14439. /**
  14440. * Converts `string` to an integer of the specified radix. If `radix` is
  14441. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  14442. * hexadecimal, in which case a `radix` of `16` is used.
  14443. *
  14444. * **Note:** This method aligns with the
  14445. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  14446. *
  14447. * @static
  14448. * @memberOf _
  14449. * @since 1.1.0
  14450. * @category String
  14451. * @param {string} string The string to convert.
  14452. * @param {number} [radix=10] The radix to interpret `value` by.
  14453. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14454. * @returns {number} Returns the converted integer.
  14455. * @example
  14456. *
  14457. * _.parseInt('08');
  14458. * // => 8
  14459. *
  14460. * _.map(['6', '08', '10'], _.parseInt);
  14461. * // => [6, 8, 10]
  14462. */
  14463. function parseInt(string, radix, guard) {
  14464. if (guard || radix == null) {
  14465. radix = 0;
  14466. } else if (radix) {
  14467. radix = +radix;
  14468. }
  14469. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  14470. }
  14471. /**
  14472. * Repeats the given string `n` times.
  14473. *
  14474. * @static
  14475. * @memberOf _
  14476. * @since 3.0.0
  14477. * @category String
  14478. * @param {string} [string=''] The string to repeat.
  14479. * @param {number} [n=1] The number of times to repeat the string.
  14480. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14481. * @returns {string} Returns the repeated string.
  14482. * @example
  14483. *
  14484. * _.repeat('*', 3);
  14485. * // => '***'
  14486. *
  14487. * _.repeat('abc', 2);
  14488. * // => 'abcabc'
  14489. *
  14490. * _.repeat('abc', 0);
  14491. * // => ''
  14492. */
  14493. function repeat(string, n, guard) {
  14494. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  14495. n = 1;
  14496. } else {
  14497. n = toInteger(n);
  14498. }
  14499. return baseRepeat(toString(string), n);
  14500. }
  14501. /**
  14502. * Replaces matches for `pattern` in `string` with `replacement`.
  14503. *
  14504. * **Note:** This method is based on
  14505. * [`String#replace`](https://mdn.io/String/replace).
  14506. *
  14507. * @static
  14508. * @memberOf _
  14509. * @since 4.0.0
  14510. * @category String
  14511. * @param {string} [string=''] The string to modify.
  14512. * @param {RegExp|string} pattern The pattern to replace.
  14513. * @param {Function|string} replacement The match replacement.
  14514. * @returns {string} Returns the modified string.
  14515. * @example
  14516. *
  14517. * _.replace('Hi Fred', 'Fred', 'Barney');
  14518. * // => 'Hi Barney'
  14519. */
  14520. function replace() {
  14521. var args = arguments,
  14522. string = toString(args[0]);
  14523. return args.length < 3 ? string : string.replace(args[1], args[2]);
  14524. }
  14525. /**
  14526. * Converts `string` to
  14527. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  14528. *
  14529. * @static
  14530. * @memberOf _
  14531. * @since 3.0.0
  14532. * @category String
  14533. * @param {string} [string=''] The string to convert.
  14534. * @returns {string} Returns the snake cased string.
  14535. * @example
  14536. *
  14537. * _.snakeCase('Foo Bar');
  14538. * // => 'foo_bar'
  14539. *
  14540. * _.snakeCase('fooBar');
  14541. * // => 'foo_bar'
  14542. *
  14543. * _.snakeCase('--FOO-BAR--');
  14544. * // => 'foo_bar'
  14545. */
  14546. var snakeCase = createCompounder(function(result, word, index) {
  14547. return result + (index ? '_' : '') + word.toLowerCase();
  14548. });
  14549. /**
  14550. * Splits `string` by `separator`.
  14551. *
  14552. * **Note:** This method is based on
  14553. * [`String#split`](https://mdn.io/String/split).
  14554. *
  14555. * @static
  14556. * @memberOf _
  14557. * @since 4.0.0
  14558. * @category String
  14559. * @param {string} [string=''] The string to split.
  14560. * @param {RegExp|string} separator The separator pattern to split by.
  14561. * @param {number} [limit] The length to truncate results to.
  14562. * @returns {Array} Returns the string segments.
  14563. * @example
  14564. *
  14565. * _.split('a-b-c', '-', 2);
  14566. * // => ['a', 'b']
  14567. */
  14568. function split(string, separator, limit) {
  14569. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  14570. separator = limit = undefined;
  14571. }
  14572. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  14573. if (!limit) {
  14574. return [];
  14575. }
  14576. string = toString(string);
  14577. if (string && (
  14578. typeof separator == 'string' ||
  14579. (separator != null && !isRegExp(separator))
  14580. )) {
  14581. separator = baseToString(separator);
  14582. if (!separator && hasUnicode(string)) {
  14583. return castSlice(stringToArray(string), 0, limit);
  14584. }
  14585. }
  14586. return string.split(separator, limit);
  14587. }
  14588. /**
  14589. * Converts `string` to
  14590. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  14591. *
  14592. * @static
  14593. * @memberOf _
  14594. * @since 3.1.0
  14595. * @category String
  14596. * @param {string} [string=''] The string to convert.
  14597. * @returns {string} Returns the start cased string.
  14598. * @example
  14599. *
  14600. * _.startCase('--foo-bar--');
  14601. * // => 'Foo Bar'
  14602. *
  14603. * _.startCase('fooBar');
  14604. * // => 'Foo Bar'
  14605. *
  14606. * _.startCase('__FOO_BAR__');
  14607. * // => 'FOO BAR'
  14608. */
  14609. var startCase = createCompounder(function(result, word, index) {
  14610. return result + (index ? ' ' : '') + upperFirst(word);
  14611. });
  14612. /**
  14613. * Checks if `string` starts with the given target string.
  14614. *
  14615. * @static
  14616. * @memberOf _
  14617. * @since 3.0.0
  14618. * @category String
  14619. * @param {string} [string=''] The string to inspect.
  14620. * @param {string} [target] The string to search for.
  14621. * @param {number} [position=0] The position to search from.
  14622. * @returns {boolean} Returns `true` if `string` starts with `target`,
  14623. * else `false`.
  14624. * @example
  14625. *
  14626. * _.startsWith('abc', 'a');
  14627. * // => true
  14628. *
  14629. * _.startsWith('abc', 'b');
  14630. * // => false
  14631. *
  14632. * _.startsWith('abc', 'b', 1);
  14633. * // => true
  14634. */
  14635. function startsWith(string, target, position) {
  14636. string = toString(string);
  14637. position = position == null
  14638. ? 0
  14639. : baseClamp(toInteger(position), 0, string.length);
  14640. target = baseToString(target);
  14641. return string.slice(position, position + target.length) == target;
  14642. }
  14643. /**
  14644. * Creates a compiled template function that can interpolate data properties
  14645. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  14646. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  14647. * properties may be accessed as free variables in the template. If a setting
  14648. * object is given, it takes precedence over `_.templateSettings` values.
  14649. *
  14650. * **Note:** In the development build `_.template` utilizes
  14651. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  14652. * for easier debugging.
  14653. *
  14654. * For more information on precompiling templates see
  14655. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  14656. *
  14657. * For more information on Chrome extension sandboxes see
  14658. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  14659. *
  14660. * @static
  14661. * @since 0.1.0
  14662. * @memberOf _
  14663. * @category String
  14664. * @param {string} [string=''] The template string.
  14665. * @param {Object} [options={}] The options object.
  14666. * @param {RegExp} [options.escape=_.templateSettings.escape]
  14667. * The HTML "escape" delimiter.
  14668. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  14669. * The "evaluate" delimiter.
  14670. * @param {Object} [options.imports=_.templateSettings.imports]
  14671. * An object to import into the template as free variables.
  14672. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  14673. * The "interpolate" delimiter.
  14674. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  14675. * The sourceURL of the compiled template.
  14676. * @param {string} [options.variable='obj']
  14677. * The data object variable name.
  14678. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14679. * @returns {Function} Returns the compiled template function.
  14680. * @example
  14681. *
  14682. * // Use the "interpolate" delimiter to create a compiled template.
  14683. * var compiled = _.template('hello <%= user %>!');
  14684. * compiled({ 'user': 'fred' });
  14685. * // => 'hello fred!'
  14686. *
  14687. * // Use the HTML "escape" delimiter to escape data property values.
  14688. * var compiled = _.template('<b><%- value %></b>');
  14689. * compiled({ 'value': '<script>' });
  14690. * // => '<b>&lt;script&gt;</b>'
  14691. *
  14692. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  14693. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  14694. * compiled({ 'users': ['fred', 'barney'] });
  14695. * // => '<li>fred</li><li>barney</li>'
  14696. *
  14697. * // Use the internal `print` function in "evaluate" delimiters.
  14698. * var compiled = _.template('<% print("hello " + user); %>!');
  14699. * compiled({ 'user': 'barney' });
  14700. * // => 'hello barney!'
  14701. *
  14702. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  14703. * // Disable support by replacing the "interpolate" delimiter.
  14704. * var compiled = _.template('hello ${ user }!');
  14705. * compiled({ 'user': 'pebbles' });
  14706. * // => 'hello pebbles!'
  14707. *
  14708. * // Use backslashes to treat delimiters as plain text.
  14709. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  14710. * compiled({ 'value': 'ignored' });
  14711. * // => '<%- value %>'
  14712. *
  14713. * // Use the `imports` option to import `jQuery` as `jq`.
  14714. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  14715. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  14716. * compiled({ 'users': ['fred', 'barney'] });
  14717. * // => '<li>fred</li><li>barney</li>'
  14718. *
  14719. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  14720. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  14721. * compiled(data);
  14722. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  14723. *
  14724. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  14725. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  14726. * compiled.source;
  14727. * // => function(data) {
  14728. * // var __t, __p = '';
  14729. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  14730. * // return __p;
  14731. * // }
  14732. *
  14733. * // Use custom template delimiters.
  14734. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  14735. * var compiled = _.template('hello {{ user }}!');
  14736. * compiled({ 'user': 'mustache' });
  14737. * // => 'hello mustache!'
  14738. *
  14739. * // Use the `source` property to inline compiled templates for meaningful
  14740. * // line numbers in error messages and stack traces.
  14741. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  14742. * var JST = {\
  14743. * "main": ' + _.template(mainText).source + '\
  14744. * };\
  14745. * ');
  14746. */
  14747. function template(string, options, guard) {
  14748. // Based on John Resig's `tmpl` implementation
  14749. // (http://ejohn.org/blog/javascript-micro-templating/)
  14750. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  14751. var settings = lodash.templateSettings;
  14752. if (guard && isIterateeCall(string, options, guard)) {
  14753. options = undefined;
  14754. }
  14755. string = toString(string);
  14756. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  14757. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  14758. importsKeys = keys(imports),
  14759. importsValues = baseValues(imports, importsKeys);
  14760. var isEscaping,
  14761. isEvaluating,
  14762. index = 0,
  14763. interpolate = options.interpolate || reNoMatch,
  14764. source = "__p += '";
  14765. // Compile the regexp to match each delimiter.
  14766. var reDelimiters = RegExp(
  14767. (options.escape || reNoMatch).source + '|' +
  14768. interpolate.source + '|' +
  14769. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  14770. (options.evaluate || reNoMatch).source + '|$'
  14771. , 'g');
  14772. // Use a sourceURL for easier debugging.
  14773. var sourceURL = '//# sourceURL=' +
  14774. ('sourceURL' in options
  14775. ? options.sourceURL
  14776. : ('lodash.templateSources[' + (++templateCounter) + ']')
  14777. ) + '\n';
  14778. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  14779. interpolateValue || (interpolateValue = esTemplateValue);
  14780. // Escape characters that can't be included in string literals.
  14781. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  14782. // Replace delimiters with snippets.
  14783. if (escapeValue) {
  14784. isEscaping = true;
  14785. source += "' +\n__e(" + escapeValue + ") +\n'";
  14786. }
  14787. if (evaluateValue) {
  14788. isEvaluating = true;
  14789. source += "';\n" + evaluateValue + ";\n__p += '";
  14790. }
  14791. if (interpolateValue) {
  14792. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  14793. }
  14794. index = offset + match.length;
  14795. // The JS engine embedded in Adobe products needs `match` returned in
  14796. // order to produce the correct `offset` value.
  14797. return match;
  14798. });
  14799. source += "';\n";
  14800. // If `variable` is not specified wrap a with-statement around the generated
  14801. // code to add the data object to the top of the scope chain.
  14802. var variable = options.variable;
  14803. if (!variable) {
  14804. source = 'with (obj) {\n' + source + '\n}\n';
  14805. }
  14806. // Cleanup code by stripping empty strings.
  14807. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  14808. .replace(reEmptyStringMiddle, '$1')
  14809. .replace(reEmptyStringTrailing, '$1;');
  14810. // Frame code as the function body.
  14811. source = 'function(' + (variable || 'obj') + ') {\n' +
  14812. (variable
  14813. ? ''
  14814. : 'obj || (obj = {});\n'
  14815. ) +
  14816. "var __t, __p = ''" +
  14817. (isEscaping
  14818. ? ', __e = _.escape'
  14819. : ''
  14820. ) +
  14821. (isEvaluating
  14822. ? ', __j = Array.prototype.join;\n' +
  14823. "function print() { __p += __j.call(arguments, '') }\n"
  14824. : ';\n'
  14825. ) +
  14826. source +
  14827. 'return __p\n}';
  14828. var result = attempt(function() {
  14829. return Function(importsKeys, sourceURL + 'return ' + source)
  14830. .apply(undefined, importsValues);
  14831. });
  14832. // Provide the compiled function's source by its `toString` method or
  14833. // the `source` property as a convenience for inlining compiled templates.
  14834. result.source = source;
  14835. if (isError(result)) {
  14836. throw result;
  14837. }
  14838. return result;
  14839. }
  14840. /**
  14841. * Converts `string`, as a whole, to lower case just like
  14842. * [String#toLowerCase](https://mdn.io/toLowerCase).
  14843. *
  14844. * @static
  14845. * @memberOf _
  14846. * @since 4.0.0
  14847. * @category String
  14848. * @param {string} [string=''] The string to convert.
  14849. * @returns {string} Returns the lower cased string.
  14850. * @example
  14851. *
  14852. * _.toLower('--Foo-Bar--');
  14853. * // => '--foo-bar--'
  14854. *
  14855. * _.toLower('fooBar');
  14856. * // => 'foobar'
  14857. *
  14858. * _.toLower('__FOO_BAR__');
  14859. * // => '__foo_bar__'
  14860. */
  14861. function toLower(value) {
  14862. return toString(value).toLowerCase();
  14863. }
  14864. /**
  14865. * Converts `string`, as a whole, to upper case just like
  14866. * [String#toUpperCase](https://mdn.io/toUpperCase).
  14867. *
  14868. * @static
  14869. * @memberOf _
  14870. * @since 4.0.0
  14871. * @category String
  14872. * @param {string} [string=''] The string to convert.
  14873. * @returns {string} Returns the upper cased string.
  14874. * @example
  14875. *
  14876. * _.toUpper('--foo-bar--');
  14877. * // => '--FOO-BAR--'
  14878. *
  14879. * _.toUpper('fooBar');
  14880. * // => 'FOOBAR'
  14881. *
  14882. * _.toUpper('__foo_bar__');
  14883. * // => '__FOO_BAR__'
  14884. */
  14885. function toUpper(value) {
  14886. return toString(value).toUpperCase();
  14887. }
  14888. /**
  14889. * Removes leading and trailing whitespace or specified characters from `string`.
  14890. *
  14891. * @static
  14892. * @memberOf _
  14893. * @since 3.0.0
  14894. * @category String
  14895. * @param {string} [string=''] The string to trim.
  14896. * @param {string} [chars=whitespace] The characters to trim.
  14897. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14898. * @returns {string} Returns the trimmed string.
  14899. * @example
  14900. *
  14901. * _.trim(' abc ');
  14902. * // => 'abc'
  14903. *
  14904. * _.trim('-_-abc-_-', '_-');
  14905. * // => 'abc'
  14906. *
  14907. * _.map([' foo ', ' bar '], _.trim);
  14908. * // => ['foo', 'bar']
  14909. */
  14910. function trim(string, chars, guard) {
  14911. string = toString(string);
  14912. if (string && (guard || chars === undefined)) {
  14913. return string.replace(reTrim, '');
  14914. }
  14915. if (!string || !(chars = baseToString(chars))) {
  14916. return string;
  14917. }
  14918. var strSymbols = stringToArray(string),
  14919. chrSymbols = stringToArray(chars),
  14920. start = charsStartIndex(strSymbols, chrSymbols),
  14921. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  14922. return castSlice(strSymbols, start, end).join('');
  14923. }
  14924. /**
  14925. * Removes trailing whitespace or specified characters from `string`.
  14926. *
  14927. * @static
  14928. * @memberOf _
  14929. * @since 4.0.0
  14930. * @category String
  14931. * @param {string} [string=''] The string to trim.
  14932. * @param {string} [chars=whitespace] The characters to trim.
  14933. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14934. * @returns {string} Returns the trimmed string.
  14935. * @example
  14936. *
  14937. * _.trimEnd(' abc ');
  14938. * // => ' abc'
  14939. *
  14940. * _.trimEnd('-_-abc-_-', '_-');
  14941. * // => '-_-abc'
  14942. */
  14943. function trimEnd(string, chars, guard) {
  14944. string = toString(string);
  14945. if (string && (guard || chars === undefined)) {
  14946. return string.replace(reTrimEnd, '');
  14947. }
  14948. if (!string || !(chars = baseToString(chars))) {
  14949. return string;
  14950. }
  14951. var strSymbols = stringToArray(string),
  14952. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  14953. return castSlice(strSymbols, 0, end).join('');
  14954. }
  14955. /**
  14956. * Removes leading whitespace or specified characters from `string`.
  14957. *
  14958. * @static
  14959. * @memberOf _
  14960. * @since 4.0.0
  14961. * @category String
  14962. * @param {string} [string=''] The string to trim.
  14963. * @param {string} [chars=whitespace] The characters to trim.
  14964. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14965. * @returns {string} Returns the trimmed string.
  14966. * @example
  14967. *
  14968. * _.trimStart(' abc ');
  14969. * // => 'abc '
  14970. *
  14971. * _.trimStart('-_-abc-_-', '_-');
  14972. * // => 'abc-_-'
  14973. */
  14974. function trimStart(string, chars, guard) {
  14975. string = toString(string);
  14976. if (string && (guard || chars === undefined)) {
  14977. return string.replace(reTrimStart, '');
  14978. }
  14979. if (!string || !(chars = baseToString(chars))) {
  14980. return string;
  14981. }
  14982. var strSymbols = stringToArray(string),
  14983. start = charsStartIndex(strSymbols, stringToArray(chars));
  14984. return castSlice(strSymbols, start).join('');
  14985. }
  14986. /**
  14987. * Truncates `string` if it's longer than the given maximum string length.
  14988. * The last characters of the truncated string are replaced with the omission
  14989. * string which defaults to "...".
  14990. *
  14991. * @static
  14992. * @memberOf _
  14993. * @since 4.0.0
  14994. * @category String
  14995. * @param {string} [string=''] The string to truncate.
  14996. * @param {Object} [options={}] The options object.
  14997. * @param {number} [options.length=30] The maximum string length.
  14998. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  14999. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  15000. * @returns {string} Returns the truncated string.
  15001. * @example
  15002. *
  15003. * _.truncate('hi-diddly-ho there, neighborino');
  15004. * // => 'hi-diddly-ho there, neighbo...'
  15005. *
  15006. * _.truncate('hi-diddly-ho there, neighborino', {
  15007. * 'length': 24,
  15008. * 'separator': ' '
  15009. * });
  15010. * // => 'hi-diddly-ho there,...'
  15011. *
  15012. * _.truncate('hi-diddly-ho there, neighborino', {
  15013. * 'length': 24,
  15014. * 'separator': /,? +/
  15015. * });
  15016. * // => 'hi-diddly-ho there...'
  15017. *
  15018. * _.truncate('hi-diddly-ho there, neighborino', {
  15019. * 'omission': ' [...]'
  15020. * });
  15021. * // => 'hi-diddly-ho there, neig [...]'
  15022. */
  15023. function truncate(string, options) {
  15024. var length = DEFAULT_TRUNC_LENGTH,
  15025. omission = DEFAULT_TRUNC_OMISSION;
  15026. if (isObject(options)) {
  15027. var separator = 'separator' in options ? options.separator : separator;
  15028. length = 'length' in options ? toInteger(options.length) : length;
  15029. omission = 'omission' in options ? baseToString(options.omission) : omission;
  15030. }
  15031. string = toString(string);
  15032. var strLength = string.length;
  15033. if (hasUnicode(string)) {
  15034. var strSymbols = stringToArray(string);
  15035. strLength = strSymbols.length;
  15036. }
  15037. if (length >= strLength) {
  15038. return string;
  15039. }
  15040. var end = length - stringSize(omission);
  15041. if (end < 1) {
  15042. return omission;
  15043. }
  15044. var result = strSymbols
  15045. ? castSlice(strSymbols, 0, end).join('')
  15046. : string.slice(0, end);
  15047. if (separator === undefined) {
  15048. return result + omission;
  15049. }
  15050. if (strSymbols) {
  15051. end += (result.length - end);
  15052. }
  15053. if (isRegExp(separator)) {
  15054. if (string.slice(end).search(separator)) {
  15055. var match,
  15056. substring = result;
  15057. if (!separator.global) {
  15058. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  15059. }
  15060. separator.lastIndex = 0;
  15061. while ((match = separator.exec(substring))) {
  15062. var newEnd = match.index;
  15063. }
  15064. result = result.slice(0, newEnd === undefined ? end : newEnd);
  15065. }
  15066. } else if (string.indexOf(baseToString(separator), end) != end) {
  15067. var index = result.lastIndexOf(separator);
  15068. if (index > -1) {
  15069. result = result.slice(0, index);
  15070. }
  15071. }
  15072. return result + omission;
  15073. }
  15074. /**
  15075. * The inverse of `_.escape`; this method converts the HTML entities
  15076. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  15077. * their corresponding characters.
  15078. *
  15079. * **Note:** No other HTML entities are unescaped. To unescape additional
  15080. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  15081. *
  15082. * @static
  15083. * @memberOf _
  15084. * @since 0.6.0
  15085. * @category String
  15086. * @param {string} [string=''] The string to unescape.
  15087. * @returns {string} Returns the unescaped string.
  15088. * @example
  15089. *
  15090. * _.unescape('fred, barney, &amp; pebbles');
  15091. * // => 'fred, barney, & pebbles'
  15092. */
  15093. function unescape(string) {
  15094. string = toString(string);
  15095. return (string && reHasEscapedHtml.test(string))
  15096. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  15097. : string;
  15098. }
  15099. /**
  15100. * Converts `string`, as space separated words, to upper case.
  15101. *
  15102. * @static
  15103. * @memberOf _
  15104. * @since 4.0.0
  15105. * @category String
  15106. * @param {string} [string=''] The string to convert.
  15107. * @returns {string} Returns the upper cased string.
  15108. * @example
  15109. *
  15110. * _.upperCase('--foo-bar');
  15111. * // => 'FOO BAR'
  15112. *
  15113. * _.upperCase('fooBar');
  15114. * // => 'FOO BAR'
  15115. *
  15116. * _.upperCase('__foo_bar__');
  15117. * // => 'FOO BAR'
  15118. */
  15119. var upperCase = createCompounder(function(result, word, index) {
  15120. return result + (index ? ' ' : '') + word.toUpperCase();
  15121. });
  15122. /**
  15123. * Converts the first character of `string` to upper case.
  15124. *
  15125. * @static
  15126. * @memberOf _
  15127. * @since 4.0.0
  15128. * @category String
  15129. * @param {string} [string=''] The string to convert.
  15130. * @returns {string} Returns the converted string.
  15131. * @example
  15132. *
  15133. * _.upperFirst('fred');
  15134. * // => 'Fred'
  15135. *
  15136. * _.upperFirst('FRED');
  15137. * // => 'FRED'
  15138. */
  15139. var upperFirst = createCaseFirst('toUpperCase');
  15140. /**
  15141. * Splits `string` into an array of its words.
  15142. *
  15143. * @static
  15144. * @memberOf _
  15145. * @since 3.0.0
  15146. * @category String
  15147. * @param {string} [string=''] The string to inspect.
  15148. * @param {RegExp|string} [pattern] The pattern to match words.
  15149. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15150. * @returns {Array} Returns the words of `string`.
  15151. * @example
  15152. *
  15153. * _.words('fred, barney, & pebbles');
  15154. * // => ['fred', 'barney', 'pebbles']
  15155. *
  15156. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  15157. * // => ['fred', 'barney', '&', 'pebbles']
  15158. */
  15159. function words(string, pattern, guard) {
  15160. string = toString(string);
  15161. pattern = guard ? undefined : pattern;
  15162. if (pattern === undefined) {
  15163. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  15164. }
  15165. return string.match(pattern) || [];
  15166. }
  15167. /*------------------------------------------------------------------------*/
  15168. /**
  15169. * Attempts to invoke `func`, returning either the result or the caught error
  15170. * object. Any additional arguments are provided to `func` when it's invoked.
  15171. *
  15172. * @static
  15173. * @memberOf _
  15174. * @since 3.0.0
  15175. * @category Util
  15176. * @param {Function} func The function to attempt.
  15177. * @param {...*} [args] The arguments to invoke `func` with.
  15178. * @returns {*} Returns the `func` result or error object.
  15179. * @example
  15180. *
  15181. * // Avoid throwing errors for invalid selectors.
  15182. * var elements = _.attempt(function(selector) {
  15183. * return document.querySelectorAll(selector);
  15184. * }, '>_>');
  15185. *
  15186. * if (_.isError(elements)) {
  15187. * elements = [];
  15188. * }
  15189. */
  15190. var attempt = baseRest(function(func, args) {
  15191. try {
  15192. return apply(func, undefined, args);
  15193. } catch (e) {
  15194. return isError(e) ? e : new Error(e);
  15195. }
  15196. });
  15197. /**
  15198. * Binds methods of an object to the object itself, overwriting the existing
  15199. * method.
  15200. *
  15201. * **Note:** This method doesn't set the "length" property of bound functions.
  15202. *
  15203. * @static
  15204. * @since 0.1.0
  15205. * @memberOf _
  15206. * @category Util
  15207. * @param {Object} object The object to bind and assign the bound methods to.
  15208. * @param {...(string|string[])} methodNames The object method names to bind.
  15209. * @returns {Object} Returns `object`.
  15210. * @example
  15211. *
  15212. * var view = {
  15213. * 'label': 'docs',
  15214. * 'click': function() {
  15215. * console.log('clicked ' + this.label);
  15216. * }
  15217. * };
  15218. *
  15219. * _.bindAll(view, ['click']);
  15220. * jQuery(element).on('click', view.click);
  15221. * // => Logs 'clicked docs' when clicked.
  15222. */
  15223. var bindAll = flatRest(function(object, methodNames) {
  15224. arrayEach(methodNames, function(key) {
  15225. key = toKey(key);
  15226. baseAssignValue(object, key, bind(object[key], object));
  15227. });
  15228. return object;
  15229. });
  15230. /**
  15231. * Creates a function that iterates over `pairs` and invokes the corresponding
  15232. * function of the first predicate to return truthy. The predicate-function
  15233. * pairs are invoked with the `this` binding and arguments of the created
  15234. * function.
  15235. *
  15236. * @static
  15237. * @memberOf _
  15238. * @since 4.0.0
  15239. * @category Util
  15240. * @param {Array} pairs The predicate-function pairs.
  15241. * @returns {Function} Returns the new composite function.
  15242. * @example
  15243. *
  15244. * var func = _.cond([
  15245. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  15246. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  15247. * [_.stubTrue, _.constant('no match')]
  15248. * ]);
  15249. *
  15250. * func({ 'a': 1, 'b': 2 });
  15251. * // => 'matches A'
  15252. *
  15253. * func({ 'a': 0, 'b': 1 });
  15254. * // => 'matches B'
  15255. *
  15256. * func({ 'a': '1', 'b': '2' });
  15257. * // => 'no match'
  15258. */
  15259. function cond(pairs) {
  15260. var length = pairs == null ? 0 : pairs.length,
  15261. toIteratee = getIteratee();
  15262. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  15263. if (typeof pair[1] != 'function') {
  15264. throw new TypeError(FUNC_ERROR_TEXT);
  15265. }
  15266. return [toIteratee(pair[0]), pair[1]];
  15267. });
  15268. return baseRest(function(args) {
  15269. var index = -1;
  15270. while (++index < length) {
  15271. var pair = pairs[index];
  15272. if (apply(pair[0], this, args)) {
  15273. return apply(pair[1], this, args);
  15274. }
  15275. }
  15276. });
  15277. }
  15278. /**
  15279. * Creates a function that invokes the predicate properties of `source` with
  15280. * the corresponding property values of a given object, returning `true` if
  15281. * all predicates return truthy, else `false`.
  15282. *
  15283. * **Note:** The created function is equivalent to `_.conformsTo` with
  15284. * `source` partially applied.
  15285. *
  15286. * @static
  15287. * @memberOf _
  15288. * @since 4.0.0
  15289. * @category Util
  15290. * @param {Object} source The object of property predicates to conform to.
  15291. * @returns {Function} Returns the new spec function.
  15292. * @example
  15293. *
  15294. * var objects = [
  15295. * { 'a': 2, 'b': 1 },
  15296. * { 'a': 1, 'b': 2 }
  15297. * ];
  15298. *
  15299. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  15300. * // => [{ 'a': 1, 'b': 2 }]
  15301. */
  15302. function conforms(source) {
  15303. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  15304. }
  15305. /**
  15306. * Creates a function that returns `value`.
  15307. *
  15308. * @static
  15309. * @memberOf _
  15310. * @since 2.4.0
  15311. * @category Util
  15312. * @param {*} value The value to return from the new function.
  15313. * @returns {Function} Returns the new constant function.
  15314. * @example
  15315. *
  15316. * var objects = _.times(2, _.constant({ 'a': 1 }));
  15317. *
  15318. * console.log(objects);
  15319. * // => [{ 'a': 1 }, { 'a': 1 }]
  15320. *
  15321. * console.log(objects[0] === objects[1]);
  15322. * // => true
  15323. */
  15324. function constant(value) {
  15325. return function() {
  15326. return value;
  15327. };
  15328. }
  15329. /**
  15330. * Checks `value` to determine whether a default value should be returned in
  15331. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  15332. * or `undefined`.
  15333. *
  15334. * @static
  15335. * @memberOf _
  15336. * @since 4.14.0
  15337. * @category Util
  15338. * @param {*} value The value to check.
  15339. * @param {*} defaultValue The default value.
  15340. * @returns {*} Returns the resolved value.
  15341. * @example
  15342. *
  15343. * _.defaultTo(1, 10);
  15344. * // => 1
  15345. *
  15346. * _.defaultTo(undefined, 10);
  15347. * // => 10
  15348. */
  15349. function defaultTo(value, defaultValue) {
  15350. return (value == null || value !== value) ? defaultValue : value;
  15351. }
  15352. /**
  15353. * Creates a function that returns the result of invoking the given functions
  15354. * with the `this` binding of the created function, where each successive
  15355. * invocation is supplied the return value of the previous.
  15356. *
  15357. * @static
  15358. * @memberOf _
  15359. * @since 3.0.0
  15360. * @category Util
  15361. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  15362. * @returns {Function} Returns the new composite function.
  15363. * @see _.flowRight
  15364. * @example
  15365. *
  15366. * function square(n) {
  15367. * return n * n;
  15368. * }
  15369. *
  15370. * var addSquare = _.flow([_.add, square]);
  15371. * addSquare(1, 2);
  15372. * // => 9
  15373. */
  15374. var flow = createFlow();
  15375. /**
  15376. * This method is like `_.flow` except that it creates a function that
  15377. * invokes the given functions from right to left.
  15378. *
  15379. * @static
  15380. * @since 3.0.0
  15381. * @memberOf _
  15382. * @category Util
  15383. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  15384. * @returns {Function} Returns the new composite function.
  15385. * @see _.flow
  15386. * @example
  15387. *
  15388. * function square(n) {
  15389. * return n * n;
  15390. * }
  15391. *
  15392. * var addSquare = _.flowRight([square, _.add]);
  15393. * addSquare(1, 2);
  15394. * // => 9
  15395. */
  15396. var flowRight = createFlow(true);
  15397. /**
  15398. * This method returns the first argument it receives.
  15399. *
  15400. * @static
  15401. * @since 0.1.0
  15402. * @memberOf _
  15403. * @category Util
  15404. * @param {*} value Any value.
  15405. * @returns {*} Returns `value`.
  15406. * @example
  15407. *
  15408. * var object = { 'a': 1 };
  15409. *
  15410. * console.log(_.identity(object) === object);
  15411. * // => true
  15412. */
  15413. function identity(value) {
  15414. return value;
  15415. }
  15416. /**
  15417. * Creates a function that invokes `func` with the arguments of the created
  15418. * function. If `func` is a property name, the created function returns the
  15419. * property value for a given element. If `func` is an array or object, the
  15420. * created function returns `true` for elements that contain the equivalent
  15421. * source properties, otherwise it returns `false`.
  15422. *
  15423. * @static
  15424. * @since 4.0.0
  15425. * @memberOf _
  15426. * @category Util
  15427. * @param {*} [func=_.identity] The value to convert to a callback.
  15428. * @returns {Function} Returns the callback.
  15429. * @example
  15430. *
  15431. * var users = [
  15432. * { 'user': 'barney', 'age': 36, 'active': true },
  15433. * { 'user': 'fred', 'age': 40, 'active': false }
  15434. * ];
  15435. *
  15436. * // The `_.matches` iteratee shorthand.
  15437. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  15438. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  15439. *
  15440. * // The `_.matchesProperty` iteratee shorthand.
  15441. * _.filter(users, _.iteratee(['user', 'fred']));
  15442. * // => [{ 'user': 'fred', 'age': 40 }]
  15443. *
  15444. * // The `_.property` iteratee shorthand.
  15445. * _.map(users, _.iteratee('user'));
  15446. * // => ['barney', 'fred']
  15447. *
  15448. * // Create custom iteratee shorthands.
  15449. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  15450. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  15451. * return func.test(string);
  15452. * };
  15453. * });
  15454. *
  15455. * _.filter(['abc', 'def'], /ef/);
  15456. * // => ['def']
  15457. */
  15458. function iteratee(func) {
  15459. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  15460. }
  15461. /**
  15462. * Creates a function that performs a partial deep comparison between a given
  15463. * object and `source`, returning `true` if the given object has equivalent
  15464. * property values, else `false`.
  15465. *
  15466. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  15467. * partially applied.
  15468. *
  15469. * Partial comparisons will match empty array and empty object `source`
  15470. * values against any array or object value, respectively. See `_.isEqual`
  15471. * for a list of supported value comparisons.
  15472. *
  15473. * @static
  15474. * @memberOf _
  15475. * @since 3.0.0
  15476. * @category Util
  15477. * @param {Object} source The object of property values to match.
  15478. * @returns {Function} Returns the new spec function.
  15479. * @example
  15480. *
  15481. * var objects = [
  15482. * { 'a': 1, 'b': 2, 'c': 3 },
  15483. * { 'a': 4, 'b': 5, 'c': 6 }
  15484. * ];
  15485. *
  15486. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  15487. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  15488. */
  15489. function matches(source) {
  15490. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  15491. }
  15492. /**
  15493. * Creates a function that performs a partial deep comparison between the
  15494. * value at `path` of a given object to `srcValue`, returning `true` if the
  15495. * object value is equivalent, else `false`.
  15496. *
  15497. * **Note:** Partial comparisons will match empty array and empty object
  15498. * `srcValue` values against any array or object value, respectively. See
  15499. * `_.isEqual` for a list of supported value comparisons.
  15500. *
  15501. * @static
  15502. * @memberOf _
  15503. * @since 3.2.0
  15504. * @category Util
  15505. * @param {Array|string} path The path of the property to get.
  15506. * @param {*} srcValue The value to match.
  15507. * @returns {Function} Returns the new spec function.
  15508. * @example
  15509. *
  15510. * var objects = [
  15511. * { 'a': 1, 'b': 2, 'c': 3 },
  15512. * { 'a': 4, 'b': 5, 'c': 6 }
  15513. * ];
  15514. *
  15515. * _.find(objects, _.matchesProperty('a', 4));
  15516. * // => { 'a': 4, 'b': 5, 'c': 6 }
  15517. */
  15518. function matchesProperty(path, srcValue) {
  15519. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  15520. }
  15521. /**
  15522. * Creates a function that invokes the method at `path` of a given object.
  15523. * Any additional arguments are provided to the invoked method.
  15524. *
  15525. * @static
  15526. * @memberOf _
  15527. * @since 3.7.0
  15528. * @category Util
  15529. * @param {Array|string} path The path of the method to invoke.
  15530. * @param {...*} [args] The arguments to invoke the method with.
  15531. * @returns {Function} Returns the new invoker function.
  15532. * @example
  15533. *
  15534. * var objects = [
  15535. * { 'a': { 'b': _.constant(2) } },
  15536. * { 'a': { 'b': _.constant(1) } }
  15537. * ];
  15538. *
  15539. * _.map(objects, _.method('a.b'));
  15540. * // => [2, 1]
  15541. *
  15542. * _.map(objects, _.method(['a', 'b']));
  15543. * // => [2, 1]
  15544. */
  15545. var method = baseRest(function(path, args) {
  15546. return function(object) {
  15547. return baseInvoke(object, path, args);
  15548. };
  15549. });
  15550. /**
  15551. * The opposite of `_.method`; this method creates a function that invokes
  15552. * the method at a given path of `object`. Any additional arguments are
  15553. * provided to the invoked method.
  15554. *
  15555. * @static
  15556. * @memberOf _
  15557. * @since 3.7.0
  15558. * @category Util
  15559. * @param {Object} object The object to query.
  15560. * @param {...*} [args] The arguments to invoke the method with.
  15561. * @returns {Function} Returns the new invoker function.
  15562. * @example
  15563. *
  15564. * var array = _.times(3, _.constant),
  15565. * object = { 'a': array, 'b': array, 'c': array };
  15566. *
  15567. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  15568. * // => [2, 0]
  15569. *
  15570. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  15571. * // => [2, 0]
  15572. */
  15573. var methodOf = baseRest(function(object, args) {
  15574. return function(path) {
  15575. return baseInvoke(object, path, args);
  15576. };
  15577. });
  15578. /**
  15579. * Adds all own enumerable string keyed function properties of a source
  15580. * object to the destination object. If `object` is a function, then methods
  15581. * are added to its prototype as well.
  15582. *
  15583. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  15584. * avoid conflicts caused by modifying the original.
  15585. *
  15586. * @static
  15587. * @since 0.1.0
  15588. * @memberOf _
  15589. * @category Util
  15590. * @param {Function|Object} [object=lodash] The destination object.
  15591. * @param {Object} source The object of functions to add.
  15592. * @param {Object} [options={}] The options object.
  15593. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  15594. * @returns {Function|Object} Returns `object`.
  15595. * @example
  15596. *
  15597. * function vowels(string) {
  15598. * return _.filter(string, function(v) {
  15599. * return /[aeiou]/i.test(v);
  15600. * });
  15601. * }
  15602. *
  15603. * _.mixin({ 'vowels': vowels });
  15604. * _.vowels('fred');
  15605. * // => ['e']
  15606. *
  15607. * _('fred').vowels().value();
  15608. * // => ['e']
  15609. *
  15610. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  15611. * _('fred').vowels();
  15612. * // => ['e']
  15613. */
  15614. function mixin(object, source, options) {
  15615. var props = keys(source),
  15616. methodNames = baseFunctions(source, props);
  15617. if (options == null &&
  15618. !(isObject(source) && (methodNames.length || !props.length))) {
  15619. options = source;
  15620. source = object;
  15621. object = this;
  15622. methodNames = baseFunctions(source, keys(source));
  15623. }
  15624. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  15625. isFunc = isFunction(object);
  15626. arrayEach(methodNames, function(methodName) {
  15627. var func = source[methodName];
  15628. object[methodName] = func;
  15629. if (isFunc) {
  15630. object.prototype[methodName] = function() {
  15631. var chainAll = this.__chain__;
  15632. if (chain || chainAll) {
  15633. var result = object(this.__wrapped__),
  15634. actions = result.__actions__ = copyArray(this.__actions__);
  15635. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  15636. result.__chain__ = chainAll;
  15637. return result;
  15638. }
  15639. return func.apply(object, arrayPush([this.value()], arguments));
  15640. };
  15641. }
  15642. });
  15643. return object;
  15644. }
  15645. /**
  15646. * Reverts the `_` variable to its previous value and returns a reference to
  15647. * the `lodash` function.
  15648. *
  15649. * @static
  15650. * @since 0.1.0
  15651. * @memberOf _
  15652. * @category Util
  15653. * @returns {Function} Returns the `lodash` function.
  15654. * @example
  15655. *
  15656. * var lodash = _.noConflict();
  15657. */
  15658. function noConflict() {
  15659. if (root._ === this) {
  15660. root._ = oldDash;
  15661. }
  15662. return this;
  15663. }
  15664. /**
  15665. * This method returns `undefined`.
  15666. *
  15667. * @static
  15668. * @memberOf _
  15669. * @since 2.3.0
  15670. * @category Util
  15671. * @example
  15672. *
  15673. * _.times(2, _.noop);
  15674. * // => [undefined, undefined]
  15675. */
  15676. function noop() {
  15677. // No operation performed.
  15678. }
  15679. /**
  15680. * Creates a function that gets the argument at index `n`. If `n` is negative,
  15681. * the nth argument from the end is returned.
  15682. *
  15683. * @static
  15684. * @memberOf _
  15685. * @since 4.0.0
  15686. * @category Util
  15687. * @param {number} [n=0] The index of the argument to return.
  15688. * @returns {Function} Returns the new pass-thru function.
  15689. * @example
  15690. *
  15691. * var func = _.nthArg(1);
  15692. * func('a', 'b', 'c', 'd');
  15693. * // => 'b'
  15694. *
  15695. * var func = _.nthArg(-2);
  15696. * func('a', 'b', 'c', 'd');
  15697. * // => 'c'
  15698. */
  15699. function nthArg(n) {
  15700. n = toInteger(n);
  15701. return baseRest(function(args) {
  15702. return baseNth(args, n);
  15703. });
  15704. }
  15705. /**
  15706. * Creates a function that invokes `iteratees` with the arguments it receives
  15707. * and returns their results.
  15708. *
  15709. * @static
  15710. * @memberOf _
  15711. * @since 4.0.0
  15712. * @category Util
  15713. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  15714. * The iteratees to invoke.
  15715. * @returns {Function} Returns the new function.
  15716. * @example
  15717. *
  15718. * var func = _.over([Math.max, Math.min]);
  15719. *
  15720. * func(1, 2, 3, 4);
  15721. * // => [4, 1]
  15722. */
  15723. var over = createOver(arrayMap);
  15724. /**
  15725. * Creates a function that checks if **all** of the `predicates` return
  15726. * truthy when invoked with the arguments it receives.
  15727. *
  15728. * @static
  15729. * @memberOf _
  15730. * @since 4.0.0
  15731. * @category Util
  15732. * @param {...(Function|Function[])} [predicates=[_.identity]]
  15733. * The predicates to check.
  15734. * @returns {Function} Returns the new function.
  15735. * @example
  15736. *
  15737. * var func = _.overEvery([Boolean, isFinite]);
  15738. *
  15739. * func('1');
  15740. * // => true
  15741. *
  15742. * func(null);
  15743. * // => false
  15744. *
  15745. * func(NaN);
  15746. * // => false
  15747. */
  15748. var overEvery = createOver(arrayEvery);
  15749. /**
  15750. * Creates a function that checks if **any** of the `predicates` return
  15751. * truthy when invoked with the arguments it receives.
  15752. *
  15753. * @static
  15754. * @memberOf _
  15755. * @since 4.0.0
  15756. * @category Util
  15757. * @param {...(Function|Function[])} [predicates=[_.identity]]
  15758. * The predicates to check.
  15759. * @returns {Function} Returns the new function.
  15760. * @example
  15761. *
  15762. * var func = _.overSome([Boolean, isFinite]);
  15763. *
  15764. * func('1');
  15765. * // => true
  15766. *
  15767. * func(null);
  15768. * // => true
  15769. *
  15770. * func(NaN);
  15771. * // => false
  15772. */
  15773. var overSome = createOver(arraySome);
  15774. /**
  15775. * Creates a function that returns the value at `path` of a given object.
  15776. *
  15777. * @static
  15778. * @memberOf _
  15779. * @since 2.4.0
  15780. * @category Util
  15781. * @param {Array|string} path The path of the property to get.
  15782. * @returns {Function} Returns the new accessor function.
  15783. * @example
  15784. *
  15785. * var objects = [
  15786. * { 'a': { 'b': 2 } },
  15787. * { 'a': { 'b': 1 } }
  15788. * ];
  15789. *
  15790. * _.map(objects, _.property('a.b'));
  15791. * // => [2, 1]
  15792. *
  15793. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  15794. * // => [1, 2]
  15795. */
  15796. function property(path) {
  15797. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  15798. }
  15799. /**
  15800. * The opposite of `_.property`; this method creates a function that returns
  15801. * the value at a given path of `object`.
  15802. *
  15803. * @static
  15804. * @memberOf _
  15805. * @since 3.0.0
  15806. * @category Util
  15807. * @param {Object} object The object to query.
  15808. * @returns {Function} Returns the new accessor function.
  15809. * @example
  15810. *
  15811. * var array = [0, 1, 2],
  15812. * object = { 'a': array, 'b': array, 'c': array };
  15813. *
  15814. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  15815. * // => [2, 0]
  15816. *
  15817. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  15818. * // => [2, 0]
  15819. */
  15820. function propertyOf(object) {
  15821. return function(path) {
  15822. return object == null ? undefined : baseGet(object, path);
  15823. };
  15824. }
  15825. /**
  15826. * Creates an array of numbers (positive and/or negative) progressing from
  15827. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  15828. * `start` is specified without an `end` or `step`. If `end` is not specified,
  15829. * it's set to `start` with `start` then set to `0`.
  15830. *
  15831. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  15832. * floating-point values which can produce unexpected results.
  15833. *
  15834. * @static
  15835. * @since 0.1.0
  15836. * @memberOf _
  15837. * @category Util
  15838. * @param {number} [start=0] The start of the range.
  15839. * @param {number} end The end of the range.
  15840. * @param {number} [step=1] The value to increment or decrement by.
  15841. * @returns {Array} Returns the range of numbers.
  15842. * @see _.inRange, _.rangeRight
  15843. * @example
  15844. *
  15845. * _.range(4);
  15846. * // => [0, 1, 2, 3]
  15847. *
  15848. * _.range(-4);
  15849. * // => [0, -1, -2, -3]
  15850. *
  15851. * _.range(1, 5);
  15852. * // => [1, 2, 3, 4]
  15853. *
  15854. * _.range(0, 20, 5);
  15855. * // => [0, 5, 10, 15]
  15856. *
  15857. * _.range(0, -4, -1);
  15858. * // => [0, -1, -2, -3]
  15859. *
  15860. * _.range(1, 4, 0);
  15861. * // => [1, 1, 1]
  15862. *
  15863. * _.range(0);
  15864. * // => []
  15865. */
  15866. var range = createRange();
  15867. /**
  15868. * This method is like `_.range` except that it populates values in
  15869. * descending order.
  15870. *
  15871. * @static
  15872. * @memberOf _
  15873. * @since 4.0.0
  15874. * @category Util
  15875. * @param {number} [start=0] The start of the range.
  15876. * @param {number} end The end of the range.
  15877. * @param {number} [step=1] The value to increment or decrement by.
  15878. * @returns {Array} Returns the range of numbers.
  15879. * @see _.inRange, _.range
  15880. * @example
  15881. *
  15882. * _.rangeRight(4);
  15883. * // => [3, 2, 1, 0]
  15884. *
  15885. * _.rangeRight(-4);
  15886. * // => [-3, -2, -1, 0]
  15887. *
  15888. * _.rangeRight(1, 5);
  15889. * // => [4, 3, 2, 1]
  15890. *
  15891. * _.rangeRight(0, 20, 5);
  15892. * // => [15, 10, 5, 0]
  15893. *
  15894. * _.rangeRight(0, -4, -1);
  15895. * // => [-3, -2, -1, 0]
  15896. *
  15897. * _.rangeRight(1, 4, 0);
  15898. * // => [1, 1, 1]
  15899. *
  15900. * _.rangeRight(0);
  15901. * // => []
  15902. */
  15903. var rangeRight = createRange(true);
  15904. /**
  15905. * This method returns a new empty array.
  15906. *
  15907. * @static
  15908. * @memberOf _
  15909. * @since 4.13.0
  15910. * @category Util
  15911. * @returns {Array} Returns the new empty array.
  15912. * @example
  15913. *
  15914. * var arrays = _.times(2, _.stubArray);
  15915. *
  15916. * console.log(arrays);
  15917. * // => [[], []]
  15918. *
  15919. * console.log(arrays[0] === arrays[1]);
  15920. * // => false
  15921. */
  15922. function stubArray() {
  15923. return [];
  15924. }
  15925. /**
  15926. * This method returns `false`.
  15927. *
  15928. * @static
  15929. * @memberOf _
  15930. * @since 4.13.0
  15931. * @category Util
  15932. * @returns {boolean} Returns `false`.
  15933. * @example
  15934. *
  15935. * _.times(2, _.stubFalse);
  15936. * // => [false, false]
  15937. */
  15938. function stubFalse() {
  15939. return false;
  15940. }
  15941. /**
  15942. * This method returns a new empty object.
  15943. *
  15944. * @static
  15945. * @memberOf _
  15946. * @since 4.13.0
  15947. * @category Util
  15948. * @returns {Object} Returns the new empty object.
  15949. * @example
  15950. *
  15951. * var objects = _.times(2, _.stubObject);
  15952. *
  15953. * console.log(objects);
  15954. * // => [{}, {}]
  15955. *
  15956. * console.log(objects[0] === objects[1]);
  15957. * // => false
  15958. */
  15959. function stubObject() {
  15960. return {};
  15961. }
  15962. /**
  15963. * This method returns an empty string.
  15964. *
  15965. * @static
  15966. * @memberOf _
  15967. * @since 4.13.0
  15968. * @category Util
  15969. * @returns {string} Returns the empty string.
  15970. * @example
  15971. *
  15972. * _.times(2, _.stubString);
  15973. * // => ['', '']
  15974. */
  15975. function stubString() {
  15976. return '';
  15977. }
  15978. /**
  15979. * This method returns `true`.
  15980. *
  15981. * @static
  15982. * @memberOf _
  15983. * @since 4.13.0
  15984. * @category Util
  15985. * @returns {boolean} Returns `true`.
  15986. * @example
  15987. *
  15988. * _.times(2, _.stubTrue);
  15989. * // => [true, true]
  15990. */
  15991. function stubTrue() {
  15992. return true;
  15993. }
  15994. /**
  15995. * Invokes the iteratee `n` times, returning an array of the results of
  15996. * each invocation. The iteratee is invoked with one argument; (index).
  15997. *
  15998. * @static
  15999. * @since 0.1.0
  16000. * @memberOf _
  16001. * @category Util
  16002. * @param {number} n The number of times to invoke `iteratee`.
  16003. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  16004. * @returns {Array} Returns the array of results.
  16005. * @example
  16006. *
  16007. * _.times(3, String);
  16008. * // => ['0', '1', '2']
  16009. *
  16010. * _.times(4, _.constant(0));
  16011. * // => [0, 0, 0, 0]
  16012. */
  16013. function times(n, iteratee) {
  16014. n = toInteger(n);
  16015. if (n < 1 || n > MAX_SAFE_INTEGER) {
  16016. return [];
  16017. }
  16018. var index = MAX_ARRAY_LENGTH,
  16019. length = nativeMin(n, MAX_ARRAY_LENGTH);
  16020. iteratee = getIteratee(iteratee);
  16021. n -= MAX_ARRAY_LENGTH;
  16022. var result = baseTimes(length, iteratee);
  16023. while (++index < n) {
  16024. iteratee(index);
  16025. }
  16026. return result;
  16027. }
  16028. /**
  16029. * Converts `value` to a property path array.
  16030. *
  16031. * @static
  16032. * @memberOf _
  16033. * @since 4.0.0
  16034. * @category Util
  16035. * @param {*} value The value to convert.
  16036. * @returns {Array} Returns the new property path array.
  16037. * @example
  16038. *
  16039. * _.toPath('a.b.c');
  16040. * // => ['a', 'b', 'c']
  16041. *
  16042. * _.toPath('a[0].b.c');
  16043. * // => ['a', '0', 'b', 'c']
  16044. */
  16045. function toPath(value) {
  16046. if (isArray(value)) {
  16047. return arrayMap(value, toKey);
  16048. }
  16049. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  16050. }
  16051. /**
  16052. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  16053. *
  16054. * @static
  16055. * @since 0.1.0
  16056. * @memberOf _
  16057. * @category Util
  16058. * @param {string} [prefix=''] The value to prefix the ID with.
  16059. * @returns {string} Returns the unique ID.
  16060. * @example
  16061. *
  16062. * _.uniqueId('contact_');
  16063. * // => 'contact_104'
  16064. *
  16065. * _.uniqueId();
  16066. * // => '105'
  16067. */
  16068. function uniqueId(prefix) {
  16069. var id = ++idCounter;
  16070. return toString(prefix) + id;
  16071. }
  16072. /*------------------------------------------------------------------------*/
  16073. /**
  16074. * Adds two numbers.
  16075. *
  16076. * @static
  16077. * @memberOf _
  16078. * @since 3.4.0
  16079. * @category Math
  16080. * @param {number} augend The first number in an addition.
  16081. * @param {number} addend The second number in an addition.
  16082. * @returns {number} Returns the total.
  16083. * @example
  16084. *
  16085. * _.add(6, 4);
  16086. * // => 10
  16087. */
  16088. var add = createMathOperation(function(augend, addend) {
  16089. return augend + addend;
  16090. }, 0);
  16091. /**
  16092. * Computes `number` rounded up to `precision`.
  16093. *
  16094. * @static
  16095. * @memberOf _
  16096. * @since 3.10.0
  16097. * @category Math
  16098. * @param {number} number The number to round up.
  16099. * @param {number} [precision=0] The precision to round up to.
  16100. * @returns {number} Returns the rounded up number.
  16101. * @example
  16102. *
  16103. * _.ceil(4.006);
  16104. * // => 5
  16105. *
  16106. * _.ceil(6.004, 2);
  16107. * // => 6.01
  16108. *
  16109. * _.ceil(6040, -2);
  16110. * // => 6100
  16111. */
  16112. var ceil = createRound('ceil');
  16113. /**
  16114. * Divide two numbers.
  16115. *
  16116. * @static
  16117. * @memberOf _
  16118. * @since 4.7.0
  16119. * @category Math
  16120. * @param {number} dividend The first number in a division.
  16121. * @param {number} divisor The second number in a division.
  16122. * @returns {number} Returns the quotient.
  16123. * @example
  16124. *
  16125. * _.divide(6, 4);
  16126. * // => 1.5
  16127. */
  16128. var divide = createMathOperation(function(dividend, divisor) {
  16129. return dividend / divisor;
  16130. }, 1);
  16131. /**
  16132. * Computes `number` rounded down to `precision`.
  16133. *
  16134. * @static
  16135. * @memberOf _
  16136. * @since 3.10.0
  16137. * @category Math
  16138. * @param {number} number The number to round down.
  16139. * @param {number} [precision=0] The precision to round down to.
  16140. * @returns {number} Returns the rounded down number.
  16141. * @example
  16142. *
  16143. * _.floor(4.006);
  16144. * // => 4
  16145. *
  16146. * _.floor(0.046, 2);
  16147. * // => 0.04
  16148. *
  16149. * _.floor(4060, -2);
  16150. * // => 4000
  16151. */
  16152. var floor = createRound('floor');
  16153. /**
  16154. * Computes the maximum value of `array`. If `array` is empty or falsey,
  16155. * `undefined` is returned.
  16156. *
  16157. * @static
  16158. * @since 0.1.0
  16159. * @memberOf _
  16160. * @category Math
  16161. * @param {Array} array The array to iterate over.
  16162. * @returns {*} Returns the maximum value.
  16163. * @example
  16164. *
  16165. * _.max([4, 2, 8, 6]);
  16166. * // => 8
  16167. *
  16168. * _.max([]);
  16169. * // => undefined
  16170. */
  16171. function max(array) {
  16172. return (array && array.length)
  16173. ? baseExtremum(array, identity, baseGt)
  16174. : undefined;
  16175. }
  16176. /**
  16177. * This method is like `_.max` except that it accepts `iteratee` which is
  16178. * invoked for each element in `array` to generate the criterion by which
  16179. * the value is ranked. The iteratee is invoked with one argument: (value).
  16180. *
  16181. * @static
  16182. * @memberOf _
  16183. * @since 4.0.0
  16184. * @category Math
  16185. * @param {Array} array The array to iterate over.
  16186. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16187. * @returns {*} Returns the maximum value.
  16188. * @example
  16189. *
  16190. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  16191. *
  16192. * _.maxBy(objects, function(o) { return o.n; });
  16193. * // => { 'n': 2 }
  16194. *
  16195. * // The `_.property` iteratee shorthand.
  16196. * _.maxBy(objects, 'n');
  16197. * // => { 'n': 2 }
  16198. */
  16199. function maxBy(array, iteratee) {
  16200. return (array && array.length)
  16201. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  16202. : undefined;
  16203. }
  16204. /**
  16205. * Computes the mean of the values in `array`.
  16206. *
  16207. * @static
  16208. * @memberOf _
  16209. * @since 4.0.0
  16210. * @category Math
  16211. * @param {Array} array The array to iterate over.
  16212. * @returns {number} Returns the mean.
  16213. * @example
  16214. *
  16215. * _.mean([4, 2, 8, 6]);
  16216. * // => 5
  16217. */
  16218. function mean(array) {
  16219. return baseMean(array, identity);
  16220. }
  16221. /**
  16222. * This method is like `_.mean` except that it accepts `iteratee` which is
  16223. * invoked for each element in `array` to generate the value to be averaged.
  16224. * The iteratee is invoked with one argument: (value).
  16225. *
  16226. * @static
  16227. * @memberOf _
  16228. * @since 4.7.0
  16229. * @category Math
  16230. * @param {Array} array The array to iterate over.
  16231. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16232. * @returns {number} Returns the mean.
  16233. * @example
  16234. *
  16235. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  16236. *
  16237. * _.meanBy(objects, function(o) { return o.n; });
  16238. * // => 5
  16239. *
  16240. * // The `_.property` iteratee shorthand.
  16241. * _.meanBy(objects, 'n');
  16242. * // => 5
  16243. */
  16244. function meanBy(array, iteratee) {
  16245. return baseMean(array, getIteratee(iteratee, 2));
  16246. }
  16247. /**
  16248. * Computes the minimum value of `array`. If `array` is empty or falsey,
  16249. * `undefined` is returned.
  16250. *
  16251. * @static
  16252. * @since 0.1.0
  16253. * @memberOf _
  16254. * @category Math
  16255. * @param {Array} array The array to iterate over.
  16256. * @returns {*} Returns the minimum value.
  16257. * @example
  16258. *
  16259. * _.min([4, 2, 8, 6]);
  16260. * // => 2
  16261. *
  16262. * _.min([]);
  16263. * // => undefined
  16264. */
  16265. function min(array) {
  16266. return (array && array.length)
  16267. ? baseExtremum(array, identity, baseLt)
  16268. : undefined;
  16269. }
  16270. /**
  16271. * This method is like `_.min` except that it accepts `iteratee` which is
  16272. * invoked for each element in `array` to generate the criterion by which
  16273. * the value is ranked. The iteratee is invoked with one argument: (value).
  16274. *
  16275. * @static
  16276. * @memberOf _
  16277. * @since 4.0.0
  16278. * @category Math
  16279. * @param {Array} array The array to iterate over.
  16280. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16281. * @returns {*} Returns the minimum value.
  16282. * @example
  16283. *
  16284. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  16285. *
  16286. * _.minBy(objects, function(o) { return o.n; });
  16287. * // => { 'n': 1 }
  16288. *
  16289. * // The `_.property` iteratee shorthand.
  16290. * _.minBy(objects, 'n');
  16291. * // => { 'n': 1 }
  16292. */
  16293. function minBy(array, iteratee) {
  16294. return (array && array.length)
  16295. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  16296. : undefined;
  16297. }
  16298. /**
  16299. * Multiply two numbers.
  16300. *
  16301. * @static
  16302. * @memberOf _
  16303. * @since 4.7.0
  16304. * @category Math
  16305. * @param {number} multiplier The first number in a multiplication.
  16306. * @param {number} multiplicand The second number in a multiplication.
  16307. * @returns {number} Returns the product.
  16308. * @example
  16309. *
  16310. * _.multiply(6, 4);
  16311. * // => 24
  16312. */
  16313. var multiply = createMathOperation(function(multiplier, multiplicand) {
  16314. return multiplier * multiplicand;
  16315. }, 1);
  16316. /**
  16317. * Computes `number` rounded to `precision`.
  16318. *
  16319. * @static
  16320. * @memberOf _
  16321. * @since 3.10.0
  16322. * @category Math
  16323. * @param {number} number The number to round.
  16324. * @param {number} [precision=0] The precision to round to.
  16325. * @returns {number} Returns the rounded number.
  16326. * @example
  16327. *
  16328. * _.round(4.006);
  16329. * // => 4
  16330. *
  16331. * _.round(4.006, 2);
  16332. * // => 4.01
  16333. *
  16334. * _.round(4060, -2);
  16335. * // => 4100
  16336. */
  16337. var round = createRound('round');
  16338. /**
  16339. * Subtract two numbers.
  16340. *
  16341. * @static
  16342. * @memberOf _
  16343. * @since 4.0.0
  16344. * @category Math
  16345. * @param {number} minuend The first number in a subtraction.
  16346. * @param {number} subtrahend The second number in a subtraction.
  16347. * @returns {number} Returns the difference.
  16348. * @example
  16349. *
  16350. * _.subtract(6, 4);
  16351. * // => 2
  16352. */
  16353. var subtract = createMathOperation(function(minuend, subtrahend) {
  16354. return minuend - subtrahend;
  16355. }, 0);
  16356. /**
  16357. * Computes the sum of the values in `array`.
  16358. *
  16359. * @static
  16360. * @memberOf _
  16361. * @since 3.4.0
  16362. * @category Math
  16363. * @param {Array} array The array to iterate over.
  16364. * @returns {number} Returns the sum.
  16365. * @example
  16366. *
  16367. * _.sum([4, 2, 8, 6]);
  16368. * // => 20
  16369. */
  16370. function sum(array) {
  16371. return (array && array.length)
  16372. ? baseSum(array, identity)
  16373. : 0;
  16374. }
  16375. /**
  16376. * This method is like `_.sum` except that it accepts `iteratee` which is
  16377. * invoked for each element in `array` to generate the value to be summed.
  16378. * The iteratee is invoked with one argument: (value).
  16379. *
  16380. * @static
  16381. * @memberOf _
  16382. * @since 4.0.0
  16383. * @category Math
  16384. * @param {Array} array The array to iterate over.
  16385. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16386. * @returns {number} Returns the sum.
  16387. * @example
  16388. *
  16389. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  16390. *
  16391. * _.sumBy(objects, function(o) { return o.n; });
  16392. * // => 20
  16393. *
  16394. * // The `_.property` iteratee shorthand.
  16395. * _.sumBy(objects, 'n');
  16396. * // => 20
  16397. */
  16398. function sumBy(array, iteratee) {
  16399. return (array && array.length)
  16400. ? baseSum(array, getIteratee(iteratee, 2))
  16401. : 0;
  16402. }
  16403. /*------------------------------------------------------------------------*/
  16404. // Add methods that return wrapped values in chain sequences.
  16405. lodash.after = after;
  16406. lodash.ary = ary;
  16407. lodash.assign = assign;
  16408. lodash.assignIn = assignIn;
  16409. lodash.assignInWith = assignInWith;
  16410. lodash.assignWith = assignWith;
  16411. lodash.at = at;
  16412. lodash.before = before;
  16413. lodash.bind = bind;
  16414. lodash.bindAll = bindAll;
  16415. lodash.bindKey = bindKey;
  16416. lodash.castArray = castArray;
  16417. lodash.chain = chain;
  16418. lodash.chunk = chunk;
  16419. lodash.compact = compact;
  16420. lodash.concat = concat;
  16421. lodash.cond = cond;
  16422. lodash.conforms = conforms;
  16423. lodash.constant = constant;
  16424. lodash.countBy = countBy;
  16425. lodash.create = create;
  16426. lodash.curry = curry;
  16427. lodash.curryRight = curryRight;
  16428. lodash.debounce = debounce;
  16429. lodash.defaults = defaults;
  16430. lodash.defaultsDeep = defaultsDeep;
  16431. lodash.defer = defer;
  16432. lodash.delay = delay;
  16433. lodash.difference = difference;
  16434. lodash.differenceBy = differenceBy;
  16435. lodash.differenceWith = differenceWith;
  16436. lodash.drop = drop;
  16437. lodash.dropRight = dropRight;
  16438. lodash.dropRightWhile = dropRightWhile;
  16439. lodash.dropWhile = dropWhile;
  16440. lodash.fill = fill;
  16441. lodash.filter = filter;
  16442. lodash.flatMap = flatMap;
  16443. lodash.flatMapDeep = flatMapDeep;
  16444. lodash.flatMapDepth = flatMapDepth;
  16445. lodash.flatten = flatten;
  16446. lodash.flattenDeep = flattenDeep;
  16447. lodash.flattenDepth = flattenDepth;
  16448. lodash.flip = flip;
  16449. lodash.flow = flow;
  16450. lodash.flowRight = flowRight;
  16451. lodash.fromPairs = fromPairs;
  16452. lodash.functions = functions;
  16453. lodash.functionsIn = functionsIn;
  16454. lodash.groupBy = groupBy;
  16455. lodash.initial = initial;
  16456. lodash.intersection = intersection;
  16457. lodash.intersectionBy = intersectionBy;
  16458. lodash.intersectionWith = intersectionWith;
  16459. lodash.invert = invert;
  16460. lodash.invertBy = invertBy;
  16461. lodash.invokeMap = invokeMap;
  16462. lodash.iteratee = iteratee;
  16463. lodash.keyBy = keyBy;
  16464. lodash.keys = keys;
  16465. lodash.keysIn = keysIn;
  16466. lodash.map = map;
  16467. lodash.mapKeys = mapKeys;
  16468. lodash.mapValues = mapValues;
  16469. lodash.matches = matches;
  16470. lodash.matchesProperty = matchesProperty;
  16471. lodash.memoize = memoize;
  16472. lodash.merge = merge;
  16473. lodash.mergeWith = mergeWith;
  16474. lodash.method = method;
  16475. lodash.methodOf = methodOf;
  16476. lodash.mixin = mixin;
  16477. lodash.negate = negate;
  16478. lodash.nthArg = nthArg;
  16479. lodash.omit = omit;
  16480. lodash.omitBy = omitBy;
  16481. lodash.once = once;
  16482. lodash.orderBy = orderBy;
  16483. lodash.over = over;
  16484. lodash.overArgs = overArgs;
  16485. lodash.overEvery = overEvery;
  16486. lodash.overSome = overSome;
  16487. lodash.partial = partial;
  16488. lodash.partialRight = partialRight;
  16489. lodash.partition = partition;
  16490. lodash.pick = pick;
  16491. lodash.pickBy = pickBy;
  16492. lodash.property = property;
  16493. lodash.propertyOf = propertyOf;
  16494. lodash.pull = pull;
  16495. lodash.pullAll = pullAll;
  16496. lodash.pullAllBy = pullAllBy;
  16497. lodash.pullAllWith = pullAllWith;
  16498. lodash.pullAt = pullAt;
  16499. lodash.range = range;
  16500. lodash.rangeRight = rangeRight;
  16501. lodash.rearg = rearg;
  16502. lodash.reject = reject;
  16503. lodash.remove = remove;
  16504. lodash.rest = rest;
  16505. lodash.reverse = reverse;
  16506. lodash.sampleSize = sampleSize;
  16507. lodash.set = set;
  16508. lodash.setWith = setWith;
  16509. lodash.shuffle = shuffle;
  16510. lodash.slice = slice;
  16511. lodash.sortBy = sortBy;
  16512. lodash.sortedUniq = sortedUniq;
  16513. lodash.sortedUniqBy = sortedUniqBy;
  16514. lodash.split = split;
  16515. lodash.spread = spread;
  16516. lodash.tail = tail;
  16517. lodash.take = take;
  16518. lodash.takeRight = takeRight;
  16519. lodash.takeRightWhile = takeRightWhile;
  16520. lodash.takeWhile = takeWhile;
  16521. lodash.tap = tap;
  16522. lodash.throttle = throttle;
  16523. lodash.thru = thru;
  16524. lodash.toArray = toArray;
  16525. lodash.toPairs = toPairs;
  16526. lodash.toPairsIn = toPairsIn;
  16527. lodash.toPath = toPath;
  16528. lodash.toPlainObject = toPlainObject;
  16529. lodash.transform = transform;
  16530. lodash.unary = unary;
  16531. lodash.union = union;
  16532. lodash.unionBy = unionBy;
  16533. lodash.unionWith = unionWith;
  16534. lodash.uniq = uniq;
  16535. lodash.uniqBy = uniqBy;
  16536. lodash.uniqWith = uniqWith;
  16537. lodash.unset = unset;
  16538. lodash.unzip = unzip;
  16539. lodash.unzipWith = unzipWith;
  16540. lodash.update = update;
  16541. lodash.updateWith = updateWith;
  16542. lodash.values = values;
  16543. lodash.valuesIn = valuesIn;
  16544. lodash.without = without;
  16545. lodash.words = words;
  16546. lodash.wrap = wrap;
  16547. lodash.xor = xor;
  16548. lodash.xorBy = xorBy;
  16549. lodash.xorWith = xorWith;
  16550. lodash.zip = zip;
  16551. lodash.zipObject = zipObject;
  16552. lodash.zipObjectDeep = zipObjectDeep;
  16553. lodash.zipWith = zipWith;
  16554. // Add aliases.
  16555. lodash.entries = toPairs;
  16556. lodash.entriesIn = toPairsIn;
  16557. lodash.extend = assignIn;
  16558. lodash.extendWith = assignInWith;
  16559. // Add methods to `lodash.prototype`.
  16560. mixin(lodash, lodash);
  16561. /*------------------------------------------------------------------------*/
  16562. // Add methods that return unwrapped values in chain sequences.
  16563. lodash.add = add;
  16564. lodash.attempt = attempt;
  16565. lodash.camelCase = camelCase;
  16566. lodash.capitalize = capitalize;
  16567. lodash.ceil = ceil;
  16568. lodash.clamp = clamp;
  16569. lodash.clone = clone;
  16570. lodash.cloneDeep = cloneDeep;
  16571. lodash.cloneDeepWith = cloneDeepWith;
  16572. lodash.cloneWith = cloneWith;
  16573. lodash.conformsTo = conformsTo;
  16574. lodash.deburr = deburr;
  16575. lodash.defaultTo = defaultTo;
  16576. lodash.divide = divide;
  16577. lodash.endsWith = endsWith;
  16578. lodash.eq = eq;
  16579. lodash.escape = escape;
  16580. lodash.escapeRegExp = escapeRegExp;
  16581. lodash.every = every;
  16582. lodash.find = find;
  16583. lodash.findIndex = findIndex;
  16584. lodash.findKey = findKey;
  16585. lodash.findLast = findLast;
  16586. lodash.findLastIndex = findLastIndex;
  16587. lodash.findLastKey = findLastKey;
  16588. lodash.floor = floor;
  16589. lodash.forEach = forEach;
  16590. lodash.forEachRight = forEachRight;
  16591. lodash.forIn = forIn;
  16592. lodash.forInRight = forInRight;
  16593. lodash.forOwn = forOwn;
  16594. lodash.forOwnRight = forOwnRight;
  16595. lodash.get = get;
  16596. lodash.gt = gt;
  16597. lodash.gte = gte;
  16598. lodash.has = has;
  16599. lodash.hasIn = hasIn;
  16600. lodash.head = head;
  16601. lodash.identity = identity;
  16602. lodash.includes = includes;
  16603. lodash.indexOf = indexOf;
  16604. lodash.inRange = inRange;
  16605. lodash.invoke = invoke;
  16606. lodash.isArguments = isArguments;
  16607. lodash.isArray = isArray;
  16608. lodash.isArrayBuffer = isArrayBuffer;
  16609. lodash.isArrayLike = isArrayLike;
  16610. lodash.isArrayLikeObject = isArrayLikeObject;
  16611. lodash.isBoolean = isBoolean;
  16612. lodash.isBuffer = isBuffer;
  16613. lodash.isDate = isDate;
  16614. lodash.isElement = isElement;
  16615. lodash.isEmpty = isEmpty;
  16616. lodash.isEqual = isEqual;
  16617. lodash.isEqualWith = isEqualWith;
  16618. lodash.isError = isError;
  16619. lodash.isFinite = isFinite;
  16620. lodash.isFunction = isFunction;
  16621. lodash.isInteger = isInteger;
  16622. lodash.isLength = isLength;
  16623. lodash.isMap = isMap;
  16624. lodash.isMatch = isMatch;
  16625. lodash.isMatchWith = isMatchWith;
  16626. lodash.isNaN = isNaN;
  16627. lodash.isNative = isNative;
  16628. lodash.isNil = isNil;
  16629. lodash.isNull = isNull;
  16630. lodash.isNumber = isNumber;
  16631. lodash.isObject = isObject;
  16632. lodash.isObjectLike = isObjectLike;
  16633. lodash.isPlainObject = isPlainObject;
  16634. lodash.isRegExp = isRegExp;
  16635. lodash.isSafeInteger = isSafeInteger;
  16636. lodash.isSet = isSet;
  16637. lodash.isString = isString;
  16638. lodash.isSymbol = isSymbol;
  16639. lodash.isTypedArray = isTypedArray;
  16640. lodash.isUndefined = isUndefined;
  16641. lodash.isWeakMap = isWeakMap;
  16642. lodash.isWeakSet = isWeakSet;
  16643. lodash.join = join;
  16644. lodash.kebabCase = kebabCase;
  16645. lodash.last = last;
  16646. lodash.lastIndexOf = lastIndexOf;
  16647. lodash.lowerCase = lowerCase;
  16648. lodash.lowerFirst = lowerFirst;
  16649. lodash.lt = lt;
  16650. lodash.lte = lte;
  16651. lodash.max = max;
  16652. lodash.maxBy = maxBy;
  16653. lodash.mean = mean;
  16654. lodash.meanBy = meanBy;
  16655. lodash.min = min;
  16656. lodash.minBy = minBy;
  16657. lodash.stubArray = stubArray;
  16658. lodash.stubFalse = stubFalse;
  16659. lodash.stubObject = stubObject;
  16660. lodash.stubString = stubString;
  16661. lodash.stubTrue = stubTrue;
  16662. lodash.multiply = multiply;
  16663. lodash.nth = nth;
  16664. lodash.noConflict = noConflict;
  16665. lodash.noop = noop;
  16666. lodash.now = now;
  16667. lodash.pad = pad;
  16668. lodash.padEnd = padEnd;
  16669. lodash.padStart = padStart;
  16670. lodash.parseInt = parseInt;
  16671. lodash.random = random;
  16672. lodash.reduce = reduce;
  16673. lodash.reduceRight = reduceRight;
  16674. lodash.repeat = repeat;
  16675. lodash.replace = replace;
  16676. lodash.result = result;
  16677. lodash.round = round;
  16678. lodash.runInContext = runInContext;
  16679. lodash.sample = sample;
  16680. lodash.size = size;
  16681. lodash.snakeCase = snakeCase;
  16682. lodash.some = some;
  16683. lodash.sortedIndex = sortedIndex;
  16684. lodash.sortedIndexBy = sortedIndexBy;
  16685. lodash.sortedIndexOf = sortedIndexOf;
  16686. lodash.sortedLastIndex = sortedLastIndex;
  16687. lodash.sortedLastIndexBy = sortedLastIndexBy;
  16688. lodash.sortedLastIndexOf = sortedLastIndexOf;
  16689. lodash.startCase = startCase;
  16690. lodash.startsWith = startsWith;
  16691. lodash.subtract = subtract;
  16692. lodash.sum = sum;
  16693. lodash.sumBy = sumBy;
  16694. lodash.template = template;
  16695. lodash.times = times;
  16696. lodash.toFinite = toFinite;
  16697. lodash.toInteger = toInteger;
  16698. lodash.toLength = toLength;
  16699. lodash.toLower = toLower;
  16700. lodash.toNumber = toNumber;
  16701. lodash.toSafeInteger = toSafeInteger;
  16702. lodash.toString = toString;
  16703. lodash.toUpper = toUpper;
  16704. lodash.trim = trim;
  16705. lodash.trimEnd = trimEnd;
  16706. lodash.trimStart = trimStart;
  16707. lodash.truncate = truncate;
  16708. lodash.unescape = unescape;
  16709. lodash.uniqueId = uniqueId;
  16710. lodash.upperCase = upperCase;
  16711. lodash.upperFirst = upperFirst;
  16712. // Add aliases.
  16713. lodash.each = forEach;
  16714. lodash.eachRight = forEachRight;
  16715. lodash.first = head;
  16716. mixin(lodash, (function() {
  16717. var source = {};
  16718. baseForOwn(lodash, function(func, methodName) {
  16719. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  16720. source[methodName] = func;
  16721. }
  16722. });
  16723. return source;
  16724. }()), { 'chain': false });
  16725. /*------------------------------------------------------------------------*/
  16726. /**
  16727. * The semantic version number.
  16728. *
  16729. * @static
  16730. * @memberOf _
  16731. * @type {string}
  16732. */
  16733. lodash.VERSION = VERSION;
  16734. // Assign default placeholders.
  16735. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  16736. lodash[methodName].placeholder = lodash;
  16737. });
  16738. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  16739. arrayEach(['drop', 'take'], function(methodName, index) {
  16740. LazyWrapper.prototype[methodName] = function(n) {
  16741. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  16742. var result = (this.__filtered__ && !index)
  16743. ? new LazyWrapper(this)
  16744. : this.clone();
  16745. if (result.__filtered__) {
  16746. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  16747. } else {
  16748. result.__views__.push({
  16749. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  16750. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  16751. });
  16752. }
  16753. return result;
  16754. };
  16755. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  16756. return this.reverse()[methodName](n).reverse();
  16757. };
  16758. });
  16759. // Add `LazyWrapper` methods that accept an `iteratee` value.
  16760. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  16761. var type = index + 1,
  16762. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  16763. LazyWrapper.prototype[methodName] = function(iteratee) {
  16764. var result = this.clone();
  16765. result.__iteratees__.push({
  16766. 'iteratee': getIteratee(iteratee, 3),
  16767. 'type': type
  16768. });
  16769. result.__filtered__ = result.__filtered__ || isFilter;
  16770. return result;
  16771. };
  16772. });
  16773. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  16774. arrayEach(['head', 'last'], function(methodName, index) {
  16775. var takeName = 'take' + (index ? 'Right' : '');
  16776. LazyWrapper.prototype[methodName] = function() {
  16777. return this[takeName](1).value()[0];
  16778. };
  16779. });
  16780. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  16781. arrayEach(['initial', 'tail'], function(methodName, index) {
  16782. var dropName = 'drop' + (index ? '' : 'Right');
  16783. LazyWrapper.prototype[methodName] = function() {
  16784. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  16785. };
  16786. });
  16787. LazyWrapper.prototype.compact = function() {
  16788. return this.filter(identity);
  16789. };
  16790. LazyWrapper.prototype.find = function(predicate) {
  16791. return this.filter(predicate).head();
  16792. };
  16793. LazyWrapper.prototype.findLast = function(predicate) {
  16794. return this.reverse().find(predicate);
  16795. };
  16796. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  16797. if (typeof path == 'function') {
  16798. return new LazyWrapper(this);
  16799. }
  16800. return this.map(function(value) {
  16801. return baseInvoke(value, path, args);
  16802. });
  16803. });
  16804. LazyWrapper.prototype.reject = function(predicate) {
  16805. return this.filter(negate(getIteratee(predicate)));
  16806. };
  16807. LazyWrapper.prototype.slice = function(start, end) {
  16808. start = toInteger(start);
  16809. var result = this;
  16810. if (result.__filtered__ && (start > 0 || end < 0)) {
  16811. return new LazyWrapper(result);
  16812. }
  16813. if (start < 0) {
  16814. result = result.takeRight(-start);
  16815. } else if (start) {
  16816. result = result.drop(start);
  16817. }
  16818. if (end !== undefined) {
  16819. end = toInteger(end);
  16820. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  16821. }
  16822. return result;
  16823. };
  16824. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  16825. return this.reverse().takeWhile(predicate).reverse();
  16826. };
  16827. LazyWrapper.prototype.toArray = function() {
  16828. return this.take(MAX_ARRAY_LENGTH);
  16829. };
  16830. // Add `LazyWrapper` methods to `lodash.prototype`.
  16831. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  16832. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  16833. isTaker = /^(?:head|last)$/.test(methodName),
  16834. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  16835. retUnwrapped = isTaker || /^find/.test(methodName);
  16836. if (!lodashFunc) {
  16837. return;
  16838. }
  16839. lodash.prototype[methodName] = function() {
  16840. var value = this.__wrapped__,
  16841. args = isTaker ? [1] : arguments,
  16842. isLazy = value instanceof LazyWrapper,
  16843. iteratee = args[0],
  16844. useLazy = isLazy || isArray(value);
  16845. var interceptor = function(value) {
  16846. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  16847. return (isTaker && chainAll) ? result[0] : result;
  16848. };
  16849. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  16850. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  16851. isLazy = useLazy = false;
  16852. }
  16853. var chainAll = this.__chain__,
  16854. isHybrid = !!this.__actions__.length,
  16855. isUnwrapped = retUnwrapped && !chainAll,
  16856. onlyLazy = isLazy && !isHybrid;
  16857. if (!retUnwrapped && useLazy) {
  16858. value = onlyLazy ? value : new LazyWrapper(this);
  16859. var result = func.apply(value, args);
  16860. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  16861. return new LodashWrapper(result, chainAll);
  16862. }
  16863. if (isUnwrapped && onlyLazy) {
  16864. return func.apply(this, args);
  16865. }
  16866. result = this.thru(interceptor);
  16867. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  16868. };
  16869. });
  16870. // Add `Array` methods to `lodash.prototype`.
  16871. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  16872. var func = arrayProto[methodName],
  16873. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  16874. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  16875. lodash.prototype[methodName] = function() {
  16876. var args = arguments;
  16877. if (retUnwrapped && !this.__chain__) {
  16878. var value = this.value();
  16879. return func.apply(isArray(value) ? value : [], args);
  16880. }
  16881. return this[chainName](function(value) {
  16882. return func.apply(isArray(value) ? value : [], args);
  16883. });
  16884. };
  16885. });
  16886. // Map minified method names to their real names.
  16887. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  16888. var lodashFunc = lodash[methodName];
  16889. if (lodashFunc) {
  16890. var key = (lodashFunc.name + ''),
  16891. names = realNames[key] || (realNames[key] = []);
  16892. names.push({ 'name': methodName, 'func': lodashFunc });
  16893. }
  16894. });
  16895. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  16896. 'name': 'wrapper',
  16897. 'func': undefined
  16898. }];
  16899. // Add methods to `LazyWrapper`.
  16900. LazyWrapper.prototype.clone = lazyClone;
  16901. LazyWrapper.prototype.reverse = lazyReverse;
  16902. LazyWrapper.prototype.value = lazyValue;
  16903. // Add chain sequence methods to the `lodash` wrapper.
  16904. lodash.prototype.at = wrapperAt;
  16905. lodash.prototype.chain = wrapperChain;
  16906. lodash.prototype.commit = wrapperCommit;
  16907. lodash.prototype.next = wrapperNext;
  16908. lodash.prototype.plant = wrapperPlant;
  16909. lodash.prototype.reverse = wrapperReverse;
  16910. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  16911. // Add lazy aliases.
  16912. lodash.prototype.first = lodash.prototype.head;
  16913. if (symIterator) {
  16914. lodash.prototype[symIterator] = wrapperToIterator;
  16915. }
  16916. return lodash;
  16917. });
  16918. /*--------------------------------------------------------------------------*/
  16919. // Export lodash.
  16920. var _ = runInContext();
  16921. // Some AMD build optimizers, like r.js, check for condition patterns like:
  16922. if (true) {
  16923. // Expose Lodash on the global object to prevent errors when Lodash is
  16924. // loaded by a script tag in the presence of an AMD loader.
  16925. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  16926. // Use `_.noConflict` to remove Lodash from the global object.
  16927. root._ = _;
  16928. // Define as an anonymous module so, through path mapping, it can be
  16929. // referenced as the "underscore" module.
  16930. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  16931. return _;
  16932. }).call(exports, __webpack_require__, exports, module),
  16933. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  16934. }
  16935. // Check for `exports` after `define` in case a build optimizer adds it.
  16936. else if (freeModule) {
  16937. // Export for Node.js.
  16938. (freeModule.exports = _)._ = _;
  16939. // Export for CommonJS support.
  16940. freeExports._ = _;
  16941. }
  16942. else {
  16943. // Export to the global object.
  16944. root._ = _;
  16945. }
  16946. }.call(this));
  16947. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(13)(module)))
  16948. /***/ }),
  16949. /* 13 */
  16950. /***/ (function(module, exports) {
  16951. module.exports = function(module) {
  16952. if(!module.webpackPolyfill) {
  16953. module.deprecate = function() {};
  16954. module.paths = [];
  16955. // module.parent = undefined by default
  16956. if(!module.children) module.children = [];
  16957. Object.defineProperty(module, "loaded", {
  16958. enumerable: true,
  16959. get: function() {
  16960. return module.l;
  16961. }
  16962. });
  16963. Object.defineProperty(module, "id", {
  16964. enumerable: true,
  16965. get: function() {
  16966. return module.i;
  16967. }
  16968. });
  16969. module.webpackPolyfill = 1;
  16970. }
  16971. return module;
  16972. };
  16973. /***/ }),
  16974. /* 14 */
  16975. /***/ (function(module, exports, __webpack_require__) {
  16976. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  16977. * jQuery JavaScript Library v3.3.1
  16978. * https://jquery.com/
  16979. *
  16980. * Includes Sizzle.js
  16981. * https://sizzlejs.com/
  16982. *
  16983. * Copyright JS Foundation and other contributors
  16984. * Released under the MIT license
  16985. * https://jquery.org/license
  16986. *
  16987. * Date: 2018-01-20T17:24Z
  16988. */
  16989. ( function( global, factory ) {
  16990. "use strict";
  16991. if ( typeof module === "object" && typeof module.exports === "object" ) {
  16992. // For CommonJS and CommonJS-like environments where a proper `window`
  16993. // is present, execute the factory and get jQuery.
  16994. // For environments that do not have a `window` with a `document`
  16995. // (such as Node.js), expose a factory as module.exports.
  16996. // This accentuates the need for the creation of a real `window`.
  16997. // e.g. var jQuery = require("jquery")(window);
  16998. // See ticket #14549 for more info.
  16999. module.exports = global.document ?
  17000. factory( global, true ) :
  17001. function( w ) {
  17002. if ( !w.document ) {
  17003. throw new Error( "jQuery requires a window with a document" );
  17004. }
  17005. return factory( w );
  17006. };
  17007. } else {
  17008. factory( global );
  17009. }
  17010. // Pass this if window is not defined yet
  17011. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  17012. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  17013. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  17014. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  17015. // enough that all such attempts are guarded in a try block.
  17016. "use strict";
  17017. var arr = [];
  17018. var document = window.document;
  17019. var getProto = Object.getPrototypeOf;
  17020. var slice = arr.slice;
  17021. var concat = arr.concat;
  17022. var push = arr.push;
  17023. var indexOf = arr.indexOf;
  17024. var class2type = {};
  17025. var toString = class2type.toString;
  17026. var hasOwn = class2type.hasOwnProperty;
  17027. var fnToString = hasOwn.toString;
  17028. var ObjectFunctionString = fnToString.call( Object );
  17029. var support = {};
  17030. var isFunction = function isFunction( obj ) {
  17031. // Support: Chrome <=57, Firefox <=52
  17032. // In some browsers, typeof returns "function" for HTML <object> elements
  17033. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  17034. // We don't want to classify *any* DOM node as a function.
  17035. return typeof obj === "function" && typeof obj.nodeType !== "number";
  17036. };
  17037. var isWindow = function isWindow( obj ) {
  17038. return obj != null && obj === obj.window;
  17039. };
  17040. var preservedScriptAttributes = {
  17041. type: true,
  17042. src: true,
  17043. noModule: true
  17044. };
  17045. function DOMEval( code, doc, node ) {
  17046. doc = doc || document;
  17047. var i,
  17048. script = doc.createElement( "script" );
  17049. script.text = code;
  17050. if ( node ) {
  17051. for ( i in preservedScriptAttributes ) {
  17052. if ( node[ i ] ) {
  17053. script[ i ] = node[ i ];
  17054. }
  17055. }
  17056. }
  17057. doc.head.appendChild( script ).parentNode.removeChild( script );
  17058. }
  17059. function toType( obj ) {
  17060. if ( obj == null ) {
  17061. return obj + "";
  17062. }
  17063. // Support: Android <=2.3 only (functionish RegExp)
  17064. return typeof obj === "object" || typeof obj === "function" ?
  17065. class2type[ toString.call( obj ) ] || "object" :
  17066. typeof obj;
  17067. }
  17068. /* global Symbol */
  17069. // Defining this global in .eslintrc.json would create a danger of using the global
  17070. // unguarded in another place, it seems safer to define global only for this module
  17071. var
  17072. version = "3.3.1",
  17073. // Define a local copy of jQuery
  17074. jQuery = function( selector, context ) {
  17075. // The jQuery object is actually just the init constructor 'enhanced'
  17076. // Need init if jQuery is called (just allow error to be thrown if not included)
  17077. return new jQuery.fn.init( selector, context );
  17078. },
  17079. // Support: Android <=4.0 only
  17080. // Make sure we trim BOM and NBSP
  17081. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  17082. jQuery.fn = jQuery.prototype = {
  17083. // The current version of jQuery being used
  17084. jquery: version,
  17085. constructor: jQuery,
  17086. // The default length of a jQuery object is 0
  17087. length: 0,
  17088. toArray: function() {
  17089. return slice.call( this );
  17090. },
  17091. // Get the Nth element in the matched element set OR
  17092. // Get the whole matched element set as a clean array
  17093. get: function( num ) {
  17094. // Return all the elements in a clean array
  17095. if ( num == null ) {
  17096. return slice.call( this );
  17097. }
  17098. // Return just the one element from the set
  17099. return num < 0 ? this[ num + this.length ] : this[ num ];
  17100. },
  17101. // Take an array of elements and push it onto the stack
  17102. // (returning the new matched element set)
  17103. pushStack: function( elems ) {
  17104. // Build a new jQuery matched element set
  17105. var ret = jQuery.merge( this.constructor(), elems );
  17106. // Add the old object onto the stack (as a reference)
  17107. ret.prevObject = this;
  17108. // Return the newly-formed element set
  17109. return ret;
  17110. },
  17111. // Execute a callback for every element in the matched set.
  17112. each: function( callback ) {
  17113. return jQuery.each( this, callback );
  17114. },
  17115. map: function( callback ) {
  17116. return this.pushStack( jQuery.map( this, function( elem, i ) {
  17117. return callback.call( elem, i, elem );
  17118. } ) );
  17119. },
  17120. slice: function() {
  17121. return this.pushStack( slice.apply( this, arguments ) );
  17122. },
  17123. first: function() {
  17124. return this.eq( 0 );
  17125. },
  17126. last: function() {
  17127. return this.eq( -1 );
  17128. },
  17129. eq: function( i ) {
  17130. var len = this.length,
  17131. j = +i + ( i < 0 ? len : 0 );
  17132. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  17133. },
  17134. end: function() {
  17135. return this.prevObject || this.constructor();
  17136. },
  17137. // For internal use only.
  17138. // Behaves like an Array's method, not like a jQuery method.
  17139. push: push,
  17140. sort: arr.sort,
  17141. splice: arr.splice
  17142. };
  17143. jQuery.extend = jQuery.fn.extend = function() {
  17144. var options, name, src, copy, copyIsArray, clone,
  17145. target = arguments[ 0 ] || {},
  17146. i = 1,
  17147. length = arguments.length,
  17148. deep = false;
  17149. // Handle a deep copy situation
  17150. if ( typeof target === "boolean" ) {
  17151. deep = target;
  17152. // Skip the boolean and the target
  17153. target = arguments[ i ] || {};
  17154. i++;
  17155. }
  17156. // Handle case when target is a string or something (possible in deep copy)
  17157. if ( typeof target !== "object" && !isFunction( target ) ) {
  17158. target = {};
  17159. }
  17160. // Extend jQuery itself if only one argument is passed
  17161. if ( i === length ) {
  17162. target = this;
  17163. i--;
  17164. }
  17165. for ( ; i < length; i++ ) {
  17166. // Only deal with non-null/undefined values
  17167. if ( ( options = arguments[ i ] ) != null ) {
  17168. // Extend the base object
  17169. for ( name in options ) {
  17170. src = target[ name ];
  17171. copy = options[ name ];
  17172. // Prevent never-ending loop
  17173. if ( target === copy ) {
  17174. continue;
  17175. }
  17176. // Recurse if we're merging plain objects or arrays
  17177. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  17178. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  17179. if ( copyIsArray ) {
  17180. copyIsArray = false;
  17181. clone = src && Array.isArray( src ) ? src : [];
  17182. } else {
  17183. clone = src && jQuery.isPlainObject( src ) ? src : {};
  17184. }
  17185. // Never move original objects, clone them
  17186. target[ name ] = jQuery.extend( deep, clone, copy );
  17187. // Don't bring in undefined values
  17188. } else if ( copy !== undefined ) {
  17189. target[ name ] = copy;
  17190. }
  17191. }
  17192. }
  17193. }
  17194. // Return the modified object
  17195. return target;
  17196. };
  17197. jQuery.extend( {
  17198. // Unique for each copy of jQuery on the page
  17199. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  17200. // Assume jQuery is ready without the ready module
  17201. isReady: true,
  17202. error: function( msg ) {
  17203. throw new Error( msg );
  17204. },
  17205. noop: function() {},
  17206. isPlainObject: function( obj ) {
  17207. var proto, Ctor;
  17208. // Detect obvious negatives
  17209. // Use toString instead of jQuery.type to catch host objects
  17210. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  17211. return false;
  17212. }
  17213. proto = getProto( obj );
  17214. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  17215. if ( !proto ) {
  17216. return true;
  17217. }
  17218. // Objects with prototype are plain iff they were constructed by a global Object function
  17219. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  17220. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  17221. },
  17222. isEmptyObject: function( obj ) {
  17223. /* eslint-disable no-unused-vars */
  17224. // See https://github.com/eslint/eslint/issues/6125
  17225. var name;
  17226. for ( name in obj ) {
  17227. return false;
  17228. }
  17229. return true;
  17230. },
  17231. // Evaluates a script in a global context
  17232. globalEval: function( code ) {
  17233. DOMEval( code );
  17234. },
  17235. each: function( obj, callback ) {
  17236. var length, i = 0;
  17237. if ( isArrayLike( obj ) ) {
  17238. length = obj.length;
  17239. for ( ; i < length; i++ ) {
  17240. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  17241. break;
  17242. }
  17243. }
  17244. } else {
  17245. for ( i in obj ) {
  17246. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  17247. break;
  17248. }
  17249. }
  17250. }
  17251. return obj;
  17252. },
  17253. // Support: Android <=4.0 only
  17254. trim: function( text ) {
  17255. return text == null ?
  17256. "" :
  17257. ( text + "" ).replace( rtrim, "" );
  17258. },
  17259. // results is for internal usage only
  17260. makeArray: function( arr, results ) {
  17261. var ret = results || [];
  17262. if ( arr != null ) {
  17263. if ( isArrayLike( Object( arr ) ) ) {
  17264. jQuery.merge( ret,
  17265. typeof arr === "string" ?
  17266. [ arr ] : arr
  17267. );
  17268. } else {
  17269. push.call( ret, arr );
  17270. }
  17271. }
  17272. return ret;
  17273. },
  17274. inArray: function( elem, arr, i ) {
  17275. return arr == null ? -1 : indexOf.call( arr, elem, i );
  17276. },
  17277. // Support: Android <=4.0 only, PhantomJS 1 only
  17278. // push.apply(_, arraylike) throws on ancient WebKit
  17279. merge: function( first, second ) {
  17280. var len = +second.length,
  17281. j = 0,
  17282. i = first.length;
  17283. for ( ; j < len; j++ ) {
  17284. first[ i++ ] = second[ j ];
  17285. }
  17286. first.length = i;
  17287. return first;
  17288. },
  17289. grep: function( elems, callback, invert ) {
  17290. var callbackInverse,
  17291. matches = [],
  17292. i = 0,
  17293. length = elems.length,
  17294. callbackExpect = !invert;
  17295. // Go through the array, only saving the items
  17296. // that pass the validator function
  17297. for ( ; i < length; i++ ) {
  17298. callbackInverse = !callback( elems[ i ], i );
  17299. if ( callbackInverse !== callbackExpect ) {
  17300. matches.push( elems[ i ] );
  17301. }
  17302. }
  17303. return matches;
  17304. },
  17305. // arg is for internal usage only
  17306. map: function( elems, callback, arg ) {
  17307. var length, value,
  17308. i = 0,
  17309. ret = [];
  17310. // Go through the array, translating each of the items to their new values
  17311. if ( isArrayLike( elems ) ) {
  17312. length = elems.length;
  17313. for ( ; i < length; i++ ) {
  17314. value = callback( elems[ i ], i, arg );
  17315. if ( value != null ) {
  17316. ret.push( value );
  17317. }
  17318. }
  17319. // Go through every key on the object,
  17320. } else {
  17321. for ( i in elems ) {
  17322. value = callback( elems[ i ], i, arg );
  17323. if ( value != null ) {
  17324. ret.push( value );
  17325. }
  17326. }
  17327. }
  17328. // Flatten any nested arrays
  17329. return concat.apply( [], ret );
  17330. },
  17331. // A global GUID counter for objects
  17332. guid: 1,
  17333. // jQuery.support is not used in Core but other projects attach their
  17334. // properties to it so it needs to exist.
  17335. support: support
  17336. } );
  17337. if ( typeof Symbol === "function" ) {
  17338. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  17339. }
  17340. // Populate the class2type map
  17341. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  17342. function( i, name ) {
  17343. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  17344. } );
  17345. function isArrayLike( obj ) {
  17346. // Support: real iOS 8.2 only (not reproducible in simulator)
  17347. // `in` check used to prevent JIT error (gh-2145)
  17348. // hasOwn isn't used here due to false negatives
  17349. // regarding Nodelist length in IE
  17350. var length = !!obj && "length" in obj && obj.length,
  17351. type = toType( obj );
  17352. if ( isFunction( obj ) || isWindow( obj ) ) {
  17353. return false;
  17354. }
  17355. return type === "array" || length === 0 ||
  17356. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  17357. }
  17358. var Sizzle =
  17359. /*!
  17360. * Sizzle CSS Selector Engine v2.3.3
  17361. * https://sizzlejs.com/
  17362. *
  17363. * Copyright jQuery Foundation and other contributors
  17364. * Released under the MIT license
  17365. * http://jquery.org/license
  17366. *
  17367. * Date: 2016-08-08
  17368. */
  17369. (function( window ) {
  17370. var i,
  17371. support,
  17372. Expr,
  17373. getText,
  17374. isXML,
  17375. tokenize,
  17376. compile,
  17377. select,
  17378. outermostContext,
  17379. sortInput,
  17380. hasDuplicate,
  17381. // Local document vars
  17382. setDocument,
  17383. document,
  17384. docElem,
  17385. documentIsHTML,
  17386. rbuggyQSA,
  17387. rbuggyMatches,
  17388. matches,
  17389. contains,
  17390. // Instance-specific data
  17391. expando = "sizzle" + 1 * new Date(),
  17392. preferredDoc = window.document,
  17393. dirruns = 0,
  17394. done = 0,
  17395. classCache = createCache(),
  17396. tokenCache = createCache(),
  17397. compilerCache = createCache(),
  17398. sortOrder = function( a, b ) {
  17399. if ( a === b ) {
  17400. hasDuplicate = true;
  17401. }
  17402. return 0;
  17403. },
  17404. // Instance methods
  17405. hasOwn = ({}).hasOwnProperty,
  17406. arr = [],
  17407. pop = arr.pop,
  17408. push_native = arr.push,
  17409. push = arr.push,
  17410. slice = arr.slice,
  17411. // Use a stripped-down indexOf as it's faster than native
  17412. // https://jsperf.com/thor-indexof-vs-for/5
  17413. indexOf = function( list, elem ) {
  17414. var i = 0,
  17415. len = list.length;
  17416. for ( ; i < len; i++ ) {
  17417. if ( list[i] === elem ) {
  17418. return i;
  17419. }
  17420. }
  17421. return -1;
  17422. },
  17423. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  17424. // Regular expressions
  17425. // http://www.w3.org/TR/css3-selectors/#whitespace
  17426. whitespace = "[\\x20\\t\\r\\n\\f]",
  17427. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  17428. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  17429. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  17430. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  17431. // Operator (capture 2)
  17432. "*([*^$|!~]?=)" + whitespace +
  17433. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  17434. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  17435. "*\\]",
  17436. pseudos = ":(" + identifier + ")(?:\\((" +
  17437. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  17438. // 1. quoted (capture 3; capture 4 or capture 5)
  17439. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  17440. // 2. simple (capture 6)
  17441. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  17442. // 3. anything else (capture 2)
  17443. ".*" +
  17444. ")\\)|)",
  17445. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  17446. rwhitespace = new RegExp( whitespace + "+", "g" ),
  17447. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  17448. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  17449. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  17450. rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
  17451. rpseudo = new RegExp( pseudos ),
  17452. ridentifier = new RegExp( "^" + identifier + "$" ),
  17453. matchExpr = {
  17454. "ID": new RegExp( "^#(" + identifier + ")" ),
  17455. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  17456. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  17457. "ATTR": new RegExp( "^" + attributes ),
  17458. "PSEUDO": new RegExp( "^" + pseudos ),
  17459. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  17460. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  17461. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  17462. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  17463. // For use in libraries implementing .is()
  17464. // We use this for POS matching in `select`
  17465. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  17466. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  17467. },
  17468. rinputs = /^(?:input|select|textarea|button)$/i,
  17469. rheader = /^h\d$/i,
  17470. rnative = /^[^{]+\{\s*\[native \w/,
  17471. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  17472. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  17473. rsibling = /[+~]/,
  17474. // CSS escapes
  17475. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  17476. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  17477. funescape = function( _, escaped, escapedWhitespace ) {
  17478. var high = "0x" + escaped - 0x10000;
  17479. // NaN means non-codepoint
  17480. // Support: Firefox<24
  17481. // Workaround erroneous numeric interpretation of +"0x"
  17482. return high !== high || escapedWhitespace ?
  17483. escaped :
  17484. high < 0 ?
  17485. // BMP codepoint
  17486. String.fromCharCode( high + 0x10000 ) :
  17487. // Supplemental Plane codepoint (surrogate pair)
  17488. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  17489. },
  17490. // CSS string/identifier serialization
  17491. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  17492. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  17493. fcssescape = function( ch, asCodePoint ) {
  17494. if ( asCodePoint ) {
  17495. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  17496. if ( ch === "\0" ) {
  17497. return "\uFFFD";
  17498. }
  17499. // Control characters and (dependent upon position) numbers get escaped as code points
  17500. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  17501. }
  17502. // Other potentially-special ASCII characters get backslash-escaped
  17503. return "\\" + ch;
  17504. },
  17505. // Used for iframes
  17506. // See setDocument()
  17507. // Removing the function wrapper causes a "Permission Denied"
  17508. // error in IE
  17509. unloadHandler = function() {
  17510. setDocument();
  17511. },
  17512. disabledAncestor = addCombinator(
  17513. function( elem ) {
  17514. return elem.disabled === true && ("form" in elem || "label" in elem);
  17515. },
  17516. { dir: "parentNode", next: "legend" }
  17517. );
  17518. // Optimize for push.apply( _, NodeList )
  17519. try {
  17520. push.apply(
  17521. (arr = slice.call( preferredDoc.childNodes )),
  17522. preferredDoc.childNodes
  17523. );
  17524. // Support: Android<4.0
  17525. // Detect silently failing push.apply
  17526. arr[ preferredDoc.childNodes.length ].nodeType;
  17527. } catch ( e ) {
  17528. push = { apply: arr.length ?
  17529. // Leverage slice if possible
  17530. function( target, els ) {
  17531. push_native.apply( target, slice.call(els) );
  17532. } :
  17533. // Support: IE<9
  17534. // Otherwise append directly
  17535. function( target, els ) {
  17536. var j = target.length,
  17537. i = 0;
  17538. // Can't trust NodeList.length
  17539. while ( (target[j++] = els[i++]) ) {}
  17540. target.length = j - 1;
  17541. }
  17542. };
  17543. }
  17544. function Sizzle( selector, context, results, seed ) {
  17545. var m, i, elem, nid, match, groups, newSelector,
  17546. newContext = context && context.ownerDocument,
  17547. // nodeType defaults to 9, since context defaults to document
  17548. nodeType = context ? context.nodeType : 9;
  17549. results = results || [];
  17550. // Return early from calls with invalid selector or context
  17551. if ( typeof selector !== "string" || !selector ||
  17552. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  17553. return results;
  17554. }
  17555. // Try to shortcut find operations (as opposed to filters) in HTML documents
  17556. if ( !seed ) {
  17557. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  17558. setDocument( context );
  17559. }
  17560. context = context || document;
  17561. if ( documentIsHTML ) {
  17562. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  17563. // (excepting DocumentFragment context, where the methods don't exist)
  17564. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  17565. // ID selector
  17566. if ( (m = match[1]) ) {
  17567. // Document context
  17568. if ( nodeType === 9 ) {
  17569. if ( (elem = context.getElementById( m )) ) {
  17570. // Support: IE, Opera, Webkit
  17571. // TODO: identify versions
  17572. // getElementById can match elements by name instead of ID
  17573. if ( elem.id === m ) {
  17574. results.push( elem );
  17575. return results;
  17576. }
  17577. } else {
  17578. return results;
  17579. }
  17580. // Element context
  17581. } else {
  17582. // Support: IE, Opera, Webkit
  17583. // TODO: identify versions
  17584. // getElementById can match elements by name instead of ID
  17585. if ( newContext && (elem = newContext.getElementById( m )) &&
  17586. contains( context, elem ) &&
  17587. elem.id === m ) {
  17588. results.push( elem );
  17589. return results;
  17590. }
  17591. }
  17592. // Type selector
  17593. } else if ( match[2] ) {
  17594. push.apply( results, context.getElementsByTagName( selector ) );
  17595. return results;
  17596. // Class selector
  17597. } else if ( (m = match[3]) && support.getElementsByClassName &&
  17598. context.getElementsByClassName ) {
  17599. push.apply( results, context.getElementsByClassName( m ) );
  17600. return results;
  17601. }
  17602. }
  17603. // Take advantage of querySelectorAll
  17604. if ( support.qsa &&
  17605. !compilerCache[ selector + " " ] &&
  17606. (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
  17607. if ( nodeType !== 1 ) {
  17608. newContext = context;
  17609. newSelector = selector;
  17610. // qSA looks outside Element context, which is not what we want
  17611. // Thanks to Andrew Dupont for this workaround technique
  17612. // Support: IE <=8
  17613. // Exclude object elements
  17614. } else if ( context.nodeName.toLowerCase() !== "object" ) {
  17615. // Capture the context ID, setting it first if necessary
  17616. if ( (nid = context.getAttribute( "id" )) ) {
  17617. nid = nid.replace( rcssescape, fcssescape );
  17618. } else {
  17619. context.setAttribute( "id", (nid = expando) );
  17620. }
  17621. // Prefix every selector in the list
  17622. groups = tokenize( selector );
  17623. i = groups.length;
  17624. while ( i-- ) {
  17625. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  17626. }
  17627. newSelector = groups.join( "," );
  17628. // Expand context for sibling selectors
  17629. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  17630. context;
  17631. }
  17632. if ( newSelector ) {
  17633. try {
  17634. push.apply( results,
  17635. newContext.querySelectorAll( newSelector )
  17636. );
  17637. return results;
  17638. } catch ( qsaError ) {
  17639. } finally {
  17640. if ( nid === expando ) {
  17641. context.removeAttribute( "id" );
  17642. }
  17643. }
  17644. }
  17645. }
  17646. }
  17647. }
  17648. // All others
  17649. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  17650. }
  17651. /**
  17652. * Create key-value caches of limited size
  17653. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  17654. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  17655. * deleting the oldest entry
  17656. */
  17657. function createCache() {
  17658. var keys = [];
  17659. function cache( key, value ) {
  17660. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  17661. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  17662. // Only keep the most recent entries
  17663. delete cache[ keys.shift() ];
  17664. }
  17665. return (cache[ key + " " ] = value);
  17666. }
  17667. return cache;
  17668. }
  17669. /**
  17670. * Mark a function for special use by Sizzle
  17671. * @param {Function} fn The function to mark
  17672. */
  17673. function markFunction( fn ) {
  17674. fn[ expando ] = true;
  17675. return fn;
  17676. }
  17677. /**
  17678. * Support testing using an element
  17679. * @param {Function} fn Passed the created element and returns a boolean result
  17680. */
  17681. function assert( fn ) {
  17682. var el = document.createElement("fieldset");
  17683. try {
  17684. return !!fn( el );
  17685. } catch (e) {
  17686. return false;
  17687. } finally {
  17688. // Remove from its parent by default
  17689. if ( el.parentNode ) {
  17690. el.parentNode.removeChild( el );
  17691. }
  17692. // release memory in IE
  17693. el = null;
  17694. }
  17695. }
  17696. /**
  17697. * Adds the same handler for all of the specified attrs
  17698. * @param {String} attrs Pipe-separated list of attributes
  17699. * @param {Function} handler The method that will be applied
  17700. */
  17701. function addHandle( attrs, handler ) {
  17702. var arr = attrs.split("|"),
  17703. i = arr.length;
  17704. while ( i-- ) {
  17705. Expr.attrHandle[ arr[i] ] = handler;
  17706. }
  17707. }
  17708. /**
  17709. * Checks document order of two siblings
  17710. * @param {Element} a
  17711. * @param {Element} b
  17712. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  17713. */
  17714. function siblingCheck( a, b ) {
  17715. var cur = b && a,
  17716. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  17717. a.sourceIndex - b.sourceIndex;
  17718. // Use IE sourceIndex if available on both nodes
  17719. if ( diff ) {
  17720. return diff;
  17721. }
  17722. // Check if b follows a
  17723. if ( cur ) {
  17724. while ( (cur = cur.nextSibling) ) {
  17725. if ( cur === b ) {
  17726. return -1;
  17727. }
  17728. }
  17729. }
  17730. return a ? 1 : -1;
  17731. }
  17732. /**
  17733. * Returns a function to use in pseudos for input types
  17734. * @param {String} type
  17735. */
  17736. function createInputPseudo( type ) {
  17737. return function( elem ) {
  17738. var name = elem.nodeName.toLowerCase();
  17739. return name === "input" && elem.type === type;
  17740. };
  17741. }
  17742. /**
  17743. * Returns a function to use in pseudos for buttons
  17744. * @param {String} type
  17745. */
  17746. function createButtonPseudo( type ) {
  17747. return function( elem ) {
  17748. var name = elem.nodeName.toLowerCase();
  17749. return (name === "input" || name === "button") && elem.type === type;
  17750. };
  17751. }
  17752. /**
  17753. * Returns a function to use in pseudos for :enabled/:disabled
  17754. * @param {Boolean} disabled true for :disabled; false for :enabled
  17755. */
  17756. function createDisabledPseudo( disabled ) {
  17757. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  17758. return function( elem ) {
  17759. // Only certain elements can match :enabled or :disabled
  17760. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  17761. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  17762. if ( "form" in elem ) {
  17763. // Check for inherited disabledness on relevant non-disabled elements:
  17764. // * listed form-associated elements in a disabled fieldset
  17765. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  17766. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  17767. // * option elements in a disabled optgroup
  17768. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  17769. // All such elements have a "form" property.
  17770. if ( elem.parentNode && elem.disabled === false ) {
  17771. // Option elements defer to a parent optgroup if present
  17772. if ( "label" in elem ) {
  17773. if ( "label" in elem.parentNode ) {
  17774. return elem.parentNode.disabled === disabled;
  17775. } else {
  17776. return elem.disabled === disabled;
  17777. }
  17778. }
  17779. // Support: IE 6 - 11
  17780. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  17781. return elem.isDisabled === disabled ||
  17782. // Where there is no isDisabled, check manually
  17783. /* jshint -W018 */
  17784. elem.isDisabled !== !disabled &&
  17785. disabledAncestor( elem ) === disabled;
  17786. }
  17787. return elem.disabled === disabled;
  17788. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  17789. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  17790. // even exist on them, let alone have a boolean value.
  17791. } else if ( "label" in elem ) {
  17792. return elem.disabled === disabled;
  17793. }
  17794. // Remaining elements are neither :enabled nor :disabled
  17795. return false;
  17796. };
  17797. }
  17798. /**
  17799. * Returns a function to use in pseudos for positionals
  17800. * @param {Function} fn
  17801. */
  17802. function createPositionalPseudo( fn ) {
  17803. return markFunction(function( argument ) {
  17804. argument = +argument;
  17805. return markFunction(function( seed, matches ) {
  17806. var j,
  17807. matchIndexes = fn( [], seed.length, argument ),
  17808. i = matchIndexes.length;
  17809. // Match elements found at the specified indexes
  17810. while ( i-- ) {
  17811. if ( seed[ (j = matchIndexes[i]) ] ) {
  17812. seed[j] = !(matches[j] = seed[j]);
  17813. }
  17814. }
  17815. });
  17816. });
  17817. }
  17818. /**
  17819. * Checks a node for validity as a Sizzle context
  17820. * @param {Element|Object=} context
  17821. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  17822. */
  17823. function testContext( context ) {
  17824. return context && typeof context.getElementsByTagName !== "undefined" && context;
  17825. }
  17826. // Expose support vars for convenience
  17827. support = Sizzle.support = {};
  17828. /**
  17829. * Detects XML nodes
  17830. * @param {Element|Object} elem An element or a document
  17831. * @returns {Boolean} True iff elem is a non-HTML XML node
  17832. */
  17833. isXML = Sizzle.isXML = function( elem ) {
  17834. // documentElement is verified for cases where it doesn't yet exist
  17835. // (such as loading iframes in IE - #4833)
  17836. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  17837. return documentElement ? documentElement.nodeName !== "HTML" : false;
  17838. };
  17839. /**
  17840. * Sets document-related variables once based on the current document
  17841. * @param {Element|Object} [doc] An element or document object to use to set the document
  17842. * @returns {Object} Returns the current document
  17843. */
  17844. setDocument = Sizzle.setDocument = function( node ) {
  17845. var hasCompare, subWindow,
  17846. doc = node ? node.ownerDocument || node : preferredDoc;
  17847. // Return early if doc is invalid or already selected
  17848. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  17849. return document;
  17850. }
  17851. // Update global variables
  17852. document = doc;
  17853. docElem = document.documentElement;
  17854. documentIsHTML = !isXML( document );
  17855. // Support: IE 9-11, Edge
  17856. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  17857. if ( preferredDoc !== document &&
  17858. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  17859. // Support: IE 11, Edge
  17860. if ( subWindow.addEventListener ) {
  17861. subWindow.addEventListener( "unload", unloadHandler, false );
  17862. // Support: IE 9 - 10 only
  17863. } else if ( subWindow.attachEvent ) {
  17864. subWindow.attachEvent( "onunload", unloadHandler );
  17865. }
  17866. }
  17867. /* Attributes
  17868. ---------------------------------------------------------------------- */
  17869. // Support: IE<8
  17870. // Verify that getAttribute really returns attributes and not properties
  17871. // (excepting IE8 booleans)
  17872. support.attributes = assert(function( el ) {
  17873. el.className = "i";
  17874. return !el.getAttribute("className");
  17875. });
  17876. /* getElement(s)By*
  17877. ---------------------------------------------------------------------- */
  17878. // Check if getElementsByTagName("*") returns only elements
  17879. support.getElementsByTagName = assert(function( el ) {
  17880. el.appendChild( document.createComment("") );
  17881. return !el.getElementsByTagName("*").length;
  17882. });
  17883. // Support: IE<9
  17884. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  17885. // Support: IE<10
  17886. // Check if getElementById returns elements by name
  17887. // The broken getElementById methods don't pick up programmatically-set names,
  17888. // so use a roundabout getElementsByName test
  17889. support.getById = assert(function( el ) {
  17890. docElem.appendChild( el ).id = expando;
  17891. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  17892. });
  17893. // ID filter and find
  17894. if ( support.getById ) {
  17895. Expr.filter["ID"] = function( id ) {
  17896. var attrId = id.replace( runescape, funescape );
  17897. return function( elem ) {
  17898. return elem.getAttribute("id") === attrId;
  17899. };
  17900. };
  17901. Expr.find["ID"] = function( id, context ) {
  17902. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  17903. var elem = context.getElementById( id );
  17904. return elem ? [ elem ] : [];
  17905. }
  17906. };
  17907. } else {
  17908. Expr.filter["ID"] = function( id ) {
  17909. var attrId = id.replace( runescape, funescape );
  17910. return function( elem ) {
  17911. var node = typeof elem.getAttributeNode !== "undefined" &&
  17912. elem.getAttributeNode("id");
  17913. return node && node.value === attrId;
  17914. };
  17915. };
  17916. // Support: IE 6 - 7 only
  17917. // getElementById is not reliable as a find shortcut
  17918. Expr.find["ID"] = function( id, context ) {
  17919. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  17920. var node, i, elems,
  17921. elem = context.getElementById( id );
  17922. if ( elem ) {
  17923. // Verify the id attribute
  17924. node = elem.getAttributeNode("id");
  17925. if ( node && node.value === id ) {
  17926. return [ elem ];
  17927. }
  17928. // Fall back on getElementsByName
  17929. elems = context.getElementsByName( id );
  17930. i = 0;
  17931. while ( (elem = elems[i++]) ) {
  17932. node = elem.getAttributeNode("id");
  17933. if ( node && node.value === id ) {
  17934. return [ elem ];
  17935. }
  17936. }
  17937. }
  17938. return [];
  17939. }
  17940. };
  17941. }
  17942. // Tag
  17943. Expr.find["TAG"] = support.getElementsByTagName ?
  17944. function( tag, context ) {
  17945. if ( typeof context.getElementsByTagName !== "undefined" ) {
  17946. return context.getElementsByTagName( tag );
  17947. // DocumentFragment nodes don't have gEBTN
  17948. } else if ( support.qsa ) {
  17949. return context.querySelectorAll( tag );
  17950. }
  17951. } :
  17952. function( tag, context ) {
  17953. var elem,
  17954. tmp = [],
  17955. i = 0,
  17956. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  17957. results = context.getElementsByTagName( tag );
  17958. // Filter out possible comments
  17959. if ( tag === "*" ) {
  17960. while ( (elem = results[i++]) ) {
  17961. if ( elem.nodeType === 1 ) {
  17962. tmp.push( elem );
  17963. }
  17964. }
  17965. return tmp;
  17966. }
  17967. return results;
  17968. };
  17969. // Class
  17970. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  17971. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  17972. return context.getElementsByClassName( className );
  17973. }
  17974. };
  17975. /* QSA/matchesSelector
  17976. ---------------------------------------------------------------------- */
  17977. // QSA and matchesSelector support
  17978. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  17979. rbuggyMatches = [];
  17980. // qSa(:focus) reports false when true (Chrome 21)
  17981. // We allow this because of a bug in IE8/9 that throws an error
  17982. // whenever `document.activeElement` is accessed on an iframe
  17983. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  17984. // See https://bugs.jquery.com/ticket/13378
  17985. rbuggyQSA = [];
  17986. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  17987. // Build QSA regex
  17988. // Regex strategy adopted from Diego Perini
  17989. assert(function( el ) {
  17990. // Select is set to empty string on purpose
  17991. // This is to test IE's treatment of not explicitly
  17992. // setting a boolean content attribute,
  17993. // since its presence should be enough
  17994. // https://bugs.jquery.com/ticket/12359
  17995. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  17996. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  17997. "<option selected=''></option></select>";
  17998. // Support: IE8, Opera 11-12.16
  17999. // Nothing should be selected when empty strings follow ^= or $= or *=
  18000. // The test attribute must be unknown in Opera but "safe" for WinRT
  18001. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  18002. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  18003. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  18004. }
  18005. // Support: IE8
  18006. // Boolean attributes and "value" are not treated correctly
  18007. if ( !el.querySelectorAll("[selected]").length ) {
  18008. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  18009. }
  18010. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  18011. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  18012. rbuggyQSA.push("~=");
  18013. }
  18014. // Webkit/Opera - :checked should return selected option elements
  18015. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  18016. // IE8 throws error here and will not see later tests
  18017. if ( !el.querySelectorAll(":checked").length ) {
  18018. rbuggyQSA.push(":checked");
  18019. }
  18020. // Support: Safari 8+, iOS 8+
  18021. // https://bugs.webkit.org/show_bug.cgi?id=136851
  18022. // In-page `selector#id sibling-combinator selector` fails
  18023. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  18024. rbuggyQSA.push(".#.+[+~]");
  18025. }
  18026. });
  18027. assert(function( el ) {
  18028. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  18029. "<select disabled='disabled'><option/></select>";
  18030. // Support: Windows 8 Native Apps
  18031. // The type and name attributes are restricted during .innerHTML assignment
  18032. var input = document.createElement("input");
  18033. input.setAttribute( "type", "hidden" );
  18034. el.appendChild( input ).setAttribute( "name", "D" );
  18035. // Support: IE8
  18036. // Enforce case-sensitivity of name attribute
  18037. if ( el.querySelectorAll("[name=d]").length ) {
  18038. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  18039. }
  18040. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  18041. // IE8 throws error here and will not see later tests
  18042. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  18043. rbuggyQSA.push( ":enabled", ":disabled" );
  18044. }
  18045. // Support: IE9-11+
  18046. // IE's :disabled selector does not pick up the children of disabled fieldsets
  18047. docElem.appendChild( el ).disabled = true;
  18048. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  18049. rbuggyQSA.push( ":enabled", ":disabled" );
  18050. }
  18051. // Opera 10-11 does not throw on post-comma invalid pseudos
  18052. el.querySelectorAll("*,:x");
  18053. rbuggyQSA.push(",.*:");
  18054. });
  18055. }
  18056. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  18057. docElem.webkitMatchesSelector ||
  18058. docElem.mozMatchesSelector ||
  18059. docElem.oMatchesSelector ||
  18060. docElem.msMatchesSelector) )) ) {
  18061. assert(function( el ) {
  18062. // Check to see if it's possible to do matchesSelector
  18063. // on a disconnected node (IE 9)
  18064. support.disconnectedMatch = matches.call( el, "*" );
  18065. // This should fail with an exception
  18066. // Gecko does not error, returns false instead
  18067. matches.call( el, "[s!='']:x" );
  18068. rbuggyMatches.push( "!=", pseudos );
  18069. });
  18070. }
  18071. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  18072. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  18073. /* Contains
  18074. ---------------------------------------------------------------------- */
  18075. hasCompare = rnative.test( docElem.compareDocumentPosition );
  18076. // Element contains another
  18077. // Purposefully self-exclusive
  18078. // As in, an element does not contain itself
  18079. contains = hasCompare || rnative.test( docElem.contains ) ?
  18080. function( a, b ) {
  18081. var adown = a.nodeType === 9 ? a.documentElement : a,
  18082. bup = b && b.parentNode;
  18083. return a === bup || !!( bup && bup.nodeType === 1 && (
  18084. adown.contains ?
  18085. adown.contains( bup ) :
  18086. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  18087. ));
  18088. } :
  18089. function( a, b ) {
  18090. if ( b ) {
  18091. while ( (b = b.parentNode) ) {
  18092. if ( b === a ) {
  18093. return true;
  18094. }
  18095. }
  18096. }
  18097. return false;
  18098. };
  18099. /* Sorting
  18100. ---------------------------------------------------------------------- */
  18101. // Document order sorting
  18102. sortOrder = hasCompare ?
  18103. function( a, b ) {
  18104. // Flag for duplicate removal
  18105. if ( a === b ) {
  18106. hasDuplicate = true;
  18107. return 0;
  18108. }
  18109. // Sort on method existence if only one input has compareDocumentPosition
  18110. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  18111. if ( compare ) {
  18112. return compare;
  18113. }
  18114. // Calculate position if both inputs belong to the same document
  18115. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  18116. a.compareDocumentPosition( b ) :
  18117. // Otherwise we know they are disconnected
  18118. 1;
  18119. // Disconnected nodes
  18120. if ( compare & 1 ||
  18121. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  18122. // Choose the first element that is related to our preferred document
  18123. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  18124. return -1;
  18125. }
  18126. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  18127. return 1;
  18128. }
  18129. // Maintain original order
  18130. return sortInput ?
  18131. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  18132. 0;
  18133. }
  18134. return compare & 4 ? -1 : 1;
  18135. } :
  18136. function( a, b ) {
  18137. // Exit early if the nodes are identical
  18138. if ( a === b ) {
  18139. hasDuplicate = true;
  18140. return 0;
  18141. }
  18142. var cur,
  18143. i = 0,
  18144. aup = a.parentNode,
  18145. bup = b.parentNode,
  18146. ap = [ a ],
  18147. bp = [ b ];
  18148. // Parentless nodes are either documents or disconnected
  18149. if ( !aup || !bup ) {
  18150. return a === document ? -1 :
  18151. b === document ? 1 :
  18152. aup ? -1 :
  18153. bup ? 1 :
  18154. sortInput ?
  18155. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  18156. 0;
  18157. // If the nodes are siblings, we can do a quick check
  18158. } else if ( aup === bup ) {
  18159. return siblingCheck( a, b );
  18160. }
  18161. // Otherwise we need full lists of their ancestors for comparison
  18162. cur = a;
  18163. while ( (cur = cur.parentNode) ) {
  18164. ap.unshift( cur );
  18165. }
  18166. cur = b;
  18167. while ( (cur = cur.parentNode) ) {
  18168. bp.unshift( cur );
  18169. }
  18170. // Walk down the tree looking for a discrepancy
  18171. while ( ap[i] === bp[i] ) {
  18172. i++;
  18173. }
  18174. return i ?
  18175. // Do a sibling check if the nodes have a common ancestor
  18176. siblingCheck( ap[i], bp[i] ) :
  18177. // Otherwise nodes in our document sort first
  18178. ap[i] === preferredDoc ? -1 :
  18179. bp[i] === preferredDoc ? 1 :
  18180. 0;
  18181. };
  18182. return document;
  18183. };
  18184. Sizzle.matches = function( expr, elements ) {
  18185. return Sizzle( expr, null, null, elements );
  18186. };
  18187. Sizzle.matchesSelector = function( elem, expr ) {
  18188. // Set document vars if needed
  18189. if ( ( elem.ownerDocument || elem ) !== document ) {
  18190. setDocument( elem );
  18191. }
  18192. // Make sure that attribute selectors are quoted
  18193. expr = expr.replace( rattributeQuotes, "='$1']" );
  18194. if ( support.matchesSelector && documentIsHTML &&
  18195. !compilerCache[ expr + " " ] &&
  18196. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  18197. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  18198. try {
  18199. var ret = matches.call( elem, expr );
  18200. // IE 9's matchesSelector returns false on disconnected nodes
  18201. if ( ret || support.disconnectedMatch ||
  18202. // As well, disconnected nodes are said to be in a document
  18203. // fragment in IE 9
  18204. elem.document && elem.document.nodeType !== 11 ) {
  18205. return ret;
  18206. }
  18207. } catch (e) {}
  18208. }
  18209. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  18210. };
  18211. Sizzle.contains = function( context, elem ) {
  18212. // Set document vars if needed
  18213. if ( ( context.ownerDocument || context ) !== document ) {
  18214. setDocument( context );
  18215. }
  18216. return contains( context, elem );
  18217. };
  18218. Sizzle.attr = function( elem, name ) {
  18219. // Set document vars if needed
  18220. if ( ( elem.ownerDocument || elem ) !== document ) {
  18221. setDocument( elem );
  18222. }
  18223. var fn = Expr.attrHandle[ name.toLowerCase() ],
  18224. // Don't get fooled by Object.prototype properties (jQuery #13807)
  18225. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  18226. fn( elem, name, !documentIsHTML ) :
  18227. undefined;
  18228. return val !== undefined ?
  18229. val :
  18230. support.attributes || !documentIsHTML ?
  18231. elem.getAttribute( name ) :
  18232. (val = elem.getAttributeNode(name)) && val.specified ?
  18233. val.value :
  18234. null;
  18235. };
  18236. Sizzle.escape = function( sel ) {
  18237. return (sel + "").replace( rcssescape, fcssescape );
  18238. };
  18239. Sizzle.error = function( msg ) {
  18240. throw new Error( "Syntax error, unrecognized expression: " + msg );
  18241. };
  18242. /**
  18243. * Document sorting and removing duplicates
  18244. * @param {ArrayLike} results
  18245. */
  18246. Sizzle.uniqueSort = function( results ) {
  18247. var elem,
  18248. duplicates = [],
  18249. j = 0,
  18250. i = 0;
  18251. // Unless we *know* we can detect duplicates, assume their presence
  18252. hasDuplicate = !support.detectDuplicates;
  18253. sortInput = !support.sortStable && results.slice( 0 );
  18254. results.sort( sortOrder );
  18255. if ( hasDuplicate ) {
  18256. while ( (elem = results[i++]) ) {
  18257. if ( elem === results[ i ] ) {
  18258. j = duplicates.push( i );
  18259. }
  18260. }
  18261. while ( j-- ) {
  18262. results.splice( duplicates[ j ], 1 );
  18263. }
  18264. }
  18265. // Clear input after sorting to release objects
  18266. // See https://github.com/jquery/sizzle/pull/225
  18267. sortInput = null;
  18268. return results;
  18269. };
  18270. /**
  18271. * Utility function for retrieving the text value of an array of DOM nodes
  18272. * @param {Array|Element} elem
  18273. */
  18274. getText = Sizzle.getText = function( elem ) {
  18275. var node,
  18276. ret = "",
  18277. i = 0,
  18278. nodeType = elem.nodeType;
  18279. if ( !nodeType ) {
  18280. // If no nodeType, this is expected to be an array
  18281. while ( (node = elem[i++]) ) {
  18282. // Do not traverse comment nodes
  18283. ret += getText( node );
  18284. }
  18285. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  18286. // Use textContent for elements
  18287. // innerText usage removed for consistency of new lines (jQuery #11153)
  18288. if ( typeof elem.textContent === "string" ) {
  18289. return elem.textContent;
  18290. } else {
  18291. // Traverse its children
  18292. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  18293. ret += getText( elem );
  18294. }
  18295. }
  18296. } else if ( nodeType === 3 || nodeType === 4 ) {
  18297. return elem.nodeValue;
  18298. }
  18299. // Do not include comment or processing instruction nodes
  18300. return ret;
  18301. };
  18302. Expr = Sizzle.selectors = {
  18303. // Can be adjusted by the user
  18304. cacheLength: 50,
  18305. createPseudo: markFunction,
  18306. match: matchExpr,
  18307. attrHandle: {},
  18308. find: {},
  18309. relative: {
  18310. ">": { dir: "parentNode", first: true },
  18311. " ": { dir: "parentNode" },
  18312. "+": { dir: "previousSibling", first: true },
  18313. "~": { dir: "previousSibling" }
  18314. },
  18315. preFilter: {
  18316. "ATTR": function( match ) {
  18317. match[1] = match[1].replace( runescape, funescape );
  18318. // Move the given value to match[3] whether quoted or unquoted
  18319. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  18320. if ( match[2] === "~=" ) {
  18321. match[3] = " " + match[3] + " ";
  18322. }
  18323. return match.slice( 0, 4 );
  18324. },
  18325. "CHILD": function( match ) {
  18326. /* matches from matchExpr["CHILD"]
  18327. 1 type (only|nth|...)
  18328. 2 what (child|of-type)
  18329. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  18330. 4 xn-component of xn+y argument ([+-]?\d*n|)
  18331. 5 sign of xn-component
  18332. 6 x of xn-component
  18333. 7 sign of y-component
  18334. 8 y of y-component
  18335. */
  18336. match[1] = match[1].toLowerCase();
  18337. if ( match[1].slice( 0, 3 ) === "nth" ) {
  18338. // nth-* requires argument
  18339. if ( !match[3] ) {
  18340. Sizzle.error( match[0] );
  18341. }
  18342. // numeric x and y parameters for Expr.filter.CHILD
  18343. // remember that false/true cast respectively to 0/1
  18344. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  18345. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  18346. // other types prohibit arguments
  18347. } else if ( match[3] ) {
  18348. Sizzle.error( match[0] );
  18349. }
  18350. return match;
  18351. },
  18352. "PSEUDO": function( match ) {
  18353. var excess,
  18354. unquoted = !match[6] && match[2];
  18355. if ( matchExpr["CHILD"].test( match[0] ) ) {
  18356. return null;
  18357. }
  18358. // Accept quoted arguments as-is
  18359. if ( match[3] ) {
  18360. match[2] = match[4] || match[5] || "";
  18361. // Strip excess characters from unquoted arguments
  18362. } else if ( unquoted && rpseudo.test( unquoted ) &&
  18363. // Get excess from tokenize (recursively)
  18364. (excess = tokenize( unquoted, true )) &&
  18365. // advance to the next closing parenthesis
  18366. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  18367. // excess is a negative index
  18368. match[0] = match[0].slice( 0, excess );
  18369. match[2] = unquoted.slice( 0, excess );
  18370. }
  18371. // Return only captures needed by the pseudo filter method (type and argument)
  18372. return match.slice( 0, 3 );
  18373. }
  18374. },
  18375. filter: {
  18376. "TAG": function( nodeNameSelector ) {
  18377. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  18378. return nodeNameSelector === "*" ?
  18379. function() { return true; } :
  18380. function( elem ) {
  18381. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  18382. };
  18383. },
  18384. "CLASS": function( className ) {
  18385. var pattern = classCache[ className + " " ];
  18386. return pattern ||
  18387. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  18388. classCache( className, function( elem ) {
  18389. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  18390. });
  18391. },
  18392. "ATTR": function( name, operator, check ) {
  18393. return function( elem ) {
  18394. var result = Sizzle.attr( elem, name );
  18395. if ( result == null ) {
  18396. return operator === "!=";
  18397. }
  18398. if ( !operator ) {
  18399. return true;
  18400. }
  18401. result += "";
  18402. return operator === "=" ? result === check :
  18403. operator === "!=" ? result !== check :
  18404. operator === "^=" ? check && result.indexOf( check ) === 0 :
  18405. operator === "*=" ? check && result.indexOf( check ) > -1 :
  18406. operator === "$=" ? check && result.slice( -check.length ) === check :
  18407. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  18408. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  18409. false;
  18410. };
  18411. },
  18412. "CHILD": function( type, what, argument, first, last ) {
  18413. var simple = type.slice( 0, 3 ) !== "nth",
  18414. forward = type.slice( -4 ) !== "last",
  18415. ofType = what === "of-type";
  18416. return first === 1 && last === 0 ?
  18417. // Shortcut for :nth-*(n)
  18418. function( elem ) {
  18419. return !!elem.parentNode;
  18420. } :
  18421. function( elem, context, xml ) {
  18422. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  18423. dir = simple !== forward ? "nextSibling" : "previousSibling",
  18424. parent = elem.parentNode,
  18425. name = ofType && elem.nodeName.toLowerCase(),
  18426. useCache = !xml && !ofType,
  18427. diff = false;
  18428. if ( parent ) {
  18429. // :(first|last|only)-(child|of-type)
  18430. if ( simple ) {
  18431. while ( dir ) {
  18432. node = elem;
  18433. while ( (node = node[ dir ]) ) {
  18434. if ( ofType ?
  18435. node.nodeName.toLowerCase() === name :
  18436. node.nodeType === 1 ) {
  18437. return false;
  18438. }
  18439. }
  18440. // Reverse direction for :only-* (if we haven't yet done so)
  18441. start = dir = type === "only" && !start && "nextSibling";
  18442. }
  18443. return true;
  18444. }
  18445. start = [ forward ? parent.firstChild : parent.lastChild ];
  18446. // non-xml :nth-child(...) stores cache data on `parent`
  18447. if ( forward && useCache ) {
  18448. // Seek `elem` from a previously-cached index
  18449. // ...in a gzip-friendly way
  18450. node = parent;
  18451. outerCache = node[ expando ] || (node[ expando ] = {});
  18452. // Support: IE <9 only
  18453. // Defend against cloned attroperties (jQuery gh-1709)
  18454. uniqueCache = outerCache[ node.uniqueID ] ||
  18455. (outerCache[ node.uniqueID ] = {});
  18456. cache = uniqueCache[ type ] || [];
  18457. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  18458. diff = nodeIndex && cache[ 2 ];
  18459. node = nodeIndex && parent.childNodes[ nodeIndex ];
  18460. while ( (node = ++nodeIndex && node && node[ dir ] ||
  18461. // Fallback to seeking `elem` from the start
  18462. (diff = nodeIndex = 0) || start.pop()) ) {
  18463. // When found, cache indexes on `parent` and break
  18464. if ( node.nodeType === 1 && ++diff && node === elem ) {
  18465. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  18466. break;
  18467. }
  18468. }
  18469. } else {
  18470. // Use previously-cached element index if available
  18471. if ( useCache ) {
  18472. // ...in a gzip-friendly way
  18473. node = elem;
  18474. outerCache = node[ expando ] || (node[ expando ] = {});
  18475. // Support: IE <9 only
  18476. // Defend against cloned attroperties (jQuery gh-1709)
  18477. uniqueCache = outerCache[ node.uniqueID ] ||
  18478. (outerCache[ node.uniqueID ] = {});
  18479. cache = uniqueCache[ type ] || [];
  18480. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  18481. diff = nodeIndex;
  18482. }
  18483. // xml :nth-child(...)
  18484. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  18485. if ( diff === false ) {
  18486. // Use the same loop as above to seek `elem` from the start
  18487. while ( (node = ++nodeIndex && node && node[ dir ] ||
  18488. (diff = nodeIndex = 0) || start.pop()) ) {
  18489. if ( ( ofType ?
  18490. node.nodeName.toLowerCase() === name :
  18491. node.nodeType === 1 ) &&
  18492. ++diff ) {
  18493. // Cache the index of each encountered element
  18494. if ( useCache ) {
  18495. outerCache = node[ expando ] || (node[ expando ] = {});
  18496. // Support: IE <9 only
  18497. // Defend against cloned attroperties (jQuery gh-1709)
  18498. uniqueCache = outerCache[ node.uniqueID ] ||
  18499. (outerCache[ node.uniqueID ] = {});
  18500. uniqueCache[ type ] = [ dirruns, diff ];
  18501. }
  18502. if ( node === elem ) {
  18503. break;
  18504. }
  18505. }
  18506. }
  18507. }
  18508. }
  18509. // Incorporate the offset, then check against cycle size
  18510. diff -= last;
  18511. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  18512. }
  18513. };
  18514. },
  18515. "PSEUDO": function( pseudo, argument ) {
  18516. // pseudo-class names are case-insensitive
  18517. // http://www.w3.org/TR/selectors/#pseudo-classes
  18518. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  18519. // Remember that setFilters inherits from pseudos
  18520. var args,
  18521. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  18522. Sizzle.error( "unsupported pseudo: " + pseudo );
  18523. // The user may use createPseudo to indicate that
  18524. // arguments are needed to create the filter function
  18525. // just as Sizzle does
  18526. if ( fn[ expando ] ) {
  18527. return fn( argument );
  18528. }
  18529. // But maintain support for old signatures
  18530. if ( fn.length > 1 ) {
  18531. args = [ pseudo, pseudo, "", argument ];
  18532. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  18533. markFunction(function( seed, matches ) {
  18534. var idx,
  18535. matched = fn( seed, argument ),
  18536. i = matched.length;
  18537. while ( i-- ) {
  18538. idx = indexOf( seed, matched[i] );
  18539. seed[ idx ] = !( matches[ idx ] = matched[i] );
  18540. }
  18541. }) :
  18542. function( elem ) {
  18543. return fn( elem, 0, args );
  18544. };
  18545. }
  18546. return fn;
  18547. }
  18548. },
  18549. pseudos: {
  18550. // Potentially complex pseudos
  18551. "not": markFunction(function( selector ) {
  18552. // Trim the selector passed to compile
  18553. // to avoid treating leading and trailing
  18554. // spaces as combinators
  18555. var input = [],
  18556. results = [],
  18557. matcher = compile( selector.replace( rtrim, "$1" ) );
  18558. return matcher[ expando ] ?
  18559. markFunction(function( seed, matches, context, xml ) {
  18560. var elem,
  18561. unmatched = matcher( seed, null, xml, [] ),
  18562. i = seed.length;
  18563. // Match elements unmatched by `matcher`
  18564. while ( i-- ) {
  18565. if ( (elem = unmatched[i]) ) {
  18566. seed[i] = !(matches[i] = elem);
  18567. }
  18568. }
  18569. }) :
  18570. function( elem, context, xml ) {
  18571. input[0] = elem;
  18572. matcher( input, null, xml, results );
  18573. // Don't keep the element (issue #299)
  18574. input[0] = null;
  18575. return !results.pop();
  18576. };
  18577. }),
  18578. "has": markFunction(function( selector ) {
  18579. return function( elem ) {
  18580. return Sizzle( selector, elem ).length > 0;
  18581. };
  18582. }),
  18583. "contains": markFunction(function( text ) {
  18584. text = text.replace( runescape, funescape );
  18585. return function( elem ) {
  18586. return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
  18587. };
  18588. }),
  18589. // "Whether an element is represented by a :lang() selector
  18590. // is based solely on the element's language value
  18591. // being equal to the identifier C,
  18592. // or beginning with the identifier C immediately followed by "-".
  18593. // The matching of C against the element's language value is performed case-insensitively.
  18594. // The identifier C does not have to be a valid language name."
  18595. // http://www.w3.org/TR/selectors/#lang-pseudo
  18596. "lang": markFunction( function( lang ) {
  18597. // lang value must be a valid identifier
  18598. if ( !ridentifier.test(lang || "") ) {
  18599. Sizzle.error( "unsupported lang: " + lang );
  18600. }
  18601. lang = lang.replace( runescape, funescape ).toLowerCase();
  18602. return function( elem ) {
  18603. var elemLang;
  18604. do {
  18605. if ( (elemLang = documentIsHTML ?
  18606. elem.lang :
  18607. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  18608. elemLang = elemLang.toLowerCase();
  18609. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  18610. }
  18611. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  18612. return false;
  18613. };
  18614. }),
  18615. // Miscellaneous
  18616. "target": function( elem ) {
  18617. var hash = window.location && window.location.hash;
  18618. return hash && hash.slice( 1 ) === elem.id;
  18619. },
  18620. "root": function( elem ) {
  18621. return elem === docElem;
  18622. },
  18623. "focus": function( elem ) {
  18624. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  18625. },
  18626. // Boolean properties
  18627. "enabled": createDisabledPseudo( false ),
  18628. "disabled": createDisabledPseudo( true ),
  18629. "checked": function( elem ) {
  18630. // In CSS3, :checked should return both checked and selected elements
  18631. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  18632. var nodeName = elem.nodeName.toLowerCase();
  18633. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  18634. },
  18635. "selected": function( elem ) {
  18636. // Accessing this property makes selected-by-default
  18637. // options in Safari work properly
  18638. if ( elem.parentNode ) {
  18639. elem.parentNode.selectedIndex;
  18640. }
  18641. return elem.selected === true;
  18642. },
  18643. // Contents
  18644. "empty": function( elem ) {
  18645. // http://www.w3.org/TR/selectors/#empty-pseudo
  18646. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  18647. // but not by others (comment: 8; processing instruction: 7; etc.)
  18648. // nodeType < 6 works because attributes (2) do not appear as children
  18649. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  18650. if ( elem.nodeType < 6 ) {
  18651. return false;
  18652. }
  18653. }
  18654. return true;
  18655. },
  18656. "parent": function( elem ) {
  18657. return !Expr.pseudos["empty"]( elem );
  18658. },
  18659. // Element/input types
  18660. "header": function( elem ) {
  18661. return rheader.test( elem.nodeName );
  18662. },
  18663. "input": function( elem ) {
  18664. return rinputs.test( elem.nodeName );
  18665. },
  18666. "button": function( elem ) {
  18667. var name = elem.nodeName.toLowerCase();
  18668. return name === "input" && elem.type === "button" || name === "button";
  18669. },
  18670. "text": function( elem ) {
  18671. var attr;
  18672. return elem.nodeName.toLowerCase() === "input" &&
  18673. elem.type === "text" &&
  18674. // Support: IE<8
  18675. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  18676. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  18677. },
  18678. // Position-in-collection
  18679. "first": createPositionalPseudo(function() {
  18680. return [ 0 ];
  18681. }),
  18682. "last": createPositionalPseudo(function( matchIndexes, length ) {
  18683. return [ length - 1 ];
  18684. }),
  18685. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  18686. return [ argument < 0 ? argument + length : argument ];
  18687. }),
  18688. "even": createPositionalPseudo(function( matchIndexes, length ) {
  18689. var i = 0;
  18690. for ( ; i < length; i += 2 ) {
  18691. matchIndexes.push( i );
  18692. }
  18693. return matchIndexes;
  18694. }),
  18695. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  18696. var i = 1;
  18697. for ( ; i < length; i += 2 ) {
  18698. matchIndexes.push( i );
  18699. }
  18700. return matchIndexes;
  18701. }),
  18702. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  18703. var i = argument < 0 ? argument + length : argument;
  18704. for ( ; --i >= 0; ) {
  18705. matchIndexes.push( i );
  18706. }
  18707. return matchIndexes;
  18708. }),
  18709. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  18710. var i = argument < 0 ? argument + length : argument;
  18711. for ( ; ++i < length; ) {
  18712. matchIndexes.push( i );
  18713. }
  18714. return matchIndexes;
  18715. })
  18716. }
  18717. };
  18718. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  18719. // Add button/input type pseudos
  18720. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  18721. Expr.pseudos[ i ] = createInputPseudo( i );
  18722. }
  18723. for ( i in { submit: true, reset: true } ) {
  18724. Expr.pseudos[ i ] = createButtonPseudo( i );
  18725. }
  18726. // Easy API for creating new setFilters
  18727. function setFilters() {}
  18728. setFilters.prototype = Expr.filters = Expr.pseudos;
  18729. Expr.setFilters = new setFilters();
  18730. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  18731. var matched, match, tokens, type,
  18732. soFar, groups, preFilters,
  18733. cached = tokenCache[ selector + " " ];
  18734. if ( cached ) {
  18735. return parseOnly ? 0 : cached.slice( 0 );
  18736. }
  18737. soFar = selector;
  18738. groups = [];
  18739. preFilters = Expr.preFilter;
  18740. while ( soFar ) {
  18741. // Comma and first run
  18742. if ( !matched || (match = rcomma.exec( soFar )) ) {
  18743. if ( match ) {
  18744. // Don't consume trailing commas as valid
  18745. soFar = soFar.slice( match[0].length ) || soFar;
  18746. }
  18747. groups.push( (tokens = []) );
  18748. }
  18749. matched = false;
  18750. // Combinators
  18751. if ( (match = rcombinators.exec( soFar )) ) {
  18752. matched = match.shift();
  18753. tokens.push({
  18754. value: matched,
  18755. // Cast descendant combinators to space
  18756. type: match[0].replace( rtrim, " " )
  18757. });
  18758. soFar = soFar.slice( matched.length );
  18759. }
  18760. // Filters
  18761. for ( type in Expr.filter ) {
  18762. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  18763. (match = preFilters[ type ]( match ))) ) {
  18764. matched = match.shift();
  18765. tokens.push({
  18766. value: matched,
  18767. type: type,
  18768. matches: match
  18769. });
  18770. soFar = soFar.slice( matched.length );
  18771. }
  18772. }
  18773. if ( !matched ) {
  18774. break;
  18775. }
  18776. }
  18777. // Return the length of the invalid excess
  18778. // if we're just parsing
  18779. // Otherwise, throw an error or return tokens
  18780. return parseOnly ?
  18781. soFar.length :
  18782. soFar ?
  18783. Sizzle.error( selector ) :
  18784. // Cache the tokens
  18785. tokenCache( selector, groups ).slice( 0 );
  18786. };
  18787. function toSelector( tokens ) {
  18788. var i = 0,
  18789. len = tokens.length,
  18790. selector = "";
  18791. for ( ; i < len; i++ ) {
  18792. selector += tokens[i].value;
  18793. }
  18794. return selector;
  18795. }
  18796. function addCombinator( matcher, combinator, base ) {
  18797. var dir = combinator.dir,
  18798. skip = combinator.next,
  18799. key = skip || dir,
  18800. checkNonElements = base && key === "parentNode",
  18801. doneName = done++;
  18802. return combinator.first ?
  18803. // Check against closest ancestor/preceding element
  18804. function( elem, context, xml ) {
  18805. while ( (elem = elem[ dir ]) ) {
  18806. if ( elem.nodeType === 1 || checkNonElements ) {
  18807. return matcher( elem, context, xml );
  18808. }
  18809. }
  18810. return false;
  18811. } :
  18812. // Check against all ancestor/preceding elements
  18813. function( elem, context, xml ) {
  18814. var oldCache, uniqueCache, outerCache,
  18815. newCache = [ dirruns, doneName ];
  18816. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  18817. if ( xml ) {
  18818. while ( (elem = elem[ dir ]) ) {
  18819. if ( elem.nodeType === 1 || checkNonElements ) {
  18820. if ( matcher( elem, context, xml ) ) {
  18821. return true;
  18822. }
  18823. }
  18824. }
  18825. } else {
  18826. while ( (elem = elem[ dir ]) ) {
  18827. if ( elem.nodeType === 1 || checkNonElements ) {
  18828. outerCache = elem[ expando ] || (elem[ expando ] = {});
  18829. // Support: IE <9 only
  18830. // Defend against cloned attroperties (jQuery gh-1709)
  18831. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  18832. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  18833. elem = elem[ dir ] || elem;
  18834. } else if ( (oldCache = uniqueCache[ key ]) &&
  18835. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  18836. // Assign to newCache so results back-propagate to previous elements
  18837. return (newCache[ 2 ] = oldCache[ 2 ]);
  18838. } else {
  18839. // Reuse newcache so results back-propagate to previous elements
  18840. uniqueCache[ key ] = newCache;
  18841. // A match means we're done; a fail means we have to keep checking
  18842. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  18843. return true;
  18844. }
  18845. }
  18846. }
  18847. }
  18848. }
  18849. return false;
  18850. };
  18851. }
  18852. function elementMatcher( matchers ) {
  18853. return matchers.length > 1 ?
  18854. function( elem, context, xml ) {
  18855. var i = matchers.length;
  18856. while ( i-- ) {
  18857. if ( !matchers[i]( elem, context, xml ) ) {
  18858. return false;
  18859. }
  18860. }
  18861. return true;
  18862. } :
  18863. matchers[0];
  18864. }
  18865. function multipleContexts( selector, contexts, results ) {
  18866. var i = 0,
  18867. len = contexts.length;
  18868. for ( ; i < len; i++ ) {
  18869. Sizzle( selector, contexts[i], results );
  18870. }
  18871. return results;
  18872. }
  18873. function condense( unmatched, map, filter, context, xml ) {
  18874. var elem,
  18875. newUnmatched = [],
  18876. i = 0,
  18877. len = unmatched.length,
  18878. mapped = map != null;
  18879. for ( ; i < len; i++ ) {
  18880. if ( (elem = unmatched[i]) ) {
  18881. if ( !filter || filter( elem, context, xml ) ) {
  18882. newUnmatched.push( elem );
  18883. if ( mapped ) {
  18884. map.push( i );
  18885. }
  18886. }
  18887. }
  18888. }
  18889. return newUnmatched;
  18890. }
  18891. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  18892. if ( postFilter && !postFilter[ expando ] ) {
  18893. postFilter = setMatcher( postFilter );
  18894. }
  18895. if ( postFinder && !postFinder[ expando ] ) {
  18896. postFinder = setMatcher( postFinder, postSelector );
  18897. }
  18898. return markFunction(function( seed, results, context, xml ) {
  18899. var temp, i, elem,
  18900. preMap = [],
  18901. postMap = [],
  18902. preexisting = results.length,
  18903. // Get initial elements from seed or context
  18904. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  18905. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  18906. matcherIn = preFilter && ( seed || !selector ) ?
  18907. condense( elems, preMap, preFilter, context, xml ) :
  18908. elems,
  18909. matcherOut = matcher ?
  18910. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  18911. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  18912. // ...intermediate processing is necessary
  18913. [] :
  18914. // ...otherwise use results directly
  18915. results :
  18916. matcherIn;
  18917. // Find primary matches
  18918. if ( matcher ) {
  18919. matcher( matcherIn, matcherOut, context, xml );
  18920. }
  18921. // Apply postFilter
  18922. if ( postFilter ) {
  18923. temp = condense( matcherOut, postMap );
  18924. postFilter( temp, [], context, xml );
  18925. // Un-match failing elements by moving them back to matcherIn
  18926. i = temp.length;
  18927. while ( i-- ) {
  18928. if ( (elem = temp[i]) ) {
  18929. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  18930. }
  18931. }
  18932. }
  18933. if ( seed ) {
  18934. if ( postFinder || preFilter ) {
  18935. if ( postFinder ) {
  18936. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  18937. temp = [];
  18938. i = matcherOut.length;
  18939. while ( i-- ) {
  18940. if ( (elem = matcherOut[i]) ) {
  18941. // Restore matcherIn since elem is not yet a final match
  18942. temp.push( (matcherIn[i] = elem) );
  18943. }
  18944. }
  18945. postFinder( null, (matcherOut = []), temp, xml );
  18946. }
  18947. // Move matched elements from seed to results to keep them synchronized
  18948. i = matcherOut.length;
  18949. while ( i-- ) {
  18950. if ( (elem = matcherOut[i]) &&
  18951. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  18952. seed[temp] = !(results[temp] = elem);
  18953. }
  18954. }
  18955. }
  18956. // Add elements to results, through postFinder if defined
  18957. } else {
  18958. matcherOut = condense(
  18959. matcherOut === results ?
  18960. matcherOut.splice( preexisting, matcherOut.length ) :
  18961. matcherOut
  18962. );
  18963. if ( postFinder ) {
  18964. postFinder( null, results, matcherOut, xml );
  18965. } else {
  18966. push.apply( results, matcherOut );
  18967. }
  18968. }
  18969. });
  18970. }
  18971. function matcherFromTokens( tokens ) {
  18972. var checkContext, matcher, j,
  18973. len = tokens.length,
  18974. leadingRelative = Expr.relative[ tokens[0].type ],
  18975. implicitRelative = leadingRelative || Expr.relative[" "],
  18976. i = leadingRelative ? 1 : 0,
  18977. // The foundational matcher ensures that elements are reachable from top-level context(s)
  18978. matchContext = addCombinator( function( elem ) {
  18979. return elem === checkContext;
  18980. }, implicitRelative, true ),
  18981. matchAnyContext = addCombinator( function( elem ) {
  18982. return indexOf( checkContext, elem ) > -1;
  18983. }, implicitRelative, true ),
  18984. matchers = [ function( elem, context, xml ) {
  18985. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  18986. (checkContext = context).nodeType ?
  18987. matchContext( elem, context, xml ) :
  18988. matchAnyContext( elem, context, xml ) );
  18989. // Avoid hanging onto element (issue #299)
  18990. checkContext = null;
  18991. return ret;
  18992. } ];
  18993. for ( ; i < len; i++ ) {
  18994. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  18995. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  18996. } else {
  18997. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  18998. // Return special upon seeing a positional matcher
  18999. if ( matcher[ expando ] ) {
  19000. // Find the next relative operator (if any) for proper handling
  19001. j = ++i;
  19002. for ( ; j < len; j++ ) {
  19003. if ( Expr.relative[ tokens[j].type ] ) {
  19004. break;
  19005. }
  19006. }
  19007. return setMatcher(
  19008. i > 1 && elementMatcher( matchers ),
  19009. i > 1 && toSelector(
  19010. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  19011. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  19012. ).replace( rtrim, "$1" ),
  19013. matcher,
  19014. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  19015. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  19016. j < len && toSelector( tokens )
  19017. );
  19018. }
  19019. matchers.push( matcher );
  19020. }
  19021. }
  19022. return elementMatcher( matchers );
  19023. }
  19024. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  19025. var bySet = setMatchers.length > 0,
  19026. byElement = elementMatchers.length > 0,
  19027. superMatcher = function( seed, context, xml, results, outermost ) {
  19028. var elem, j, matcher,
  19029. matchedCount = 0,
  19030. i = "0",
  19031. unmatched = seed && [],
  19032. setMatched = [],
  19033. contextBackup = outermostContext,
  19034. // We must always have either seed elements or outermost context
  19035. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  19036. // Use integer dirruns iff this is the outermost matcher
  19037. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  19038. len = elems.length;
  19039. if ( outermost ) {
  19040. outermostContext = context === document || context || outermost;
  19041. }
  19042. // Add elements passing elementMatchers directly to results
  19043. // Support: IE<9, Safari
  19044. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  19045. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  19046. if ( byElement && elem ) {
  19047. j = 0;
  19048. if ( !context && elem.ownerDocument !== document ) {
  19049. setDocument( elem );
  19050. xml = !documentIsHTML;
  19051. }
  19052. while ( (matcher = elementMatchers[j++]) ) {
  19053. if ( matcher( elem, context || document, xml) ) {
  19054. results.push( elem );
  19055. break;
  19056. }
  19057. }
  19058. if ( outermost ) {
  19059. dirruns = dirrunsUnique;
  19060. }
  19061. }
  19062. // Track unmatched elements for set filters
  19063. if ( bySet ) {
  19064. // They will have gone through all possible matchers
  19065. if ( (elem = !matcher && elem) ) {
  19066. matchedCount--;
  19067. }
  19068. // Lengthen the array for every element, matched or not
  19069. if ( seed ) {
  19070. unmatched.push( elem );
  19071. }
  19072. }
  19073. }
  19074. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  19075. // makes the latter nonnegative.
  19076. matchedCount += i;
  19077. // Apply set filters to unmatched elements
  19078. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  19079. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  19080. // no element matchers and no seed.
  19081. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  19082. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  19083. // numerically zero.
  19084. if ( bySet && i !== matchedCount ) {
  19085. j = 0;
  19086. while ( (matcher = setMatchers[j++]) ) {
  19087. matcher( unmatched, setMatched, context, xml );
  19088. }
  19089. if ( seed ) {
  19090. // Reintegrate element matches to eliminate the need for sorting
  19091. if ( matchedCount > 0 ) {
  19092. while ( i-- ) {
  19093. if ( !(unmatched[i] || setMatched[i]) ) {
  19094. setMatched[i] = pop.call( results );
  19095. }
  19096. }
  19097. }
  19098. // Discard index placeholder values to get only actual matches
  19099. setMatched = condense( setMatched );
  19100. }
  19101. // Add matches to results
  19102. push.apply( results, setMatched );
  19103. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  19104. if ( outermost && !seed && setMatched.length > 0 &&
  19105. ( matchedCount + setMatchers.length ) > 1 ) {
  19106. Sizzle.uniqueSort( results );
  19107. }
  19108. }
  19109. // Override manipulation of globals by nested matchers
  19110. if ( outermost ) {
  19111. dirruns = dirrunsUnique;
  19112. outermostContext = contextBackup;
  19113. }
  19114. return unmatched;
  19115. };
  19116. return bySet ?
  19117. markFunction( superMatcher ) :
  19118. superMatcher;
  19119. }
  19120. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  19121. var i,
  19122. setMatchers = [],
  19123. elementMatchers = [],
  19124. cached = compilerCache[ selector + " " ];
  19125. if ( !cached ) {
  19126. // Generate a function of recursive functions that can be used to check each element
  19127. if ( !match ) {
  19128. match = tokenize( selector );
  19129. }
  19130. i = match.length;
  19131. while ( i-- ) {
  19132. cached = matcherFromTokens( match[i] );
  19133. if ( cached[ expando ] ) {
  19134. setMatchers.push( cached );
  19135. } else {
  19136. elementMatchers.push( cached );
  19137. }
  19138. }
  19139. // Cache the compiled function
  19140. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  19141. // Save selector and tokenization
  19142. cached.selector = selector;
  19143. }
  19144. return cached;
  19145. };
  19146. /**
  19147. * A low-level selection function that works with Sizzle's compiled
  19148. * selector functions
  19149. * @param {String|Function} selector A selector or a pre-compiled
  19150. * selector function built with Sizzle.compile
  19151. * @param {Element} context
  19152. * @param {Array} [results]
  19153. * @param {Array} [seed] A set of elements to match against
  19154. */
  19155. select = Sizzle.select = function( selector, context, results, seed ) {
  19156. var i, tokens, token, type, find,
  19157. compiled = typeof selector === "function" && selector,
  19158. match = !seed && tokenize( (selector = compiled.selector || selector) );
  19159. results = results || [];
  19160. // Try to minimize operations if there is only one selector in the list and no seed
  19161. // (the latter of which guarantees us context)
  19162. if ( match.length === 1 ) {
  19163. // Reduce context if the leading compound selector is an ID
  19164. tokens = match[0] = match[0].slice( 0 );
  19165. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  19166. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  19167. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  19168. if ( !context ) {
  19169. return results;
  19170. // Precompiled matchers will still verify ancestry, so step up a level
  19171. } else if ( compiled ) {
  19172. context = context.parentNode;
  19173. }
  19174. selector = selector.slice( tokens.shift().value.length );
  19175. }
  19176. // Fetch a seed set for right-to-left matching
  19177. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  19178. while ( i-- ) {
  19179. token = tokens[i];
  19180. // Abort if we hit a combinator
  19181. if ( Expr.relative[ (type = token.type) ] ) {
  19182. break;
  19183. }
  19184. if ( (find = Expr.find[ type ]) ) {
  19185. // Search, expanding context for leading sibling combinators
  19186. if ( (seed = find(
  19187. token.matches[0].replace( runescape, funescape ),
  19188. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  19189. )) ) {
  19190. // If seed is empty or no tokens remain, we can return early
  19191. tokens.splice( i, 1 );
  19192. selector = seed.length && toSelector( tokens );
  19193. if ( !selector ) {
  19194. push.apply( results, seed );
  19195. return results;
  19196. }
  19197. break;
  19198. }
  19199. }
  19200. }
  19201. }
  19202. // Compile and execute a filtering function if one is not provided
  19203. // Provide `match` to avoid retokenization if we modified the selector above
  19204. ( compiled || compile( selector, match ) )(
  19205. seed,
  19206. context,
  19207. !documentIsHTML,
  19208. results,
  19209. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  19210. );
  19211. return results;
  19212. };
  19213. // One-time assignments
  19214. // Sort stability
  19215. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  19216. // Support: Chrome 14-35+
  19217. // Always assume duplicates if they aren't passed to the comparison function
  19218. support.detectDuplicates = !!hasDuplicate;
  19219. // Initialize against the default document
  19220. setDocument();
  19221. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  19222. // Detached nodes confoundingly follow *each other*
  19223. support.sortDetached = assert(function( el ) {
  19224. // Should return 1, but returns 4 (following)
  19225. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  19226. });
  19227. // Support: IE<8
  19228. // Prevent attribute/property "interpolation"
  19229. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  19230. if ( !assert(function( el ) {
  19231. el.innerHTML = "<a href='#'></a>";
  19232. return el.firstChild.getAttribute("href") === "#" ;
  19233. }) ) {
  19234. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  19235. if ( !isXML ) {
  19236. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  19237. }
  19238. });
  19239. }
  19240. // Support: IE<9
  19241. // Use defaultValue in place of getAttribute("value")
  19242. if ( !support.attributes || !assert(function( el ) {
  19243. el.innerHTML = "<input/>";
  19244. el.firstChild.setAttribute( "value", "" );
  19245. return el.firstChild.getAttribute( "value" ) === "";
  19246. }) ) {
  19247. addHandle( "value", function( elem, name, isXML ) {
  19248. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  19249. return elem.defaultValue;
  19250. }
  19251. });
  19252. }
  19253. // Support: IE<9
  19254. // Use getAttributeNode to fetch booleans when getAttribute lies
  19255. if ( !assert(function( el ) {
  19256. return el.getAttribute("disabled") == null;
  19257. }) ) {
  19258. addHandle( booleans, function( elem, name, isXML ) {
  19259. var val;
  19260. if ( !isXML ) {
  19261. return elem[ name ] === true ? name.toLowerCase() :
  19262. (val = elem.getAttributeNode( name )) && val.specified ?
  19263. val.value :
  19264. null;
  19265. }
  19266. });
  19267. }
  19268. return Sizzle;
  19269. })( window );
  19270. jQuery.find = Sizzle;
  19271. jQuery.expr = Sizzle.selectors;
  19272. // Deprecated
  19273. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  19274. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  19275. jQuery.text = Sizzle.getText;
  19276. jQuery.isXMLDoc = Sizzle.isXML;
  19277. jQuery.contains = Sizzle.contains;
  19278. jQuery.escapeSelector = Sizzle.escape;
  19279. var dir = function( elem, dir, until ) {
  19280. var matched = [],
  19281. truncate = until !== undefined;
  19282. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  19283. if ( elem.nodeType === 1 ) {
  19284. if ( truncate && jQuery( elem ).is( until ) ) {
  19285. break;
  19286. }
  19287. matched.push( elem );
  19288. }
  19289. }
  19290. return matched;
  19291. };
  19292. var siblings = function( n, elem ) {
  19293. var matched = [];
  19294. for ( ; n; n = n.nextSibling ) {
  19295. if ( n.nodeType === 1 && n !== elem ) {
  19296. matched.push( n );
  19297. }
  19298. }
  19299. return matched;
  19300. };
  19301. var rneedsContext = jQuery.expr.match.needsContext;
  19302. function nodeName( elem, name ) {
  19303. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  19304. };
  19305. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  19306. // Implement the identical functionality for filter and not
  19307. function winnow( elements, qualifier, not ) {
  19308. if ( isFunction( qualifier ) ) {
  19309. return jQuery.grep( elements, function( elem, i ) {
  19310. return !!qualifier.call( elem, i, elem ) !== not;
  19311. } );
  19312. }
  19313. // Single element
  19314. if ( qualifier.nodeType ) {
  19315. return jQuery.grep( elements, function( elem ) {
  19316. return ( elem === qualifier ) !== not;
  19317. } );
  19318. }
  19319. // Arraylike of elements (jQuery, arguments, Array)
  19320. if ( typeof qualifier !== "string" ) {
  19321. return jQuery.grep( elements, function( elem ) {
  19322. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  19323. } );
  19324. }
  19325. // Filtered directly for both simple and complex selectors
  19326. return jQuery.filter( qualifier, elements, not );
  19327. }
  19328. jQuery.filter = function( expr, elems, not ) {
  19329. var elem = elems[ 0 ];
  19330. if ( not ) {
  19331. expr = ":not(" + expr + ")";
  19332. }
  19333. if ( elems.length === 1 && elem.nodeType === 1 ) {
  19334. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  19335. }
  19336. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  19337. return elem.nodeType === 1;
  19338. } ) );
  19339. };
  19340. jQuery.fn.extend( {
  19341. find: function( selector ) {
  19342. var i, ret,
  19343. len = this.length,
  19344. self = this;
  19345. if ( typeof selector !== "string" ) {
  19346. return this.pushStack( jQuery( selector ).filter( function() {
  19347. for ( i = 0; i < len; i++ ) {
  19348. if ( jQuery.contains( self[ i ], this ) ) {
  19349. return true;
  19350. }
  19351. }
  19352. } ) );
  19353. }
  19354. ret = this.pushStack( [] );
  19355. for ( i = 0; i < len; i++ ) {
  19356. jQuery.find( selector, self[ i ], ret );
  19357. }
  19358. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  19359. },
  19360. filter: function( selector ) {
  19361. return this.pushStack( winnow( this, selector || [], false ) );
  19362. },
  19363. not: function( selector ) {
  19364. return this.pushStack( winnow( this, selector || [], true ) );
  19365. },
  19366. is: function( selector ) {
  19367. return !!winnow(
  19368. this,
  19369. // If this is a positional/relative selector, check membership in the returned set
  19370. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  19371. typeof selector === "string" && rneedsContext.test( selector ) ?
  19372. jQuery( selector ) :
  19373. selector || [],
  19374. false
  19375. ).length;
  19376. }
  19377. } );
  19378. // Initialize a jQuery object
  19379. // A central reference to the root jQuery(document)
  19380. var rootjQuery,
  19381. // A simple way to check for HTML strings
  19382. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  19383. // Strict HTML recognition (#11290: must start with <)
  19384. // Shortcut simple #id case for speed
  19385. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  19386. init = jQuery.fn.init = function( selector, context, root ) {
  19387. var match, elem;
  19388. // HANDLE: $(""), $(null), $(undefined), $(false)
  19389. if ( !selector ) {
  19390. return this;
  19391. }
  19392. // Method init() accepts an alternate rootjQuery
  19393. // so migrate can support jQuery.sub (gh-2101)
  19394. root = root || rootjQuery;
  19395. // Handle HTML strings
  19396. if ( typeof selector === "string" ) {
  19397. if ( selector[ 0 ] === "<" &&
  19398. selector[ selector.length - 1 ] === ">" &&
  19399. selector.length >= 3 ) {
  19400. // Assume that strings that start and end with <> are HTML and skip the regex check
  19401. match = [ null, selector, null ];
  19402. } else {
  19403. match = rquickExpr.exec( selector );
  19404. }
  19405. // Match html or make sure no context is specified for #id
  19406. if ( match && ( match[ 1 ] || !context ) ) {
  19407. // HANDLE: $(html) -> $(array)
  19408. if ( match[ 1 ] ) {
  19409. context = context instanceof jQuery ? context[ 0 ] : context;
  19410. // Option to run scripts is true for back-compat
  19411. // Intentionally let the error be thrown if parseHTML is not present
  19412. jQuery.merge( this, jQuery.parseHTML(
  19413. match[ 1 ],
  19414. context && context.nodeType ? context.ownerDocument || context : document,
  19415. true
  19416. ) );
  19417. // HANDLE: $(html, props)
  19418. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  19419. for ( match in context ) {
  19420. // Properties of context are called as methods if possible
  19421. if ( isFunction( this[ match ] ) ) {
  19422. this[ match ]( context[ match ] );
  19423. // ...and otherwise set as attributes
  19424. } else {
  19425. this.attr( match, context[ match ] );
  19426. }
  19427. }
  19428. }
  19429. return this;
  19430. // HANDLE: $(#id)
  19431. } else {
  19432. elem = document.getElementById( match[ 2 ] );
  19433. if ( elem ) {
  19434. // Inject the element directly into the jQuery object
  19435. this[ 0 ] = elem;
  19436. this.length = 1;
  19437. }
  19438. return this;
  19439. }
  19440. // HANDLE: $(expr, $(...))
  19441. } else if ( !context || context.jquery ) {
  19442. return ( context || root ).find( selector );
  19443. // HANDLE: $(expr, context)
  19444. // (which is just equivalent to: $(context).find(expr)
  19445. } else {
  19446. return this.constructor( context ).find( selector );
  19447. }
  19448. // HANDLE: $(DOMElement)
  19449. } else if ( selector.nodeType ) {
  19450. this[ 0 ] = selector;
  19451. this.length = 1;
  19452. return this;
  19453. // HANDLE: $(function)
  19454. // Shortcut for document ready
  19455. } else if ( isFunction( selector ) ) {
  19456. return root.ready !== undefined ?
  19457. root.ready( selector ) :
  19458. // Execute immediately if ready is not present
  19459. selector( jQuery );
  19460. }
  19461. return jQuery.makeArray( selector, this );
  19462. };
  19463. // Give the init function the jQuery prototype for later instantiation
  19464. init.prototype = jQuery.fn;
  19465. // Initialize central reference
  19466. rootjQuery = jQuery( document );
  19467. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  19468. // Methods guaranteed to produce a unique set when starting from a unique set
  19469. guaranteedUnique = {
  19470. children: true,
  19471. contents: true,
  19472. next: true,
  19473. prev: true
  19474. };
  19475. jQuery.fn.extend( {
  19476. has: function( target ) {
  19477. var targets = jQuery( target, this ),
  19478. l = targets.length;
  19479. return this.filter( function() {
  19480. var i = 0;
  19481. for ( ; i < l; i++ ) {
  19482. if ( jQuery.contains( this, targets[ i ] ) ) {
  19483. return true;
  19484. }
  19485. }
  19486. } );
  19487. },
  19488. closest: function( selectors, context ) {
  19489. var cur,
  19490. i = 0,
  19491. l = this.length,
  19492. matched = [],
  19493. targets = typeof selectors !== "string" && jQuery( selectors );
  19494. // Positional selectors never match, since there's no _selection_ context
  19495. if ( !rneedsContext.test( selectors ) ) {
  19496. for ( ; i < l; i++ ) {
  19497. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  19498. // Always skip document fragments
  19499. if ( cur.nodeType < 11 && ( targets ?
  19500. targets.index( cur ) > -1 :
  19501. // Don't pass non-elements to Sizzle
  19502. cur.nodeType === 1 &&
  19503. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  19504. matched.push( cur );
  19505. break;
  19506. }
  19507. }
  19508. }
  19509. }
  19510. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  19511. },
  19512. // Determine the position of an element within the set
  19513. index: function( elem ) {
  19514. // No argument, return index in parent
  19515. if ( !elem ) {
  19516. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  19517. }
  19518. // Index in selector
  19519. if ( typeof elem === "string" ) {
  19520. return indexOf.call( jQuery( elem ), this[ 0 ] );
  19521. }
  19522. // Locate the position of the desired element
  19523. return indexOf.call( this,
  19524. // If it receives a jQuery object, the first element is used
  19525. elem.jquery ? elem[ 0 ] : elem
  19526. );
  19527. },
  19528. add: function( selector, context ) {
  19529. return this.pushStack(
  19530. jQuery.uniqueSort(
  19531. jQuery.merge( this.get(), jQuery( selector, context ) )
  19532. )
  19533. );
  19534. },
  19535. addBack: function( selector ) {
  19536. return this.add( selector == null ?
  19537. this.prevObject : this.prevObject.filter( selector )
  19538. );
  19539. }
  19540. } );
  19541. function sibling( cur, dir ) {
  19542. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  19543. return cur;
  19544. }
  19545. jQuery.each( {
  19546. parent: function( elem ) {
  19547. var parent = elem.parentNode;
  19548. return parent && parent.nodeType !== 11 ? parent : null;
  19549. },
  19550. parents: function( elem ) {
  19551. return dir( elem, "parentNode" );
  19552. },
  19553. parentsUntil: function( elem, i, until ) {
  19554. return dir( elem, "parentNode", until );
  19555. },
  19556. next: function( elem ) {
  19557. return sibling( elem, "nextSibling" );
  19558. },
  19559. prev: function( elem ) {
  19560. return sibling( elem, "previousSibling" );
  19561. },
  19562. nextAll: function( elem ) {
  19563. return dir( elem, "nextSibling" );
  19564. },
  19565. prevAll: function( elem ) {
  19566. return dir( elem, "previousSibling" );
  19567. },
  19568. nextUntil: function( elem, i, until ) {
  19569. return dir( elem, "nextSibling", until );
  19570. },
  19571. prevUntil: function( elem, i, until ) {
  19572. return dir( elem, "previousSibling", until );
  19573. },
  19574. siblings: function( elem ) {
  19575. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  19576. },
  19577. children: function( elem ) {
  19578. return siblings( elem.firstChild );
  19579. },
  19580. contents: function( elem ) {
  19581. if ( nodeName( elem, "iframe" ) ) {
  19582. return elem.contentDocument;
  19583. }
  19584. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  19585. // Treat the template element as a regular one in browsers that
  19586. // don't support it.
  19587. if ( nodeName( elem, "template" ) ) {
  19588. elem = elem.content || elem;
  19589. }
  19590. return jQuery.merge( [], elem.childNodes );
  19591. }
  19592. }, function( name, fn ) {
  19593. jQuery.fn[ name ] = function( until, selector ) {
  19594. var matched = jQuery.map( this, fn, until );
  19595. if ( name.slice( -5 ) !== "Until" ) {
  19596. selector = until;
  19597. }
  19598. if ( selector && typeof selector === "string" ) {
  19599. matched = jQuery.filter( selector, matched );
  19600. }
  19601. if ( this.length > 1 ) {
  19602. // Remove duplicates
  19603. if ( !guaranteedUnique[ name ] ) {
  19604. jQuery.uniqueSort( matched );
  19605. }
  19606. // Reverse order for parents* and prev-derivatives
  19607. if ( rparentsprev.test( name ) ) {
  19608. matched.reverse();
  19609. }
  19610. }
  19611. return this.pushStack( matched );
  19612. };
  19613. } );
  19614. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  19615. // Convert String-formatted options into Object-formatted ones
  19616. function createOptions( options ) {
  19617. var object = {};
  19618. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  19619. object[ flag ] = true;
  19620. } );
  19621. return object;
  19622. }
  19623. /*
  19624. * Create a callback list using the following parameters:
  19625. *
  19626. * options: an optional list of space-separated options that will change how
  19627. * the callback list behaves or a more traditional option object
  19628. *
  19629. * By default a callback list will act like an event callback list and can be
  19630. * "fired" multiple times.
  19631. *
  19632. * Possible options:
  19633. *
  19634. * once: will ensure the callback list can only be fired once (like a Deferred)
  19635. *
  19636. * memory: will keep track of previous values and will call any callback added
  19637. * after the list has been fired right away with the latest "memorized"
  19638. * values (like a Deferred)
  19639. *
  19640. * unique: will ensure a callback can only be added once (no duplicate in the list)
  19641. *
  19642. * stopOnFalse: interrupt callings when a callback returns false
  19643. *
  19644. */
  19645. jQuery.Callbacks = function( options ) {
  19646. // Convert options from String-formatted to Object-formatted if needed
  19647. // (we check in cache first)
  19648. options = typeof options === "string" ?
  19649. createOptions( options ) :
  19650. jQuery.extend( {}, options );
  19651. var // Flag to know if list is currently firing
  19652. firing,
  19653. // Last fire value for non-forgettable lists
  19654. memory,
  19655. // Flag to know if list was already fired
  19656. fired,
  19657. // Flag to prevent firing
  19658. locked,
  19659. // Actual callback list
  19660. list = [],
  19661. // Queue of execution data for repeatable lists
  19662. queue = [],
  19663. // Index of currently firing callback (modified by add/remove as needed)
  19664. firingIndex = -1,
  19665. // Fire callbacks
  19666. fire = function() {
  19667. // Enforce single-firing
  19668. locked = locked || options.once;
  19669. // Execute callbacks for all pending executions,
  19670. // respecting firingIndex overrides and runtime changes
  19671. fired = firing = true;
  19672. for ( ; queue.length; firingIndex = -1 ) {
  19673. memory = queue.shift();
  19674. while ( ++firingIndex < list.length ) {
  19675. // Run callback and check for early termination
  19676. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  19677. options.stopOnFalse ) {
  19678. // Jump to end and forget the data so .add doesn't re-fire
  19679. firingIndex = list.length;
  19680. memory = false;
  19681. }
  19682. }
  19683. }
  19684. // Forget the data if we're done with it
  19685. if ( !options.memory ) {
  19686. memory = false;
  19687. }
  19688. firing = false;
  19689. // Clean up if we're done firing for good
  19690. if ( locked ) {
  19691. // Keep an empty list if we have data for future add calls
  19692. if ( memory ) {
  19693. list = [];
  19694. // Otherwise, this object is spent
  19695. } else {
  19696. list = "";
  19697. }
  19698. }
  19699. },
  19700. // Actual Callbacks object
  19701. self = {
  19702. // Add a callback or a collection of callbacks to the list
  19703. add: function() {
  19704. if ( list ) {
  19705. // If we have memory from a past run, we should fire after adding
  19706. if ( memory && !firing ) {
  19707. firingIndex = list.length - 1;
  19708. queue.push( memory );
  19709. }
  19710. ( function add( args ) {
  19711. jQuery.each( args, function( _, arg ) {
  19712. if ( isFunction( arg ) ) {
  19713. if ( !options.unique || !self.has( arg ) ) {
  19714. list.push( arg );
  19715. }
  19716. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  19717. // Inspect recursively
  19718. add( arg );
  19719. }
  19720. } );
  19721. } )( arguments );
  19722. if ( memory && !firing ) {
  19723. fire();
  19724. }
  19725. }
  19726. return this;
  19727. },
  19728. // Remove a callback from the list
  19729. remove: function() {
  19730. jQuery.each( arguments, function( _, arg ) {
  19731. var index;
  19732. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  19733. list.splice( index, 1 );
  19734. // Handle firing indexes
  19735. if ( index <= firingIndex ) {
  19736. firingIndex--;
  19737. }
  19738. }
  19739. } );
  19740. return this;
  19741. },
  19742. // Check if a given callback is in the list.
  19743. // If no argument is given, return whether or not list has callbacks attached.
  19744. has: function( fn ) {
  19745. return fn ?
  19746. jQuery.inArray( fn, list ) > -1 :
  19747. list.length > 0;
  19748. },
  19749. // Remove all callbacks from the list
  19750. empty: function() {
  19751. if ( list ) {
  19752. list = [];
  19753. }
  19754. return this;
  19755. },
  19756. // Disable .fire and .add
  19757. // Abort any current/pending executions
  19758. // Clear all callbacks and values
  19759. disable: function() {
  19760. locked = queue = [];
  19761. list = memory = "";
  19762. return this;
  19763. },
  19764. disabled: function() {
  19765. return !list;
  19766. },
  19767. // Disable .fire
  19768. // Also disable .add unless we have memory (since it would have no effect)
  19769. // Abort any pending executions
  19770. lock: function() {
  19771. locked = queue = [];
  19772. if ( !memory && !firing ) {
  19773. list = memory = "";
  19774. }
  19775. return this;
  19776. },
  19777. locked: function() {
  19778. return !!locked;
  19779. },
  19780. // Call all callbacks with the given context and arguments
  19781. fireWith: function( context, args ) {
  19782. if ( !locked ) {
  19783. args = args || [];
  19784. args = [ context, args.slice ? args.slice() : args ];
  19785. queue.push( args );
  19786. if ( !firing ) {
  19787. fire();
  19788. }
  19789. }
  19790. return this;
  19791. },
  19792. // Call all the callbacks with the given arguments
  19793. fire: function() {
  19794. self.fireWith( this, arguments );
  19795. return this;
  19796. },
  19797. // To know if the callbacks have already been called at least once
  19798. fired: function() {
  19799. return !!fired;
  19800. }
  19801. };
  19802. return self;
  19803. };
  19804. function Identity( v ) {
  19805. return v;
  19806. }
  19807. function Thrower( ex ) {
  19808. throw ex;
  19809. }
  19810. function adoptValue( value, resolve, reject, noValue ) {
  19811. var method;
  19812. try {
  19813. // Check for promise aspect first to privilege synchronous behavior
  19814. if ( value && isFunction( ( method = value.promise ) ) ) {
  19815. method.call( value ).done( resolve ).fail( reject );
  19816. // Other thenables
  19817. } else if ( value && isFunction( ( method = value.then ) ) ) {
  19818. method.call( value, resolve, reject );
  19819. // Other non-thenables
  19820. } else {
  19821. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  19822. // * false: [ value ].slice( 0 ) => resolve( value )
  19823. // * true: [ value ].slice( 1 ) => resolve()
  19824. resolve.apply( undefined, [ value ].slice( noValue ) );
  19825. }
  19826. // For Promises/A+, convert exceptions into rejections
  19827. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  19828. // Deferred#then to conditionally suppress rejection.
  19829. } catch ( value ) {
  19830. // Support: Android 4.0 only
  19831. // Strict mode functions invoked without .call/.apply get global-object context
  19832. reject.apply( undefined, [ value ] );
  19833. }
  19834. }
  19835. jQuery.extend( {
  19836. Deferred: function( func ) {
  19837. var tuples = [
  19838. // action, add listener, callbacks,
  19839. // ... .then handlers, argument index, [final state]
  19840. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  19841. jQuery.Callbacks( "memory" ), 2 ],
  19842. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  19843. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  19844. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  19845. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  19846. ],
  19847. state = "pending",
  19848. promise = {
  19849. state: function() {
  19850. return state;
  19851. },
  19852. always: function() {
  19853. deferred.done( arguments ).fail( arguments );
  19854. return this;
  19855. },
  19856. "catch": function( fn ) {
  19857. return promise.then( null, fn );
  19858. },
  19859. // Keep pipe for back-compat
  19860. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  19861. var fns = arguments;
  19862. return jQuery.Deferred( function( newDefer ) {
  19863. jQuery.each( tuples, function( i, tuple ) {
  19864. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  19865. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  19866. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  19867. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  19868. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  19869. deferred[ tuple[ 1 ] ]( function() {
  19870. var returned = fn && fn.apply( this, arguments );
  19871. if ( returned && isFunction( returned.promise ) ) {
  19872. returned.promise()
  19873. .progress( newDefer.notify )
  19874. .done( newDefer.resolve )
  19875. .fail( newDefer.reject );
  19876. } else {
  19877. newDefer[ tuple[ 0 ] + "With" ](
  19878. this,
  19879. fn ? [ returned ] : arguments
  19880. );
  19881. }
  19882. } );
  19883. } );
  19884. fns = null;
  19885. } ).promise();
  19886. },
  19887. then: function( onFulfilled, onRejected, onProgress ) {
  19888. var maxDepth = 0;
  19889. function resolve( depth, deferred, handler, special ) {
  19890. return function() {
  19891. var that = this,
  19892. args = arguments,
  19893. mightThrow = function() {
  19894. var returned, then;
  19895. // Support: Promises/A+ section 2.3.3.3.3
  19896. // https://promisesaplus.com/#point-59
  19897. // Ignore double-resolution attempts
  19898. if ( depth < maxDepth ) {
  19899. return;
  19900. }
  19901. returned = handler.apply( that, args );
  19902. // Support: Promises/A+ section 2.3.1
  19903. // https://promisesaplus.com/#point-48
  19904. if ( returned === deferred.promise() ) {
  19905. throw new TypeError( "Thenable self-resolution" );
  19906. }
  19907. // Support: Promises/A+ sections 2.3.3.1, 3.5
  19908. // https://promisesaplus.com/#point-54
  19909. // https://promisesaplus.com/#point-75
  19910. // Retrieve `then` only once
  19911. then = returned &&
  19912. // Support: Promises/A+ section 2.3.4
  19913. // https://promisesaplus.com/#point-64
  19914. // Only check objects and functions for thenability
  19915. ( typeof returned === "object" ||
  19916. typeof returned === "function" ) &&
  19917. returned.then;
  19918. // Handle a returned thenable
  19919. if ( isFunction( then ) ) {
  19920. // Special processors (notify) just wait for resolution
  19921. if ( special ) {
  19922. then.call(
  19923. returned,
  19924. resolve( maxDepth, deferred, Identity, special ),
  19925. resolve( maxDepth, deferred, Thrower, special )
  19926. );
  19927. // Normal processors (resolve) also hook into progress
  19928. } else {
  19929. // ...and disregard older resolution values
  19930. maxDepth++;
  19931. then.call(
  19932. returned,
  19933. resolve( maxDepth, deferred, Identity, special ),
  19934. resolve( maxDepth, deferred, Thrower, special ),
  19935. resolve( maxDepth, deferred, Identity,
  19936. deferred.notifyWith )
  19937. );
  19938. }
  19939. // Handle all other returned values
  19940. } else {
  19941. // Only substitute handlers pass on context
  19942. // and multiple values (non-spec behavior)
  19943. if ( handler !== Identity ) {
  19944. that = undefined;
  19945. args = [ returned ];
  19946. }
  19947. // Process the value(s)
  19948. // Default process is resolve
  19949. ( special || deferred.resolveWith )( that, args );
  19950. }
  19951. },
  19952. // Only normal processors (resolve) catch and reject exceptions
  19953. process = special ?
  19954. mightThrow :
  19955. function() {
  19956. try {
  19957. mightThrow();
  19958. } catch ( e ) {
  19959. if ( jQuery.Deferred.exceptionHook ) {
  19960. jQuery.Deferred.exceptionHook( e,
  19961. process.stackTrace );
  19962. }
  19963. // Support: Promises/A+ section 2.3.3.3.4.1
  19964. // https://promisesaplus.com/#point-61
  19965. // Ignore post-resolution exceptions
  19966. if ( depth + 1 >= maxDepth ) {
  19967. // Only substitute handlers pass on context
  19968. // and multiple values (non-spec behavior)
  19969. if ( handler !== Thrower ) {
  19970. that = undefined;
  19971. args = [ e ];
  19972. }
  19973. deferred.rejectWith( that, args );
  19974. }
  19975. }
  19976. };
  19977. // Support: Promises/A+ section 2.3.3.3.1
  19978. // https://promisesaplus.com/#point-57
  19979. // Re-resolve promises immediately to dodge false rejection from
  19980. // subsequent errors
  19981. if ( depth ) {
  19982. process();
  19983. } else {
  19984. // Call an optional hook to record the stack, in case of exception
  19985. // since it's otherwise lost when execution goes async
  19986. if ( jQuery.Deferred.getStackHook ) {
  19987. process.stackTrace = jQuery.Deferred.getStackHook();
  19988. }
  19989. window.setTimeout( process );
  19990. }
  19991. };
  19992. }
  19993. return jQuery.Deferred( function( newDefer ) {
  19994. // progress_handlers.add( ... )
  19995. tuples[ 0 ][ 3 ].add(
  19996. resolve(
  19997. 0,
  19998. newDefer,
  19999. isFunction( onProgress ) ?
  20000. onProgress :
  20001. Identity,
  20002. newDefer.notifyWith
  20003. )
  20004. );
  20005. // fulfilled_handlers.add( ... )
  20006. tuples[ 1 ][ 3 ].add(
  20007. resolve(
  20008. 0,
  20009. newDefer,
  20010. isFunction( onFulfilled ) ?
  20011. onFulfilled :
  20012. Identity
  20013. )
  20014. );
  20015. // rejected_handlers.add( ... )
  20016. tuples[ 2 ][ 3 ].add(
  20017. resolve(
  20018. 0,
  20019. newDefer,
  20020. isFunction( onRejected ) ?
  20021. onRejected :
  20022. Thrower
  20023. )
  20024. );
  20025. } ).promise();
  20026. },
  20027. // Get a promise for this deferred
  20028. // If obj is provided, the promise aspect is added to the object
  20029. promise: function( obj ) {
  20030. return obj != null ? jQuery.extend( obj, promise ) : promise;
  20031. }
  20032. },
  20033. deferred = {};
  20034. // Add list-specific methods
  20035. jQuery.each( tuples, function( i, tuple ) {
  20036. var list = tuple[ 2 ],
  20037. stateString = tuple[ 5 ];
  20038. // promise.progress = list.add
  20039. // promise.done = list.add
  20040. // promise.fail = list.add
  20041. promise[ tuple[ 1 ] ] = list.add;
  20042. // Handle state
  20043. if ( stateString ) {
  20044. list.add(
  20045. function() {
  20046. // state = "resolved" (i.e., fulfilled)
  20047. // state = "rejected"
  20048. state = stateString;
  20049. },
  20050. // rejected_callbacks.disable
  20051. // fulfilled_callbacks.disable
  20052. tuples[ 3 - i ][ 2 ].disable,
  20053. // rejected_handlers.disable
  20054. // fulfilled_handlers.disable
  20055. tuples[ 3 - i ][ 3 ].disable,
  20056. // progress_callbacks.lock
  20057. tuples[ 0 ][ 2 ].lock,
  20058. // progress_handlers.lock
  20059. tuples[ 0 ][ 3 ].lock
  20060. );
  20061. }
  20062. // progress_handlers.fire
  20063. // fulfilled_handlers.fire
  20064. // rejected_handlers.fire
  20065. list.add( tuple[ 3 ].fire );
  20066. // deferred.notify = function() { deferred.notifyWith(...) }
  20067. // deferred.resolve = function() { deferred.resolveWith(...) }
  20068. // deferred.reject = function() { deferred.rejectWith(...) }
  20069. deferred[ tuple[ 0 ] ] = function() {
  20070. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  20071. return this;
  20072. };
  20073. // deferred.notifyWith = list.fireWith
  20074. // deferred.resolveWith = list.fireWith
  20075. // deferred.rejectWith = list.fireWith
  20076. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  20077. } );
  20078. // Make the deferred a promise
  20079. promise.promise( deferred );
  20080. // Call given func if any
  20081. if ( func ) {
  20082. func.call( deferred, deferred );
  20083. }
  20084. // All done!
  20085. return deferred;
  20086. },
  20087. // Deferred helper
  20088. when: function( singleValue ) {
  20089. var
  20090. // count of uncompleted subordinates
  20091. remaining = arguments.length,
  20092. // count of unprocessed arguments
  20093. i = remaining,
  20094. // subordinate fulfillment data
  20095. resolveContexts = Array( i ),
  20096. resolveValues = slice.call( arguments ),
  20097. // the master Deferred
  20098. master = jQuery.Deferred(),
  20099. // subordinate callback factory
  20100. updateFunc = function( i ) {
  20101. return function( value ) {
  20102. resolveContexts[ i ] = this;
  20103. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  20104. if ( !( --remaining ) ) {
  20105. master.resolveWith( resolveContexts, resolveValues );
  20106. }
  20107. };
  20108. };
  20109. // Single- and empty arguments are adopted like Promise.resolve
  20110. if ( remaining <= 1 ) {
  20111. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  20112. !remaining );
  20113. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  20114. if ( master.state() === "pending" ||
  20115. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  20116. return master.then();
  20117. }
  20118. }
  20119. // Multiple arguments are aggregated like Promise.all array elements
  20120. while ( i-- ) {
  20121. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  20122. }
  20123. return master.promise();
  20124. }
  20125. } );
  20126. // These usually indicate a programmer mistake during development,
  20127. // warn about them ASAP rather than swallowing them by default.
  20128. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  20129. jQuery.Deferred.exceptionHook = function( error, stack ) {
  20130. // Support: IE 8 - 9 only
  20131. // Console exists when dev tools are open, which can happen at any time
  20132. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  20133. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  20134. }
  20135. };
  20136. jQuery.readyException = function( error ) {
  20137. window.setTimeout( function() {
  20138. throw error;
  20139. } );
  20140. };
  20141. // The deferred used on DOM ready
  20142. var readyList = jQuery.Deferred();
  20143. jQuery.fn.ready = function( fn ) {
  20144. readyList
  20145. .then( fn )
  20146. // Wrap jQuery.readyException in a function so that the lookup
  20147. // happens at the time of error handling instead of callback
  20148. // registration.
  20149. .catch( function( error ) {
  20150. jQuery.readyException( error );
  20151. } );
  20152. return this;
  20153. };
  20154. jQuery.extend( {
  20155. // Is the DOM ready to be used? Set to true once it occurs.
  20156. isReady: false,
  20157. // A counter to track how many items to wait for before
  20158. // the ready event fires. See #6781
  20159. readyWait: 1,
  20160. // Handle when the DOM is ready
  20161. ready: function( wait ) {
  20162. // Abort if there are pending holds or we're already ready
  20163. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  20164. return;
  20165. }
  20166. // Remember that the DOM is ready
  20167. jQuery.isReady = true;
  20168. // If a normal DOM Ready event fired, decrement, and wait if need be
  20169. if ( wait !== true && --jQuery.readyWait > 0 ) {
  20170. return;
  20171. }
  20172. // If there are functions bound, to execute
  20173. readyList.resolveWith( document, [ jQuery ] );
  20174. }
  20175. } );
  20176. jQuery.ready.then = readyList.then;
  20177. // The ready event handler and self cleanup method
  20178. function completed() {
  20179. document.removeEventListener( "DOMContentLoaded", completed );
  20180. window.removeEventListener( "load", completed );
  20181. jQuery.ready();
  20182. }
  20183. // Catch cases where $(document).ready() is called
  20184. // after the browser event has already occurred.
  20185. // Support: IE <=9 - 10 only
  20186. // Older IE sometimes signals "interactive" too soon
  20187. if ( document.readyState === "complete" ||
  20188. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  20189. // Handle it asynchronously to allow scripts the opportunity to delay ready
  20190. window.setTimeout( jQuery.ready );
  20191. } else {
  20192. // Use the handy event callback
  20193. document.addEventListener( "DOMContentLoaded", completed );
  20194. // A fallback to window.onload, that will always work
  20195. window.addEventListener( "load", completed );
  20196. }
  20197. // Multifunctional method to get and set values of a collection
  20198. // The value/s can optionally be executed if it's a function
  20199. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  20200. var i = 0,
  20201. len = elems.length,
  20202. bulk = key == null;
  20203. // Sets many values
  20204. if ( toType( key ) === "object" ) {
  20205. chainable = true;
  20206. for ( i in key ) {
  20207. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  20208. }
  20209. // Sets one value
  20210. } else if ( value !== undefined ) {
  20211. chainable = true;
  20212. if ( !isFunction( value ) ) {
  20213. raw = true;
  20214. }
  20215. if ( bulk ) {
  20216. // Bulk operations run against the entire set
  20217. if ( raw ) {
  20218. fn.call( elems, value );
  20219. fn = null;
  20220. // ...except when executing function values
  20221. } else {
  20222. bulk = fn;
  20223. fn = function( elem, key, value ) {
  20224. return bulk.call( jQuery( elem ), value );
  20225. };
  20226. }
  20227. }
  20228. if ( fn ) {
  20229. for ( ; i < len; i++ ) {
  20230. fn(
  20231. elems[ i ], key, raw ?
  20232. value :
  20233. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  20234. );
  20235. }
  20236. }
  20237. }
  20238. if ( chainable ) {
  20239. return elems;
  20240. }
  20241. // Gets
  20242. if ( bulk ) {
  20243. return fn.call( elems );
  20244. }
  20245. return len ? fn( elems[ 0 ], key ) : emptyGet;
  20246. };
  20247. // Matches dashed string for camelizing
  20248. var rmsPrefix = /^-ms-/,
  20249. rdashAlpha = /-([a-z])/g;
  20250. // Used by camelCase as callback to replace()
  20251. function fcamelCase( all, letter ) {
  20252. return letter.toUpperCase();
  20253. }
  20254. // Convert dashed to camelCase; used by the css and data modules
  20255. // Support: IE <=9 - 11, Edge 12 - 15
  20256. // Microsoft forgot to hump their vendor prefix (#9572)
  20257. function camelCase( string ) {
  20258. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  20259. }
  20260. var acceptData = function( owner ) {
  20261. // Accepts only:
  20262. // - Node
  20263. // - Node.ELEMENT_NODE
  20264. // - Node.DOCUMENT_NODE
  20265. // - Object
  20266. // - Any
  20267. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  20268. };
  20269. function Data() {
  20270. this.expando = jQuery.expando + Data.uid++;
  20271. }
  20272. Data.uid = 1;
  20273. Data.prototype = {
  20274. cache: function( owner ) {
  20275. // Check if the owner object already has a cache
  20276. var value = owner[ this.expando ];
  20277. // If not, create one
  20278. if ( !value ) {
  20279. value = {};
  20280. // We can accept data for non-element nodes in modern browsers,
  20281. // but we should not, see #8335.
  20282. // Always return an empty object.
  20283. if ( acceptData( owner ) ) {
  20284. // If it is a node unlikely to be stringify-ed or looped over
  20285. // use plain assignment
  20286. if ( owner.nodeType ) {
  20287. owner[ this.expando ] = value;
  20288. // Otherwise secure it in a non-enumerable property
  20289. // configurable must be true to allow the property to be
  20290. // deleted when data is removed
  20291. } else {
  20292. Object.defineProperty( owner, this.expando, {
  20293. value: value,
  20294. configurable: true
  20295. } );
  20296. }
  20297. }
  20298. }
  20299. return value;
  20300. },
  20301. set: function( owner, data, value ) {
  20302. var prop,
  20303. cache = this.cache( owner );
  20304. // Handle: [ owner, key, value ] args
  20305. // Always use camelCase key (gh-2257)
  20306. if ( typeof data === "string" ) {
  20307. cache[ camelCase( data ) ] = value;
  20308. // Handle: [ owner, { properties } ] args
  20309. } else {
  20310. // Copy the properties one-by-one to the cache object
  20311. for ( prop in data ) {
  20312. cache[ camelCase( prop ) ] = data[ prop ];
  20313. }
  20314. }
  20315. return cache;
  20316. },
  20317. get: function( owner, key ) {
  20318. return key === undefined ?
  20319. this.cache( owner ) :
  20320. // Always use camelCase key (gh-2257)
  20321. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  20322. },
  20323. access: function( owner, key, value ) {
  20324. // In cases where either:
  20325. //
  20326. // 1. No key was specified
  20327. // 2. A string key was specified, but no value provided
  20328. //
  20329. // Take the "read" path and allow the get method to determine
  20330. // which value to return, respectively either:
  20331. //
  20332. // 1. The entire cache object
  20333. // 2. The data stored at the key
  20334. //
  20335. if ( key === undefined ||
  20336. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  20337. return this.get( owner, key );
  20338. }
  20339. // When the key is not a string, or both a key and value
  20340. // are specified, set or extend (existing objects) with either:
  20341. //
  20342. // 1. An object of properties
  20343. // 2. A key and value
  20344. //
  20345. this.set( owner, key, value );
  20346. // Since the "set" path can have two possible entry points
  20347. // return the expected data based on which path was taken[*]
  20348. return value !== undefined ? value : key;
  20349. },
  20350. remove: function( owner, key ) {
  20351. var i,
  20352. cache = owner[ this.expando ];
  20353. if ( cache === undefined ) {
  20354. return;
  20355. }
  20356. if ( key !== undefined ) {
  20357. // Support array or space separated string of keys
  20358. if ( Array.isArray( key ) ) {
  20359. // If key is an array of keys...
  20360. // We always set camelCase keys, so remove that.
  20361. key = key.map( camelCase );
  20362. } else {
  20363. key = camelCase( key );
  20364. // If a key with the spaces exists, use it.
  20365. // Otherwise, create an array by matching non-whitespace
  20366. key = key in cache ?
  20367. [ key ] :
  20368. ( key.match( rnothtmlwhite ) || [] );
  20369. }
  20370. i = key.length;
  20371. while ( i-- ) {
  20372. delete cache[ key[ i ] ];
  20373. }
  20374. }
  20375. // Remove the expando if there's no more data
  20376. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  20377. // Support: Chrome <=35 - 45
  20378. // Webkit & Blink performance suffers when deleting properties
  20379. // from DOM nodes, so set to undefined instead
  20380. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  20381. if ( owner.nodeType ) {
  20382. owner[ this.expando ] = undefined;
  20383. } else {
  20384. delete owner[ this.expando ];
  20385. }
  20386. }
  20387. },
  20388. hasData: function( owner ) {
  20389. var cache = owner[ this.expando ];
  20390. return cache !== undefined && !jQuery.isEmptyObject( cache );
  20391. }
  20392. };
  20393. var dataPriv = new Data();
  20394. var dataUser = new Data();
  20395. // Implementation Summary
  20396. //
  20397. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  20398. // 2. Improve the module's maintainability by reducing the storage
  20399. // paths to a single mechanism.
  20400. // 3. Use the same single mechanism to support "private" and "user" data.
  20401. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  20402. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  20403. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  20404. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  20405. rmultiDash = /[A-Z]/g;
  20406. function getData( data ) {
  20407. if ( data === "true" ) {
  20408. return true;
  20409. }
  20410. if ( data === "false" ) {
  20411. return false;
  20412. }
  20413. if ( data === "null" ) {
  20414. return null;
  20415. }
  20416. // Only convert to a number if it doesn't change the string
  20417. if ( data === +data + "" ) {
  20418. return +data;
  20419. }
  20420. if ( rbrace.test( data ) ) {
  20421. return JSON.parse( data );
  20422. }
  20423. return data;
  20424. }
  20425. function dataAttr( elem, key, data ) {
  20426. var name;
  20427. // If nothing was found internally, try to fetch any
  20428. // data from the HTML5 data-* attribute
  20429. if ( data === undefined && elem.nodeType === 1 ) {
  20430. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  20431. data = elem.getAttribute( name );
  20432. if ( typeof data === "string" ) {
  20433. try {
  20434. data = getData( data );
  20435. } catch ( e ) {}
  20436. // Make sure we set the data so it isn't changed later
  20437. dataUser.set( elem, key, data );
  20438. } else {
  20439. data = undefined;
  20440. }
  20441. }
  20442. return data;
  20443. }
  20444. jQuery.extend( {
  20445. hasData: function( elem ) {
  20446. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  20447. },
  20448. data: function( elem, name, data ) {
  20449. return dataUser.access( elem, name, data );
  20450. },
  20451. removeData: function( elem, name ) {
  20452. dataUser.remove( elem, name );
  20453. },
  20454. // TODO: Now that all calls to _data and _removeData have been replaced
  20455. // with direct calls to dataPriv methods, these can be deprecated.
  20456. _data: function( elem, name, data ) {
  20457. return dataPriv.access( elem, name, data );
  20458. },
  20459. _removeData: function( elem, name ) {
  20460. dataPriv.remove( elem, name );
  20461. }
  20462. } );
  20463. jQuery.fn.extend( {
  20464. data: function( key, value ) {
  20465. var i, name, data,
  20466. elem = this[ 0 ],
  20467. attrs = elem && elem.attributes;
  20468. // Gets all values
  20469. if ( key === undefined ) {
  20470. if ( this.length ) {
  20471. data = dataUser.get( elem );
  20472. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  20473. i = attrs.length;
  20474. while ( i-- ) {
  20475. // Support: IE 11 only
  20476. // The attrs elements can be null (#14894)
  20477. if ( attrs[ i ] ) {
  20478. name = attrs[ i ].name;
  20479. if ( name.indexOf( "data-" ) === 0 ) {
  20480. name = camelCase( name.slice( 5 ) );
  20481. dataAttr( elem, name, data[ name ] );
  20482. }
  20483. }
  20484. }
  20485. dataPriv.set( elem, "hasDataAttrs", true );
  20486. }
  20487. }
  20488. return data;
  20489. }
  20490. // Sets multiple values
  20491. if ( typeof key === "object" ) {
  20492. return this.each( function() {
  20493. dataUser.set( this, key );
  20494. } );
  20495. }
  20496. return access( this, function( value ) {
  20497. var data;
  20498. // The calling jQuery object (element matches) is not empty
  20499. // (and therefore has an element appears at this[ 0 ]) and the
  20500. // `value` parameter was not undefined. An empty jQuery object
  20501. // will result in `undefined` for elem = this[ 0 ] which will
  20502. // throw an exception if an attempt to read a data cache is made.
  20503. if ( elem && value === undefined ) {
  20504. // Attempt to get data from the cache
  20505. // The key will always be camelCased in Data
  20506. data = dataUser.get( elem, key );
  20507. if ( data !== undefined ) {
  20508. return data;
  20509. }
  20510. // Attempt to "discover" the data in
  20511. // HTML5 custom data-* attrs
  20512. data = dataAttr( elem, key );
  20513. if ( data !== undefined ) {
  20514. return data;
  20515. }
  20516. // We tried really hard, but the data doesn't exist.
  20517. return;
  20518. }
  20519. // Set the data...
  20520. this.each( function() {
  20521. // We always store the camelCased key
  20522. dataUser.set( this, key, value );
  20523. } );
  20524. }, null, value, arguments.length > 1, null, true );
  20525. },
  20526. removeData: function( key ) {
  20527. return this.each( function() {
  20528. dataUser.remove( this, key );
  20529. } );
  20530. }
  20531. } );
  20532. jQuery.extend( {
  20533. queue: function( elem, type, data ) {
  20534. var queue;
  20535. if ( elem ) {
  20536. type = ( type || "fx" ) + "queue";
  20537. queue = dataPriv.get( elem, type );
  20538. // Speed up dequeue by getting out quickly if this is just a lookup
  20539. if ( data ) {
  20540. if ( !queue || Array.isArray( data ) ) {
  20541. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  20542. } else {
  20543. queue.push( data );
  20544. }
  20545. }
  20546. return queue || [];
  20547. }
  20548. },
  20549. dequeue: function( elem, type ) {
  20550. type = type || "fx";
  20551. var queue = jQuery.queue( elem, type ),
  20552. startLength = queue.length,
  20553. fn = queue.shift(),
  20554. hooks = jQuery._queueHooks( elem, type ),
  20555. next = function() {
  20556. jQuery.dequeue( elem, type );
  20557. };
  20558. // If the fx queue is dequeued, always remove the progress sentinel
  20559. if ( fn === "inprogress" ) {
  20560. fn = queue.shift();
  20561. startLength--;
  20562. }
  20563. if ( fn ) {
  20564. // Add a progress sentinel to prevent the fx queue from being
  20565. // automatically dequeued
  20566. if ( type === "fx" ) {
  20567. queue.unshift( "inprogress" );
  20568. }
  20569. // Clear up the last queue stop function
  20570. delete hooks.stop;
  20571. fn.call( elem, next, hooks );
  20572. }
  20573. if ( !startLength && hooks ) {
  20574. hooks.empty.fire();
  20575. }
  20576. },
  20577. // Not public - generate a queueHooks object, or return the current one
  20578. _queueHooks: function( elem, type ) {
  20579. var key = type + "queueHooks";
  20580. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  20581. empty: jQuery.Callbacks( "once memory" ).add( function() {
  20582. dataPriv.remove( elem, [ type + "queue", key ] );
  20583. } )
  20584. } );
  20585. }
  20586. } );
  20587. jQuery.fn.extend( {
  20588. queue: function( type, data ) {
  20589. var setter = 2;
  20590. if ( typeof type !== "string" ) {
  20591. data = type;
  20592. type = "fx";
  20593. setter--;
  20594. }
  20595. if ( arguments.length < setter ) {
  20596. return jQuery.queue( this[ 0 ], type );
  20597. }
  20598. return data === undefined ?
  20599. this :
  20600. this.each( function() {
  20601. var queue = jQuery.queue( this, type, data );
  20602. // Ensure a hooks for this queue
  20603. jQuery._queueHooks( this, type );
  20604. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  20605. jQuery.dequeue( this, type );
  20606. }
  20607. } );
  20608. },
  20609. dequeue: function( type ) {
  20610. return this.each( function() {
  20611. jQuery.dequeue( this, type );
  20612. } );
  20613. },
  20614. clearQueue: function( type ) {
  20615. return this.queue( type || "fx", [] );
  20616. },
  20617. // Get a promise resolved when queues of a certain type
  20618. // are emptied (fx is the type by default)
  20619. promise: function( type, obj ) {
  20620. var tmp,
  20621. count = 1,
  20622. defer = jQuery.Deferred(),
  20623. elements = this,
  20624. i = this.length,
  20625. resolve = function() {
  20626. if ( !( --count ) ) {
  20627. defer.resolveWith( elements, [ elements ] );
  20628. }
  20629. };
  20630. if ( typeof type !== "string" ) {
  20631. obj = type;
  20632. type = undefined;
  20633. }
  20634. type = type || "fx";
  20635. while ( i-- ) {
  20636. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  20637. if ( tmp && tmp.empty ) {
  20638. count++;
  20639. tmp.empty.add( resolve );
  20640. }
  20641. }
  20642. resolve();
  20643. return defer.promise( obj );
  20644. }
  20645. } );
  20646. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  20647. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  20648. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  20649. var isHiddenWithinTree = function( elem, el ) {
  20650. // isHiddenWithinTree might be called from jQuery#filter function;
  20651. // in that case, element will be second argument
  20652. elem = el || elem;
  20653. // Inline style trumps all
  20654. return elem.style.display === "none" ||
  20655. elem.style.display === "" &&
  20656. // Otherwise, check computed style
  20657. // Support: Firefox <=43 - 45
  20658. // Disconnected elements can have computed display: none, so first confirm that elem is
  20659. // in the document.
  20660. jQuery.contains( elem.ownerDocument, elem ) &&
  20661. jQuery.css( elem, "display" ) === "none";
  20662. };
  20663. var swap = function( elem, options, callback, args ) {
  20664. var ret, name,
  20665. old = {};
  20666. // Remember the old values, and insert the new ones
  20667. for ( name in options ) {
  20668. old[ name ] = elem.style[ name ];
  20669. elem.style[ name ] = options[ name ];
  20670. }
  20671. ret = callback.apply( elem, args || [] );
  20672. // Revert the old values
  20673. for ( name in options ) {
  20674. elem.style[ name ] = old[ name ];
  20675. }
  20676. return ret;
  20677. };
  20678. function adjustCSS( elem, prop, valueParts, tween ) {
  20679. var adjusted, scale,
  20680. maxIterations = 20,
  20681. currentValue = tween ?
  20682. function() {
  20683. return tween.cur();
  20684. } :
  20685. function() {
  20686. return jQuery.css( elem, prop, "" );
  20687. },
  20688. initial = currentValue(),
  20689. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  20690. // Starting value computation is required for potential unit mismatches
  20691. initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  20692. rcssNum.exec( jQuery.css( elem, prop ) );
  20693. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  20694. // Support: Firefox <=54
  20695. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  20696. initial = initial / 2;
  20697. // Trust units reported by jQuery.css
  20698. unit = unit || initialInUnit[ 3 ];
  20699. // Iteratively approximate from a nonzero starting point
  20700. initialInUnit = +initial || 1;
  20701. while ( maxIterations-- ) {
  20702. // Evaluate and update our best guess (doubling guesses that zero out).
  20703. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  20704. jQuery.style( elem, prop, initialInUnit + unit );
  20705. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  20706. maxIterations = 0;
  20707. }
  20708. initialInUnit = initialInUnit / scale;
  20709. }
  20710. initialInUnit = initialInUnit * 2;
  20711. jQuery.style( elem, prop, initialInUnit + unit );
  20712. // Make sure we update the tween properties later on
  20713. valueParts = valueParts || [];
  20714. }
  20715. if ( valueParts ) {
  20716. initialInUnit = +initialInUnit || +initial || 0;
  20717. // Apply relative offset (+=/-=) if specified
  20718. adjusted = valueParts[ 1 ] ?
  20719. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  20720. +valueParts[ 2 ];
  20721. if ( tween ) {
  20722. tween.unit = unit;
  20723. tween.start = initialInUnit;
  20724. tween.end = adjusted;
  20725. }
  20726. }
  20727. return adjusted;
  20728. }
  20729. var defaultDisplayMap = {};
  20730. function getDefaultDisplay( elem ) {
  20731. var temp,
  20732. doc = elem.ownerDocument,
  20733. nodeName = elem.nodeName,
  20734. display = defaultDisplayMap[ nodeName ];
  20735. if ( display ) {
  20736. return display;
  20737. }
  20738. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  20739. display = jQuery.css( temp, "display" );
  20740. temp.parentNode.removeChild( temp );
  20741. if ( display === "none" ) {
  20742. display = "block";
  20743. }
  20744. defaultDisplayMap[ nodeName ] = display;
  20745. return display;
  20746. }
  20747. function showHide( elements, show ) {
  20748. var display, elem,
  20749. values = [],
  20750. index = 0,
  20751. length = elements.length;
  20752. // Determine new display value for elements that need to change
  20753. for ( ; index < length; index++ ) {
  20754. elem = elements[ index ];
  20755. if ( !elem.style ) {
  20756. continue;
  20757. }
  20758. display = elem.style.display;
  20759. if ( show ) {
  20760. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  20761. // check is required in this first loop unless we have a nonempty display value (either
  20762. // inline or about-to-be-restored)
  20763. if ( display === "none" ) {
  20764. values[ index ] = dataPriv.get( elem, "display" ) || null;
  20765. if ( !values[ index ] ) {
  20766. elem.style.display = "";
  20767. }
  20768. }
  20769. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  20770. values[ index ] = getDefaultDisplay( elem );
  20771. }
  20772. } else {
  20773. if ( display !== "none" ) {
  20774. values[ index ] = "none";
  20775. // Remember what we're overwriting
  20776. dataPriv.set( elem, "display", display );
  20777. }
  20778. }
  20779. }
  20780. // Set the display of the elements in a second loop to avoid constant reflow
  20781. for ( index = 0; index < length; index++ ) {
  20782. if ( values[ index ] != null ) {
  20783. elements[ index ].style.display = values[ index ];
  20784. }
  20785. }
  20786. return elements;
  20787. }
  20788. jQuery.fn.extend( {
  20789. show: function() {
  20790. return showHide( this, true );
  20791. },
  20792. hide: function() {
  20793. return showHide( this );
  20794. },
  20795. toggle: function( state ) {
  20796. if ( typeof state === "boolean" ) {
  20797. return state ? this.show() : this.hide();
  20798. }
  20799. return this.each( function() {
  20800. if ( isHiddenWithinTree( this ) ) {
  20801. jQuery( this ).show();
  20802. } else {
  20803. jQuery( this ).hide();
  20804. }
  20805. } );
  20806. }
  20807. } );
  20808. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  20809. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
  20810. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  20811. // We have to close these tags to support XHTML (#13200)
  20812. var wrapMap = {
  20813. // Support: IE <=9 only
  20814. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  20815. // XHTML parsers do not magically insert elements in the
  20816. // same way that tag soup parsers do. So we cannot shorten
  20817. // this by omitting <tbody> or other required elements.
  20818. thead: [ 1, "<table>", "</table>" ],
  20819. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  20820. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  20821. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  20822. _default: [ 0, "", "" ]
  20823. };
  20824. // Support: IE <=9 only
  20825. wrapMap.optgroup = wrapMap.option;
  20826. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  20827. wrapMap.th = wrapMap.td;
  20828. function getAll( context, tag ) {
  20829. // Support: IE <=9 - 11 only
  20830. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  20831. var ret;
  20832. if ( typeof context.getElementsByTagName !== "undefined" ) {
  20833. ret = context.getElementsByTagName( tag || "*" );
  20834. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  20835. ret = context.querySelectorAll( tag || "*" );
  20836. } else {
  20837. ret = [];
  20838. }
  20839. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  20840. return jQuery.merge( [ context ], ret );
  20841. }
  20842. return ret;
  20843. }
  20844. // Mark scripts as having already been evaluated
  20845. function setGlobalEval( elems, refElements ) {
  20846. var i = 0,
  20847. l = elems.length;
  20848. for ( ; i < l; i++ ) {
  20849. dataPriv.set(
  20850. elems[ i ],
  20851. "globalEval",
  20852. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  20853. );
  20854. }
  20855. }
  20856. var rhtml = /<|&#?\w+;/;
  20857. function buildFragment( elems, context, scripts, selection, ignored ) {
  20858. var elem, tmp, tag, wrap, contains, j,
  20859. fragment = context.createDocumentFragment(),
  20860. nodes = [],
  20861. i = 0,
  20862. l = elems.length;
  20863. for ( ; i < l; i++ ) {
  20864. elem = elems[ i ];
  20865. if ( elem || elem === 0 ) {
  20866. // Add nodes directly
  20867. if ( toType( elem ) === "object" ) {
  20868. // Support: Android <=4.0 only, PhantomJS 1 only
  20869. // push.apply(_, arraylike) throws on ancient WebKit
  20870. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  20871. // Convert non-html into a text node
  20872. } else if ( !rhtml.test( elem ) ) {
  20873. nodes.push( context.createTextNode( elem ) );
  20874. // Convert html into DOM nodes
  20875. } else {
  20876. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  20877. // Deserialize a standard representation
  20878. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  20879. wrap = wrapMap[ tag ] || wrapMap._default;
  20880. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  20881. // Descend through wrappers to the right content
  20882. j = wrap[ 0 ];
  20883. while ( j-- ) {
  20884. tmp = tmp.lastChild;
  20885. }
  20886. // Support: Android <=4.0 only, PhantomJS 1 only
  20887. // push.apply(_, arraylike) throws on ancient WebKit
  20888. jQuery.merge( nodes, tmp.childNodes );
  20889. // Remember the top-level container
  20890. tmp = fragment.firstChild;
  20891. // Ensure the created nodes are orphaned (#12392)
  20892. tmp.textContent = "";
  20893. }
  20894. }
  20895. }
  20896. // Remove wrapper from fragment
  20897. fragment.textContent = "";
  20898. i = 0;
  20899. while ( ( elem = nodes[ i++ ] ) ) {
  20900. // Skip elements already in the context collection (trac-4087)
  20901. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  20902. if ( ignored ) {
  20903. ignored.push( elem );
  20904. }
  20905. continue;
  20906. }
  20907. contains = jQuery.contains( elem.ownerDocument, elem );
  20908. // Append to fragment
  20909. tmp = getAll( fragment.appendChild( elem ), "script" );
  20910. // Preserve script evaluation history
  20911. if ( contains ) {
  20912. setGlobalEval( tmp );
  20913. }
  20914. // Capture executables
  20915. if ( scripts ) {
  20916. j = 0;
  20917. while ( ( elem = tmp[ j++ ] ) ) {
  20918. if ( rscriptType.test( elem.type || "" ) ) {
  20919. scripts.push( elem );
  20920. }
  20921. }
  20922. }
  20923. }
  20924. return fragment;
  20925. }
  20926. ( function() {
  20927. var fragment = document.createDocumentFragment(),
  20928. div = fragment.appendChild( document.createElement( "div" ) ),
  20929. input = document.createElement( "input" );
  20930. // Support: Android 4.0 - 4.3 only
  20931. // Check state lost if the name is set (#11217)
  20932. // Support: Windows Web Apps (WWA)
  20933. // `name` and `type` must use .setAttribute for WWA (#14901)
  20934. input.setAttribute( "type", "radio" );
  20935. input.setAttribute( "checked", "checked" );
  20936. input.setAttribute( "name", "t" );
  20937. div.appendChild( input );
  20938. // Support: Android <=4.1 only
  20939. // Older WebKit doesn't clone checked state correctly in fragments
  20940. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  20941. // Support: IE <=11 only
  20942. // Make sure textarea (and checkbox) defaultValue is properly cloned
  20943. div.innerHTML = "<textarea>x</textarea>";
  20944. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  20945. } )();
  20946. var documentElement = document.documentElement;
  20947. var
  20948. rkeyEvent = /^key/,
  20949. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  20950. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  20951. function returnTrue() {
  20952. return true;
  20953. }
  20954. function returnFalse() {
  20955. return false;
  20956. }
  20957. // Support: IE <=9 only
  20958. // See #13393 for more info
  20959. function safeActiveElement() {
  20960. try {
  20961. return document.activeElement;
  20962. } catch ( err ) { }
  20963. }
  20964. function on( elem, types, selector, data, fn, one ) {
  20965. var origFn, type;
  20966. // Types can be a map of types/handlers
  20967. if ( typeof types === "object" ) {
  20968. // ( types-Object, selector, data )
  20969. if ( typeof selector !== "string" ) {
  20970. // ( types-Object, data )
  20971. data = data || selector;
  20972. selector = undefined;
  20973. }
  20974. for ( type in types ) {
  20975. on( elem, type, selector, data, types[ type ], one );
  20976. }
  20977. return elem;
  20978. }
  20979. if ( data == null && fn == null ) {
  20980. // ( types, fn )
  20981. fn = selector;
  20982. data = selector = undefined;
  20983. } else if ( fn == null ) {
  20984. if ( typeof selector === "string" ) {
  20985. // ( types, selector, fn )
  20986. fn = data;
  20987. data = undefined;
  20988. } else {
  20989. // ( types, data, fn )
  20990. fn = data;
  20991. data = selector;
  20992. selector = undefined;
  20993. }
  20994. }
  20995. if ( fn === false ) {
  20996. fn = returnFalse;
  20997. } else if ( !fn ) {
  20998. return elem;
  20999. }
  21000. if ( one === 1 ) {
  21001. origFn = fn;
  21002. fn = function( event ) {
  21003. // Can use an empty set, since event contains the info
  21004. jQuery().off( event );
  21005. return origFn.apply( this, arguments );
  21006. };
  21007. // Use same guid so caller can remove using origFn
  21008. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  21009. }
  21010. return elem.each( function() {
  21011. jQuery.event.add( this, types, fn, data, selector );
  21012. } );
  21013. }
  21014. /*
  21015. * Helper functions for managing events -- not part of the public interface.
  21016. * Props to Dean Edwards' addEvent library for many of the ideas.
  21017. */
  21018. jQuery.event = {
  21019. global: {},
  21020. add: function( elem, types, handler, data, selector ) {
  21021. var handleObjIn, eventHandle, tmp,
  21022. events, t, handleObj,
  21023. special, handlers, type, namespaces, origType,
  21024. elemData = dataPriv.get( elem );
  21025. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  21026. if ( !elemData ) {
  21027. return;
  21028. }
  21029. // Caller can pass in an object of custom data in lieu of the handler
  21030. if ( handler.handler ) {
  21031. handleObjIn = handler;
  21032. handler = handleObjIn.handler;
  21033. selector = handleObjIn.selector;
  21034. }
  21035. // Ensure that invalid selectors throw exceptions at attach time
  21036. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  21037. if ( selector ) {
  21038. jQuery.find.matchesSelector( documentElement, selector );
  21039. }
  21040. // Make sure that the handler has a unique ID, used to find/remove it later
  21041. if ( !handler.guid ) {
  21042. handler.guid = jQuery.guid++;
  21043. }
  21044. // Init the element's event structure and main handler, if this is the first
  21045. if ( !( events = elemData.events ) ) {
  21046. events = elemData.events = {};
  21047. }
  21048. if ( !( eventHandle = elemData.handle ) ) {
  21049. eventHandle = elemData.handle = function( e ) {
  21050. // Discard the second event of a jQuery.event.trigger() and
  21051. // when an event is called after a page has unloaded
  21052. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  21053. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  21054. };
  21055. }
  21056. // Handle multiple events separated by a space
  21057. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  21058. t = types.length;
  21059. while ( t-- ) {
  21060. tmp = rtypenamespace.exec( types[ t ] ) || [];
  21061. type = origType = tmp[ 1 ];
  21062. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  21063. // There *must* be a type, no attaching namespace-only handlers
  21064. if ( !type ) {
  21065. continue;
  21066. }
  21067. // If event changes its type, use the special event handlers for the changed type
  21068. special = jQuery.event.special[ type ] || {};
  21069. // If selector defined, determine special event api type, otherwise given type
  21070. type = ( selector ? special.delegateType : special.bindType ) || type;
  21071. // Update special based on newly reset type
  21072. special = jQuery.event.special[ type ] || {};
  21073. // handleObj is passed to all event handlers
  21074. handleObj = jQuery.extend( {
  21075. type: type,
  21076. origType: origType,
  21077. data: data,
  21078. handler: handler,
  21079. guid: handler.guid,
  21080. selector: selector,
  21081. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  21082. namespace: namespaces.join( "." )
  21083. }, handleObjIn );
  21084. // Init the event handler queue if we're the first
  21085. if ( !( handlers = events[ type ] ) ) {
  21086. handlers = events[ type ] = [];
  21087. handlers.delegateCount = 0;
  21088. // Only use addEventListener if the special events handler returns false
  21089. if ( !special.setup ||
  21090. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  21091. if ( elem.addEventListener ) {
  21092. elem.addEventListener( type, eventHandle );
  21093. }
  21094. }
  21095. }
  21096. if ( special.add ) {
  21097. special.add.call( elem, handleObj );
  21098. if ( !handleObj.handler.guid ) {
  21099. handleObj.handler.guid = handler.guid;
  21100. }
  21101. }
  21102. // Add to the element's handler list, delegates in front
  21103. if ( selector ) {
  21104. handlers.splice( handlers.delegateCount++, 0, handleObj );
  21105. } else {
  21106. handlers.push( handleObj );
  21107. }
  21108. // Keep track of which events have ever been used, for event optimization
  21109. jQuery.event.global[ type ] = true;
  21110. }
  21111. },
  21112. // Detach an event or set of events from an element
  21113. remove: function( elem, types, handler, selector, mappedTypes ) {
  21114. var j, origCount, tmp,
  21115. events, t, handleObj,
  21116. special, handlers, type, namespaces, origType,
  21117. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  21118. if ( !elemData || !( events = elemData.events ) ) {
  21119. return;
  21120. }
  21121. // Once for each type.namespace in types; type may be omitted
  21122. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  21123. t = types.length;
  21124. while ( t-- ) {
  21125. tmp = rtypenamespace.exec( types[ t ] ) || [];
  21126. type = origType = tmp[ 1 ];
  21127. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  21128. // Unbind all events (on this namespace, if provided) for the element
  21129. if ( !type ) {
  21130. for ( type in events ) {
  21131. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  21132. }
  21133. continue;
  21134. }
  21135. special = jQuery.event.special[ type ] || {};
  21136. type = ( selector ? special.delegateType : special.bindType ) || type;
  21137. handlers = events[ type ] || [];
  21138. tmp = tmp[ 2 ] &&
  21139. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  21140. // Remove matching events
  21141. origCount = j = handlers.length;
  21142. while ( j-- ) {
  21143. handleObj = handlers[ j ];
  21144. if ( ( mappedTypes || origType === handleObj.origType ) &&
  21145. ( !handler || handler.guid === handleObj.guid ) &&
  21146. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  21147. ( !selector || selector === handleObj.selector ||
  21148. selector === "**" && handleObj.selector ) ) {
  21149. handlers.splice( j, 1 );
  21150. if ( handleObj.selector ) {
  21151. handlers.delegateCount--;
  21152. }
  21153. if ( special.remove ) {
  21154. special.remove.call( elem, handleObj );
  21155. }
  21156. }
  21157. }
  21158. // Remove generic event handler if we removed something and no more handlers exist
  21159. // (avoids potential for endless recursion during removal of special event handlers)
  21160. if ( origCount && !handlers.length ) {
  21161. if ( !special.teardown ||
  21162. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  21163. jQuery.removeEvent( elem, type, elemData.handle );
  21164. }
  21165. delete events[ type ];
  21166. }
  21167. }
  21168. // Remove data and the expando if it's no longer used
  21169. if ( jQuery.isEmptyObject( events ) ) {
  21170. dataPriv.remove( elem, "handle events" );
  21171. }
  21172. },
  21173. dispatch: function( nativeEvent ) {
  21174. // Make a writable jQuery.Event from the native event object
  21175. var event = jQuery.event.fix( nativeEvent );
  21176. var i, j, ret, matched, handleObj, handlerQueue,
  21177. args = new Array( arguments.length ),
  21178. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  21179. special = jQuery.event.special[ event.type ] || {};
  21180. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  21181. args[ 0 ] = event;
  21182. for ( i = 1; i < arguments.length; i++ ) {
  21183. args[ i ] = arguments[ i ];
  21184. }
  21185. event.delegateTarget = this;
  21186. // Call the preDispatch hook for the mapped type, and let it bail if desired
  21187. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  21188. return;
  21189. }
  21190. // Determine handlers
  21191. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  21192. // Run delegates first; they may want to stop propagation beneath us
  21193. i = 0;
  21194. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  21195. event.currentTarget = matched.elem;
  21196. j = 0;
  21197. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  21198. !event.isImmediatePropagationStopped() ) {
  21199. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  21200. // a subset or equal to those in the bound event (both can have no namespace).
  21201. if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
  21202. event.handleObj = handleObj;
  21203. event.data = handleObj.data;
  21204. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  21205. handleObj.handler ).apply( matched.elem, args );
  21206. if ( ret !== undefined ) {
  21207. if ( ( event.result = ret ) === false ) {
  21208. event.preventDefault();
  21209. event.stopPropagation();
  21210. }
  21211. }
  21212. }
  21213. }
  21214. }
  21215. // Call the postDispatch hook for the mapped type
  21216. if ( special.postDispatch ) {
  21217. special.postDispatch.call( this, event );
  21218. }
  21219. return event.result;
  21220. },
  21221. handlers: function( event, handlers ) {
  21222. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  21223. handlerQueue = [],
  21224. delegateCount = handlers.delegateCount,
  21225. cur = event.target;
  21226. // Find delegate handlers
  21227. if ( delegateCount &&
  21228. // Support: IE <=9
  21229. // Black-hole SVG <use> instance trees (trac-13180)
  21230. cur.nodeType &&
  21231. // Support: Firefox <=42
  21232. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  21233. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  21234. // Support: IE 11 only
  21235. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  21236. !( event.type === "click" && event.button >= 1 ) ) {
  21237. for ( ; cur !== this; cur = cur.parentNode || this ) {
  21238. // Don't check non-elements (#13208)
  21239. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  21240. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  21241. matchedHandlers = [];
  21242. matchedSelectors = {};
  21243. for ( i = 0; i < delegateCount; i++ ) {
  21244. handleObj = handlers[ i ];
  21245. // Don't conflict with Object.prototype properties (#13203)
  21246. sel = handleObj.selector + " ";
  21247. if ( matchedSelectors[ sel ] === undefined ) {
  21248. matchedSelectors[ sel ] = handleObj.needsContext ?
  21249. jQuery( sel, this ).index( cur ) > -1 :
  21250. jQuery.find( sel, this, null, [ cur ] ).length;
  21251. }
  21252. if ( matchedSelectors[ sel ] ) {
  21253. matchedHandlers.push( handleObj );
  21254. }
  21255. }
  21256. if ( matchedHandlers.length ) {
  21257. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  21258. }
  21259. }
  21260. }
  21261. }
  21262. // Add the remaining (directly-bound) handlers
  21263. cur = this;
  21264. if ( delegateCount < handlers.length ) {
  21265. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  21266. }
  21267. return handlerQueue;
  21268. },
  21269. addProp: function( name, hook ) {
  21270. Object.defineProperty( jQuery.Event.prototype, name, {
  21271. enumerable: true,
  21272. configurable: true,
  21273. get: isFunction( hook ) ?
  21274. function() {
  21275. if ( this.originalEvent ) {
  21276. return hook( this.originalEvent );
  21277. }
  21278. } :
  21279. function() {
  21280. if ( this.originalEvent ) {
  21281. return this.originalEvent[ name ];
  21282. }
  21283. },
  21284. set: function( value ) {
  21285. Object.defineProperty( this, name, {
  21286. enumerable: true,
  21287. configurable: true,
  21288. writable: true,
  21289. value: value
  21290. } );
  21291. }
  21292. } );
  21293. },
  21294. fix: function( originalEvent ) {
  21295. return originalEvent[ jQuery.expando ] ?
  21296. originalEvent :
  21297. new jQuery.Event( originalEvent );
  21298. },
  21299. special: {
  21300. load: {
  21301. // Prevent triggered image.load events from bubbling to window.load
  21302. noBubble: true
  21303. },
  21304. focus: {
  21305. // Fire native event if possible so blur/focus sequence is correct
  21306. trigger: function() {
  21307. if ( this !== safeActiveElement() && this.focus ) {
  21308. this.focus();
  21309. return false;
  21310. }
  21311. },
  21312. delegateType: "focusin"
  21313. },
  21314. blur: {
  21315. trigger: function() {
  21316. if ( this === safeActiveElement() && this.blur ) {
  21317. this.blur();
  21318. return false;
  21319. }
  21320. },
  21321. delegateType: "focusout"
  21322. },
  21323. click: {
  21324. // For checkbox, fire native event so checked state will be right
  21325. trigger: function() {
  21326. if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) {
  21327. this.click();
  21328. return false;
  21329. }
  21330. },
  21331. // For cross-browser consistency, don't fire native .click() on links
  21332. _default: function( event ) {
  21333. return nodeName( event.target, "a" );
  21334. }
  21335. },
  21336. beforeunload: {
  21337. postDispatch: function( event ) {
  21338. // Support: Firefox 20+
  21339. // Firefox doesn't alert if the returnValue field is not set.
  21340. if ( event.result !== undefined && event.originalEvent ) {
  21341. event.originalEvent.returnValue = event.result;
  21342. }
  21343. }
  21344. }
  21345. }
  21346. };
  21347. jQuery.removeEvent = function( elem, type, handle ) {
  21348. // This "if" is needed for plain objects
  21349. if ( elem.removeEventListener ) {
  21350. elem.removeEventListener( type, handle );
  21351. }
  21352. };
  21353. jQuery.Event = function( src, props ) {
  21354. // Allow instantiation without the 'new' keyword
  21355. if ( !( this instanceof jQuery.Event ) ) {
  21356. return new jQuery.Event( src, props );
  21357. }
  21358. // Event object
  21359. if ( src && src.type ) {
  21360. this.originalEvent = src;
  21361. this.type = src.type;
  21362. // Events bubbling up the document may have been marked as prevented
  21363. // by a handler lower down the tree; reflect the correct value.
  21364. this.isDefaultPrevented = src.defaultPrevented ||
  21365. src.defaultPrevented === undefined &&
  21366. // Support: Android <=2.3 only
  21367. src.returnValue === false ?
  21368. returnTrue :
  21369. returnFalse;
  21370. // Create target properties
  21371. // Support: Safari <=6 - 7 only
  21372. // Target should not be a text node (#504, #13143)
  21373. this.target = ( src.target && src.target.nodeType === 3 ) ?
  21374. src.target.parentNode :
  21375. src.target;
  21376. this.currentTarget = src.currentTarget;
  21377. this.relatedTarget = src.relatedTarget;
  21378. // Event type
  21379. } else {
  21380. this.type = src;
  21381. }
  21382. // Put explicitly provided properties onto the event object
  21383. if ( props ) {
  21384. jQuery.extend( this, props );
  21385. }
  21386. // Create a timestamp if incoming event doesn't have one
  21387. this.timeStamp = src && src.timeStamp || Date.now();
  21388. // Mark it as fixed
  21389. this[ jQuery.expando ] = true;
  21390. };
  21391. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  21392. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  21393. jQuery.Event.prototype = {
  21394. constructor: jQuery.Event,
  21395. isDefaultPrevented: returnFalse,
  21396. isPropagationStopped: returnFalse,
  21397. isImmediatePropagationStopped: returnFalse,
  21398. isSimulated: false,
  21399. preventDefault: function() {
  21400. var e = this.originalEvent;
  21401. this.isDefaultPrevented = returnTrue;
  21402. if ( e && !this.isSimulated ) {
  21403. e.preventDefault();
  21404. }
  21405. },
  21406. stopPropagation: function() {
  21407. var e = this.originalEvent;
  21408. this.isPropagationStopped = returnTrue;
  21409. if ( e && !this.isSimulated ) {
  21410. e.stopPropagation();
  21411. }
  21412. },
  21413. stopImmediatePropagation: function() {
  21414. var e = this.originalEvent;
  21415. this.isImmediatePropagationStopped = returnTrue;
  21416. if ( e && !this.isSimulated ) {
  21417. e.stopImmediatePropagation();
  21418. }
  21419. this.stopPropagation();
  21420. }
  21421. };
  21422. // Includes all common event props including KeyEvent and MouseEvent specific props
  21423. jQuery.each( {
  21424. altKey: true,
  21425. bubbles: true,
  21426. cancelable: true,
  21427. changedTouches: true,
  21428. ctrlKey: true,
  21429. detail: true,
  21430. eventPhase: true,
  21431. metaKey: true,
  21432. pageX: true,
  21433. pageY: true,
  21434. shiftKey: true,
  21435. view: true,
  21436. "char": true,
  21437. charCode: true,
  21438. key: true,
  21439. keyCode: true,
  21440. button: true,
  21441. buttons: true,
  21442. clientX: true,
  21443. clientY: true,
  21444. offsetX: true,
  21445. offsetY: true,
  21446. pointerId: true,
  21447. pointerType: true,
  21448. screenX: true,
  21449. screenY: true,
  21450. targetTouches: true,
  21451. toElement: true,
  21452. touches: true,
  21453. which: function( event ) {
  21454. var button = event.button;
  21455. // Add which for key events
  21456. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  21457. return event.charCode != null ? event.charCode : event.keyCode;
  21458. }
  21459. // Add which for click: 1 === left; 2 === middle; 3 === right
  21460. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  21461. if ( button & 1 ) {
  21462. return 1;
  21463. }
  21464. if ( button & 2 ) {
  21465. return 3;
  21466. }
  21467. if ( button & 4 ) {
  21468. return 2;
  21469. }
  21470. return 0;
  21471. }
  21472. return event.which;
  21473. }
  21474. }, jQuery.event.addProp );
  21475. // Create mouseenter/leave events using mouseover/out and event-time checks
  21476. // so that event delegation works in jQuery.
  21477. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  21478. //
  21479. // Support: Safari 7 only
  21480. // Safari sends mouseenter too often; see:
  21481. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  21482. // for the description of the bug (it existed in older Chrome versions as well).
  21483. jQuery.each( {
  21484. mouseenter: "mouseover",
  21485. mouseleave: "mouseout",
  21486. pointerenter: "pointerover",
  21487. pointerleave: "pointerout"
  21488. }, function( orig, fix ) {
  21489. jQuery.event.special[ orig ] = {
  21490. delegateType: fix,
  21491. bindType: fix,
  21492. handle: function( event ) {
  21493. var ret,
  21494. target = this,
  21495. related = event.relatedTarget,
  21496. handleObj = event.handleObj;
  21497. // For mouseenter/leave call the handler if related is outside the target.
  21498. // NB: No relatedTarget if the mouse left/entered the browser window
  21499. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  21500. event.type = handleObj.origType;
  21501. ret = handleObj.handler.apply( this, arguments );
  21502. event.type = fix;
  21503. }
  21504. return ret;
  21505. }
  21506. };
  21507. } );
  21508. jQuery.fn.extend( {
  21509. on: function( types, selector, data, fn ) {
  21510. return on( this, types, selector, data, fn );
  21511. },
  21512. one: function( types, selector, data, fn ) {
  21513. return on( this, types, selector, data, fn, 1 );
  21514. },
  21515. off: function( types, selector, fn ) {
  21516. var handleObj, type;
  21517. if ( types && types.preventDefault && types.handleObj ) {
  21518. // ( event ) dispatched jQuery.Event
  21519. handleObj = types.handleObj;
  21520. jQuery( types.delegateTarget ).off(
  21521. handleObj.namespace ?
  21522. handleObj.origType + "." + handleObj.namespace :
  21523. handleObj.origType,
  21524. handleObj.selector,
  21525. handleObj.handler
  21526. );
  21527. return this;
  21528. }
  21529. if ( typeof types === "object" ) {
  21530. // ( types-object [, selector] )
  21531. for ( type in types ) {
  21532. this.off( type, selector, types[ type ] );
  21533. }
  21534. return this;
  21535. }
  21536. if ( selector === false || typeof selector === "function" ) {
  21537. // ( types [, fn] )
  21538. fn = selector;
  21539. selector = undefined;
  21540. }
  21541. if ( fn === false ) {
  21542. fn = returnFalse;
  21543. }
  21544. return this.each( function() {
  21545. jQuery.event.remove( this, types, fn, selector );
  21546. } );
  21547. }
  21548. } );
  21549. var
  21550. /* eslint-disable max-len */
  21551. // See https://github.com/eslint/eslint/issues/3229
  21552. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  21553. /* eslint-enable */
  21554. // Support: IE <=10 - 11, Edge 12 - 13 only
  21555. // In IE/Edge using regex groups here causes severe slowdowns.
  21556. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  21557. rnoInnerhtml = /<script|<style|<link/i,
  21558. // checked="checked" or checked
  21559. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  21560. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  21561. // Prefer a tbody over its parent table for containing new rows
  21562. function manipulationTarget( elem, content ) {
  21563. if ( nodeName( elem, "table" ) &&
  21564. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  21565. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  21566. }
  21567. return elem;
  21568. }
  21569. // Replace/restore the type attribute of script elements for safe DOM manipulation
  21570. function disableScript( elem ) {
  21571. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  21572. return elem;
  21573. }
  21574. function restoreScript( elem ) {
  21575. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  21576. elem.type = elem.type.slice( 5 );
  21577. } else {
  21578. elem.removeAttribute( "type" );
  21579. }
  21580. return elem;
  21581. }
  21582. function cloneCopyEvent( src, dest ) {
  21583. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  21584. if ( dest.nodeType !== 1 ) {
  21585. return;
  21586. }
  21587. // 1. Copy private data: events, handlers, etc.
  21588. if ( dataPriv.hasData( src ) ) {
  21589. pdataOld = dataPriv.access( src );
  21590. pdataCur = dataPriv.set( dest, pdataOld );
  21591. events = pdataOld.events;
  21592. if ( events ) {
  21593. delete pdataCur.handle;
  21594. pdataCur.events = {};
  21595. for ( type in events ) {
  21596. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  21597. jQuery.event.add( dest, type, events[ type ][ i ] );
  21598. }
  21599. }
  21600. }
  21601. }
  21602. // 2. Copy user data
  21603. if ( dataUser.hasData( src ) ) {
  21604. udataOld = dataUser.access( src );
  21605. udataCur = jQuery.extend( {}, udataOld );
  21606. dataUser.set( dest, udataCur );
  21607. }
  21608. }
  21609. // Fix IE bugs, see support tests
  21610. function fixInput( src, dest ) {
  21611. var nodeName = dest.nodeName.toLowerCase();
  21612. // Fails to persist the checked state of a cloned checkbox or radio button.
  21613. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  21614. dest.checked = src.checked;
  21615. // Fails to return the selected option to the default selected state when cloning options
  21616. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  21617. dest.defaultValue = src.defaultValue;
  21618. }
  21619. }
  21620. function domManip( collection, args, callback, ignored ) {
  21621. // Flatten any nested arrays
  21622. args = concat.apply( [], args );
  21623. var fragment, first, scripts, hasScripts, node, doc,
  21624. i = 0,
  21625. l = collection.length,
  21626. iNoClone = l - 1,
  21627. value = args[ 0 ],
  21628. valueIsFunction = isFunction( value );
  21629. // We can't cloneNode fragments that contain checked, in WebKit
  21630. if ( valueIsFunction ||
  21631. ( l > 1 && typeof value === "string" &&
  21632. !support.checkClone && rchecked.test( value ) ) ) {
  21633. return collection.each( function( index ) {
  21634. var self = collection.eq( index );
  21635. if ( valueIsFunction ) {
  21636. args[ 0 ] = value.call( this, index, self.html() );
  21637. }
  21638. domManip( self, args, callback, ignored );
  21639. } );
  21640. }
  21641. if ( l ) {
  21642. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  21643. first = fragment.firstChild;
  21644. if ( fragment.childNodes.length === 1 ) {
  21645. fragment = first;
  21646. }
  21647. // Require either new content or an interest in ignored elements to invoke the callback
  21648. if ( first || ignored ) {
  21649. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  21650. hasScripts = scripts.length;
  21651. // Use the original fragment for the last item
  21652. // instead of the first because it can end up
  21653. // being emptied incorrectly in certain situations (#8070).
  21654. for ( ; i < l; i++ ) {
  21655. node = fragment;
  21656. if ( i !== iNoClone ) {
  21657. node = jQuery.clone( node, true, true );
  21658. // Keep references to cloned scripts for later restoration
  21659. if ( hasScripts ) {
  21660. // Support: Android <=4.0 only, PhantomJS 1 only
  21661. // push.apply(_, arraylike) throws on ancient WebKit
  21662. jQuery.merge( scripts, getAll( node, "script" ) );
  21663. }
  21664. }
  21665. callback.call( collection[ i ], node, i );
  21666. }
  21667. if ( hasScripts ) {
  21668. doc = scripts[ scripts.length - 1 ].ownerDocument;
  21669. // Reenable scripts
  21670. jQuery.map( scripts, restoreScript );
  21671. // Evaluate executable scripts on first document insertion
  21672. for ( i = 0; i < hasScripts; i++ ) {
  21673. node = scripts[ i ];
  21674. if ( rscriptType.test( node.type || "" ) &&
  21675. !dataPriv.access( node, "globalEval" ) &&
  21676. jQuery.contains( doc, node ) ) {
  21677. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  21678. // Optional AJAX dependency, but won't run scripts if not present
  21679. if ( jQuery._evalUrl ) {
  21680. jQuery._evalUrl( node.src );
  21681. }
  21682. } else {
  21683. DOMEval( node.textContent.replace( rcleanScript, "" ), doc, node );
  21684. }
  21685. }
  21686. }
  21687. }
  21688. }
  21689. }
  21690. return collection;
  21691. }
  21692. function remove( elem, selector, keepData ) {
  21693. var node,
  21694. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  21695. i = 0;
  21696. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  21697. if ( !keepData && node.nodeType === 1 ) {
  21698. jQuery.cleanData( getAll( node ) );
  21699. }
  21700. if ( node.parentNode ) {
  21701. if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
  21702. setGlobalEval( getAll( node, "script" ) );
  21703. }
  21704. node.parentNode.removeChild( node );
  21705. }
  21706. }
  21707. return elem;
  21708. }
  21709. jQuery.extend( {
  21710. htmlPrefilter: function( html ) {
  21711. return html.replace( rxhtmlTag, "<$1></$2>" );
  21712. },
  21713. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  21714. var i, l, srcElements, destElements,
  21715. clone = elem.cloneNode( true ),
  21716. inPage = jQuery.contains( elem.ownerDocument, elem );
  21717. // Fix IE cloning issues
  21718. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  21719. !jQuery.isXMLDoc( elem ) ) {
  21720. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  21721. destElements = getAll( clone );
  21722. srcElements = getAll( elem );
  21723. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  21724. fixInput( srcElements[ i ], destElements[ i ] );
  21725. }
  21726. }
  21727. // Copy the events from the original to the clone
  21728. if ( dataAndEvents ) {
  21729. if ( deepDataAndEvents ) {
  21730. srcElements = srcElements || getAll( elem );
  21731. destElements = destElements || getAll( clone );
  21732. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  21733. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  21734. }
  21735. } else {
  21736. cloneCopyEvent( elem, clone );
  21737. }
  21738. }
  21739. // Preserve script evaluation history
  21740. destElements = getAll( clone, "script" );
  21741. if ( destElements.length > 0 ) {
  21742. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  21743. }
  21744. // Return the cloned set
  21745. return clone;
  21746. },
  21747. cleanData: function( elems ) {
  21748. var data, elem, type,
  21749. special = jQuery.event.special,
  21750. i = 0;
  21751. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  21752. if ( acceptData( elem ) ) {
  21753. if ( ( data = elem[ dataPriv.expando ] ) ) {
  21754. if ( data.events ) {
  21755. for ( type in data.events ) {
  21756. if ( special[ type ] ) {
  21757. jQuery.event.remove( elem, type );
  21758. // This is a shortcut to avoid jQuery.event.remove's overhead
  21759. } else {
  21760. jQuery.removeEvent( elem, type, data.handle );
  21761. }
  21762. }
  21763. }
  21764. // Support: Chrome <=35 - 45+
  21765. // Assign undefined instead of using delete, see Data#remove
  21766. elem[ dataPriv.expando ] = undefined;
  21767. }
  21768. if ( elem[ dataUser.expando ] ) {
  21769. // Support: Chrome <=35 - 45+
  21770. // Assign undefined instead of using delete, see Data#remove
  21771. elem[ dataUser.expando ] = undefined;
  21772. }
  21773. }
  21774. }
  21775. }
  21776. } );
  21777. jQuery.fn.extend( {
  21778. detach: function( selector ) {
  21779. return remove( this, selector, true );
  21780. },
  21781. remove: function( selector ) {
  21782. return remove( this, selector );
  21783. },
  21784. text: function( value ) {
  21785. return access( this, function( value ) {
  21786. return value === undefined ?
  21787. jQuery.text( this ) :
  21788. this.empty().each( function() {
  21789. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  21790. this.textContent = value;
  21791. }
  21792. } );
  21793. }, null, value, arguments.length );
  21794. },
  21795. append: function() {
  21796. return domManip( this, arguments, function( elem ) {
  21797. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  21798. var target = manipulationTarget( this, elem );
  21799. target.appendChild( elem );
  21800. }
  21801. } );
  21802. },
  21803. prepend: function() {
  21804. return domManip( this, arguments, function( elem ) {
  21805. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  21806. var target = manipulationTarget( this, elem );
  21807. target.insertBefore( elem, target.firstChild );
  21808. }
  21809. } );
  21810. },
  21811. before: function() {
  21812. return domManip( this, arguments, function( elem ) {
  21813. if ( this.parentNode ) {
  21814. this.parentNode.insertBefore( elem, this );
  21815. }
  21816. } );
  21817. },
  21818. after: function() {
  21819. return domManip( this, arguments, function( elem ) {
  21820. if ( this.parentNode ) {
  21821. this.parentNode.insertBefore( elem, this.nextSibling );
  21822. }
  21823. } );
  21824. },
  21825. empty: function() {
  21826. var elem,
  21827. i = 0;
  21828. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  21829. if ( elem.nodeType === 1 ) {
  21830. // Prevent memory leaks
  21831. jQuery.cleanData( getAll( elem, false ) );
  21832. // Remove any remaining nodes
  21833. elem.textContent = "";
  21834. }
  21835. }
  21836. return this;
  21837. },
  21838. clone: function( dataAndEvents, deepDataAndEvents ) {
  21839. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  21840. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  21841. return this.map( function() {
  21842. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  21843. } );
  21844. },
  21845. html: function( value ) {
  21846. return access( this, function( value ) {
  21847. var elem = this[ 0 ] || {},
  21848. i = 0,
  21849. l = this.length;
  21850. if ( value === undefined && elem.nodeType === 1 ) {
  21851. return elem.innerHTML;
  21852. }
  21853. // See if we can take a shortcut and just use innerHTML
  21854. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  21855. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  21856. value = jQuery.htmlPrefilter( value );
  21857. try {
  21858. for ( ; i < l; i++ ) {
  21859. elem = this[ i ] || {};
  21860. // Remove element nodes and prevent memory leaks
  21861. if ( elem.nodeType === 1 ) {
  21862. jQuery.cleanData( getAll( elem, false ) );
  21863. elem.innerHTML = value;
  21864. }
  21865. }
  21866. elem = 0;
  21867. // If using innerHTML throws an exception, use the fallback method
  21868. } catch ( e ) {}
  21869. }
  21870. if ( elem ) {
  21871. this.empty().append( value );
  21872. }
  21873. }, null, value, arguments.length );
  21874. },
  21875. replaceWith: function() {
  21876. var ignored = [];
  21877. // Make the changes, replacing each non-ignored context element with the new content
  21878. return domManip( this, arguments, function( elem ) {
  21879. var parent = this.parentNode;
  21880. if ( jQuery.inArray( this, ignored ) < 0 ) {
  21881. jQuery.cleanData( getAll( this ) );
  21882. if ( parent ) {
  21883. parent.replaceChild( elem, this );
  21884. }
  21885. }
  21886. // Force callback invocation
  21887. }, ignored );
  21888. }
  21889. } );
  21890. jQuery.each( {
  21891. appendTo: "append",
  21892. prependTo: "prepend",
  21893. insertBefore: "before",
  21894. insertAfter: "after",
  21895. replaceAll: "replaceWith"
  21896. }, function( name, original ) {
  21897. jQuery.fn[ name ] = function( selector ) {
  21898. var elems,
  21899. ret = [],
  21900. insert = jQuery( selector ),
  21901. last = insert.length - 1,
  21902. i = 0;
  21903. for ( ; i <= last; i++ ) {
  21904. elems = i === last ? this : this.clone( true );
  21905. jQuery( insert[ i ] )[ original ]( elems );
  21906. // Support: Android <=4.0 only, PhantomJS 1 only
  21907. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  21908. push.apply( ret, elems.get() );
  21909. }
  21910. return this.pushStack( ret );
  21911. };
  21912. } );
  21913. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  21914. var getStyles = function( elem ) {
  21915. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  21916. // IE throws on elements created in popups
  21917. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  21918. var view = elem.ownerDocument.defaultView;
  21919. if ( !view || !view.opener ) {
  21920. view = window;
  21921. }
  21922. return view.getComputedStyle( elem );
  21923. };
  21924. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  21925. ( function() {
  21926. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  21927. // so they're executed at the same time to save the second computation.
  21928. function computeStyleTests() {
  21929. // This is a singleton, we need to execute it only once
  21930. if ( !div ) {
  21931. return;
  21932. }
  21933. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  21934. "margin-top:1px;padding:0;border:0";
  21935. div.style.cssText =
  21936. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  21937. "margin:auto;border:1px;padding:1px;" +
  21938. "width:60%;top:1%";
  21939. documentElement.appendChild( container ).appendChild( div );
  21940. var divStyle = window.getComputedStyle( div );
  21941. pixelPositionVal = divStyle.top !== "1%";
  21942. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  21943. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  21944. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  21945. // Some styles come back with percentage values, even though they shouldn't
  21946. div.style.right = "60%";
  21947. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  21948. // Support: IE 9 - 11 only
  21949. // Detect misreporting of content dimensions for box-sizing:border-box elements
  21950. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  21951. // Support: IE 9 only
  21952. // Detect overflow:scroll screwiness (gh-3699)
  21953. div.style.position = "absolute";
  21954. scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
  21955. documentElement.removeChild( container );
  21956. // Nullify the div so it wouldn't be stored in the memory and
  21957. // it will also be a sign that checks already performed
  21958. div = null;
  21959. }
  21960. function roundPixelMeasures( measure ) {
  21961. return Math.round( parseFloat( measure ) );
  21962. }
  21963. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  21964. reliableMarginLeftVal,
  21965. container = document.createElement( "div" ),
  21966. div = document.createElement( "div" );
  21967. // Finish early in limited (non-browser) environments
  21968. if ( !div.style ) {
  21969. return;
  21970. }
  21971. // Support: IE <=9 - 11 only
  21972. // Style of cloned element affects source element cloned (#8908)
  21973. div.style.backgroundClip = "content-box";
  21974. div.cloneNode( true ).style.backgroundClip = "";
  21975. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  21976. jQuery.extend( support, {
  21977. boxSizingReliable: function() {
  21978. computeStyleTests();
  21979. return boxSizingReliableVal;
  21980. },
  21981. pixelBoxStyles: function() {
  21982. computeStyleTests();
  21983. return pixelBoxStylesVal;
  21984. },
  21985. pixelPosition: function() {
  21986. computeStyleTests();
  21987. return pixelPositionVal;
  21988. },
  21989. reliableMarginLeft: function() {
  21990. computeStyleTests();
  21991. return reliableMarginLeftVal;
  21992. },
  21993. scrollboxSize: function() {
  21994. computeStyleTests();
  21995. return scrollboxSizeVal;
  21996. }
  21997. } );
  21998. } )();
  21999. function curCSS( elem, name, computed ) {
  22000. var width, minWidth, maxWidth, ret,
  22001. // Support: Firefox 51+
  22002. // Retrieving style before computed somehow
  22003. // fixes an issue with getting wrong values
  22004. // on detached elements
  22005. style = elem.style;
  22006. computed = computed || getStyles( elem );
  22007. // getPropertyValue is needed for:
  22008. // .css('filter') (IE 9 only, #12537)
  22009. // .css('--customProperty) (#3144)
  22010. if ( computed ) {
  22011. ret = computed.getPropertyValue( name ) || computed[ name ];
  22012. if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
  22013. ret = jQuery.style( elem, name );
  22014. }
  22015. // A tribute to the "awesome hack by Dean Edwards"
  22016. // Android Browser returns percentage for some values,
  22017. // but width seems to be reliably pixels.
  22018. // This is against the CSSOM draft spec:
  22019. // https://drafts.csswg.org/cssom/#resolved-values
  22020. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  22021. // Remember the original values
  22022. width = style.width;
  22023. minWidth = style.minWidth;
  22024. maxWidth = style.maxWidth;
  22025. // Put in the new values to get a computed value out
  22026. style.minWidth = style.maxWidth = style.width = ret;
  22027. ret = computed.width;
  22028. // Revert the changed values
  22029. style.width = width;
  22030. style.minWidth = minWidth;
  22031. style.maxWidth = maxWidth;
  22032. }
  22033. }
  22034. return ret !== undefined ?
  22035. // Support: IE <=9 - 11 only
  22036. // IE returns zIndex value as an integer.
  22037. ret + "" :
  22038. ret;
  22039. }
  22040. function addGetHookIf( conditionFn, hookFn ) {
  22041. // Define the hook, we'll check on the first run if it's really needed.
  22042. return {
  22043. get: function() {
  22044. if ( conditionFn() ) {
  22045. // Hook not needed (or it's not possible to use it due
  22046. // to missing dependency), remove it.
  22047. delete this.get;
  22048. return;
  22049. }
  22050. // Hook needed; redefine it so that the support test is not executed again.
  22051. return ( this.get = hookFn ).apply( this, arguments );
  22052. }
  22053. };
  22054. }
  22055. var
  22056. // Swappable if display is none or starts with table
  22057. // except "table", "table-cell", or "table-caption"
  22058. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  22059. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  22060. rcustomProp = /^--/,
  22061. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  22062. cssNormalTransform = {
  22063. letterSpacing: "0",
  22064. fontWeight: "400"
  22065. },
  22066. cssPrefixes = [ "Webkit", "Moz", "ms" ],
  22067. emptyStyle = document.createElement( "div" ).style;
  22068. // Return a css property mapped to a potentially vendor prefixed property
  22069. function vendorPropName( name ) {
  22070. // Shortcut for names that are not vendor prefixed
  22071. if ( name in emptyStyle ) {
  22072. return name;
  22073. }
  22074. // Check for vendor prefixed names
  22075. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  22076. i = cssPrefixes.length;
  22077. while ( i-- ) {
  22078. name = cssPrefixes[ i ] + capName;
  22079. if ( name in emptyStyle ) {
  22080. return name;
  22081. }
  22082. }
  22083. }
  22084. // Return a property mapped along what jQuery.cssProps suggests or to
  22085. // a vendor prefixed property.
  22086. function finalPropName( name ) {
  22087. var ret = jQuery.cssProps[ name ];
  22088. if ( !ret ) {
  22089. ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
  22090. }
  22091. return ret;
  22092. }
  22093. function setPositiveNumber( elem, value, subtract ) {
  22094. // Any relative (+/-) values have already been
  22095. // normalized at this point
  22096. var matches = rcssNum.exec( value );
  22097. return matches ?
  22098. // Guard against undefined "subtract", e.g., when used as in cssHooks
  22099. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  22100. value;
  22101. }
  22102. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  22103. var i = dimension === "width" ? 1 : 0,
  22104. extra = 0,
  22105. delta = 0;
  22106. // Adjustment may not be necessary
  22107. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  22108. return 0;
  22109. }
  22110. for ( ; i < 4; i += 2 ) {
  22111. // Both box models exclude margin
  22112. if ( box === "margin" ) {
  22113. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  22114. }
  22115. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  22116. if ( !isBorderBox ) {
  22117. // Add padding
  22118. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  22119. // For "border" or "margin", add border
  22120. if ( box !== "padding" ) {
  22121. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  22122. // But still keep track of it otherwise
  22123. } else {
  22124. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  22125. }
  22126. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  22127. // "padding" or "margin"
  22128. } else {
  22129. // For "content", subtract padding
  22130. if ( box === "content" ) {
  22131. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  22132. }
  22133. // For "content" or "padding", subtract border
  22134. if ( box !== "margin" ) {
  22135. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  22136. }
  22137. }
  22138. }
  22139. // Account for positive content-box scroll gutter when requested by providing computedVal
  22140. if ( !isBorderBox && computedVal >= 0 ) {
  22141. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  22142. // Assuming integer scroll gutter, subtract the rest and round down
  22143. delta += Math.max( 0, Math.ceil(
  22144. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  22145. computedVal -
  22146. delta -
  22147. extra -
  22148. 0.5
  22149. ) );
  22150. }
  22151. return delta;
  22152. }
  22153. function getWidthOrHeight( elem, dimension, extra ) {
  22154. // Start with computed style
  22155. var styles = getStyles( elem ),
  22156. val = curCSS( elem, dimension, styles ),
  22157. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  22158. valueIsBorderBox = isBorderBox;
  22159. // Support: Firefox <=54
  22160. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  22161. if ( rnumnonpx.test( val ) ) {
  22162. if ( !extra ) {
  22163. return val;
  22164. }
  22165. val = "auto";
  22166. }
  22167. // Check for style in case a browser which returns unreliable values
  22168. // for getComputedStyle silently falls back to the reliable elem.style
  22169. valueIsBorderBox = valueIsBorderBox &&
  22170. ( support.boxSizingReliable() || val === elem.style[ dimension ] );
  22171. // Fall back to offsetWidth/offsetHeight when value is "auto"
  22172. // This happens for inline elements with no explicit setting (gh-3571)
  22173. // Support: Android <=4.1 - 4.3 only
  22174. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  22175. if ( val === "auto" ||
  22176. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) {
  22177. val = elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ];
  22178. // offsetWidth/offsetHeight provide border-box values
  22179. valueIsBorderBox = true;
  22180. }
  22181. // Normalize "" and auto
  22182. val = parseFloat( val ) || 0;
  22183. // Adjust for the element's box model
  22184. return ( val +
  22185. boxModelAdjustment(
  22186. elem,
  22187. dimension,
  22188. extra || ( isBorderBox ? "border" : "content" ),
  22189. valueIsBorderBox,
  22190. styles,
  22191. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  22192. val
  22193. )
  22194. ) + "px";
  22195. }
  22196. jQuery.extend( {
  22197. // Add in style property hooks for overriding the default
  22198. // behavior of getting and setting a style property
  22199. cssHooks: {
  22200. opacity: {
  22201. get: function( elem, computed ) {
  22202. if ( computed ) {
  22203. // We should always get a number back from opacity
  22204. var ret = curCSS( elem, "opacity" );
  22205. return ret === "" ? "1" : ret;
  22206. }
  22207. }
  22208. }
  22209. },
  22210. // Don't automatically add "px" to these possibly-unitless properties
  22211. cssNumber: {
  22212. "animationIterationCount": true,
  22213. "columnCount": true,
  22214. "fillOpacity": true,
  22215. "flexGrow": true,
  22216. "flexShrink": true,
  22217. "fontWeight": true,
  22218. "lineHeight": true,
  22219. "opacity": true,
  22220. "order": true,
  22221. "orphans": true,
  22222. "widows": true,
  22223. "zIndex": true,
  22224. "zoom": true
  22225. },
  22226. // Add in properties whose names you wish to fix before
  22227. // setting or getting the value
  22228. cssProps: {},
  22229. // Get and set the style property on a DOM Node
  22230. style: function( elem, name, value, extra ) {
  22231. // Don't set styles on text and comment nodes
  22232. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  22233. return;
  22234. }
  22235. // Make sure that we're working with the right name
  22236. var ret, type, hooks,
  22237. origName = camelCase( name ),
  22238. isCustomProp = rcustomProp.test( name ),
  22239. style = elem.style;
  22240. // Make sure that we're working with the right name. We don't
  22241. // want to query the value if it is a CSS custom property
  22242. // since they are user-defined.
  22243. if ( !isCustomProp ) {
  22244. name = finalPropName( origName );
  22245. }
  22246. // Gets hook for the prefixed version, then unprefixed version
  22247. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  22248. // Check if we're setting a value
  22249. if ( value !== undefined ) {
  22250. type = typeof value;
  22251. // Convert "+=" or "-=" to relative numbers (#7345)
  22252. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  22253. value = adjustCSS( elem, name, ret );
  22254. // Fixes bug #9237
  22255. type = "number";
  22256. }
  22257. // Make sure that null and NaN values aren't set (#7116)
  22258. if ( value == null || value !== value ) {
  22259. return;
  22260. }
  22261. // If a number was passed in, add the unit (except for certain CSS properties)
  22262. if ( type === "number" ) {
  22263. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  22264. }
  22265. // background-* props affect original clone's values
  22266. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  22267. style[ name ] = "inherit";
  22268. }
  22269. // If a hook was provided, use that value, otherwise just set the specified value
  22270. if ( !hooks || !( "set" in hooks ) ||
  22271. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  22272. if ( isCustomProp ) {
  22273. style.setProperty( name, value );
  22274. } else {
  22275. style[ name ] = value;
  22276. }
  22277. }
  22278. } else {
  22279. // If a hook was provided get the non-computed value from there
  22280. if ( hooks && "get" in hooks &&
  22281. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  22282. return ret;
  22283. }
  22284. // Otherwise just get the value from the style object
  22285. return style[ name ];
  22286. }
  22287. },
  22288. css: function( elem, name, extra, styles ) {
  22289. var val, num, hooks,
  22290. origName = camelCase( name ),
  22291. isCustomProp = rcustomProp.test( name );
  22292. // Make sure that we're working with the right name. We don't
  22293. // want to modify the value if it is a CSS custom property
  22294. // since they are user-defined.
  22295. if ( !isCustomProp ) {
  22296. name = finalPropName( origName );
  22297. }
  22298. // Try prefixed name followed by the unprefixed name
  22299. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  22300. // If a hook was provided get the computed value from there
  22301. if ( hooks && "get" in hooks ) {
  22302. val = hooks.get( elem, true, extra );
  22303. }
  22304. // Otherwise, if a way to get the computed value exists, use that
  22305. if ( val === undefined ) {
  22306. val = curCSS( elem, name, styles );
  22307. }
  22308. // Convert "normal" to computed value
  22309. if ( val === "normal" && name in cssNormalTransform ) {
  22310. val = cssNormalTransform[ name ];
  22311. }
  22312. // Make numeric if forced or a qualifier was provided and val looks numeric
  22313. if ( extra === "" || extra ) {
  22314. num = parseFloat( val );
  22315. return extra === true || isFinite( num ) ? num || 0 : val;
  22316. }
  22317. return val;
  22318. }
  22319. } );
  22320. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  22321. jQuery.cssHooks[ dimension ] = {
  22322. get: function( elem, computed, extra ) {
  22323. if ( computed ) {
  22324. // Certain elements can have dimension info if we invisibly show them
  22325. // but it must have a current display style that would benefit
  22326. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  22327. // Support: Safari 8+
  22328. // Table columns in Safari have non-zero offsetWidth & zero
  22329. // getBoundingClientRect().width unless display is changed.
  22330. // Support: IE <=11 only
  22331. // Running getBoundingClientRect on a disconnected node
  22332. // in IE throws an error.
  22333. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  22334. swap( elem, cssShow, function() {
  22335. return getWidthOrHeight( elem, dimension, extra );
  22336. } ) :
  22337. getWidthOrHeight( elem, dimension, extra );
  22338. }
  22339. },
  22340. set: function( elem, value, extra ) {
  22341. var matches,
  22342. styles = getStyles( elem ),
  22343. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  22344. subtract = extra && boxModelAdjustment(
  22345. elem,
  22346. dimension,
  22347. extra,
  22348. isBorderBox,
  22349. styles
  22350. );
  22351. // Account for unreliable border-box dimensions by comparing offset* to computed and
  22352. // faking a content-box to get border and padding (gh-3699)
  22353. if ( isBorderBox && support.scrollboxSize() === styles.position ) {
  22354. subtract -= Math.ceil(
  22355. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  22356. parseFloat( styles[ dimension ] ) -
  22357. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  22358. 0.5
  22359. );
  22360. }
  22361. // Convert to pixels if value adjustment is needed
  22362. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  22363. ( matches[ 3 ] || "px" ) !== "px" ) {
  22364. elem.style[ dimension ] = value;
  22365. value = jQuery.css( elem, dimension );
  22366. }
  22367. return setPositiveNumber( elem, value, subtract );
  22368. }
  22369. };
  22370. } );
  22371. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  22372. function( elem, computed ) {
  22373. if ( computed ) {
  22374. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  22375. elem.getBoundingClientRect().left -
  22376. swap( elem, { marginLeft: 0 }, function() {
  22377. return elem.getBoundingClientRect().left;
  22378. } )
  22379. ) + "px";
  22380. }
  22381. }
  22382. );
  22383. // These hooks are used by animate to expand properties
  22384. jQuery.each( {
  22385. margin: "",
  22386. padding: "",
  22387. border: "Width"
  22388. }, function( prefix, suffix ) {
  22389. jQuery.cssHooks[ prefix + suffix ] = {
  22390. expand: function( value ) {
  22391. var i = 0,
  22392. expanded = {},
  22393. // Assumes a single number if not a string
  22394. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  22395. for ( ; i < 4; i++ ) {
  22396. expanded[ prefix + cssExpand[ i ] + suffix ] =
  22397. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  22398. }
  22399. return expanded;
  22400. }
  22401. };
  22402. if ( prefix !== "margin" ) {
  22403. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  22404. }
  22405. } );
  22406. jQuery.fn.extend( {
  22407. css: function( name, value ) {
  22408. return access( this, function( elem, name, value ) {
  22409. var styles, len,
  22410. map = {},
  22411. i = 0;
  22412. if ( Array.isArray( name ) ) {
  22413. styles = getStyles( elem );
  22414. len = name.length;
  22415. for ( ; i < len; i++ ) {
  22416. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  22417. }
  22418. return map;
  22419. }
  22420. return value !== undefined ?
  22421. jQuery.style( elem, name, value ) :
  22422. jQuery.css( elem, name );
  22423. }, name, value, arguments.length > 1 );
  22424. }
  22425. } );
  22426. function Tween( elem, options, prop, end, easing ) {
  22427. return new Tween.prototype.init( elem, options, prop, end, easing );
  22428. }
  22429. jQuery.Tween = Tween;
  22430. Tween.prototype = {
  22431. constructor: Tween,
  22432. init: function( elem, options, prop, end, easing, unit ) {
  22433. this.elem = elem;
  22434. this.prop = prop;
  22435. this.easing = easing || jQuery.easing._default;
  22436. this.options = options;
  22437. this.start = this.now = this.cur();
  22438. this.end = end;
  22439. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  22440. },
  22441. cur: function() {
  22442. var hooks = Tween.propHooks[ this.prop ];
  22443. return hooks && hooks.get ?
  22444. hooks.get( this ) :
  22445. Tween.propHooks._default.get( this );
  22446. },
  22447. run: function( percent ) {
  22448. var eased,
  22449. hooks = Tween.propHooks[ this.prop ];
  22450. if ( this.options.duration ) {
  22451. this.pos = eased = jQuery.easing[ this.easing ](
  22452. percent, this.options.duration * percent, 0, 1, this.options.duration
  22453. );
  22454. } else {
  22455. this.pos = eased = percent;
  22456. }
  22457. this.now = ( this.end - this.start ) * eased + this.start;
  22458. if ( this.options.step ) {
  22459. this.options.step.call( this.elem, this.now, this );
  22460. }
  22461. if ( hooks && hooks.set ) {
  22462. hooks.set( this );
  22463. } else {
  22464. Tween.propHooks._default.set( this );
  22465. }
  22466. return this;
  22467. }
  22468. };
  22469. Tween.prototype.init.prototype = Tween.prototype;
  22470. Tween.propHooks = {
  22471. _default: {
  22472. get: function( tween ) {
  22473. var result;
  22474. // Use a property on the element directly when it is not a DOM element,
  22475. // or when there is no matching style property that exists.
  22476. if ( tween.elem.nodeType !== 1 ||
  22477. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  22478. return tween.elem[ tween.prop ];
  22479. }
  22480. // Passing an empty string as a 3rd parameter to .css will automatically
  22481. // attempt a parseFloat and fallback to a string if the parse fails.
  22482. // Simple values such as "10px" are parsed to Float;
  22483. // complex values such as "rotate(1rad)" are returned as-is.
  22484. result = jQuery.css( tween.elem, tween.prop, "" );
  22485. // Empty strings, null, undefined and "auto" are converted to 0.
  22486. return !result || result === "auto" ? 0 : result;
  22487. },
  22488. set: function( tween ) {
  22489. // Use step hook for back compat.
  22490. // Use cssHook if its there.
  22491. // Use .style if available and use plain properties where available.
  22492. if ( jQuery.fx.step[ tween.prop ] ) {
  22493. jQuery.fx.step[ tween.prop ]( tween );
  22494. } else if ( tween.elem.nodeType === 1 &&
  22495. ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
  22496. jQuery.cssHooks[ tween.prop ] ) ) {
  22497. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  22498. } else {
  22499. tween.elem[ tween.prop ] = tween.now;
  22500. }
  22501. }
  22502. }
  22503. };
  22504. // Support: IE <=9 only
  22505. // Panic based approach to setting things on disconnected nodes
  22506. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  22507. set: function( tween ) {
  22508. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  22509. tween.elem[ tween.prop ] = tween.now;
  22510. }
  22511. }
  22512. };
  22513. jQuery.easing = {
  22514. linear: function( p ) {
  22515. return p;
  22516. },
  22517. swing: function( p ) {
  22518. return 0.5 - Math.cos( p * Math.PI ) / 2;
  22519. },
  22520. _default: "swing"
  22521. };
  22522. jQuery.fx = Tween.prototype.init;
  22523. // Back compat <1.8 extension point
  22524. jQuery.fx.step = {};
  22525. var
  22526. fxNow, inProgress,
  22527. rfxtypes = /^(?:toggle|show|hide)$/,
  22528. rrun = /queueHooks$/;
  22529. function schedule() {
  22530. if ( inProgress ) {
  22531. if ( document.hidden === false && window.requestAnimationFrame ) {
  22532. window.requestAnimationFrame( schedule );
  22533. } else {
  22534. window.setTimeout( schedule, jQuery.fx.interval );
  22535. }
  22536. jQuery.fx.tick();
  22537. }
  22538. }
  22539. // Animations created synchronously will run synchronously
  22540. function createFxNow() {
  22541. window.setTimeout( function() {
  22542. fxNow = undefined;
  22543. } );
  22544. return ( fxNow = Date.now() );
  22545. }
  22546. // Generate parameters to create a standard animation
  22547. function genFx( type, includeWidth ) {
  22548. var which,
  22549. i = 0,
  22550. attrs = { height: type };
  22551. // If we include width, step value is 1 to do all cssExpand values,
  22552. // otherwise step value is 2 to skip over Left and Right
  22553. includeWidth = includeWidth ? 1 : 0;
  22554. for ( ; i < 4; i += 2 - includeWidth ) {
  22555. which = cssExpand[ i ];
  22556. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  22557. }
  22558. if ( includeWidth ) {
  22559. attrs.opacity = attrs.width = type;
  22560. }
  22561. return attrs;
  22562. }
  22563. function createTween( value, prop, animation ) {
  22564. var tween,
  22565. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  22566. index = 0,
  22567. length = collection.length;
  22568. for ( ; index < length; index++ ) {
  22569. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  22570. // We're done with this property
  22571. return tween;
  22572. }
  22573. }
  22574. }
  22575. function defaultPrefilter( elem, props, opts ) {
  22576. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  22577. isBox = "width" in props || "height" in props,
  22578. anim = this,
  22579. orig = {},
  22580. style = elem.style,
  22581. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  22582. dataShow = dataPriv.get( elem, "fxshow" );
  22583. // Queue-skipping animations hijack the fx hooks
  22584. if ( !opts.queue ) {
  22585. hooks = jQuery._queueHooks( elem, "fx" );
  22586. if ( hooks.unqueued == null ) {
  22587. hooks.unqueued = 0;
  22588. oldfire = hooks.empty.fire;
  22589. hooks.empty.fire = function() {
  22590. if ( !hooks.unqueued ) {
  22591. oldfire();
  22592. }
  22593. };
  22594. }
  22595. hooks.unqueued++;
  22596. anim.always( function() {
  22597. // Ensure the complete handler is called before this completes
  22598. anim.always( function() {
  22599. hooks.unqueued--;
  22600. if ( !jQuery.queue( elem, "fx" ).length ) {
  22601. hooks.empty.fire();
  22602. }
  22603. } );
  22604. } );
  22605. }
  22606. // Detect show/hide animations
  22607. for ( prop in props ) {
  22608. value = props[ prop ];
  22609. if ( rfxtypes.test( value ) ) {
  22610. delete props[ prop ];
  22611. toggle = toggle || value === "toggle";
  22612. if ( value === ( hidden ? "hide" : "show" ) ) {
  22613. // Pretend to be hidden if this is a "show" and
  22614. // there is still data from a stopped show/hide
  22615. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  22616. hidden = true;
  22617. // Ignore all other no-op show/hide data
  22618. } else {
  22619. continue;
  22620. }
  22621. }
  22622. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  22623. }
  22624. }
  22625. // Bail out if this is a no-op like .hide().hide()
  22626. propTween = !jQuery.isEmptyObject( props );
  22627. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  22628. return;
  22629. }
  22630. // Restrict "overflow" and "display" styles during box animations
  22631. if ( isBox && elem.nodeType === 1 ) {
  22632. // Support: IE <=9 - 11, Edge 12 - 15
  22633. // Record all 3 overflow attributes because IE does not infer the shorthand
  22634. // from identically-valued overflowX and overflowY and Edge just mirrors
  22635. // the overflowX value there.
  22636. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  22637. // Identify a display type, preferring old show/hide data over the CSS cascade
  22638. restoreDisplay = dataShow && dataShow.display;
  22639. if ( restoreDisplay == null ) {
  22640. restoreDisplay = dataPriv.get( elem, "display" );
  22641. }
  22642. display = jQuery.css( elem, "display" );
  22643. if ( display === "none" ) {
  22644. if ( restoreDisplay ) {
  22645. display = restoreDisplay;
  22646. } else {
  22647. // Get nonempty value(s) by temporarily forcing visibility
  22648. showHide( [ elem ], true );
  22649. restoreDisplay = elem.style.display || restoreDisplay;
  22650. display = jQuery.css( elem, "display" );
  22651. showHide( [ elem ] );
  22652. }
  22653. }
  22654. // Animate inline elements as inline-block
  22655. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  22656. if ( jQuery.css( elem, "float" ) === "none" ) {
  22657. // Restore the original display value at the end of pure show/hide animations
  22658. if ( !propTween ) {
  22659. anim.done( function() {
  22660. style.display = restoreDisplay;
  22661. } );
  22662. if ( restoreDisplay == null ) {
  22663. display = style.display;
  22664. restoreDisplay = display === "none" ? "" : display;
  22665. }
  22666. }
  22667. style.display = "inline-block";
  22668. }
  22669. }
  22670. }
  22671. if ( opts.overflow ) {
  22672. style.overflow = "hidden";
  22673. anim.always( function() {
  22674. style.overflow = opts.overflow[ 0 ];
  22675. style.overflowX = opts.overflow[ 1 ];
  22676. style.overflowY = opts.overflow[ 2 ];
  22677. } );
  22678. }
  22679. // Implement show/hide animations
  22680. propTween = false;
  22681. for ( prop in orig ) {
  22682. // General show/hide setup for this element animation
  22683. if ( !propTween ) {
  22684. if ( dataShow ) {
  22685. if ( "hidden" in dataShow ) {
  22686. hidden = dataShow.hidden;
  22687. }
  22688. } else {
  22689. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  22690. }
  22691. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  22692. if ( toggle ) {
  22693. dataShow.hidden = !hidden;
  22694. }
  22695. // Show elements before animating them
  22696. if ( hidden ) {
  22697. showHide( [ elem ], true );
  22698. }
  22699. /* eslint-disable no-loop-func */
  22700. anim.done( function() {
  22701. /* eslint-enable no-loop-func */
  22702. // The final step of a "hide" animation is actually hiding the element
  22703. if ( !hidden ) {
  22704. showHide( [ elem ] );
  22705. }
  22706. dataPriv.remove( elem, "fxshow" );
  22707. for ( prop in orig ) {
  22708. jQuery.style( elem, prop, orig[ prop ] );
  22709. }
  22710. } );
  22711. }
  22712. // Per-property setup
  22713. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  22714. if ( !( prop in dataShow ) ) {
  22715. dataShow[ prop ] = propTween.start;
  22716. if ( hidden ) {
  22717. propTween.end = propTween.start;
  22718. propTween.start = 0;
  22719. }
  22720. }
  22721. }
  22722. }
  22723. function propFilter( props, specialEasing ) {
  22724. var index, name, easing, value, hooks;
  22725. // camelCase, specialEasing and expand cssHook pass
  22726. for ( index in props ) {
  22727. name = camelCase( index );
  22728. easing = specialEasing[ name ];
  22729. value = props[ index ];
  22730. if ( Array.isArray( value ) ) {
  22731. easing = value[ 1 ];
  22732. value = props[ index ] = value[ 0 ];
  22733. }
  22734. if ( index !== name ) {
  22735. props[ name ] = value;
  22736. delete props[ index ];
  22737. }
  22738. hooks = jQuery.cssHooks[ name ];
  22739. if ( hooks && "expand" in hooks ) {
  22740. value = hooks.expand( value );
  22741. delete props[ name ];
  22742. // Not quite $.extend, this won't overwrite existing keys.
  22743. // Reusing 'index' because we have the correct "name"
  22744. for ( index in value ) {
  22745. if ( !( index in props ) ) {
  22746. props[ index ] = value[ index ];
  22747. specialEasing[ index ] = easing;
  22748. }
  22749. }
  22750. } else {
  22751. specialEasing[ name ] = easing;
  22752. }
  22753. }
  22754. }
  22755. function Animation( elem, properties, options ) {
  22756. var result,
  22757. stopped,
  22758. index = 0,
  22759. length = Animation.prefilters.length,
  22760. deferred = jQuery.Deferred().always( function() {
  22761. // Don't match elem in the :animated selector
  22762. delete tick.elem;
  22763. } ),
  22764. tick = function() {
  22765. if ( stopped ) {
  22766. return false;
  22767. }
  22768. var currentTime = fxNow || createFxNow(),
  22769. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  22770. // Support: Android 2.3 only
  22771. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  22772. temp = remaining / animation.duration || 0,
  22773. percent = 1 - temp,
  22774. index = 0,
  22775. length = animation.tweens.length;
  22776. for ( ; index < length; index++ ) {
  22777. animation.tweens[ index ].run( percent );
  22778. }
  22779. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  22780. // If there's more to do, yield
  22781. if ( percent < 1 && length ) {
  22782. return remaining;
  22783. }
  22784. // If this was an empty animation, synthesize a final progress notification
  22785. if ( !length ) {
  22786. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  22787. }
  22788. // Resolve the animation and report its conclusion
  22789. deferred.resolveWith( elem, [ animation ] );
  22790. return false;
  22791. },
  22792. animation = deferred.promise( {
  22793. elem: elem,
  22794. props: jQuery.extend( {}, properties ),
  22795. opts: jQuery.extend( true, {
  22796. specialEasing: {},
  22797. easing: jQuery.easing._default
  22798. }, options ),
  22799. originalProperties: properties,
  22800. originalOptions: options,
  22801. startTime: fxNow || createFxNow(),
  22802. duration: options.duration,
  22803. tweens: [],
  22804. createTween: function( prop, end ) {
  22805. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  22806. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  22807. animation.tweens.push( tween );
  22808. return tween;
  22809. },
  22810. stop: function( gotoEnd ) {
  22811. var index = 0,
  22812. // If we are going to the end, we want to run all the tweens
  22813. // otherwise we skip this part
  22814. length = gotoEnd ? animation.tweens.length : 0;
  22815. if ( stopped ) {
  22816. return this;
  22817. }
  22818. stopped = true;
  22819. for ( ; index < length; index++ ) {
  22820. animation.tweens[ index ].run( 1 );
  22821. }
  22822. // Resolve when we played the last frame; otherwise, reject
  22823. if ( gotoEnd ) {
  22824. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  22825. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  22826. } else {
  22827. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  22828. }
  22829. return this;
  22830. }
  22831. } ),
  22832. props = animation.props;
  22833. propFilter( props, animation.opts.specialEasing );
  22834. for ( ; index < length; index++ ) {
  22835. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  22836. if ( result ) {
  22837. if ( isFunction( result.stop ) ) {
  22838. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  22839. result.stop.bind( result );
  22840. }
  22841. return result;
  22842. }
  22843. }
  22844. jQuery.map( props, createTween, animation );
  22845. if ( isFunction( animation.opts.start ) ) {
  22846. animation.opts.start.call( elem, animation );
  22847. }
  22848. // Attach callbacks from options
  22849. animation
  22850. .progress( animation.opts.progress )
  22851. .done( animation.opts.done, animation.opts.complete )
  22852. .fail( animation.opts.fail )
  22853. .always( animation.opts.always );
  22854. jQuery.fx.timer(
  22855. jQuery.extend( tick, {
  22856. elem: elem,
  22857. anim: animation,
  22858. queue: animation.opts.queue
  22859. } )
  22860. );
  22861. return animation;
  22862. }
  22863. jQuery.Animation = jQuery.extend( Animation, {
  22864. tweeners: {
  22865. "*": [ function( prop, value ) {
  22866. var tween = this.createTween( prop, value );
  22867. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  22868. return tween;
  22869. } ]
  22870. },
  22871. tweener: function( props, callback ) {
  22872. if ( isFunction( props ) ) {
  22873. callback = props;
  22874. props = [ "*" ];
  22875. } else {
  22876. props = props.match( rnothtmlwhite );
  22877. }
  22878. var prop,
  22879. index = 0,
  22880. length = props.length;
  22881. for ( ; index < length; index++ ) {
  22882. prop = props[ index ];
  22883. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  22884. Animation.tweeners[ prop ].unshift( callback );
  22885. }
  22886. },
  22887. prefilters: [ defaultPrefilter ],
  22888. prefilter: function( callback, prepend ) {
  22889. if ( prepend ) {
  22890. Animation.prefilters.unshift( callback );
  22891. } else {
  22892. Animation.prefilters.push( callback );
  22893. }
  22894. }
  22895. } );
  22896. jQuery.speed = function( speed, easing, fn ) {
  22897. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  22898. complete: fn || !fn && easing ||
  22899. isFunction( speed ) && speed,
  22900. duration: speed,
  22901. easing: fn && easing || easing && !isFunction( easing ) && easing
  22902. };
  22903. // Go to the end state if fx are off
  22904. if ( jQuery.fx.off ) {
  22905. opt.duration = 0;
  22906. } else {
  22907. if ( typeof opt.duration !== "number" ) {
  22908. if ( opt.duration in jQuery.fx.speeds ) {
  22909. opt.duration = jQuery.fx.speeds[ opt.duration ];
  22910. } else {
  22911. opt.duration = jQuery.fx.speeds._default;
  22912. }
  22913. }
  22914. }
  22915. // Normalize opt.queue - true/undefined/null -> "fx"
  22916. if ( opt.queue == null || opt.queue === true ) {
  22917. opt.queue = "fx";
  22918. }
  22919. // Queueing
  22920. opt.old = opt.complete;
  22921. opt.complete = function() {
  22922. if ( isFunction( opt.old ) ) {
  22923. opt.old.call( this );
  22924. }
  22925. if ( opt.queue ) {
  22926. jQuery.dequeue( this, opt.queue );
  22927. }
  22928. };
  22929. return opt;
  22930. };
  22931. jQuery.fn.extend( {
  22932. fadeTo: function( speed, to, easing, callback ) {
  22933. // Show any hidden elements after setting opacity to 0
  22934. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  22935. // Animate to the value specified
  22936. .end().animate( { opacity: to }, speed, easing, callback );
  22937. },
  22938. animate: function( prop, speed, easing, callback ) {
  22939. var empty = jQuery.isEmptyObject( prop ),
  22940. optall = jQuery.speed( speed, easing, callback ),
  22941. doAnimation = function() {
  22942. // Operate on a copy of prop so per-property easing won't be lost
  22943. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  22944. // Empty animations, or finishing resolves immediately
  22945. if ( empty || dataPriv.get( this, "finish" ) ) {
  22946. anim.stop( true );
  22947. }
  22948. };
  22949. doAnimation.finish = doAnimation;
  22950. return empty || optall.queue === false ?
  22951. this.each( doAnimation ) :
  22952. this.queue( optall.queue, doAnimation );
  22953. },
  22954. stop: function( type, clearQueue, gotoEnd ) {
  22955. var stopQueue = function( hooks ) {
  22956. var stop = hooks.stop;
  22957. delete hooks.stop;
  22958. stop( gotoEnd );
  22959. };
  22960. if ( typeof type !== "string" ) {
  22961. gotoEnd = clearQueue;
  22962. clearQueue = type;
  22963. type = undefined;
  22964. }
  22965. if ( clearQueue && type !== false ) {
  22966. this.queue( type || "fx", [] );
  22967. }
  22968. return this.each( function() {
  22969. var dequeue = true,
  22970. index = type != null && type + "queueHooks",
  22971. timers = jQuery.timers,
  22972. data = dataPriv.get( this );
  22973. if ( index ) {
  22974. if ( data[ index ] && data[ index ].stop ) {
  22975. stopQueue( data[ index ] );
  22976. }
  22977. } else {
  22978. for ( index in data ) {
  22979. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  22980. stopQueue( data[ index ] );
  22981. }
  22982. }
  22983. }
  22984. for ( index = timers.length; index--; ) {
  22985. if ( timers[ index ].elem === this &&
  22986. ( type == null || timers[ index ].queue === type ) ) {
  22987. timers[ index ].anim.stop( gotoEnd );
  22988. dequeue = false;
  22989. timers.splice( index, 1 );
  22990. }
  22991. }
  22992. // Start the next in the queue if the last step wasn't forced.
  22993. // Timers currently will call their complete callbacks, which
  22994. // will dequeue but only if they were gotoEnd.
  22995. if ( dequeue || !gotoEnd ) {
  22996. jQuery.dequeue( this, type );
  22997. }
  22998. } );
  22999. },
  23000. finish: function( type ) {
  23001. if ( type !== false ) {
  23002. type = type || "fx";
  23003. }
  23004. return this.each( function() {
  23005. var index,
  23006. data = dataPriv.get( this ),
  23007. queue = data[ type + "queue" ],
  23008. hooks = data[ type + "queueHooks" ],
  23009. timers = jQuery.timers,
  23010. length = queue ? queue.length : 0;
  23011. // Enable finishing flag on private data
  23012. data.finish = true;
  23013. // Empty the queue first
  23014. jQuery.queue( this, type, [] );
  23015. if ( hooks && hooks.stop ) {
  23016. hooks.stop.call( this, true );
  23017. }
  23018. // Look for any active animations, and finish them
  23019. for ( index = timers.length; index--; ) {
  23020. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  23021. timers[ index ].anim.stop( true );
  23022. timers.splice( index, 1 );
  23023. }
  23024. }
  23025. // Look for any animations in the old queue and finish them
  23026. for ( index = 0; index < length; index++ ) {
  23027. if ( queue[ index ] && queue[ index ].finish ) {
  23028. queue[ index ].finish.call( this );
  23029. }
  23030. }
  23031. // Turn off finishing flag
  23032. delete data.finish;
  23033. } );
  23034. }
  23035. } );
  23036. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  23037. var cssFn = jQuery.fn[ name ];
  23038. jQuery.fn[ name ] = function( speed, easing, callback ) {
  23039. return speed == null || typeof speed === "boolean" ?
  23040. cssFn.apply( this, arguments ) :
  23041. this.animate( genFx( name, true ), speed, easing, callback );
  23042. };
  23043. } );
  23044. // Generate shortcuts for custom animations
  23045. jQuery.each( {
  23046. slideDown: genFx( "show" ),
  23047. slideUp: genFx( "hide" ),
  23048. slideToggle: genFx( "toggle" ),
  23049. fadeIn: { opacity: "show" },
  23050. fadeOut: { opacity: "hide" },
  23051. fadeToggle: { opacity: "toggle" }
  23052. }, function( name, props ) {
  23053. jQuery.fn[ name ] = function( speed, easing, callback ) {
  23054. return this.animate( props, speed, easing, callback );
  23055. };
  23056. } );
  23057. jQuery.timers = [];
  23058. jQuery.fx.tick = function() {
  23059. var timer,
  23060. i = 0,
  23061. timers = jQuery.timers;
  23062. fxNow = Date.now();
  23063. for ( ; i < timers.length; i++ ) {
  23064. timer = timers[ i ];
  23065. // Run the timer and safely remove it when done (allowing for external removal)
  23066. if ( !timer() && timers[ i ] === timer ) {
  23067. timers.splice( i--, 1 );
  23068. }
  23069. }
  23070. if ( !timers.length ) {
  23071. jQuery.fx.stop();
  23072. }
  23073. fxNow = undefined;
  23074. };
  23075. jQuery.fx.timer = function( timer ) {
  23076. jQuery.timers.push( timer );
  23077. jQuery.fx.start();
  23078. };
  23079. jQuery.fx.interval = 13;
  23080. jQuery.fx.start = function() {
  23081. if ( inProgress ) {
  23082. return;
  23083. }
  23084. inProgress = true;
  23085. schedule();
  23086. };
  23087. jQuery.fx.stop = function() {
  23088. inProgress = null;
  23089. };
  23090. jQuery.fx.speeds = {
  23091. slow: 600,
  23092. fast: 200,
  23093. // Default speed
  23094. _default: 400
  23095. };
  23096. // Based off of the plugin by Clint Helfers, with permission.
  23097. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  23098. jQuery.fn.delay = function( time, type ) {
  23099. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  23100. type = type || "fx";
  23101. return this.queue( type, function( next, hooks ) {
  23102. var timeout = window.setTimeout( next, time );
  23103. hooks.stop = function() {
  23104. window.clearTimeout( timeout );
  23105. };
  23106. } );
  23107. };
  23108. ( function() {
  23109. var input = document.createElement( "input" ),
  23110. select = document.createElement( "select" ),
  23111. opt = select.appendChild( document.createElement( "option" ) );
  23112. input.type = "checkbox";
  23113. // Support: Android <=4.3 only
  23114. // Default value for a checkbox should be "on"
  23115. support.checkOn = input.value !== "";
  23116. // Support: IE <=11 only
  23117. // Must access selectedIndex to make default options select
  23118. support.optSelected = opt.selected;
  23119. // Support: IE <=11 only
  23120. // An input loses its value after becoming a radio
  23121. input = document.createElement( "input" );
  23122. input.value = "t";
  23123. input.type = "radio";
  23124. support.radioValue = input.value === "t";
  23125. } )();
  23126. var boolHook,
  23127. attrHandle = jQuery.expr.attrHandle;
  23128. jQuery.fn.extend( {
  23129. attr: function( name, value ) {
  23130. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  23131. },
  23132. removeAttr: function( name ) {
  23133. return this.each( function() {
  23134. jQuery.removeAttr( this, name );
  23135. } );
  23136. }
  23137. } );
  23138. jQuery.extend( {
  23139. attr: function( elem, name, value ) {
  23140. var ret, hooks,
  23141. nType = elem.nodeType;
  23142. // Don't get/set attributes on text, comment and attribute nodes
  23143. if ( nType === 3 || nType === 8 || nType === 2 ) {
  23144. return;
  23145. }
  23146. // Fallback to prop when attributes are not supported
  23147. if ( typeof elem.getAttribute === "undefined" ) {
  23148. return jQuery.prop( elem, name, value );
  23149. }
  23150. // Attribute hooks are determined by the lowercase version
  23151. // Grab necessary hook if one is defined
  23152. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  23153. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  23154. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  23155. }
  23156. if ( value !== undefined ) {
  23157. if ( value === null ) {
  23158. jQuery.removeAttr( elem, name );
  23159. return;
  23160. }
  23161. if ( hooks && "set" in hooks &&
  23162. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  23163. return ret;
  23164. }
  23165. elem.setAttribute( name, value + "" );
  23166. return value;
  23167. }
  23168. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  23169. return ret;
  23170. }
  23171. ret = jQuery.find.attr( elem, name );
  23172. // Non-existent attributes return null, we normalize to undefined
  23173. return ret == null ? undefined : ret;
  23174. },
  23175. attrHooks: {
  23176. type: {
  23177. set: function( elem, value ) {
  23178. if ( !support.radioValue && value === "radio" &&
  23179. nodeName( elem, "input" ) ) {
  23180. var val = elem.value;
  23181. elem.setAttribute( "type", value );
  23182. if ( val ) {
  23183. elem.value = val;
  23184. }
  23185. return value;
  23186. }
  23187. }
  23188. }
  23189. },
  23190. removeAttr: function( elem, value ) {
  23191. var name,
  23192. i = 0,
  23193. // Attribute names can contain non-HTML whitespace characters
  23194. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  23195. attrNames = value && value.match( rnothtmlwhite );
  23196. if ( attrNames && elem.nodeType === 1 ) {
  23197. while ( ( name = attrNames[ i++ ] ) ) {
  23198. elem.removeAttribute( name );
  23199. }
  23200. }
  23201. }
  23202. } );
  23203. // Hooks for boolean attributes
  23204. boolHook = {
  23205. set: function( elem, value, name ) {
  23206. if ( value === false ) {
  23207. // Remove boolean attributes when set to false
  23208. jQuery.removeAttr( elem, name );
  23209. } else {
  23210. elem.setAttribute( name, name );
  23211. }
  23212. return name;
  23213. }
  23214. };
  23215. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  23216. var getter = attrHandle[ name ] || jQuery.find.attr;
  23217. attrHandle[ name ] = function( elem, name, isXML ) {
  23218. var ret, handle,
  23219. lowercaseName = name.toLowerCase();
  23220. if ( !isXML ) {
  23221. // Avoid an infinite loop by temporarily removing this function from the getter
  23222. handle = attrHandle[ lowercaseName ];
  23223. attrHandle[ lowercaseName ] = ret;
  23224. ret = getter( elem, name, isXML ) != null ?
  23225. lowercaseName :
  23226. null;
  23227. attrHandle[ lowercaseName ] = handle;
  23228. }
  23229. return ret;
  23230. };
  23231. } );
  23232. var rfocusable = /^(?:input|select|textarea|button)$/i,
  23233. rclickable = /^(?:a|area)$/i;
  23234. jQuery.fn.extend( {
  23235. prop: function( name, value ) {
  23236. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  23237. },
  23238. removeProp: function( name ) {
  23239. return this.each( function() {
  23240. delete this[ jQuery.propFix[ name ] || name ];
  23241. } );
  23242. }
  23243. } );
  23244. jQuery.extend( {
  23245. prop: function( elem, name, value ) {
  23246. var ret, hooks,
  23247. nType = elem.nodeType;
  23248. // Don't get/set properties on text, comment and attribute nodes
  23249. if ( nType === 3 || nType === 8 || nType === 2 ) {
  23250. return;
  23251. }
  23252. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  23253. // Fix name and attach hooks
  23254. name = jQuery.propFix[ name ] || name;
  23255. hooks = jQuery.propHooks[ name ];
  23256. }
  23257. if ( value !== undefined ) {
  23258. if ( hooks && "set" in hooks &&
  23259. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  23260. return ret;
  23261. }
  23262. return ( elem[ name ] = value );
  23263. }
  23264. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  23265. return ret;
  23266. }
  23267. return elem[ name ];
  23268. },
  23269. propHooks: {
  23270. tabIndex: {
  23271. get: function( elem ) {
  23272. // Support: IE <=9 - 11 only
  23273. // elem.tabIndex doesn't always return the
  23274. // correct value when it hasn't been explicitly set
  23275. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  23276. // Use proper attribute retrieval(#12072)
  23277. var tabindex = jQuery.find.attr( elem, "tabindex" );
  23278. if ( tabindex ) {
  23279. return parseInt( tabindex, 10 );
  23280. }
  23281. if (
  23282. rfocusable.test( elem.nodeName ) ||
  23283. rclickable.test( elem.nodeName ) &&
  23284. elem.href
  23285. ) {
  23286. return 0;
  23287. }
  23288. return -1;
  23289. }
  23290. }
  23291. },
  23292. propFix: {
  23293. "for": "htmlFor",
  23294. "class": "className"
  23295. }
  23296. } );
  23297. // Support: IE <=11 only
  23298. // Accessing the selectedIndex property
  23299. // forces the browser to respect setting selected
  23300. // on the option
  23301. // The getter ensures a default option is selected
  23302. // when in an optgroup
  23303. // eslint rule "no-unused-expressions" is disabled for this code
  23304. // since it considers such accessions noop
  23305. if ( !support.optSelected ) {
  23306. jQuery.propHooks.selected = {
  23307. get: function( elem ) {
  23308. /* eslint no-unused-expressions: "off" */
  23309. var parent = elem.parentNode;
  23310. if ( parent && parent.parentNode ) {
  23311. parent.parentNode.selectedIndex;
  23312. }
  23313. return null;
  23314. },
  23315. set: function( elem ) {
  23316. /* eslint no-unused-expressions: "off" */
  23317. var parent = elem.parentNode;
  23318. if ( parent ) {
  23319. parent.selectedIndex;
  23320. if ( parent.parentNode ) {
  23321. parent.parentNode.selectedIndex;
  23322. }
  23323. }
  23324. }
  23325. };
  23326. }
  23327. jQuery.each( [
  23328. "tabIndex",
  23329. "readOnly",
  23330. "maxLength",
  23331. "cellSpacing",
  23332. "cellPadding",
  23333. "rowSpan",
  23334. "colSpan",
  23335. "useMap",
  23336. "frameBorder",
  23337. "contentEditable"
  23338. ], function() {
  23339. jQuery.propFix[ this.toLowerCase() ] = this;
  23340. } );
  23341. // Strip and collapse whitespace according to HTML spec
  23342. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  23343. function stripAndCollapse( value ) {
  23344. var tokens = value.match( rnothtmlwhite ) || [];
  23345. return tokens.join( " " );
  23346. }
  23347. function getClass( elem ) {
  23348. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  23349. }
  23350. function classesToArray( value ) {
  23351. if ( Array.isArray( value ) ) {
  23352. return value;
  23353. }
  23354. if ( typeof value === "string" ) {
  23355. return value.match( rnothtmlwhite ) || [];
  23356. }
  23357. return [];
  23358. }
  23359. jQuery.fn.extend( {
  23360. addClass: function( value ) {
  23361. var classes, elem, cur, curValue, clazz, j, finalValue,
  23362. i = 0;
  23363. if ( isFunction( value ) ) {
  23364. return this.each( function( j ) {
  23365. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  23366. } );
  23367. }
  23368. classes = classesToArray( value );
  23369. if ( classes.length ) {
  23370. while ( ( elem = this[ i++ ] ) ) {
  23371. curValue = getClass( elem );
  23372. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  23373. if ( cur ) {
  23374. j = 0;
  23375. while ( ( clazz = classes[ j++ ] ) ) {
  23376. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  23377. cur += clazz + " ";
  23378. }
  23379. }
  23380. // Only assign if different to avoid unneeded rendering.
  23381. finalValue = stripAndCollapse( cur );
  23382. if ( curValue !== finalValue ) {
  23383. elem.setAttribute( "class", finalValue );
  23384. }
  23385. }
  23386. }
  23387. }
  23388. return this;
  23389. },
  23390. removeClass: function( value ) {
  23391. var classes, elem, cur, curValue, clazz, j, finalValue,
  23392. i = 0;
  23393. if ( isFunction( value ) ) {
  23394. return this.each( function( j ) {
  23395. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  23396. } );
  23397. }
  23398. if ( !arguments.length ) {
  23399. return this.attr( "class", "" );
  23400. }
  23401. classes = classesToArray( value );
  23402. if ( classes.length ) {
  23403. while ( ( elem = this[ i++ ] ) ) {
  23404. curValue = getClass( elem );
  23405. // This expression is here for better compressibility (see addClass)
  23406. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  23407. if ( cur ) {
  23408. j = 0;
  23409. while ( ( clazz = classes[ j++ ] ) ) {
  23410. // Remove *all* instances
  23411. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  23412. cur = cur.replace( " " + clazz + " ", " " );
  23413. }
  23414. }
  23415. // Only assign if different to avoid unneeded rendering.
  23416. finalValue = stripAndCollapse( cur );
  23417. if ( curValue !== finalValue ) {
  23418. elem.setAttribute( "class", finalValue );
  23419. }
  23420. }
  23421. }
  23422. }
  23423. return this;
  23424. },
  23425. toggleClass: function( value, stateVal ) {
  23426. var type = typeof value,
  23427. isValidValue = type === "string" || Array.isArray( value );
  23428. if ( typeof stateVal === "boolean" && isValidValue ) {
  23429. return stateVal ? this.addClass( value ) : this.removeClass( value );
  23430. }
  23431. if ( isFunction( value ) ) {
  23432. return this.each( function( i ) {
  23433. jQuery( this ).toggleClass(
  23434. value.call( this, i, getClass( this ), stateVal ),
  23435. stateVal
  23436. );
  23437. } );
  23438. }
  23439. return this.each( function() {
  23440. var className, i, self, classNames;
  23441. if ( isValidValue ) {
  23442. // Toggle individual class names
  23443. i = 0;
  23444. self = jQuery( this );
  23445. classNames = classesToArray( value );
  23446. while ( ( className = classNames[ i++ ] ) ) {
  23447. // Check each className given, space separated list
  23448. if ( self.hasClass( className ) ) {
  23449. self.removeClass( className );
  23450. } else {
  23451. self.addClass( className );
  23452. }
  23453. }
  23454. // Toggle whole class name
  23455. } else if ( value === undefined || type === "boolean" ) {
  23456. className = getClass( this );
  23457. if ( className ) {
  23458. // Store className if set
  23459. dataPriv.set( this, "__className__", className );
  23460. }
  23461. // If the element has a class name or if we're passed `false`,
  23462. // then remove the whole classname (if there was one, the above saved it).
  23463. // Otherwise bring back whatever was previously saved (if anything),
  23464. // falling back to the empty string if nothing was stored.
  23465. if ( this.setAttribute ) {
  23466. this.setAttribute( "class",
  23467. className || value === false ?
  23468. "" :
  23469. dataPriv.get( this, "__className__" ) || ""
  23470. );
  23471. }
  23472. }
  23473. } );
  23474. },
  23475. hasClass: function( selector ) {
  23476. var className, elem,
  23477. i = 0;
  23478. className = " " + selector + " ";
  23479. while ( ( elem = this[ i++ ] ) ) {
  23480. if ( elem.nodeType === 1 &&
  23481. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  23482. return true;
  23483. }
  23484. }
  23485. return false;
  23486. }
  23487. } );
  23488. var rreturn = /\r/g;
  23489. jQuery.fn.extend( {
  23490. val: function( value ) {
  23491. var hooks, ret, valueIsFunction,
  23492. elem = this[ 0 ];
  23493. if ( !arguments.length ) {
  23494. if ( elem ) {
  23495. hooks = jQuery.valHooks[ elem.type ] ||
  23496. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  23497. if ( hooks &&
  23498. "get" in hooks &&
  23499. ( ret = hooks.get( elem, "value" ) ) !== undefined
  23500. ) {
  23501. return ret;
  23502. }
  23503. ret = elem.value;
  23504. // Handle most common string cases
  23505. if ( typeof ret === "string" ) {
  23506. return ret.replace( rreturn, "" );
  23507. }
  23508. // Handle cases where value is null/undef or number
  23509. return ret == null ? "" : ret;
  23510. }
  23511. return;
  23512. }
  23513. valueIsFunction = isFunction( value );
  23514. return this.each( function( i ) {
  23515. var val;
  23516. if ( this.nodeType !== 1 ) {
  23517. return;
  23518. }
  23519. if ( valueIsFunction ) {
  23520. val = value.call( this, i, jQuery( this ).val() );
  23521. } else {
  23522. val = value;
  23523. }
  23524. // Treat null/undefined as ""; convert numbers to string
  23525. if ( val == null ) {
  23526. val = "";
  23527. } else if ( typeof val === "number" ) {
  23528. val += "";
  23529. } else if ( Array.isArray( val ) ) {
  23530. val = jQuery.map( val, function( value ) {
  23531. return value == null ? "" : value + "";
  23532. } );
  23533. }
  23534. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  23535. // If set returns undefined, fall back to normal setting
  23536. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  23537. this.value = val;
  23538. }
  23539. } );
  23540. }
  23541. } );
  23542. jQuery.extend( {
  23543. valHooks: {
  23544. option: {
  23545. get: function( elem ) {
  23546. var val = jQuery.find.attr( elem, "value" );
  23547. return val != null ?
  23548. val :
  23549. // Support: IE <=10 - 11 only
  23550. // option.text throws exceptions (#14686, #14858)
  23551. // Strip and collapse whitespace
  23552. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  23553. stripAndCollapse( jQuery.text( elem ) );
  23554. }
  23555. },
  23556. select: {
  23557. get: function( elem ) {
  23558. var value, option, i,
  23559. options = elem.options,
  23560. index = elem.selectedIndex,
  23561. one = elem.type === "select-one",
  23562. values = one ? null : [],
  23563. max = one ? index + 1 : options.length;
  23564. if ( index < 0 ) {
  23565. i = max;
  23566. } else {
  23567. i = one ? index : 0;
  23568. }
  23569. // Loop through all the selected options
  23570. for ( ; i < max; i++ ) {
  23571. option = options[ i ];
  23572. // Support: IE <=9 only
  23573. // IE8-9 doesn't update selected after form reset (#2551)
  23574. if ( ( option.selected || i === index ) &&
  23575. // Don't return options that are disabled or in a disabled optgroup
  23576. !option.disabled &&
  23577. ( !option.parentNode.disabled ||
  23578. !nodeName( option.parentNode, "optgroup" ) ) ) {
  23579. // Get the specific value for the option
  23580. value = jQuery( option ).val();
  23581. // We don't need an array for one selects
  23582. if ( one ) {
  23583. return value;
  23584. }
  23585. // Multi-Selects return an array
  23586. values.push( value );
  23587. }
  23588. }
  23589. return values;
  23590. },
  23591. set: function( elem, value ) {
  23592. var optionSet, option,
  23593. options = elem.options,
  23594. values = jQuery.makeArray( value ),
  23595. i = options.length;
  23596. while ( i-- ) {
  23597. option = options[ i ];
  23598. /* eslint-disable no-cond-assign */
  23599. if ( option.selected =
  23600. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  23601. ) {
  23602. optionSet = true;
  23603. }
  23604. /* eslint-enable no-cond-assign */
  23605. }
  23606. // Force browsers to behave consistently when non-matching value is set
  23607. if ( !optionSet ) {
  23608. elem.selectedIndex = -1;
  23609. }
  23610. return values;
  23611. }
  23612. }
  23613. }
  23614. } );
  23615. // Radios and checkboxes getter/setter
  23616. jQuery.each( [ "radio", "checkbox" ], function() {
  23617. jQuery.valHooks[ this ] = {
  23618. set: function( elem, value ) {
  23619. if ( Array.isArray( value ) ) {
  23620. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  23621. }
  23622. }
  23623. };
  23624. if ( !support.checkOn ) {
  23625. jQuery.valHooks[ this ].get = function( elem ) {
  23626. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  23627. };
  23628. }
  23629. } );
  23630. // Return jQuery for attributes-only inclusion
  23631. support.focusin = "onfocusin" in window;
  23632. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  23633. stopPropagationCallback = function( e ) {
  23634. e.stopPropagation();
  23635. };
  23636. jQuery.extend( jQuery.event, {
  23637. trigger: function( event, data, elem, onlyHandlers ) {
  23638. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  23639. eventPath = [ elem || document ],
  23640. type = hasOwn.call( event, "type" ) ? event.type : event,
  23641. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  23642. cur = lastElement = tmp = elem = elem || document;
  23643. // Don't do events on text and comment nodes
  23644. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  23645. return;
  23646. }
  23647. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  23648. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  23649. return;
  23650. }
  23651. if ( type.indexOf( "." ) > -1 ) {
  23652. // Namespaced trigger; create a regexp to match event type in handle()
  23653. namespaces = type.split( "." );
  23654. type = namespaces.shift();
  23655. namespaces.sort();
  23656. }
  23657. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  23658. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  23659. event = event[ jQuery.expando ] ?
  23660. event :
  23661. new jQuery.Event( type, typeof event === "object" && event );
  23662. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  23663. event.isTrigger = onlyHandlers ? 2 : 3;
  23664. event.namespace = namespaces.join( "." );
  23665. event.rnamespace = event.namespace ?
  23666. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  23667. null;
  23668. // Clean up the event in case it is being reused
  23669. event.result = undefined;
  23670. if ( !event.target ) {
  23671. event.target = elem;
  23672. }
  23673. // Clone any incoming data and prepend the event, creating the handler arg list
  23674. data = data == null ?
  23675. [ event ] :
  23676. jQuery.makeArray( data, [ event ] );
  23677. // Allow special events to draw outside the lines
  23678. special = jQuery.event.special[ type ] || {};
  23679. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  23680. return;
  23681. }
  23682. // Determine event propagation path in advance, per W3C events spec (#9951)
  23683. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  23684. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  23685. bubbleType = special.delegateType || type;
  23686. if ( !rfocusMorph.test( bubbleType + type ) ) {
  23687. cur = cur.parentNode;
  23688. }
  23689. for ( ; cur; cur = cur.parentNode ) {
  23690. eventPath.push( cur );
  23691. tmp = cur;
  23692. }
  23693. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  23694. if ( tmp === ( elem.ownerDocument || document ) ) {
  23695. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  23696. }
  23697. }
  23698. // Fire handlers on the event path
  23699. i = 0;
  23700. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  23701. lastElement = cur;
  23702. event.type = i > 1 ?
  23703. bubbleType :
  23704. special.bindType || type;
  23705. // jQuery handler
  23706. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  23707. dataPriv.get( cur, "handle" );
  23708. if ( handle ) {
  23709. handle.apply( cur, data );
  23710. }
  23711. // Native handler
  23712. handle = ontype && cur[ ontype ];
  23713. if ( handle && handle.apply && acceptData( cur ) ) {
  23714. event.result = handle.apply( cur, data );
  23715. if ( event.result === false ) {
  23716. event.preventDefault();
  23717. }
  23718. }
  23719. }
  23720. event.type = type;
  23721. // If nobody prevented the default action, do it now
  23722. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  23723. if ( ( !special._default ||
  23724. special._default.apply( eventPath.pop(), data ) === false ) &&
  23725. acceptData( elem ) ) {
  23726. // Call a native DOM method on the target with the same name as the event.
  23727. // Don't do default actions on window, that's where global variables be (#6170)
  23728. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  23729. // Don't re-trigger an onFOO event when we call its FOO() method
  23730. tmp = elem[ ontype ];
  23731. if ( tmp ) {
  23732. elem[ ontype ] = null;
  23733. }
  23734. // Prevent re-triggering of the same event, since we already bubbled it above
  23735. jQuery.event.triggered = type;
  23736. if ( event.isPropagationStopped() ) {
  23737. lastElement.addEventListener( type, stopPropagationCallback );
  23738. }
  23739. elem[ type ]();
  23740. if ( event.isPropagationStopped() ) {
  23741. lastElement.removeEventListener( type, stopPropagationCallback );
  23742. }
  23743. jQuery.event.triggered = undefined;
  23744. if ( tmp ) {
  23745. elem[ ontype ] = tmp;
  23746. }
  23747. }
  23748. }
  23749. }
  23750. return event.result;
  23751. },
  23752. // Piggyback on a donor event to simulate a different one
  23753. // Used only for `focus(in | out)` events
  23754. simulate: function( type, elem, event ) {
  23755. var e = jQuery.extend(
  23756. new jQuery.Event(),
  23757. event,
  23758. {
  23759. type: type,
  23760. isSimulated: true
  23761. }
  23762. );
  23763. jQuery.event.trigger( e, null, elem );
  23764. }
  23765. } );
  23766. jQuery.fn.extend( {
  23767. trigger: function( type, data ) {
  23768. return this.each( function() {
  23769. jQuery.event.trigger( type, data, this );
  23770. } );
  23771. },
  23772. triggerHandler: function( type, data ) {
  23773. var elem = this[ 0 ];
  23774. if ( elem ) {
  23775. return jQuery.event.trigger( type, data, elem, true );
  23776. }
  23777. }
  23778. } );
  23779. // Support: Firefox <=44
  23780. // Firefox doesn't have focus(in | out) events
  23781. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  23782. //
  23783. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  23784. // focus(in | out) events fire after focus & blur events,
  23785. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  23786. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  23787. if ( !support.focusin ) {
  23788. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  23789. // Attach a single capturing handler on the document while someone wants focusin/focusout
  23790. var handler = function( event ) {
  23791. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  23792. };
  23793. jQuery.event.special[ fix ] = {
  23794. setup: function() {
  23795. var doc = this.ownerDocument || this,
  23796. attaches = dataPriv.access( doc, fix );
  23797. if ( !attaches ) {
  23798. doc.addEventListener( orig, handler, true );
  23799. }
  23800. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  23801. },
  23802. teardown: function() {
  23803. var doc = this.ownerDocument || this,
  23804. attaches = dataPriv.access( doc, fix ) - 1;
  23805. if ( !attaches ) {
  23806. doc.removeEventListener( orig, handler, true );
  23807. dataPriv.remove( doc, fix );
  23808. } else {
  23809. dataPriv.access( doc, fix, attaches );
  23810. }
  23811. }
  23812. };
  23813. } );
  23814. }
  23815. var location = window.location;
  23816. var nonce = Date.now();
  23817. var rquery = ( /\?/ );
  23818. // Cross-browser xml parsing
  23819. jQuery.parseXML = function( data ) {
  23820. var xml;
  23821. if ( !data || typeof data !== "string" ) {
  23822. return null;
  23823. }
  23824. // Support: IE 9 - 11 only
  23825. // IE throws on parseFromString with invalid input.
  23826. try {
  23827. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  23828. } catch ( e ) {
  23829. xml = undefined;
  23830. }
  23831. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  23832. jQuery.error( "Invalid XML: " + data );
  23833. }
  23834. return xml;
  23835. };
  23836. var
  23837. rbracket = /\[\]$/,
  23838. rCRLF = /\r?\n/g,
  23839. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  23840. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  23841. function buildParams( prefix, obj, traditional, add ) {
  23842. var name;
  23843. if ( Array.isArray( obj ) ) {
  23844. // Serialize array item.
  23845. jQuery.each( obj, function( i, v ) {
  23846. if ( traditional || rbracket.test( prefix ) ) {
  23847. // Treat each array item as a scalar.
  23848. add( prefix, v );
  23849. } else {
  23850. // Item is non-scalar (array or object), encode its numeric index.
  23851. buildParams(
  23852. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  23853. v,
  23854. traditional,
  23855. add
  23856. );
  23857. }
  23858. } );
  23859. } else if ( !traditional && toType( obj ) === "object" ) {
  23860. // Serialize object item.
  23861. for ( name in obj ) {
  23862. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  23863. }
  23864. } else {
  23865. // Serialize scalar item.
  23866. add( prefix, obj );
  23867. }
  23868. }
  23869. // Serialize an array of form elements or a set of
  23870. // key/values into a query string
  23871. jQuery.param = function( a, traditional ) {
  23872. var prefix,
  23873. s = [],
  23874. add = function( key, valueOrFunction ) {
  23875. // If value is a function, invoke it and use its return value
  23876. var value = isFunction( valueOrFunction ) ?
  23877. valueOrFunction() :
  23878. valueOrFunction;
  23879. s[ s.length ] = encodeURIComponent( key ) + "=" +
  23880. encodeURIComponent( value == null ? "" : value );
  23881. };
  23882. // If an array was passed in, assume that it is an array of form elements.
  23883. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  23884. // Serialize the form elements
  23885. jQuery.each( a, function() {
  23886. add( this.name, this.value );
  23887. } );
  23888. } else {
  23889. // If traditional, encode the "old" way (the way 1.3.2 or older
  23890. // did it), otherwise encode params recursively.
  23891. for ( prefix in a ) {
  23892. buildParams( prefix, a[ prefix ], traditional, add );
  23893. }
  23894. }
  23895. // Return the resulting serialization
  23896. return s.join( "&" );
  23897. };
  23898. jQuery.fn.extend( {
  23899. serialize: function() {
  23900. return jQuery.param( this.serializeArray() );
  23901. },
  23902. serializeArray: function() {
  23903. return this.map( function() {
  23904. // Can add propHook for "elements" to filter or add form elements
  23905. var elements = jQuery.prop( this, "elements" );
  23906. return elements ? jQuery.makeArray( elements ) : this;
  23907. } )
  23908. .filter( function() {
  23909. var type = this.type;
  23910. // Use .is( ":disabled" ) so that fieldset[disabled] works
  23911. return this.name && !jQuery( this ).is( ":disabled" ) &&
  23912. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  23913. ( this.checked || !rcheckableType.test( type ) );
  23914. } )
  23915. .map( function( i, elem ) {
  23916. var val = jQuery( this ).val();
  23917. if ( val == null ) {
  23918. return null;
  23919. }
  23920. if ( Array.isArray( val ) ) {
  23921. return jQuery.map( val, function( val ) {
  23922. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  23923. } );
  23924. }
  23925. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  23926. } ).get();
  23927. }
  23928. } );
  23929. var
  23930. r20 = /%20/g,
  23931. rhash = /#.*$/,
  23932. rantiCache = /([?&])_=[^&]*/,
  23933. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  23934. // #7653, #8125, #8152: local protocol detection
  23935. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  23936. rnoContent = /^(?:GET|HEAD)$/,
  23937. rprotocol = /^\/\//,
  23938. /* Prefilters
  23939. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  23940. * 2) These are called:
  23941. * - BEFORE asking for a transport
  23942. * - AFTER param serialization (s.data is a string if s.processData is true)
  23943. * 3) key is the dataType
  23944. * 4) the catchall symbol "*" can be used
  23945. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  23946. */
  23947. prefilters = {},
  23948. /* Transports bindings
  23949. * 1) key is the dataType
  23950. * 2) the catchall symbol "*" can be used
  23951. * 3) selection will start with transport dataType and THEN go to "*" if needed
  23952. */
  23953. transports = {},
  23954. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  23955. allTypes = "*/".concat( "*" ),
  23956. // Anchor tag for parsing the document origin
  23957. originAnchor = document.createElement( "a" );
  23958. originAnchor.href = location.href;
  23959. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  23960. function addToPrefiltersOrTransports( structure ) {
  23961. // dataTypeExpression is optional and defaults to "*"
  23962. return function( dataTypeExpression, func ) {
  23963. if ( typeof dataTypeExpression !== "string" ) {
  23964. func = dataTypeExpression;
  23965. dataTypeExpression = "*";
  23966. }
  23967. var dataType,
  23968. i = 0,
  23969. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  23970. if ( isFunction( func ) ) {
  23971. // For each dataType in the dataTypeExpression
  23972. while ( ( dataType = dataTypes[ i++ ] ) ) {
  23973. // Prepend if requested
  23974. if ( dataType[ 0 ] === "+" ) {
  23975. dataType = dataType.slice( 1 ) || "*";
  23976. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  23977. // Otherwise append
  23978. } else {
  23979. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  23980. }
  23981. }
  23982. }
  23983. };
  23984. }
  23985. // Base inspection function for prefilters and transports
  23986. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  23987. var inspected = {},
  23988. seekingTransport = ( structure === transports );
  23989. function inspect( dataType ) {
  23990. var selected;
  23991. inspected[ dataType ] = true;
  23992. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  23993. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  23994. if ( typeof dataTypeOrTransport === "string" &&
  23995. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  23996. options.dataTypes.unshift( dataTypeOrTransport );
  23997. inspect( dataTypeOrTransport );
  23998. return false;
  23999. } else if ( seekingTransport ) {
  24000. return !( selected = dataTypeOrTransport );
  24001. }
  24002. } );
  24003. return selected;
  24004. }
  24005. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  24006. }
  24007. // A special extend for ajax options
  24008. // that takes "flat" options (not to be deep extended)
  24009. // Fixes #9887
  24010. function ajaxExtend( target, src ) {
  24011. var key, deep,
  24012. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  24013. for ( key in src ) {
  24014. if ( src[ key ] !== undefined ) {
  24015. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  24016. }
  24017. }
  24018. if ( deep ) {
  24019. jQuery.extend( true, target, deep );
  24020. }
  24021. return target;
  24022. }
  24023. /* Handles responses to an ajax request:
  24024. * - finds the right dataType (mediates between content-type and expected dataType)
  24025. * - returns the corresponding response
  24026. */
  24027. function ajaxHandleResponses( s, jqXHR, responses ) {
  24028. var ct, type, finalDataType, firstDataType,
  24029. contents = s.contents,
  24030. dataTypes = s.dataTypes;
  24031. // Remove auto dataType and get content-type in the process
  24032. while ( dataTypes[ 0 ] === "*" ) {
  24033. dataTypes.shift();
  24034. if ( ct === undefined ) {
  24035. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  24036. }
  24037. }
  24038. // Check if we're dealing with a known content-type
  24039. if ( ct ) {
  24040. for ( type in contents ) {
  24041. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  24042. dataTypes.unshift( type );
  24043. break;
  24044. }
  24045. }
  24046. }
  24047. // Check to see if we have a response for the expected dataType
  24048. if ( dataTypes[ 0 ] in responses ) {
  24049. finalDataType = dataTypes[ 0 ];
  24050. } else {
  24051. // Try convertible dataTypes
  24052. for ( type in responses ) {
  24053. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  24054. finalDataType = type;
  24055. break;
  24056. }
  24057. if ( !firstDataType ) {
  24058. firstDataType = type;
  24059. }
  24060. }
  24061. // Or just use first one
  24062. finalDataType = finalDataType || firstDataType;
  24063. }
  24064. // If we found a dataType
  24065. // We add the dataType to the list if needed
  24066. // and return the corresponding response
  24067. if ( finalDataType ) {
  24068. if ( finalDataType !== dataTypes[ 0 ] ) {
  24069. dataTypes.unshift( finalDataType );
  24070. }
  24071. return responses[ finalDataType ];
  24072. }
  24073. }
  24074. /* Chain conversions given the request and the original response
  24075. * Also sets the responseXXX fields on the jqXHR instance
  24076. */
  24077. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  24078. var conv2, current, conv, tmp, prev,
  24079. converters = {},
  24080. // Work with a copy of dataTypes in case we need to modify it for conversion
  24081. dataTypes = s.dataTypes.slice();
  24082. // Create converters map with lowercased keys
  24083. if ( dataTypes[ 1 ] ) {
  24084. for ( conv in s.converters ) {
  24085. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  24086. }
  24087. }
  24088. current = dataTypes.shift();
  24089. // Convert to each sequential dataType
  24090. while ( current ) {
  24091. if ( s.responseFields[ current ] ) {
  24092. jqXHR[ s.responseFields[ current ] ] = response;
  24093. }
  24094. // Apply the dataFilter if provided
  24095. if ( !prev && isSuccess && s.dataFilter ) {
  24096. response = s.dataFilter( response, s.dataType );
  24097. }
  24098. prev = current;
  24099. current = dataTypes.shift();
  24100. if ( current ) {
  24101. // There's only work to do if current dataType is non-auto
  24102. if ( current === "*" ) {
  24103. current = prev;
  24104. // Convert response if prev dataType is non-auto and differs from current
  24105. } else if ( prev !== "*" && prev !== current ) {
  24106. // Seek a direct converter
  24107. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  24108. // If none found, seek a pair
  24109. if ( !conv ) {
  24110. for ( conv2 in converters ) {
  24111. // If conv2 outputs current
  24112. tmp = conv2.split( " " );
  24113. if ( tmp[ 1 ] === current ) {
  24114. // If prev can be converted to accepted input
  24115. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  24116. converters[ "* " + tmp[ 0 ] ];
  24117. if ( conv ) {
  24118. // Condense equivalence converters
  24119. if ( conv === true ) {
  24120. conv = converters[ conv2 ];
  24121. // Otherwise, insert the intermediate dataType
  24122. } else if ( converters[ conv2 ] !== true ) {
  24123. current = tmp[ 0 ];
  24124. dataTypes.unshift( tmp[ 1 ] );
  24125. }
  24126. break;
  24127. }
  24128. }
  24129. }
  24130. }
  24131. // Apply converter (if not an equivalence)
  24132. if ( conv !== true ) {
  24133. // Unless errors are allowed to bubble, catch and return them
  24134. if ( conv && s.throws ) {
  24135. response = conv( response );
  24136. } else {
  24137. try {
  24138. response = conv( response );
  24139. } catch ( e ) {
  24140. return {
  24141. state: "parsererror",
  24142. error: conv ? e : "No conversion from " + prev + " to " + current
  24143. };
  24144. }
  24145. }
  24146. }
  24147. }
  24148. }
  24149. }
  24150. return { state: "success", data: response };
  24151. }
  24152. jQuery.extend( {
  24153. // Counter for holding the number of active queries
  24154. active: 0,
  24155. // Last-Modified header cache for next request
  24156. lastModified: {},
  24157. etag: {},
  24158. ajaxSettings: {
  24159. url: location.href,
  24160. type: "GET",
  24161. isLocal: rlocalProtocol.test( location.protocol ),
  24162. global: true,
  24163. processData: true,
  24164. async: true,
  24165. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  24166. /*
  24167. timeout: 0,
  24168. data: null,
  24169. dataType: null,
  24170. username: null,
  24171. password: null,
  24172. cache: null,
  24173. throws: false,
  24174. traditional: false,
  24175. headers: {},
  24176. */
  24177. accepts: {
  24178. "*": allTypes,
  24179. text: "text/plain",
  24180. html: "text/html",
  24181. xml: "application/xml, text/xml",
  24182. json: "application/json, text/javascript"
  24183. },
  24184. contents: {
  24185. xml: /\bxml\b/,
  24186. html: /\bhtml/,
  24187. json: /\bjson\b/
  24188. },
  24189. responseFields: {
  24190. xml: "responseXML",
  24191. text: "responseText",
  24192. json: "responseJSON"
  24193. },
  24194. // Data converters
  24195. // Keys separate source (or catchall "*") and destination types with a single space
  24196. converters: {
  24197. // Convert anything to text
  24198. "* text": String,
  24199. // Text to html (true = no transformation)
  24200. "text html": true,
  24201. // Evaluate text as a json expression
  24202. "text json": JSON.parse,
  24203. // Parse text as xml
  24204. "text xml": jQuery.parseXML
  24205. },
  24206. // For options that shouldn't be deep extended:
  24207. // you can add your own custom options here if
  24208. // and when you create one that shouldn't be
  24209. // deep extended (see ajaxExtend)
  24210. flatOptions: {
  24211. url: true,
  24212. context: true
  24213. }
  24214. },
  24215. // Creates a full fledged settings object into target
  24216. // with both ajaxSettings and settings fields.
  24217. // If target is omitted, writes into ajaxSettings.
  24218. ajaxSetup: function( target, settings ) {
  24219. return settings ?
  24220. // Building a settings object
  24221. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  24222. // Extending ajaxSettings
  24223. ajaxExtend( jQuery.ajaxSettings, target );
  24224. },
  24225. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  24226. ajaxTransport: addToPrefiltersOrTransports( transports ),
  24227. // Main method
  24228. ajax: function( url, options ) {
  24229. // If url is an object, simulate pre-1.5 signature
  24230. if ( typeof url === "object" ) {
  24231. options = url;
  24232. url = undefined;
  24233. }
  24234. // Force options to be an object
  24235. options = options || {};
  24236. var transport,
  24237. // URL without anti-cache param
  24238. cacheURL,
  24239. // Response headers
  24240. responseHeadersString,
  24241. responseHeaders,
  24242. // timeout handle
  24243. timeoutTimer,
  24244. // Url cleanup var
  24245. urlAnchor,
  24246. // Request state (becomes false upon send and true upon completion)
  24247. completed,
  24248. // To know if global events are to be dispatched
  24249. fireGlobals,
  24250. // Loop variable
  24251. i,
  24252. // uncached part of the url
  24253. uncached,
  24254. // Create the final options object
  24255. s = jQuery.ajaxSetup( {}, options ),
  24256. // Callbacks context
  24257. callbackContext = s.context || s,
  24258. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  24259. globalEventContext = s.context &&
  24260. ( callbackContext.nodeType || callbackContext.jquery ) ?
  24261. jQuery( callbackContext ) :
  24262. jQuery.event,
  24263. // Deferreds
  24264. deferred = jQuery.Deferred(),
  24265. completeDeferred = jQuery.Callbacks( "once memory" ),
  24266. // Status-dependent callbacks
  24267. statusCode = s.statusCode || {},
  24268. // Headers (they are sent all at once)
  24269. requestHeaders = {},
  24270. requestHeadersNames = {},
  24271. // Default abort message
  24272. strAbort = "canceled",
  24273. // Fake xhr
  24274. jqXHR = {
  24275. readyState: 0,
  24276. // Builds headers hashtable if needed
  24277. getResponseHeader: function( key ) {
  24278. var match;
  24279. if ( completed ) {
  24280. if ( !responseHeaders ) {
  24281. responseHeaders = {};
  24282. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  24283. responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
  24284. }
  24285. }
  24286. match = responseHeaders[ key.toLowerCase() ];
  24287. }
  24288. return match == null ? null : match;
  24289. },
  24290. // Raw string
  24291. getAllResponseHeaders: function() {
  24292. return completed ? responseHeadersString : null;
  24293. },
  24294. // Caches the header
  24295. setRequestHeader: function( name, value ) {
  24296. if ( completed == null ) {
  24297. name = requestHeadersNames[ name.toLowerCase() ] =
  24298. requestHeadersNames[ name.toLowerCase() ] || name;
  24299. requestHeaders[ name ] = value;
  24300. }
  24301. return this;
  24302. },
  24303. // Overrides response content-type header
  24304. overrideMimeType: function( type ) {
  24305. if ( completed == null ) {
  24306. s.mimeType = type;
  24307. }
  24308. return this;
  24309. },
  24310. // Status-dependent callbacks
  24311. statusCode: function( map ) {
  24312. var code;
  24313. if ( map ) {
  24314. if ( completed ) {
  24315. // Execute the appropriate callbacks
  24316. jqXHR.always( map[ jqXHR.status ] );
  24317. } else {
  24318. // Lazy-add the new callbacks in a way that preserves old ones
  24319. for ( code in map ) {
  24320. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  24321. }
  24322. }
  24323. }
  24324. return this;
  24325. },
  24326. // Cancel the request
  24327. abort: function( statusText ) {
  24328. var finalText = statusText || strAbort;
  24329. if ( transport ) {
  24330. transport.abort( finalText );
  24331. }
  24332. done( 0, finalText );
  24333. return this;
  24334. }
  24335. };
  24336. // Attach deferreds
  24337. deferred.promise( jqXHR );
  24338. // Add protocol if not provided (prefilters might expect it)
  24339. // Handle falsy url in the settings object (#10093: consistency with old signature)
  24340. // We also use the url parameter if available
  24341. s.url = ( ( url || s.url || location.href ) + "" )
  24342. .replace( rprotocol, location.protocol + "//" );
  24343. // Alias method option to type as per ticket #12004
  24344. s.type = options.method || options.type || s.method || s.type;
  24345. // Extract dataTypes list
  24346. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  24347. // A cross-domain request is in order when the origin doesn't match the current origin.
  24348. if ( s.crossDomain == null ) {
  24349. urlAnchor = document.createElement( "a" );
  24350. // Support: IE <=8 - 11, Edge 12 - 15
  24351. // IE throws exception on accessing the href property if url is malformed,
  24352. // e.g. http://example.com:80x/
  24353. try {
  24354. urlAnchor.href = s.url;
  24355. // Support: IE <=8 - 11 only
  24356. // Anchor's host property isn't correctly set when s.url is relative
  24357. urlAnchor.href = urlAnchor.href;
  24358. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  24359. urlAnchor.protocol + "//" + urlAnchor.host;
  24360. } catch ( e ) {
  24361. // If there is an error parsing the URL, assume it is crossDomain,
  24362. // it can be rejected by the transport if it is invalid
  24363. s.crossDomain = true;
  24364. }
  24365. }
  24366. // Convert data if not already a string
  24367. if ( s.data && s.processData && typeof s.data !== "string" ) {
  24368. s.data = jQuery.param( s.data, s.traditional );
  24369. }
  24370. // Apply prefilters
  24371. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  24372. // If request was aborted inside a prefilter, stop there
  24373. if ( completed ) {
  24374. return jqXHR;
  24375. }
  24376. // We can fire global events as of now if asked to
  24377. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  24378. fireGlobals = jQuery.event && s.global;
  24379. // Watch for a new set of requests
  24380. if ( fireGlobals && jQuery.active++ === 0 ) {
  24381. jQuery.event.trigger( "ajaxStart" );
  24382. }
  24383. // Uppercase the type
  24384. s.type = s.type.toUpperCase();
  24385. // Determine if request has content
  24386. s.hasContent = !rnoContent.test( s.type );
  24387. // Save the URL in case we're toying with the If-Modified-Since
  24388. // and/or If-None-Match header later on
  24389. // Remove hash to simplify url manipulation
  24390. cacheURL = s.url.replace( rhash, "" );
  24391. // More options handling for requests with no content
  24392. if ( !s.hasContent ) {
  24393. // Remember the hash so we can put it back
  24394. uncached = s.url.slice( cacheURL.length );
  24395. // If data is available and should be processed, append data to url
  24396. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  24397. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  24398. // #9682: remove data so that it's not used in an eventual retry
  24399. delete s.data;
  24400. }
  24401. // Add or update anti-cache param if needed
  24402. if ( s.cache === false ) {
  24403. cacheURL = cacheURL.replace( rantiCache, "$1" );
  24404. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  24405. }
  24406. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  24407. s.url = cacheURL + uncached;
  24408. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  24409. } else if ( s.data && s.processData &&
  24410. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  24411. s.data = s.data.replace( r20, "+" );
  24412. }
  24413. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  24414. if ( s.ifModified ) {
  24415. if ( jQuery.lastModified[ cacheURL ] ) {
  24416. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  24417. }
  24418. if ( jQuery.etag[ cacheURL ] ) {
  24419. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  24420. }
  24421. }
  24422. // Set the correct header, if data is being sent
  24423. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  24424. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  24425. }
  24426. // Set the Accepts header for the server, depending on the dataType
  24427. jqXHR.setRequestHeader(
  24428. "Accept",
  24429. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  24430. s.accepts[ s.dataTypes[ 0 ] ] +
  24431. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  24432. s.accepts[ "*" ]
  24433. );
  24434. // Check for headers option
  24435. for ( i in s.headers ) {
  24436. jqXHR.setRequestHeader( i, s.headers[ i ] );
  24437. }
  24438. // Allow custom headers/mimetypes and early abort
  24439. if ( s.beforeSend &&
  24440. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  24441. // Abort if not done already and return
  24442. return jqXHR.abort();
  24443. }
  24444. // Aborting is no longer a cancellation
  24445. strAbort = "abort";
  24446. // Install callbacks on deferreds
  24447. completeDeferred.add( s.complete );
  24448. jqXHR.done( s.success );
  24449. jqXHR.fail( s.error );
  24450. // Get transport
  24451. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  24452. // If no transport, we auto-abort
  24453. if ( !transport ) {
  24454. done( -1, "No Transport" );
  24455. } else {
  24456. jqXHR.readyState = 1;
  24457. // Send global event
  24458. if ( fireGlobals ) {
  24459. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  24460. }
  24461. // If request was aborted inside ajaxSend, stop there
  24462. if ( completed ) {
  24463. return jqXHR;
  24464. }
  24465. // Timeout
  24466. if ( s.async && s.timeout > 0 ) {
  24467. timeoutTimer = window.setTimeout( function() {
  24468. jqXHR.abort( "timeout" );
  24469. }, s.timeout );
  24470. }
  24471. try {
  24472. completed = false;
  24473. transport.send( requestHeaders, done );
  24474. } catch ( e ) {
  24475. // Rethrow post-completion exceptions
  24476. if ( completed ) {
  24477. throw e;
  24478. }
  24479. // Propagate others as results
  24480. done( -1, e );
  24481. }
  24482. }
  24483. // Callback for when everything is done
  24484. function done( status, nativeStatusText, responses, headers ) {
  24485. var isSuccess, success, error, response, modified,
  24486. statusText = nativeStatusText;
  24487. // Ignore repeat invocations
  24488. if ( completed ) {
  24489. return;
  24490. }
  24491. completed = true;
  24492. // Clear timeout if it exists
  24493. if ( timeoutTimer ) {
  24494. window.clearTimeout( timeoutTimer );
  24495. }
  24496. // Dereference transport for early garbage collection
  24497. // (no matter how long the jqXHR object will be used)
  24498. transport = undefined;
  24499. // Cache response headers
  24500. responseHeadersString = headers || "";
  24501. // Set readyState
  24502. jqXHR.readyState = status > 0 ? 4 : 0;
  24503. // Determine if successful
  24504. isSuccess = status >= 200 && status < 300 || status === 304;
  24505. // Get response data
  24506. if ( responses ) {
  24507. response = ajaxHandleResponses( s, jqXHR, responses );
  24508. }
  24509. // Convert no matter what (that way responseXXX fields are always set)
  24510. response = ajaxConvert( s, response, jqXHR, isSuccess );
  24511. // If successful, handle type chaining
  24512. if ( isSuccess ) {
  24513. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  24514. if ( s.ifModified ) {
  24515. modified = jqXHR.getResponseHeader( "Last-Modified" );
  24516. if ( modified ) {
  24517. jQuery.lastModified[ cacheURL ] = modified;
  24518. }
  24519. modified = jqXHR.getResponseHeader( "etag" );
  24520. if ( modified ) {
  24521. jQuery.etag[ cacheURL ] = modified;
  24522. }
  24523. }
  24524. // if no content
  24525. if ( status === 204 || s.type === "HEAD" ) {
  24526. statusText = "nocontent";
  24527. // if not modified
  24528. } else if ( status === 304 ) {
  24529. statusText = "notmodified";
  24530. // If we have data, let's convert it
  24531. } else {
  24532. statusText = response.state;
  24533. success = response.data;
  24534. error = response.error;
  24535. isSuccess = !error;
  24536. }
  24537. } else {
  24538. // Extract error from statusText and normalize for non-aborts
  24539. error = statusText;
  24540. if ( status || !statusText ) {
  24541. statusText = "error";
  24542. if ( status < 0 ) {
  24543. status = 0;
  24544. }
  24545. }
  24546. }
  24547. // Set data for the fake xhr object
  24548. jqXHR.status = status;
  24549. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  24550. // Success/Error
  24551. if ( isSuccess ) {
  24552. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  24553. } else {
  24554. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  24555. }
  24556. // Status-dependent callbacks
  24557. jqXHR.statusCode( statusCode );
  24558. statusCode = undefined;
  24559. if ( fireGlobals ) {
  24560. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  24561. [ jqXHR, s, isSuccess ? success : error ] );
  24562. }
  24563. // Complete
  24564. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  24565. if ( fireGlobals ) {
  24566. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  24567. // Handle the global AJAX counter
  24568. if ( !( --jQuery.active ) ) {
  24569. jQuery.event.trigger( "ajaxStop" );
  24570. }
  24571. }
  24572. }
  24573. return jqXHR;
  24574. },
  24575. getJSON: function( url, data, callback ) {
  24576. return jQuery.get( url, data, callback, "json" );
  24577. },
  24578. getScript: function( url, callback ) {
  24579. return jQuery.get( url, undefined, callback, "script" );
  24580. }
  24581. } );
  24582. jQuery.each( [ "get", "post" ], function( i, method ) {
  24583. jQuery[ method ] = function( url, data, callback, type ) {
  24584. // Shift arguments if data argument was omitted
  24585. if ( isFunction( data ) ) {
  24586. type = type || callback;
  24587. callback = data;
  24588. data = undefined;
  24589. }
  24590. // The url can be an options object (which then must have .url)
  24591. return jQuery.ajax( jQuery.extend( {
  24592. url: url,
  24593. type: method,
  24594. dataType: type,
  24595. data: data,
  24596. success: callback
  24597. }, jQuery.isPlainObject( url ) && url ) );
  24598. };
  24599. } );
  24600. jQuery._evalUrl = function( url ) {
  24601. return jQuery.ajax( {
  24602. url: url,
  24603. // Make this explicit, since user can override this through ajaxSetup (#11264)
  24604. type: "GET",
  24605. dataType: "script",
  24606. cache: true,
  24607. async: false,
  24608. global: false,
  24609. "throws": true
  24610. } );
  24611. };
  24612. jQuery.fn.extend( {
  24613. wrapAll: function( html ) {
  24614. var wrap;
  24615. if ( this[ 0 ] ) {
  24616. if ( isFunction( html ) ) {
  24617. html = html.call( this[ 0 ] );
  24618. }
  24619. // The elements to wrap the target around
  24620. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  24621. if ( this[ 0 ].parentNode ) {
  24622. wrap.insertBefore( this[ 0 ] );
  24623. }
  24624. wrap.map( function() {
  24625. var elem = this;
  24626. while ( elem.firstElementChild ) {
  24627. elem = elem.firstElementChild;
  24628. }
  24629. return elem;
  24630. } ).append( this );
  24631. }
  24632. return this;
  24633. },
  24634. wrapInner: function( html ) {
  24635. if ( isFunction( html ) ) {
  24636. return this.each( function( i ) {
  24637. jQuery( this ).wrapInner( html.call( this, i ) );
  24638. } );
  24639. }
  24640. return this.each( function() {
  24641. var self = jQuery( this ),
  24642. contents = self.contents();
  24643. if ( contents.length ) {
  24644. contents.wrapAll( html );
  24645. } else {
  24646. self.append( html );
  24647. }
  24648. } );
  24649. },
  24650. wrap: function( html ) {
  24651. var htmlIsFunction = isFunction( html );
  24652. return this.each( function( i ) {
  24653. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  24654. } );
  24655. },
  24656. unwrap: function( selector ) {
  24657. this.parent( selector ).not( "body" ).each( function() {
  24658. jQuery( this ).replaceWith( this.childNodes );
  24659. } );
  24660. return this;
  24661. }
  24662. } );
  24663. jQuery.expr.pseudos.hidden = function( elem ) {
  24664. return !jQuery.expr.pseudos.visible( elem );
  24665. };
  24666. jQuery.expr.pseudos.visible = function( elem ) {
  24667. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  24668. };
  24669. jQuery.ajaxSettings.xhr = function() {
  24670. try {
  24671. return new window.XMLHttpRequest();
  24672. } catch ( e ) {}
  24673. };
  24674. var xhrSuccessStatus = {
  24675. // File protocol always yields status code 0, assume 200
  24676. 0: 200,
  24677. // Support: IE <=9 only
  24678. // #1450: sometimes IE returns 1223 when it should be 204
  24679. 1223: 204
  24680. },
  24681. xhrSupported = jQuery.ajaxSettings.xhr();
  24682. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  24683. support.ajax = xhrSupported = !!xhrSupported;
  24684. jQuery.ajaxTransport( function( options ) {
  24685. var callback, errorCallback;
  24686. // Cross domain only allowed if supported through XMLHttpRequest
  24687. if ( support.cors || xhrSupported && !options.crossDomain ) {
  24688. return {
  24689. send: function( headers, complete ) {
  24690. var i,
  24691. xhr = options.xhr();
  24692. xhr.open(
  24693. options.type,
  24694. options.url,
  24695. options.async,
  24696. options.username,
  24697. options.password
  24698. );
  24699. // Apply custom fields if provided
  24700. if ( options.xhrFields ) {
  24701. for ( i in options.xhrFields ) {
  24702. xhr[ i ] = options.xhrFields[ i ];
  24703. }
  24704. }
  24705. // Override mime type if needed
  24706. if ( options.mimeType && xhr.overrideMimeType ) {
  24707. xhr.overrideMimeType( options.mimeType );
  24708. }
  24709. // X-Requested-With header
  24710. // For cross-domain requests, seeing as conditions for a preflight are
  24711. // akin to a jigsaw puzzle, we simply never set it to be sure.
  24712. // (it can always be set on a per-request basis or even using ajaxSetup)
  24713. // For same-domain requests, won't change header if already provided.
  24714. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  24715. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  24716. }
  24717. // Set headers
  24718. for ( i in headers ) {
  24719. xhr.setRequestHeader( i, headers[ i ] );
  24720. }
  24721. // Callback
  24722. callback = function( type ) {
  24723. return function() {
  24724. if ( callback ) {
  24725. callback = errorCallback = xhr.onload =
  24726. xhr.onerror = xhr.onabort = xhr.ontimeout =
  24727. xhr.onreadystatechange = null;
  24728. if ( type === "abort" ) {
  24729. xhr.abort();
  24730. } else if ( type === "error" ) {
  24731. // Support: IE <=9 only
  24732. // On a manual native abort, IE9 throws
  24733. // errors on any property access that is not readyState
  24734. if ( typeof xhr.status !== "number" ) {
  24735. complete( 0, "error" );
  24736. } else {
  24737. complete(
  24738. // File: protocol always yields status 0; see #8605, #14207
  24739. xhr.status,
  24740. xhr.statusText
  24741. );
  24742. }
  24743. } else {
  24744. complete(
  24745. xhrSuccessStatus[ xhr.status ] || xhr.status,
  24746. xhr.statusText,
  24747. // Support: IE <=9 only
  24748. // IE9 has no XHR2 but throws on binary (trac-11426)
  24749. // For XHR2 non-text, let the caller handle it (gh-2498)
  24750. ( xhr.responseType || "text" ) !== "text" ||
  24751. typeof xhr.responseText !== "string" ?
  24752. { binary: xhr.response } :
  24753. { text: xhr.responseText },
  24754. xhr.getAllResponseHeaders()
  24755. );
  24756. }
  24757. }
  24758. };
  24759. };
  24760. // Listen to events
  24761. xhr.onload = callback();
  24762. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  24763. // Support: IE 9 only
  24764. // Use onreadystatechange to replace onabort
  24765. // to handle uncaught aborts
  24766. if ( xhr.onabort !== undefined ) {
  24767. xhr.onabort = errorCallback;
  24768. } else {
  24769. xhr.onreadystatechange = function() {
  24770. // Check readyState before timeout as it changes
  24771. if ( xhr.readyState === 4 ) {
  24772. // Allow onerror to be called first,
  24773. // but that will not handle a native abort
  24774. // Also, save errorCallback to a variable
  24775. // as xhr.onerror cannot be accessed
  24776. window.setTimeout( function() {
  24777. if ( callback ) {
  24778. errorCallback();
  24779. }
  24780. } );
  24781. }
  24782. };
  24783. }
  24784. // Create the abort callback
  24785. callback = callback( "abort" );
  24786. try {
  24787. // Do send the request (this may raise an exception)
  24788. xhr.send( options.hasContent && options.data || null );
  24789. } catch ( e ) {
  24790. // #14683: Only rethrow if this hasn't been notified as an error yet
  24791. if ( callback ) {
  24792. throw e;
  24793. }
  24794. }
  24795. },
  24796. abort: function() {
  24797. if ( callback ) {
  24798. callback();
  24799. }
  24800. }
  24801. };
  24802. }
  24803. } );
  24804. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  24805. jQuery.ajaxPrefilter( function( s ) {
  24806. if ( s.crossDomain ) {
  24807. s.contents.script = false;
  24808. }
  24809. } );
  24810. // Install script dataType
  24811. jQuery.ajaxSetup( {
  24812. accepts: {
  24813. script: "text/javascript, application/javascript, " +
  24814. "application/ecmascript, application/x-ecmascript"
  24815. },
  24816. contents: {
  24817. script: /\b(?:java|ecma)script\b/
  24818. },
  24819. converters: {
  24820. "text script": function( text ) {
  24821. jQuery.globalEval( text );
  24822. return text;
  24823. }
  24824. }
  24825. } );
  24826. // Handle cache's special case and crossDomain
  24827. jQuery.ajaxPrefilter( "script", function( s ) {
  24828. if ( s.cache === undefined ) {
  24829. s.cache = false;
  24830. }
  24831. if ( s.crossDomain ) {
  24832. s.type = "GET";
  24833. }
  24834. } );
  24835. // Bind script tag hack transport
  24836. jQuery.ajaxTransport( "script", function( s ) {
  24837. // This transport only deals with cross domain requests
  24838. if ( s.crossDomain ) {
  24839. var script, callback;
  24840. return {
  24841. send: function( _, complete ) {
  24842. script = jQuery( "<script>" ).prop( {
  24843. charset: s.scriptCharset,
  24844. src: s.url
  24845. } ).on(
  24846. "load error",
  24847. callback = function( evt ) {
  24848. script.remove();
  24849. callback = null;
  24850. if ( evt ) {
  24851. complete( evt.type === "error" ? 404 : 200, evt.type );
  24852. }
  24853. }
  24854. );
  24855. // Use native DOM manipulation to avoid our domManip AJAX trickery
  24856. document.head.appendChild( script[ 0 ] );
  24857. },
  24858. abort: function() {
  24859. if ( callback ) {
  24860. callback();
  24861. }
  24862. }
  24863. };
  24864. }
  24865. } );
  24866. var oldCallbacks = [],
  24867. rjsonp = /(=)\?(?=&|$)|\?\?/;
  24868. // Default jsonp settings
  24869. jQuery.ajaxSetup( {
  24870. jsonp: "callback",
  24871. jsonpCallback: function() {
  24872. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  24873. this[ callback ] = true;
  24874. return callback;
  24875. }
  24876. } );
  24877. // Detect, normalize options and install callbacks for jsonp requests
  24878. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  24879. var callbackName, overwritten, responseContainer,
  24880. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  24881. "url" :
  24882. typeof s.data === "string" &&
  24883. ( s.contentType || "" )
  24884. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  24885. rjsonp.test( s.data ) && "data"
  24886. );
  24887. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  24888. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  24889. // Get callback name, remembering preexisting value associated with it
  24890. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  24891. s.jsonpCallback() :
  24892. s.jsonpCallback;
  24893. // Insert callback into url or form data
  24894. if ( jsonProp ) {
  24895. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  24896. } else if ( s.jsonp !== false ) {
  24897. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  24898. }
  24899. // Use data converter to retrieve json after script execution
  24900. s.converters[ "script json" ] = function() {
  24901. if ( !responseContainer ) {
  24902. jQuery.error( callbackName + " was not called" );
  24903. }
  24904. return responseContainer[ 0 ];
  24905. };
  24906. // Force json dataType
  24907. s.dataTypes[ 0 ] = "json";
  24908. // Install callback
  24909. overwritten = window[ callbackName ];
  24910. window[ callbackName ] = function() {
  24911. responseContainer = arguments;
  24912. };
  24913. // Clean-up function (fires after converters)
  24914. jqXHR.always( function() {
  24915. // If previous value didn't exist - remove it
  24916. if ( overwritten === undefined ) {
  24917. jQuery( window ).removeProp( callbackName );
  24918. // Otherwise restore preexisting value
  24919. } else {
  24920. window[ callbackName ] = overwritten;
  24921. }
  24922. // Save back as free
  24923. if ( s[ callbackName ] ) {
  24924. // Make sure that re-using the options doesn't screw things around
  24925. s.jsonpCallback = originalSettings.jsonpCallback;
  24926. // Save the callback name for future use
  24927. oldCallbacks.push( callbackName );
  24928. }
  24929. // Call if it was a function and we have a response
  24930. if ( responseContainer && isFunction( overwritten ) ) {
  24931. overwritten( responseContainer[ 0 ] );
  24932. }
  24933. responseContainer = overwritten = undefined;
  24934. } );
  24935. // Delegate to script
  24936. return "script";
  24937. }
  24938. } );
  24939. // Support: Safari 8 only
  24940. // In Safari 8 documents created via document.implementation.createHTMLDocument
  24941. // collapse sibling forms: the second one becomes a child of the first one.
  24942. // Because of that, this security measure has to be disabled in Safari 8.
  24943. // https://bugs.webkit.org/show_bug.cgi?id=137337
  24944. support.createHTMLDocument = ( function() {
  24945. var body = document.implementation.createHTMLDocument( "" ).body;
  24946. body.innerHTML = "<form></form><form></form>";
  24947. return body.childNodes.length === 2;
  24948. } )();
  24949. // Argument "data" should be string of html
  24950. // context (optional): If specified, the fragment will be created in this context,
  24951. // defaults to document
  24952. // keepScripts (optional): If true, will include scripts passed in the html string
  24953. jQuery.parseHTML = function( data, context, keepScripts ) {
  24954. if ( typeof data !== "string" ) {
  24955. return [];
  24956. }
  24957. if ( typeof context === "boolean" ) {
  24958. keepScripts = context;
  24959. context = false;
  24960. }
  24961. var base, parsed, scripts;
  24962. if ( !context ) {
  24963. // Stop scripts or inline event handlers from being executed immediately
  24964. // by using document.implementation
  24965. if ( support.createHTMLDocument ) {
  24966. context = document.implementation.createHTMLDocument( "" );
  24967. // Set the base href for the created document
  24968. // so any parsed elements with URLs
  24969. // are based on the document's URL (gh-2965)
  24970. base = context.createElement( "base" );
  24971. base.href = document.location.href;
  24972. context.head.appendChild( base );
  24973. } else {
  24974. context = document;
  24975. }
  24976. }
  24977. parsed = rsingleTag.exec( data );
  24978. scripts = !keepScripts && [];
  24979. // Single tag
  24980. if ( parsed ) {
  24981. return [ context.createElement( parsed[ 1 ] ) ];
  24982. }
  24983. parsed = buildFragment( [ data ], context, scripts );
  24984. if ( scripts && scripts.length ) {
  24985. jQuery( scripts ).remove();
  24986. }
  24987. return jQuery.merge( [], parsed.childNodes );
  24988. };
  24989. /**
  24990. * Load a url into a page
  24991. */
  24992. jQuery.fn.load = function( url, params, callback ) {
  24993. var selector, type, response,
  24994. self = this,
  24995. off = url.indexOf( " " );
  24996. if ( off > -1 ) {
  24997. selector = stripAndCollapse( url.slice( off ) );
  24998. url = url.slice( 0, off );
  24999. }
  25000. // If it's a function
  25001. if ( isFunction( params ) ) {
  25002. // We assume that it's the callback
  25003. callback = params;
  25004. params = undefined;
  25005. // Otherwise, build a param string
  25006. } else if ( params && typeof params === "object" ) {
  25007. type = "POST";
  25008. }
  25009. // If we have elements to modify, make the request
  25010. if ( self.length > 0 ) {
  25011. jQuery.ajax( {
  25012. url: url,
  25013. // If "type" variable is undefined, then "GET" method will be used.
  25014. // Make value of this field explicit since
  25015. // user can override it through ajaxSetup method
  25016. type: type || "GET",
  25017. dataType: "html",
  25018. data: params
  25019. } ).done( function( responseText ) {
  25020. // Save response for use in complete callback
  25021. response = arguments;
  25022. self.html( selector ?
  25023. // If a selector was specified, locate the right elements in a dummy div
  25024. // Exclude scripts to avoid IE 'Permission Denied' errors
  25025. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  25026. // Otherwise use the full result
  25027. responseText );
  25028. // If the request succeeds, this function gets "data", "status", "jqXHR"
  25029. // but they are ignored because response was set above.
  25030. // If it fails, this function gets "jqXHR", "status", "error"
  25031. } ).always( callback && function( jqXHR, status ) {
  25032. self.each( function() {
  25033. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  25034. } );
  25035. } );
  25036. }
  25037. return this;
  25038. };
  25039. // Attach a bunch of functions for handling common AJAX events
  25040. jQuery.each( [
  25041. "ajaxStart",
  25042. "ajaxStop",
  25043. "ajaxComplete",
  25044. "ajaxError",
  25045. "ajaxSuccess",
  25046. "ajaxSend"
  25047. ], function( i, type ) {
  25048. jQuery.fn[ type ] = function( fn ) {
  25049. return this.on( type, fn );
  25050. };
  25051. } );
  25052. jQuery.expr.pseudos.animated = function( elem ) {
  25053. return jQuery.grep( jQuery.timers, function( fn ) {
  25054. return elem === fn.elem;
  25055. } ).length;
  25056. };
  25057. jQuery.offset = {
  25058. setOffset: function( elem, options, i ) {
  25059. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  25060. position = jQuery.css( elem, "position" ),
  25061. curElem = jQuery( elem ),
  25062. props = {};
  25063. // Set position first, in-case top/left are set even on static elem
  25064. if ( position === "static" ) {
  25065. elem.style.position = "relative";
  25066. }
  25067. curOffset = curElem.offset();
  25068. curCSSTop = jQuery.css( elem, "top" );
  25069. curCSSLeft = jQuery.css( elem, "left" );
  25070. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  25071. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  25072. // Need to be able to calculate position if either
  25073. // top or left is auto and position is either absolute or fixed
  25074. if ( calculatePosition ) {
  25075. curPosition = curElem.position();
  25076. curTop = curPosition.top;
  25077. curLeft = curPosition.left;
  25078. } else {
  25079. curTop = parseFloat( curCSSTop ) || 0;
  25080. curLeft = parseFloat( curCSSLeft ) || 0;
  25081. }
  25082. if ( isFunction( options ) ) {
  25083. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  25084. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  25085. }
  25086. if ( options.top != null ) {
  25087. props.top = ( options.top - curOffset.top ) + curTop;
  25088. }
  25089. if ( options.left != null ) {
  25090. props.left = ( options.left - curOffset.left ) + curLeft;
  25091. }
  25092. if ( "using" in options ) {
  25093. options.using.call( elem, props );
  25094. } else {
  25095. curElem.css( props );
  25096. }
  25097. }
  25098. };
  25099. jQuery.fn.extend( {
  25100. // offset() relates an element's border box to the document origin
  25101. offset: function( options ) {
  25102. // Preserve chaining for setter
  25103. if ( arguments.length ) {
  25104. return options === undefined ?
  25105. this :
  25106. this.each( function( i ) {
  25107. jQuery.offset.setOffset( this, options, i );
  25108. } );
  25109. }
  25110. var rect, win,
  25111. elem = this[ 0 ];
  25112. if ( !elem ) {
  25113. return;
  25114. }
  25115. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  25116. // Support: IE <=11 only
  25117. // Running getBoundingClientRect on a
  25118. // disconnected node in IE throws an error
  25119. if ( !elem.getClientRects().length ) {
  25120. return { top: 0, left: 0 };
  25121. }
  25122. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  25123. rect = elem.getBoundingClientRect();
  25124. win = elem.ownerDocument.defaultView;
  25125. return {
  25126. top: rect.top + win.pageYOffset,
  25127. left: rect.left + win.pageXOffset
  25128. };
  25129. },
  25130. // position() relates an element's margin box to its offset parent's padding box
  25131. // This corresponds to the behavior of CSS absolute positioning
  25132. position: function() {
  25133. if ( !this[ 0 ] ) {
  25134. return;
  25135. }
  25136. var offsetParent, offset, doc,
  25137. elem = this[ 0 ],
  25138. parentOffset = { top: 0, left: 0 };
  25139. // position:fixed elements are offset from the viewport, which itself always has zero offset
  25140. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  25141. // Assume position:fixed implies availability of getBoundingClientRect
  25142. offset = elem.getBoundingClientRect();
  25143. } else {
  25144. offset = this.offset();
  25145. // Account for the *real* offset parent, which can be the document or its root element
  25146. // when a statically positioned element is identified
  25147. doc = elem.ownerDocument;
  25148. offsetParent = elem.offsetParent || doc.documentElement;
  25149. while ( offsetParent &&
  25150. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  25151. jQuery.css( offsetParent, "position" ) === "static" ) {
  25152. offsetParent = offsetParent.parentNode;
  25153. }
  25154. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  25155. // Incorporate borders into its offset, since they are outside its content origin
  25156. parentOffset = jQuery( offsetParent ).offset();
  25157. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  25158. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  25159. }
  25160. }
  25161. // Subtract parent offsets and element margins
  25162. return {
  25163. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  25164. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  25165. };
  25166. },
  25167. // This method will return documentElement in the following cases:
  25168. // 1) For the element inside the iframe without offsetParent, this method will return
  25169. // documentElement of the parent window
  25170. // 2) For the hidden or detached element
  25171. // 3) For body or html element, i.e. in case of the html node - it will return itself
  25172. //
  25173. // but those exceptions were never presented as a real life use-cases
  25174. // and might be considered as more preferable results.
  25175. //
  25176. // This logic, however, is not guaranteed and can change at any point in the future
  25177. offsetParent: function() {
  25178. return this.map( function() {
  25179. var offsetParent = this.offsetParent;
  25180. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  25181. offsetParent = offsetParent.offsetParent;
  25182. }
  25183. return offsetParent || documentElement;
  25184. } );
  25185. }
  25186. } );
  25187. // Create scrollLeft and scrollTop methods
  25188. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  25189. var top = "pageYOffset" === prop;
  25190. jQuery.fn[ method ] = function( val ) {
  25191. return access( this, function( elem, method, val ) {
  25192. // Coalesce documents and windows
  25193. var win;
  25194. if ( isWindow( elem ) ) {
  25195. win = elem;
  25196. } else if ( elem.nodeType === 9 ) {
  25197. win = elem.defaultView;
  25198. }
  25199. if ( val === undefined ) {
  25200. return win ? win[ prop ] : elem[ method ];
  25201. }
  25202. if ( win ) {
  25203. win.scrollTo(
  25204. !top ? val : win.pageXOffset,
  25205. top ? val : win.pageYOffset
  25206. );
  25207. } else {
  25208. elem[ method ] = val;
  25209. }
  25210. }, method, val, arguments.length );
  25211. };
  25212. } );
  25213. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  25214. // Add the top/left cssHooks using jQuery.fn.position
  25215. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  25216. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  25217. // getComputedStyle returns percent when specified for top/left/bottom/right;
  25218. // rather than make the css module depend on the offset module, just check for it here
  25219. jQuery.each( [ "top", "left" ], function( i, prop ) {
  25220. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  25221. function( elem, computed ) {
  25222. if ( computed ) {
  25223. computed = curCSS( elem, prop );
  25224. // If curCSS returns percentage, fallback to offset
  25225. return rnumnonpx.test( computed ) ?
  25226. jQuery( elem ).position()[ prop ] + "px" :
  25227. computed;
  25228. }
  25229. }
  25230. );
  25231. } );
  25232. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  25233. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  25234. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  25235. function( defaultExtra, funcName ) {
  25236. // Margin is only for outerHeight, outerWidth
  25237. jQuery.fn[ funcName ] = function( margin, value ) {
  25238. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  25239. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  25240. return access( this, function( elem, type, value ) {
  25241. var doc;
  25242. if ( isWindow( elem ) ) {
  25243. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  25244. return funcName.indexOf( "outer" ) === 0 ?
  25245. elem[ "inner" + name ] :
  25246. elem.document.documentElement[ "client" + name ];
  25247. }
  25248. // Get document width or height
  25249. if ( elem.nodeType === 9 ) {
  25250. doc = elem.documentElement;
  25251. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  25252. // whichever is greatest
  25253. return Math.max(
  25254. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  25255. elem.body[ "offset" + name ], doc[ "offset" + name ],
  25256. doc[ "client" + name ]
  25257. );
  25258. }
  25259. return value === undefined ?
  25260. // Get width or height on the element, requesting but not forcing parseFloat
  25261. jQuery.css( elem, type, extra ) :
  25262. // Set width or height on the element
  25263. jQuery.style( elem, type, value, extra );
  25264. }, type, chainable ? margin : undefined, chainable );
  25265. };
  25266. } );
  25267. } );
  25268. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  25269. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  25270. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  25271. function( i, name ) {
  25272. // Handle event binding
  25273. jQuery.fn[ name ] = function( data, fn ) {
  25274. return arguments.length > 0 ?
  25275. this.on( name, null, data, fn ) :
  25276. this.trigger( name );
  25277. };
  25278. } );
  25279. jQuery.fn.extend( {
  25280. hover: function( fnOver, fnOut ) {
  25281. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  25282. }
  25283. } );
  25284. jQuery.fn.extend( {
  25285. bind: function( types, data, fn ) {
  25286. return this.on( types, null, data, fn );
  25287. },
  25288. unbind: function( types, fn ) {
  25289. return this.off( types, null, fn );
  25290. },
  25291. delegate: function( selector, types, data, fn ) {
  25292. return this.on( types, selector, data, fn );
  25293. },
  25294. undelegate: function( selector, types, fn ) {
  25295. // ( namespace ) or ( selector, types [, fn] )
  25296. return arguments.length === 1 ?
  25297. this.off( selector, "**" ) :
  25298. this.off( types, selector || "**", fn );
  25299. }
  25300. } );
  25301. // Bind a function to a context, optionally partially applying any
  25302. // arguments.
  25303. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  25304. // However, it is not slated for removal any time soon
  25305. jQuery.proxy = function( fn, context ) {
  25306. var tmp, args, proxy;
  25307. if ( typeof context === "string" ) {
  25308. tmp = fn[ context ];
  25309. context = fn;
  25310. fn = tmp;
  25311. }
  25312. // Quick check to determine if target is callable, in the spec
  25313. // this throws a TypeError, but we will just return undefined.
  25314. if ( !isFunction( fn ) ) {
  25315. return undefined;
  25316. }
  25317. // Simulated bind
  25318. args = slice.call( arguments, 2 );
  25319. proxy = function() {
  25320. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  25321. };
  25322. // Set the guid of unique handler to the same of original handler, so it can be removed
  25323. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  25324. return proxy;
  25325. };
  25326. jQuery.holdReady = function( hold ) {
  25327. if ( hold ) {
  25328. jQuery.readyWait++;
  25329. } else {
  25330. jQuery.ready( true );
  25331. }
  25332. };
  25333. jQuery.isArray = Array.isArray;
  25334. jQuery.parseJSON = JSON.parse;
  25335. jQuery.nodeName = nodeName;
  25336. jQuery.isFunction = isFunction;
  25337. jQuery.isWindow = isWindow;
  25338. jQuery.camelCase = camelCase;
  25339. jQuery.type = toType;
  25340. jQuery.now = Date.now;
  25341. jQuery.isNumeric = function( obj ) {
  25342. // As of jQuery 3.0, isNumeric is limited to
  25343. // strings and numbers (primitives or objects)
  25344. // that can be coerced to finite numbers (gh-2662)
  25345. var type = jQuery.type( obj );
  25346. return ( type === "number" || type === "string" ) &&
  25347. // parseFloat NaNs numeric-cast false positives ("")
  25348. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  25349. // subtraction forces infinities to NaN
  25350. !isNaN( obj - parseFloat( obj ) );
  25351. };
  25352. // Register as a named AMD module, since jQuery can be concatenated with other
  25353. // files that may use define, but not via a proper concatenation script that
  25354. // understands anonymous AMD modules. A named AMD is safest and most robust
  25355. // way to register. Lowercase jquery is used because AMD module names are
  25356. // derived from file names, and jQuery is normally delivered in a lowercase
  25357. // file name. Do this after creating the global so that if an AMD module wants
  25358. // to call noConflict to hide this version of jQuery, it will work.
  25359. // Note that for maximum portability, libraries that are not jQuery should
  25360. // declare themselves as anonymous modules, and avoid setting a global if an
  25361. // AMD loader is present. jQuery is a special case. For more information, see
  25362. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  25363. if ( true ) {
  25364. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  25365. return jQuery;
  25366. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  25367. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  25368. }
  25369. var
  25370. // Map over jQuery in case of overwrite
  25371. _jQuery = window.jQuery,
  25372. // Map over the $ in case of overwrite
  25373. _$ = window.$;
  25374. jQuery.noConflict = function( deep ) {
  25375. if ( window.$ === jQuery ) {
  25376. window.$ = _$;
  25377. }
  25378. if ( deep && window.jQuery === jQuery ) {
  25379. window.jQuery = _jQuery;
  25380. }
  25381. return jQuery;
  25382. };
  25383. // Expose jQuery and $ identifiers, even in AMD
  25384. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  25385. // and CommonJS for browser emulators (#13566)
  25386. if ( !noGlobal ) {
  25387. window.jQuery = window.$ = jQuery;
  25388. }
  25389. return jQuery;
  25390. } );
  25391. /***/ }),
  25392. /* 15 */
  25393. /***/ (function(module, exports) {
  25394. /*!
  25395. * Bootstrap v3.3.7 (http://getbootstrap.com)
  25396. * Copyright 2011-2016 Twitter, Inc.
  25397. * Licensed under the MIT license
  25398. */
  25399. if (typeof jQuery === 'undefined') {
  25400. throw new Error('Bootstrap\'s JavaScript requires jQuery')
  25401. }
  25402. +function ($) {
  25403. 'use strict';
  25404. var version = $.fn.jquery.split(' ')[0].split('.')
  25405. if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] > 3)) {
  25406. throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4')
  25407. }
  25408. }(jQuery);
  25409. /* ========================================================================
  25410. * Bootstrap: transition.js v3.3.7
  25411. * http://getbootstrap.com/javascript/#transitions
  25412. * ========================================================================
  25413. * Copyright 2011-2016 Twitter, Inc.
  25414. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  25415. * ======================================================================== */
  25416. +function ($) {
  25417. 'use strict';
  25418. // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
  25419. // ============================================================
  25420. function transitionEnd() {
  25421. var el = document.createElement('bootstrap')
  25422. var transEndEventNames = {
  25423. WebkitTransition : 'webkitTransitionEnd',
  25424. MozTransition : 'transitionend',
  25425. OTransition : 'oTransitionEnd otransitionend',
  25426. transition : 'transitionend'
  25427. }
  25428. for (var name in transEndEventNames) {
  25429. if (el.style[name] !== undefined) {
  25430. return { end: transEndEventNames[name] }
  25431. }
  25432. }
  25433. return false // explicit for ie8 ( ._.)
  25434. }
  25435. // http://blog.alexmaccaw.com/css-transitions
  25436. $.fn.emulateTransitionEnd = function (duration) {
  25437. var called = false
  25438. var $el = this
  25439. $(this).one('bsTransitionEnd', function () { called = true })
  25440. var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
  25441. setTimeout(callback, duration)
  25442. return this
  25443. }
  25444. $(function () {
  25445. $.support.transition = transitionEnd()
  25446. if (!$.support.transition) return
  25447. $.event.special.bsTransitionEnd = {
  25448. bindType: $.support.transition.end,
  25449. delegateType: $.support.transition.end,
  25450. handle: function (e) {
  25451. if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
  25452. }
  25453. }
  25454. })
  25455. }(jQuery);
  25456. /* ========================================================================
  25457. * Bootstrap: alert.js v3.3.7
  25458. * http://getbootstrap.com/javascript/#alerts
  25459. * ========================================================================
  25460. * Copyright 2011-2016 Twitter, Inc.
  25461. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  25462. * ======================================================================== */
  25463. +function ($) {
  25464. 'use strict';
  25465. // ALERT CLASS DEFINITION
  25466. // ======================
  25467. var dismiss = '[data-dismiss="alert"]'
  25468. var Alert = function (el) {
  25469. $(el).on('click', dismiss, this.close)
  25470. }
  25471. Alert.VERSION = '3.3.7'
  25472. Alert.TRANSITION_DURATION = 150
  25473. Alert.prototype.close = function (e) {
  25474. var $this = $(this)
  25475. var selector = $this.attr('data-target')
  25476. if (!selector) {
  25477. selector = $this.attr('href')
  25478. selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
  25479. }
  25480. var $parent = $(selector === '#' ? [] : selector)
  25481. if (e) e.preventDefault()
  25482. if (!$parent.length) {
  25483. $parent = $this.closest('.alert')
  25484. }
  25485. $parent.trigger(e = $.Event('close.bs.alert'))
  25486. if (e.isDefaultPrevented()) return
  25487. $parent.removeClass('in')
  25488. function removeElement() {
  25489. // detach from parent, fire event then clean up data
  25490. $parent.detach().trigger('closed.bs.alert').remove()
  25491. }
  25492. $.support.transition && $parent.hasClass('fade') ?
  25493. $parent
  25494. .one('bsTransitionEnd', removeElement)
  25495. .emulateTransitionEnd(Alert.TRANSITION_DURATION) :
  25496. removeElement()
  25497. }
  25498. // ALERT PLUGIN DEFINITION
  25499. // =======================
  25500. function Plugin(option) {
  25501. return this.each(function () {
  25502. var $this = $(this)
  25503. var data = $this.data('bs.alert')
  25504. if (!data) $this.data('bs.alert', (data = new Alert(this)))
  25505. if (typeof option == 'string') data[option].call($this)
  25506. })
  25507. }
  25508. var old = $.fn.alert
  25509. $.fn.alert = Plugin
  25510. $.fn.alert.Constructor = Alert
  25511. // ALERT NO CONFLICT
  25512. // =================
  25513. $.fn.alert.noConflict = function () {
  25514. $.fn.alert = old
  25515. return this
  25516. }
  25517. // ALERT DATA-API
  25518. // ==============
  25519. $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
  25520. }(jQuery);
  25521. /* ========================================================================
  25522. * Bootstrap: button.js v3.3.7
  25523. * http://getbootstrap.com/javascript/#buttons
  25524. * ========================================================================
  25525. * Copyright 2011-2016 Twitter, Inc.
  25526. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  25527. * ======================================================================== */
  25528. +function ($) {
  25529. 'use strict';
  25530. // BUTTON PUBLIC CLASS DEFINITION
  25531. // ==============================
  25532. var Button = function (element, options) {
  25533. this.$element = $(element)
  25534. this.options = $.extend({}, Button.DEFAULTS, options)
  25535. this.isLoading = false
  25536. }
  25537. Button.VERSION = '3.3.7'
  25538. Button.DEFAULTS = {
  25539. loadingText: 'loading...'
  25540. }
  25541. Button.prototype.setState = function (state) {
  25542. var d = 'disabled'
  25543. var $el = this.$element
  25544. var val = $el.is('input') ? 'val' : 'html'
  25545. var data = $el.data()
  25546. state += 'Text'
  25547. if (data.resetText == null) $el.data('resetText', $el[val]())
  25548. // push to event loop to allow forms to submit
  25549. setTimeout($.proxy(function () {
  25550. $el[val](data[state] == null ? this.options[state] : data[state])
  25551. if (state == 'loadingText') {
  25552. this.isLoading = true
  25553. $el.addClass(d).attr(d, d).prop(d, true)
  25554. } else if (this.isLoading) {
  25555. this.isLoading = false
  25556. $el.removeClass(d).removeAttr(d).prop(d, false)
  25557. }
  25558. }, this), 0)
  25559. }
  25560. Button.prototype.toggle = function () {
  25561. var changed = true
  25562. var $parent = this.$element.closest('[data-toggle="buttons"]')
  25563. if ($parent.length) {
  25564. var $input = this.$element.find('input')
  25565. if ($input.prop('type') == 'radio') {
  25566. if ($input.prop('checked')) changed = false
  25567. $parent.find('.active').removeClass('active')
  25568. this.$element.addClass('active')
  25569. } else if ($input.prop('type') == 'checkbox') {
  25570. if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false
  25571. this.$element.toggleClass('active')
  25572. }
  25573. $input.prop('checked', this.$element.hasClass('active'))
  25574. if (changed) $input.trigger('change')
  25575. } else {
  25576. this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
  25577. this.$element.toggleClass('active')
  25578. }
  25579. }
  25580. // BUTTON PLUGIN DEFINITION
  25581. // ========================
  25582. function Plugin(option) {
  25583. return this.each(function () {
  25584. var $this = $(this)
  25585. var data = $this.data('bs.button')
  25586. var options = typeof option == 'object' && option
  25587. if (!data) $this.data('bs.button', (data = new Button(this, options)))
  25588. if (option == 'toggle') data.toggle()
  25589. else if (option) data.setState(option)
  25590. })
  25591. }
  25592. var old = $.fn.button
  25593. $.fn.button = Plugin
  25594. $.fn.button.Constructor = Button
  25595. // BUTTON NO CONFLICT
  25596. // ==================
  25597. $.fn.button.noConflict = function () {
  25598. $.fn.button = old
  25599. return this
  25600. }
  25601. // BUTTON DATA-API
  25602. // ===============
  25603. $(document)
  25604. .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
  25605. var $btn = $(e.target).closest('.btn')
  25606. Plugin.call($btn, 'toggle')
  25607. if (!($(e.target).is('input[type="radio"], input[type="checkbox"]'))) {
  25608. // Prevent double click on radios, and the double selections (so cancellation) on checkboxes
  25609. e.preventDefault()
  25610. // The target component still receive the focus
  25611. if ($btn.is('input,button')) $btn.trigger('focus')
  25612. else $btn.find('input:visible,button:visible').first().trigger('focus')
  25613. }
  25614. })
  25615. .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
  25616. $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
  25617. })
  25618. }(jQuery);
  25619. /* ========================================================================
  25620. * Bootstrap: carousel.js v3.3.7
  25621. * http://getbootstrap.com/javascript/#carousel
  25622. * ========================================================================
  25623. * Copyright 2011-2016 Twitter, Inc.
  25624. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  25625. * ======================================================================== */
  25626. +function ($) {
  25627. 'use strict';
  25628. // CAROUSEL CLASS DEFINITION
  25629. // =========================
  25630. var Carousel = function (element, options) {
  25631. this.$element = $(element)
  25632. this.$indicators = this.$element.find('.carousel-indicators')
  25633. this.options = options
  25634. this.paused = null
  25635. this.sliding = null
  25636. this.interval = null
  25637. this.$active = null
  25638. this.$items = null
  25639. this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this))
  25640. this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element
  25641. .on('mouseenter.bs.carousel', $.proxy(this.pause, this))
  25642. .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
  25643. }
  25644. Carousel.VERSION = '3.3.7'
  25645. Carousel.TRANSITION_DURATION = 600
  25646. Carousel.DEFAULTS = {
  25647. interval: 5000,
  25648. pause: 'hover',
  25649. wrap: true,
  25650. keyboard: true
  25651. }
  25652. Carousel.prototype.keydown = function (e) {
  25653. if (/input|textarea/i.test(e.target.tagName)) return
  25654. switch (e.which) {
  25655. case 37: this.prev(); break
  25656. case 39: this.next(); break
  25657. default: return
  25658. }
  25659. e.preventDefault()
  25660. }
  25661. Carousel.prototype.cycle = function (e) {
  25662. e || (this.paused = false)
  25663. this.interval && clearInterval(this.interval)
  25664. this.options.interval
  25665. && !this.paused
  25666. && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
  25667. return this
  25668. }
  25669. Carousel.prototype.getItemIndex = function (item) {
  25670. this.$items = item.parent().children('.item')
  25671. return this.$items.index(item || this.$active)
  25672. }
  25673. Carousel.prototype.getItemForDirection = function (direction, active) {
  25674. var activeIndex = this.getItemIndex(active)
  25675. var willWrap = (direction == 'prev' && activeIndex === 0)
  25676. || (direction == 'next' && activeIndex == (this.$items.length - 1))
  25677. if (willWrap && !this.options.wrap) return active
  25678. var delta = direction == 'prev' ? -1 : 1
  25679. var itemIndex = (activeIndex + delta) % this.$items.length
  25680. return this.$items.eq(itemIndex)
  25681. }
  25682. Carousel.prototype.to = function (pos) {
  25683. var that = this
  25684. var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
  25685. if (pos > (this.$items.length - 1) || pos < 0) return
  25686. if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
  25687. if (activeIndex == pos) return this.pause().cycle()
  25688. return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos))
  25689. }
  25690. Carousel.prototype.pause = function (e) {
  25691. e || (this.paused = true)
  25692. if (this.$element.find('.next, .prev').length && $.support.transition) {
  25693. this.$element.trigger($.support.transition.end)
  25694. this.cycle(true)
  25695. }
  25696. this.interval = clearInterval(this.interval)
  25697. return this
  25698. }
  25699. Carousel.prototype.next = function () {
  25700. if (this.sliding) return
  25701. return this.slide('next')
  25702. }
  25703. Carousel.prototype.prev = function () {
  25704. if (this.sliding) return
  25705. return this.slide('prev')
  25706. }
  25707. Carousel.prototype.slide = function (type, next) {
  25708. var $active = this.$element.find('.item.active')
  25709. var $next = next || this.getItemForDirection(type, $active)
  25710. var isCycling = this.interval
  25711. var direction = type == 'next' ? 'left' : 'right'
  25712. var that = this
  25713. if ($next.hasClass('active')) return (this.sliding = false)
  25714. var relatedTarget = $next[0]
  25715. var slideEvent = $.Event('slide.bs.carousel', {
  25716. relatedTarget: relatedTarget,
  25717. direction: direction
  25718. })
  25719. this.$element.trigger(slideEvent)
  25720. if (slideEvent.isDefaultPrevented()) return
  25721. this.sliding = true
  25722. isCycling && this.pause()
  25723. if (this.$indicators.length) {
  25724. this.$indicators.find('.active').removeClass('active')
  25725. var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
  25726. $nextIndicator && $nextIndicator.addClass('active')
  25727. }
  25728. var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
  25729. if ($.support.transition && this.$element.hasClass('slide')) {
  25730. $next.addClass(type)
  25731. $next[0].offsetWidth // force reflow
  25732. $active.addClass(direction)
  25733. $next.addClass(direction)
  25734. $active
  25735. .one('bsTransitionEnd', function () {
  25736. $next.removeClass([type, direction].join(' ')).addClass('active')
  25737. $active.removeClass(['active', direction].join(' '))
  25738. that.sliding = false
  25739. setTimeout(function () {
  25740. that.$element.trigger(slidEvent)
  25741. }, 0)
  25742. })
  25743. .emulateTransitionEnd(Carousel.TRANSITION_DURATION)
  25744. } else {
  25745. $active.removeClass('active')
  25746. $next.addClass('active')
  25747. this.sliding = false
  25748. this.$element.trigger(slidEvent)
  25749. }
  25750. isCycling && this.cycle()
  25751. return this
  25752. }
  25753. // CAROUSEL PLUGIN DEFINITION
  25754. // ==========================
  25755. function Plugin(option) {
  25756. return this.each(function () {
  25757. var $this = $(this)
  25758. var data = $this.data('bs.carousel')
  25759. var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
  25760. var action = typeof option == 'string' ? option : options.slide
  25761. if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
  25762. if (typeof option == 'number') data.to(option)
  25763. else if (action) data[action]()
  25764. else if (options.interval) data.pause().cycle()
  25765. })
  25766. }
  25767. var old = $.fn.carousel
  25768. $.fn.carousel = Plugin
  25769. $.fn.carousel.Constructor = Carousel
  25770. // CAROUSEL NO CONFLICT
  25771. // ====================
  25772. $.fn.carousel.noConflict = function () {
  25773. $.fn.carousel = old
  25774. return this
  25775. }
  25776. // CAROUSEL DATA-API
  25777. // =================
  25778. var clickHandler = function (e) {
  25779. var href
  25780. var $this = $(this)
  25781. var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
  25782. if (!$target.hasClass('carousel')) return
  25783. var options = $.extend({}, $target.data(), $this.data())
  25784. var slideIndex = $this.attr('data-slide-to')
  25785. if (slideIndex) options.interval = false
  25786. Plugin.call($target, options)
  25787. if (slideIndex) {
  25788. $target.data('bs.carousel').to(slideIndex)
  25789. }
  25790. e.preventDefault()
  25791. }
  25792. $(document)
  25793. .on('click.bs.carousel.data-api', '[data-slide]', clickHandler)
  25794. .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler)
  25795. $(window).on('load', function () {
  25796. $('[data-ride="carousel"]').each(function () {
  25797. var $carousel = $(this)
  25798. Plugin.call($carousel, $carousel.data())
  25799. })
  25800. })
  25801. }(jQuery);
  25802. /* ========================================================================
  25803. * Bootstrap: collapse.js v3.3.7
  25804. * http://getbootstrap.com/javascript/#collapse
  25805. * ========================================================================
  25806. * Copyright 2011-2016 Twitter, Inc.
  25807. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  25808. * ======================================================================== */
  25809. /* jshint latedef: false */
  25810. +function ($) {
  25811. 'use strict';
  25812. // COLLAPSE PUBLIC CLASS DEFINITION
  25813. // ================================
  25814. var Collapse = function (element, options) {
  25815. this.$element = $(element)
  25816. this.options = $.extend({}, Collapse.DEFAULTS, options)
  25817. this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' +
  25818. '[data-toggle="collapse"][data-target="#' + element.id + '"]')
  25819. this.transitioning = null
  25820. if (this.options.parent) {
  25821. this.$parent = this.getParent()
  25822. } else {
  25823. this.addAriaAndCollapsedClass(this.$element, this.$trigger)
  25824. }
  25825. if (this.options.toggle) this.toggle()
  25826. }
  25827. Collapse.VERSION = '3.3.7'
  25828. Collapse.TRANSITION_DURATION = 350
  25829. Collapse.DEFAULTS = {
  25830. toggle: true
  25831. }
  25832. Collapse.prototype.dimension = function () {
  25833. var hasWidth = this.$element.hasClass('width')
  25834. return hasWidth ? 'width' : 'height'
  25835. }
  25836. Collapse.prototype.show = function () {
  25837. if (this.transitioning || this.$element.hasClass('in')) return
  25838. var activesData
  25839. var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing')
  25840. if (actives && actives.length) {
  25841. activesData = actives.data('bs.collapse')
  25842. if (activesData && activesData.transitioning) return
  25843. }
  25844. var startEvent = $.Event('show.bs.collapse')
  25845. this.$element.trigger(startEvent)
  25846. if (startEvent.isDefaultPrevented()) return
  25847. if (actives && actives.length) {
  25848. Plugin.call(actives, 'hide')
  25849. activesData || actives.data('bs.collapse', null)
  25850. }
  25851. var dimension = this.dimension()
  25852. this.$element
  25853. .removeClass('collapse')
  25854. .addClass('collapsing')[dimension](0)
  25855. .attr('aria-expanded', true)
  25856. this.$trigger
  25857. .removeClass('collapsed')
  25858. .attr('aria-expanded', true)
  25859. this.transitioning = 1
  25860. var complete = function () {
  25861. this.$element
  25862. .removeClass('collapsing')
  25863. .addClass('collapse in')[dimension]('')
  25864. this.transitioning = 0
  25865. this.$element
  25866. .trigger('shown.bs.collapse')
  25867. }
  25868. if (!$.support.transition) return complete.call(this)
  25869. var scrollSize = $.camelCase(['scroll', dimension].join('-'))
  25870. this.$element
  25871. .one('bsTransitionEnd', $.proxy(complete, this))
  25872. .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize])
  25873. }
  25874. Collapse.prototype.hide = function () {
  25875. if (this.transitioning || !this.$element.hasClass('in')) return
  25876. var startEvent = $.Event('hide.bs.collapse')
  25877. this.$element.trigger(startEvent)
  25878. if (startEvent.isDefaultPrevented()) return
  25879. var dimension = this.dimension()
  25880. this.$element[dimension](this.$element[dimension]())[0].offsetHeight
  25881. this.$element
  25882. .addClass('collapsing')
  25883. .removeClass('collapse in')
  25884. .attr('aria-expanded', false)
  25885. this.$trigger
  25886. .addClass('collapsed')
  25887. .attr('aria-expanded', false)
  25888. this.transitioning = 1
  25889. var complete = function () {
  25890. this.transitioning = 0
  25891. this.$element
  25892. .removeClass('collapsing')
  25893. .addClass('collapse')
  25894. .trigger('hidden.bs.collapse')
  25895. }
  25896. if (!$.support.transition) return complete.call(this)
  25897. this.$element
  25898. [dimension](0)
  25899. .one('bsTransitionEnd', $.proxy(complete, this))
  25900. .emulateTransitionEnd(Collapse.TRANSITION_DURATION)
  25901. }
  25902. Collapse.prototype.toggle = function () {
  25903. this[this.$element.hasClass('in') ? 'hide' : 'show']()
  25904. }
  25905. Collapse.prototype.getParent = function () {
  25906. return $(this.options.parent)
  25907. .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]')
  25908. .each($.proxy(function (i, element) {
  25909. var $element = $(element)
  25910. this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element)
  25911. }, this))
  25912. .end()
  25913. }
  25914. Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) {
  25915. var isOpen = $element.hasClass('in')
  25916. $element.attr('aria-expanded', isOpen)
  25917. $trigger
  25918. .toggleClass('collapsed', !isOpen)
  25919. .attr('aria-expanded', isOpen)
  25920. }
  25921. function getTargetFromTrigger($trigger) {
  25922. var href
  25923. var target = $trigger.attr('data-target')
  25924. || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
  25925. return $(target)
  25926. }
  25927. // COLLAPSE PLUGIN DEFINITION
  25928. // ==========================
  25929. function Plugin(option) {
  25930. return this.each(function () {
  25931. var $this = $(this)
  25932. var data = $this.data('bs.collapse')
  25933. var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
  25934. if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false
  25935. if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
  25936. if (typeof option == 'string') data[option]()
  25937. })
  25938. }
  25939. var old = $.fn.collapse
  25940. $.fn.collapse = Plugin
  25941. $.fn.collapse.Constructor = Collapse
  25942. // COLLAPSE NO CONFLICT
  25943. // ====================
  25944. $.fn.collapse.noConflict = function () {
  25945. $.fn.collapse = old
  25946. return this
  25947. }
  25948. // COLLAPSE DATA-API
  25949. // =================
  25950. $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
  25951. var $this = $(this)
  25952. if (!$this.attr('data-target')) e.preventDefault()
  25953. var $target = getTargetFromTrigger($this)
  25954. var data = $target.data('bs.collapse')
  25955. var option = data ? 'toggle' : $this.data()
  25956. Plugin.call($target, option)
  25957. })
  25958. }(jQuery);
  25959. /* ========================================================================
  25960. * Bootstrap: dropdown.js v3.3.7
  25961. * http://getbootstrap.com/javascript/#dropdowns
  25962. * ========================================================================
  25963. * Copyright 2011-2016 Twitter, Inc.
  25964. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  25965. * ======================================================================== */
  25966. +function ($) {
  25967. 'use strict';
  25968. // DROPDOWN CLASS DEFINITION
  25969. // =========================
  25970. var backdrop = '.dropdown-backdrop'
  25971. var toggle = '[data-toggle="dropdown"]'
  25972. var Dropdown = function (element) {
  25973. $(element).on('click.bs.dropdown', this.toggle)
  25974. }
  25975. Dropdown.VERSION = '3.3.7'
  25976. function getParent($this) {
  25977. var selector = $this.attr('data-target')
  25978. if (!selector) {
  25979. selector = $this.attr('href')
  25980. selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
  25981. }
  25982. var $parent = selector && $(selector)
  25983. return $parent && $parent.length ? $parent : $this.parent()
  25984. }
  25985. function clearMenus(e) {
  25986. if (e && e.which === 3) return
  25987. $(backdrop).remove()
  25988. $(toggle).each(function () {
  25989. var $this = $(this)
  25990. var $parent = getParent($this)
  25991. var relatedTarget = { relatedTarget: this }
  25992. if (!$parent.hasClass('open')) return
  25993. if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return
  25994. $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
  25995. if (e.isDefaultPrevented()) return
  25996. $this.attr('aria-expanded', 'false')
  25997. $parent.removeClass('open').trigger($.Event('hidden.bs.dropdown', relatedTarget))
  25998. })
  25999. }
  26000. Dropdown.prototype.toggle = function (e) {
  26001. var $this = $(this)
  26002. if ($this.is('.disabled, :disabled')) return
  26003. var $parent = getParent($this)
  26004. var isActive = $parent.hasClass('open')
  26005. clearMenus()
  26006. if (!isActive) {
  26007. if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
  26008. // if mobile we use a backdrop because click events don't delegate
  26009. $(document.createElement('div'))
  26010. .addClass('dropdown-backdrop')
  26011. .insertAfter($(this))
  26012. .on('click', clearMenus)
  26013. }
  26014. var relatedTarget = { relatedTarget: this }
  26015. $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
  26016. if (e.isDefaultPrevented()) return
  26017. $this
  26018. .trigger('focus')
  26019. .attr('aria-expanded', 'true')
  26020. $parent
  26021. .toggleClass('open')
  26022. .trigger($.Event('shown.bs.dropdown', relatedTarget))
  26023. }
  26024. return false
  26025. }
  26026. Dropdown.prototype.keydown = function (e) {
  26027. if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return
  26028. var $this = $(this)
  26029. e.preventDefault()
  26030. e.stopPropagation()
  26031. if ($this.is('.disabled, :disabled')) return
  26032. var $parent = getParent($this)
  26033. var isActive = $parent.hasClass('open')
  26034. if (!isActive && e.which != 27 || isActive && e.which == 27) {
  26035. if (e.which == 27) $parent.find(toggle).trigger('focus')
  26036. return $this.trigger('click')
  26037. }
  26038. var desc = ' li:not(.disabled):visible a'
  26039. var $items = $parent.find('.dropdown-menu' + desc)
  26040. if (!$items.length) return
  26041. var index = $items.index(e.target)
  26042. if (e.which == 38 && index > 0) index-- // up
  26043. if (e.which == 40 && index < $items.length - 1) index++ // down
  26044. if (!~index) index = 0
  26045. $items.eq(index).trigger('focus')
  26046. }
  26047. // DROPDOWN PLUGIN DEFINITION
  26048. // ==========================
  26049. function Plugin(option) {
  26050. return this.each(function () {
  26051. var $this = $(this)
  26052. var data = $this.data('bs.dropdown')
  26053. if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
  26054. if (typeof option == 'string') data[option].call($this)
  26055. })
  26056. }
  26057. var old = $.fn.dropdown
  26058. $.fn.dropdown = Plugin
  26059. $.fn.dropdown.Constructor = Dropdown
  26060. // DROPDOWN NO CONFLICT
  26061. // ====================
  26062. $.fn.dropdown.noConflict = function () {
  26063. $.fn.dropdown = old
  26064. return this
  26065. }
  26066. // APPLY TO STANDARD DROPDOWN ELEMENTS
  26067. // ===================================
  26068. $(document)
  26069. .on('click.bs.dropdown.data-api', clearMenus)
  26070. .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
  26071. .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
  26072. .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)
  26073. .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown)
  26074. }(jQuery);
  26075. /* ========================================================================
  26076. * Bootstrap: modal.js v3.3.7
  26077. * http://getbootstrap.com/javascript/#modals
  26078. * ========================================================================
  26079. * Copyright 2011-2016 Twitter, Inc.
  26080. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  26081. * ======================================================================== */
  26082. +function ($) {
  26083. 'use strict';
  26084. // MODAL CLASS DEFINITION
  26085. // ======================
  26086. var Modal = function (element, options) {
  26087. this.options = options
  26088. this.$body = $(document.body)
  26089. this.$element = $(element)
  26090. this.$dialog = this.$element.find('.modal-dialog')
  26091. this.$backdrop = null
  26092. this.isShown = null
  26093. this.originalBodyPad = null
  26094. this.scrollbarWidth = 0
  26095. this.ignoreBackdropClick = false
  26096. if (this.options.remote) {
  26097. this.$element
  26098. .find('.modal-content')
  26099. .load(this.options.remote, $.proxy(function () {
  26100. this.$element.trigger('loaded.bs.modal')
  26101. }, this))
  26102. }
  26103. }
  26104. Modal.VERSION = '3.3.7'
  26105. Modal.TRANSITION_DURATION = 300
  26106. Modal.BACKDROP_TRANSITION_DURATION = 150
  26107. Modal.DEFAULTS = {
  26108. backdrop: true,
  26109. keyboard: true,
  26110. show: true
  26111. }
  26112. Modal.prototype.toggle = function (_relatedTarget) {
  26113. return this.isShown ? this.hide() : this.show(_relatedTarget)
  26114. }
  26115. Modal.prototype.show = function (_relatedTarget) {
  26116. var that = this
  26117. var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
  26118. this.$element.trigger(e)
  26119. if (this.isShown || e.isDefaultPrevented()) return
  26120. this.isShown = true
  26121. this.checkScrollbar()
  26122. this.setScrollbar()
  26123. this.$body.addClass('modal-open')
  26124. this.escape()
  26125. this.resize()
  26126. this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
  26127. this.$dialog.on('mousedown.dismiss.bs.modal', function () {
  26128. that.$element.one('mouseup.dismiss.bs.modal', function (e) {
  26129. if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true
  26130. })
  26131. })
  26132. this.backdrop(function () {
  26133. var transition = $.support.transition && that.$element.hasClass('fade')
  26134. if (!that.$element.parent().length) {
  26135. that.$element.appendTo(that.$body) // don't move modals dom position
  26136. }
  26137. that.$element
  26138. .show()
  26139. .scrollTop(0)
  26140. that.adjustDialog()
  26141. if (transition) {
  26142. that.$element[0].offsetWidth // force reflow
  26143. }
  26144. that.$element.addClass('in')
  26145. that.enforceFocus()
  26146. var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
  26147. transition ?
  26148. that.$dialog // wait for modal to slide in
  26149. .one('bsTransitionEnd', function () {
  26150. that.$element.trigger('focus').trigger(e)
  26151. })
  26152. .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
  26153. that.$element.trigger('focus').trigger(e)
  26154. })
  26155. }
  26156. Modal.prototype.hide = function (e) {
  26157. if (e) e.preventDefault()
  26158. e = $.Event('hide.bs.modal')
  26159. this.$element.trigger(e)
  26160. if (!this.isShown || e.isDefaultPrevented()) return
  26161. this.isShown = false
  26162. this.escape()
  26163. this.resize()
  26164. $(document).off('focusin.bs.modal')
  26165. this.$element
  26166. .removeClass('in')
  26167. .off('click.dismiss.bs.modal')
  26168. .off('mouseup.dismiss.bs.modal')
  26169. this.$dialog.off('mousedown.dismiss.bs.modal')
  26170. $.support.transition && this.$element.hasClass('fade') ?
  26171. this.$element
  26172. .one('bsTransitionEnd', $.proxy(this.hideModal, this))
  26173. .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
  26174. this.hideModal()
  26175. }
  26176. Modal.prototype.enforceFocus = function () {
  26177. $(document)
  26178. .off('focusin.bs.modal') // guard against infinite focus loop
  26179. .on('focusin.bs.modal', $.proxy(function (e) {
  26180. if (document !== e.target &&
  26181. this.$element[0] !== e.target &&
  26182. !this.$element.has(e.target).length) {
  26183. this.$element.trigger('focus')
  26184. }
  26185. }, this))
  26186. }
  26187. Modal.prototype.escape = function () {
  26188. if (this.isShown && this.options.keyboard) {
  26189. this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {
  26190. e.which == 27 && this.hide()
  26191. }, this))
  26192. } else if (!this.isShown) {
  26193. this.$element.off('keydown.dismiss.bs.modal')
  26194. }
  26195. }
  26196. Modal.prototype.resize = function () {
  26197. if (this.isShown) {
  26198. $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this))
  26199. } else {
  26200. $(window).off('resize.bs.modal')
  26201. }
  26202. }
  26203. Modal.prototype.hideModal = function () {
  26204. var that = this
  26205. this.$element.hide()
  26206. this.backdrop(function () {
  26207. that.$body.removeClass('modal-open')
  26208. that.resetAdjustments()
  26209. that.resetScrollbar()
  26210. that.$element.trigger('hidden.bs.modal')
  26211. })
  26212. }
  26213. Modal.prototype.removeBackdrop = function () {
  26214. this.$backdrop && this.$backdrop.remove()
  26215. this.$backdrop = null
  26216. }
  26217. Modal.prototype.backdrop = function (callback) {
  26218. var that = this
  26219. var animate = this.$element.hasClass('fade') ? 'fade' : ''
  26220. if (this.isShown && this.options.backdrop) {
  26221. var doAnimate = $.support.transition && animate
  26222. this.$backdrop = $(document.createElement('div'))
  26223. .addClass('modal-backdrop ' + animate)
  26224. .appendTo(this.$body)
  26225. this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
  26226. if (this.ignoreBackdropClick) {
  26227. this.ignoreBackdropClick = false
  26228. return
  26229. }
  26230. if (e.target !== e.currentTarget) return
  26231. this.options.backdrop == 'static'
  26232. ? this.$element[0].focus()
  26233. : this.hide()
  26234. }, this))
  26235. if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
  26236. this.$backdrop.addClass('in')
  26237. if (!callback) return
  26238. doAnimate ?
  26239. this.$backdrop
  26240. .one('bsTransitionEnd', callback)
  26241. .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
  26242. callback()
  26243. } else if (!this.isShown && this.$backdrop) {
  26244. this.$backdrop.removeClass('in')
  26245. var callbackRemove = function () {
  26246. that.removeBackdrop()
  26247. callback && callback()
  26248. }
  26249. $.support.transition && this.$element.hasClass('fade') ?
  26250. this.$backdrop
  26251. .one('bsTransitionEnd', callbackRemove)
  26252. .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
  26253. callbackRemove()
  26254. } else if (callback) {
  26255. callback()
  26256. }
  26257. }
  26258. // these following methods are used to handle overflowing modals
  26259. Modal.prototype.handleUpdate = function () {
  26260. this.adjustDialog()
  26261. }
  26262. Modal.prototype.adjustDialog = function () {
  26263. var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight
  26264. this.$element.css({
  26265. paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',
  26266. paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''
  26267. })
  26268. }
  26269. Modal.prototype.resetAdjustments = function () {
  26270. this.$element.css({
  26271. paddingLeft: '',
  26272. paddingRight: ''
  26273. })
  26274. }
  26275. Modal.prototype.checkScrollbar = function () {
  26276. var fullWindowWidth = window.innerWidth
  26277. if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8
  26278. var documentElementRect = document.documentElement.getBoundingClientRect()
  26279. fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left)
  26280. }
  26281. this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth
  26282. this.scrollbarWidth = this.measureScrollbar()
  26283. }
  26284. Modal.prototype.setScrollbar = function () {
  26285. var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
  26286. this.originalBodyPad = document.body.style.paddingRight || ''
  26287. if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
  26288. }
  26289. Modal.prototype.resetScrollbar = function () {
  26290. this.$body.css('padding-right', this.originalBodyPad)
  26291. }
  26292. Modal.prototype.measureScrollbar = function () { // thx walsh
  26293. var scrollDiv = document.createElement('div')
  26294. scrollDiv.className = 'modal-scrollbar-measure'
  26295. this.$body.append(scrollDiv)
  26296. var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
  26297. this.$body[0].removeChild(scrollDiv)
  26298. return scrollbarWidth
  26299. }
  26300. // MODAL PLUGIN DEFINITION
  26301. // =======================
  26302. function Plugin(option, _relatedTarget) {
  26303. return this.each(function () {
  26304. var $this = $(this)
  26305. var data = $this.data('bs.modal')
  26306. var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
  26307. if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
  26308. if (typeof option == 'string') data[option](_relatedTarget)
  26309. else if (options.show) data.show(_relatedTarget)
  26310. })
  26311. }
  26312. var old = $.fn.modal
  26313. $.fn.modal = Plugin
  26314. $.fn.modal.Constructor = Modal
  26315. // MODAL NO CONFLICT
  26316. // =================
  26317. $.fn.modal.noConflict = function () {
  26318. $.fn.modal = old
  26319. return this
  26320. }
  26321. // MODAL DATA-API
  26322. // ==============
  26323. $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
  26324. var $this = $(this)
  26325. var href = $this.attr('href')
  26326. var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
  26327. var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
  26328. if ($this.is('a')) e.preventDefault()
  26329. $target.one('show.bs.modal', function (showEvent) {
  26330. if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
  26331. $target.one('hidden.bs.modal', function () {
  26332. $this.is(':visible') && $this.trigger('focus')
  26333. })
  26334. })
  26335. Plugin.call($target, option, this)
  26336. })
  26337. }(jQuery);
  26338. /* ========================================================================
  26339. * Bootstrap: tooltip.js v3.3.7
  26340. * http://getbootstrap.com/javascript/#tooltip
  26341. * Inspired by the original jQuery.tipsy by Jason Frame
  26342. * ========================================================================
  26343. * Copyright 2011-2016 Twitter, Inc.
  26344. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  26345. * ======================================================================== */
  26346. +function ($) {
  26347. 'use strict';
  26348. // TOOLTIP PUBLIC CLASS DEFINITION
  26349. // ===============================
  26350. var Tooltip = function (element, options) {
  26351. this.type = null
  26352. this.options = null
  26353. this.enabled = null
  26354. this.timeout = null
  26355. this.hoverState = null
  26356. this.$element = null
  26357. this.inState = null
  26358. this.init('tooltip', element, options)
  26359. }
  26360. Tooltip.VERSION = '3.3.7'
  26361. Tooltip.TRANSITION_DURATION = 150
  26362. Tooltip.DEFAULTS = {
  26363. animation: true,
  26364. placement: 'top',
  26365. selector: false,
  26366. template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
  26367. trigger: 'hover focus',
  26368. title: '',
  26369. delay: 0,
  26370. html: false,
  26371. container: false,
  26372. viewport: {
  26373. selector: 'body',
  26374. padding: 0
  26375. }
  26376. }
  26377. Tooltip.prototype.init = function (type, element, options) {
  26378. this.enabled = true
  26379. this.type = type
  26380. this.$element = $(element)
  26381. this.options = this.getOptions(options)
  26382. this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport))
  26383. this.inState = { click: false, hover: false, focus: false }
  26384. if (this.$element[0] instanceof document.constructor && !this.options.selector) {
  26385. throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')
  26386. }
  26387. var triggers = this.options.trigger.split(' ')
  26388. for (var i = triggers.length; i--;) {
  26389. var trigger = triggers[i]
  26390. if (trigger == 'click') {
  26391. this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
  26392. } else if (trigger != 'manual') {
  26393. var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'
  26394. var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
  26395. this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
  26396. this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
  26397. }
  26398. }
  26399. this.options.selector ?
  26400. (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
  26401. this.fixTitle()
  26402. }
  26403. Tooltip.prototype.getDefaults = function () {
  26404. return Tooltip.DEFAULTS
  26405. }
  26406. Tooltip.prototype.getOptions = function (options) {
  26407. options = $.extend({}, this.getDefaults(), this.$element.data(), options)
  26408. if (options.delay && typeof options.delay == 'number') {
  26409. options.delay = {
  26410. show: options.delay,
  26411. hide: options.delay
  26412. }
  26413. }
  26414. return options
  26415. }
  26416. Tooltip.prototype.getDelegateOptions = function () {
  26417. var options = {}
  26418. var defaults = this.getDefaults()
  26419. this._options && $.each(this._options, function (key, value) {
  26420. if (defaults[key] != value) options[key] = value
  26421. })
  26422. return options
  26423. }
  26424. Tooltip.prototype.enter = function (obj) {
  26425. var self = obj instanceof this.constructor ?
  26426. obj : $(obj.currentTarget).data('bs.' + this.type)
  26427. if (!self) {
  26428. self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
  26429. $(obj.currentTarget).data('bs.' + this.type, self)
  26430. }
  26431. if (obj instanceof $.Event) {
  26432. self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true
  26433. }
  26434. if (self.tip().hasClass('in') || self.hoverState == 'in') {
  26435. self.hoverState = 'in'
  26436. return
  26437. }
  26438. clearTimeout(self.timeout)
  26439. self.hoverState = 'in'
  26440. if (!self.options.delay || !self.options.delay.show) return self.show()
  26441. self.timeout = setTimeout(function () {
  26442. if (self.hoverState == 'in') self.show()
  26443. }, self.options.delay.show)
  26444. }
  26445. Tooltip.prototype.isInStateTrue = function () {
  26446. for (var key in this.inState) {
  26447. if (this.inState[key]) return true
  26448. }
  26449. return false
  26450. }
  26451. Tooltip.prototype.leave = function (obj) {
  26452. var self = obj instanceof this.constructor ?
  26453. obj : $(obj.currentTarget).data('bs.' + this.type)
  26454. if (!self) {
  26455. self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
  26456. $(obj.currentTarget).data('bs.' + this.type, self)
  26457. }
  26458. if (obj instanceof $.Event) {
  26459. self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false
  26460. }
  26461. if (self.isInStateTrue()) return
  26462. clearTimeout(self.timeout)
  26463. self.hoverState = 'out'
  26464. if (!self.options.delay || !self.options.delay.hide) return self.hide()
  26465. self.timeout = setTimeout(function () {
  26466. if (self.hoverState == 'out') self.hide()
  26467. }, self.options.delay.hide)
  26468. }
  26469. Tooltip.prototype.show = function () {
  26470. var e = $.Event('show.bs.' + this.type)
  26471. if (this.hasContent() && this.enabled) {
  26472. this.$element.trigger(e)
  26473. var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])
  26474. if (e.isDefaultPrevented() || !inDom) return
  26475. var that = this
  26476. var $tip = this.tip()
  26477. var tipId = this.getUID(this.type)
  26478. this.setContent()
  26479. $tip.attr('id', tipId)
  26480. this.$element.attr('aria-describedby', tipId)
  26481. if (this.options.animation) $tip.addClass('fade')
  26482. var placement = typeof this.options.placement == 'function' ?
  26483. this.options.placement.call(this, $tip[0], this.$element[0]) :
  26484. this.options.placement
  26485. var autoToken = /\s?auto?\s?/i
  26486. var autoPlace = autoToken.test(placement)
  26487. if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
  26488. $tip
  26489. .detach()
  26490. .css({ top: 0, left: 0, display: 'block' })
  26491. .addClass(placement)
  26492. .data('bs.' + this.type, this)
  26493. this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
  26494. this.$element.trigger('inserted.bs.' + this.type)
  26495. var pos = this.getPosition()
  26496. var actualWidth = $tip[0].offsetWidth
  26497. var actualHeight = $tip[0].offsetHeight
  26498. if (autoPlace) {
  26499. var orgPlacement = placement
  26500. var viewportDim = this.getPosition(this.$viewport)
  26501. placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' :
  26502. placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' :
  26503. placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' :
  26504. placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' :
  26505. placement
  26506. $tip
  26507. .removeClass(orgPlacement)
  26508. .addClass(placement)
  26509. }
  26510. var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
  26511. this.applyPlacement(calculatedOffset, placement)
  26512. var complete = function () {
  26513. var prevHoverState = that.hoverState
  26514. that.$element.trigger('shown.bs.' + that.type)
  26515. that.hoverState = null
  26516. if (prevHoverState == 'out') that.leave(that)
  26517. }
  26518. $.support.transition && this.$tip.hasClass('fade') ?
  26519. $tip
  26520. .one('bsTransitionEnd', complete)
  26521. .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
  26522. complete()
  26523. }
  26524. }
  26525. Tooltip.prototype.applyPlacement = function (offset, placement) {
  26526. var $tip = this.tip()
  26527. var width = $tip[0].offsetWidth
  26528. var height = $tip[0].offsetHeight
  26529. // manually read margins because getBoundingClientRect includes difference
  26530. var marginTop = parseInt($tip.css('margin-top'), 10)
  26531. var marginLeft = parseInt($tip.css('margin-left'), 10)
  26532. // we must check for NaN for ie 8/9
  26533. if (isNaN(marginTop)) marginTop = 0
  26534. if (isNaN(marginLeft)) marginLeft = 0
  26535. offset.top += marginTop
  26536. offset.left += marginLeft
  26537. // $.fn.offset doesn't round pixel values
  26538. // so we use setOffset directly with our own function B-0
  26539. $.offset.setOffset($tip[0], $.extend({
  26540. using: function (props) {
  26541. $tip.css({
  26542. top: Math.round(props.top),
  26543. left: Math.round(props.left)
  26544. })
  26545. }
  26546. }, offset), 0)
  26547. $tip.addClass('in')
  26548. // check to see if placing tip in new offset caused the tip to resize itself
  26549. var actualWidth = $tip[0].offsetWidth
  26550. var actualHeight = $tip[0].offsetHeight
  26551. if (placement == 'top' && actualHeight != height) {
  26552. offset.top = offset.top + height - actualHeight
  26553. }
  26554. var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)
  26555. if (delta.left) offset.left += delta.left
  26556. else offset.top += delta.top
  26557. var isVertical = /top|bottom/.test(placement)
  26558. var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
  26559. var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight'
  26560. $tip.offset(offset)
  26561. this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)
  26562. }
  26563. Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) {
  26564. this.arrow()
  26565. .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%')
  26566. .css(isVertical ? 'top' : 'left', '')
  26567. }
  26568. Tooltip.prototype.setContent = function () {
  26569. var $tip = this.tip()
  26570. var title = this.getTitle()
  26571. $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
  26572. $tip.removeClass('fade in top bottom left right')
  26573. }
  26574. Tooltip.prototype.hide = function (callback) {
  26575. var that = this
  26576. var $tip = $(this.$tip)
  26577. var e = $.Event('hide.bs.' + this.type)
  26578. function complete() {
  26579. if (that.hoverState != 'in') $tip.detach()
  26580. if (that.$element) { // TODO: Check whether guarding this code with this `if` is really necessary.
  26581. that.$element
  26582. .removeAttr('aria-describedby')
  26583. .trigger('hidden.bs.' + that.type)
  26584. }
  26585. callback && callback()
  26586. }
  26587. this.$element.trigger(e)
  26588. if (e.isDefaultPrevented()) return
  26589. $tip.removeClass('in')
  26590. $.support.transition && $tip.hasClass('fade') ?
  26591. $tip
  26592. .one('bsTransitionEnd', complete)
  26593. .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
  26594. complete()
  26595. this.hoverState = null
  26596. return this
  26597. }
  26598. Tooltip.prototype.fixTitle = function () {
  26599. var $e = this.$element
  26600. if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') {
  26601. $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
  26602. }
  26603. }
  26604. Tooltip.prototype.hasContent = function () {
  26605. return this.getTitle()
  26606. }
  26607. Tooltip.prototype.getPosition = function ($element) {
  26608. $element = $element || this.$element
  26609. var el = $element[0]
  26610. var isBody = el.tagName == 'BODY'
  26611. var elRect = el.getBoundingClientRect()
  26612. if (elRect.width == null) {
  26613. // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093
  26614. elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
  26615. }
  26616. var isSvg = window.SVGElement && el instanceof window.SVGElement
  26617. // Avoid using $.offset() on SVGs since it gives incorrect results in jQuery 3.
  26618. // See https://github.com/twbs/bootstrap/issues/20280
  26619. var elOffset = isBody ? { top: 0, left: 0 } : (isSvg ? null : $element.offset())
  26620. var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
  26621. var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null
  26622. return $.extend({}, elRect, scroll, outerDims, elOffset)
  26623. }
  26624. Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
  26625. return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
  26626. placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
  26627. placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
  26628. /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
  26629. }
  26630. Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {
  26631. var delta = { top: 0, left: 0 }
  26632. if (!this.$viewport) return delta
  26633. var viewportPadding = this.options.viewport && this.options.viewport.padding || 0
  26634. var viewportDimensions = this.getPosition(this.$viewport)
  26635. if (/right|left/.test(placement)) {
  26636. var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll
  26637. var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
  26638. if (topEdgeOffset < viewportDimensions.top) { // top overflow
  26639. delta.top = viewportDimensions.top - topEdgeOffset
  26640. } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow
  26641. delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
  26642. }
  26643. } else {
  26644. var leftEdgeOffset = pos.left - viewportPadding
  26645. var rightEdgeOffset = pos.left + viewportPadding + actualWidth
  26646. if (leftEdgeOffset < viewportDimensions.left) { // left overflow
  26647. delta.left = viewportDimensions.left - leftEdgeOffset
  26648. } else if (rightEdgeOffset > viewportDimensions.right) { // right overflow
  26649. delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
  26650. }
  26651. }
  26652. return delta
  26653. }
  26654. Tooltip.prototype.getTitle = function () {
  26655. var title
  26656. var $e = this.$element
  26657. var o = this.options
  26658. title = $e.attr('data-original-title')
  26659. || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
  26660. return title
  26661. }
  26662. Tooltip.prototype.getUID = function (prefix) {
  26663. do prefix += ~~(Math.random() * 1000000)
  26664. while (document.getElementById(prefix))
  26665. return prefix
  26666. }
  26667. Tooltip.prototype.tip = function () {
  26668. if (!this.$tip) {
  26669. this.$tip = $(this.options.template)
  26670. if (this.$tip.length != 1) {
  26671. throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!')
  26672. }
  26673. }
  26674. return this.$tip
  26675. }
  26676. Tooltip.prototype.arrow = function () {
  26677. return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
  26678. }
  26679. Tooltip.prototype.enable = function () {
  26680. this.enabled = true
  26681. }
  26682. Tooltip.prototype.disable = function () {
  26683. this.enabled = false
  26684. }
  26685. Tooltip.prototype.toggleEnabled = function () {
  26686. this.enabled = !this.enabled
  26687. }
  26688. Tooltip.prototype.toggle = function (e) {
  26689. var self = this
  26690. if (e) {
  26691. self = $(e.currentTarget).data('bs.' + this.type)
  26692. if (!self) {
  26693. self = new this.constructor(e.currentTarget, this.getDelegateOptions())
  26694. $(e.currentTarget).data('bs.' + this.type, self)
  26695. }
  26696. }
  26697. if (e) {
  26698. self.inState.click = !self.inState.click
  26699. if (self.isInStateTrue()) self.enter(self)
  26700. else self.leave(self)
  26701. } else {
  26702. self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
  26703. }
  26704. }
  26705. Tooltip.prototype.destroy = function () {
  26706. var that = this
  26707. clearTimeout(this.timeout)
  26708. this.hide(function () {
  26709. that.$element.off('.' + that.type).removeData('bs.' + that.type)
  26710. if (that.$tip) {
  26711. that.$tip.detach()
  26712. }
  26713. that.$tip = null
  26714. that.$arrow = null
  26715. that.$viewport = null
  26716. that.$element = null
  26717. })
  26718. }
  26719. // TOOLTIP PLUGIN DEFINITION
  26720. // =========================
  26721. function Plugin(option) {
  26722. return this.each(function () {
  26723. var $this = $(this)
  26724. var data = $this.data('bs.tooltip')
  26725. var options = typeof option == 'object' && option
  26726. if (!data && /destroy|hide/.test(option)) return
  26727. if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
  26728. if (typeof option == 'string') data[option]()
  26729. })
  26730. }
  26731. var old = $.fn.tooltip
  26732. $.fn.tooltip = Plugin
  26733. $.fn.tooltip.Constructor = Tooltip
  26734. // TOOLTIP NO CONFLICT
  26735. // ===================
  26736. $.fn.tooltip.noConflict = function () {
  26737. $.fn.tooltip = old
  26738. return this
  26739. }
  26740. }(jQuery);
  26741. /* ========================================================================
  26742. * Bootstrap: popover.js v3.3.7
  26743. * http://getbootstrap.com/javascript/#popovers
  26744. * ========================================================================
  26745. * Copyright 2011-2016 Twitter, Inc.
  26746. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  26747. * ======================================================================== */
  26748. +function ($) {
  26749. 'use strict';
  26750. // POPOVER PUBLIC CLASS DEFINITION
  26751. // ===============================
  26752. var Popover = function (element, options) {
  26753. this.init('popover', element, options)
  26754. }
  26755. if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
  26756. Popover.VERSION = '3.3.7'
  26757. Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
  26758. placement: 'right',
  26759. trigger: 'click',
  26760. content: '',
  26761. template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
  26762. })
  26763. // NOTE: POPOVER EXTENDS tooltip.js
  26764. // ================================
  26765. Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
  26766. Popover.prototype.constructor = Popover
  26767. Popover.prototype.getDefaults = function () {
  26768. return Popover.DEFAULTS
  26769. }
  26770. Popover.prototype.setContent = function () {
  26771. var $tip = this.tip()
  26772. var title = this.getTitle()
  26773. var content = this.getContent()
  26774. $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
  26775. $tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events
  26776. this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
  26777. ](content)
  26778. $tip.removeClass('fade top bottom left right in')
  26779. // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
  26780. // this manually by checking the contents.
  26781. if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
  26782. }
  26783. Popover.prototype.hasContent = function () {
  26784. return this.getTitle() || this.getContent()
  26785. }
  26786. Popover.prototype.getContent = function () {
  26787. var $e = this.$element
  26788. var o = this.options
  26789. return $e.attr('data-content')
  26790. || (typeof o.content == 'function' ?
  26791. o.content.call($e[0]) :
  26792. o.content)
  26793. }
  26794. Popover.prototype.arrow = function () {
  26795. return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
  26796. }
  26797. // POPOVER PLUGIN DEFINITION
  26798. // =========================
  26799. function Plugin(option) {
  26800. return this.each(function () {
  26801. var $this = $(this)
  26802. var data = $this.data('bs.popover')
  26803. var options = typeof option == 'object' && option
  26804. if (!data && /destroy|hide/.test(option)) return
  26805. if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
  26806. if (typeof option == 'string') data[option]()
  26807. })
  26808. }
  26809. var old = $.fn.popover
  26810. $.fn.popover = Plugin
  26811. $.fn.popover.Constructor = Popover
  26812. // POPOVER NO CONFLICT
  26813. // ===================
  26814. $.fn.popover.noConflict = function () {
  26815. $.fn.popover = old
  26816. return this
  26817. }
  26818. }(jQuery);
  26819. /* ========================================================================
  26820. * Bootstrap: scrollspy.js v3.3.7
  26821. * http://getbootstrap.com/javascript/#scrollspy
  26822. * ========================================================================
  26823. * Copyright 2011-2016 Twitter, Inc.
  26824. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  26825. * ======================================================================== */
  26826. +function ($) {
  26827. 'use strict';
  26828. // SCROLLSPY CLASS DEFINITION
  26829. // ==========================
  26830. function ScrollSpy(element, options) {
  26831. this.$body = $(document.body)
  26832. this.$scrollElement = $(element).is(document.body) ? $(window) : $(element)
  26833. this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
  26834. this.selector = (this.options.target || '') + ' .nav li > a'
  26835. this.offsets = []
  26836. this.targets = []
  26837. this.activeTarget = null
  26838. this.scrollHeight = 0
  26839. this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this))
  26840. this.refresh()
  26841. this.process()
  26842. }
  26843. ScrollSpy.VERSION = '3.3.7'
  26844. ScrollSpy.DEFAULTS = {
  26845. offset: 10
  26846. }
  26847. ScrollSpy.prototype.getScrollHeight = function () {
  26848. return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
  26849. }
  26850. ScrollSpy.prototype.refresh = function () {
  26851. var that = this
  26852. var offsetMethod = 'offset'
  26853. var offsetBase = 0
  26854. this.offsets = []
  26855. this.targets = []
  26856. this.scrollHeight = this.getScrollHeight()
  26857. if (!$.isWindow(this.$scrollElement[0])) {
  26858. offsetMethod = 'position'
  26859. offsetBase = this.$scrollElement.scrollTop()
  26860. }
  26861. this.$body
  26862. .find(this.selector)
  26863. .map(function () {
  26864. var $el = $(this)
  26865. var href = $el.data('target') || $el.attr('href')
  26866. var $href = /^#./.test(href) && $(href)
  26867. return ($href
  26868. && $href.length
  26869. && $href.is(':visible')
  26870. && [[$href[offsetMethod]().top + offsetBase, href]]) || null
  26871. })
  26872. .sort(function (a, b) { return a[0] - b[0] })
  26873. .each(function () {
  26874. that.offsets.push(this[0])
  26875. that.targets.push(this[1])
  26876. })
  26877. }
  26878. ScrollSpy.prototype.process = function () {
  26879. var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
  26880. var scrollHeight = this.getScrollHeight()
  26881. var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height()
  26882. var offsets = this.offsets
  26883. var targets = this.targets
  26884. var activeTarget = this.activeTarget
  26885. var i
  26886. if (this.scrollHeight != scrollHeight) {
  26887. this.refresh()
  26888. }
  26889. if (scrollTop >= maxScroll) {
  26890. return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
  26891. }
  26892. if (activeTarget && scrollTop < offsets[0]) {
  26893. this.activeTarget = null
  26894. return this.clear()
  26895. }
  26896. for (i = offsets.length; i--;) {
  26897. activeTarget != targets[i]
  26898. && scrollTop >= offsets[i]
  26899. && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1])
  26900. && this.activate(targets[i])
  26901. }
  26902. }
  26903. ScrollSpy.prototype.activate = function (target) {
  26904. this.activeTarget = target
  26905. this.clear()
  26906. var selector = this.selector +
  26907. '[data-target="' + target + '"],' +
  26908. this.selector + '[href="' + target + '"]'
  26909. var active = $(selector)
  26910. .parents('li')
  26911. .addClass('active')
  26912. if (active.parent('.dropdown-menu').length) {
  26913. active = active
  26914. .closest('li.dropdown')
  26915. .addClass('active')
  26916. }
  26917. active.trigger('activate.bs.scrollspy')
  26918. }
  26919. ScrollSpy.prototype.clear = function () {
  26920. $(this.selector)
  26921. .parentsUntil(this.options.target, '.active')
  26922. .removeClass('active')
  26923. }
  26924. // SCROLLSPY PLUGIN DEFINITION
  26925. // ===========================
  26926. function Plugin(option) {
  26927. return this.each(function () {
  26928. var $this = $(this)
  26929. var data = $this.data('bs.scrollspy')
  26930. var options = typeof option == 'object' && option
  26931. if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
  26932. if (typeof option == 'string') data[option]()
  26933. })
  26934. }
  26935. var old = $.fn.scrollspy
  26936. $.fn.scrollspy = Plugin
  26937. $.fn.scrollspy.Constructor = ScrollSpy
  26938. // SCROLLSPY NO CONFLICT
  26939. // =====================
  26940. $.fn.scrollspy.noConflict = function () {
  26941. $.fn.scrollspy = old
  26942. return this
  26943. }
  26944. // SCROLLSPY DATA-API
  26945. // ==================
  26946. $(window).on('load.bs.scrollspy.data-api', function () {
  26947. $('[data-spy="scroll"]').each(function () {
  26948. var $spy = $(this)
  26949. Plugin.call($spy, $spy.data())
  26950. })
  26951. })
  26952. }(jQuery);
  26953. /* ========================================================================
  26954. * Bootstrap: tab.js v3.3.7
  26955. * http://getbootstrap.com/javascript/#tabs
  26956. * ========================================================================
  26957. * Copyright 2011-2016 Twitter, Inc.
  26958. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  26959. * ======================================================================== */
  26960. +function ($) {
  26961. 'use strict';
  26962. // TAB CLASS DEFINITION
  26963. // ====================
  26964. var Tab = function (element) {
  26965. // jscs:disable requireDollarBeforejQueryAssignment
  26966. this.element = $(element)
  26967. // jscs:enable requireDollarBeforejQueryAssignment
  26968. }
  26969. Tab.VERSION = '3.3.7'
  26970. Tab.TRANSITION_DURATION = 150
  26971. Tab.prototype.show = function () {
  26972. var $this = this.element
  26973. var $ul = $this.closest('ul:not(.dropdown-menu)')
  26974. var selector = $this.data('target')
  26975. if (!selector) {
  26976. selector = $this.attr('href')
  26977. selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
  26978. }
  26979. if ($this.parent('li').hasClass('active')) return
  26980. var $previous = $ul.find('.active:last a')
  26981. var hideEvent = $.Event('hide.bs.tab', {
  26982. relatedTarget: $this[0]
  26983. })
  26984. var showEvent = $.Event('show.bs.tab', {
  26985. relatedTarget: $previous[0]
  26986. })
  26987. $previous.trigger(hideEvent)
  26988. $this.trigger(showEvent)
  26989. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return
  26990. var $target = $(selector)
  26991. this.activate($this.closest('li'), $ul)
  26992. this.activate($target, $target.parent(), function () {
  26993. $previous.trigger({
  26994. type: 'hidden.bs.tab',
  26995. relatedTarget: $this[0]
  26996. })
  26997. $this.trigger({
  26998. type: 'shown.bs.tab',
  26999. relatedTarget: $previous[0]
  27000. })
  27001. })
  27002. }
  27003. Tab.prototype.activate = function (element, container, callback) {
  27004. var $active = container.find('> .active')
  27005. var transition = callback
  27006. && $.support.transition
  27007. && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length)
  27008. function next() {
  27009. $active
  27010. .removeClass('active')
  27011. .find('> .dropdown-menu > .active')
  27012. .removeClass('active')
  27013. .end()
  27014. .find('[data-toggle="tab"]')
  27015. .attr('aria-expanded', false)
  27016. element
  27017. .addClass('active')
  27018. .find('[data-toggle="tab"]')
  27019. .attr('aria-expanded', true)
  27020. if (transition) {
  27021. element[0].offsetWidth // reflow for transition
  27022. element.addClass('in')
  27023. } else {
  27024. element.removeClass('fade')
  27025. }
  27026. if (element.parent('.dropdown-menu').length) {
  27027. element
  27028. .closest('li.dropdown')
  27029. .addClass('active')
  27030. .end()
  27031. .find('[data-toggle="tab"]')
  27032. .attr('aria-expanded', true)
  27033. }
  27034. callback && callback()
  27035. }
  27036. $active.length && transition ?
  27037. $active
  27038. .one('bsTransitionEnd', next)
  27039. .emulateTransitionEnd(Tab.TRANSITION_DURATION) :
  27040. next()
  27041. $active.removeClass('in')
  27042. }
  27043. // TAB PLUGIN DEFINITION
  27044. // =====================
  27045. function Plugin(option) {
  27046. return this.each(function () {
  27047. var $this = $(this)
  27048. var data = $this.data('bs.tab')
  27049. if (!data) $this.data('bs.tab', (data = new Tab(this)))
  27050. if (typeof option == 'string') data[option]()
  27051. })
  27052. }
  27053. var old = $.fn.tab
  27054. $.fn.tab = Plugin
  27055. $.fn.tab.Constructor = Tab
  27056. // TAB NO CONFLICT
  27057. // ===============
  27058. $.fn.tab.noConflict = function () {
  27059. $.fn.tab = old
  27060. return this
  27061. }
  27062. // TAB DATA-API
  27063. // ============
  27064. var clickHandler = function (e) {
  27065. e.preventDefault()
  27066. Plugin.call($(this), 'show')
  27067. }
  27068. $(document)
  27069. .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
  27070. .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)
  27071. }(jQuery);
  27072. /* ========================================================================
  27073. * Bootstrap: affix.js v3.3.7
  27074. * http://getbootstrap.com/javascript/#affix
  27075. * ========================================================================
  27076. * Copyright 2011-2016 Twitter, Inc.
  27077. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  27078. * ======================================================================== */
  27079. +function ($) {
  27080. 'use strict';
  27081. // AFFIX CLASS DEFINITION
  27082. // ======================
  27083. var Affix = function (element, options) {
  27084. this.options = $.extend({}, Affix.DEFAULTS, options)
  27085. this.$target = $(this.options.target)
  27086. .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
  27087. .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
  27088. this.$element = $(element)
  27089. this.affixed = null
  27090. this.unpin = null
  27091. this.pinnedOffset = null
  27092. this.checkPosition()
  27093. }
  27094. Affix.VERSION = '3.3.7'
  27095. Affix.RESET = 'affix affix-top affix-bottom'
  27096. Affix.DEFAULTS = {
  27097. offset: 0,
  27098. target: window
  27099. }
  27100. Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
  27101. var scrollTop = this.$target.scrollTop()
  27102. var position = this.$element.offset()
  27103. var targetHeight = this.$target.height()
  27104. if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false
  27105. if (this.affixed == 'bottom') {
  27106. if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
  27107. return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
  27108. }
  27109. var initializing = this.affixed == null
  27110. var colliderTop = initializing ? scrollTop : position.top
  27111. var colliderHeight = initializing ? targetHeight : height
  27112. if (offsetTop != null && scrollTop <= offsetTop) return 'top'
  27113. if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'
  27114. return false
  27115. }
  27116. Affix.prototype.getPinnedOffset = function () {
  27117. if (this.pinnedOffset) return this.pinnedOffset
  27118. this.$element.removeClass(Affix.RESET).addClass('affix')
  27119. var scrollTop = this.$target.scrollTop()
  27120. var position = this.$element.offset()
  27121. return (this.pinnedOffset = position.top - scrollTop)
  27122. }
  27123. Affix.prototype.checkPositionWithEventLoop = function () {
  27124. setTimeout($.proxy(this.checkPosition, this), 1)
  27125. }
  27126. Affix.prototype.checkPosition = function () {
  27127. if (!this.$element.is(':visible')) return
  27128. var height = this.$element.height()
  27129. var offset = this.options.offset
  27130. var offsetTop = offset.top
  27131. var offsetBottom = offset.bottom
  27132. var scrollHeight = Math.max($(document).height(), $(document.body).height())
  27133. if (typeof offset != 'object') offsetBottom = offsetTop = offset
  27134. if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
  27135. if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
  27136. var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)
  27137. if (this.affixed != affix) {
  27138. if (this.unpin != null) this.$element.css('top', '')
  27139. var affixType = 'affix' + (affix ? '-' + affix : '')
  27140. var e = $.Event(affixType + '.bs.affix')
  27141. this.$element.trigger(e)
  27142. if (e.isDefaultPrevented()) return
  27143. this.affixed = affix
  27144. this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
  27145. this.$element
  27146. .removeClass(Affix.RESET)
  27147. .addClass(affixType)
  27148. .trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
  27149. }
  27150. if (affix == 'bottom') {
  27151. this.$element.offset({
  27152. top: scrollHeight - height - offsetBottom
  27153. })
  27154. }
  27155. }
  27156. // AFFIX PLUGIN DEFINITION
  27157. // =======================
  27158. function Plugin(option) {
  27159. return this.each(function () {
  27160. var $this = $(this)
  27161. var data = $this.data('bs.affix')
  27162. var options = typeof option == 'object' && option
  27163. if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
  27164. if (typeof option == 'string') data[option]()
  27165. })
  27166. }
  27167. var old = $.fn.affix
  27168. $.fn.affix = Plugin
  27169. $.fn.affix.Constructor = Affix
  27170. // AFFIX NO CONFLICT
  27171. // =================
  27172. $.fn.affix.noConflict = function () {
  27173. $.fn.affix = old
  27174. return this
  27175. }
  27176. // AFFIX DATA-API
  27177. // ==============
  27178. $(window).on('load', function () {
  27179. $('[data-spy="affix"]').each(function () {
  27180. var $spy = $(this)
  27181. var data = $spy.data()
  27182. data.offset = data.offset || {}
  27183. if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
  27184. if (data.offsetTop != null) data.offset.top = data.offsetTop
  27185. Plugin.call($spy, data)
  27186. })
  27187. })
  27188. }(jQuery);
  27189. /***/ }),
  27190. /* 16 */
  27191. /***/ (function(module, exports, __webpack_require__) {
  27192. module.exports = __webpack_require__(17);
  27193. /***/ }),
  27194. /* 17 */
  27195. /***/ (function(module, exports, __webpack_require__) {
  27196. "use strict";
  27197. var utils = __webpack_require__(0);
  27198. var bind = __webpack_require__(3);
  27199. var Axios = __webpack_require__(19);
  27200. var defaults = __webpack_require__(2);
  27201. /**
  27202. * Create an instance of Axios
  27203. *
  27204. * @param {Object} defaultConfig The default config for the instance
  27205. * @return {Axios} A new instance of Axios
  27206. */
  27207. function createInstance(defaultConfig) {
  27208. var context = new Axios(defaultConfig);
  27209. var instance = bind(Axios.prototype.request, context);
  27210. // Copy axios.prototype to instance
  27211. utils.extend(instance, Axios.prototype, context);
  27212. // Copy context to instance
  27213. utils.extend(instance, context);
  27214. return instance;
  27215. }
  27216. // Create the default instance to be exported
  27217. var axios = createInstance(defaults);
  27218. // Expose Axios class to allow class inheritance
  27219. axios.Axios = Axios;
  27220. // Factory for creating new instances
  27221. axios.create = function create(instanceConfig) {
  27222. return createInstance(utils.merge(defaults, instanceConfig));
  27223. };
  27224. // Expose Cancel & CancelToken
  27225. axios.Cancel = __webpack_require__(8);
  27226. axios.CancelToken = __webpack_require__(33);
  27227. axios.isCancel = __webpack_require__(7);
  27228. // Expose all/spread
  27229. axios.all = function all(promises) {
  27230. return Promise.all(promises);
  27231. };
  27232. axios.spread = __webpack_require__(34);
  27233. module.exports = axios;
  27234. // Allow use of default import syntax in TypeScript
  27235. module.exports.default = axios;
  27236. /***/ }),
  27237. /* 18 */
  27238. /***/ (function(module, exports) {
  27239. /*!
  27240. * Determine if an object is a Buffer
  27241. *
  27242. * @author Feross Aboukhadijeh <https://feross.org>
  27243. * @license MIT
  27244. */
  27245. // The _isBuffer check is for Safari 5-7 support, because it's missing
  27246. // Object.prototype.constructor. Remove this eventually
  27247. module.exports = function (obj) {
  27248. return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
  27249. }
  27250. function isBuffer (obj) {
  27251. return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
  27252. }
  27253. // For Node v0.10 support. Remove this eventually.
  27254. function isSlowBuffer (obj) {
  27255. return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
  27256. }
  27257. /***/ }),
  27258. /* 19 */
  27259. /***/ (function(module, exports, __webpack_require__) {
  27260. "use strict";
  27261. var defaults = __webpack_require__(2);
  27262. var utils = __webpack_require__(0);
  27263. var InterceptorManager = __webpack_require__(28);
  27264. var dispatchRequest = __webpack_require__(29);
  27265. var isAbsoluteURL = __webpack_require__(31);
  27266. var combineURLs = __webpack_require__(32);
  27267. /**
  27268. * Create a new instance of Axios
  27269. *
  27270. * @param {Object} instanceConfig The default config for the instance
  27271. */
  27272. function Axios(instanceConfig) {
  27273. this.defaults = instanceConfig;
  27274. this.interceptors = {
  27275. request: new InterceptorManager(),
  27276. response: new InterceptorManager()
  27277. };
  27278. }
  27279. /**
  27280. * Dispatch a request
  27281. *
  27282. * @param {Object} config The config specific for this request (merged with this.defaults)
  27283. */
  27284. Axios.prototype.request = function request(config) {
  27285. /*eslint no-param-reassign:0*/
  27286. // Allow for axios('example/url'[, config]) a la fetch API
  27287. if (typeof config === 'string') {
  27288. config = utils.merge({
  27289. url: arguments[0]
  27290. }, arguments[1]);
  27291. }
  27292. config = utils.merge(defaults, this.defaults, { method: 'get' }, config);
  27293. config.method = config.method.toLowerCase();
  27294. // Support baseURL config
  27295. if (config.baseURL && !isAbsoluteURL(config.url)) {
  27296. config.url = combineURLs(config.baseURL, config.url);
  27297. }
  27298. // Hook up interceptors middleware
  27299. var chain = [dispatchRequest, undefined];
  27300. var promise = Promise.resolve(config);
  27301. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  27302. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  27303. });
  27304. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  27305. chain.push(interceptor.fulfilled, interceptor.rejected);
  27306. });
  27307. while (chain.length) {
  27308. promise = promise.then(chain.shift(), chain.shift());
  27309. }
  27310. return promise;
  27311. };
  27312. // Provide aliases for supported request methods
  27313. utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  27314. /*eslint func-names:0*/
  27315. Axios.prototype[method] = function(url, config) {
  27316. return this.request(utils.merge(config || {}, {
  27317. method: method,
  27318. url: url
  27319. }));
  27320. };
  27321. });
  27322. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  27323. /*eslint func-names:0*/
  27324. Axios.prototype[method] = function(url, data, config) {
  27325. return this.request(utils.merge(config || {}, {
  27326. method: method,
  27327. url: url,
  27328. data: data
  27329. }));
  27330. };
  27331. });
  27332. module.exports = Axios;
  27333. /***/ }),
  27334. /* 20 */
  27335. /***/ (function(module, exports, __webpack_require__) {
  27336. "use strict";
  27337. var utils = __webpack_require__(0);
  27338. module.exports = function normalizeHeaderName(headers, normalizedName) {
  27339. utils.forEach(headers, function processHeader(value, name) {
  27340. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  27341. headers[normalizedName] = value;
  27342. delete headers[name];
  27343. }
  27344. });
  27345. };
  27346. /***/ }),
  27347. /* 21 */
  27348. /***/ (function(module, exports, __webpack_require__) {
  27349. "use strict";
  27350. var createError = __webpack_require__(6);
  27351. /**
  27352. * Resolve or reject a Promise based on response status.
  27353. *
  27354. * @param {Function} resolve A function that resolves the promise.
  27355. * @param {Function} reject A function that rejects the promise.
  27356. * @param {object} response The response.
  27357. */
  27358. module.exports = function settle(resolve, reject, response) {
  27359. var validateStatus = response.config.validateStatus;
  27360. // Note: status is not exposed by XDomainRequest
  27361. if (!response.status || !validateStatus || validateStatus(response.status)) {
  27362. resolve(response);
  27363. } else {
  27364. reject(createError(
  27365. 'Request failed with status code ' + response.status,
  27366. response.config,
  27367. null,
  27368. response.request,
  27369. response
  27370. ));
  27371. }
  27372. };
  27373. /***/ }),
  27374. /* 22 */
  27375. /***/ (function(module, exports, __webpack_require__) {
  27376. "use strict";
  27377. /**
  27378. * Update an Error with the specified config, error code, and response.
  27379. *
  27380. * @param {Error} error The error to update.
  27381. * @param {Object} config The config.
  27382. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  27383. * @param {Object} [request] The request.
  27384. * @param {Object} [response] The response.
  27385. * @returns {Error} The error.
  27386. */
  27387. module.exports = function enhanceError(error, config, code, request, response) {
  27388. error.config = config;
  27389. if (code) {
  27390. error.code = code;
  27391. }
  27392. error.request = request;
  27393. error.response = response;
  27394. return error;
  27395. };
  27396. /***/ }),
  27397. /* 23 */
  27398. /***/ (function(module, exports, __webpack_require__) {
  27399. "use strict";
  27400. var utils = __webpack_require__(0);
  27401. function encode(val) {
  27402. return encodeURIComponent(val).
  27403. replace(/%40/gi, '@').
  27404. replace(/%3A/gi, ':').
  27405. replace(/%24/g, '$').
  27406. replace(/%2C/gi, ',').
  27407. replace(/%20/g, '+').
  27408. replace(/%5B/gi, '[').
  27409. replace(/%5D/gi, ']');
  27410. }
  27411. /**
  27412. * Build a URL by appending params to the end
  27413. *
  27414. * @param {string} url The base of the url (e.g., http://www.google.com)
  27415. * @param {object} [params] The params to be appended
  27416. * @returns {string} The formatted url
  27417. */
  27418. module.exports = function buildURL(url, params, paramsSerializer) {
  27419. /*eslint no-param-reassign:0*/
  27420. if (!params) {
  27421. return url;
  27422. }
  27423. var serializedParams;
  27424. if (paramsSerializer) {
  27425. serializedParams = paramsSerializer(params);
  27426. } else if (utils.isURLSearchParams(params)) {
  27427. serializedParams = params.toString();
  27428. } else {
  27429. var parts = [];
  27430. utils.forEach(params, function serialize(val, key) {
  27431. if (val === null || typeof val === 'undefined') {
  27432. return;
  27433. }
  27434. if (utils.isArray(val)) {
  27435. key = key + '[]';
  27436. }
  27437. if (!utils.isArray(val)) {
  27438. val = [val];
  27439. }
  27440. utils.forEach(val, function parseValue(v) {
  27441. if (utils.isDate(v)) {
  27442. v = v.toISOString();
  27443. } else if (utils.isObject(v)) {
  27444. v = JSON.stringify(v);
  27445. }
  27446. parts.push(encode(key) + '=' + encode(v));
  27447. });
  27448. });
  27449. serializedParams = parts.join('&');
  27450. }
  27451. if (serializedParams) {
  27452. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  27453. }
  27454. return url;
  27455. };
  27456. /***/ }),
  27457. /* 24 */
  27458. /***/ (function(module, exports, __webpack_require__) {
  27459. "use strict";
  27460. var utils = __webpack_require__(0);
  27461. /**
  27462. * Parse headers into an object
  27463. *
  27464. * ```
  27465. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  27466. * Content-Type: application/json
  27467. * Connection: keep-alive
  27468. * Transfer-Encoding: chunked
  27469. * ```
  27470. *
  27471. * @param {String} headers Headers needing to be parsed
  27472. * @returns {Object} Headers parsed into an object
  27473. */
  27474. module.exports = function parseHeaders(headers) {
  27475. var parsed = {};
  27476. var key;
  27477. var val;
  27478. var i;
  27479. if (!headers) { return parsed; }
  27480. utils.forEach(headers.split('\n'), function parser(line) {
  27481. i = line.indexOf(':');
  27482. key = utils.trim(line.substr(0, i)).toLowerCase();
  27483. val = utils.trim(line.substr(i + 1));
  27484. if (key) {
  27485. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  27486. }
  27487. });
  27488. return parsed;
  27489. };
  27490. /***/ }),
  27491. /* 25 */
  27492. /***/ (function(module, exports, __webpack_require__) {
  27493. "use strict";
  27494. var utils = __webpack_require__(0);
  27495. module.exports = (
  27496. utils.isStandardBrowserEnv() ?
  27497. // Standard browser envs have full support of the APIs needed to test
  27498. // whether the request URL is of the same origin as current location.
  27499. (function standardBrowserEnv() {
  27500. var msie = /(msie|trident)/i.test(navigator.userAgent);
  27501. var urlParsingNode = document.createElement('a');
  27502. var originURL;
  27503. /**
  27504. * Parse a URL to discover it's components
  27505. *
  27506. * @param {String} url The URL to be parsed
  27507. * @returns {Object}
  27508. */
  27509. function resolveURL(url) {
  27510. var href = url;
  27511. if (msie) {
  27512. // IE needs attribute set twice to normalize properties
  27513. urlParsingNode.setAttribute('href', href);
  27514. href = urlParsingNode.href;
  27515. }
  27516. urlParsingNode.setAttribute('href', href);
  27517. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  27518. return {
  27519. href: urlParsingNode.href,
  27520. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  27521. host: urlParsingNode.host,
  27522. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  27523. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  27524. hostname: urlParsingNode.hostname,
  27525. port: urlParsingNode.port,
  27526. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  27527. urlParsingNode.pathname :
  27528. '/' + urlParsingNode.pathname
  27529. };
  27530. }
  27531. originURL = resolveURL(window.location.href);
  27532. /**
  27533. * Determine if a URL shares the same origin as the current location
  27534. *
  27535. * @param {String} requestURL The URL to test
  27536. * @returns {boolean} True if URL shares the same origin, otherwise false
  27537. */
  27538. return function isURLSameOrigin(requestURL) {
  27539. var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  27540. return (parsed.protocol === originURL.protocol &&
  27541. parsed.host === originURL.host);
  27542. };
  27543. })() :
  27544. // Non standard browser envs (web workers, react-native) lack needed support.
  27545. (function nonStandardBrowserEnv() {
  27546. return function isURLSameOrigin() {
  27547. return true;
  27548. };
  27549. })()
  27550. );
  27551. /***/ }),
  27552. /* 26 */
  27553. /***/ (function(module, exports, __webpack_require__) {
  27554. "use strict";
  27555. // btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
  27556. var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  27557. function E() {
  27558. this.message = 'String contains an invalid character';
  27559. }
  27560. E.prototype = new Error;
  27561. E.prototype.code = 5;
  27562. E.prototype.name = 'InvalidCharacterError';
  27563. function btoa(input) {
  27564. var str = String(input);
  27565. var output = '';
  27566. for (
  27567. // initialize result and counter
  27568. var block, charCode, idx = 0, map = chars;
  27569. // if the next str index does not exist:
  27570. // change the mapping table to "="
  27571. // check if d has no fractional digits
  27572. str.charAt(idx | 0) || (map = '=', idx % 1);
  27573. // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
  27574. output += map.charAt(63 & block >> 8 - idx % 1 * 8)
  27575. ) {
  27576. charCode = str.charCodeAt(idx += 3 / 4);
  27577. if (charCode > 0xFF) {
  27578. throw new E();
  27579. }
  27580. block = block << 8 | charCode;
  27581. }
  27582. return output;
  27583. }
  27584. module.exports = btoa;
  27585. /***/ }),
  27586. /* 27 */
  27587. /***/ (function(module, exports, __webpack_require__) {
  27588. "use strict";
  27589. var utils = __webpack_require__(0);
  27590. module.exports = (
  27591. utils.isStandardBrowserEnv() ?
  27592. // Standard browser envs support document.cookie
  27593. (function standardBrowserEnv() {
  27594. return {
  27595. write: function write(name, value, expires, path, domain, secure) {
  27596. var cookie = [];
  27597. cookie.push(name + '=' + encodeURIComponent(value));
  27598. if (utils.isNumber(expires)) {
  27599. cookie.push('expires=' + new Date(expires).toGMTString());
  27600. }
  27601. if (utils.isString(path)) {
  27602. cookie.push('path=' + path);
  27603. }
  27604. if (utils.isString(domain)) {
  27605. cookie.push('domain=' + domain);
  27606. }
  27607. if (secure === true) {
  27608. cookie.push('secure');
  27609. }
  27610. document.cookie = cookie.join('; ');
  27611. },
  27612. read: function read(name) {
  27613. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  27614. return (match ? decodeURIComponent(match[3]) : null);
  27615. },
  27616. remove: function remove(name) {
  27617. this.write(name, '', Date.now() - 86400000);
  27618. }
  27619. };
  27620. })() :
  27621. // Non standard browser env (web workers, react-native) lack needed support.
  27622. (function nonStandardBrowserEnv() {
  27623. return {
  27624. write: function write() {},
  27625. read: function read() { return null; },
  27626. remove: function remove() {}
  27627. };
  27628. })()
  27629. );
  27630. /***/ }),
  27631. /* 28 */
  27632. /***/ (function(module, exports, __webpack_require__) {
  27633. "use strict";
  27634. var utils = __webpack_require__(0);
  27635. function InterceptorManager() {
  27636. this.handlers = [];
  27637. }
  27638. /**
  27639. * Add a new interceptor to the stack
  27640. *
  27641. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  27642. * @param {Function} rejected The function to handle `reject` for a `Promise`
  27643. *
  27644. * @return {Number} An ID used to remove interceptor later
  27645. */
  27646. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  27647. this.handlers.push({
  27648. fulfilled: fulfilled,
  27649. rejected: rejected
  27650. });
  27651. return this.handlers.length - 1;
  27652. };
  27653. /**
  27654. * Remove an interceptor from the stack
  27655. *
  27656. * @param {Number} id The ID that was returned by `use`
  27657. */
  27658. InterceptorManager.prototype.eject = function eject(id) {
  27659. if (this.handlers[id]) {
  27660. this.handlers[id] = null;
  27661. }
  27662. };
  27663. /**
  27664. * Iterate over all the registered interceptors
  27665. *
  27666. * This method is particularly useful for skipping over any
  27667. * interceptors that may have become `null` calling `eject`.
  27668. *
  27669. * @param {Function} fn The function to call for each interceptor
  27670. */
  27671. InterceptorManager.prototype.forEach = function forEach(fn) {
  27672. utils.forEach(this.handlers, function forEachHandler(h) {
  27673. if (h !== null) {
  27674. fn(h);
  27675. }
  27676. });
  27677. };
  27678. module.exports = InterceptorManager;
  27679. /***/ }),
  27680. /* 29 */
  27681. /***/ (function(module, exports, __webpack_require__) {
  27682. "use strict";
  27683. var utils = __webpack_require__(0);
  27684. var transformData = __webpack_require__(30);
  27685. var isCancel = __webpack_require__(7);
  27686. var defaults = __webpack_require__(2);
  27687. /**
  27688. * Throws a `Cancel` if cancellation has been requested.
  27689. */
  27690. function throwIfCancellationRequested(config) {
  27691. if (config.cancelToken) {
  27692. config.cancelToken.throwIfRequested();
  27693. }
  27694. }
  27695. /**
  27696. * Dispatch a request to the server using the configured adapter.
  27697. *
  27698. * @param {object} config The config that is to be used for the request
  27699. * @returns {Promise} The Promise to be fulfilled
  27700. */
  27701. module.exports = function dispatchRequest(config) {
  27702. throwIfCancellationRequested(config);
  27703. // Ensure headers exist
  27704. config.headers = config.headers || {};
  27705. // Transform request data
  27706. config.data = transformData(
  27707. config.data,
  27708. config.headers,
  27709. config.transformRequest
  27710. );
  27711. // Flatten headers
  27712. config.headers = utils.merge(
  27713. config.headers.common || {},
  27714. config.headers[config.method] || {},
  27715. config.headers || {}
  27716. );
  27717. utils.forEach(
  27718. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  27719. function cleanHeaderConfig(method) {
  27720. delete config.headers[method];
  27721. }
  27722. );
  27723. var adapter = config.adapter || defaults.adapter;
  27724. return adapter(config).then(function onAdapterResolution(response) {
  27725. throwIfCancellationRequested(config);
  27726. // Transform response data
  27727. response.data = transformData(
  27728. response.data,
  27729. response.headers,
  27730. config.transformResponse
  27731. );
  27732. return response;
  27733. }, function onAdapterRejection(reason) {
  27734. if (!isCancel(reason)) {
  27735. throwIfCancellationRequested(config);
  27736. // Transform response data
  27737. if (reason && reason.response) {
  27738. reason.response.data = transformData(
  27739. reason.response.data,
  27740. reason.response.headers,
  27741. config.transformResponse
  27742. );
  27743. }
  27744. }
  27745. return Promise.reject(reason);
  27746. });
  27747. };
  27748. /***/ }),
  27749. /* 30 */
  27750. /***/ (function(module, exports, __webpack_require__) {
  27751. "use strict";
  27752. var utils = __webpack_require__(0);
  27753. /**
  27754. * Transform the data for a request or a response
  27755. *
  27756. * @param {Object|String} data The data to be transformed
  27757. * @param {Array} headers The headers for the request or response
  27758. * @param {Array|Function} fns A single function or Array of functions
  27759. * @returns {*} The resulting transformed data
  27760. */
  27761. module.exports = function transformData(data, headers, fns) {
  27762. /*eslint no-param-reassign:0*/
  27763. utils.forEach(fns, function transform(fn) {
  27764. data = fn(data, headers);
  27765. });
  27766. return data;
  27767. };
  27768. /***/ }),
  27769. /* 31 */
  27770. /***/ (function(module, exports, __webpack_require__) {
  27771. "use strict";
  27772. /**
  27773. * Determines whether the specified URL is absolute
  27774. *
  27775. * @param {string} url The URL to test
  27776. * @returns {boolean} True if the specified URL is absolute, otherwise false
  27777. */
  27778. module.exports = function isAbsoluteURL(url) {
  27779. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  27780. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  27781. // by any combination of letters, digits, plus, period, or hyphen.
  27782. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  27783. };
  27784. /***/ }),
  27785. /* 32 */
  27786. /***/ (function(module, exports, __webpack_require__) {
  27787. "use strict";
  27788. /**
  27789. * Creates a new URL by combining the specified URLs
  27790. *
  27791. * @param {string} baseURL The base URL
  27792. * @param {string} relativeURL The relative URL
  27793. * @returns {string} The combined URL
  27794. */
  27795. module.exports = function combineURLs(baseURL, relativeURL) {
  27796. return relativeURL
  27797. ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
  27798. : baseURL;
  27799. };
  27800. /***/ }),
  27801. /* 33 */
  27802. /***/ (function(module, exports, __webpack_require__) {
  27803. "use strict";
  27804. var Cancel = __webpack_require__(8);
  27805. /**
  27806. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  27807. *
  27808. * @class
  27809. * @param {Function} executor The executor function.
  27810. */
  27811. function CancelToken(executor) {
  27812. if (typeof executor !== 'function') {
  27813. throw new TypeError('executor must be a function.');
  27814. }
  27815. var resolvePromise;
  27816. this.promise = new Promise(function promiseExecutor(resolve) {
  27817. resolvePromise = resolve;
  27818. });
  27819. var token = this;
  27820. executor(function cancel(message) {
  27821. if (token.reason) {
  27822. // Cancellation has already been requested
  27823. return;
  27824. }
  27825. token.reason = new Cancel(message);
  27826. resolvePromise(token.reason);
  27827. });
  27828. }
  27829. /**
  27830. * Throws a `Cancel` if cancellation has been requested.
  27831. */
  27832. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  27833. if (this.reason) {
  27834. throw this.reason;
  27835. }
  27836. };
  27837. /**
  27838. * Returns an object that contains a new `CancelToken` and a function that, when called,
  27839. * cancels the `CancelToken`.
  27840. */
  27841. CancelToken.source = function source() {
  27842. var cancel;
  27843. var token = new CancelToken(function executor(c) {
  27844. cancel = c;
  27845. });
  27846. return {
  27847. token: token,
  27848. cancel: cancel
  27849. };
  27850. };
  27851. module.exports = CancelToken;
  27852. /***/ }),
  27853. /* 34 */
  27854. /***/ (function(module, exports, __webpack_require__) {
  27855. "use strict";
  27856. /**
  27857. * Syntactic sugar for invoking a function and expanding an array for arguments.
  27858. *
  27859. * Common use case would be to use `Function.prototype.apply`.
  27860. *
  27861. * ```js
  27862. * function f(x, y, z) {}
  27863. * var args = [1, 2, 3];
  27864. * f.apply(null, args);
  27865. * ```
  27866. *
  27867. * With `spread` this example can be re-written.
  27868. *
  27869. * ```js
  27870. * spread(function(x, y, z) {})([1, 2, 3]);
  27871. * ```
  27872. *
  27873. * @param {Function} callback
  27874. * @returns {Function}
  27875. */
  27876. module.exports = function spread(callback) {
  27877. return function wrap(arr) {
  27878. return callback.apply(null, arr);
  27879. };
  27880. };
  27881. /***/ }),
  27882. /* 35 */
  27883. /***/ (function(module, exports, __webpack_require__) {
  27884. "use strict";
  27885. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  27886. * Vue.js v2.5.13
  27887. * (c) 2014-2017 Evan You
  27888. * Released under the MIT License.
  27889. */
  27890. /* */
  27891. var emptyObject = Object.freeze({});
  27892. // these helpers produces better vm code in JS engines due to their
  27893. // explicitness and function inlining
  27894. function isUndef (v) {
  27895. return v === undefined || v === null
  27896. }
  27897. function isDef (v) {
  27898. return v !== undefined && v !== null
  27899. }
  27900. function isTrue (v) {
  27901. return v === true
  27902. }
  27903. function isFalse (v) {
  27904. return v === false
  27905. }
  27906. /**
  27907. * Check if value is primitive
  27908. */
  27909. function isPrimitive (value) {
  27910. return (
  27911. typeof value === 'string' ||
  27912. typeof value === 'number' ||
  27913. // $flow-disable-line
  27914. typeof value === 'symbol' ||
  27915. typeof value === 'boolean'
  27916. )
  27917. }
  27918. /**
  27919. * Quick object check - this is primarily used to tell
  27920. * Objects from primitive values when we know the value
  27921. * is a JSON-compliant type.
  27922. */
  27923. function isObject (obj) {
  27924. return obj !== null && typeof obj === 'object'
  27925. }
  27926. /**
  27927. * Get the raw type string of a value e.g. [object Object]
  27928. */
  27929. var _toString = Object.prototype.toString;
  27930. function toRawType (value) {
  27931. return _toString.call(value).slice(8, -1)
  27932. }
  27933. /**
  27934. * Strict object type check. Only returns true
  27935. * for plain JavaScript objects.
  27936. */
  27937. function isPlainObject (obj) {
  27938. return _toString.call(obj) === '[object Object]'
  27939. }
  27940. function isRegExp (v) {
  27941. return _toString.call(v) === '[object RegExp]'
  27942. }
  27943. /**
  27944. * Check if val is a valid array index.
  27945. */
  27946. function isValidArrayIndex (val) {
  27947. var n = parseFloat(String(val));
  27948. return n >= 0 && Math.floor(n) === n && isFinite(val)
  27949. }
  27950. /**
  27951. * Convert a value to a string that is actually rendered.
  27952. */
  27953. function toString (val) {
  27954. return val == null
  27955. ? ''
  27956. : typeof val === 'object'
  27957. ? JSON.stringify(val, null, 2)
  27958. : String(val)
  27959. }
  27960. /**
  27961. * Convert a input value to a number for persistence.
  27962. * If the conversion fails, return original string.
  27963. */
  27964. function toNumber (val) {
  27965. var n = parseFloat(val);
  27966. return isNaN(n) ? val : n
  27967. }
  27968. /**
  27969. * Make a map and return a function for checking if a key
  27970. * is in that map.
  27971. */
  27972. function makeMap (
  27973. str,
  27974. expectsLowerCase
  27975. ) {
  27976. var map = Object.create(null);
  27977. var list = str.split(',');
  27978. for (var i = 0; i < list.length; i++) {
  27979. map[list[i]] = true;
  27980. }
  27981. return expectsLowerCase
  27982. ? function (val) { return map[val.toLowerCase()]; }
  27983. : function (val) { return map[val]; }
  27984. }
  27985. /**
  27986. * Check if a tag is a built-in tag.
  27987. */
  27988. var isBuiltInTag = makeMap('slot,component', true);
  27989. /**
  27990. * Check if a attribute is a reserved attribute.
  27991. */
  27992. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  27993. /**
  27994. * Remove an item from an array
  27995. */
  27996. function remove (arr, item) {
  27997. if (arr.length) {
  27998. var index = arr.indexOf(item);
  27999. if (index > -1) {
  28000. return arr.splice(index, 1)
  28001. }
  28002. }
  28003. }
  28004. /**
  28005. * Check whether the object has the property.
  28006. */
  28007. var hasOwnProperty = Object.prototype.hasOwnProperty;
  28008. function hasOwn (obj, key) {
  28009. return hasOwnProperty.call(obj, key)
  28010. }
  28011. /**
  28012. * Create a cached version of a pure function.
  28013. */
  28014. function cached (fn) {
  28015. var cache = Object.create(null);
  28016. return (function cachedFn (str) {
  28017. var hit = cache[str];
  28018. return hit || (cache[str] = fn(str))
  28019. })
  28020. }
  28021. /**
  28022. * Camelize a hyphen-delimited string.
  28023. */
  28024. var camelizeRE = /-(\w)/g;
  28025. var camelize = cached(function (str) {
  28026. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  28027. });
  28028. /**
  28029. * Capitalize a string.
  28030. */
  28031. var capitalize = cached(function (str) {
  28032. return str.charAt(0).toUpperCase() + str.slice(1)
  28033. });
  28034. /**
  28035. * Hyphenate a camelCase string.
  28036. */
  28037. var hyphenateRE = /\B([A-Z])/g;
  28038. var hyphenate = cached(function (str) {
  28039. return str.replace(hyphenateRE, '-$1').toLowerCase()
  28040. });
  28041. /**
  28042. * Simple bind, faster than native
  28043. */
  28044. function bind (fn, ctx) {
  28045. function boundFn (a) {
  28046. var l = arguments.length;
  28047. return l
  28048. ? l > 1
  28049. ? fn.apply(ctx, arguments)
  28050. : fn.call(ctx, a)
  28051. : fn.call(ctx)
  28052. }
  28053. // record original fn length
  28054. boundFn._length = fn.length;
  28055. return boundFn
  28056. }
  28057. /**
  28058. * Convert an Array-like object to a real Array.
  28059. */
  28060. function toArray (list, start) {
  28061. start = start || 0;
  28062. var i = list.length - start;
  28063. var ret = new Array(i);
  28064. while (i--) {
  28065. ret[i] = list[i + start];
  28066. }
  28067. return ret
  28068. }
  28069. /**
  28070. * Mix properties into target object.
  28071. */
  28072. function extend (to, _from) {
  28073. for (var key in _from) {
  28074. to[key] = _from[key];
  28075. }
  28076. return to
  28077. }
  28078. /**
  28079. * Merge an Array of Objects into a single Object.
  28080. */
  28081. function toObject (arr) {
  28082. var res = {};
  28083. for (var i = 0; i < arr.length; i++) {
  28084. if (arr[i]) {
  28085. extend(res, arr[i]);
  28086. }
  28087. }
  28088. return res
  28089. }
  28090. /**
  28091. * Perform no operation.
  28092. * Stubbing args to make Flow happy without leaving useless transpiled code
  28093. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/)
  28094. */
  28095. function noop (a, b, c) {}
  28096. /**
  28097. * Always return false.
  28098. */
  28099. var no = function (a, b, c) { return false; };
  28100. /**
  28101. * Return same value
  28102. */
  28103. var identity = function (_) { return _; };
  28104. /**
  28105. * Generate a static keys string from compiler modules.
  28106. */
  28107. function genStaticKeys (modules) {
  28108. return modules.reduce(function (keys, m) {
  28109. return keys.concat(m.staticKeys || [])
  28110. }, []).join(',')
  28111. }
  28112. /**
  28113. * Check if two values are loosely equal - that is,
  28114. * if they are plain objects, do they have the same shape?
  28115. */
  28116. function looseEqual (a, b) {
  28117. if (a === b) { return true }
  28118. var isObjectA = isObject(a);
  28119. var isObjectB = isObject(b);
  28120. if (isObjectA && isObjectB) {
  28121. try {
  28122. var isArrayA = Array.isArray(a);
  28123. var isArrayB = Array.isArray(b);
  28124. if (isArrayA && isArrayB) {
  28125. return a.length === b.length && a.every(function (e, i) {
  28126. return looseEqual(e, b[i])
  28127. })
  28128. } else if (!isArrayA && !isArrayB) {
  28129. var keysA = Object.keys(a);
  28130. var keysB = Object.keys(b);
  28131. return keysA.length === keysB.length && keysA.every(function (key) {
  28132. return looseEqual(a[key], b[key])
  28133. })
  28134. } else {
  28135. /* istanbul ignore next */
  28136. return false
  28137. }
  28138. } catch (e) {
  28139. /* istanbul ignore next */
  28140. return false
  28141. }
  28142. } else if (!isObjectA && !isObjectB) {
  28143. return String(a) === String(b)
  28144. } else {
  28145. return false
  28146. }
  28147. }
  28148. function looseIndexOf (arr, val) {
  28149. for (var i = 0; i < arr.length; i++) {
  28150. if (looseEqual(arr[i], val)) { return i }
  28151. }
  28152. return -1
  28153. }
  28154. /**
  28155. * Ensure a function is called only once.
  28156. */
  28157. function once (fn) {
  28158. var called = false;
  28159. return function () {
  28160. if (!called) {
  28161. called = true;
  28162. fn.apply(this, arguments);
  28163. }
  28164. }
  28165. }
  28166. var SSR_ATTR = 'data-server-rendered';
  28167. var ASSET_TYPES = [
  28168. 'component',
  28169. 'directive',
  28170. 'filter'
  28171. ];
  28172. var LIFECYCLE_HOOKS = [
  28173. 'beforeCreate',
  28174. 'created',
  28175. 'beforeMount',
  28176. 'mounted',
  28177. 'beforeUpdate',
  28178. 'updated',
  28179. 'beforeDestroy',
  28180. 'destroyed',
  28181. 'activated',
  28182. 'deactivated',
  28183. 'errorCaptured'
  28184. ];
  28185. /* */
  28186. var config = ({
  28187. /**
  28188. * Option merge strategies (used in core/util/options)
  28189. */
  28190. // $flow-disable-line
  28191. optionMergeStrategies: Object.create(null),
  28192. /**
  28193. * Whether to suppress warnings.
  28194. */
  28195. silent: false,
  28196. /**
  28197. * Show production mode tip message on boot?
  28198. */
  28199. productionTip: "development" !== 'production',
  28200. /**
  28201. * Whether to enable devtools
  28202. */
  28203. devtools: "development" !== 'production',
  28204. /**
  28205. * Whether to record perf
  28206. */
  28207. performance: false,
  28208. /**
  28209. * Error handler for watcher errors
  28210. */
  28211. errorHandler: null,
  28212. /**
  28213. * Warn handler for watcher warns
  28214. */
  28215. warnHandler: null,
  28216. /**
  28217. * Ignore certain custom elements
  28218. */
  28219. ignoredElements: [],
  28220. /**
  28221. * Custom user key aliases for v-on
  28222. */
  28223. // $flow-disable-line
  28224. keyCodes: Object.create(null),
  28225. /**
  28226. * Check if a tag is reserved so that it cannot be registered as a
  28227. * component. This is platform-dependent and may be overwritten.
  28228. */
  28229. isReservedTag: no,
  28230. /**
  28231. * Check if an attribute is reserved so that it cannot be used as a component
  28232. * prop. This is platform-dependent and may be overwritten.
  28233. */
  28234. isReservedAttr: no,
  28235. /**
  28236. * Check if a tag is an unknown element.
  28237. * Platform-dependent.
  28238. */
  28239. isUnknownElement: no,
  28240. /**
  28241. * Get the namespace of an element
  28242. */
  28243. getTagNamespace: noop,
  28244. /**
  28245. * Parse the real tag name for the specific platform.
  28246. */
  28247. parsePlatformTagName: identity,
  28248. /**
  28249. * Check if an attribute must be bound using property, e.g. value
  28250. * Platform-dependent.
  28251. */
  28252. mustUseProp: no,
  28253. /**
  28254. * Exposed for legacy reasons
  28255. */
  28256. _lifecycleHooks: LIFECYCLE_HOOKS
  28257. });
  28258. /* */
  28259. /**
  28260. * Check if a string starts with $ or _
  28261. */
  28262. function isReserved (str) {
  28263. var c = (str + '').charCodeAt(0);
  28264. return c === 0x24 || c === 0x5F
  28265. }
  28266. /**
  28267. * Define a property.
  28268. */
  28269. function def (obj, key, val, enumerable) {
  28270. Object.defineProperty(obj, key, {
  28271. value: val,
  28272. enumerable: !!enumerable,
  28273. writable: true,
  28274. configurable: true
  28275. });
  28276. }
  28277. /**
  28278. * Parse simple path.
  28279. */
  28280. var bailRE = /[^\w.$]/;
  28281. function parsePath (path) {
  28282. if (bailRE.test(path)) {
  28283. return
  28284. }
  28285. var segments = path.split('.');
  28286. return function (obj) {
  28287. for (var i = 0; i < segments.length; i++) {
  28288. if (!obj) { return }
  28289. obj = obj[segments[i]];
  28290. }
  28291. return obj
  28292. }
  28293. }
  28294. /* */
  28295. // can we use __proto__?
  28296. var hasProto = '__proto__' in {};
  28297. // Browser environment sniffing
  28298. var inBrowser = typeof window !== 'undefined';
  28299. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  28300. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  28301. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  28302. var isIE = UA && /msie|trident/.test(UA);
  28303. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  28304. var isEdge = UA && UA.indexOf('edge/') > 0;
  28305. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  28306. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  28307. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  28308. // Firefox has a "watch" function on Object.prototype...
  28309. var nativeWatch = ({}).watch;
  28310. var supportsPassive = false;
  28311. if (inBrowser) {
  28312. try {
  28313. var opts = {};
  28314. Object.defineProperty(opts, 'passive', ({
  28315. get: function get () {
  28316. /* istanbul ignore next */
  28317. supportsPassive = true;
  28318. }
  28319. })); // https://github.com/facebook/flow/issues/285
  28320. window.addEventListener('test-passive', null, opts);
  28321. } catch (e) {}
  28322. }
  28323. // this needs to be lazy-evaled because vue may be required before
  28324. // vue-server-renderer can set VUE_ENV
  28325. var _isServer;
  28326. var isServerRendering = function () {
  28327. if (_isServer === undefined) {
  28328. /* istanbul ignore if */
  28329. if (!inBrowser && typeof global !== 'undefined') {
  28330. // detect presence of vue-server-renderer and avoid
  28331. // Webpack shimming the process
  28332. _isServer = global['process'].env.VUE_ENV === 'server';
  28333. } else {
  28334. _isServer = false;
  28335. }
  28336. }
  28337. return _isServer
  28338. };
  28339. // detect devtools
  28340. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  28341. /* istanbul ignore next */
  28342. function isNative (Ctor) {
  28343. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  28344. }
  28345. var hasSymbol =
  28346. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  28347. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  28348. var _Set;
  28349. /* istanbul ignore if */ // $flow-disable-line
  28350. if (typeof Set !== 'undefined' && isNative(Set)) {
  28351. // use native Set when available.
  28352. _Set = Set;
  28353. } else {
  28354. // a non-standard Set polyfill that only works with primitive keys.
  28355. _Set = (function () {
  28356. function Set () {
  28357. this.set = Object.create(null);
  28358. }
  28359. Set.prototype.has = function has (key) {
  28360. return this.set[key] === true
  28361. };
  28362. Set.prototype.add = function add (key) {
  28363. this.set[key] = true;
  28364. };
  28365. Set.prototype.clear = function clear () {
  28366. this.set = Object.create(null);
  28367. };
  28368. return Set;
  28369. }());
  28370. }
  28371. /* */
  28372. var warn = noop;
  28373. var tip = noop;
  28374. var generateComponentTrace = (noop); // work around flow check
  28375. var formatComponentName = (noop);
  28376. if (true) {
  28377. var hasConsole = typeof console !== 'undefined';
  28378. var classifyRE = /(?:^|[-_])(\w)/g;
  28379. var classify = function (str) { return str
  28380. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  28381. .replace(/[-_]/g, ''); };
  28382. warn = function (msg, vm) {
  28383. var trace = vm ? generateComponentTrace(vm) : '';
  28384. if (config.warnHandler) {
  28385. config.warnHandler.call(null, msg, vm, trace);
  28386. } else if (hasConsole && (!config.silent)) {
  28387. console.error(("[Vue warn]: " + msg + trace));
  28388. }
  28389. };
  28390. tip = function (msg, vm) {
  28391. if (hasConsole && (!config.silent)) {
  28392. console.warn("[Vue tip]: " + msg + (
  28393. vm ? generateComponentTrace(vm) : ''
  28394. ));
  28395. }
  28396. };
  28397. formatComponentName = function (vm, includeFile) {
  28398. if (vm.$root === vm) {
  28399. return '<Root>'
  28400. }
  28401. var options = typeof vm === 'function' && vm.cid != null
  28402. ? vm.options
  28403. : vm._isVue
  28404. ? vm.$options || vm.constructor.options
  28405. : vm || {};
  28406. var name = options.name || options._componentTag;
  28407. var file = options.__file;
  28408. if (!name && file) {
  28409. var match = file.match(/([^/\\]+)\.vue$/);
  28410. name = match && match[1];
  28411. }
  28412. return (
  28413. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  28414. (file && includeFile !== false ? (" at " + file) : '')
  28415. )
  28416. };
  28417. var repeat = function (str, n) {
  28418. var res = '';
  28419. while (n) {
  28420. if (n % 2 === 1) { res += str; }
  28421. if (n > 1) { str += str; }
  28422. n >>= 1;
  28423. }
  28424. return res
  28425. };
  28426. generateComponentTrace = function (vm) {
  28427. if (vm._isVue && vm.$parent) {
  28428. var tree = [];
  28429. var currentRecursiveSequence = 0;
  28430. while (vm) {
  28431. if (tree.length > 0) {
  28432. var last = tree[tree.length - 1];
  28433. if (last.constructor === vm.constructor) {
  28434. currentRecursiveSequence++;
  28435. vm = vm.$parent;
  28436. continue
  28437. } else if (currentRecursiveSequence > 0) {
  28438. tree[tree.length - 1] = [last, currentRecursiveSequence];
  28439. currentRecursiveSequence = 0;
  28440. }
  28441. }
  28442. tree.push(vm);
  28443. vm = vm.$parent;
  28444. }
  28445. return '\n\nfound in\n\n' + tree
  28446. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  28447. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  28448. : formatComponentName(vm))); })
  28449. .join('\n')
  28450. } else {
  28451. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  28452. }
  28453. };
  28454. }
  28455. /* */
  28456. var uid = 0;
  28457. /**
  28458. * A dep is an observable that can have multiple
  28459. * directives subscribing to it.
  28460. */
  28461. var Dep = function Dep () {
  28462. this.id = uid++;
  28463. this.subs = [];
  28464. };
  28465. Dep.prototype.addSub = function addSub (sub) {
  28466. this.subs.push(sub);
  28467. };
  28468. Dep.prototype.removeSub = function removeSub (sub) {
  28469. remove(this.subs, sub);
  28470. };
  28471. Dep.prototype.depend = function depend () {
  28472. if (Dep.target) {
  28473. Dep.target.addDep(this);
  28474. }
  28475. };
  28476. Dep.prototype.notify = function notify () {
  28477. // stabilize the subscriber list first
  28478. var subs = this.subs.slice();
  28479. for (var i = 0, l = subs.length; i < l; i++) {
  28480. subs[i].update();
  28481. }
  28482. };
  28483. // the current target watcher being evaluated.
  28484. // this is globally unique because there could be only one
  28485. // watcher being evaluated at any time.
  28486. Dep.target = null;
  28487. var targetStack = [];
  28488. function pushTarget (_target) {
  28489. if (Dep.target) { targetStack.push(Dep.target); }
  28490. Dep.target = _target;
  28491. }
  28492. function popTarget () {
  28493. Dep.target = targetStack.pop();
  28494. }
  28495. /* */
  28496. var VNode = function VNode (
  28497. tag,
  28498. data,
  28499. children,
  28500. text,
  28501. elm,
  28502. context,
  28503. componentOptions,
  28504. asyncFactory
  28505. ) {
  28506. this.tag = tag;
  28507. this.data = data;
  28508. this.children = children;
  28509. this.text = text;
  28510. this.elm = elm;
  28511. this.ns = undefined;
  28512. this.context = context;
  28513. this.fnContext = undefined;
  28514. this.fnOptions = undefined;
  28515. this.fnScopeId = undefined;
  28516. this.key = data && data.key;
  28517. this.componentOptions = componentOptions;
  28518. this.componentInstance = undefined;
  28519. this.parent = undefined;
  28520. this.raw = false;
  28521. this.isStatic = false;
  28522. this.isRootInsert = true;
  28523. this.isComment = false;
  28524. this.isCloned = false;
  28525. this.isOnce = false;
  28526. this.asyncFactory = asyncFactory;
  28527. this.asyncMeta = undefined;
  28528. this.isAsyncPlaceholder = false;
  28529. };
  28530. var prototypeAccessors = { child: { configurable: true } };
  28531. // DEPRECATED: alias for componentInstance for backwards compat.
  28532. /* istanbul ignore next */
  28533. prototypeAccessors.child.get = function () {
  28534. return this.componentInstance
  28535. };
  28536. Object.defineProperties( VNode.prototype, prototypeAccessors );
  28537. var createEmptyVNode = function (text) {
  28538. if ( text === void 0 ) text = '';
  28539. var node = new VNode();
  28540. node.text = text;
  28541. node.isComment = true;
  28542. return node
  28543. };
  28544. function createTextVNode (val) {
  28545. return new VNode(undefined, undefined, undefined, String(val))
  28546. }
  28547. // optimized shallow clone
  28548. // used for static nodes and slot nodes because they may be reused across
  28549. // multiple renders, cloning them avoids errors when DOM manipulations rely
  28550. // on their elm reference.
  28551. function cloneVNode (vnode, deep) {
  28552. var componentOptions = vnode.componentOptions;
  28553. var cloned = new VNode(
  28554. vnode.tag,
  28555. vnode.data,
  28556. vnode.children,
  28557. vnode.text,
  28558. vnode.elm,
  28559. vnode.context,
  28560. componentOptions,
  28561. vnode.asyncFactory
  28562. );
  28563. cloned.ns = vnode.ns;
  28564. cloned.isStatic = vnode.isStatic;
  28565. cloned.key = vnode.key;
  28566. cloned.isComment = vnode.isComment;
  28567. cloned.fnContext = vnode.fnContext;
  28568. cloned.fnOptions = vnode.fnOptions;
  28569. cloned.fnScopeId = vnode.fnScopeId;
  28570. cloned.isCloned = true;
  28571. if (deep) {
  28572. if (vnode.children) {
  28573. cloned.children = cloneVNodes(vnode.children, true);
  28574. }
  28575. if (componentOptions && componentOptions.children) {
  28576. componentOptions.children = cloneVNodes(componentOptions.children, true);
  28577. }
  28578. }
  28579. return cloned
  28580. }
  28581. function cloneVNodes (vnodes, deep) {
  28582. var len = vnodes.length;
  28583. var res = new Array(len);
  28584. for (var i = 0; i < len; i++) {
  28585. res[i] = cloneVNode(vnodes[i], deep);
  28586. }
  28587. return res
  28588. }
  28589. /*
  28590. * not type checking this file because flow doesn't play well with
  28591. * dynamically accessing methods on Array prototype
  28592. */
  28593. var arrayProto = Array.prototype;
  28594. var arrayMethods = Object.create(arrayProto);[
  28595. 'push',
  28596. 'pop',
  28597. 'shift',
  28598. 'unshift',
  28599. 'splice',
  28600. 'sort',
  28601. 'reverse'
  28602. ].forEach(function (method) {
  28603. // cache original method
  28604. var original = arrayProto[method];
  28605. def(arrayMethods, method, function mutator () {
  28606. var args = [], len = arguments.length;
  28607. while ( len-- ) args[ len ] = arguments[ len ];
  28608. var result = original.apply(this, args);
  28609. var ob = this.__ob__;
  28610. var inserted;
  28611. switch (method) {
  28612. case 'push':
  28613. case 'unshift':
  28614. inserted = args;
  28615. break
  28616. case 'splice':
  28617. inserted = args.slice(2);
  28618. break
  28619. }
  28620. if (inserted) { ob.observeArray(inserted); }
  28621. // notify change
  28622. ob.dep.notify();
  28623. return result
  28624. });
  28625. });
  28626. /* */
  28627. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  28628. /**
  28629. * By default, when a reactive property is set, the new value is
  28630. * also converted to become reactive. However when passing down props,
  28631. * we don't want to force conversion because the value may be a nested value
  28632. * under a frozen data structure. Converting it would defeat the optimization.
  28633. */
  28634. var observerState = {
  28635. shouldConvert: true
  28636. };
  28637. /**
  28638. * Observer class that are attached to each observed
  28639. * object. Once attached, the observer converts target
  28640. * object's property keys into getter/setters that
  28641. * collect dependencies and dispatches updates.
  28642. */
  28643. var Observer = function Observer (value) {
  28644. this.value = value;
  28645. this.dep = new Dep();
  28646. this.vmCount = 0;
  28647. def(value, '__ob__', this);
  28648. if (Array.isArray(value)) {
  28649. var augment = hasProto
  28650. ? protoAugment
  28651. : copyAugment;
  28652. augment(value, arrayMethods, arrayKeys);
  28653. this.observeArray(value);
  28654. } else {
  28655. this.walk(value);
  28656. }
  28657. };
  28658. /**
  28659. * Walk through each property and convert them into
  28660. * getter/setters. This method should only be called when
  28661. * value type is Object.
  28662. */
  28663. Observer.prototype.walk = function walk (obj) {
  28664. var keys = Object.keys(obj);
  28665. for (var i = 0; i < keys.length; i++) {
  28666. defineReactive(obj, keys[i], obj[keys[i]]);
  28667. }
  28668. };
  28669. /**
  28670. * Observe a list of Array items.
  28671. */
  28672. Observer.prototype.observeArray = function observeArray (items) {
  28673. for (var i = 0, l = items.length; i < l; i++) {
  28674. observe(items[i]);
  28675. }
  28676. };
  28677. // helpers
  28678. /**
  28679. * Augment an target Object or Array by intercepting
  28680. * the prototype chain using __proto__
  28681. */
  28682. function protoAugment (target, src, keys) {
  28683. /* eslint-disable no-proto */
  28684. target.__proto__ = src;
  28685. /* eslint-enable no-proto */
  28686. }
  28687. /**
  28688. * Augment an target Object or Array by defining
  28689. * hidden properties.
  28690. */
  28691. /* istanbul ignore next */
  28692. function copyAugment (target, src, keys) {
  28693. for (var i = 0, l = keys.length; i < l; i++) {
  28694. var key = keys[i];
  28695. def(target, key, src[key]);
  28696. }
  28697. }
  28698. /**
  28699. * Attempt to create an observer instance for a value,
  28700. * returns the new observer if successfully observed,
  28701. * or the existing observer if the value already has one.
  28702. */
  28703. function observe (value, asRootData) {
  28704. if (!isObject(value) || value instanceof VNode) {
  28705. return
  28706. }
  28707. var ob;
  28708. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  28709. ob = value.__ob__;
  28710. } else if (
  28711. observerState.shouldConvert &&
  28712. !isServerRendering() &&
  28713. (Array.isArray(value) || isPlainObject(value)) &&
  28714. Object.isExtensible(value) &&
  28715. !value._isVue
  28716. ) {
  28717. ob = new Observer(value);
  28718. }
  28719. if (asRootData && ob) {
  28720. ob.vmCount++;
  28721. }
  28722. return ob
  28723. }
  28724. /**
  28725. * Define a reactive property on an Object.
  28726. */
  28727. function defineReactive (
  28728. obj,
  28729. key,
  28730. val,
  28731. customSetter,
  28732. shallow
  28733. ) {
  28734. var dep = new Dep();
  28735. var property = Object.getOwnPropertyDescriptor(obj, key);
  28736. if (property && property.configurable === false) {
  28737. return
  28738. }
  28739. // cater for pre-defined getter/setters
  28740. var getter = property && property.get;
  28741. var setter = property && property.set;
  28742. var childOb = !shallow && observe(val);
  28743. Object.defineProperty(obj, key, {
  28744. enumerable: true,
  28745. configurable: true,
  28746. get: function reactiveGetter () {
  28747. var value = getter ? getter.call(obj) : val;
  28748. if (Dep.target) {
  28749. dep.depend();
  28750. if (childOb) {
  28751. childOb.dep.depend();
  28752. if (Array.isArray(value)) {
  28753. dependArray(value);
  28754. }
  28755. }
  28756. }
  28757. return value
  28758. },
  28759. set: function reactiveSetter (newVal) {
  28760. var value = getter ? getter.call(obj) : val;
  28761. /* eslint-disable no-self-compare */
  28762. if (newVal === value || (newVal !== newVal && value !== value)) {
  28763. return
  28764. }
  28765. /* eslint-enable no-self-compare */
  28766. if ("development" !== 'production' && customSetter) {
  28767. customSetter();
  28768. }
  28769. if (setter) {
  28770. setter.call(obj, newVal);
  28771. } else {
  28772. val = newVal;
  28773. }
  28774. childOb = !shallow && observe(newVal);
  28775. dep.notify();
  28776. }
  28777. });
  28778. }
  28779. /**
  28780. * Set a property on an object. Adds the new property and
  28781. * triggers change notification if the property doesn't
  28782. * already exist.
  28783. */
  28784. function set (target, key, val) {
  28785. if (Array.isArray(target) && isValidArrayIndex(key)) {
  28786. target.length = Math.max(target.length, key);
  28787. target.splice(key, 1, val);
  28788. return val
  28789. }
  28790. if (key in target && !(key in Object.prototype)) {
  28791. target[key] = val;
  28792. return val
  28793. }
  28794. var ob = (target).__ob__;
  28795. if (target._isVue || (ob && ob.vmCount)) {
  28796. "development" !== 'production' && warn(
  28797. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  28798. 'at runtime - declare it upfront in the data option.'
  28799. );
  28800. return val
  28801. }
  28802. if (!ob) {
  28803. target[key] = val;
  28804. return val
  28805. }
  28806. defineReactive(ob.value, key, val);
  28807. ob.dep.notify();
  28808. return val
  28809. }
  28810. /**
  28811. * Delete a property and trigger change if necessary.
  28812. */
  28813. function del (target, key) {
  28814. if (Array.isArray(target) && isValidArrayIndex(key)) {
  28815. target.splice(key, 1);
  28816. return
  28817. }
  28818. var ob = (target).__ob__;
  28819. if (target._isVue || (ob && ob.vmCount)) {
  28820. "development" !== 'production' && warn(
  28821. 'Avoid deleting properties on a Vue instance or its root $data ' +
  28822. '- just set it to null.'
  28823. );
  28824. return
  28825. }
  28826. if (!hasOwn(target, key)) {
  28827. return
  28828. }
  28829. delete target[key];
  28830. if (!ob) {
  28831. return
  28832. }
  28833. ob.dep.notify();
  28834. }
  28835. /**
  28836. * Collect dependencies on array elements when the array is touched, since
  28837. * we cannot intercept array element access like property getters.
  28838. */
  28839. function dependArray (value) {
  28840. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  28841. e = value[i];
  28842. e && e.__ob__ && e.__ob__.dep.depend();
  28843. if (Array.isArray(e)) {
  28844. dependArray(e);
  28845. }
  28846. }
  28847. }
  28848. /* */
  28849. /**
  28850. * Option overwriting strategies are functions that handle
  28851. * how to merge a parent option value and a child option
  28852. * value into the final value.
  28853. */
  28854. var strats = config.optionMergeStrategies;
  28855. /**
  28856. * Options with restrictions
  28857. */
  28858. if (true) {
  28859. strats.el = strats.propsData = function (parent, child, vm, key) {
  28860. if (!vm) {
  28861. warn(
  28862. "option \"" + key + "\" can only be used during instance " +
  28863. 'creation with the `new` keyword.'
  28864. );
  28865. }
  28866. return defaultStrat(parent, child)
  28867. };
  28868. }
  28869. /**
  28870. * Helper that recursively merges two data objects together.
  28871. */
  28872. function mergeData (to, from) {
  28873. if (!from) { return to }
  28874. var key, toVal, fromVal;
  28875. var keys = Object.keys(from);
  28876. for (var i = 0; i < keys.length; i++) {
  28877. key = keys[i];
  28878. toVal = to[key];
  28879. fromVal = from[key];
  28880. if (!hasOwn(to, key)) {
  28881. set(to, key, fromVal);
  28882. } else if (isPlainObject(toVal) && isPlainObject(fromVal)) {
  28883. mergeData(toVal, fromVal);
  28884. }
  28885. }
  28886. return to
  28887. }
  28888. /**
  28889. * Data
  28890. */
  28891. function mergeDataOrFn (
  28892. parentVal,
  28893. childVal,
  28894. vm
  28895. ) {
  28896. if (!vm) {
  28897. // in a Vue.extend merge, both should be functions
  28898. if (!childVal) {
  28899. return parentVal
  28900. }
  28901. if (!parentVal) {
  28902. return childVal
  28903. }
  28904. // when parentVal & childVal are both present,
  28905. // we need to return a function that returns the
  28906. // merged result of both functions... no need to
  28907. // check if parentVal is a function here because
  28908. // it has to be a function to pass previous merges.
  28909. return function mergedDataFn () {
  28910. return mergeData(
  28911. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  28912. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  28913. )
  28914. }
  28915. } else {
  28916. return function mergedInstanceDataFn () {
  28917. // instance merge
  28918. var instanceData = typeof childVal === 'function'
  28919. ? childVal.call(vm, vm)
  28920. : childVal;
  28921. var defaultData = typeof parentVal === 'function'
  28922. ? parentVal.call(vm, vm)
  28923. : parentVal;
  28924. if (instanceData) {
  28925. return mergeData(instanceData, defaultData)
  28926. } else {
  28927. return defaultData
  28928. }
  28929. }
  28930. }
  28931. }
  28932. strats.data = function (
  28933. parentVal,
  28934. childVal,
  28935. vm
  28936. ) {
  28937. if (!vm) {
  28938. if (childVal && typeof childVal !== 'function') {
  28939. "development" !== 'production' && warn(
  28940. 'The "data" option should be a function ' +
  28941. 'that returns a per-instance value in component ' +
  28942. 'definitions.',
  28943. vm
  28944. );
  28945. return parentVal
  28946. }
  28947. return mergeDataOrFn(parentVal, childVal)
  28948. }
  28949. return mergeDataOrFn(parentVal, childVal, vm)
  28950. };
  28951. /**
  28952. * Hooks and props are merged as arrays.
  28953. */
  28954. function mergeHook (
  28955. parentVal,
  28956. childVal
  28957. ) {
  28958. return childVal
  28959. ? parentVal
  28960. ? parentVal.concat(childVal)
  28961. : Array.isArray(childVal)
  28962. ? childVal
  28963. : [childVal]
  28964. : parentVal
  28965. }
  28966. LIFECYCLE_HOOKS.forEach(function (hook) {
  28967. strats[hook] = mergeHook;
  28968. });
  28969. /**
  28970. * Assets
  28971. *
  28972. * When a vm is present (instance creation), we need to do
  28973. * a three-way merge between constructor options, instance
  28974. * options and parent options.
  28975. */
  28976. function mergeAssets (
  28977. parentVal,
  28978. childVal,
  28979. vm,
  28980. key
  28981. ) {
  28982. var res = Object.create(parentVal || null);
  28983. if (childVal) {
  28984. "development" !== 'production' && assertObjectType(key, childVal, vm);
  28985. return extend(res, childVal)
  28986. } else {
  28987. return res
  28988. }
  28989. }
  28990. ASSET_TYPES.forEach(function (type) {
  28991. strats[type + 's'] = mergeAssets;
  28992. });
  28993. /**
  28994. * Watchers.
  28995. *
  28996. * Watchers hashes should not overwrite one
  28997. * another, so we merge them as arrays.
  28998. */
  28999. strats.watch = function (
  29000. parentVal,
  29001. childVal,
  29002. vm,
  29003. key
  29004. ) {
  29005. // work around Firefox's Object.prototype.watch...
  29006. if (parentVal === nativeWatch) { parentVal = undefined; }
  29007. if (childVal === nativeWatch) { childVal = undefined; }
  29008. /* istanbul ignore if */
  29009. if (!childVal) { return Object.create(parentVal || null) }
  29010. if (true) {
  29011. assertObjectType(key, childVal, vm);
  29012. }
  29013. if (!parentVal) { return childVal }
  29014. var ret = {};
  29015. extend(ret, parentVal);
  29016. for (var key$1 in childVal) {
  29017. var parent = ret[key$1];
  29018. var child = childVal[key$1];
  29019. if (parent && !Array.isArray(parent)) {
  29020. parent = [parent];
  29021. }
  29022. ret[key$1] = parent
  29023. ? parent.concat(child)
  29024. : Array.isArray(child) ? child : [child];
  29025. }
  29026. return ret
  29027. };
  29028. /**
  29029. * Other object hashes.
  29030. */
  29031. strats.props =
  29032. strats.methods =
  29033. strats.inject =
  29034. strats.computed = function (
  29035. parentVal,
  29036. childVal,
  29037. vm,
  29038. key
  29039. ) {
  29040. if (childVal && "development" !== 'production') {
  29041. assertObjectType(key, childVal, vm);
  29042. }
  29043. if (!parentVal) { return childVal }
  29044. var ret = Object.create(null);
  29045. extend(ret, parentVal);
  29046. if (childVal) { extend(ret, childVal); }
  29047. return ret
  29048. };
  29049. strats.provide = mergeDataOrFn;
  29050. /**
  29051. * Default strategy.
  29052. */
  29053. var defaultStrat = function (parentVal, childVal) {
  29054. return childVal === undefined
  29055. ? parentVal
  29056. : childVal
  29057. };
  29058. /**
  29059. * Validate component names
  29060. */
  29061. function checkComponents (options) {
  29062. for (var key in options.components) {
  29063. validateComponentName(key);
  29064. }
  29065. }
  29066. function validateComponentName (name) {
  29067. if (!/^[a-zA-Z][\w-]*$/.test(name)) {
  29068. warn(
  29069. 'Invalid component name: "' + name + '". Component names ' +
  29070. 'can only contain alphanumeric characters and the hyphen, ' +
  29071. 'and must start with a letter.'
  29072. );
  29073. }
  29074. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  29075. warn(
  29076. 'Do not use built-in or reserved HTML elements as component ' +
  29077. 'id: ' + name
  29078. );
  29079. }
  29080. }
  29081. /**
  29082. * Ensure all props option syntax are normalized into the
  29083. * Object-based format.
  29084. */
  29085. function normalizeProps (options, vm) {
  29086. var props = options.props;
  29087. if (!props) { return }
  29088. var res = {};
  29089. var i, val, name;
  29090. if (Array.isArray(props)) {
  29091. i = props.length;
  29092. while (i--) {
  29093. val = props[i];
  29094. if (typeof val === 'string') {
  29095. name = camelize(val);
  29096. res[name] = { type: null };
  29097. } else if (true) {
  29098. warn('props must be strings when using array syntax.');
  29099. }
  29100. }
  29101. } else if (isPlainObject(props)) {
  29102. for (var key in props) {
  29103. val = props[key];
  29104. name = camelize(key);
  29105. res[name] = isPlainObject(val)
  29106. ? val
  29107. : { type: val };
  29108. }
  29109. } else if (true) {
  29110. warn(
  29111. "Invalid value for option \"props\": expected an Array or an Object, " +
  29112. "but got " + (toRawType(props)) + ".",
  29113. vm
  29114. );
  29115. }
  29116. options.props = res;
  29117. }
  29118. /**
  29119. * Normalize all injections into Object-based format
  29120. */
  29121. function normalizeInject (options, vm) {
  29122. var inject = options.inject;
  29123. if (!inject) { return }
  29124. var normalized = options.inject = {};
  29125. if (Array.isArray(inject)) {
  29126. for (var i = 0; i < inject.length; i++) {
  29127. normalized[inject[i]] = { from: inject[i] };
  29128. }
  29129. } else if (isPlainObject(inject)) {
  29130. for (var key in inject) {
  29131. var val = inject[key];
  29132. normalized[key] = isPlainObject(val)
  29133. ? extend({ from: key }, val)
  29134. : { from: val };
  29135. }
  29136. } else if (true) {
  29137. warn(
  29138. "Invalid value for option \"inject\": expected an Array or an Object, " +
  29139. "but got " + (toRawType(inject)) + ".",
  29140. vm
  29141. );
  29142. }
  29143. }
  29144. /**
  29145. * Normalize raw function directives into object format.
  29146. */
  29147. function normalizeDirectives (options) {
  29148. var dirs = options.directives;
  29149. if (dirs) {
  29150. for (var key in dirs) {
  29151. var def = dirs[key];
  29152. if (typeof def === 'function') {
  29153. dirs[key] = { bind: def, update: def };
  29154. }
  29155. }
  29156. }
  29157. }
  29158. function assertObjectType (name, value, vm) {
  29159. if (!isPlainObject(value)) {
  29160. warn(
  29161. "Invalid value for option \"" + name + "\": expected an Object, " +
  29162. "but got " + (toRawType(value)) + ".",
  29163. vm
  29164. );
  29165. }
  29166. }
  29167. /**
  29168. * Merge two option objects into a new one.
  29169. * Core utility used in both instantiation and inheritance.
  29170. */
  29171. function mergeOptions (
  29172. parent,
  29173. child,
  29174. vm
  29175. ) {
  29176. if (true) {
  29177. checkComponents(child);
  29178. }
  29179. if (typeof child === 'function') {
  29180. child = child.options;
  29181. }
  29182. normalizeProps(child, vm);
  29183. normalizeInject(child, vm);
  29184. normalizeDirectives(child);
  29185. var extendsFrom = child.extends;
  29186. if (extendsFrom) {
  29187. parent = mergeOptions(parent, extendsFrom, vm);
  29188. }
  29189. if (child.mixins) {
  29190. for (var i = 0, l = child.mixins.length; i < l; i++) {
  29191. parent = mergeOptions(parent, child.mixins[i], vm);
  29192. }
  29193. }
  29194. var options = {};
  29195. var key;
  29196. for (key in parent) {
  29197. mergeField(key);
  29198. }
  29199. for (key in child) {
  29200. if (!hasOwn(parent, key)) {
  29201. mergeField(key);
  29202. }
  29203. }
  29204. function mergeField (key) {
  29205. var strat = strats[key] || defaultStrat;
  29206. options[key] = strat(parent[key], child[key], vm, key);
  29207. }
  29208. return options
  29209. }
  29210. /**
  29211. * Resolve an asset.
  29212. * This function is used because child instances need access
  29213. * to assets defined in its ancestor chain.
  29214. */
  29215. function resolveAsset (
  29216. options,
  29217. type,
  29218. id,
  29219. warnMissing
  29220. ) {
  29221. /* istanbul ignore if */
  29222. if (typeof id !== 'string') {
  29223. return
  29224. }
  29225. var assets = options[type];
  29226. // check local registration variations first
  29227. if (hasOwn(assets, id)) { return assets[id] }
  29228. var camelizedId = camelize(id);
  29229. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  29230. var PascalCaseId = capitalize(camelizedId);
  29231. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  29232. // fallback to prototype chain
  29233. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  29234. if ("development" !== 'production' && warnMissing && !res) {
  29235. warn(
  29236. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  29237. options
  29238. );
  29239. }
  29240. return res
  29241. }
  29242. /* */
  29243. function validateProp (
  29244. key,
  29245. propOptions,
  29246. propsData,
  29247. vm
  29248. ) {
  29249. var prop = propOptions[key];
  29250. var absent = !hasOwn(propsData, key);
  29251. var value = propsData[key];
  29252. // handle boolean props
  29253. if (isType(Boolean, prop.type)) {
  29254. if (absent && !hasOwn(prop, 'default')) {
  29255. value = false;
  29256. } else if (!isType(String, prop.type) && (value === '' || value === hyphenate(key))) {
  29257. value = true;
  29258. }
  29259. }
  29260. // check default value
  29261. if (value === undefined) {
  29262. value = getPropDefaultValue(vm, prop, key);
  29263. // since the default value is a fresh copy,
  29264. // make sure to observe it.
  29265. var prevShouldConvert = observerState.shouldConvert;
  29266. observerState.shouldConvert = true;
  29267. observe(value);
  29268. observerState.shouldConvert = prevShouldConvert;
  29269. }
  29270. if (
  29271. true
  29272. ) {
  29273. assertProp(prop, key, value, vm, absent);
  29274. }
  29275. return value
  29276. }
  29277. /**
  29278. * Get the default value of a prop.
  29279. */
  29280. function getPropDefaultValue (vm, prop, key) {
  29281. // no default, return undefined
  29282. if (!hasOwn(prop, 'default')) {
  29283. return undefined
  29284. }
  29285. var def = prop.default;
  29286. // warn against non-factory defaults for Object & Array
  29287. if ("development" !== 'production' && isObject(def)) {
  29288. warn(
  29289. 'Invalid default value for prop "' + key + '": ' +
  29290. 'Props with type Object/Array must use a factory function ' +
  29291. 'to return the default value.',
  29292. vm
  29293. );
  29294. }
  29295. // the raw prop value was also undefined from previous render,
  29296. // return previous default value to avoid unnecessary watcher trigger
  29297. if (vm && vm.$options.propsData &&
  29298. vm.$options.propsData[key] === undefined &&
  29299. vm._props[key] !== undefined
  29300. ) {
  29301. return vm._props[key]
  29302. }
  29303. // call factory function for non-Function types
  29304. // a value is Function if its prototype is function even across different execution context
  29305. return typeof def === 'function' && getType(prop.type) !== 'Function'
  29306. ? def.call(vm)
  29307. : def
  29308. }
  29309. /**
  29310. * Assert whether a prop is valid.
  29311. */
  29312. function assertProp (
  29313. prop,
  29314. name,
  29315. value,
  29316. vm,
  29317. absent
  29318. ) {
  29319. if (prop.required && absent) {
  29320. warn(
  29321. 'Missing required prop: "' + name + '"',
  29322. vm
  29323. );
  29324. return
  29325. }
  29326. if (value == null && !prop.required) {
  29327. return
  29328. }
  29329. var type = prop.type;
  29330. var valid = !type || type === true;
  29331. var expectedTypes = [];
  29332. if (type) {
  29333. if (!Array.isArray(type)) {
  29334. type = [type];
  29335. }
  29336. for (var i = 0; i < type.length && !valid; i++) {
  29337. var assertedType = assertType(value, type[i]);
  29338. expectedTypes.push(assertedType.expectedType || '');
  29339. valid = assertedType.valid;
  29340. }
  29341. }
  29342. if (!valid) {
  29343. warn(
  29344. "Invalid prop: type check failed for prop \"" + name + "\"." +
  29345. " Expected " + (expectedTypes.map(capitalize).join(', ')) +
  29346. ", got " + (toRawType(value)) + ".",
  29347. vm
  29348. );
  29349. return
  29350. }
  29351. var validator = prop.validator;
  29352. if (validator) {
  29353. if (!validator(value)) {
  29354. warn(
  29355. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  29356. vm
  29357. );
  29358. }
  29359. }
  29360. }
  29361. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  29362. function assertType (value, type) {
  29363. var valid;
  29364. var expectedType = getType(type);
  29365. if (simpleCheckRE.test(expectedType)) {
  29366. var t = typeof value;
  29367. valid = t === expectedType.toLowerCase();
  29368. // for primitive wrapper objects
  29369. if (!valid && t === 'object') {
  29370. valid = value instanceof type;
  29371. }
  29372. } else if (expectedType === 'Object') {
  29373. valid = isPlainObject(value);
  29374. } else if (expectedType === 'Array') {
  29375. valid = Array.isArray(value);
  29376. } else {
  29377. valid = value instanceof type;
  29378. }
  29379. return {
  29380. valid: valid,
  29381. expectedType: expectedType
  29382. }
  29383. }
  29384. /**
  29385. * Use function string name to check built-in types,
  29386. * because a simple equality check will fail when running
  29387. * across different vms / iframes.
  29388. */
  29389. function getType (fn) {
  29390. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  29391. return match ? match[1] : ''
  29392. }
  29393. function isType (type, fn) {
  29394. if (!Array.isArray(fn)) {
  29395. return getType(fn) === getType(type)
  29396. }
  29397. for (var i = 0, len = fn.length; i < len; i++) {
  29398. if (getType(fn[i]) === getType(type)) {
  29399. return true
  29400. }
  29401. }
  29402. /* istanbul ignore next */
  29403. return false
  29404. }
  29405. /* */
  29406. function handleError (err, vm, info) {
  29407. if (vm) {
  29408. var cur = vm;
  29409. while ((cur = cur.$parent)) {
  29410. var hooks = cur.$options.errorCaptured;
  29411. if (hooks) {
  29412. for (var i = 0; i < hooks.length; i++) {
  29413. try {
  29414. var capture = hooks[i].call(cur, err, vm, info) === false;
  29415. if (capture) { return }
  29416. } catch (e) {
  29417. globalHandleError(e, cur, 'errorCaptured hook');
  29418. }
  29419. }
  29420. }
  29421. }
  29422. }
  29423. globalHandleError(err, vm, info);
  29424. }
  29425. function globalHandleError (err, vm, info) {
  29426. if (config.errorHandler) {
  29427. try {
  29428. return config.errorHandler.call(null, err, vm, info)
  29429. } catch (e) {
  29430. logError(e, null, 'config.errorHandler');
  29431. }
  29432. }
  29433. logError(err, vm, info);
  29434. }
  29435. function logError (err, vm, info) {
  29436. if (true) {
  29437. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  29438. }
  29439. /* istanbul ignore else */
  29440. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  29441. console.error(err);
  29442. } else {
  29443. throw err
  29444. }
  29445. }
  29446. /* */
  29447. /* globals MessageChannel */
  29448. var callbacks = [];
  29449. var pending = false;
  29450. function flushCallbacks () {
  29451. pending = false;
  29452. var copies = callbacks.slice(0);
  29453. callbacks.length = 0;
  29454. for (var i = 0; i < copies.length; i++) {
  29455. copies[i]();
  29456. }
  29457. }
  29458. // Here we have async deferring wrappers using both micro and macro tasks.
  29459. // In < 2.4 we used micro tasks everywhere, but there are some scenarios where
  29460. // micro tasks have too high a priority and fires in between supposedly
  29461. // sequential events (e.g. #4521, #6690) or even between bubbling of the same
  29462. // event (#6566). However, using macro tasks everywhere also has subtle problems
  29463. // when state is changed right before repaint (e.g. #6813, out-in transitions).
  29464. // Here we use micro task by default, but expose a way to force macro task when
  29465. // needed (e.g. in event handlers attached by v-on).
  29466. var microTimerFunc;
  29467. var macroTimerFunc;
  29468. var useMacroTask = false;
  29469. // Determine (macro) Task defer implementation.
  29470. // Technically setImmediate should be the ideal choice, but it's only available
  29471. // in IE. The only polyfill that consistently queues the callback after all DOM
  29472. // events triggered in the same loop is by using MessageChannel.
  29473. /* istanbul ignore if */
  29474. if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  29475. macroTimerFunc = function () {
  29476. setImmediate(flushCallbacks);
  29477. };
  29478. } else if (typeof MessageChannel !== 'undefined' && (
  29479. isNative(MessageChannel) ||
  29480. // PhantomJS
  29481. MessageChannel.toString() === '[object MessageChannelConstructor]'
  29482. )) {
  29483. var channel = new MessageChannel();
  29484. var port = channel.port2;
  29485. channel.port1.onmessage = flushCallbacks;
  29486. macroTimerFunc = function () {
  29487. port.postMessage(1);
  29488. };
  29489. } else {
  29490. /* istanbul ignore next */
  29491. macroTimerFunc = function () {
  29492. setTimeout(flushCallbacks, 0);
  29493. };
  29494. }
  29495. // Determine MicroTask defer implementation.
  29496. /* istanbul ignore next, $flow-disable-line */
  29497. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  29498. var p = Promise.resolve();
  29499. microTimerFunc = function () {
  29500. p.then(flushCallbacks);
  29501. // in problematic UIWebViews, Promise.then doesn't completely break, but
  29502. // it can get stuck in a weird state where callbacks are pushed into the
  29503. // microtask queue but the queue isn't being flushed, until the browser
  29504. // needs to do some other work, e.g. handle a timer. Therefore we can
  29505. // "force" the microtask queue to be flushed by adding an empty timer.
  29506. if (isIOS) { setTimeout(noop); }
  29507. };
  29508. } else {
  29509. // fallback to macro
  29510. microTimerFunc = macroTimerFunc;
  29511. }
  29512. /**
  29513. * Wrap a function so that if any code inside triggers state change,
  29514. * the changes are queued using a Task instead of a MicroTask.
  29515. */
  29516. function withMacroTask (fn) {
  29517. return fn._withTask || (fn._withTask = function () {
  29518. useMacroTask = true;
  29519. var res = fn.apply(null, arguments);
  29520. useMacroTask = false;
  29521. return res
  29522. })
  29523. }
  29524. function nextTick (cb, ctx) {
  29525. var _resolve;
  29526. callbacks.push(function () {
  29527. if (cb) {
  29528. try {
  29529. cb.call(ctx);
  29530. } catch (e) {
  29531. handleError(e, ctx, 'nextTick');
  29532. }
  29533. } else if (_resolve) {
  29534. _resolve(ctx);
  29535. }
  29536. });
  29537. if (!pending) {
  29538. pending = true;
  29539. if (useMacroTask) {
  29540. macroTimerFunc();
  29541. } else {
  29542. microTimerFunc();
  29543. }
  29544. }
  29545. // $flow-disable-line
  29546. if (!cb && typeof Promise !== 'undefined') {
  29547. return new Promise(function (resolve) {
  29548. _resolve = resolve;
  29549. })
  29550. }
  29551. }
  29552. /* */
  29553. var mark;
  29554. var measure;
  29555. if (true) {
  29556. var perf = inBrowser && window.performance;
  29557. /* istanbul ignore if */
  29558. if (
  29559. perf &&
  29560. perf.mark &&
  29561. perf.measure &&
  29562. perf.clearMarks &&
  29563. perf.clearMeasures
  29564. ) {
  29565. mark = function (tag) { return perf.mark(tag); };
  29566. measure = function (name, startTag, endTag) {
  29567. perf.measure(name, startTag, endTag);
  29568. perf.clearMarks(startTag);
  29569. perf.clearMarks(endTag);
  29570. perf.clearMeasures(name);
  29571. };
  29572. }
  29573. }
  29574. /* not type checking this file because flow doesn't play well with Proxy */
  29575. var initProxy;
  29576. if (true) {
  29577. var allowedGlobals = makeMap(
  29578. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  29579. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  29580. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  29581. 'require' // for Webpack/Browserify
  29582. );
  29583. var warnNonPresent = function (target, key) {
  29584. warn(
  29585. "Property or method \"" + key + "\" is not defined on the instance but " +
  29586. 'referenced during render. Make sure that this property is reactive, ' +
  29587. 'either in the data option, or for class-based components, by ' +
  29588. 'initializing the property. ' +
  29589. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  29590. target
  29591. );
  29592. };
  29593. var hasProxy =
  29594. typeof Proxy !== 'undefined' &&
  29595. Proxy.toString().match(/native code/);
  29596. if (hasProxy) {
  29597. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  29598. config.keyCodes = new Proxy(config.keyCodes, {
  29599. set: function set (target, key, value) {
  29600. if (isBuiltInModifier(key)) {
  29601. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  29602. return false
  29603. } else {
  29604. target[key] = value;
  29605. return true
  29606. }
  29607. }
  29608. });
  29609. }
  29610. var hasHandler = {
  29611. has: function has (target, key) {
  29612. var has = key in target;
  29613. var isAllowed = allowedGlobals(key) || key.charAt(0) === '_';
  29614. if (!has && !isAllowed) {
  29615. warnNonPresent(target, key);
  29616. }
  29617. return has || !isAllowed
  29618. }
  29619. };
  29620. var getHandler = {
  29621. get: function get (target, key) {
  29622. if (typeof key === 'string' && !(key in target)) {
  29623. warnNonPresent(target, key);
  29624. }
  29625. return target[key]
  29626. }
  29627. };
  29628. initProxy = function initProxy (vm) {
  29629. if (hasProxy) {
  29630. // determine which proxy handler to use
  29631. var options = vm.$options;
  29632. var handlers = options.render && options.render._withStripped
  29633. ? getHandler
  29634. : hasHandler;
  29635. vm._renderProxy = new Proxy(vm, handlers);
  29636. } else {
  29637. vm._renderProxy = vm;
  29638. }
  29639. };
  29640. }
  29641. /* */
  29642. var seenObjects = new _Set();
  29643. /**
  29644. * Recursively traverse an object to evoke all converted
  29645. * getters, so that every nested property inside the object
  29646. * is collected as a "deep" dependency.
  29647. */
  29648. function traverse (val) {
  29649. _traverse(val, seenObjects);
  29650. seenObjects.clear();
  29651. }
  29652. function _traverse (val, seen) {
  29653. var i, keys;
  29654. var isA = Array.isArray(val);
  29655. if ((!isA && !isObject(val)) || Object.isFrozen(val)) {
  29656. return
  29657. }
  29658. if (val.__ob__) {
  29659. var depId = val.__ob__.dep.id;
  29660. if (seen.has(depId)) {
  29661. return
  29662. }
  29663. seen.add(depId);
  29664. }
  29665. if (isA) {
  29666. i = val.length;
  29667. while (i--) { _traverse(val[i], seen); }
  29668. } else {
  29669. keys = Object.keys(val);
  29670. i = keys.length;
  29671. while (i--) { _traverse(val[keys[i]], seen); }
  29672. }
  29673. }
  29674. /* */
  29675. var normalizeEvent = cached(function (name) {
  29676. var passive = name.charAt(0) === '&';
  29677. name = passive ? name.slice(1) : name;
  29678. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  29679. name = once$$1 ? name.slice(1) : name;
  29680. var capture = name.charAt(0) === '!';
  29681. name = capture ? name.slice(1) : name;
  29682. return {
  29683. name: name,
  29684. once: once$$1,
  29685. capture: capture,
  29686. passive: passive
  29687. }
  29688. });
  29689. function createFnInvoker (fns) {
  29690. function invoker () {
  29691. var arguments$1 = arguments;
  29692. var fns = invoker.fns;
  29693. if (Array.isArray(fns)) {
  29694. var cloned = fns.slice();
  29695. for (var i = 0; i < cloned.length; i++) {
  29696. cloned[i].apply(null, arguments$1);
  29697. }
  29698. } else {
  29699. // return handler return value for single handlers
  29700. return fns.apply(null, arguments)
  29701. }
  29702. }
  29703. invoker.fns = fns;
  29704. return invoker
  29705. }
  29706. function updateListeners (
  29707. on,
  29708. oldOn,
  29709. add,
  29710. remove$$1,
  29711. vm
  29712. ) {
  29713. var name, def, cur, old, event;
  29714. for (name in on) {
  29715. def = cur = on[name];
  29716. old = oldOn[name];
  29717. event = normalizeEvent(name);
  29718. /* istanbul ignore if */
  29719. if (isUndef(cur)) {
  29720. "development" !== 'production' && warn(
  29721. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  29722. vm
  29723. );
  29724. } else if (isUndef(old)) {
  29725. if (isUndef(cur.fns)) {
  29726. cur = on[name] = createFnInvoker(cur);
  29727. }
  29728. add(event.name, cur, event.once, event.capture, event.passive, event.params);
  29729. } else if (cur !== old) {
  29730. old.fns = cur;
  29731. on[name] = old;
  29732. }
  29733. }
  29734. for (name in oldOn) {
  29735. if (isUndef(on[name])) {
  29736. event = normalizeEvent(name);
  29737. remove$$1(event.name, oldOn[name], event.capture);
  29738. }
  29739. }
  29740. }
  29741. /* */
  29742. function mergeVNodeHook (def, hookKey, hook) {
  29743. if (def instanceof VNode) {
  29744. def = def.data.hook || (def.data.hook = {});
  29745. }
  29746. var invoker;
  29747. var oldHook = def[hookKey];
  29748. function wrappedHook () {
  29749. hook.apply(this, arguments);
  29750. // important: remove merged hook to ensure it's called only once
  29751. // and prevent memory leak
  29752. remove(invoker.fns, wrappedHook);
  29753. }
  29754. if (isUndef(oldHook)) {
  29755. // no existing hook
  29756. invoker = createFnInvoker([wrappedHook]);
  29757. } else {
  29758. /* istanbul ignore if */
  29759. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  29760. // already a merged invoker
  29761. invoker = oldHook;
  29762. invoker.fns.push(wrappedHook);
  29763. } else {
  29764. // existing plain hook
  29765. invoker = createFnInvoker([oldHook, wrappedHook]);
  29766. }
  29767. }
  29768. invoker.merged = true;
  29769. def[hookKey] = invoker;
  29770. }
  29771. /* */
  29772. function extractPropsFromVNodeData (
  29773. data,
  29774. Ctor,
  29775. tag
  29776. ) {
  29777. // we are only extracting raw values here.
  29778. // validation and default values are handled in the child
  29779. // component itself.
  29780. var propOptions = Ctor.options.props;
  29781. if (isUndef(propOptions)) {
  29782. return
  29783. }
  29784. var res = {};
  29785. var attrs = data.attrs;
  29786. var props = data.props;
  29787. if (isDef(attrs) || isDef(props)) {
  29788. for (var key in propOptions) {
  29789. var altKey = hyphenate(key);
  29790. if (true) {
  29791. var keyInLowerCase = key.toLowerCase();
  29792. if (
  29793. key !== keyInLowerCase &&
  29794. attrs && hasOwn(attrs, keyInLowerCase)
  29795. ) {
  29796. tip(
  29797. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  29798. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  29799. " \"" + key + "\". " +
  29800. "Note that HTML attributes are case-insensitive and camelCased " +
  29801. "props need to use their kebab-case equivalents when using in-DOM " +
  29802. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  29803. );
  29804. }
  29805. }
  29806. checkProp(res, props, key, altKey, true) ||
  29807. checkProp(res, attrs, key, altKey, false);
  29808. }
  29809. }
  29810. return res
  29811. }
  29812. function checkProp (
  29813. res,
  29814. hash,
  29815. key,
  29816. altKey,
  29817. preserve
  29818. ) {
  29819. if (isDef(hash)) {
  29820. if (hasOwn(hash, key)) {
  29821. res[key] = hash[key];
  29822. if (!preserve) {
  29823. delete hash[key];
  29824. }
  29825. return true
  29826. } else if (hasOwn(hash, altKey)) {
  29827. res[key] = hash[altKey];
  29828. if (!preserve) {
  29829. delete hash[altKey];
  29830. }
  29831. return true
  29832. }
  29833. }
  29834. return false
  29835. }
  29836. /* */
  29837. // The template compiler attempts to minimize the need for normalization by
  29838. // statically analyzing the template at compile time.
  29839. //
  29840. // For plain HTML markup, normalization can be completely skipped because the
  29841. // generated render function is guaranteed to return Array<VNode>. There are
  29842. // two cases where extra normalization is needed:
  29843. // 1. When the children contains components - because a functional component
  29844. // may return an Array instead of a single root. In this case, just a simple
  29845. // normalization is needed - if any child is an Array, we flatten the whole
  29846. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  29847. // because functional components already normalize their own children.
  29848. function simpleNormalizeChildren (children) {
  29849. for (var i = 0; i < children.length; i++) {
  29850. if (Array.isArray(children[i])) {
  29851. return Array.prototype.concat.apply([], children)
  29852. }
  29853. }
  29854. return children
  29855. }
  29856. // 2. When the children contains constructs that always generated nested Arrays,
  29857. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  29858. // with hand-written render functions / JSX. In such cases a full normalization
  29859. // is needed to cater to all possible types of children values.
  29860. function normalizeChildren (children) {
  29861. return isPrimitive(children)
  29862. ? [createTextVNode(children)]
  29863. : Array.isArray(children)
  29864. ? normalizeArrayChildren(children)
  29865. : undefined
  29866. }
  29867. function isTextNode (node) {
  29868. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  29869. }
  29870. function normalizeArrayChildren (children, nestedIndex) {
  29871. var res = [];
  29872. var i, c, lastIndex, last;
  29873. for (i = 0; i < children.length; i++) {
  29874. c = children[i];
  29875. if (isUndef(c) || typeof c === 'boolean') { continue }
  29876. lastIndex = res.length - 1;
  29877. last = res[lastIndex];
  29878. // nested
  29879. if (Array.isArray(c)) {
  29880. if (c.length > 0) {
  29881. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  29882. // merge adjacent text nodes
  29883. if (isTextNode(c[0]) && isTextNode(last)) {
  29884. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  29885. c.shift();
  29886. }
  29887. res.push.apply(res, c);
  29888. }
  29889. } else if (isPrimitive(c)) {
  29890. if (isTextNode(last)) {
  29891. // merge adjacent text nodes
  29892. // this is necessary for SSR hydration because text nodes are
  29893. // essentially merged when rendered to HTML strings
  29894. res[lastIndex] = createTextVNode(last.text + c);
  29895. } else if (c !== '') {
  29896. // convert primitive to vnode
  29897. res.push(createTextVNode(c));
  29898. }
  29899. } else {
  29900. if (isTextNode(c) && isTextNode(last)) {
  29901. // merge adjacent text nodes
  29902. res[lastIndex] = createTextVNode(last.text + c.text);
  29903. } else {
  29904. // default key for nested array children (likely generated by v-for)
  29905. if (isTrue(children._isVList) &&
  29906. isDef(c.tag) &&
  29907. isUndef(c.key) &&
  29908. isDef(nestedIndex)) {
  29909. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  29910. }
  29911. res.push(c);
  29912. }
  29913. }
  29914. }
  29915. return res
  29916. }
  29917. /* */
  29918. function ensureCtor (comp, base) {
  29919. if (
  29920. comp.__esModule ||
  29921. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  29922. ) {
  29923. comp = comp.default;
  29924. }
  29925. return isObject(comp)
  29926. ? base.extend(comp)
  29927. : comp
  29928. }
  29929. function createAsyncPlaceholder (
  29930. factory,
  29931. data,
  29932. context,
  29933. children,
  29934. tag
  29935. ) {
  29936. var node = createEmptyVNode();
  29937. node.asyncFactory = factory;
  29938. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  29939. return node
  29940. }
  29941. function resolveAsyncComponent (
  29942. factory,
  29943. baseCtor,
  29944. context
  29945. ) {
  29946. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  29947. return factory.errorComp
  29948. }
  29949. if (isDef(factory.resolved)) {
  29950. return factory.resolved
  29951. }
  29952. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  29953. return factory.loadingComp
  29954. }
  29955. if (isDef(factory.contexts)) {
  29956. // already pending
  29957. factory.contexts.push(context);
  29958. } else {
  29959. var contexts = factory.contexts = [context];
  29960. var sync = true;
  29961. var forceRender = function () {
  29962. for (var i = 0, l = contexts.length; i < l; i++) {
  29963. contexts[i].$forceUpdate();
  29964. }
  29965. };
  29966. var resolve = once(function (res) {
  29967. // cache resolved
  29968. factory.resolved = ensureCtor(res, baseCtor);
  29969. // invoke callbacks only if this is not a synchronous resolve
  29970. // (async resolves are shimmed as synchronous during SSR)
  29971. if (!sync) {
  29972. forceRender();
  29973. }
  29974. });
  29975. var reject = once(function (reason) {
  29976. "development" !== 'production' && warn(
  29977. "Failed to resolve async component: " + (String(factory)) +
  29978. (reason ? ("\nReason: " + reason) : '')
  29979. );
  29980. if (isDef(factory.errorComp)) {
  29981. factory.error = true;
  29982. forceRender();
  29983. }
  29984. });
  29985. var res = factory(resolve, reject);
  29986. if (isObject(res)) {
  29987. if (typeof res.then === 'function') {
  29988. // () => Promise
  29989. if (isUndef(factory.resolved)) {
  29990. res.then(resolve, reject);
  29991. }
  29992. } else if (isDef(res.component) && typeof res.component.then === 'function') {
  29993. res.component.then(resolve, reject);
  29994. if (isDef(res.error)) {
  29995. factory.errorComp = ensureCtor(res.error, baseCtor);
  29996. }
  29997. if (isDef(res.loading)) {
  29998. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  29999. if (res.delay === 0) {
  30000. factory.loading = true;
  30001. } else {
  30002. setTimeout(function () {
  30003. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  30004. factory.loading = true;
  30005. forceRender();
  30006. }
  30007. }, res.delay || 200);
  30008. }
  30009. }
  30010. if (isDef(res.timeout)) {
  30011. setTimeout(function () {
  30012. if (isUndef(factory.resolved)) {
  30013. reject(
  30014. true
  30015. ? ("timeout (" + (res.timeout) + "ms)")
  30016. : null
  30017. );
  30018. }
  30019. }, res.timeout);
  30020. }
  30021. }
  30022. }
  30023. sync = false;
  30024. // return in case resolved synchronously
  30025. return factory.loading
  30026. ? factory.loadingComp
  30027. : factory.resolved
  30028. }
  30029. }
  30030. /* */
  30031. function isAsyncPlaceholder (node) {
  30032. return node.isComment && node.asyncFactory
  30033. }
  30034. /* */
  30035. function getFirstComponentChild (children) {
  30036. if (Array.isArray(children)) {
  30037. for (var i = 0; i < children.length; i++) {
  30038. var c = children[i];
  30039. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  30040. return c
  30041. }
  30042. }
  30043. }
  30044. }
  30045. /* */
  30046. /* */
  30047. function initEvents (vm) {
  30048. vm._events = Object.create(null);
  30049. vm._hasHookEvent = false;
  30050. // init parent attached events
  30051. var listeners = vm.$options._parentListeners;
  30052. if (listeners) {
  30053. updateComponentListeners(vm, listeners);
  30054. }
  30055. }
  30056. var target;
  30057. function add (event, fn, once) {
  30058. if (once) {
  30059. target.$once(event, fn);
  30060. } else {
  30061. target.$on(event, fn);
  30062. }
  30063. }
  30064. function remove$1 (event, fn) {
  30065. target.$off(event, fn);
  30066. }
  30067. function updateComponentListeners (
  30068. vm,
  30069. listeners,
  30070. oldListeners
  30071. ) {
  30072. target = vm;
  30073. updateListeners(listeners, oldListeners || {}, add, remove$1, vm);
  30074. target = undefined;
  30075. }
  30076. function eventsMixin (Vue) {
  30077. var hookRE = /^hook:/;
  30078. Vue.prototype.$on = function (event, fn) {
  30079. var this$1 = this;
  30080. var vm = this;
  30081. if (Array.isArray(event)) {
  30082. for (var i = 0, l = event.length; i < l; i++) {
  30083. this$1.$on(event[i], fn);
  30084. }
  30085. } else {
  30086. (vm._events[event] || (vm._events[event] = [])).push(fn);
  30087. // optimize hook:event cost by using a boolean flag marked at registration
  30088. // instead of a hash lookup
  30089. if (hookRE.test(event)) {
  30090. vm._hasHookEvent = true;
  30091. }
  30092. }
  30093. return vm
  30094. };
  30095. Vue.prototype.$once = function (event, fn) {
  30096. var vm = this;
  30097. function on () {
  30098. vm.$off(event, on);
  30099. fn.apply(vm, arguments);
  30100. }
  30101. on.fn = fn;
  30102. vm.$on(event, on);
  30103. return vm
  30104. };
  30105. Vue.prototype.$off = function (event, fn) {
  30106. var this$1 = this;
  30107. var vm = this;
  30108. // all
  30109. if (!arguments.length) {
  30110. vm._events = Object.create(null);
  30111. return vm
  30112. }
  30113. // array of events
  30114. if (Array.isArray(event)) {
  30115. for (var i = 0, l = event.length; i < l; i++) {
  30116. this$1.$off(event[i], fn);
  30117. }
  30118. return vm
  30119. }
  30120. // specific event
  30121. var cbs = vm._events[event];
  30122. if (!cbs) {
  30123. return vm
  30124. }
  30125. if (!fn) {
  30126. vm._events[event] = null;
  30127. return vm
  30128. }
  30129. if (fn) {
  30130. // specific handler
  30131. var cb;
  30132. var i$1 = cbs.length;
  30133. while (i$1--) {
  30134. cb = cbs[i$1];
  30135. if (cb === fn || cb.fn === fn) {
  30136. cbs.splice(i$1, 1);
  30137. break
  30138. }
  30139. }
  30140. }
  30141. return vm
  30142. };
  30143. Vue.prototype.$emit = function (event) {
  30144. var vm = this;
  30145. if (true) {
  30146. var lowerCaseEvent = event.toLowerCase();
  30147. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  30148. tip(
  30149. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  30150. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  30151. "Note that HTML attributes are case-insensitive and you cannot use " +
  30152. "v-on to listen to camelCase events when using in-DOM templates. " +
  30153. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  30154. );
  30155. }
  30156. }
  30157. var cbs = vm._events[event];
  30158. if (cbs) {
  30159. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  30160. var args = toArray(arguments, 1);
  30161. for (var i = 0, l = cbs.length; i < l; i++) {
  30162. try {
  30163. cbs[i].apply(vm, args);
  30164. } catch (e) {
  30165. handleError(e, vm, ("event handler for \"" + event + "\""));
  30166. }
  30167. }
  30168. }
  30169. return vm
  30170. };
  30171. }
  30172. /* */
  30173. /**
  30174. * Runtime helper for resolving raw children VNodes into a slot object.
  30175. */
  30176. function resolveSlots (
  30177. children,
  30178. context
  30179. ) {
  30180. var slots = {};
  30181. if (!children) {
  30182. return slots
  30183. }
  30184. for (var i = 0, l = children.length; i < l; i++) {
  30185. var child = children[i];
  30186. var data = child.data;
  30187. // remove slot attribute if the node is resolved as a Vue slot node
  30188. if (data && data.attrs && data.attrs.slot) {
  30189. delete data.attrs.slot;
  30190. }
  30191. // named slots should only be respected if the vnode was rendered in the
  30192. // same context.
  30193. if ((child.context === context || child.fnContext === context) &&
  30194. data && data.slot != null
  30195. ) {
  30196. var name = data.slot;
  30197. var slot = (slots[name] || (slots[name] = []));
  30198. if (child.tag === 'template') {
  30199. slot.push.apply(slot, child.children || []);
  30200. } else {
  30201. slot.push(child);
  30202. }
  30203. } else {
  30204. (slots.default || (slots.default = [])).push(child);
  30205. }
  30206. }
  30207. // ignore slots that contains only whitespace
  30208. for (var name$1 in slots) {
  30209. if (slots[name$1].every(isWhitespace)) {
  30210. delete slots[name$1];
  30211. }
  30212. }
  30213. return slots
  30214. }
  30215. function isWhitespace (node) {
  30216. return (node.isComment && !node.asyncFactory) || node.text === ' '
  30217. }
  30218. function resolveScopedSlots (
  30219. fns, // see flow/vnode
  30220. res
  30221. ) {
  30222. res = res || {};
  30223. for (var i = 0; i < fns.length; i++) {
  30224. if (Array.isArray(fns[i])) {
  30225. resolveScopedSlots(fns[i], res);
  30226. } else {
  30227. res[fns[i].key] = fns[i].fn;
  30228. }
  30229. }
  30230. return res
  30231. }
  30232. /* */
  30233. var activeInstance = null;
  30234. var isUpdatingChildComponent = false;
  30235. function initLifecycle (vm) {
  30236. var options = vm.$options;
  30237. // locate first non-abstract parent
  30238. var parent = options.parent;
  30239. if (parent && !options.abstract) {
  30240. while (parent.$options.abstract && parent.$parent) {
  30241. parent = parent.$parent;
  30242. }
  30243. parent.$children.push(vm);
  30244. }
  30245. vm.$parent = parent;
  30246. vm.$root = parent ? parent.$root : vm;
  30247. vm.$children = [];
  30248. vm.$refs = {};
  30249. vm._watcher = null;
  30250. vm._inactive = null;
  30251. vm._directInactive = false;
  30252. vm._isMounted = false;
  30253. vm._isDestroyed = false;
  30254. vm._isBeingDestroyed = false;
  30255. }
  30256. function lifecycleMixin (Vue) {
  30257. Vue.prototype._update = function (vnode, hydrating) {
  30258. var vm = this;
  30259. if (vm._isMounted) {
  30260. callHook(vm, 'beforeUpdate');
  30261. }
  30262. var prevEl = vm.$el;
  30263. var prevVnode = vm._vnode;
  30264. var prevActiveInstance = activeInstance;
  30265. activeInstance = vm;
  30266. vm._vnode = vnode;
  30267. // Vue.prototype.__patch__ is injected in entry points
  30268. // based on the rendering backend used.
  30269. if (!prevVnode) {
  30270. // initial render
  30271. vm.$el = vm.__patch__(
  30272. vm.$el, vnode, hydrating, false /* removeOnly */,
  30273. vm.$options._parentElm,
  30274. vm.$options._refElm
  30275. );
  30276. // no need for the ref nodes after initial patch
  30277. // this prevents keeping a detached DOM tree in memory (#5851)
  30278. vm.$options._parentElm = vm.$options._refElm = null;
  30279. } else {
  30280. // updates
  30281. vm.$el = vm.__patch__(prevVnode, vnode);
  30282. }
  30283. activeInstance = prevActiveInstance;
  30284. // update __vue__ reference
  30285. if (prevEl) {
  30286. prevEl.__vue__ = null;
  30287. }
  30288. if (vm.$el) {
  30289. vm.$el.__vue__ = vm;
  30290. }
  30291. // if parent is an HOC, update its $el as well
  30292. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  30293. vm.$parent.$el = vm.$el;
  30294. }
  30295. // updated hook is called by the scheduler to ensure that children are
  30296. // updated in a parent's updated hook.
  30297. };
  30298. Vue.prototype.$forceUpdate = function () {
  30299. var vm = this;
  30300. if (vm._watcher) {
  30301. vm._watcher.update();
  30302. }
  30303. };
  30304. Vue.prototype.$destroy = function () {
  30305. var vm = this;
  30306. if (vm._isBeingDestroyed) {
  30307. return
  30308. }
  30309. callHook(vm, 'beforeDestroy');
  30310. vm._isBeingDestroyed = true;
  30311. // remove self from parent
  30312. var parent = vm.$parent;
  30313. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  30314. remove(parent.$children, vm);
  30315. }
  30316. // teardown watchers
  30317. if (vm._watcher) {
  30318. vm._watcher.teardown();
  30319. }
  30320. var i = vm._watchers.length;
  30321. while (i--) {
  30322. vm._watchers[i].teardown();
  30323. }
  30324. // remove reference from data ob
  30325. // frozen object may not have observer.
  30326. if (vm._data.__ob__) {
  30327. vm._data.__ob__.vmCount--;
  30328. }
  30329. // call the last hook...
  30330. vm._isDestroyed = true;
  30331. // invoke destroy hooks on current rendered tree
  30332. vm.__patch__(vm._vnode, null);
  30333. // fire destroyed hook
  30334. callHook(vm, 'destroyed');
  30335. // turn off all instance listeners.
  30336. vm.$off();
  30337. // remove __vue__ reference
  30338. if (vm.$el) {
  30339. vm.$el.__vue__ = null;
  30340. }
  30341. // release circular reference (#6759)
  30342. if (vm.$vnode) {
  30343. vm.$vnode.parent = null;
  30344. }
  30345. };
  30346. }
  30347. function mountComponent (
  30348. vm,
  30349. el,
  30350. hydrating
  30351. ) {
  30352. vm.$el = el;
  30353. if (!vm.$options.render) {
  30354. vm.$options.render = createEmptyVNode;
  30355. if (true) {
  30356. /* istanbul ignore if */
  30357. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  30358. vm.$options.el || el) {
  30359. warn(
  30360. 'You are using the runtime-only build of Vue where the template ' +
  30361. 'compiler is not available. Either pre-compile the templates into ' +
  30362. 'render functions, or use the compiler-included build.',
  30363. vm
  30364. );
  30365. } else {
  30366. warn(
  30367. 'Failed to mount component: template or render function not defined.',
  30368. vm
  30369. );
  30370. }
  30371. }
  30372. }
  30373. callHook(vm, 'beforeMount');
  30374. var updateComponent;
  30375. /* istanbul ignore if */
  30376. if ("development" !== 'production' && config.performance && mark) {
  30377. updateComponent = function () {
  30378. var name = vm._name;
  30379. var id = vm._uid;
  30380. var startTag = "vue-perf-start:" + id;
  30381. var endTag = "vue-perf-end:" + id;
  30382. mark(startTag);
  30383. var vnode = vm._render();
  30384. mark(endTag);
  30385. measure(("vue " + name + " render"), startTag, endTag);
  30386. mark(startTag);
  30387. vm._update(vnode, hydrating);
  30388. mark(endTag);
  30389. measure(("vue " + name + " patch"), startTag, endTag);
  30390. };
  30391. } else {
  30392. updateComponent = function () {
  30393. vm._update(vm._render(), hydrating);
  30394. };
  30395. }
  30396. // we set this to vm._watcher inside the watcher's constructor
  30397. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  30398. // component's mounted hook), which relies on vm._watcher being already defined
  30399. new Watcher(vm, updateComponent, noop, null, true /* isRenderWatcher */);
  30400. hydrating = false;
  30401. // manually mounted instance, call mounted on self
  30402. // mounted is called for render-created child components in its inserted hook
  30403. if (vm.$vnode == null) {
  30404. vm._isMounted = true;
  30405. callHook(vm, 'mounted');
  30406. }
  30407. return vm
  30408. }
  30409. function updateChildComponent (
  30410. vm,
  30411. propsData,
  30412. listeners,
  30413. parentVnode,
  30414. renderChildren
  30415. ) {
  30416. if (true) {
  30417. isUpdatingChildComponent = true;
  30418. }
  30419. // determine whether component has slot children
  30420. // we need to do this before overwriting $options._renderChildren
  30421. var hasChildren = !!(
  30422. renderChildren || // has new static slots
  30423. vm.$options._renderChildren || // has old static slots
  30424. parentVnode.data.scopedSlots || // has new scoped slots
  30425. vm.$scopedSlots !== emptyObject // has old scoped slots
  30426. );
  30427. vm.$options._parentVnode = parentVnode;
  30428. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  30429. if (vm._vnode) { // update child tree's parent
  30430. vm._vnode.parent = parentVnode;
  30431. }
  30432. vm.$options._renderChildren = renderChildren;
  30433. // update $attrs and $listeners hash
  30434. // these are also reactive so they may trigger child update if the child
  30435. // used them during render
  30436. vm.$attrs = (parentVnode.data && parentVnode.data.attrs) || emptyObject;
  30437. vm.$listeners = listeners || emptyObject;
  30438. // update props
  30439. if (propsData && vm.$options.props) {
  30440. observerState.shouldConvert = false;
  30441. var props = vm._props;
  30442. var propKeys = vm.$options._propKeys || [];
  30443. for (var i = 0; i < propKeys.length; i++) {
  30444. var key = propKeys[i];
  30445. props[key] = validateProp(key, vm.$options.props, propsData, vm);
  30446. }
  30447. observerState.shouldConvert = true;
  30448. // keep a copy of raw propsData
  30449. vm.$options.propsData = propsData;
  30450. }
  30451. // update listeners
  30452. if (listeners) {
  30453. var oldListeners = vm.$options._parentListeners;
  30454. vm.$options._parentListeners = listeners;
  30455. updateComponentListeners(vm, listeners, oldListeners);
  30456. }
  30457. // resolve slots + force update if has children
  30458. if (hasChildren) {
  30459. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  30460. vm.$forceUpdate();
  30461. }
  30462. if (true) {
  30463. isUpdatingChildComponent = false;
  30464. }
  30465. }
  30466. function isInInactiveTree (vm) {
  30467. while (vm && (vm = vm.$parent)) {
  30468. if (vm._inactive) { return true }
  30469. }
  30470. return false
  30471. }
  30472. function activateChildComponent (vm, direct) {
  30473. if (direct) {
  30474. vm._directInactive = false;
  30475. if (isInInactiveTree(vm)) {
  30476. return
  30477. }
  30478. } else if (vm._directInactive) {
  30479. return
  30480. }
  30481. if (vm._inactive || vm._inactive === null) {
  30482. vm._inactive = false;
  30483. for (var i = 0; i < vm.$children.length; i++) {
  30484. activateChildComponent(vm.$children[i]);
  30485. }
  30486. callHook(vm, 'activated');
  30487. }
  30488. }
  30489. function deactivateChildComponent (vm, direct) {
  30490. if (direct) {
  30491. vm._directInactive = true;
  30492. if (isInInactiveTree(vm)) {
  30493. return
  30494. }
  30495. }
  30496. if (!vm._inactive) {
  30497. vm._inactive = true;
  30498. for (var i = 0; i < vm.$children.length; i++) {
  30499. deactivateChildComponent(vm.$children[i]);
  30500. }
  30501. callHook(vm, 'deactivated');
  30502. }
  30503. }
  30504. function callHook (vm, hook) {
  30505. var handlers = vm.$options[hook];
  30506. if (handlers) {
  30507. for (var i = 0, j = handlers.length; i < j; i++) {
  30508. try {
  30509. handlers[i].call(vm);
  30510. } catch (e) {
  30511. handleError(e, vm, (hook + " hook"));
  30512. }
  30513. }
  30514. }
  30515. if (vm._hasHookEvent) {
  30516. vm.$emit('hook:' + hook);
  30517. }
  30518. }
  30519. /* */
  30520. var MAX_UPDATE_COUNT = 100;
  30521. var queue = [];
  30522. var activatedChildren = [];
  30523. var has = {};
  30524. var circular = {};
  30525. var waiting = false;
  30526. var flushing = false;
  30527. var index = 0;
  30528. /**
  30529. * Reset the scheduler's state.
  30530. */
  30531. function resetSchedulerState () {
  30532. index = queue.length = activatedChildren.length = 0;
  30533. has = {};
  30534. if (true) {
  30535. circular = {};
  30536. }
  30537. waiting = flushing = false;
  30538. }
  30539. /**
  30540. * Flush both queues and run the watchers.
  30541. */
  30542. function flushSchedulerQueue () {
  30543. flushing = true;
  30544. var watcher, id;
  30545. // Sort queue before flush.
  30546. // This ensures that:
  30547. // 1. Components are updated from parent to child. (because parent is always
  30548. // created before the child)
  30549. // 2. A component's user watchers are run before its render watcher (because
  30550. // user watchers are created before the render watcher)
  30551. // 3. If a component is destroyed during a parent component's watcher run,
  30552. // its watchers can be skipped.
  30553. queue.sort(function (a, b) { return a.id - b.id; });
  30554. // do not cache length because more watchers might be pushed
  30555. // as we run existing watchers
  30556. for (index = 0; index < queue.length; index++) {
  30557. watcher = queue[index];
  30558. id = watcher.id;
  30559. has[id] = null;
  30560. watcher.run();
  30561. // in dev build, check and stop circular updates.
  30562. if ("development" !== 'production' && has[id] != null) {
  30563. circular[id] = (circular[id] || 0) + 1;
  30564. if (circular[id] > MAX_UPDATE_COUNT) {
  30565. warn(
  30566. 'You may have an infinite update loop ' + (
  30567. watcher.user
  30568. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  30569. : "in a component render function."
  30570. ),
  30571. watcher.vm
  30572. );
  30573. break
  30574. }
  30575. }
  30576. }
  30577. // keep copies of post queues before resetting state
  30578. var activatedQueue = activatedChildren.slice();
  30579. var updatedQueue = queue.slice();
  30580. resetSchedulerState();
  30581. // call component updated and activated hooks
  30582. callActivatedHooks(activatedQueue);
  30583. callUpdatedHooks(updatedQueue);
  30584. // devtool hook
  30585. /* istanbul ignore if */
  30586. if (devtools && config.devtools) {
  30587. devtools.emit('flush');
  30588. }
  30589. }
  30590. function callUpdatedHooks (queue) {
  30591. var i = queue.length;
  30592. while (i--) {
  30593. var watcher = queue[i];
  30594. var vm = watcher.vm;
  30595. if (vm._watcher === watcher && vm._isMounted) {
  30596. callHook(vm, 'updated');
  30597. }
  30598. }
  30599. }
  30600. /**
  30601. * Queue a kept-alive component that was activated during patch.
  30602. * The queue will be processed after the entire tree has been patched.
  30603. */
  30604. function queueActivatedComponent (vm) {
  30605. // setting _inactive to false here so that a render function can
  30606. // rely on checking whether it's in an inactive tree (e.g. router-view)
  30607. vm._inactive = false;
  30608. activatedChildren.push(vm);
  30609. }
  30610. function callActivatedHooks (queue) {
  30611. for (var i = 0; i < queue.length; i++) {
  30612. queue[i]._inactive = true;
  30613. activateChildComponent(queue[i], true /* true */);
  30614. }
  30615. }
  30616. /**
  30617. * Push a watcher into the watcher queue.
  30618. * Jobs with duplicate IDs will be skipped unless it's
  30619. * pushed when the queue is being flushed.
  30620. */
  30621. function queueWatcher (watcher) {
  30622. var id = watcher.id;
  30623. if (has[id] == null) {
  30624. has[id] = true;
  30625. if (!flushing) {
  30626. queue.push(watcher);
  30627. } else {
  30628. // if already flushing, splice the watcher based on its id
  30629. // if already past its id, it will be run next immediately.
  30630. var i = queue.length - 1;
  30631. while (i > index && queue[i].id > watcher.id) {
  30632. i--;
  30633. }
  30634. queue.splice(i + 1, 0, watcher);
  30635. }
  30636. // queue the flush
  30637. if (!waiting) {
  30638. waiting = true;
  30639. nextTick(flushSchedulerQueue);
  30640. }
  30641. }
  30642. }
  30643. /* */
  30644. var uid$2 = 0;
  30645. /**
  30646. * A watcher parses an expression, collects dependencies,
  30647. * and fires callback when the expression value changes.
  30648. * This is used for both the $watch() api and directives.
  30649. */
  30650. var Watcher = function Watcher (
  30651. vm,
  30652. expOrFn,
  30653. cb,
  30654. options,
  30655. isRenderWatcher
  30656. ) {
  30657. this.vm = vm;
  30658. if (isRenderWatcher) {
  30659. vm._watcher = this;
  30660. }
  30661. vm._watchers.push(this);
  30662. // options
  30663. if (options) {
  30664. this.deep = !!options.deep;
  30665. this.user = !!options.user;
  30666. this.lazy = !!options.lazy;
  30667. this.sync = !!options.sync;
  30668. } else {
  30669. this.deep = this.user = this.lazy = this.sync = false;
  30670. }
  30671. this.cb = cb;
  30672. this.id = ++uid$2; // uid for batching
  30673. this.active = true;
  30674. this.dirty = this.lazy; // for lazy watchers
  30675. this.deps = [];
  30676. this.newDeps = [];
  30677. this.depIds = new _Set();
  30678. this.newDepIds = new _Set();
  30679. this.expression = true
  30680. ? expOrFn.toString()
  30681. : '';
  30682. // parse expression for getter
  30683. if (typeof expOrFn === 'function') {
  30684. this.getter = expOrFn;
  30685. } else {
  30686. this.getter = parsePath(expOrFn);
  30687. if (!this.getter) {
  30688. this.getter = function () {};
  30689. "development" !== 'production' && warn(
  30690. "Failed watching path: \"" + expOrFn + "\" " +
  30691. 'Watcher only accepts simple dot-delimited paths. ' +
  30692. 'For full control, use a function instead.',
  30693. vm
  30694. );
  30695. }
  30696. }
  30697. this.value = this.lazy
  30698. ? undefined
  30699. : this.get();
  30700. };
  30701. /**
  30702. * Evaluate the getter, and re-collect dependencies.
  30703. */
  30704. Watcher.prototype.get = function get () {
  30705. pushTarget(this);
  30706. var value;
  30707. var vm = this.vm;
  30708. try {
  30709. value = this.getter.call(vm, vm);
  30710. } catch (e) {
  30711. if (this.user) {
  30712. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  30713. } else {
  30714. throw e
  30715. }
  30716. } finally {
  30717. // "touch" every property so they are all tracked as
  30718. // dependencies for deep watching
  30719. if (this.deep) {
  30720. traverse(value);
  30721. }
  30722. popTarget();
  30723. this.cleanupDeps();
  30724. }
  30725. return value
  30726. };
  30727. /**
  30728. * Add a dependency to this directive.
  30729. */
  30730. Watcher.prototype.addDep = function addDep (dep) {
  30731. var id = dep.id;
  30732. if (!this.newDepIds.has(id)) {
  30733. this.newDepIds.add(id);
  30734. this.newDeps.push(dep);
  30735. if (!this.depIds.has(id)) {
  30736. dep.addSub(this);
  30737. }
  30738. }
  30739. };
  30740. /**
  30741. * Clean up for dependency collection.
  30742. */
  30743. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  30744. var this$1 = this;
  30745. var i = this.deps.length;
  30746. while (i--) {
  30747. var dep = this$1.deps[i];
  30748. if (!this$1.newDepIds.has(dep.id)) {
  30749. dep.removeSub(this$1);
  30750. }
  30751. }
  30752. var tmp = this.depIds;
  30753. this.depIds = this.newDepIds;
  30754. this.newDepIds = tmp;
  30755. this.newDepIds.clear();
  30756. tmp = this.deps;
  30757. this.deps = this.newDeps;
  30758. this.newDeps = tmp;
  30759. this.newDeps.length = 0;
  30760. };
  30761. /**
  30762. * Subscriber interface.
  30763. * Will be called when a dependency changes.
  30764. */
  30765. Watcher.prototype.update = function update () {
  30766. /* istanbul ignore else */
  30767. if (this.lazy) {
  30768. this.dirty = true;
  30769. } else if (this.sync) {
  30770. this.run();
  30771. } else {
  30772. queueWatcher(this);
  30773. }
  30774. };
  30775. /**
  30776. * Scheduler job interface.
  30777. * Will be called by the scheduler.
  30778. */
  30779. Watcher.prototype.run = function run () {
  30780. if (this.active) {
  30781. var value = this.get();
  30782. if (
  30783. value !== this.value ||
  30784. // Deep watchers and watchers on Object/Arrays should fire even
  30785. // when the value is the same, because the value may
  30786. // have mutated.
  30787. isObject(value) ||
  30788. this.deep
  30789. ) {
  30790. // set new value
  30791. var oldValue = this.value;
  30792. this.value = value;
  30793. if (this.user) {
  30794. try {
  30795. this.cb.call(this.vm, value, oldValue);
  30796. } catch (e) {
  30797. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  30798. }
  30799. } else {
  30800. this.cb.call(this.vm, value, oldValue);
  30801. }
  30802. }
  30803. }
  30804. };
  30805. /**
  30806. * Evaluate the value of the watcher.
  30807. * This only gets called for lazy watchers.
  30808. */
  30809. Watcher.prototype.evaluate = function evaluate () {
  30810. this.value = this.get();
  30811. this.dirty = false;
  30812. };
  30813. /**
  30814. * Depend on all deps collected by this watcher.
  30815. */
  30816. Watcher.prototype.depend = function depend () {
  30817. var this$1 = this;
  30818. var i = this.deps.length;
  30819. while (i--) {
  30820. this$1.deps[i].depend();
  30821. }
  30822. };
  30823. /**
  30824. * Remove self from all dependencies' subscriber list.
  30825. */
  30826. Watcher.prototype.teardown = function teardown () {
  30827. var this$1 = this;
  30828. if (this.active) {
  30829. // remove self from vm's watcher list
  30830. // this is a somewhat expensive operation so we skip it
  30831. // if the vm is being destroyed.
  30832. if (!this.vm._isBeingDestroyed) {
  30833. remove(this.vm._watchers, this);
  30834. }
  30835. var i = this.deps.length;
  30836. while (i--) {
  30837. this$1.deps[i].removeSub(this$1);
  30838. }
  30839. this.active = false;
  30840. }
  30841. };
  30842. /* */
  30843. var sharedPropertyDefinition = {
  30844. enumerable: true,
  30845. configurable: true,
  30846. get: noop,
  30847. set: noop
  30848. };
  30849. function proxy (target, sourceKey, key) {
  30850. sharedPropertyDefinition.get = function proxyGetter () {
  30851. return this[sourceKey][key]
  30852. };
  30853. sharedPropertyDefinition.set = function proxySetter (val) {
  30854. this[sourceKey][key] = val;
  30855. };
  30856. Object.defineProperty(target, key, sharedPropertyDefinition);
  30857. }
  30858. function initState (vm) {
  30859. vm._watchers = [];
  30860. var opts = vm.$options;
  30861. if (opts.props) { initProps(vm, opts.props); }
  30862. if (opts.methods) { initMethods(vm, opts.methods); }
  30863. if (opts.data) {
  30864. initData(vm);
  30865. } else {
  30866. observe(vm._data = {}, true /* asRootData */);
  30867. }
  30868. if (opts.computed) { initComputed(vm, opts.computed); }
  30869. if (opts.watch && opts.watch !== nativeWatch) {
  30870. initWatch(vm, opts.watch);
  30871. }
  30872. }
  30873. function initProps (vm, propsOptions) {
  30874. var propsData = vm.$options.propsData || {};
  30875. var props = vm._props = {};
  30876. // cache prop keys so that future props updates can iterate using Array
  30877. // instead of dynamic object key enumeration.
  30878. var keys = vm.$options._propKeys = [];
  30879. var isRoot = !vm.$parent;
  30880. // root instance props should be converted
  30881. observerState.shouldConvert = isRoot;
  30882. var loop = function ( key ) {
  30883. keys.push(key);
  30884. var value = validateProp(key, propsOptions, propsData, vm);
  30885. /* istanbul ignore else */
  30886. if (true) {
  30887. var hyphenatedKey = hyphenate(key);
  30888. if (isReservedAttribute(hyphenatedKey) ||
  30889. config.isReservedAttr(hyphenatedKey)) {
  30890. warn(
  30891. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  30892. vm
  30893. );
  30894. }
  30895. defineReactive(props, key, value, function () {
  30896. if (vm.$parent && !isUpdatingChildComponent) {
  30897. warn(
  30898. "Avoid mutating a prop directly since the value will be " +
  30899. "overwritten whenever the parent component re-renders. " +
  30900. "Instead, use a data or computed property based on the prop's " +
  30901. "value. Prop being mutated: \"" + key + "\"",
  30902. vm
  30903. );
  30904. }
  30905. });
  30906. } else {
  30907. defineReactive(props, key, value);
  30908. }
  30909. // static props are already proxied on the component's prototype
  30910. // during Vue.extend(). We only need to proxy props defined at
  30911. // instantiation here.
  30912. if (!(key in vm)) {
  30913. proxy(vm, "_props", key);
  30914. }
  30915. };
  30916. for (var key in propsOptions) loop( key );
  30917. observerState.shouldConvert = true;
  30918. }
  30919. function initData (vm) {
  30920. var data = vm.$options.data;
  30921. data = vm._data = typeof data === 'function'
  30922. ? getData(data, vm)
  30923. : data || {};
  30924. if (!isPlainObject(data)) {
  30925. data = {};
  30926. "development" !== 'production' && warn(
  30927. 'data functions should return an object:\n' +
  30928. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  30929. vm
  30930. );
  30931. }
  30932. // proxy data on instance
  30933. var keys = Object.keys(data);
  30934. var props = vm.$options.props;
  30935. var methods = vm.$options.methods;
  30936. var i = keys.length;
  30937. while (i--) {
  30938. var key = keys[i];
  30939. if (true) {
  30940. if (methods && hasOwn(methods, key)) {
  30941. warn(
  30942. ("Method \"" + key + "\" has already been defined as a data property."),
  30943. vm
  30944. );
  30945. }
  30946. }
  30947. if (props && hasOwn(props, key)) {
  30948. "development" !== 'production' && warn(
  30949. "The data property \"" + key + "\" is already declared as a prop. " +
  30950. "Use prop default value instead.",
  30951. vm
  30952. );
  30953. } else if (!isReserved(key)) {
  30954. proxy(vm, "_data", key);
  30955. }
  30956. }
  30957. // observe data
  30958. observe(data, true /* asRootData */);
  30959. }
  30960. function getData (data, vm) {
  30961. try {
  30962. return data.call(vm, vm)
  30963. } catch (e) {
  30964. handleError(e, vm, "data()");
  30965. return {}
  30966. }
  30967. }
  30968. var computedWatcherOptions = { lazy: true };
  30969. function initComputed (vm, computed) {
  30970. // $flow-disable-line
  30971. var watchers = vm._computedWatchers = Object.create(null);
  30972. // computed properties are just getters during SSR
  30973. var isSSR = isServerRendering();
  30974. for (var key in computed) {
  30975. var userDef = computed[key];
  30976. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  30977. if ("development" !== 'production' && getter == null) {
  30978. warn(
  30979. ("Getter is missing for computed property \"" + key + "\"."),
  30980. vm
  30981. );
  30982. }
  30983. if (!isSSR) {
  30984. // create internal watcher for the computed property.
  30985. watchers[key] = new Watcher(
  30986. vm,
  30987. getter || noop,
  30988. noop,
  30989. computedWatcherOptions
  30990. );
  30991. }
  30992. // component-defined computed properties are already defined on the
  30993. // component prototype. We only need to define computed properties defined
  30994. // at instantiation here.
  30995. if (!(key in vm)) {
  30996. defineComputed(vm, key, userDef);
  30997. } else if (true) {
  30998. if (key in vm.$data) {
  30999. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  31000. } else if (vm.$options.props && key in vm.$options.props) {
  31001. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  31002. }
  31003. }
  31004. }
  31005. }
  31006. function defineComputed (
  31007. target,
  31008. key,
  31009. userDef
  31010. ) {
  31011. var shouldCache = !isServerRendering();
  31012. if (typeof userDef === 'function') {
  31013. sharedPropertyDefinition.get = shouldCache
  31014. ? createComputedGetter(key)
  31015. : userDef;
  31016. sharedPropertyDefinition.set = noop;
  31017. } else {
  31018. sharedPropertyDefinition.get = userDef.get
  31019. ? shouldCache && userDef.cache !== false
  31020. ? createComputedGetter(key)
  31021. : userDef.get
  31022. : noop;
  31023. sharedPropertyDefinition.set = userDef.set
  31024. ? userDef.set
  31025. : noop;
  31026. }
  31027. if ("development" !== 'production' &&
  31028. sharedPropertyDefinition.set === noop) {
  31029. sharedPropertyDefinition.set = function () {
  31030. warn(
  31031. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  31032. this
  31033. );
  31034. };
  31035. }
  31036. Object.defineProperty(target, key, sharedPropertyDefinition);
  31037. }
  31038. function createComputedGetter (key) {
  31039. return function computedGetter () {
  31040. var watcher = this._computedWatchers && this._computedWatchers[key];
  31041. if (watcher) {
  31042. if (watcher.dirty) {
  31043. watcher.evaluate();
  31044. }
  31045. if (Dep.target) {
  31046. watcher.depend();
  31047. }
  31048. return watcher.value
  31049. }
  31050. }
  31051. }
  31052. function initMethods (vm, methods) {
  31053. var props = vm.$options.props;
  31054. for (var key in methods) {
  31055. if (true) {
  31056. if (methods[key] == null) {
  31057. warn(
  31058. "Method \"" + key + "\" has an undefined value in the component definition. " +
  31059. "Did you reference the function correctly?",
  31060. vm
  31061. );
  31062. }
  31063. if (props && hasOwn(props, key)) {
  31064. warn(
  31065. ("Method \"" + key + "\" has already been defined as a prop."),
  31066. vm
  31067. );
  31068. }
  31069. if ((key in vm) && isReserved(key)) {
  31070. warn(
  31071. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  31072. "Avoid defining component methods that start with _ or $."
  31073. );
  31074. }
  31075. }
  31076. vm[key] = methods[key] == null ? noop : bind(methods[key], vm);
  31077. }
  31078. }
  31079. function initWatch (vm, watch) {
  31080. for (var key in watch) {
  31081. var handler = watch[key];
  31082. if (Array.isArray(handler)) {
  31083. for (var i = 0; i < handler.length; i++) {
  31084. createWatcher(vm, key, handler[i]);
  31085. }
  31086. } else {
  31087. createWatcher(vm, key, handler);
  31088. }
  31089. }
  31090. }
  31091. function createWatcher (
  31092. vm,
  31093. keyOrFn,
  31094. handler,
  31095. options
  31096. ) {
  31097. if (isPlainObject(handler)) {
  31098. options = handler;
  31099. handler = handler.handler;
  31100. }
  31101. if (typeof handler === 'string') {
  31102. handler = vm[handler];
  31103. }
  31104. return vm.$watch(keyOrFn, handler, options)
  31105. }
  31106. function stateMixin (Vue) {
  31107. // flow somehow has problems with directly declared definition object
  31108. // when using Object.defineProperty, so we have to procedurally build up
  31109. // the object here.
  31110. var dataDef = {};
  31111. dataDef.get = function () { return this._data };
  31112. var propsDef = {};
  31113. propsDef.get = function () { return this._props };
  31114. if (true) {
  31115. dataDef.set = function (newData) {
  31116. warn(
  31117. 'Avoid replacing instance root $data. ' +
  31118. 'Use nested data properties instead.',
  31119. this
  31120. );
  31121. };
  31122. propsDef.set = function () {
  31123. warn("$props is readonly.", this);
  31124. };
  31125. }
  31126. Object.defineProperty(Vue.prototype, '$data', dataDef);
  31127. Object.defineProperty(Vue.prototype, '$props', propsDef);
  31128. Vue.prototype.$set = set;
  31129. Vue.prototype.$delete = del;
  31130. Vue.prototype.$watch = function (
  31131. expOrFn,
  31132. cb,
  31133. options
  31134. ) {
  31135. var vm = this;
  31136. if (isPlainObject(cb)) {
  31137. return createWatcher(vm, expOrFn, cb, options)
  31138. }
  31139. options = options || {};
  31140. options.user = true;
  31141. var watcher = new Watcher(vm, expOrFn, cb, options);
  31142. if (options.immediate) {
  31143. cb.call(vm, watcher.value);
  31144. }
  31145. return function unwatchFn () {
  31146. watcher.teardown();
  31147. }
  31148. };
  31149. }
  31150. /* */
  31151. function initProvide (vm) {
  31152. var provide = vm.$options.provide;
  31153. if (provide) {
  31154. vm._provided = typeof provide === 'function'
  31155. ? provide.call(vm)
  31156. : provide;
  31157. }
  31158. }
  31159. function initInjections (vm) {
  31160. var result = resolveInject(vm.$options.inject, vm);
  31161. if (result) {
  31162. observerState.shouldConvert = false;
  31163. Object.keys(result).forEach(function (key) {
  31164. /* istanbul ignore else */
  31165. if (true) {
  31166. defineReactive(vm, key, result[key], function () {
  31167. warn(
  31168. "Avoid mutating an injected value directly since the changes will be " +
  31169. "overwritten whenever the provided component re-renders. " +
  31170. "injection being mutated: \"" + key + "\"",
  31171. vm
  31172. );
  31173. });
  31174. } else {
  31175. defineReactive(vm, key, result[key]);
  31176. }
  31177. });
  31178. observerState.shouldConvert = true;
  31179. }
  31180. }
  31181. function resolveInject (inject, vm) {
  31182. if (inject) {
  31183. // inject is :any because flow is not smart enough to figure out cached
  31184. var result = Object.create(null);
  31185. var keys = hasSymbol
  31186. ? Reflect.ownKeys(inject).filter(function (key) {
  31187. /* istanbul ignore next */
  31188. return Object.getOwnPropertyDescriptor(inject, key).enumerable
  31189. })
  31190. : Object.keys(inject);
  31191. for (var i = 0; i < keys.length; i++) {
  31192. var key = keys[i];
  31193. var provideKey = inject[key].from;
  31194. var source = vm;
  31195. while (source) {
  31196. if (source._provided && provideKey in source._provided) {
  31197. result[key] = source._provided[provideKey];
  31198. break
  31199. }
  31200. source = source.$parent;
  31201. }
  31202. if (!source) {
  31203. if ('default' in inject[key]) {
  31204. var provideDefault = inject[key].default;
  31205. result[key] = typeof provideDefault === 'function'
  31206. ? provideDefault.call(vm)
  31207. : provideDefault;
  31208. } else if (true) {
  31209. warn(("Injection \"" + key + "\" not found"), vm);
  31210. }
  31211. }
  31212. }
  31213. return result
  31214. }
  31215. }
  31216. /* */
  31217. /**
  31218. * Runtime helper for rendering v-for lists.
  31219. */
  31220. function renderList (
  31221. val,
  31222. render
  31223. ) {
  31224. var ret, i, l, keys, key;
  31225. if (Array.isArray(val) || typeof val === 'string') {
  31226. ret = new Array(val.length);
  31227. for (i = 0, l = val.length; i < l; i++) {
  31228. ret[i] = render(val[i], i);
  31229. }
  31230. } else if (typeof val === 'number') {
  31231. ret = new Array(val);
  31232. for (i = 0; i < val; i++) {
  31233. ret[i] = render(i + 1, i);
  31234. }
  31235. } else if (isObject(val)) {
  31236. keys = Object.keys(val);
  31237. ret = new Array(keys.length);
  31238. for (i = 0, l = keys.length; i < l; i++) {
  31239. key = keys[i];
  31240. ret[i] = render(val[key], key, i);
  31241. }
  31242. }
  31243. if (isDef(ret)) {
  31244. (ret)._isVList = true;
  31245. }
  31246. return ret
  31247. }
  31248. /* */
  31249. /**
  31250. * Runtime helper for rendering <slot>
  31251. */
  31252. function renderSlot (
  31253. name,
  31254. fallback,
  31255. props,
  31256. bindObject
  31257. ) {
  31258. var scopedSlotFn = this.$scopedSlots[name];
  31259. var nodes;
  31260. if (scopedSlotFn) { // scoped slot
  31261. props = props || {};
  31262. if (bindObject) {
  31263. if ("development" !== 'production' && !isObject(bindObject)) {
  31264. warn(
  31265. 'slot v-bind without argument expects an Object',
  31266. this
  31267. );
  31268. }
  31269. props = extend(extend({}, bindObject), props);
  31270. }
  31271. nodes = scopedSlotFn(props) || fallback;
  31272. } else {
  31273. var slotNodes = this.$slots[name];
  31274. // warn duplicate slot usage
  31275. if (slotNodes) {
  31276. if ("development" !== 'production' && slotNodes._rendered) {
  31277. warn(
  31278. "Duplicate presence of slot \"" + name + "\" found in the same render tree " +
  31279. "- this will likely cause render errors.",
  31280. this
  31281. );
  31282. }
  31283. slotNodes._rendered = true;
  31284. }
  31285. nodes = slotNodes || fallback;
  31286. }
  31287. var target = props && props.slot;
  31288. if (target) {
  31289. return this.$createElement('template', { slot: target }, nodes)
  31290. } else {
  31291. return nodes
  31292. }
  31293. }
  31294. /* */
  31295. /**
  31296. * Runtime helper for resolving filters
  31297. */
  31298. function resolveFilter (id) {
  31299. return resolveAsset(this.$options, 'filters', id, true) || identity
  31300. }
  31301. /* */
  31302. /**
  31303. * Runtime helper for checking keyCodes from config.
  31304. * exposed as Vue.prototype._k
  31305. * passing in eventKeyName as last argument separately for backwards compat
  31306. */
  31307. function checkKeyCodes (
  31308. eventKeyCode,
  31309. key,
  31310. builtInAlias,
  31311. eventKeyName
  31312. ) {
  31313. var keyCodes = config.keyCodes[key] || builtInAlias;
  31314. if (keyCodes) {
  31315. if (Array.isArray(keyCodes)) {
  31316. return keyCodes.indexOf(eventKeyCode) === -1
  31317. } else {
  31318. return keyCodes !== eventKeyCode
  31319. }
  31320. } else if (eventKeyName) {
  31321. return hyphenate(eventKeyName) !== key
  31322. }
  31323. }
  31324. /* */
  31325. /**
  31326. * Runtime helper for merging v-bind="object" into a VNode's data.
  31327. */
  31328. function bindObjectProps (
  31329. data,
  31330. tag,
  31331. value,
  31332. asProp,
  31333. isSync
  31334. ) {
  31335. if (value) {
  31336. if (!isObject(value)) {
  31337. "development" !== 'production' && warn(
  31338. 'v-bind without argument expects an Object or Array value',
  31339. this
  31340. );
  31341. } else {
  31342. if (Array.isArray(value)) {
  31343. value = toObject(value);
  31344. }
  31345. var hash;
  31346. var loop = function ( key ) {
  31347. if (
  31348. key === 'class' ||
  31349. key === 'style' ||
  31350. isReservedAttribute(key)
  31351. ) {
  31352. hash = data;
  31353. } else {
  31354. var type = data.attrs && data.attrs.type;
  31355. hash = asProp || config.mustUseProp(tag, type, key)
  31356. ? data.domProps || (data.domProps = {})
  31357. : data.attrs || (data.attrs = {});
  31358. }
  31359. if (!(key in hash)) {
  31360. hash[key] = value[key];
  31361. if (isSync) {
  31362. var on = data.on || (data.on = {});
  31363. on[("update:" + key)] = function ($event) {
  31364. value[key] = $event;
  31365. };
  31366. }
  31367. }
  31368. };
  31369. for (var key in value) loop( key );
  31370. }
  31371. }
  31372. return data
  31373. }
  31374. /* */
  31375. /**
  31376. * Runtime helper for rendering static trees.
  31377. */
  31378. function renderStatic (
  31379. index,
  31380. isInFor
  31381. ) {
  31382. var cached = this._staticTrees || (this._staticTrees = []);
  31383. var tree = cached[index];
  31384. // if has already-rendered static tree and not inside v-for,
  31385. // we can reuse the same tree by doing a shallow clone.
  31386. if (tree && !isInFor) {
  31387. return Array.isArray(tree)
  31388. ? cloneVNodes(tree)
  31389. : cloneVNode(tree)
  31390. }
  31391. // otherwise, render a fresh tree.
  31392. tree = cached[index] = this.$options.staticRenderFns[index].call(
  31393. this._renderProxy,
  31394. null,
  31395. this // for render fns generated for functional component templates
  31396. );
  31397. markStatic(tree, ("__static__" + index), false);
  31398. return tree
  31399. }
  31400. /**
  31401. * Runtime helper for v-once.
  31402. * Effectively it means marking the node as static with a unique key.
  31403. */
  31404. function markOnce (
  31405. tree,
  31406. index,
  31407. key
  31408. ) {
  31409. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  31410. return tree
  31411. }
  31412. function markStatic (
  31413. tree,
  31414. key,
  31415. isOnce
  31416. ) {
  31417. if (Array.isArray(tree)) {
  31418. for (var i = 0; i < tree.length; i++) {
  31419. if (tree[i] && typeof tree[i] !== 'string') {
  31420. markStaticNode(tree[i], (key + "_" + i), isOnce);
  31421. }
  31422. }
  31423. } else {
  31424. markStaticNode(tree, key, isOnce);
  31425. }
  31426. }
  31427. function markStaticNode (node, key, isOnce) {
  31428. node.isStatic = true;
  31429. node.key = key;
  31430. node.isOnce = isOnce;
  31431. }
  31432. /* */
  31433. function bindObjectListeners (data, value) {
  31434. if (value) {
  31435. if (!isPlainObject(value)) {
  31436. "development" !== 'production' && warn(
  31437. 'v-on without argument expects an Object value',
  31438. this
  31439. );
  31440. } else {
  31441. var on = data.on = data.on ? extend({}, data.on) : {};
  31442. for (var key in value) {
  31443. var existing = on[key];
  31444. var ours = value[key];
  31445. on[key] = existing ? [].concat(existing, ours) : ours;
  31446. }
  31447. }
  31448. }
  31449. return data
  31450. }
  31451. /* */
  31452. function installRenderHelpers (target) {
  31453. target._o = markOnce;
  31454. target._n = toNumber;
  31455. target._s = toString;
  31456. target._l = renderList;
  31457. target._t = renderSlot;
  31458. target._q = looseEqual;
  31459. target._i = looseIndexOf;
  31460. target._m = renderStatic;
  31461. target._f = resolveFilter;
  31462. target._k = checkKeyCodes;
  31463. target._b = bindObjectProps;
  31464. target._v = createTextVNode;
  31465. target._e = createEmptyVNode;
  31466. target._u = resolveScopedSlots;
  31467. target._g = bindObjectListeners;
  31468. }
  31469. /* */
  31470. function FunctionalRenderContext (
  31471. data,
  31472. props,
  31473. children,
  31474. parent,
  31475. Ctor
  31476. ) {
  31477. var options = Ctor.options;
  31478. this.data = data;
  31479. this.props = props;
  31480. this.children = children;
  31481. this.parent = parent;
  31482. this.listeners = data.on || emptyObject;
  31483. this.injections = resolveInject(options.inject, parent);
  31484. this.slots = function () { return resolveSlots(children, parent); };
  31485. // ensure the createElement function in functional components
  31486. // gets a unique context - this is necessary for correct named slot check
  31487. var contextVm = Object.create(parent);
  31488. var isCompiled = isTrue(options._compiled);
  31489. var needNormalization = !isCompiled;
  31490. // support for compiled functional template
  31491. if (isCompiled) {
  31492. // exposing $options for renderStatic()
  31493. this.$options = options;
  31494. // pre-resolve slots for renderSlot()
  31495. this.$slots = this.slots();
  31496. this.$scopedSlots = data.scopedSlots || emptyObject;
  31497. }
  31498. if (options._scopeId) {
  31499. this._c = function (a, b, c, d) {
  31500. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  31501. if (vnode) {
  31502. vnode.fnScopeId = options._scopeId;
  31503. vnode.fnContext = parent;
  31504. }
  31505. return vnode
  31506. };
  31507. } else {
  31508. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  31509. }
  31510. }
  31511. installRenderHelpers(FunctionalRenderContext.prototype);
  31512. function createFunctionalComponent (
  31513. Ctor,
  31514. propsData,
  31515. data,
  31516. contextVm,
  31517. children
  31518. ) {
  31519. var options = Ctor.options;
  31520. var props = {};
  31521. var propOptions = options.props;
  31522. if (isDef(propOptions)) {
  31523. for (var key in propOptions) {
  31524. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  31525. }
  31526. } else {
  31527. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  31528. if (isDef(data.props)) { mergeProps(props, data.props); }
  31529. }
  31530. var renderContext = new FunctionalRenderContext(
  31531. data,
  31532. props,
  31533. children,
  31534. contextVm,
  31535. Ctor
  31536. );
  31537. var vnode = options.render.call(null, renderContext._c, renderContext);
  31538. if (vnode instanceof VNode) {
  31539. vnode.fnContext = contextVm;
  31540. vnode.fnOptions = options;
  31541. if (data.slot) {
  31542. (vnode.data || (vnode.data = {})).slot = data.slot;
  31543. }
  31544. }
  31545. return vnode
  31546. }
  31547. function mergeProps (to, from) {
  31548. for (var key in from) {
  31549. to[camelize(key)] = from[key];
  31550. }
  31551. }
  31552. /* */
  31553. // Register the component hook to weex native render engine.
  31554. // The hook will be triggered by native, not javascript.
  31555. // Updates the state of the component to weex native render engine.
  31556. /* */
  31557. // https://github.com/Hanks10100/weex-native-directive/tree/master/component
  31558. // listening on native callback
  31559. /* */
  31560. /* */
  31561. // hooks to be invoked on component VNodes during patch
  31562. var componentVNodeHooks = {
  31563. init: function init (
  31564. vnode,
  31565. hydrating,
  31566. parentElm,
  31567. refElm
  31568. ) {
  31569. if (!vnode.componentInstance || vnode.componentInstance._isDestroyed) {
  31570. var child = vnode.componentInstance = createComponentInstanceForVnode(
  31571. vnode,
  31572. activeInstance,
  31573. parentElm,
  31574. refElm
  31575. );
  31576. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  31577. } else if (vnode.data.keepAlive) {
  31578. // kept-alive components, treat as a patch
  31579. var mountedNode = vnode; // work around flow
  31580. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  31581. }
  31582. },
  31583. prepatch: function prepatch (oldVnode, vnode) {
  31584. var options = vnode.componentOptions;
  31585. var child = vnode.componentInstance = oldVnode.componentInstance;
  31586. updateChildComponent(
  31587. child,
  31588. options.propsData, // updated props
  31589. options.listeners, // updated listeners
  31590. vnode, // new parent vnode
  31591. options.children // new children
  31592. );
  31593. },
  31594. insert: function insert (vnode) {
  31595. var context = vnode.context;
  31596. var componentInstance = vnode.componentInstance;
  31597. if (!componentInstance._isMounted) {
  31598. componentInstance._isMounted = true;
  31599. callHook(componentInstance, 'mounted');
  31600. }
  31601. if (vnode.data.keepAlive) {
  31602. if (context._isMounted) {
  31603. // vue-router#1212
  31604. // During updates, a kept-alive component's child components may
  31605. // change, so directly walking the tree here may call activated hooks
  31606. // on incorrect children. Instead we push them into a queue which will
  31607. // be processed after the whole patch process ended.
  31608. queueActivatedComponent(componentInstance);
  31609. } else {
  31610. activateChildComponent(componentInstance, true /* direct */);
  31611. }
  31612. }
  31613. },
  31614. destroy: function destroy (vnode) {
  31615. var componentInstance = vnode.componentInstance;
  31616. if (!componentInstance._isDestroyed) {
  31617. if (!vnode.data.keepAlive) {
  31618. componentInstance.$destroy();
  31619. } else {
  31620. deactivateChildComponent(componentInstance, true /* direct */);
  31621. }
  31622. }
  31623. }
  31624. };
  31625. var hooksToMerge = Object.keys(componentVNodeHooks);
  31626. function createComponent (
  31627. Ctor,
  31628. data,
  31629. context,
  31630. children,
  31631. tag
  31632. ) {
  31633. if (isUndef(Ctor)) {
  31634. return
  31635. }
  31636. var baseCtor = context.$options._base;
  31637. // plain options object: turn it into a constructor
  31638. if (isObject(Ctor)) {
  31639. Ctor = baseCtor.extend(Ctor);
  31640. }
  31641. // if at this stage it's not a constructor or an async component factory,
  31642. // reject.
  31643. if (typeof Ctor !== 'function') {
  31644. if (true) {
  31645. warn(("Invalid Component definition: " + (String(Ctor))), context);
  31646. }
  31647. return
  31648. }
  31649. // async component
  31650. var asyncFactory;
  31651. if (isUndef(Ctor.cid)) {
  31652. asyncFactory = Ctor;
  31653. Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context);
  31654. if (Ctor === undefined) {
  31655. // return a placeholder node for async component, which is rendered
  31656. // as a comment node but preserves all the raw information for the node.
  31657. // the information will be used for async server-rendering and hydration.
  31658. return createAsyncPlaceholder(
  31659. asyncFactory,
  31660. data,
  31661. context,
  31662. children,
  31663. tag
  31664. )
  31665. }
  31666. }
  31667. data = data || {};
  31668. // resolve constructor options in case global mixins are applied after
  31669. // component constructor creation
  31670. resolveConstructorOptions(Ctor);
  31671. // transform component v-model data into props & events
  31672. if (isDef(data.model)) {
  31673. transformModel(Ctor.options, data);
  31674. }
  31675. // extract props
  31676. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  31677. // functional component
  31678. if (isTrue(Ctor.options.functional)) {
  31679. return createFunctionalComponent(Ctor, propsData, data, context, children)
  31680. }
  31681. // extract listeners, since these needs to be treated as
  31682. // child component listeners instead of DOM listeners
  31683. var listeners = data.on;
  31684. // replace with listeners with .native modifier
  31685. // so it gets processed during parent component patch.
  31686. data.on = data.nativeOn;
  31687. if (isTrue(Ctor.options.abstract)) {
  31688. // abstract components do not keep anything
  31689. // other than props & listeners & slot
  31690. // work around flow
  31691. var slot = data.slot;
  31692. data = {};
  31693. if (slot) {
  31694. data.slot = slot;
  31695. }
  31696. }
  31697. // merge component management hooks onto the placeholder node
  31698. mergeHooks(data);
  31699. // return a placeholder vnode
  31700. var name = Ctor.options.name || tag;
  31701. var vnode = new VNode(
  31702. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  31703. data, undefined, undefined, undefined, context,
  31704. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  31705. asyncFactory
  31706. );
  31707. // Weex specific: invoke recycle-list optimized @render function for
  31708. // extracting cell-slot template.
  31709. // https://github.com/Hanks10100/weex-native-directive/tree/master/component
  31710. /* istanbul ignore if */
  31711. return vnode
  31712. }
  31713. function createComponentInstanceForVnode (
  31714. vnode, // we know it's MountedComponentVNode but flow doesn't
  31715. parent, // activeInstance in lifecycle state
  31716. parentElm,
  31717. refElm
  31718. ) {
  31719. var options = {
  31720. _isComponent: true,
  31721. parent: parent,
  31722. _parentVnode: vnode,
  31723. _parentElm: parentElm || null,
  31724. _refElm: refElm || null
  31725. };
  31726. // check inline-template render functions
  31727. var inlineTemplate = vnode.data.inlineTemplate;
  31728. if (isDef(inlineTemplate)) {
  31729. options.render = inlineTemplate.render;
  31730. options.staticRenderFns = inlineTemplate.staticRenderFns;
  31731. }
  31732. return new vnode.componentOptions.Ctor(options)
  31733. }
  31734. function mergeHooks (data) {
  31735. if (!data.hook) {
  31736. data.hook = {};
  31737. }
  31738. for (var i = 0; i < hooksToMerge.length; i++) {
  31739. var key = hooksToMerge[i];
  31740. var fromParent = data.hook[key];
  31741. var ours = componentVNodeHooks[key];
  31742. data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours;
  31743. }
  31744. }
  31745. function mergeHook$1 (one, two) {
  31746. return function (a, b, c, d) {
  31747. one(a, b, c, d);
  31748. two(a, b, c, d);
  31749. }
  31750. }
  31751. // transform component v-model info (value and callback) into
  31752. // prop and event handler respectively.
  31753. function transformModel (options, data) {
  31754. var prop = (options.model && options.model.prop) || 'value';
  31755. var event = (options.model && options.model.event) || 'input';(data.props || (data.props = {}))[prop] = data.model.value;
  31756. var on = data.on || (data.on = {});
  31757. if (isDef(on[event])) {
  31758. on[event] = [data.model.callback].concat(on[event]);
  31759. } else {
  31760. on[event] = data.model.callback;
  31761. }
  31762. }
  31763. /* */
  31764. var SIMPLE_NORMALIZE = 1;
  31765. var ALWAYS_NORMALIZE = 2;
  31766. // wrapper function for providing a more flexible interface
  31767. // without getting yelled at by flow
  31768. function createElement (
  31769. context,
  31770. tag,
  31771. data,
  31772. children,
  31773. normalizationType,
  31774. alwaysNormalize
  31775. ) {
  31776. if (Array.isArray(data) || isPrimitive(data)) {
  31777. normalizationType = children;
  31778. children = data;
  31779. data = undefined;
  31780. }
  31781. if (isTrue(alwaysNormalize)) {
  31782. normalizationType = ALWAYS_NORMALIZE;
  31783. }
  31784. return _createElement(context, tag, data, children, normalizationType)
  31785. }
  31786. function _createElement (
  31787. context,
  31788. tag,
  31789. data,
  31790. children,
  31791. normalizationType
  31792. ) {
  31793. if (isDef(data) && isDef((data).__ob__)) {
  31794. "development" !== 'production' && warn(
  31795. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  31796. 'Always create fresh vnode data objects in each render!',
  31797. context
  31798. );
  31799. return createEmptyVNode()
  31800. }
  31801. // object syntax in v-bind
  31802. if (isDef(data) && isDef(data.is)) {
  31803. tag = data.is;
  31804. }
  31805. if (!tag) {
  31806. // in case of component :is set to falsy value
  31807. return createEmptyVNode()
  31808. }
  31809. // warn against non-primitive key
  31810. if ("development" !== 'production' &&
  31811. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  31812. ) {
  31813. {
  31814. warn(
  31815. 'Avoid using non-primitive value as key, ' +
  31816. 'use string/number value instead.',
  31817. context
  31818. );
  31819. }
  31820. }
  31821. // support single function children as default scoped slot
  31822. if (Array.isArray(children) &&
  31823. typeof children[0] === 'function'
  31824. ) {
  31825. data = data || {};
  31826. data.scopedSlots = { default: children[0] };
  31827. children.length = 0;
  31828. }
  31829. if (normalizationType === ALWAYS_NORMALIZE) {
  31830. children = normalizeChildren(children);
  31831. } else if (normalizationType === SIMPLE_NORMALIZE) {
  31832. children = simpleNormalizeChildren(children);
  31833. }
  31834. var vnode, ns;
  31835. if (typeof tag === 'string') {
  31836. var Ctor;
  31837. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  31838. if (config.isReservedTag(tag)) {
  31839. // platform built-in elements
  31840. vnode = new VNode(
  31841. config.parsePlatformTagName(tag), data, children,
  31842. undefined, undefined, context
  31843. );
  31844. } else if (isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  31845. // component
  31846. vnode = createComponent(Ctor, data, context, children, tag);
  31847. } else {
  31848. // unknown or unlisted namespaced elements
  31849. // check at runtime because it may get assigned a namespace when its
  31850. // parent normalizes children
  31851. vnode = new VNode(
  31852. tag, data, children,
  31853. undefined, undefined, context
  31854. );
  31855. }
  31856. } else {
  31857. // direct component options / constructor
  31858. vnode = createComponent(tag, data, context, children);
  31859. }
  31860. if (isDef(vnode)) {
  31861. if (ns) { applyNS(vnode, ns); }
  31862. return vnode
  31863. } else {
  31864. return createEmptyVNode()
  31865. }
  31866. }
  31867. function applyNS (vnode, ns, force) {
  31868. vnode.ns = ns;
  31869. if (vnode.tag === 'foreignObject') {
  31870. // use default namespace inside foreignObject
  31871. ns = undefined;
  31872. force = true;
  31873. }
  31874. if (isDef(vnode.children)) {
  31875. for (var i = 0, l = vnode.children.length; i < l; i++) {
  31876. var child = vnode.children[i];
  31877. if (isDef(child.tag) && (isUndef(child.ns) || isTrue(force))) {
  31878. applyNS(child, ns, force);
  31879. }
  31880. }
  31881. }
  31882. }
  31883. /* */
  31884. function initRender (vm) {
  31885. vm._vnode = null; // the root of the child tree
  31886. vm._staticTrees = null; // v-once cached trees
  31887. var options = vm.$options;
  31888. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  31889. var renderContext = parentVnode && parentVnode.context;
  31890. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  31891. vm.$scopedSlots = emptyObject;
  31892. // bind the createElement fn to this instance
  31893. // so that we get proper render context inside it.
  31894. // args order: tag, data, children, normalizationType, alwaysNormalize
  31895. // internal version is used by render functions compiled from templates
  31896. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  31897. // normalization is always applied for the public version, used in
  31898. // user-written render functions.
  31899. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  31900. // $attrs & $listeners are exposed for easier HOC creation.
  31901. // they need to be reactive so that HOCs using them are always updated
  31902. var parentData = parentVnode && parentVnode.data;
  31903. /* istanbul ignore else */
  31904. if (true) {
  31905. defineReactive(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  31906. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  31907. }, true);
  31908. defineReactive(vm, '$listeners', options._parentListeners || emptyObject, function () {
  31909. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  31910. }, true);
  31911. } else {
  31912. defineReactive(vm, '$attrs', parentData && parentData.attrs || emptyObject, null, true);
  31913. defineReactive(vm, '$listeners', options._parentListeners || emptyObject, null, true);
  31914. }
  31915. }
  31916. function renderMixin (Vue) {
  31917. // install runtime convenience helpers
  31918. installRenderHelpers(Vue.prototype);
  31919. Vue.prototype.$nextTick = function (fn) {
  31920. return nextTick(fn, this)
  31921. };
  31922. Vue.prototype._render = function () {
  31923. var vm = this;
  31924. var ref = vm.$options;
  31925. var render = ref.render;
  31926. var _parentVnode = ref._parentVnode;
  31927. if (vm._isMounted) {
  31928. // if the parent didn't update, the slot nodes will be the ones from
  31929. // last render. They need to be cloned to ensure "freshness" for this render.
  31930. for (var key in vm.$slots) {
  31931. var slot = vm.$slots[key];
  31932. // _rendered is a flag added by renderSlot, but may not be present
  31933. // if the slot is passed from manually written render functions
  31934. if (slot._rendered || (slot[0] && slot[0].elm)) {
  31935. vm.$slots[key] = cloneVNodes(slot, true /* deep */);
  31936. }
  31937. }
  31938. }
  31939. vm.$scopedSlots = (_parentVnode && _parentVnode.data.scopedSlots) || emptyObject;
  31940. // set parent vnode. this allows render functions to have access
  31941. // to the data on the placeholder node.
  31942. vm.$vnode = _parentVnode;
  31943. // render self
  31944. var vnode;
  31945. try {
  31946. vnode = render.call(vm._renderProxy, vm.$createElement);
  31947. } catch (e) {
  31948. handleError(e, vm, "render");
  31949. // return error render result,
  31950. // or previous vnode to prevent render error causing blank component
  31951. /* istanbul ignore else */
  31952. if (true) {
  31953. if (vm.$options.renderError) {
  31954. try {
  31955. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  31956. } catch (e) {
  31957. handleError(e, vm, "renderError");
  31958. vnode = vm._vnode;
  31959. }
  31960. } else {
  31961. vnode = vm._vnode;
  31962. }
  31963. } else {
  31964. vnode = vm._vnode;
  31965. }
  31966. }
  31967. // return empty vnode in case the render function errored out
  31968. if (!(vnode instanceof VNode)) {
  31969. if ("development" !== 'production' && Array.isArray(vnode)) {
  31970. warn(
  31971. 'Multiple root nodes returned from render function. Render function ' +
  31972. 'should return a single root node.',
  31973. vm
  31974. );
  31975. }
  31976. vnode = createEmptyVNode();
  31977. }
  31978. // set parent
  31979. vnode.parent = _parentVnode;
  31980. return vnode
  31981. };
  31982. }
  31983. /* */
  31984. var uid$1 = 0;
  31985. function initMixin (Vue) {
  31986. Vue.prototype._init = function (options) {
  31987. var vm = this;
  31988. // a uid
  31989. vm._uid = uid$1++;
  31990. var startTag, endTag;
  31991. /* istanbul ignore if */
  31992. if ("development" !== 'production' && config.performance && mark) {
  31993. startTag = "vue-perf-start:" + (vm._uid);
  31994. endTag = "vue-perf-end:" + (vm._uid);
  31995. mark(startTag);
  31996. }
  31997. // a flag to avoid this being observed
  31998. vm._isVue = true;
  31999. // merge options
  32000. if (options && options._isComponent) {
  32001. // optimize internal component instantiation
  32002. // since dynamic options merging is pretty slow, and none of the
  32003. // internal component options needs special treatment.
  32004. initInternalComponent(vm, options);
  32005. } else {
  32006. vm.$options = mergeOptions(
  32007. resolveConstructorOptions(vm.constructor),
  32008. options || {},
  32009. vm
  32010. );
  32011. }
  32012. /* istanbul ignore else */
  32013. if (true) {
  32014. initProxy(vm);
  32015. } else {
  32016. vm._renderProxy = vm;
  32017. }
  32018. // expose real self
  32019. vm._self = vm;
  32020. initLifecycle(vm);
  32021. initEvents(vm);
  32022. initRender(vm);
  32023. callHook(vm, 'beforeCreate');
  32024. initInjections(vm); // resolve injections before data/props
  32025. initState(vm);
  32026. initProvide(vm); // resolve provide after data/props
  32027. callHook(vm, 'created');
  32028. /* istanbul ignore if */
  32029. if ("development" !== 'production' && config.performance && mark) {
  32030. vm._name = formatComponentName(vm, false);
  32031. mark(endTag);
  32032. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  32033. }
  32034. if (vm.$options.el) {
  32035. vm.$mount(vm.$options.el);
  32036. }
  32037. };
  32038. }
  32039. function initInternalComponent (vm, options) {
  32040. var opts = vm.$options = Object.create(vm.constructor.options);
  32041. // doing this because it's faster than dynamic enumeration.
  32042. var parentVnode = options._parentVnode;
  32043. opts.parent = options.parent;
  32044. opts._parentVnode = parentVnode;
  32045. opts._parentElm = options._parentElm;
  32046. opts._refElm = options._refElm;
  32047. var vnodeComponentOptions = parentVnode.componentOptions;
  32048. opts.propsData = vnodeComponentOptions.propsData;
  32049. opts._parentListeners = vnodeComponentOptions.listeners;
  32050. opts._renderChildren = vnodeComponentOptions.children;
  32051. opts._componentTag = vnodeComponentOptions.tag;
  32052. if (options.render) {
  32053. opts.render = options.render;
  32054. opts.staticRenderFns = options.staticRenderFns;
  32055. }
  32056. }
  32057. function resolveConstructorOptions (Ctor) {
  32058. var options = Ctor.options;
  32059. if (Ctor.super) {
  32060. var superOptions = resolveConstructorOptions(Ctor.super);
  32061. var cachedSuperOptions = Ctor.superOptions;
  32062. if (superOptions !== cachedSuperOptions) {
  32063. // super option changed,
  32064. // need to resolve new options.
  32065. Ctor.superOptions = superOptions;
  32066. // check if there are any late-modified/attached options (#4976)
  32067. var modifiedOptions = resolveModifiedOptions(Ctor);
  32068. // update base extend options
  32069. if (modifiedOptions) {
  32070. extend(Ctor.extendOptions, modifiedOptions);
  32071. }
  32072. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  32073. if (options.name) {
  32074. options.components[options.name] = Ctor;
  32075. }
  32076. }
  32077. }
  32078. return options
  32079. }
  32080. function resolveModifiedOptions (Ctor) {
  32081. var modified;
  32082. var latest = Ctor.options;
  32083. var extended = Ctor.extendOptions;
  32084. var sealed = Ctor.sealedOptions;
  32085. for (var key in latest) {
  32086. if (latest[key] !== sealed[key]) {
  32087. if (!modified) { modified = {}; }
  32088. modified[key] = dedupe(latest[key], extended[key], sealed[key]);
  32089. }
  32090. }
  32091. return modified
  32092. }
  32093. function dedupe (latest, extended, sealed) {
  32094. // compare latest and sealed to ensure lifecycle hooks won't be duplicated
  32095. // between merges
  32096. if (Array.isArray(latest)) {
  32097. var res = [];
  32098. sealed = Array.isArray(sealed) ? sealed : [sealed];
  32099. extended = Array.isArray(extended) ? extended : [extended];
  32100. for (var i = 0; i < latest.length; i++) {
  32101. // push original options and not sealed options to exclude duplicated options
  32102. if (extended.indexOf(latest[i]) >= 0 || sealed.indexOf(latest[i]) < 0) {
  32103. res.push(latest[i]);
  32104. }
  32105. }
  32106. return res
  32107. } else {
  32108. return latest
  32109. }
  32110. }
  32111. function Vue$3 (options) {
  32112. if ("development" !== 'production' &&
  32113. !(this instanceof Vue$3)
  32114. ) {
  32115. warn('Vue is a constructor and should be called with the `new` keyword');
  32116. }
  32117. this._init(options);
  32118. }
  32119. initMixin(Vue$3);
  32120. stateMixin(Vue$3);
  32121. eventsMixin(Vue$3);
  32122. lifecycleMixin(Vue$3);
  32123. renderMixin(Vue$3);
  32124. /* */
  32125. function initUse (Vue) {
  32126. Vue.use = function (plugin) {
  32127. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  32128. if (installedPlugins.indexOf(plugin) > -1) {
  32129. return this
  32130. }
  32131. // additional parameters
  32132. var args = toArray(arguments, 1);
  32133. args.unshift(this);
  32134. if (typeof plugin.install === 'function') {
  32135. plugin.install.apply(plugin, args);
  32136. } else if (typeof plugin === 'function') {
  32137. plugin.apply(null, args);
  32138. }
  32139. installedPlugins.push(plugin);
  32140. return this
  32141. };
  32142. }
  32143. /* */
  32144. function initMixin$1 (Vue) {
  32145. Vue.mixin = function (mixin) {
  32146. this.options = mergeOptions(this.options, mixin);
  32147. return this
  32148. };
  32149. }
  32150. /* */
  32151. function initExtend (Vue) {
  32152. /**
  32153. * Each instance constructor, including Vue, has a unique
  32154. * cid. This enables us to create wrapped "child
  32155. * constructors" for prototypal inheritance and cache them.
  32156. */
  32157. Vue.cid = 0;
  32158. var cid = 1;
  32159. /**
  32160. * Class inheritance
  32161. */
  32162. Vue.extend = function (extendOptions) {
  32163. extendOptions = extendOptions || {};
  32164. var Super = this;
  32165. var SuperId = Super.cid;
  32166. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  32167. if (cachedCtors[SuperId]) {
  32168. return cachedCtors[SuperId]
  32169. }
  32170. var name = extendOptions.name || Super.options.name;
  32171. if ("development" !== 'production' && name) {
  32172. validateComponentName(name);
  32173. }
  32174. var Sub = function VueComponent (options) {
  32175. this._init(options);
  32176. };
  32177. Sub.prototype = Object.create(Super.prototype);
  32178. Sub.prototype.constructor = Sub;
  32179. Sub.cid = cid++;
  32180. Sub.options = mergeOptions(
  32181. Super.options,
  32182. extendOptions
  32183. );
  32184. Sub['super'] = Super;
  32185. // For props and computed properties, we define the proxy getters on
  32186. // the Vue instances at extension time, on the extended prototype. This
  32187. // avoids Object.defineProperty calls for each instance created.
  32188. if (Sub.options.props) {
  32189. initProps$1(Sub);
  32190. }
  32191. if (Sub.options.computed) {
  32192. initComputed$1(Sub);
  32193. }
  32194. // allow further extension/mixin/plugin usage
  32195. Sub.extend = Super.extend;
  32196. Sub.mixin = Super.mixin;
  32197. Sub.use = Super.use;
  32198. // create asset registers, so extended classes
  32199. // can have their private assets too.
  32200. ASSET_TYPES.forEach(function (type) {
  32201. Sub[type] = Super[type];
  32202. });
  32203. // enable recursive self-lookup
  32204. if (name) {
  32205. Sub.options.components[name] = Sub;
  32206. }
  32207. // keep a reference to the super options at extension time.
  32208. // later at instantiation we can check if Super's options have
  32209. // been updated.
  32210. Sub.superOptions = Super.options;
  32211. Sub.extendOptions = extendOptions;
  32212. Sub.sealedOptions = extend({}, Sub.options);
  32213. // cache constructor
  32214. cachedCtors[SuperId] = Sub;
  32215. return Sub
  32216. };
  32217. }
  32218. function initProps$1 (Comp) {
  32219. var props = Comp.options.props;
  32220. for (var key in props) {
  32221. proxy(Comp.prototype, "_props", key);
  32222. }
  32223. }
  32224. function initComputed$1 (Comp) {
  32225. var computed = Comp.options.computed;
  32226. for (var key in computed) {
  32227. defineComputed(Comp.prototype, key, computed[key]);
  32228. }
  32229. }
  32230. /* */
  32231. function initAssetRegisters (Vue) {
  32232. /**
  32233. * Create asset registration methods.
  32234. */
  32235. ASSET_TYPES.forEach(function (type) {
  32236. Vue[type] = function (
  32237. id,
  32238. definition
  32239. ) {
  32240. if (!definition) {
  32241. return this.options[type + 's'][id]
  32242. } else {
  32243. /* istanbul ignore if */
  32244. if ("development" !== 'production' && type === 'component') {
  32245. validateComponentName(id);
  32246. }
  32247. if (type === 'component' && isPlainObject(definition)) {
  32248. definition.name = definition.name || id;
  32249. definition = this.options._base.extend(definition);
  32250. }
  32251. if (type === 'directive' && typeof definition === 'function') {
  32252. definition = { bind: definition, update: definition };
  32253. }
  32254. this.options[type + 's'][id] = definition;
  32255. return definition
  32256. }
  32257. };
  32258. });
  32259. }
  32260. /* */
  32261. function getComponentName (opts) {
  32262. return opts && (opts.Ctor.options.name || opts.tag)
  32263. }
  32264. function matches (pattern, name) {
  32265. if (Array.isArray(pattern)) {
  32266. return pattern.indexOf(name) > -1
  32267. } else if (typeof pattern === 'string') {
  32268. return pattern.split(',').indexOf(name) > -1
  32269. } else if (isRegExp(pattern)) {
  32270. return pattern.test(name)
  32271. }
  32272. /* istanbul ignore next */
  32273. return false
  32274. }
  32275. function pruneCache (keepAliveInstance, filter) {
  32276. var cache = keepAliveInstance.cache;
  32277. var keys = keepAliveInstance.keys;
  32278. var _vnode = keepAliveInstance._vnode;
  32279. for (var key in cache) {
  32280. var cachedNode = cache[key];
  32281. if (cachedNode) {
  32282. var name = getComponentName(cachedNode.componentOptions);
  32283. if (name && !filter(name)) {
  32284. pruneCacheEntry(cache, key, keys, _vnode);
  32285. }
  32286. }
  32287. }
  32288. }
  32289. function pruneCacheEntry (
  32290. cache,
  32291. key,
  32292. keys,
  32293. current
  32294. ) {
  32295. var cached$$1 = cache[key];
  32296. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  32297. cached$$1.componentInstance.$destroy();
  32298. }
  32299. cache[key] = null;
  32300. remove(keys, key);
  32301. }
  32302. var patternTypes = [String, RegExp, Array];
  32303. var KeepAlive = {
  32304. name: 'keep-alive',
  32305. abstract: true,
  32306. props: {
  32307. include: patternTypes,
  32308. exclude: patternTypes,
  32309. max: [String, Number]
  32310. },
  32311. created: function created () {
  32312. this.cache = Object.create(null);
  32313. this.keys = [];
  32314. },
  32315. destroyed: function destroyed () {
  32316. var this$1 = this;
  32317. for (var key in this$1.cache) {
  32318. pruneCacheEntry(this$1.cache, key, this$1.keys);
  32319. }
  32320. },
  32321. watch: {
  32322. include: function include (val) {
  32323. pruneCache(this, function (name) { return matches(val, name); });
  32324. },
  32325. exclude: function exclude (val) {
  32326. pruneCache(this, function (name) { return !matches(val, name); });
  32327. }
  32328. },
  32329. render: function render () {
  32330. var slot = this.$slots.default;
  32331. var vnode = getFirstComponentChild(slot);
  32332. var componentOptions = vnode && vnode.componentOptions;
  32333. if (componentOptions) {
  32334. // check pattern
  32335. var name = getComponentName(componentOptions);
  32336. var ref = this;
  32337. var include = ref.include;
  32338. var exclude = ref.exclude;
  32339. if (
  32340. // not included
  32341. (include && (!name || !matches(include, name))) ||
  32342. // excluded
  32343. (exclude && name && matches(exclude, name))
  32344. ) {
  32345. return vnode
  32346. }
  32347. var ref$1 = this;
  32348. var cache = ref$1.cache;
  32349. var keys = ref$1.keys;
  32350. var key = vnode.key == null
  32351. // same constructor may get registered as different local components
  32352. // so cid alone is not enough (#3269)
  32353. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  32354. : vnode.key;
  32355. if (cache[key]) {
  32356. vnode.componentInstance = cache[key].componentInstance;
  32357. // make current key freshest
  32358. remove(keys, key);
  32359. keys.push(key);
  32360. } else {
  32361. cache[key] = vnode;
  32362. keys.push(key);
  32363. // prune oldest entry
  32364. if (this.max && keys.length > parseInt(this.max)) {
  32365. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  32366. }
  32367. }
  32368. vnode.data.keepAlive = true;
  32369. }
  32370. return vnode || (slot && slot[0])
  32371. }
  32372. };
  32373. var builtInComponents = {
  32374. KeepAlive: KeepAlive
  32375. };
  32376. /* */
  32377. function initGlobalAPI (Vue) {
  32378. // config
  32379. var configDef = {};
  32380. configDef.get = function () { return config; };
  32381. if (true) {
  32382. configDef.set = function () {
  32383. warn(
  32384. 'Do not replace the Vue.config object, set individual fields instead.'
  32385. );
  32386. };
  32387. }
  32388. Object.defineProperty(Vue, 'config', configDef);
  32389. // exposed util methods.
  32390. // NOTE: these are not considered part of the public API - avoid relying on
  32391. // them unless you are aware of the risk.
  32392. Vue.util = {
  32393. warn: warn,
  32394. extend: extend,
  32395. mergeOptions: mergeOptions,
  32396. defineReactive: defineReactive
  32397. };
  32398. Vue.set = set;
  32399. Vue.delete = del;
  32400. Vue.nextTick = nextTick;
  32401. Vue.options = Object.create(null);
  32402. ASSET_TYPES.forEach(function (type) {
  32403. Vue.options[type + 's'] = Object.create(null);
  32404. });
  32405. // this is used to identify the "base" constructor to extend all plain-object
  32406. // components with in Weex's multi-instance scenarios.
  32407. Vue.options._base = Vue;
  32408. extend(Vue.options.components, builtInComponents);
  32409. initUse(Vue);
  32410. initMixin$1(Vue);
  32411. initExtend(Vue);
  32412. initAssetRegisters(Vue);
  32413. }
  32414. initGlobalAPI(Vue$3);
  32415. Object.defineProperty(Vue$3.prototype, '$isServer', {
  32416. get: isServerRendering
  32417. });
  32418. Object.defineProperty(Vue$3.prototype, '$ssrContext', {
  32419. get: function get () {
  32420. /* istanbul ignore next */
  32421. return this.$vnode && this.$vnode.ssrContext
  32422. }
  32423. });
  32424. Vue$3.version = '2.5.13';
  32425. /* */
  32426. // these are reserved for web because they are directly compiled away
  32427. // during template compilation
  32428. var isReservedAttr = makeMap('style,class');
  32429. // attributes that should be using props for binding
  32430. var acceptValue = makeMap('input,textarea,option,select,progress');
  32431. var mustUseProp = function (tag, type, attr) {
  32432. return (
  32433. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  32434. (attr === 'selected' && tag === 'option') ||
  32435. (attr === 'checked' && tag === 'input') ||
  32436. (attr === 'muted' && tag === 'video')
  32437. )
  32438. };
  32439. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  32440. var isBooleanAttr = makeMap(
  32441. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  32442. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  32443. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  32444. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  32445. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  32446. 'truespeed,typemustmatch,visible'
  32447. );
  32448. var xlinkNS = 'http://www.w3.org/1999/xlink';
  32449. var isXlink = function (name) {
  32450. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  32451. };
  32452. var getXlinkProp = function (name) {
  32453. return isXlink(name) ? name.slice(6, name.length) : ''
  32454. };
  32455. var isFalsyAttrValue = function (val) {
  32456. return val == null || val === false
  32457. };
  32458. /* */
  32459. function genClassForVnode (vnode) {
  32460. var data = vnode.data;
  32461. var parentNode = vnode;
  32462. var childNode = vnode;
  32463. while (isDef(childNode.componentInstance)) {
  32464. childNode = childNode.componentInstance._vnode;
  32465. if (childNode && childNode.data) {
  32466. data = mergeClassData(childNode.data, data);
  32467. }
  32468. }
  32469. while (isDef(parentNode = parentNode.parent)) {
  32470. if (parentNode && parentNode.data) {
  32471. data = mergeClassData(data, parentNode.data);
  32472. }
  32473. }
  32474. return renderClass(data.staticClass, data.class)
  32475. }
  32476. function mergeClassData (child, parent) {
  32477. return {
  32478. staticClass: concat(child.staticClass, parent.staticClass),
  32479. class: isDef(child.class)
  32480. ? [child.class, parent.class]
  32481. : parent.class
  32482. }
  32483. }
  32484. function renderClass (
  32485. staticClass,
  32486. dynamicClass
  32487. ) {
  32488. if (isDef(staticClass) || isDef(dynamicClass)) {
  32489. return concat(staticClass, stringifyClass(dynamicClass))
  32490. }
  32491. /* istanbul ignore next */
  32492. return ''
  32493. }
  32494. function concat (a, b) {
  32495. return a ? b ? (a + ' ' + b) : a : (b || '')
  32496. }
  32497. function stringifyClass (value) {
  32498. if (Array.isArray(value)) {
  32499. return stringifyArray(value)
  32500. }
  32501. if (isObject(value)) {
  32502. return stringifyObject(value)
  32503. }
  32504. if (typeof value === 'string') {
  32505. return value
  32506. }
  32507. /* istanbul ignore next */
  32508. return ''
  32509. }
  32510. function stringifyArray (value) {
  32511. var res = '';
  32512. var stringified;
  32513. for (var i = 0, l = value.length; i < l; i++) {
  32514. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  32515. if (res) { res += ' '; }
  32516. res += stringified;
  32517. }
  32518. }
  32519. return res
  32520. }
  32521. function stringifyObject (value) {
  32522. var res = '';
  32523. for (var key in value) {
  32524. if (value[key]) {
  32525. if (res) { res += ' '; }
  32526. res += key;
  32527. }
  32528. }
  32529. return res
  32530. }
  32531. /* */
  32532. var namespaceMap = {
  32533. svg: 'http://www.w3.org/2000/svg',
  32534. math: 'http://www.w3.org/1998/Math/MathML'
  32535. };
  32536. var isHTMLTag = makeMap(
  32537. 'html,body,base,head,link,meta,style,title,' +
  32538. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  32539. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  32540. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  32541. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  32542. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  32543. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  32544. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  32545. 'output,progress,select,textarea,' +
  32546. 'details,dialog,menu,menuitem,summary,' +
  32547. 'content,element,shadow,template,blockquote,iframe,tfoot'
  32548. );
  32549. // this map is intentionally selective, only covering SVG elements that may
  32550. // contain child elements.
  32551. var isSVG = makeMap(
  32552. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  32553. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  32554. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  32555. true
  32556. );
  32557. var isPreTag = function (tag) { return tag === 'pre'; };
  32558. var isReservedTag = function (tag) {
  32559. return isHTMLTag(tag) || isSVG(tag)
  32560. };
  32561. function getTagNamespace (tag) {
  32562. if (isSVG(tag)) {
  32563. return 'svg'
  32564. }
  32565. // basic support for MathML
  32566. // note it doesn't support other MathML elements being component roots
  32567. if (tag === 'math') {
  32568. return 'math'
  32569. }
  32570. }
  32571. var unknownElementCache = Object.create(null);
  32572. function isUnknownElement (tag) {
  32573. /* istanbul ignore if */
  32574. if (!inBrowser) {
  32575. return true
  32576. }
  32577. if (isReservedTag(tag)) {
  32578. return false
  32579. }
  32580. tag = tag.toLowerCase();
  32581. /* istanbul ignore if */
  32582. if (unknownElementCache[tag] != null) {
  32583. return unknownElementCache[tag]
  32584. }
  32585. var el = document.createElement(tag);
  32586. if (tag.indexOf('-') > -1) {
  32587. // http://stackoverflow.com/a/28210364/1070244
  32588. return (unknownElementCache[tag] = (
  32589. el.constructor === window.HTMLUnknownElement ||
  32590. el.constructor === window.HTMLElement
  32591. ))
  32592. } else {
  32593. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  32594. }
  32595. }
  32596. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  32597. /* */
  32598. /**
  32599. * Query an element selector if it's not an element already.
  32600. */
  32601. function query (el) {
  32602. if (typeof el === 'string') {
  32603. var selected = document.querySelector(el);
  32604. if (!selected) {
  32605. "development" !== 'production' && warn(
  32606. 'Cannot find element: ' + el
  32607. );
  32608. return document.createElement('div')
  32609. }
  32610. return selected
  32611. } else {
  32612. return el
  32613. }
  32614. }
  32615. /* */
  32616. function createElement$1 (tagName, vnode) {
  32617. var elm = document.createElement(tagName);
  32618. if (tagName !== 'select') {
  32619. return elm
  32620. }
  32621. // false or null will remove the attribute but undefined will not
  32622. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  32623. elm.setAttribute('multiple', 'multiple');
  32624. }
  32625. return elm
  32626. }
  32627. function createElementNS (namespace, tagName) {
  32628. return document.createElementNS(namespaceMap[namespace], tagName)
  32629. }
  32630. function createTextNode (text) {
  32631. return document.createTextNode(text)
  32632. }
  32633. function createComment (text) {
  32634. return document.createComment(text)
  32635. }
  32636. function insertBefore (parentNode, newNode, referenceNode) {
  32637. parentNode.insertBefore(newNode, referenceNode);
  32638. }
  32639. function removeChild (node, child) {
  32640. node.removeChild(child);
  32641. }
  32642. function appendChild (node, child) {
  32643. node.appendChild(child);
  32644. }
  32645. function parentNode (node) {
  32646. return node.parentNode
  32647. }
  32648. function nextSibling (node) {
  32649. return node.nextSibling
  32650. }
  32651. function tagName (node) {
  32652. return node.tagName
  32653. }
  32654. function setTextContent (node, text) {
  32655. node.textContent = text;
  32656. }
  32657. function setAttribute (node, key, val) {
  32658. node.setAttribute(key, val);
  32659. }
  32660. var nodeOps = Object.freeze({
  32661. createElement: createElement$1,
  32662. createElementNS: createElementNS,
  32663. createTextNode: createTextNode,
  32664. createComment: createComment,
  32665. insertBefore: insertBefore,
  32666. removeChild: removeChild,
  32667. appendChild: appendChild,
  32668. parentNode: parentNode,
  32669. nextSibling: nextSibling,
  32670. tagName: tagName,
  32671. setTextContent: setTextContent,
  32672. setAttribute: setAttribute
  32673. });
  32674. /* */
  32675. var ref = {
  32676. create: function create (_, vnode) {
  32677. registerRef(vnode);
  32678. },
  32679. update: function update (oldVnode, vnode) {
  32680. if (oldVnode.data.ref !== vnode.data.ref) {
  32681. registerRef(oldVnode, true);
  32682. registerRef(vnode);
  32683. }
  32684. },
  32685. destroy: function destroy (vnode) {
  32686. registerRef(vnode, true);
  32687. }
  32688. };
  32689. function registerRef (vnode, isRemoval) {
  32690. var key = vnode.data.ref;
  32691. if (!key) { return }
  32692. var vm = vnode.context;
  32693. var ref = vnode.componentInstance || vnode.elm;
  32694. var refs = vm.$refs;
  32695. if (isRemoval) {
  32696. if (Array.isArray(refs[key])) {
  32697. remove(refs[key], ref);
  32698. } else if (refs[key] === ref) {
  32699. refs[key] = undefined;
  32700. }
  32701. } else {
  32702. if (vnode.data.refInFor) {
  32703. if (!Array.isArray(refs[key])) {
  32704. refs[key] = [ref];
  32705. } else if (refs[key].indexOf(ref) < 0) {
  32706. // $flow-disable-line
  32707. refs[key].push(ref);
  32708. }
  32709. } else {
  32710. refs[key] = ref;
  32711. }
  32712. }
  32713. }
  32714. /**
  32715. * Virtual DOM patching algorithm based on Snabbdom by
  32716. * Simon Friis Vindum (@paldepind)
  32717. * Licensed under the MIT License
  32718. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  32719. *
  32720. * modified by Evan You (@yyx990803)
  32721. *
  32722. * Not type-checking this because this file is perf-critical and the cost
  32723. * of making flow understand it is not worth it.
  32724. */
  32725. var emptyNode = new VNode('', {}, []);
  32726. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  32727. function sameVnode (a, b) {
  32728. return (
  32729. a.key === b.key && (
  32730. (
  32731. a.tag === b.tag &&
  32732. a.isComment === b.isComment &&
  32733. isDef(a.data) === isDef(b.data) &&
  32734. sameInputType(a, b)
  32735. ) || (
  32736. isTrue(a.isAsyncPlaceholder) &&
  32737. a.asyncFactory === b.asyncFactory &&
  32738. isUndef(b.asyncFactory.error)
  32739. )
  32740. )
  32741. )
  32742. }
  32743. function sameInputType (a, b) {
  32744. if (a.tag !== 'input') { return true }
  32745. var i;
  32746. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  32747. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  32748. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  32749. }
  32750. function createKeyToOldIdx (children, beginIdx, endIdx) {
  32751. var i, key;
  32752. var map = {};
  32753. for (i = beginIdx; i <= endIdx; ++i) {
  32754. key = children[i].key;
  32755. if (isDef(key)) { map[key] = i; }
  32756. }
  32757. return map
  32758. }
  32759. function createPatchFunction (backend) {
  32760. var i, j;
  32761. var cbs = {};
  32762. var modules = backend.modules;
  32763. var nodeOps = backend.nodeOps;
  32764. for (i = 0; i < hooks.length; ++i) {
  32765. cbs[hooks[i]] = [];
  32766. for (j = 0; j < modules.length; ++j) {
  32767. if (isDef(modules[j][hooks[i]])) {
  32768. cbs[hooks[i]].push(modules[j][hooks[i]]);
  32769. }
  32770. }
  32771. }
  32772. function emptyNodeAt (elm) {
  32773. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  32774. }
  32775. function createRmCb (childElm, listeners) {
  32776. function remove () {
  32777. if (--remove.listeners === 0) {
  32778. removeNode(childElm);
  32779. }
  32780. }
  32781. remove.listeners = listeners;
  32782. return remove
  32783. }
  32784. function removeNode (el) {
  32785. var parent = nodeOps.parentNode(el);
  32786. // element may have already been removed due to v-html / v-text
  32787. if (isDef(parent)) {
  32788. nodeOps.removeChild(parent, el);
  32789. }
  32790. }
  32791. function isUnknownElement$$1 (vnode, inVPre) {
  32792. return (
  32793. !inVPre &&
  32794. !vnode.ns &&
  32795. !(
  32796. config.ignoredElements.length &&
  32797. config.ignoredElements.some(function (ignore) {
  32798. return isRegExp(ignore)
  32799. ? ignore.test(vnode.tag)
  32800. : ignore === vnode.tag
  32801. })
  32802. ) &&
  32803. config.isUnknownElement(vnode.tag)
  32804. )
  32805. }
  32806. var creatingElmInVPre = 0;
  32807. function createElm (vnode, insertedVnodeQueue, parentElm, refElm, nested) {
  32808. vnode.isRootInsert = !nested; // for transition enter check
  32809. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  32810. return
  32811. }
  32812. var data = vnode.data;
  32813. var children = vnode.children;
  32814. var tag = vnode.tag;
  32815. if (isDef(tag)) {
  32816. if (true) {
  32817. if (data && data.pre) {
  32818. creatingElmInVPre++;
  32819. }
  32820. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  32821. warn(
  32822. 'Unknown custom element: <' + tag + '> - did you ' +
  32823. 'register the component correctly? For recursive components, ' +
  32824. 'make sure to provide the "name" option.',
  32825. vnode.context
  32826. );
  32827. }
  32828. }
  32829. vnode.elm = vnode.ns
  32830. ? nodeOps.createElementNS(vnode.ns, tag)
  32831. : nodeOps.createElement(tag, vnode);
  32832. setScope(vnode);
  32833. /* istanbul ignore if */
  32834. {
  32835. createChildren(vnode, children, insertedVnodeQueue);
  32836. if (isDef(data)) {
  32837. invokeCreateHooks(vnode, insertedVnodeQueue);
  32838. }
  32839. insert(parentElm, vnode.elm, refElm);
  32840. }
  32841. if ("development" !== 'production' && data && data.pre) {
  32842. creatingElmInVPre--;
  32843. }
  32844. } else if (isTrue(vnode.isComment)) {
  32845. vnode.elm = nodeOps.createComment(vnode.text);
  32846. insert(parentElm, vnode.elm, refElm);
  32847. } else {
  32848. vnode.elm = nodeOps.createTextNode(vnode.text);
  32849. insert(parentElm, vnode.elm, refElm);
  32850. }
  32851. }
  32852. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  32853. var i = vnode.data;
  32854. if (isDef(i)) {
  32855. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  32856. if (isDef(i = i.hook) && isDef(i = i.init)) {
  32857. i(vnode, false /* hydrating */, parentElm, refElm);
  32858. }
  32859. // after calling the init hook, if the vnode is a child component
  32860. // it should've created a child instance and mounted it. the child
  32861. // component also has set the placeholder vnode's elm.
  32862. // in that case we can just return the element and be done.
  32863. if (isDef(vnode.componentInstance)) {
  32864. initComponent(vnode, insertedVnodeQueue);
  32865. if (isTrue(isReactivated)) {
  32866. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  32867. }
  32868. return true
  32869. }
  32870. }
  32871. }
  32872. function initComponent (vnode, insertedVnodeQueue) {
  32873. if (isDef(vnode.data.pendingInsert)) {
  32874. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  32875. vnode.data.pendingInsert = null;
  32876. }
  32877. vnode.elm = vnode.componentInstance.$el;
  32878. if (isPatchable(vnode)) {
  32879. invokeCreateHooks(vnode, insertedVnodeQueue);
  32880. setScope(vnode);
  32881. } else {
  32882. // empty component root.
  32883. // skip all element-related modules except for ref (#3455)
  32884. registerRef(vnode);
  32885. // make sure to invoke the insert hook
  32886. insertedVnodeQueue.push(vnode);
  32887. }
  32888. }
  32889. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  32890. var i;
  32891. // hack for #4339: a reactivated component with inner transition
  32892. // does not trigger because the inner node's created hooks are not called
  32893. // again. It's not ideal to involve module-specific logic in here but
  32894. // there doesn't seem to be a better way to do it.
  32895. var innerNode = vnode;
  32896. while (innerNode.componentInstance) {
  32897. innerNode = innerNode.componentInstance._vnode;
  32898. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  32899. for (i = 0; i < cbs.activate.length; ++i) {
  32900. cbs.activate[i](emptyNode, innerNode);
  32901. }
  32902. insertedVnodeQueue.push(innerNode);
  32903. break
  32904. }
  32905. }
  32906. // unlike a newly created component,
  32907. // a reactivated keep-alive component doesn't insert itself
  32908. insert(parentElm, vnode.elm, refElm);
  32909. }
  32910. function insert (parent, elm, ref$$1) {
  32911. if (isDef(parent)) {
  32912. if (isDef(ref$$1)) {
  32913. if (ref$$1.parentNode === parent) {
  32914. nodeOps.insertBefore(parent, elm, ref$$1);
  32915. }
  32916. } else {
  32917. nodeOps.appendChild(parent, elm);
  32918. }
  32919. }
  32920. }
  32921. function createChildren (vnode, children, insertedVnodeQueue) {
  32922. if (Array.isArray(children)) {
  32923. if (true) {
  32924. checkDuplicateKeys(children);
  32925. }
  32926. for (var i = 0; i < children.length; ++i) {
  32927. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true);
  32928. }
  32929. } else if (isPrimitive(vnode.text)) {
  32930. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  32931. }
  32932. }
  32933. function isPatchable (vnode) {
  32934. while (vnode.componentInstance) {
  32935. vnode = vnode.componentInstance._vnode;
  32936. }
  32937. return isDef(vnode.tag)
  32938. }
  32939. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  32940. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  32941. cbs.create[i$1](emptyNode, vnode);
  32942. }
  32943. i = vnode.data.hook; // Reuse variable
  32944. if (isDef(i)) {
  32945. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  32946. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  32947. }
  32948. }
  32949. // set scope id attribute for scoped CSS.
  32950. // this is implemented as a special case to avoid the overhead
  32951. // of going through the normal attribute patching process.
  32952. function setScope (vnode) {
  32953. var i;
  32954. if (isDef(i = vnode.fnScopeId)) {
  32955. nodeOps.setAttribute(vnode.elm, i, '');
  32956. } else {
  32957. var ancestor = vnode;
  32958. while (ancestor) {
  32959. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  32960. nodeOps.setAttribute(vnode.elm, i, '');
  32961. }
  32962. ancestor = ancestor.parent;
  32963. }
  32964. }
  32965. // for slot content they should also get the scopeId from the host instance.
  32966. if (isDef(i = activeInstance) &&
  32967. i !== vnode.context &&
  32968. i !== vnode.fnContext &&
  32969. isDef(i = i.$options._scopeId)
  32970. ) {
  32971. nodeOps.setAttribute(vnode.elm, i, '');
  32972. }
  32973. }
  32974. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  32975. for (; startIdx <= endIdx; ++startIdx) {
  32976. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm);
  32977. }
  32978. }
  32979. function invokeDestroyHook (vnode) {
  32980. var i, j;
  32981. var data = vnode.data;
  32982. if (isDef(data)) {
  32983. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  32984. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  32985. }
  32986. if (isDef(i = vnode.children)) {
  32987. for (j = 0; j < vnode.children.length; ++j) {
  32988. invokeDestroyHook(vnode.children[j]);
  32989. }
  32990. }
  32991. }
  32992. function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
  32993. for (; startIdx <= endIdx; ++startIdx) {
  32994. var ch = vnodes[startIdx];
  32995. if (isDef(ch)) {
  32996. if (isDef(ch.tag)) {
  32997. removeAndInvokeRemoveHook(ch);
  32998. invokeDestroyHook(ch);
  32999. } else { // Text node
  33000. removeNode(ch.elm);
  33001. }
  33002. }
  33003. }
  33004. }
  33005. function removeAndInvokeRemoveHook (vnode, rm) {
  33006. if (isDef(rm) || isDef(vnode.data)) {
  33007. var i;
  33008. var listeners = cbs.remove.length + 1;
  33009. if (isDef(rm)) {
  33010. // we have a recursively passed down rm callback
  33011. // increase the listeners count
  33012. rm.listeners += listeners;
  33013. } else {
  33014. // directly removing
  33015. rm = createRmCb(vnode.elm, listeners);
  33016. }
  33017. // recursively invoke hooks on child component root node
  33018. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  33019. removeAndInvokeRemoveHook(i, rm);
  33020. }
  33021. for (i = 0; i < cbs.remove.length; ++i) {
  33022. cbs.remove[i](vnode, rm);
  33023. }
  33024. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  33025. i(vnode, rm);
  33026. } else {
  33027. rm();
  33028. }
  33029. } else {
  33030. removeNode(vnode.elm);
  33031. }
  33032. }
  33033. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  33034. var oldStartIdx = 0;
  33035. var newStartIdx = 0;
  33036. var oldEndIdx = oldCh.length - 1;
  33037. var oldStartVnode = oldCh[0];
  33038. var oldEndVnode = oldCh[oldEndIdx];
  33039. var newEndIdx = newCh.length - 1;
  33040. var newStartVnode = newCh[0];
  33041. var newEndVnode = newCh[newEndIdx];
  33042. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  33043. // removeOnly is a special flag used only by <transition-group>
  33044. // to ensure removed elements stay in correct relative positions
  33045. // during leaving transitions
  33046. var canMove = !removeOnly;
  33047. if (true) {
  33048. checkDuplicateKeys(newCh);
  33049. }
  33050. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  33051. if (isUndef(oldStartVnode)) {
  33052. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  33053. } else if (isUndef(oldEndVnode)) {
  33054. oldEndVnode = oldCh[--oldEndIdx];
  33055. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  33056. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue);
  33057. oldStartVnode = oldCh[++oldStartIdx];
  33058. newStartVnode = newCh[++newStartIdx];
  33059. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  33060. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue);
  33061. oldEndVnode = oldCh[--oldEndIdx];
  33062. newEndVnode = newCh[--newEndIdx];
  33063. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  33064. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue);
  33065. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  33066. oldStartVnode = oldCh[++oldStartIdx];
  33067. newEndVnode = newCh[--newEndIdx];
  33068. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  33069. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue);
  33070. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  33071. oldEndVnode = oldCh[--oldEndIdx];
  33072. newStartVnode = newCh[++newStartIdx];
  33073. } else {
  33074. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  33075. idxInOld = isDef(newStartVnode.key)
  33076. ? oldKeyToIdx[newStartVnode.key]
  33077. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  33078. if (isUndef(idxInOld)) { // New element
  33079. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
  33080. } else {
  33081. vnodeToMove = oldCh[idxInOld];
  33082. if (sameVnode(vnodeToMove, newStartVnode)) {
  33083. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue);
  33084. oldCh[idxInOld] = undefined;
  33085. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  33086. } else {
  33087. // same key but different element. treat as new element
  33088. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
  33089. }
  33090. }
  33091. newStartVnode = newCh[++newStartIdx];
  33092. }
  33093. }
  33094. if (oldStartIdx > oldEndIdx) {
  33095. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  33096. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  33097. } else if (newStartIdx > newEndIdx) {
  33098. removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
  33099. }
  33100. }
  33101. function checkDuplicateKeys (children) {
  33102. var seenKeys = {};
  33103. for (var i = 0; i < children.length; i++) {
  33104. var vnode = children[i];
  33105. var key = vnode.key;
  33106. if (isDef(key)) {
  33107. if (seenKeys[key]) {
  33108. warn(
  33109. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  33110. vnode.context
  33111. );
  33112. } else {
  33113. seenKeys[key] = true;
  33114. }
  33115. }
  33116. }
  33117. }
  33118. function findIdxInOld (node, oldCh, start, end) {
  33119. for (var i = start; i < end; i++) {
  33120. var c = oldCh[i];
  33121. if (isDef(c) && sameVnode(node, c)) { return i }
  33122. }
  33123. }
  33124. function patchVnode (oldVnode, vnode, insertedVnodeQueue, removeOnly) {
  33125. if (oldVnode === vnode) {
  33126. return
  33127. }
  33128. var elm = vnode.elm = oldVnode.elm;
  33129. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  33130. if (isDef(vnode.asyncFactory.resolved)) {
  33131. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  33132. } else {
  33133. vnode.isAsyncPlaceholder = true;
  33134. }
  33135. return
  33136. }
  33137. // reuse element for static trees.
  33138. // note we only do this if the vnode is cloned -
  33139. // if the new node is not cloned it means the render functions have been
  33140. // reset by the hot-reload-api and we need to do a proper re-render.
  33141. if (isTrue(vnode.isStatic) &&
  33142. isTrue(oldVnode.isStatic) &&
  33143. vnode.key === oldVnode.key &&
  33144. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  33145. ) {
  33146. vnode.componentInstance = oldVnode.componentInstance;
  33147. return
  33148. }
  33149. var i;
  33150. var data = vnode.data;
  33151. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  33152. i(oldVnode, vnode);
  33153. }
  33154. var oldCh = oldVnode.children;
  33155. var ch = vnode.children;
  33156. if (isDef(data) && isPatchable(vnode)) {
  33157. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  33158. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  33159. }
  33160. if (isUndef(vnode.text)) {
  33161. if (isDef(oldCh) && isDef(ch)) {
  33162. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  33163. } else if (isDef(ch)) {
  33164. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  33165. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  33166. } else if (isDef(oldCh)) {
  33167. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  33168. } else if (isDef(oldVnode.text)) {
  33169. nodeOps.setTextContent(elm, '');
  33170. }
  33171. } else if (oldVnode.text !== vnode.text) {
  33172. nodeOps.setTextContent(elm, vnode.text);
  33173. }
  33174. if (isDef(data)) {
  33175. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  33176. }
  33177. }
  33178. function invokeInsertHook (vnode, queue, initial) {
  33179. // delay insert hooks for component root nodes, invoke them after the
  33180. // element is really inserted
  33181. if (isTrue(initial) && isDef(vnode.parent)) {
  33182. vnode.parent.data.pendingInsert = queue;
  33183. } else {
  33184. for (var i = 0; i < queue.length; ++i) {
  33185. queue[i].data.hook.insert(queue[i]);
  33186. }
  33187. }
  33188. }
  33189. var hydrationBailed = false;
  33190. // list of modules that can skip create hook during hydration because they
  33191. // are already rendered on the client or has no need for initialization
  33192. // Note: style is excluded because it relies on initial clone for future
  33193. // deep updates (#7063).
  33194. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  33195. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  33196. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  33197. var i;
  33198. var tag = vnode.tag;
  33199. var data = vnode.data;
  33200. var children = vnode.children;
  33201. inVPre = inVPre || (data && data.pre);
  33202. vnode.elm = elm;
  33203. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  33204. vnode.isAsyncPlaceholder = true;
  33205. return true
  33206. }
  33207. // assert node match
  33208. if (true) {
  33209. if (!assertNodeMatch(elm, vnode, inVPre)) {
  33210. return false
  33211. }
  33212. }
  33213. if (isDef(data)) {
  33214. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  33215. if (isDef(i = vnode.componentInstance)) {
  33216. // child component. it should have hydrated its own tree.
  33217. initComponent(vnode, insertedVnodeQueue);
  33218. return true
  33219. }
  33220. }
  33221. if (isDef(tag)) {
  33222. if (isDef(children)) {
  33223. // empty element, allow client to pick up and populate children
  33224. if (!elm.hasChildNodes()) {
  33225. createChildren(vnode, children, insertedVnodeQueue);
  33226. } else {
  33227. // v-html and domProps: innerHTML
  33228. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  33229. if (i !== elm.innerHTML) {
  33230. /* istanbul ignore if */
  33231. if ("development" !== 'production' &&
  33232. typeof console !== 'undefined' &&
  33233. !hydrationBailed
  33234. ) {
  33235. hydrationBailed = true;
  33236. console.warn('Parent: ', elm);
  33237. console.warn('server innerHTML: ', i);
  33238. console.warn('client innerHTML: ', elm.innerHTML);
  33239. }
  33240. return false
  33241. }
  33242. } else {
  33243. // iterate and compare children lists
  33244. var childrenMatch = true;
  33245. var childNode = elm.firstChild;
  33246. for (var i$1 = 0; i$1 < children.length; i$1++) {
  33247. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  33248. childrenMatch = false;
  33249. break
  33250. }
  33251. childNode = childNode.nextSibling;
  33252. }
  33253. // if childNode is not null, it means the actual childNodes list is
  33254. // longer than the virtual children list.
  33255. if (!childrenMatch || childNode) {
  33256. /* istanbul ignore if */
  33257. if ("development" !== 'production' &&
  33258. typeof console !== 'undefined' &&
  33259. !hydrationBailed
  33260. ) {
  33261. hydrationBailed = true;
  33262. console.warn('Parent: ', elm);
  33263. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  33264. }
  33265. return false
  33266. }
  33267. }
  33268. }
  33269. }
  33270. if (isDef(data)) {
  33271. var fullInvoke = false;
  33272. for (var key in data) {
  33273. if (!isRenderedModule(key)) {
  33274. fullInvoke = true;
  33275. invokeCreateHooks(vnode, insertedVnodeQueue);
  33276. break
  33277. }
  33278. }
  33279. if (!fullInvoke && data['class']) {
  33280. // ensure collecting deps for deep class bindings for future updates
  33281. traverse(data['class']);
  33282. }
  33283. }
  33284. } else if (elm.data !== vnode.text) {
  33285. elm.data = vnode.text;
  33286. }
  33287. return true
  33288. }
  33289. function assertNodeMatch (node, vnode, inVPre) {
  33290. if (isDef(vnode.tag)) {
  33291. return vnode.tag.indexOf('vue-component') === 0 || (
  33292. !isUnknownElement$$1(vnode, inVPre) &&
  33293. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  33294. )
  33295. } else {
  33296. return node.nodeType === (vnode.isComment ? 8 : 3)
  33297. }
  33298. }
  33299. return function patch (oldVnode, vnode, hydrating, removeOnly, parentElm, refElm) {
  33300. if (isUndef(vnode)) {
  33301. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  33302. return
  33303. }
  33304. var isInitialPatch = false;
  33305. var insertedVnodeQueue = [];
  33306. if (isUndef(oldVnode)) {
  33307. // empty mount (likely as component), create new root element
  33308. isInitialPatch = true;
  33309. createElm(vnode, insertedVnodeQueue, parentElm, refElm);
  33310. } else {
  33311. var isRealElement = isDef(oldVnode.nodeType);
  33312. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  33313. // patch existing root node
  33314. patchVnode(oldVnode, vnode, insertedVnodeQueue, removeOnly);
  33315. } else {
  33316. if (isRealElement) {
  33317. // mounting to a real element
  33318. // check if this is server-rendered content and if we can perform
  33319. // a successful hydration.
  33320. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  33321. oldVnode.removeAttribute(SSR_ATTR);
  33322. hydrating = true;
  33323. }
  33324. if (isTrue(hydrating)) {
  33325. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  33326. invokeInsertHook(vnode, insertedVnodeQueue, true);
  33327. return oldVnode
  33328. } else if (true) {
  33329. warn(
  33330. 'The client-side rendered virtual DOM tree is not matching ' +
  33331. 'server-rendered content. This is likely caused by incorrect ' +
  33332. 'HTML markup, for example nesting block-level elements inside ' +
  33333. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  33334. 'full client-side render.'
  33335. );
  33336. }
  33337. }
  33338. // either not server-rendered, or hydration failed.
  33339. // create an empty node and replace it
  33340. oldVnode = emptyNodeAt(oldVnode);
  33341. }
  33342. // replacing existing element
  33343. var oldElm = oldVnode.elm;
  33344. var parentElm$1 = nodeOps.parentNode(oldElm);
  33345. // create new node
  33346. createElm(
  33347. vnode,
  33348. insertedVnodeQueue,
  33349. // extremely rare edge case: do not insert if old element is in a
  33350. // leaving transition. Only happens when combining transition +
  33351. // keep-alive + HOCs. (#4590)
  33352. oldElm._leaveCb ? null : parentElm$1,
  33353. nodeOps.nextSibling(oldElm)
  33354. );
  33355. // update parent placeholder node element, recursively
  33356. if (isDef(vnode.parent)) {
  33357. var ancestor = vnode.parent;
  33358. var patchable = isPatchable(vnode);
  33359. while (ancestor) {
  33360. for (var i = 0; i < cbs.destroy.length; ++i) {
  33361. cbs.destroy[i](ancestor);
  33362. }
  33363. ancestor.elm = vnode.elm;
  33364. if (patchable) {
  33365. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  33366. cbs.create[i$1](emptyNode, ancestor);
  33367. }
  33368. // #6513
  33369. // invoke insert hooks that may have been merged by create hooks.
  33370. // e.g. for directives that uses the "inserted" hook.
  33371. var insert = ancestor.data.hook.insert;
  33372. if (insert.merged) {
  33373. // start at index 1 to avoid re-invoking component mounted hook
  33374. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  33375. insert.fns[i$2]();
  33376. }
  33377. }
  33378. } else {
  33379. registerRef(ancestor);
  33380. }
  33381. ancestor = ancestor.parent;
  33382. }
  33383. }
  33384. // destroy old node
  33385. if (isDef(parentElm$1)) {
  33386. removeVnodes(parentElm$1, [oldVnode], 0, 0);
  33387. } else if (isDef(oldVnode.tag)) {
  33388. invokeDestroyHook(oldVnode);
  33389. }
  33390. }
  33391. }
  33392. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  33393. return vnode.elm
  33394. }
  33395. }
  33396. /* */
  33397. var directives = {
  33398. create: updateDirectives,
  33399. update: updateDirectives,
  33400. destroy: function unbindDirectives (vnode) {
  33401. updateDirectives(vnode, emptyNode);
  33402. }
  33403. };
  33404. function updateDirectives (oldVnode, vnode) {
  33405. if (oldVnode.data.directives || vnode.data.directives) {
  33406. _update(oldVnode, vnode);
  33407. }
  33408. }
  33409. function _update (oldVnode, vnode) {
  33410. var isCreate = oldVnode === emptyNode;
  33411. var isDestroy = vnode === emptyNode;
  33412. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  33413. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  33414. var dirsWithInsert = [];
  33415. var dirsWithPostpatch = [];
  33416. var key, oldDir, dir;
  33417. for (key in newDirs) {
  33418. oldDir = oldDirs[key];
  33419. dir = newDirs[key];
  33420. if (!oldDir) {
  33421. // new directive, bind
  33422. callHook$1(dir, 'bind', vnode, oldVnode);
  33423. if (dir.def && dir.def.inserted) {
  33424. dirsWithInsert.push(dir);
  33425. }
  33426. } else {
  33427. // existing directive, update
  33428. dir.oldValue = oldDir.value;
  33429. callHook$1(dir, 'update', vnode, oldVnode);
  33430. if (dir.def && dir.def.componentUpdated) {
  33431. dirsWithPostpatch.push(dir);
  33432. }
  33433. }
  33434. }
  33435. if (dirsWithInsert.length) {
  33436. var callInsert = function () {
  33437. for (var i = 0; i < dirsWithInsert.length; i++) {
  33438. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  33439. }
  33440. };
  33441. if (isCreate) {
  33442. mergeVNodeHook(vnode, 'insert', callInsert);
  33443. } else {
  33444. callInsert();
  33445. }
  33446. }
  33447. if (dirsWithPostpatch.length) {
  33448. mergeVNodeHook(vnode, 'postpatch', function () {
  33449. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  33450. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  33451. }
  33452. });
  33453. }
  33454. if (!isCreate) {
  33455. for (key in oldDirs) {
  33456. if (!newDirs[key]) {
  33457. // no longer present, unbind
  33458. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  33459. }
  33460. }
  33461. }
  33462. }
  33463. var emptyModifiers = Object.create(null);
  33464. function normalizeDirectives$1 (
  33465. dirs,
  33466. vm
  33467. ) {
  33468. var res = Object.create(null);
  33469. if (!dirs) {
  33470. // $flow-disable-line
  33471. return res
  33472. }
  33473. var i, dir;
  33474. for (i = 0; i < dirs.length; i++) {
  33475. dir = dirs[i];
  33476. if (!dir.modifiers) {
  33477. // $flow-disable-line
  33478. dir.modifiers = emptyModifiers;
  33479. }
  33480. res[getRawDirName(dir)] = dir;
  33481. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  33482. }
  33483. // $flow-disable-line
  33484. return res
  33485. }
  33486. function getRawDirName (dir) {
  33487. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  33488. }
  33489. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  33490. var fn = dir.def && dir.def[hook];
  33491. if (fn) {
  33492. try {
  33493. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  33494. } catch (e) {
  33495. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  33496. }
  33497. }
  33498. }
  33499. var baseModules = [
  33500. ref,
  33501. directives
  33502. ];
  33503. /* */
  33504. function updateAttrs (oldVnode, vnode) {
  33505. var opts = vnode.componentOptions;
  33506. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  33507. return
  33508. }
  33509. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  33510. return
  33511. }
  33512. var key, cur, old;
  33513. var elm = vnode.elm;
  33514. var oldAttrs = oldVnode.data.attrs || {};
  33515. var attrs = vnode.data.attrs || {};
  33516. // clone observed objects, as the user probably wants to mutate it
  33517. if (isDef(attrs.__ob__)) {
  33518. attrs = vnode.data.attrs = extend({}, attrs);
  33519. }
  33520. for (key in attrs) {
  33521. cur = attrs[key];
  33522. old = oldAttrs[key];
  33523. if (old !== cur) {
  33524. setAttr(elm, key, cur);
  33525. }
  33526. }
  33527. // #4391: in IE9, setting type can reset value for input[type=radio]
  33528. // #6666: IE/Edge forces progress value down to 1 before setting a max
  33529. /* istanbul ignore if */
  33530. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  33531. setAttr(elm, 'value', attrs.value);
  33532. }
  33533. for (key in oldAttrs) {
  33534. if (isUndef(attrs[key])) {
  33535. if (isXlink(key)) {
  33536. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  33537. } else if (!isEnumeratedAttr(key)) {
  33538. elm.removeAttribute(key);
  33539. }
  33540. }
  33541. }
  33542. }
  33543. function setAttr (el, key, value) {
  33544. if (isBooleanAttr(key)) {
  33545. // set attribute for blank value
  33546. // e.g. <option disabled>Select one</option>
  33547. if (isFalsyAttrValue(value)) {
  33548. el.removeAttribute(key);
  33549. } else {
  33550. // technically allowfullscreen is a boolean attribute for <iframe>,
  33551. // but Flash expects a value of "true" when used on <embed> tag
  33552. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  33553. ? 'true'
  33554. : key;
  33555. el.setAttribute(key, value);
  33556. }
  33557. } else if (isEnumeratedAttr(key)) {
  33558. el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true');
  33559. } else if (isXlink(key)) {
  33560. if (isFalsyAttrValue(value)) {
  33561. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  33562. } else {
  33563. el.setAttributeNS(xlinkNS, key, value);
  33564. }
  33565. } else {
  33566. if (isFalsyAttrValue(value)) {
  33567. el.removeAttribute(key);
  33568. } else {
  33569. // #7138: IE10 & 11 fires input event when setting placeholder on
  33570. // <textarea>... block the first input event and remove the blocker
  33571. // immediately.
  33572. /* istanbul ignore if */
  33573. if (
  33574. isIE && !isIE9 &&
  33575. el.tagName === 'TEXTAREA' &&
  33576. key === 'placeholder' && !el.__ieph
  33577. ) {
  33578. var blocker = function (e) {
  33579. e.stopImmediatePropagation();
  33580. el.removeEventListener('input', blocker);
  33581. };
  33582. el.addEventListener('input', blocker);
  33583. // $flow-disable-line
  33584. el.__ieph = true; /* IE placeholder patched */
  33585. }
  33586. el.setAttribute(key, value);
  33587. }
  33588. }
  33589. }
  33590. var attrs = {
  33591. create: updateAttrs,
  33592. update: updateAttrs
  33593. };
  33594. /* */
  33595. function updateClass (oldVnode, vnode) {
  33596. var el = vnode.elm;
  33597. var data = vnode.data;
  33598. var oldData = oldVnode.data;
  33599. if (
  33600. isUndef(data.staticClass) &&
  33601. isUndef(data.class) && (
  33602. isUndef(oldData) || (
  33603. isUndef(oldData.staticClass) &&
  33604. isUndef(oldData.class)
  33605. )
  33606. )
  33607. ) {
  33608. return
  33609. }
  33610. var cls = genClassForVnode(vnode);
  33611. // handle transition classes
  33612. var transitionClass = el._transitionClasses;
  33613. if (isDef(transitionClass)) {
  33614. cls = concat(cls, stringifyClass(transitionClass));
  33615. }
  33616. // set the class
  33617. if (cls !== el._prevClass) {
  33618. el.setAttribute('class', cls);
  33619. el._prevClass = cls;
  33620. }
  33621. }
  33622. var klass = {
  33623. create: updateClass,
  33624. update: updateClass
  33625. };
  33626. /* */
  33627. var validDivisionCharRE = /[\w).+\-_$\]]/;
  33628. function parseFilters (exp) {
  33629. var inSingle = false;
  33630. var inDouble = false;
  33631. var inTemplateString = false;
  33632. var inRegex = false;
  33633. var curly = 0;
  33634. var square = 0;
  33635. var paren = 0;
  33636. var lastFilterIndex = 0;
  33637. var c, prev, i, expression, filters;
  33638. for (i = 0; i < exp.length; i++) {
  33639. prev = c;
  33640. c = exp.charCodeAt(i);
  33641. if (inSingle) {
  33642. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  33643. } else if (inDouble) {
  33644. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  33645. } else if (inTemplateString) {
  33646. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  33647. } else if (inRegex) {
  33648. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  33649. } else if (
  33650. c === 0x7C && // pipe
  33651. exp.charCodeAt(i + 1) !== 0x7C &&
  33652. exp.charCodeAt(i - 1) !== 0x7C &&
  33653. !curly && !square && !paren
  33654. ) {
  33655. if (expression === undefined) {
  33656. // first filter, end of expression
  33657. lastFilterIndex = i + 1;
  33658. expression = exp.slice(0, i).trim();
  33659. } else {
  33660. pushFilter();
  33661. }
  33662. } else {
  33663. switch (c) {
  33664. case 0x22: inDouble = true; break // "
  33665. case 0x27: inSingle = true; break // '
  33666. case 0x60: inTemplateString = true; break // `
  33667. case 0x28: paren++; break // (
  33668. case 0x29: paren--; break // )
  33669. case 0x5B: square++; break // [
  33670. case 0x5D: square--; break // ]
  33671. case 0x7B: curly++; break // {
  33672. case 0x7D: curly--; break // }
  33673. }
  33674. if (c === 0x2f) { // /
  33675. var j = i - 1;
  33676. var p = (void 0);
  33677. // find first non-whitespace prev char
  33678. for (; j >= 0; j--) {
  33679. p = exp.charAt(j);
  33680. if (p !== ' ') { break }
  33681. }
  33682. if (!p || !validDivisionCharRE.test(p)) {
  33683. inRegex = true;
  33684. }
  33685. }
  33686. }
  33687. }
  33688. if (expression === undefined) {
  33689. expression = exp.slice(0, i).trim();
  33690. } else if (lastFilterIndex !== 0) {
  33691. pushFilter();
  33692. }
  33693. function pushFilter () {
  33694. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  33695. lastFilterIndex = i + 1;
  33696. }
  33697. if (filters) {
  33698. for (i = 0; i < filters.length; i++) {
  33699. expression = wrapFilter(expression, filters[i]);
  33700. }
  33701. }
  33702. return expression
  33703. }
  33704. function wrapFilter (exp, filter) {
  33705. var i = filter.indexOf('(');
  33706. if (i < 0) {
  33707. // _f: resolveFilter
  33708. return ("_f(\"" + filter + "\")(" + exp + ")")
  33709. } else {
  33710. var name = filter.slice(0, i);
  33711. var args = filter.slice(i + 1);
  33712. return ("_f(\"" + name + "\")(" + exp + "," + args)
  33713. }
  33714. }
  33715. /* */
  33716. function baseWarn (msg) {
  33717. console.error(("[Vue compiler]: " + msg));
  33718. }
  33719. function pluckModuleFunction (
  33720. modules,
  33721. key
  33722. ) {
  33723. return modules
  33724. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  33725. : []
  33726. }
  33727. function addProp (el, name, value) {
  33728. (el.props || (el.props = [])).push({ name: name, value: value });
  33729. el.plain = false;
  33730. }
  33731. function addAttr (el, name, value) {
  33732. (el.attrs || (el.attrs = [])).push({ name: name, value: value });
  33733. el.plain = false;
  33734. }
  33735. // add a raw attr (use this in preTransforms)
  33736. function addRawAttr (el, name, value) {
  33737. el.attrsMap[name] = value;
  33738. el.attrsList.push({ name: name, value: value });
  33739. }
  33740. function addDirective (
  33741. el,
  33742. name,
  33743. rawName,
  33744. value,
  33745. arg,
  33746. modifiers
  33747. ) {
  33748. (el.directives || (el.directives = [])).push({ name: name, rawName: rawName, value: value, arg: arg, modifiers: modifiers });
  33749. el.plain = false;
  33750. }
  33751. function addHandler (
  33752. el,
  33753. name,
  33754. value,
  33755. modifiers,
  33756. important,
  33757. warn
  33758. ) {
  33759. modifiers = modifiers || emptyObject;
  33760. // warn prevent and passive modifier
  33761. /* istanbul ignore if */
  33762. if (
  33763. "development" !== 'production' && warn &&
  33764. modifiers.prevent && modifiers.passive
  33765. ) {
  33766. warn(
  33767. 'passive and prevent can\'t be used together. ' +
  33768. 'Passive handler can\'t prevent default event.'
  33769. );
  33770. }
  33771. // check capture modifier
  33772. if (modifiers.capture) {
  33773. delete modifiers.capture;
  33774. name = '!' + name; // mark the event as captured
  33775. }
  33776. if (modifiers.once) {
  33777. delete modifiers.once;
  33778. name = '~' + name; // mark the event as once
  33779. }
  33780. /* istanbul ignore if */
  33781. if (modifiers.passive) {
  33782. delete modifiers.passive;
  33783. name = '&' + name; // mark the event as passive
  33784. }
  33785. // normalize click.right and click.middle since they don't actually fire
  33786. // this is technically browser-specific, but at least for now browsers are
  33787. // the only target envs that have right/middle clicks.
  33788. if (name === 'click') {
  33789. if (modifiers.right) {
  33790. name = 'contextmenu';
  33791. delete modifiers.right;
  33792. } else if (modifiers.middle) {
  33793. name = 'mouseup';
  33794. }
  33795. }
  33796. var events;
  33797. if (modifiers.native) {
  33798. delete modifiers.native;
  33799. events = el.nativeEvents || (el.nativeEvents = {});
  33800. } else {
  33801. events = el.events || (el.events = {});
  33802. }
  33803. var newHandler = { value: value };
  33804. if (modifiers !== emptyObject) {
  33805. newHandler.modifiers = modifiers;
  33806. }
  33807. var handlers = events[name];
  33808. /* istanbul ignore if */
  33809. if (Array.isArray(handlers)) {
  33810. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  33811. } else if (handlers) {
  33812. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  33813. } else {
  33814. events[name] = newHandler;
  33815. }
  33816. el.plain = false;
  33817. }
  33818. function getBindingAttr (
  33819. el,
  33820. name,
  33821. getStatic
  33822. ) {
  33823. var dynamicValue =
  33824. getAndRemoveAttr(el, ':' + name) ||
  33825. getAndRemoveAttr(el, 'v-bind:' + name);
  33826. if (dynamicValue != null) {
  33827. return parseFilters(dynamicValue)
  33828. } else if (getStatic !== false) {
  33829. var staticValue = getAndRemoveAttr(el, name);
  33830. if (staticValue != null) {
  33831. return JSON.stringify(staticValue)
  33832. }
  33833. }
  33834. }
  33835. // note: this only removes the attr from the Array (attrsList) so that it
  33836. // doesn't get processed by processAttrs.
  33837. // By default it does NOT remove it from the map (attrsMap) because the map is
  33838. // needed during codegen.
  33839. function getAndRemoveAttr (
  33840. el,
  33841. name,
  33842. removeFromMap
  33843. ) {
  33844. var val;
  33845. if ((val = el.attrsMap[name]) != null) {
  33846. var list = el.attrsList;
  33847. for (var i = 0, l = list.length; i < l; i++) {
  33848. if (list[i].name === name) {
  33849. list.splice(i, 1);
  33850. break
  33851. }
  33852. }
  33853. }
  33854. if (removeFromMap) {
  33855. delete el.attrsMap[name];
  33856. }
  33857. return val
  33858. }
  33859. /* */
  33860. /**
  33861. * Cross-platform code generation for component v-model
  33862. */
  33863. function genComponentModel (
  33864. el,
  33865. value,
  33866. modifiers
  33867. ) {
  33868. var ref = modifiers || {};
  33869. var number = ref.number;
  33870. var trim = ref.trim;
  33871. var baseValueExpression = '$$v';
  33872. var valueExpression = baseValueExpression;
  33873. if (trim) {
  33874. valueExpression =
  33875. "(typeof " + baseValueExpression + " === 'string'" +
  33876. "? " + baseValueExpression + ".trim()" +
  33877. ": " + baseValueExpression + ")";
  33878. }
  33879. if (number) {
  33880. valueExpression = "_n(" + valueExpression + ")";
  33881. }
  33882. var assignment = genAssignmentCode(value, valueExpression);
  33883. el.model = {
  33884. value: ("(" + value + ")"),
  33885. expression: ("\"" + value + "\""),
  33886. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  33887. };
  33888. }
  33889. /**
  33890. * Cross-platform codegen helper for generating v-model value assignment code.
  33891. */
  33892. function genAssignmentCode (
  33893. value,
  33894. assignment
  33895. ) {
  33896. var res = parseModel(value);
  33897. if (res.key === null) {
  33898. return (value + "=" + assignment)
  33899. } else {
  33900. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  33901. }
  33902. }
  33903. /**
  33904. * Parse a v-model expression into a base path and a final key segment.
  33905. * Handles both dot-path and possible square brackets.
  33906. *
  33907. * Possible cases:
  33908. *
  33909. * - test
  33910. * - test[key]
  33911. * - test[test1[key]]
  33912. * - test["a"][key]
  33913. * - xxx.test[a[a].test1[key]]
  33914. * - test.xxx.a["asa"][test1[key]]
  33915. *
  33916. */
  33917. var len;
  33918. var str;
  33919. var chr;
  33920. var index$1;
  33921. var expressionPos;
  33922. var expressionEndPos;
  33923. function parseModel (val) {
  33924. len = val.length;
  33925. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  33926. index$1 = val.lastIndexOf('.');
  33927. if (index$1 > -1) {
  33928. return {
  33929. exp: val.slice(0, index$1),
  33930. key: '"' + val.slice(index$1 + 1) + '"'
  33931. }
  33932. } else {
  33933. return {
  33934. exp: val,
  33935. key: null
  33936. }
  33937. }
  33938. }
  33939. str = val;
  33940. index$1 = expressionPos = expressionEndPos = 0;
  33941. while (!eof()) {
  33942. chr = next();
  33943. /* istanbul ignore if */
  33944. if (isStringStart(chr)) {
  33945. parseString(chr);
  33946. } else if (chr === 0x5B) {
  33947. parseBracket(chr);
  33948. }
  33949. }
  33950. return {
  33951. exp: val.slice(0, expressionPos),
  33952. key: val.slice(expressionPos + 1, expressionEndPos)
  33953. }
  33954. }
  33955. function next () {
  33956. return str.charCodeAt(++index$1)
  33957. }
  33958. function eof () {
  33959. return index$1 >= len
  33960. }
  33961. function isStringStart (chr) {
  33962. return chr === 0x22 || chr === 0x27
  33963. }
  33964. function parseBracket (chr) {
  33965. var inBracket = 1;
  33966. expressionPos = index$1;
  33967. while (!eof()) {
  33968. chr = next();
  33969. if (isStringStart(chr)) {
  33970. parseString(chr);
  33971. continue
  33972. }
  33973. if (chr === 0x5B) { inBracket++; }
  33974. if (chr === 0x5D) { inBracket--; }
  33975. if (inBracket === 0) {
  33976. expressionEndPos = index$1;
  33977. break
  33978. }
  33979. }
  33980. }
  33981. function parseString (chr) {
  33982. var stringQuote = chr;
  33983. while (!eof()) {
  33984. chr = next();
  33985. if (chr === stringQuote) {
  33986. break
  33987. }
  33988. }
  33989. }
  33990. /* */
  33991. var warn$1;
  33992. // in some cases, the event used has to be determined at runtime
  33993. // so we used some reserved tokens during compile.
  33994. var RANGE_TOKEN = '__r';
  33995. var CHECKBOX_RADIO_TOKEN = '__c';
  33996. function model (
  33997. el,
  33998. dir,
  33999. _warn
  34000. ) {
  34001. warn$1 = _warn;
  34002. var value = dir.value;
  34003. var modifiers = dir.modifiers;
  34004. var tag = el.tag;
  34005. var type = el.attrsMap.type;
  34006. if (true) {
  34007. // inputs with type="file" are read only and setting the input's
  34008. // value will throw an error.
  34009. if (tag === 'input' && type === 'file') {
  34010. warn$1(
  34011. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  34012. "File inputs are read only. Use a v-on:change listener instead."
  34013. );
  34014. }
  34015. }
  34016. if (el.component) {
  34017. genComponentModel(el, value, modifiers);
  34018. // component v-model doesn't need extra runtime
  34019. return false
  34020. } else if (tag === 'select') {
  34021. genSelect(el, value, modifiers);
  34022. } else if (tag === 'input' && type === 'checkbox') {
  34023. genCheckboxModel(el, value, modifiers);
  34024. } else if (tag === 'input' && type === 'radio') {
  34025. genRadioModel(el, value, modifiers);
  34026. } else if (tag === 'input' || tag === 'textarea') {
  34027. genDefaultModel(el, value, modifiers);
  34028. } else if (!config.isReservedTag(tag)) {
  34029. genComponentModel(el, value, modifiers);
  34030. // component v-model doesn't need extra runtime
  34031. return false
  34032. } else if (true) {
  34033. warn$1(
  34034. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  34035. "v-model is not supported on this element type. " +
  34036. 'If you are working with contenteditable, it\'s recommended to ' +
  34037. 'wrap a library dedicated for that purpose inside a custom component.'
  34038. );
  34039. }
  34040. // ensure runtime directive metadata
  34041. return true
  34042. }
  34043. function genCheckboxModel (
  34044. el,
  34045. value,
  34046. modifiers
  34047. ) {
  34048. var number = modifiers && modifiers.number;
  34049. var valueBinding = getBindingAttr(el, 'value') || 'null';
  34050. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  34051. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  34052. addProp(el, 'checked',
  34053. "Array.isArray(" + value + ")" +
  34054. "?_i(" + value + "," + valueBinding + ")>-1" + (
  34055. trueValueBinding === 'true'
  34056. ? (":(" + value + ")")
  34057. : (":_q(" + value + "," + trueValueBinding + ")")
  34058. )
  34059. );
  34060. addHandler(el, 'change',
  34061. "var $$a=" + value + "," +
  34062. '$$el=$event.target,' +
  34063. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  34064. 'if(Array.isArray($$a)){' +
  34065. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  34066. '$$i=_i($$a,$$v);' +
  34067. "if($$el.checked){$$i<0&&(" + value + "=$$a.concat([$$v]))}" +
  34068. "else{$$i>-1&&(" + value + "=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}" +
  34069. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  34070. null, true
  34071. );
  34072. }
  34073. function genRadioModel (
  34074. el,
  34075. value,
  34076. modifiers
  34077. ) {
  34078. var number = modifiers && modifiers.number;
  34079. var valueBinding = getBindingAttr(el, 'value') || 'null';
  34080. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  34081. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  34082. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  34083. }
  34084. function genSelect (
  34085. el,
  34086. value,
  34087. modifiers
  34088. ) {
  34089. var number = modifiers && modifiers.number;
  34090. var selectedVal = "Array.prototype.filter" +
  34091. ".call($event.target.options,function(o){return o.selected})" +
  34092. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  34093. "return " + (number ? '_n(val)' : 'val') + "})";
  34094. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  34095. var code = "var $$selectedVal = " + selectedVal + ";";
  34096. code = code + " " + (genAssignmentCode(value, assignment));
  34097. addHandler(el, 'change', code, null, true);
  34098. }
  34099. function genDefaultModel (
  34100. el,
  34101. value,
  34102. modifiers
  34103. ) {
  34104. var type = el.attrsMap.type;
  34105. // warn if v-bind:value conflicts with v-model
  34106. if (true) {
  34107. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  34108. if (value$1) {
  34109. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  34110. warn$1(
  34111. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  34112. 'because the latter already expands to a value binding internally'
  34113. );
  34114. }
  34115. }
  34116. var ref = modifiers || {};
  34117. var lazy = ref.lazy;
  34118. var number = ref.number;
  34119. var trim = ref.trim;
  34120. var needCompositionGuard = !lazy && type !== 'range';
  34121. var event = lazy
  34122. ? 'change'
  34123. : type === 'range'
  34124. ? RANGE_TOKEN
  34125. : 'input';
  34126. var valueExpression = '$event.target.value';
  34127. if (trim) {
  34128. valueExpression = "$event.target.value.trim()";
  34129. }
  34130. if (number) {
  34131. valueExpression = "_n(" + valueExpression + ")";
  34132. }
  34133. var code = genAssignmentCode(value, valueExpression);
  34134. if (needCompositionGuard) {
  34135. code = "if($event.target.composing)return;" + code;
  34136. }
  34137. addProp(el, 'value', ("(" + value + ")"));
  34138. addHandler(el, event, code, null, true);
  34139. if (trim || number) {
  34140. addHandler(el, 'blur', '$forceUpdate()');
  34141. }
  34142. }
  34143. /* */
  34144. // normalize v-model event tokens that can only be determined at runtime.
  34145. // it's important to place the event as the first in the array because
  34146. // the whole point is ensuring the v-model callback gets called before
  34147. // user-attached handlers.
  34148. function normalizeEvents (on) {
  34149. /* istanbul ignore if */
  34150. if (isDef(on[RANGE_TOKEN])) {
  34151. // IE input[type=range] only supports `change` event
  34152. var event = isIE ? 'change' : 'input';
  34153. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  34154. delete on[RANGE_TOKEN];
  34155. }
  34156. // This was originally intended to fix #4521 but no longer necessary
  34157. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  34158. /* istanbul ignore if */
  34159. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  34160. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  34161. delete on[CHECKBOX_RADIO_TOKEN];
  34162. }
  34163. }
  34164. var target$1;
  34165. function createOnceHandler (handler, event, capture) {
  34166. var _target = target$1; // save current target element in closure
  34167. return function onceHandler () {
  34168. var res = handler.apply(null, arguments);
  34169. if (res !== null) {
  34170. remove$2(event, onceHandler, capture, _target);
  34171. }
  34172. }
  34173. }
  34174. function add$1 (
  34175. event,
  34176. handler,
  34177. once$$1,
  34178. capture,
  34179. passive
  34180. ) {
  34181. handler = withMacroTask(handler);
  34182. if (once$$1) { handler = createOnceHandler(handler, event, capture); }
  34183. target$1.addEventListener(
  34184. event,
  34185. handler,
  34186. supportsPassive
  34187. ? { capture: capture, passive: passive }
  34188. : capture
  34189. );
  34190. }
  34191. function remove$2 (
  34192. event,
  34193. handler,
  34194. capture,
  34195. _target
  34196. ) {
  34197. (_target || target$1).removeEventListener(
  34198. event,
  34199. handler._withTask || handler,
  34200. capture
  34201. );
  34202. }
  34203. function updateDOMListeners (oldVnode, vnode) {
  34204. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  34205. return
  34206. }
  34207. var on = vnode.data.on || {};
  34208. var oldOn = oldVnode.data.on || {};
  34209. target$1 = vnode.elm;
  34210. normalizeEvents(on);
  34211. updateListeners(on, oldOn, add$1, remove$2, vnode.context);
  34212. target$1 = undefined;
  34213. }
  34214. var events = {
  34215. create: updateDOMListeners,
  34216. update: updateDOMListeners
  34217. };
  34218. /* */
  34219. function updateDOMProps (oldVnode, vnode) {
  34220. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  34221. return
  34222. }
  34223. var key, cur;
  34224. var elm = vnode.elm;
  34225. var oldProps = oldVnode.data.domProps || {};
  34226. var props = vnode.data.domProps || {};
  34227. // clone observed objects, as the user probably wants to mutate it
  34228. if (isDef(props.__ob__)) {
  34229. props = vnode.data.domProps = extend({}, props);
  34230. }
  34231. for (key in oldProps) {
  34232. if (isUndef(props[key])) {
  34233. elm[key] = '';
  34234. }
  34235. }
  34236. for (key in props) {
  34237. cur = props[key];
  34238. // ignore children if the node has textContent or innerHTML,
  34239. // as these will throw away existing DOM nodes and cause removal errors
  34240. // on subsequent patches (#3360)
  34241. if (key === 'textContent' || key === 'innerHTML') {
  34242. if (vnode.children) { vnode.children.length = 0; }
  34243. if (cur === oldProps[key]) { continue }
  34244. // #6601 work around Chrome version <= 55 bug where single textNode
  34245. // replaced by innerHTML/textContent retains its parentNode property
  34246. if (elm.childNodes.length === 1) {
  34247. elm.removeChild(elm.childNodes[0]);
  34248. }
  34249. }
  34250. if (key === 'value') {
  34251. // store value as _value as well since
  34252. // non-string values will be stringified
  34253. elm._value = cur;
  34254. // avoid resetting cursor position when value is the same
  34255. var strCur = isUndef(cur) ? '' : String(cur);
  34256. if (shouldUpdateValue(elm, strCur)) {
  34257. elm.value = strCur;
  34258. }
  34259. } else {
  34260. elm[key] = cur;
  34261. }
  34262. }
  34263. }
  34264. // check platforms/web/util/attrs.js acceptValue
  34265. function shouldUpdateValue (elm, checkVal) {
  34266. return (!elm.composing && (
  34267. elm.tagName === 'OPTION' ||
  34268. isNotInFocusAndDirty(elm, checkVal) ||
  34269. isDirtyWithModifiers(elm, checkVal)
  34270. ))
  34271. }
  34272. function isNotInFocusAndDirty (elm, checkVal) {
  34273. // return true when textbox (.number and .trim) loses focus and its value is
  34274. // not equal to the updated value
  34275. var notInFocus = true;
  34276. // #6157
  34277. // work around IE bug when accessing document.activeElement in an iframe
  34278. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  34279. return notInFocus && elm.value !== checkVal
  34280. }
  34281. function isDirtyWithModifiers (elm, newVal) {
  34282. var value = elm.value;
  34283. var modifiers = elm._vModifiers; // injected by v-model runtime
  34284. if (isDef(modifiers)) {
  34285. if (modifiers.lazy) {
  34286. // inputs with lazy should only be updated when not in focus
  34287. return false
  34288. }
  34289. if (modifiers.number) {
  34290. return toNumber(value) !== toNumber(newVal)
  34291. }
  34292. if (modifiers.trim) {
  34293. return value.trim() !== newVal.trim()
  34294. }
  34295. }
  34296. return value !== newVal
  34297. }
  34298. var domProps = {
  34299. create: updateDOMProps,
  34300. update: updateDOMProps
  34301. };
  34302. /* */
  34303. var parseStyleText = cached(function (cssText) {
  34304. var res = {};
  34305. var listDelimiter = /;(?![^(]*\))/g;
  34306. var propertyDelimiter = /:(.+)/;
  34307. cssText.split(listDelimiter).forEach(function (item) {
  34308. if (item) {
  34309. var tmp = item.split(propertyDelimiter);
  34310. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  34311. }
  34312. });
  34313. return res
  34314. });
  34315. // merge static and dynamic style data on the same vnode
  34316. function normalizeStyleData (data) {
  34317. var style = normalizeStyleBinding(data.style);
  34318. // static style is pre-processed into an object during compilation
  34319. // and is always a fresh object, so it's safe to merge into it
  34320. return data.staticStyle
  34321. ? extend(data.staticStyle, style)
  34322. : style
  34323. }
  34324. // normalize possible array / string values into Object
  34325. function normalizeStyleBinding (bindingStyle) {
  34326. if (Array.isArray(bindingStyle)) {
  34327. return toObject(bindingStyle)
  34328. }
  34329. if (typeof bindingStyle === 'string') {
  34330. return parseStyleText(bindingStyle)
  34331. }
  34332. return bindingStyle
  34333. }
  34334. /**
  34335. * parent component style should be after child's
  34336. * so that parent component's style could override it
  34337. */
  34338. function getStyle (vnode, checkChild) {
  34339. var res = {};
  34340. var styleData;
  34341. if (checkChild) {
  34342. var childNode = vnode;
  34343. while (childNode.componentInstance) {
  34344. childNode = childNode.componentInstance._vnode;
  34345. if (
  34346. childNode && childNode.data &&
  34347. (styleData = normalizeStyleData(childNode.data))
  34348. ) {
  34349. extend(res, styleData);
  34350. }
  34351. }
  34352. }
  34353. if ((styleData = normalizeStyleData(vnode.data))) {
  34354. extend(res, styleData);
  34355. }
  34356. var parentNode = vnode;
  34357. while ((parentNode = parentNode.parent)) {
  34358. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  34359. extend(res, styleData);
  34360. }
  34361. }
  34362. return res
  34363. }
  34364. /* */
  34365. var cssVarRE = /^--/;
  34366. var importantRE = /\s*!important$/;
  34367. var setProp = function (el, name, val) {
  34368. /* istanbul ignore if */
  34369. if (cssVarRE.test(name)) {
  34370. el.style.setProperty(name, val);
  34371. } else if (importantRE.test(val)) {
  34372. el.style.setProperty(name, val.replace(importantRE, ''), 'important');
  34373. } else {
  34374. var normalizedName = normalize(name);
  34375. if (Array.isArray(val)) {
  34376. // Support values array created by autoprefixer, e.g.
  34377. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  34378. // Set them one by one, and the browser will only set those it can recognize
  34379. for (var i = 0, len = val.length; i < len; i++) {
  34380. el.style[normalizedName] = val[i];
  34381. }
  34382. } else {
  34383. el.style[normalizedName] = val;
  34384. }
  34385. }
  34386. };
  34387. var vendorNames = ['Webkit', 'Moz', 'ms'];
  34388. var emptyStyle;
  34389. var normalize = cached(function (prop) {
  34390. emptyStyle = emptyStyle || document.createElement('div').style;
  34391. prop = camelize(prop);
  34392. if (prop !== 'filter' && (prop in emptyStyle)) {
  34393. return prop
  34394. }
  34395. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  34396. for (var i = 0; i < vendorNames.length; i++) {
  34397. var name = vendorNames[i] + capName;
  34398. if (name in emptyStyle) {
  34399. return name
  34400. }
  34401. }
  34402. });
  34403. function updateStyle (oldVnode, vnode) {
  34404. var data = vnode.data;
  34405. var oldData = oldVnode.data;
  34406. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  34407. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  34408. ) {
  34409. return
  34410. }
  34411. var cur, name;
  34412. var el = vnode.elm;
  34413. var oldStaticStyle = oldData.staticStyle;
  34414. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  34415. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  34416. var oldStyle = oldStaticStyle || oldStyleBinding;
  34417. var style = normalizeStyleBinding(vnode.data.style) || {};
  34418. // store normalized style under a different key for next diff
  34419. // make sure to clone it if it's reactive, since the user likely wants
  34420. // to mutate it.
  34421. vnode.data.normalizedStyle = isDef(style.__ob__)
  34422. ? extend({}, style)
  34423. : style;
  34424. var newStyle = getStyle(vnode, true);
  34425. for (name in oldStyle) {
  34426. if (isUndef(newStyle[name])) {
  34427. setProp(el, name, '');
  34428. }
  34429. }
  34430. for (name in newStyle) {
  34431. cur = newStyle[name];
  34432. if (cur !== oldStyle[name]) {
  34433. // ie9 setting to null has no effect, must use empty string
  34434. setProp(el, name, cur == null ? '' : cur);
  34435. }
  34436. }
  34437. }
  34438. var style = {
  34439. create: updateStyle,
  34440. update: updateStyle
  34441. };
  34442. /* */
  34443. /**
  34444. * Add class with compatibility for SVG since classList is not supported on
  34445. * SVG elements in IE
  34446. */
  34447. function addClass (el, cls) {
  34448. /* istanbul ignore if */
  34449. if (!cls || !(cls = cls.trim())) {
  34450. return
  34451. }
  34452. /* istanbul ignore else */
  34453. if (el.classList) {
  34454. if (cls.indexOf(' ') > -1) {
  34455. cls.split(/\s+/).forEach(function (c) { return el.classList.add(c); });
  34456. } else {
  34457. el.classList.add(cls);
  34458. }
  34459. } else {
  34460. var cur = " " + (el.getAttribute('class') || '') + " ";
  34461. if (cur.indexOf(' ' + cls + ' ') < 0) {
  34462. el.setAttribute('class', (cur + cls).trim());
  34463. }
  34464. }
  34465. }
  34466. /**
  34467. * Remove class with compatibility for SVG since classList is not supported on
  34468. * SVG elements in IE
  34469. */
  34470. function removeClass (el, cls) {
  34471. /* istanbul ignore if */
  34472. if (!cls || !(cls = cls.trim())) {
  34473. return
  34474. }
  34475. /* istanbul ignore else */
  34476. if (el.classList) {
  34477. if (cls.indexOf(' ') > -1) {
  34478. cls.split(/\s+/).forEach(function (c) { return el.classList.remove(c); });
  34479. } else {
  34480. el.classList.remove(cls);
  34481. }
  34482. if (!el.classList.length) {
  34483. el.removeAttribute('class');
  34484. }
  34485. } else {
  34486. var cur = " " + (el.getAttribute('class') || '') + " ";
  34487. var tar = ' ' + cls + ' ';
  34488. while (cur.indexOf(tar) >= 0) {
  34489. cur = cur.replace(tar, ' ');
  34490. }
  34491. cur = cur.trim();
  34492. if (cur) {
  34493. el.setAttribute('class', cur);
  34494. } else {
  34495. el.removeAttribute('class');
  34496. }
  34497. }
  34498. }
  34499. /* */
  34500. function resolveTransition (def) {
  34501. if (!def) {
  34502. return
  34503. }
  34504. /* istanbul ignore else */
  34505. if (typeof def === 'object') {
  34506. var res = {};
  34507. if (def.css !== false) {
  34508. extend(res, autoCssTransition(def.name || 'v'));
  34509. }
  34510. extend(res, def);
  34511. return res
  34512. } else if (typeof def === 'string') {
  34513. return autoCssTransition(def)
  34514. }
  34515. }
  34516. var autoCssTransition = cached(function (name) {
  34517. return {
  34518. enterClass: (name + "-enter"),
  34519. enterToClass: (name + "-enter-to"),
  34520. enterActiveClass: (name + "-enter-active"),
  34521. leaveClass: (name + "-leave"),
  34522. leaveToClass: (name + "-leave-to"),
  34523. leaveActiveClass: (name + "-leave-active")
  34524. }
  34525. });
  34526. var hasTransition = inBrowser && !isIE9;
  34527. var TRANSITION = 'transition';
  34528. var ANIMATION = 'animation';
  34529. // Transition property/event sniffing
  34530. var transitionProp = 'transition';
  34531. var transitionEndEvent = 'transitionend';
  34532. var animationProp = 'animation';
  34533. var animationEndEvent = 'animationend';
  34534. if (hasTransition) {
  34535. /* istanbul ignore if */
  34536. if (window.ontransitionend === undefined &&
  34537. window.onwebkittransitionend !== undefined
  34538. ) {
  34539. transitionProp = 'WebkitTransition';
  34540. transitionEndEvent = 'webkitTransitionEnd';
  34541. }
  34542. if (window.onanimationend === undefined &&
  34543. window.onwebkitanimationend !== undefined
  34544. ) {
  34545. animationProp = 'WebkitAnimation';
  34546. animationEndEvent = 'webkitAnimationEnd';
  34547. }
  34548. }
  34549. // binding to window is necessary to make hot reload work in IE in strict mode
  34550. var raf = inBrowser
  34551. ? window.requestAnimationFrame
  34552. ? window.requestAnimationFrame.bind(window)
  34553. : setTimeout
  34554. : /* istanbul ignore next */ function (fn) { return fn(); };
  34555. function nextFrame (fn) {
  34556. raf(function () {
  34557. raf(fn);
  34558. });
  34559. }
  34560. function addTransitionClass (el, cls) {
  34561. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  34562. if (transitionClasses.indexOf(cls) < 0) {
  34563. transitionClasses.push(cls);
  34564. addClass(el, cls);
  34565. }
  34566. }
  34567. function removeTransitionClass (el, cls) {
  34568. if (el._transitionClasses) {
  34569. remove(el._transitionClasses, cls);
  34570. }
  34571. removeClass(el, cls);
  34572. }
  34573. function whenTransitionEnds (
  34574. el,
  34575. expectedType,
  34576. cb
  34577. ) {
  34578. var ref = getTransitionInfo(el, expectedType);
  34579. var type = ref.type;
  34580. var timeout = ref.timeout;
  34581. var propCount = ref.propCount;
  34582. if (!type) { return cb() }
  34583. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  34584. var ended = 0;
  34585. var end = function () {
  34586. el.removeEventListener(event, onEnd);
  34587. cb();
  34588. };
  34589. var onEnd = function (e) {
  34590. if (e.target === el) {
  34591. if (++ended >= propCount) {
  34592. end();
  34593. }
  34594. }
  34595. };
  34596. setTimeout(function () {
  34597. if (ended < propCount) {
  34598. end();
  34599. }
  34600. }, timeout + 1);
  34601. el.addEventListener(event, onEnd);
  34602. }
  34603. var transformRE = /\b(transform|all)(,|$)/;
  34604. function getTransitionInfo (el, expectedType) {
  34605. var styles = window.getComputedStyle(el);
  34606. var transitionDelays = styles[transitionProp + 'Delay'].split(', ');
  34607. var transitionDurations = styles[transitionProp + 'Duration'].split(', ');
  34608. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  34609. var animationDelays = styles[animationProp + 'Delay'].split(', ');
  34610. var animationDurations = styles[animationProp + 'Duration'].split(', ');
  34611. var animationTimeout = getTimeout(animationDelays, animationDurations);
  34612. var type;
  34613. var timeout = 0;
  34614. var propCount = 0;
  34615. /* istanbul ignore if */
  34616. if (expectedType === TRANSITION) {
  34617. if (transitionTimeout > 0) {
  34618. type = TRANSITION;
  34619. timeout = transitionTimeout;
  34620. propCount = transitionDurations.length;
  34621. }
  34622. } else if (expectedType === ANIMATION) {
  34623. if (animationTimeout > 0) {
  34624. type = ANIMATION;
  34625. timeout = animationTimeout;
  34626. propCount = animationDurations.length;
  34627. }
  34628. } else {
  34629. timeout = Math.max(transitionTimeout, animationTimeout);
  34630. type = timeout > 0
  34631. ? transitionTimeout > animationTimeout
  34632. ? TRANSITION
  34633. : ANIMATION
  34634. : null;
  34635. propCount = type
  34636. ? type === TRANSITION
  34637. ? transitionDurations.length
  34638. : animationDurations.length
  34639. : 0;
  34640. }
  34641. var hasTransform =
  34642. type === TRANSITION &&
  34643. transformRE.test(styles[transitionProp + 'Property']);
  34644. return {
  34645. type: type,
  34646. timeout: timeout,
  34647. propCount: propCount,
  34648. hasTransform: hasTransform
  34649. }
  34650. }
  34651. function getTimeout (delays, durations) {
  34652. /* istanbul ignore next */
  34653. while (delays.length < durations.length) {
  34654. delays = delays.concat(delays);
  34655. }
  34656. return Math.max.apply(null, durations.map(function (d, i) {
  34657. return toMs(d) + toMs(delays[i])
  34658. }))
  34659. }
  34660. function toMs (s) {
  34661. return Number(s.slice(0, -1)) * 1000
  34662. }
  34663. /* */
  34664. function enter (vnode, toggleDisplay) {
  34665. var el = vnode.elm;
  34666. // call leave callback now
  34667. if (isDef(el._leaveCb)) {
  34668. el._leaveCb.cancelled = true;
  34669. el._leaveCb();
  34670. }
  34671. var data = resolveTransition(vnode.data.transition);
  34672. if (isUndef(data)) {
  34673. return
  34674. }
  34675. /* istanbul ignore if */
  34676. if (isDef(el._enterCb) || el.nodeType !== 1) {
  34677. return
  34678. }
  34679. var css = data.css;
  34680. var type = data.type;
  34681. var enterClass = data.enterClass;
  34682. var enterToClass = data.enterToClass;
  34683. var enterActiveClass = data.enterActiveClass;
  34684. var appearClass = data.appearClass;
  34685. var appearToClass = data.appearToClass;
  34686. var appearActiveClass = data.appearActiveClass;
  34687. var beforeEnter = data.beforeEnter;
  34688. var enter = data.enter;
  34689. var afterEnter = data.afterEnter;
  34690. var enterCancelled = data.enterCancelled;
  34691. var beforeAppear = data.beforeAppear;
  34692. var appear = data.appear;
  34693. var afterAppear = data.afterAppear;
  34694. var appearCancelled = data.appearCancelled;
  34695. var duration = data.duration;
  34696. // activeInstance will always be the <transition> component managing this
  34697. // transition. One edge case to check is when the <transition> is placed
  34698. // as the root node of a child component. In that case we need to check
  34699. // <transition>'s parent for appear check.
  34700. var context = activeInstance;
  34701. var transitionNode = activeInstance.$vnode;
  34702. while (transitionNode && transitionNode.parent) {
  34703. transitionNode = transitionNode.parent;
  34704. context = transitionNode.context;
  34705. }
  34706. var isAppear = !context._isMounted || !vnode.isRootInsert;
  34707. if (isAppear && !appear && appear !== '') {
  34708. return
  34709. }
  34710. var startClass = isAppear && appearClass
  34711. ? appearClass
  34712. : enterClass;
  34713. var activeClass = isAppear && appearActiveClass
  34714. ? appearActiveClass
  34715. : enterActiveClass;
  34716. var toClass = isAppear && appearToClass
  34717. ? appearToClass
  34718. : enterToClass;
  34719. var beforeEnterHook = isAppear
  34720. ? (beforeAppear || beforeEnter)
  34721. : beforeEnter;
  34722. var enterHook = isAppear
  34723. ? (typeof appear === 'function' ? appear : enter)
  34724. : enter;
  34725. var afterEnterHook = isAppear
  34726. ? (afterAppear || afterEnter)
  34727. : afterEnter;
  34728. var enterCancelledHook = isAppear
  34729. ? (appearCancelled || enterCancelled)
  34730. : enterCancelled;
  34731. var explicitEnterDuration = toNumber(
  34732. isObject(duration)
  34733. ? duration.enter
  34734. : duration
  34735. );
  34736. if ("development" !== 'production' && explicitEnterDuration != null) {
  34737. checkDuration(explicitEnterDuration, 'enter', vnode);
  34738. }
  34739. var expectsCSS = css !== false && !isIE9;
  34740. var userWantsControl = getHookArgumentsLength(enterHook);
  34741. var cb = el._enterCb = once(function () {
  34742. if (expectsCSS) {
  34743. removeTransitionClass(el, toClass);
  34744. removeTransitionClass(el, activeClass);
  34745. }
  34746. if (cb.cancelled) {
  34747. if (expectsCSS) {
  34748. removeTransitionClass(el, startClass);
  34749. }
  34750. enterCancelledHook && enterCancelledHook(el);
  34751. } else {
  34752. afterEnterHook && afterEnterHook(el);
  34753. }
  34754. el._enterCb = null;
  34755. });
  34756. if (!vnode.data.show) {
  34757. // remove pending leave element on enter by injecting an insert hook
  34758. mergeVNodeHook(vnode, 'insert', function () {
  34759. var parent = el.parentNode;
  34760. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  34761. if (pendingNode &&
  34762. pendingNode.tag === vnode.tag &&
  34763. pendingNode.elm._leaveCb
  34764. ) {
  34765. pendingNode.elm._leaveCb();
  34766. }
  34767. enterHook && enterHook(el, cb);
  34768. });
  34769. }
  34770. // start enter transition
  34771. beforeEnterHook && beforeEnterHook(el);
  34772. if (expectsCSS) {
  34773. addTransitionClass(el, startClass);
  34774. addTransitionClass(el, activeClass);
  34775. nextFrame(function () {
  34776. addTransitionClass(el, toClass);
  34777. removeTransitionClass(el, startClass);
  34778. if (!cb.cancelled && !userWantsControl) {
  34779. if (isValidDuration(explicitEnterDuration)) {
  34780. setTimeout(cb, explicitEnterDuration);
  34781. } else {
  34782. whenTransitionEnds(el, type, cb);
  34783. }
  34784. }
  34785. });
  34786. }
  34787. if (vnode.data.show) {
  34788. toggleDisplay && toggleDisplay();
  34789. enterHook && enterHook(el, cb);
  34790. }
  34791. if (!expectsCSS && !userWantsControl) {
  34792. cb();
  34793. }
  34794. }
  34795. function leave (vnode, rm) {
  34796. var el = vnode.elm;
  34797. // call enter callback now
  34798. if (isDef(el._enterCb)) {
  34799. el._enterCb.cancelled = true;
  34800. el._enterCb();
  34801. }
  34802. var data = resolveTransition(vnode.data.transition);
  34803. if (isUndef(data) || el.nodeType !== 1) {
  34804. return rm()
  34805. }
  34806. /* istanbul ignore if */
  34807. if (isDef(el._leaveCb)) {
  34808. return
  34809. }
  34810. var css = data.css;
  34811. var type = data.type;
  34812. var leaveClass = data.leaveClass;
  34813. var leaveToClass = data.leaveToClass;
  34814. var leaveActiveClass = data.leaveActiveClass;
  34815. var beforeLeave = data.beforeLeave;
  34816. var leave = data.leave;
  34817. var afterLeave = data.afterLeave;
  34818. var leaveCancelled = data.leaveCancelled;
  34819. var delayLeave = data.delayLeave;
  34820. var duration = data.duration;
  34821. var expectsCSS = css !== false && !isIE9;
  34822. var userWantsControl = getHookArgumentsLength(leave);
  34823. var explicitLeaveDuration = toNumber(
  34824. isObject(duration)
  34825. ? duration.leave
  34826. : duration
  34827. );
  34828. if ("development" !== 'production' && isDef(explicitLeaveDuration)) {
  34829. checkDuration(explicitLeaveDuration, 'leave', vnode);
  34830. }
  34831. var cb = el._leaveCb = once(function () {
  34832. if (el.parentNode && el.parentNode._pending) {
  34833. el.parentNode._pending[vnode.key] = null;
  34834. }
  34835. if (expectsCSS) {
  34836. removeTransitionClass(el, leaveToClass);
  34837. removeTransitionClass(el, leaveActiveClass);
  34838. }
  34839. if (cb.cancelled) {
  34840. if (expectsCSS) {
  34841. removeTransitionClass(el, leaveClass);
  34842. }
  34843. leaveCancelled && leaveCancelled(el);
  34844. } else {
  34845. rm();
  34846. afterLeave && afterLeave(el);
  34847. }
  34848. el._leaveCb = null;
  34849. });
  34850. if (delayLeave) {
  34851. delayLeave(performLeave);
  34852. } else {
  34853. performLeave();
  34854. }
  34855. function performLeave () {
  34856. // the delayed leave may have already been cancelled
  34857. if (cb.cancelled) {
  34858. return
  34859. }
  34860. // record leaving element
  34861. if (!vnode.data.show) {
  34862. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  34863. }
  34864. beforeLeave && beforeLeave(el);
  34865. if (expectsCSS) {
  34866. addTransitionClass(el, leaveClass);
  34867. addTransitionClass(el, leaveActiveClass);
  34868. nextFrame(function () {
  34869. addTransitionClass(el, leaveToClass);
  34870. removeTransitionClass(el, leaveClass);
  34871. if (!cb.cancelled && !userWantsControl) {
  34872. if (isValidDuration(explicitLeaveDuration)) {
  34873. setTimeout(cb, explicitLeaveDuration);
  34874. } else {
  34875. whenTransitionEnds(el, type, cb);
  34876. }
  34877. }
  34878. });
  34879. }
  34880. leave && leave(el, cb);
  34881. if (!expectsCSS && !userWantsControl) {
  34882. cb();
  34883. }
  34884. }
  34885. }
  34886. // only used in dev mode
  34887. function checkDuration (val, name, vnode) {
  34888. if (typeof val !== 'number') {
  34889. warn(
  34890. "<transition> explicit " + name + " duration is not a valid number - " +
  34891. "got " + (JSON.stringify(val)) + ".",
  34892. vnode.context
  34893. );
  34894. } else if (isNaN(val)) {
  34895. warn(
  34896. "<transition> explicit " + name + " duration is NaN - " +
  34897. 'the duration expression might be incorrect.',
  34898. vnode.context
  34899. );
  34900. }
  34901. }
  34902. function isValidDuration (val) {
  34903. return typeof val === 'number' && !isNaN(val)
  34904. }
  34905. /**
  34906. * Normalize a transition hook's argument length. The hook may be:
  34907. * - a merged hook (invoker) with the original in .fns
  34908. * - a wrapped component method (check ._length)
  34909. * - a plain function (.length)
  34910. */
  34911. function getHookArgumentsLength (fn) {
  34912. if (isUndef(fn)) {
  34913. return false
  34914. }
  34915. var invokerFns = fn.fns;
  34916. if (isDef(invokerFns)) {
  34917. // invoker
  34918. return getHookArgumentsLength(
  34919. Array.isArray(invokerFns)
  34920. ? invokerFns[0]
  34921. : invokerFns
  34922. )
  34923. } else {
  34924. return (fn._length || fn.length) > 1
  34925. }
  34926. }
  34927. function _enter (_, vnode) {
  34928. if (vnode.data.show !== true) {
  34929. enter(vnode);
  34930. }
  34931. }
  34932. var transition = inBrowser ? {
  34933. create: _enter,
  34934. activate: _enter,
  34935. remove: function remove$$1 (vnode, rm) {
  34936. /* istanbul ignore else */
  34937. if (vnode.data.show !== true) {
  34938. leave(vnode, rm);
  34939. } else {
  34940. rm();
  34941. }
  34942. }
  34943. } : {};
  34944. var platformModules = [
  34945. attrs,
  34946. klass,
  34947. events,
  34948. domProps,
  34949. style,
  34950. transition
  34951. ];
  34952. /* */
  34953. // the directive module should be applied last, after all
  34954. // built-in modules have been applied.
  34955. var modules = platformModules.concat(baseModules);
  34956. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  34957. /**
  34958. * Not type checking this file because flow doesn't like attaching
  34959. * properties to Elements.
  34960. */
  34961. /* istanbul ignore if */
  34962. if (isIE9) {
  34963. // http://www.matts411.com/post/internet-explorer-9-oninput/
  34964. document.addEventListener('selectionchange', function () {
  34965. var el = document.activeElement;
  34966. if (el && el.vmodel) {
  34967. trigger(el, 'input');
  34968. }
  34969. });
  34970. }
  34971. var directive = {
  34972. inserted: function inserted (el, binding, vnode, oldVnode) {
  34973. if (vnode.tag === 'select') {
  34974. // #6903
  34975. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  34976. mergeVNodeHook(vnode, 'postpatch', function () {
  34977. directive.componentUpdated(el, binding, vnode);
  34978. });
  34979. } else {
  34980. setSelected(el, binding, vnode.context);
  34981. }
  34982. el._vOptions = [].map.call(el.options, getValue);
  34983. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  34984. el._vModifiers = binding.modifiers;
  34985. if (!binding.modifiers.lazy) {
  34986. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  34987. // switching focus before confirming composition choice
  34988. // this also fixes the issue where some browsers e.g. iOS Chrome
  34989. // fires "change" instead of "input" on autocomplete.
  34990. el.addEventListener('change', onCompositionEnd);
  34991. if (!isAndroid) {
  34992. el.addEventListener('compositionstart', onCompositionStart);
  34993. el.addEventListener('compositionend', onCompositionEnd);
  34994. }
  34995. /* istanbul ignore if */
  34996. if (isIE9) {
  34997. el.vmodel = true;
  34998. }
  34999. }
  35000. }
  35001. },
  35002. componentUpdated: function componentUpdated (el, binding, vnode) {
  35003. if (vnode.tag === 'select') {
  35004. setSelected(el, binding, vnode.context);
  35005. // in case the options rendered by v-for have changed,
  35006. // it's possible that the value is out-of-sync with the rendered options.
  35007. // detect such cases and filter out values that no longer has a matching
  35008. // option in the DOM.
  35009. var prevOptions = el._vOptions;
  35010. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  35011. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  35012. // trigger change event if
  35013. // no matching option found for at least one value
  35014. var needReset = el.multiple
  35015. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  35016. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  35017. if (needReset) {
  35018. trigger(el, 'change');
  35019. }
  35020. }
  35021. }
  35022. }
  35023. };
  35024. function setSelected (el, binding, vm) {
  35025. actuallySetSelected(el, binding, vm);
  35026. /* istanbul ignore if */
  35027. if (isIE || isEdge) {
  35028. setTimeout(function () {
  35029. actuallySetSelected(el, binding, vm);
  35030. }, 0);
  35031. }
  35032. }
  35033. function actuallySetSelected (el, binding, vm) {
  35034. var value = binding.value;
  35035. var isMultiple = el.multiple;
  35036. if (isMultiple && !Array.isArray(value)) {
  35037. "development" !== 'production' && warn(
  35038. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  35039. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  35040. vm
  35041. );
  35042. return
  35043. }
  35044. var selected, option;
  35045. for (var i = 0, l = el.options.length; i < l; i++) {
  35046. option = el.options[i];
  35047. if (isMultiple) {
  35048. selected = looseIndexOf(value, getValue(option)) > -1;
  35049. if (option.selected !== selected) {
  35050. option.selected = selected;
  35051. }
  35052. } else {
  35053. if (looseEqual(getValue(option), value)) {
  35054. if (el.selectedIndex !== i) {
  35055. el.selectedIndex = i;
  35056. }
  35057. return
  35058. }
  35059. }
  35060. }
  35061. if (!isMultiple) {
  35062. el.selectedIndex = -1;
  35063. }
  35064. }
  35065. function hasNoMatchingOption (value, options) {
  35066. return options.every(function (o) { return !looseEqual(o, value); })
  35067. }
  35068. function getValue (option) {
  35069. return '_value' in option
  35070. ? option._value
  35071. : option.value
  35072. }
  35073. function onCompositionStart (e) {
  35074. e.target.composing = true;
  35075. }
  35076. function onCompositionEnd (e) {
  35077. // prevent triggering an input event for no reason
  35078. if (!e.target.composing) { return }
  35079. e.target.composing = false;
  35080. trigger(e.target, 'input');
  35081. }
  35082. function trigger (el, type) {
  35083. var e = document.createEvent('HTMLEvents');
  35084. e.initEvent(type, true, true);
  35085. el.dispatchEvent(e);
  35086. }
  35087. /* */
  35088. // recursively search for possible transition defined inside the component root
  35089. function locateNode (vnode) {
  35090. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  35091. ? locateNode(vnode.componentInstance._vnode)
  35092. : vnode
  35093. }
  35094. var show = {
  35095. bind: function bind (el, ref, vnode) {
  35096. var value = ref.value;
  35097. vnode = locateNode(vnode);
  35098. var transition$$1 = vnode.data && vnode.data.transition;
  35099. var originalDisplay = el.__vOriginalDisplay =
  35100. el.style.display === 'none' ? '' : el.style.display;
  35101. if (value && transition$$1) {
  35102. vnode.data.show = true;
  35103. enter(vnode, function () {
  35104. el.style.display = originalDisplay;
  35105. });
  35106. } else {
  35107. el.style.display = value ? originalDisplay : 'none';
  35108. }
  35109. },
  35110. update: function update (el, ref, vnode) {
  35111. var value = ref.value;
  35112. var oldValue = ref.oldValue;
  35113. /* istanbul ignore if */
  35114. if (value === oldValue) { return }
  35115. vnode = locateNode(vnode);
  35116. var transition$$1 = vnode.data && vnode.data.transition;
  35117. if (transition$$1) {
  35118. vnode.data.show = true;
  35119. if (value) {
  35120. enter(vnode, function () {
  35121. el.style.display = el.__vOriginalDisplay;
  35122. });
  35123. } else {
  35124. leave(vnode, function () {
  35125. el.style.display = 'none';
  35126. });
  35127. }
  35128. } else {
  35129. el.style.display = value ? el.__vOriginalDisplay : 'none';
  35130. }
  35131. },
  35132. unbind: function unbind (
  35133. el,
  35134. binding,
  35135. vnode,
  35136. oldVnode,
  35137. isDestroy
  35138. ) {
  35139. if (!isDestroy) {
  35140. el.style.display = el.__vOriginalDisplay;
  35141. }
  35142. }
  35143. };
  35144. var platformDirectives = {
  35145. model: directive,
  35146. show: show
  35147. };
  35148. /* */
  35149. // Provides transition support for a single element/component.
  35150. // supports transition mode (out-in / in-out)
  35151. var transitionProps = {
  35152. name: String,
  35153. appear: Boolean,
  35154. css: Boolean,
  35155. mode: String,
  35156. type: String,
  35157. enterClass: String,
  35158. leaveClass: String,
  35159. enterToClass: String,
  35160. leaveToClass: String,
  35161. enterActiveClass: String,
  35162. leaveActiveClass: String,
  35163. appearClass: String,
  35164. appearActiveClass: String,
  35165. appearToClass: String,
  35166. duration: [Number, String, Object]
  35167. };
  35168. // in case the child is also an abstract component, e.g. <keep-alive>
  35169. // we want to recursively retrieve the real component to be rendered
  35170. function getRealChild (vnode) {
  35171. var compOptions = vnode && vnode.componentOptions;
  35172. if (compOptions && compOptions.Ctor.options.abstract) {
  35173. return getRealChild(getFirstComponentChild(compOptions.children))
  35174. } else {
  35175. return vnode
  35176. }
  35177. }
  35178. function extractTransitionData (comp) {
  35179. var data = {};
  35180. var options = comp.$options;
  35181. // props
  35182. for (var key in options.propsData) {
  35183. data[key] = comp[key];
  35184. }
  35185. // events.
  35186. // extract listeners and pass them directly to the transition methods
  35187. var listeners = options._parentListeners;
  35188. for (var key$1 in listeners) {
  35189. data[camelize(key$1)] = listeners[key$1];
  35190. }
  35191. return data
  35192. }
  35193. function placeholder (h, rawChild) {
  35194. if (/\d-keep-alive$/.test(rawChild.tag)) {
  35195. return h('keep-alive', {
  35196. props: rawChild.componentOptions.propsData
  35197. })
  35198. }
  35199. }
  35200. function hasParentTransition (vnode) {
  35201. while ((vnode = vnode.parent)) {
  35202. if (vnode.data.transition) {
  35203. return true
  35204. }
  35205. }
  35206. }
  35207. function isSameChild (child, oldChild) {
  35208. return oldChild.key === child.key && oldChild.tag === child.tag
  35209. }
  35210. var Transition = {
  35211. name: 'transition',
  35212. props: transitionProps,
  35213. abstract: true,
  35214. render: function render (h) {
  35215. var this$1 = this;
  35216. var children = this.$slots.default;
  35217. if (!children) {
  35218. return
  35219. }
  35220. // filter out text nodes (possible whitespaces)
  35221. children = children.filter(function (c) { return c.tag || isAsyncPlaceholder(c); });
  35222. /* istanbul ignore if */
  35223. if (!children.length) {
  35224. return
  35225. }
  35226. // warn multiple elements
  35227. if ("development" !== 'production' && children.length > 1) {
  35228. warn(
  35229. '<transition> can only be used on a single element. Use ' +
  35230. '<transition-group> for lists.',
  35231. this.$parent
  35232. );
  35233. }
  35234. var mode = this.mode;
  35235. // warn invalid mode
  35236. if ("development" !== 'production' &&
  35237. mode && mode !== 'in-out' && mode !== 'out-in'
  35238. ) {
  35239. warn(
  35240. 'invalid <transition> mode: ' + mode,
  35241. this.$parent
  35242. );
  35243. }
  35244. var rawChild = children[0];
  35245. // if this is a component root node and the component's
  35246. // parent container node also has transition, skip.
  35247. if (hasParentTransition(this.$vnode)) {
  35248. return rawChild
  35249. }
  35250. // apply transition data to child
  35251. // use getRealChild() to ignore abstract components e.g. keep-alive
  35252. var child = getRealChild(rawChild);
  35253. /* istanbul ignore if */
  35254. if (!child) {
  35255. return rawChild
  35256. }
  35257. if (this._leaving) {
  35258. return placeholder(h, rawChild)
  35259. }
  35260. // ensure a key that is unique to the vnode type and to this transition
  35261. // component instance. This key will be used to remove pending leaving nodes
  35262. // during entering.
  35263. var id = "__transition-" + (this._uid) + "-";
  35264. child.key = child.key == null
  35265. ? child.isComment
  35266. ? id + 'comment'
  35267. : id + child.tag
  35268. : isPrimitive(child.key)
  35269. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  35270. : child.key;
  35271. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  35272. var oldRawChild = this._vnode;
  35273. var oldChild = getRealChild(oldRawChild);
  35274. // mark v-show
  35275. // so that the transition module can hand over the control to the directive
  35276. if (child.data.directives && child.data.directives.some(function (d) { return d.name === 'show'; })) {
  35277. child.data.show = true;
  35278. }
  35279. if (
  35280. oldChild &&
  35281. oldChild.data &&
  35282. !isSameChild(child, oldChild) &&
  35283. !isAsyncPlaceholder(oldChild) &&
  35284. // #6687 component root is a comment node
  35285. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  35286. ) {
  35287. // replace old child transition data with fresh one
  35288. // important for dynamic transitions!
  35289. var oldData = oldChild.data.transition = extend({}, data);
  35290. // handle transition mode
  35291. if (mode === 'out-in') {
  35292. // return placeholder node and queue update when leave finishes
  35293. this._leaving = true;
  35294. mergeVNodeHook(oldData, 'afterLeave', function () {
  35295. this$1._leaving = false;
  35296. this$1.$forceUpdate();
  35297. });
  35298. return placeholder(h, rawChild)
  35299. } else if (mode === 'in-out') {
  35300. if (isAsyncPlaceholder(child)) {
  35301. return oldRawChild
  35302. }
  35303. var delayedLeave;
  35304. var performLeave = function () { delayedLeave(); };
  35305. mergeVNodeHook(data, 'afterEnter', performLeave);
  35306. mergeVNodeHook(data, 'enterCancelled', performLeave);
  35307. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  35308. }
  35309. }
  35310. return rawChild
  35311. }
  35312. };
  35313. /* */
  35314. // Provides transition support for list items.
  35315. // supports move transitions using the FLIP technique.
  35316. // Because the vdom's children update algorithm is "unstable" - i.e.
  35317. // it doesn't guarantee the relative positioning of removed elements,
  35318. // we force transition-group to update its children into two passes:
  35319. // in the first pass, we remove all nodes that need to be removed,
  35320. // triggering their leaving transition; in the second pass, we insert/move
  35321. // into the final desired state. This way in the second pass removed
  35322. // nodes will remain where they should be.
  35323. var props = extend({
  35324. tag: String,
  35325. moveClass: String
  35326. }, transitionProps);
  35327. delete props.mode;
  35328. var TransitionGroup = {
  35329. props: props,
  35330. render: function render (h) {
  35331. var tag = this.tag || this.$vnode.data.tag || 'span';
  35332. var map = Object.create(null);
  35333. var prevChildren = this.prevChildren = this.children;
  35334. var rawChildren = this.$slots.default || [];
  35335. var children = this.children = [];
  35336. var transitionData = extractTransitionData(this);
  35337. for (var i = 0; i < rawChildren.length; i++) {
  35338. var c = rawChildren[i];
  35339. if (c.tag) {
  35340. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  35341. children.push(c);
  35342. map[c.key] = c
  35343. ;(c.data || (c.data = {})).transition = transitionData;
  35344. } else if (true) {
  35345. var opts = c.componentOptions;
  35346. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  35347. warn(("<transition-group> children must be keyed: <" + name + ">"));
  35348. }
  35349. }
  35350. }
  35351. if (prevChildren) {
  35352. var kept = [];
  35353. var removed = [];
  35354. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  35355. var c$1 = prevChildren[i$1];
  35356. c$1.data.transition = transitionData;
  35357. c$1.data.pos = c$1.elm.getBoundingClientRect();
  35358. if (map[c$1.key]) {
  35359. kept.push(c$1);
  35360. } else {
  35361. removed.push(c$1);
  35362. }
  35363. }
  35364. this.kept = h(tag, null, kept);
  35365. this.removed = removed;
  35366. }
  35367. return h(tag, null, children)
  35368. },
  35369. beforeUpdate: function beforeUpdate () {
  35370. // force removing pass
  35371. this.__patch__(
  35372. this._vnode,
  35373. this.kept,
  35374. false, // hydrating
  35375. true // removeOnly (!important avoids unnecessary moves)
  35376. );
  35377. this._vnode = this.kept;
  35378. },
  35379. updated: function updated () {
  35380. var children = this.prevChildren;
  35381. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  35382. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  35383. return
  35384. }
  35385. // we divide the work into three loops to avoid mixing DOM reads and writes
  35386. // in each iteration - which helps prevent layout thrashing.
  35387. children.forEach(callPendingCbs);
  35388. children.forEach(recordPosition);
  35389. children.forEach(applyTranslation);
  35390. // force reflow to put everything in position
  35391. // assign to this to avoid being removed in tree-shaking
  35392. // $flow-disable-line
  35393. this._reflow = document.body.offsetHeight;
  35394. children.forEach(function (c) {
  35395. if (c.data.moved) {
  35396. var el = c.elm;
  35397. var s = el.style;
  35398. addTransitionClass(el, moveClass);
  35399. s.transform = s.WebkitTransform = s.transitionDuration = '';
  35400. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  35401. if (!e || /transform$/.test(e.propertyName)) {
  35402. el.removeEventListener(transitionEndEvent, cb);
  35403. el._moveCb = null;
  35404. removeTransitionClass(el, moveClass);
  35405. }
  35406. });
  35407. }
  35408. });
  35409. },
  35410. methods: {
  35411. hasMove: function hasMove (el, moveClass) {
  35412. /* istanbul ignore if */
  35413. if (!hasTransition) {
  35414. return false
  35415. }
  35416. /* istanbul ignore if */
  35417. if (this._hasMove) {
  35418. return this._hasMove
  35419. }
  35420. // Detect whether an element with the move class applied has
  35421. // CSS transitions. Since the element may be inside an entering
  35422. // transition at this very moment, we make a clone of it and remove
  35423. // all other transition classes applied to ensure only the move class
  35424. // is applied.
  35425. var clone = el.cloneNode();
  35426. if (el._transitionClasses) {
  35427. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  35428. }
  35429. addClass(clone, moveClass);
  35430. clone.style.display = 'none';
  35431. this.$el.appendChild(clone);
  35432. var info = getTransitionInfo(clone);
  35433. this.$el.removeChild(clone);
  35434. return (this._hasMove = info.hasTransform)
  35435. }
  35436. }
  35437. };
  35438. function callPendingCbs (c) {
  35439. /* istanbul ignore if */
  35440. if (c.elm._moveCb) {
  35441. c.elm._moveCb();
  35442. }
  35443. /* istanbul ignore if */
  35444. if (c.elm._enterCb) {
  35445. c.elm._enterCb();
  35446. }
  35447. }
  35448. function recordPosition (c) {
  35449. c.data.newPos = c.elm.getBoundingClientRect();
  35450. }
  35451. function applyTranslation (c) {
  35452. var oldPos = c.data.pos;
  35453. var newPos = c.data.newPos;
  35454. var dx = oldPos.left - newPos.left;
  35455. var dy = oldPos.top - newPos.top;
  35456. if (dx || dy) {
  35457. c.data.moved = true;
  35458. var s = c.elm.style;
  35459. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  35460. s.transitionDuration = '0s';
  35461. }
  35462. }
  35463. var platformComponents = {
  35464. Transition: Transition,
  35465. TransitionGroup: TransitionGroup
  35466. };
  35467. /* */
  35468. // install platform specific utils
  35469. Vue$3.config.mustUseProp = mustUseProp;
  35470. Vue$3.config.isReservedTag = isReservedTag;
  35471. Vue$3.config.isReservedAttr = isReservedAttr;
  35472. Vue$3.config.getTagNamespace = getTagNamespace;
  35473. Vue$3.config.isUnknownElement = isUnknownElement;
  35474. // install platform runtime directives & components
  35475. extend(Vue$3.options.directives, platformDirectives);
  35476. extend(Vue$3.options.components, platformComponents);
  35477. // install platform patch function
  35478. Vue$3.prototype.__patch__ = inBrowser ? patch : noop;
  35479. // public mount method
  35480. Vue$3.prototype.$mount = function (
  35481. el,
  35482. hydrating
  35483. ) {
  35484. el = el && inBrowser ? query(el) : undefined;
  35485. return mountComponent(this, el, hydrating)
  35486. };
  35487. // devtools global hook
  35488. /* istanbul ignore next */
  35489. Vue$3.nextTick(function () {
  35490. if (config.devtools) {
  35491. if (devtools) {
  35492. devtools.emit('init', Vue$3);
  35493. } else if ("development" !== 'production' && isChrome) {
  35494. console[console.info ? 'info' : 'log'](
  35495. 'Download the Vue Devtools extension for a better development experience:\n' +
  35496. 'https://github.com/vuejs/vue-devtools'
  35497. );
  35498. }
  35499. }
  35500. if ("development" !== 'production' &&
  35501. config.productionTip !== false &&
  35502. inBrowser && typeof console !== 'undefined'
  35503. ) {
  35504. console[console.info ? 'info' : 'log'](
  35505. "You are running Vue in development mode.\n" +
  35506. "Make sure to turn on production mode when deploying for production.\n" +
  35507. "See more tips at https://vuejs.org/guide/deployment.html"
  35508. );
  35509. }
  35510. }, 0);
  35511. /* */
  35512. var defaultTagRE = /\{\{((?:.|\n)+?)\}\}/g;
  35513. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  35514. var buildRegex = cached(function (delimiters) {
  35515. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  35516. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  35517. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  35518. });
  35519. function parseText (
  35520. text,
  35521. delimiters
  35522. ) {
  35523. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  35524. if (!tagRE.test(text)) {
  35525. return
  35526. }
  35527. var tokens = [];
  35528. var rawTokens = [];
  35529. var lastIndex = tagRE.lastIndex = 0;
  35530. var match, index, tokenValue;
  35531. while ((match = tagRE.exec(text))) {
  35532. index = match.index;
  35533. // push text token
  35534. if (index > lastIndex) {
  35535. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  35536. tokens.push(JSON.stringify(tokenValue));
  35537. }
  35538. // tag token
  35539. var exp = parseFilters(match[1].trim());
  35540. tokens.push(("_s(" + exp + ")"));
  35541. rawTokens.push({ '@binding': exp });
  35542. lastIndex = index + match[0].length;
  35543. }
  35544. if (lastIndex < text.length) {
  35545. rawTokens.push(tokenValue = text.slice(lastIndex));
  35546. tokens.push(JSON.stringify(tokenValue));
  35547. }
  35548. return {
  35549. expression: tokens.join('+'),
  35550. tokens: rawTokens
  35551. }
  35552. }
  35553. /* */
  35554. function transformNode (el, options) {
  35555. var warn = options.warn || baseWarn;
  35556. var staticClass = getAndRemoveAttr(el, 'class');
  35557. if ("development" !== 'production' && staticClass) {
  35558. var res = parseText(staticClass, options.delimiters);
  35559. if (res) {
  35560. warn(
  35561. "class=\"" + staticClass + "\": " +
  35562. 'Interpolation inside attributes has been removed. ' +
  35563. 'Use v-bind or the colon shorthand instead. For example, ' +
  35564. 'instead of <div class="{{ val }}">, use <div :class="val">.'
  35565. );
  35566. }
  35567. }
  35568. if (staticClass) {
  35569. el.staticClass = JSON.stringify(staticClass);
  35570. }
  35571. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  35572. if (classBinding) {
  35573. el.classBinding = classBinding;
  35574. }
  35575. }
  35576. function genData (el) {
  35577. var data = '';
  35578. if (el.staticClass) {
  35579. data += "staticClass:" + (el.staticClass) + ",";
  35580. }
  35581. if (el.classBinding) {
  35582. data += "class:" + (el.classBinding) + ",";
  35583. }
  35584. return data
  35585. }
  35586. var klass$1 = {
  35587. staticKeys: ['staticClass'],
  35588. transformNode: transformNode,
  35589. genData: genData
  35590. };
  35591. /* */
  35592. function transformNode$1 (el, options) {
  35593. var warn = options.warn || baseWarn;
  35594. var staticStyle = getAndRemoveAttr(el, 'style');
  35595. if (staticStyle) {
  35596. /* istanbul ignore if */
  35597. if (true) {
  35598. var res = parseText(staticStyle, options.delimiters);
  35599. if (res) {
  35600. warn(
  35601. "style=\"" + staticStyle + "\": " +
  35602. 'Interpolation inside attributes has been removed. ' +
  35603. 'Use v-bind or the colon shorthand instead. For example, ' +
  35604. 'instead of <div style="{{ val }}">, use <div :style="val">.'
  35605. );
  35606. }
  35607. }
  35608. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  35609. }
  35610. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  35611. if (styleBinding) {
  35612. el.styleBinding = styleBinding;
  35613. }
  35614. }
  35615. function genData$1 (el) {
  35616. var data = '';
  35617. if (el.staticStyle) {
  35618. data += "staticStyle:" + (el.staticStyle) + ",";
  35619. }
  35620. if (el.styleBinding) {
  35621. data += "style:(" + (el.styleBinding) + "),";
  35622. }
  35623. return data
  35624. }
  35625. var style$1 = {
  35626. staticKeys: ['staticStyle'],
  35627. transformNode: transformNode$1,
  35628. genData: genData$1
  35629. };
  35630. /* */
  35631. var decoder;
  35632. var he = {
  35633. decode: function decode (html) {
  35634. decoder = decoder || document.createElement('div');
  35635. decoder.innerHTML = html;
  35636. return decoder.textContent
  35637. }
  35638. };
  35639. /* */
  35640. var isUnaryTag = makeMap(
  35641. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  35642. 'link,meta,param,source,track,wbr'
  35643. );
  35644. // Elements that you can, intentionally, leave open
  35645. // (and which close themselves)
  35646. var canBeLeftOpenTag = makeMap(
  35647. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  35648. );
  35649. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  35650. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  35651. var isNonPhrasingTag = makeMap(
  35652. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  35653. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  35654. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  35655. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  35656. 'title,tr,track'
  35657. );
  35658. /**
  35659. * Not type-checking this file because it's mostly vendor code.
  35660. */
  35661. /*!
  35662. * HTML Parser By John Resig (ejohn.org)
  35663. * Modified by Juriy "kangax" Zaytsev
  35664. * Original code by Erik Arvidsson, Mozilla Public License
  35665. * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
  35666. */
  35667. // Regular Expressions for parsing tags and attributes
  35668. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  35669. // could use https://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-QName
  35670. // but for Vue templates we can enforce a simple charset
  35671. var ncname = '[a-zA-Z_][\\w\\-\\.]*';
  35672. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  35673. var startTagOpen = new RegExp(("^<" + qnameCapture));
  35674. var startTagClose = /^\s*(\/?)>/;
  35675. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  35676. var doctype = /^<!DOCTYPE [^>]+>/i;
  35677. var comment = /^<!--/;
  35678. var conditionalComment = /^<!\[/;
  35679. var IS_REGEX_CAPTURING_BROKEN = false;
  35680. 'x'.replace(/x(.)?/g, function (m, g) {
  35681. IS_REGEX_CAPTURING_BROKEN = g === '';
  35682. });
  35683. // Special Elements (can contain anything)
  35684. var isPlainTextElement = makeMap('script,style,textarea', true);
  35685. var reCache = {};
  35686. var decodingMap = {
  35687. '&lt;': '<',
  35688. '&gt;': '>',
  35689. '&quot;': '"',
  35690. '&amp;': '&',
  35691. '&#10;': '\n',
  35692. '&#9;': '\t'
  35693. };
  35694. var encodedAttr = /&(?:lt|gt|quot|amp);/g;
  35695. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#10|#9);/g;
  35696. // #5992
  35697. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  35698. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  35699. function decodeAttr (value, shouldDecodeNewlines) {
  35700. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  35701. return value.replace(re, function (match) { return decodingMap[match]; })
  35702. }
  35703. function parseHTML (html, options) {
  35704. var stack = [];
  35705. var expectHTML = options.expectHTML;
  35706. var isUnaryTag$$1 = options.isUnaryTag || no;
  35707. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  35708. var index = 0;
  35709. var last, lastTag;
  35710. while (html) {
  35711. last = html;
  35712. // Make sure we're not in a plaintext content element like script/style
  35713. if (!lastTag || !isPlainTextElement(lastTag)) {
  35714. var textEnd = html.indexOf('<');
  35715. if (textEnd === 0) {
  35716. // Comment:
  35717. if (comment.test(html)) {
  35718. var commentEnd = html.indexOf('-->');
  35719. if (commentEnd >= 0) {
  35720. if (options.shouldKeepComment) {
  35721. options.comment(html.substring(4, commentEnd));
  35722. }
  35723. advance(commentEnd + 3);
  35724. continue
  35725. }
  35726. }
  35727. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  35728. if (conditionalComment.test(html)) {
  35729. var conditionalEnd = html.indexOf(']>');
  35730. if (conditionalEnd >= 0) {
  35731. advance(conditionalEnd + 2);
  35732. continue
  35733. }
  35734. }
  35735. // Doctype:
  35736. var doctypeMatch = html.match(doctype);
  35737. if (doctypeMatch) {
  35738. advance(doctypeMatch[0].length);
  35739. continue
  35740. }
  35741. // End tag:
  35742. var endTagMatch = html.match(endTag);
  35743. if (endTagMatch) {
  35744. var curIndex = index;
  35745. advance(endTagMatch[0].length);
  35746. parseEndTag(endTagMatch[1], curIndex, index);
  35747. continue
  35748. }
  35749. // Start tag:
  35750. var startTagMatch = parseStartTag();
  35751. if (startTagMatch) {
  35752. handleStartTag(startTagMatch);
  35753. if (shouldIgnoreFirstNewline(lastTag, html)) {
  35754. advance(1);
  35755. }
  35756. continue
  35757. }
  35758. }
  35759. var text = (void 0), rest = (void 0), next = (void 0);
  35760. if (textEnd >= 0) {
  35761. rest = html.slice(textEnd);
  35762. while (
  35763. !endTag.test(rest) &&
  35764. !startTagOpen.test(rest) &&
  35765. !comment.test(rest) &&
  35766. !conditionalComment.test(rest)
  35767. ) {
  35768. // < in plain text, be forgiving and treat it as text
  35769. next = rest.indexOf('<', 1);
  35770. if (next < 0) { break }
  35771. textEnd += next;
  35772. rest = html.slice(textEnd);
  35773. }
  35774. text = html.substring(0, textEnd);
  35775. advance(textEnd);
  35776. }
  35777. if (textEnd < 0) {
  35778. text = html;
  35779. html = '';
  35780. }
  35781. if (options.chars && text) {
  35782. options.chars(text);
  35783. }
  35784. } else {
  35785. var endTagLength = 0;
  35786. var stackedTag = lastTag.toLowerCase();
  35787. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  35788. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  35789. endTagLength = endTag.length;
  35790. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  35791. text = text
  35792. .replace(/<!--([\s\S]*?)-->/g, '$1')
  35793. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  35794. }
  35795. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  35796. text = text.slice(1);
  35797. }
  35798. if (options.chars) {
  35799. options.chars(text);
  35800. }
  35801. return ''
  35802. });
  35803. index += html.length - rest$1.length;
  35804. html = rest$1;
  35805. parseEndTag(stackedTag, index - endTagLength, index);
  35806. }
  35807. if (html === last) {
  35808. options.chars && options.chars(html);
  35809. if ("development" !== 'production' && !stack.length && options.warn) {
  35810. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""));
  35811. }
  35812. break
  35813. }
  35814. }
  35815. // Clean up any remaining tags
  35816. parseEndTag();
  35817. function advance (n) {
  35818. index += n;
  35819. html = html.substring(n);
  35820. }
  35821. function parseStartTag () {
  35822. var start = html.match(startTagOpen);
  35823. if (start) {
  35824. var match = {
  35825. tagName: start[1],
  35826. attrs: [],
  35827. start: index
  35828. };
  35829. advance(start[0].length);
  35830. var end, attr;
  35831. while (!(end = html.match(startTagClose)) && (attr = html.match(attribute))) {
  35832. advance(attr[0].length);
  35833. match.attrs.push(attr);
  35834. }
  35835. if (end) {
  35836. match.unarySlash = end[1];
  35837. advance(end[0].length);
  35838. match.end = index;
  35839. return match
  35840. }
  35841. }
  35842. }
  35843. function handleStartTag (match) {
  35844. var tagName = match.tagName;
  35845. var unarySlash = match.unarySlash;
  35846. if (expectHTML) {
  35847. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  35848. parseEndTag(lastTag);
  35849. }
  35850. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  35851. parseEndTag(tagName);
  35852. }
  35853. }
  35854. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  35855. var l = match.attrs.length;
  35856. var attrs = new Array(l);
  35857. for (var i = 0; i < l; i++) {
  35858. var args = match.attrs[i];
  35859. // hackish work around FF bug https://bugzilla.mozilla.org/show_bug.cgi?id=369778
  35860. if (IS_REGEX_CAPTURING_BROKEN && args[0].indexOf('""') === -1) {
  35861. if (args[3] === '') { delete args[3]; }
  35862. if (args[4] === '') { delete args[4]; }
  35863. if (args[5] === '') { delete args[5]; }
  35864. }
  35865. var value = args[3] || args[4] || args[5] || '';
  35866. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  35867. ? options.shouldDecodeNewlinesForHref
  35868. : options.shouldDecodeNewlines;
  35869. attrs[i] = {
  35870. name: args[1],
  35871. value: decodeAttr(value, shouldDecodeNewlines)
  35872. };
  35873. }
  35874. if (!unary) {
  35875. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs });
  35876. lastTag = tagName;
  35877. }
  35878. if (options.start) {
  35879. options.start(tagName, attrs, unary, match.start, match.end);
  35880. }
  35881. }
  35882. function parseEndTag (tagName, start, end) {
  35883. var pos, lowerCasedTagName;
  35884. if (start == null) { start = index; }
  35885. if (end == null) { end = index; }
  35886. if (tagName) {
  35887. lowerCasedTagName = tagName.toLowerCase();
  35888. }
  35889. // Find the closest opened tag of the same type
  35890. if (tagName) {
  35891. for (pos = stack.length - 1; pos >= 0; pos--) {
  35892. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  35893. break
  35894. }
  35895. }
  35896. } else {
  35897. // If no tag name is provided, clean shop
  35898. pos = 0;
  35899. }
  35900. if (pos >= 0) {
  35901. // Close all the open elements, up the stack
  35902. for (var i = stack.length - 1; i >= pos; i--) {
  35903. if ("development" !== 'production' &&
  35904. (i > pos || !tagName) &&
  35905. options.warn
  35906. ) {
  35907. options.warn(
  35908. ("tag <" + (stack[i].tag) + "> has no matching end tag.")
  35909. );
  35910. }
  35911. if (options.end) {
  35912. options.end(stack[i].tag, start, end);
  35913. }
  35914. }
  35915. // Remove the open elements from the stack
  35916. stack.length = pos;
  35917. lastTag = pos && stack[pos - 1].tag;
  35918. } else if (lowerCasedTagName === 'br') {
  35919. if (options.start) {
  35920. options.start(tagName, [], true, start, end);
  35921. }
  35922. } else if (lowerCasedTagName === 'p') {
  35923. if (options.start) {
  35924. options.start(tagName, [], false, start, end);
  35925. }
  35926. if (options.end) {
  35927. options.end(tagName, start, end);
  35928. }
  35929. }
  35930. }
  35931. }
  35932. /* */
  35933. var onRE = /^@|^v-on:/;
  35934. var dirRE = /^v-|^@|^:/;
  35935. var forAliasRE = /(.*?)\s+(?:in|of)\s+(.*)/;
  35936. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  35937. var stripParensRE = /^\(|\)$/g;
  35938. var argRE = /:(.*)$/;
  35939. var bindRE = /^:|^v-bind:/;
  35940. var modifierRE = /\.[^.]+/g;
  35941. var decodeHTMLCached = cached(he.decode);
  35942. // configurable state
  35943. var warn$2;
  35944. var delimiters;
  35945. var transforms;
  35946. var preTransforms;
  35947. var postTransforms;
  35948. var platformIsPreTag;
  35949. var platformMustUseProp;
  35950. var platformGetTagNamespace;
  35951. function createASTElement (
  35952. tag,
  35953. attrs,
  35954. parent
  35955. ) {
  35956. return {
  35957. type: 1,
  35958. tag: tag,
  35959. attrsList: attrs,
  35960. attrsMap: makeAttrsMap(attrs),
  35961. parent: parent,
  35962. children: []
  35963. }
  35964. }
  35965. /**
  35966. * Convert HTML string to AST.
  35967. */
  35968. function parse (
  35969. template,
  35970. options
  35971. ) {
  35972. warn$2 = options.warn || baseWarn;
  35973. platformIsPreTag = options.isPreTag || no;
  35974. platformMustUseProp = options.mustUseProp || no;
  35975. platformGetTagNamespace = options.getTagNamespace || no;
  35976. transforms = pluckModuleFunction(options.modules, 'transformNode');
  35977. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  35978. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  35979. delimiters = options.delimiters;
  35980. var stack = [];
  35981. var preserveWhitespace = options.preserveWhitespace !== false;
  35982. var root;
  35983. var currentParent;
  35984. var inVPre = false;
  35985. var inPre = false;
  35986. var warned = false;
  35987. function warnOnce (msg) {
  35988. if (!warned) {
  35989. warned = true;
  35990. warn$2(msg);
  35991. }
  35992. }
  35993. function closeElement (element) {
  35994. // check pre state
  35995. if (element.pre) {
  35996. inVPre = false;
  35997. }
  35998. if (platformIsPreTag(element.tag)) {
  35999. inPre = false;
  36000. }
  36001. // apply post-transforms
  36002. for (var i = 0; i < postTransforms.length; i++) {
  36003. postTransforms[i](element, options);
  36004. }
  36005. }
  36006. parseHTML(template, {
  36007. warn: warn$2,
  36008. expectHTML: options.expectHTML,
  36009. isUnaryTag: options.isUnaryTag,
  36010. canBeLeftOpenTag: options.canBeLeftOpenTag,
  36011. shouldDecodeNewlines: options.shouldDecodeNewlines,
  36012. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  36013. shouldKeepComment: options.comments,
  36014. start: function start (tag, attrs, unary) {
  36015. // check namespace.
  36016. // inherit parent ns if there is one
  36017. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  36018. // handle IE svg bug
  36019. /* istanbul ignore if */
  36020. if (isIE && ns === 'svg') {
  36021. attrs = guardIESVGBug(attrs);
  36022. }
  36023. var element = createASTElement(tag, attrs, currentParent);
  36024. if (ns) {
  36025. element.ns = ns;
  36026. }
  36027. if (isForbiddenTag(element) && !isServerRendering()) {
  36028. element.forbidden = true;
  36029. "development" !== 'production' && warn$2(
  36030. 'Templates should only be responsible for mapping the state to the ' +
  36031. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  36032. "<" + tag + ">" + ', as they will not be parsed.'
  36033. );
  36034. }
  36035. // apply pre-transforms
  36036. for (var i = 0; i < preTransforms.length; i++) {
  36037. element = preTransforms[i](element, options) || element;
  36038. }
  36039. if (!inVPre) {
  36040. processPre(element);
  36041. if (element.pre) {
  36042. inVPre = true;
  36043. }
  36044. }
  36045. if (platformIsPreTag(element.tag)) {
  36046. inPre = true;
  36047. }
  36048. if (inVPre) {
  36049. processRawAttrs(element);
  36050. } else if (!element.processed) {
  36051. // structural directives
  36052. processFor(element);
  36053. processIf(element);
  36054. processOnce(element);
  36055. // element-scope stuff
  36056. processElement(element, options);
  36057. }
  36058. function checkRootConstraints (el) {
  36059. if (true) {
  36060. if (el.tag === 'slot' || el.tag === 'template') {
  36061. warnOnce(
  36062. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  36063. 'contain multiple nodes.'
  36064. );
  36065. }
  36066. if (el.attrsMap.hasOwnProperty('v-for')) {
  36067. warnOnce(
  36068. 'Cannot use v-for on stateful component root element because ' +
  36069. 'it renders multiple elements.'
  36070. );
  36071. }
  36072. }
  36073. }
  36074. // tree management
  36075. if (!root) {
  36076. root = element;
  36077. checkRootConstraints(root);
  36078. } else if (!stack.length) {
  36079. // allow root elements with v-if, v-else-if and v-else
  36080. if (root.if && (element.elseif || element.else)) {
  36081. checkRootConstraints(element);
  36082. addIfCondition(root, {
  36083. exp: element.elseif,
  36084. block: element
  36085. });
  36086. } else if (true) {
  36087. warnOnce(
  36088. "Component template should contain exactly one root element. " +
  36089. "If you are using v-if on multiple elements, " +
  36090. "use v-else-if to chain them instead."
  36091. );
  36092. }
  36093. }
  36094. if (currentParent && !element.forbidden) {
  36095. if (element.elseif || element.else) {
  36096. processIfConditions(element, currentParent);
  36097. } else if (element.slotScope) { // scoped slot
  36098. currentParent.plain = false;
  36099. var name = element.slotTarget || '"default"';(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  36100. } else {
  36101. currentParent.children.push(element);
  36102. element.parent = currentParent;
  36103. }
  36104. }
  36105. if (!unary) {
  36106. currentParent = element;
  36107. stack.push(element);
  36108. } else {
  36109. closeElement(element);
  36110. }
  36111. },
  36112. end: function end () {
  36113. // remove trailing whitespace
  36114. var element = stack[stack.length - 1];
  36115. var lastNode = element.children[element.children.length - 1];
  36116. if (lastNode && lastNode.type === 3 && lastNode.text === ' ' && !inPre) {
  36117. element.children.pop();
  36118. }
  36119. // pop stack
  36120. stack.length -= 1;
  36121. currentParent = stack[stack.length - 1];
  36122. closeElement(element);
  36123. },
  36124. chars: function chars (text) {
  36125. if (!currentParent) {
  36126. if (true) {
  36127. if (text === template) {
  36128. warnOnce(
  36129. 'Component template requires a root element, rather than just text.'
  36130. );
  36131. } else if ((text = text.trim())) {
  36132. warnOnce(
  36133. ("text \"" + text + "\" outside root element will be ignored.")
  36134. );
  36135. }
  36136. }
  36137. return
  36138. }
  36139. // IE textarea placeholder bug
  36140. /* istanbul ignore if */
  36141. if (isIE &&
  36142. currentParent.tag === 'textarea' &&
  36143. currentParent.attrsMap.placeholder === text
  36144. ) {
  36145. return
  36146. }
  36147. var children = currentParent.children;
  36148. text = inPre || text.trim()
  36149. ? isTextTag(currentParent) ? text : decodeHTMLCached(text)
  36150. // only preserve whitespace if its not right after a starting tag
  36151. : preserveWhitespace && children.length ? ' ' : '';
  36152. if (text) {
  36153. var res;
  36154. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  36155. children.push({
  36156. type: 2,
  36157. expression: res.expression,
  36158. tokens: res.tokens,
  36159. text: text
  36160. });
  36161. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  36162. children.push({
  36163. type: 3,
  36164. text: text
  36165. });
  36166. }
  36167. }
  36168. },
  36169. comment: function comment (text) {
  36170. currentParent.children.push({
  36171. type: 3,
  36172. text: text,
  36173. isComment: true
  36174. });
  36175. }
  36176. });
  36177. return root
  36178. }
  36179. function processPre (el) {
  36180. if (getAndRemoveAttr(el, 'v-pre') != null) {
  36181. el.pre = true;
  36182. }
  36183. }
  36184. function processRawAttrs (el) {
  36185. var l = el.attrsList.length;
  36186. if (l) {
  36187. var attrs = el.attrs = new Array(l);
  36188. for (var i = 0; i < l; i++) {
  36189. attrs[i] = {
  36190. name: el.attrsList[i].name,
  36191. value: JSON.stringify(el.attrsList[i].value)
  36192. };
  36193. }
  36194. } else if (!el.pre) {
  36195. // non root node in pre blocks with no attributes
  36196. el.plain = true;
  36197. }
  36198. }
  36199. function processElement (element, options) {
  36200. processKey(element);
  36201. // determine whether this is a plain element after
  36202. // removing structural attributes
  36203. element.plain = !element.key && !element.attrsList.length;
  36204. processRef(element);
  36205. processSlot(element);
  36206. processComponent(element);
  36207. for (var i = 0; i < transforms.length; i++) {
  36208. element = transforms[i](element, options) || element;
  36209. }
  36210. processAttrs(element);
  36211. }
  36212. function processKey (el) {
  36213. var exp = getBindingAttr(el, 'key');
  36214. if (exp) {
  36215. if ("development" !== 'production' && el.tag === 'template') {
  36216. warn$2("<template> cannot be keyed. Place the key on real elements instead.");
  36217. }
  36218. el.key = exp;
  36219. }
  36220. }
  36221. function processRef (el) {
  36222. var ref = getBindingAttr(el, 'ref');
  36223. if (ref) {
  36224. el.ref = ref;
  36225. el.refInFor = checkInFor(el);
  36226. }
  36227. }
  36228. function processFor (el) {
  36229. var exp;
  36230. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  36231. var res = parseFor(exp);
  36232. if (res) {
  36233. extend(el, res);
  36234. } else if (true) {
  36235. warn$2(
  36236. ("Invalid v-for expression: " + exp)
  36237. );
  36238. }
  36239. }
  36240. }
  36241. function parseFor (exp) {
  36242. var inMatch = exp.match(forAliasRE);
  36243. if (!inMatch) { return }
  36244. var res = {};
  36245. res.for = inMatch[2].trim();
  36246. var alias = inMatch[1].trim().replace(stripParensRE, '');
  36247. var iteratorMatch = alias.match(forIteratorRE);
  36248. if (iteratorMatch) {
  36249. res.alias = alias.replace(forIteratorRE, '');
  36250. res.iterator1 = iteratorMatch[1].trim();
  36251. if (iteratorMatch[2]) {
  36252. res.iterator2 = iteratorMatch[2].trim();
  36253. }
  36254. } else {
  36255. res.alias = alias;
  36256. }
  36257. return res
  36258. }
  36259. function processIf (el) {
  36260. var exp = getAndRemoveAttr(el, 'v-if');
  36261. if (exp) {
  36262. el.if = exp;
  36263. addIfCondition(el, {
  36264. exp: exp,
  36265. block: el
  36266. });
  36267. } else {
  36268. if (getAndRemoveAttr(el, 'v-else') != null) {
  36269. el.else = true;
  36270. }
  36271. var elseif = getAndRemoveAttr(el, 'v-else-if');
  36272. if (elseif) {
  36273. el.elseif = elseif;
  36274. }
  36275. }
  36276. }
  36277. function processIfConditions (el, parent) {
  36278. var prev = findPrevElement(parent.children);
  36279. if (prev && prev.if) {
  36280. addIfCondition(prev, {
  36281. exp: el.elseif,
  36282. block: el
  36283. });
  36284. } else if (true) {
  36285. warn$2(
  36286. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  36287. "used on element <" + (el.tag) + "> without corresponding v-if."
  36288. );
  36289. }
  36290. }
  36291. function findPrevElement (children) {
  36292. var i = children.length;
  36293. while (i--) {
  36294. if (children[i].type === 1) {
  36295. return children[i]
  36296. } else {
  36297. if ("development" !== 'production' && children[i].text !== ' ') {
  36298. warn$2(
  36299. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  36300. "will be ignored."
  36301. );
  36302. }
  36303. children.pop();
  36304. }
  36305. }
  36306. }
  36307. function addIfCondition (el, condition) {
  36308. if (!el.ifConditions) {
  36309. el.ifConditions = [];
  36310. }
  36311. el.ifConditions.push(condition);
  36312. }
  36313. function processOnce (el) {
  36314. var once$$1 = getAndRemoveAttr(el, 'v-once');
  36315. if (once$$1 != null) {
  36316. el.once = true;
  36317. }
  36318. }
  36319. function processSlot (el) {
  36320. if (el.tag === 'slot') {
  36321. el.slotName = getBindingAttr(el, 'name');
  36322. if ("development" !== 'production' && el.key) {
  36323. warn$2(
  36324. "`key` does not work on <slot> because slots are abstract outlets " +
  36325. "and can possibly expand into multiple elements. " +
  36326. "Use the key on a wrapping element instead."
  36327. );
  36328. }
  36329. } else {
  36330. var slotScope;
  36331. if (el.tag === 'template') {
  36332. slotScope = getAndRemoveAttr(el, 'scope');
  36333. /* istanbul ignore if */
  36334. if ("development" !== 'production' && slotScope) {
  36335. warn$2(
  36336. "the \"scope\" attribute for scoped slots have been deprecated and " +
  36337. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  36338. "can also be used on plain elements in addition to <template> to " +
  36339. "denote scoped slots.",
  36340. true
  36341. );
  36342. }
  36343. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  36344. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  36345. /* istanbul ignore if */
  36346. if ("development" !== 'production' && el.attrsMap['v-for']) {
  36347. warn$2(
  36348. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  36349. "(v-for takes higher priority). Use a wrapper <template> for the " +
  36350. "scoped slot to make it clearer.",
  36351. true
  36352. );
  36353. }
  36354. el.slotScope = slotScope;
  36355. }
  36356. var slotTarget = getBindingAttr(el, 'slot');
  36357. if (slotTarget) {
  36358. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  36359. // preserve slot as an attribute for native shadow DOM compat
  36360. // only for non-scoped slots.
  36361. if (el.tag !== 'template' && !el.slotScope) {
  36362. addAttr(el, 'slot', slotTarget);
  36363. }
  36364. }
  36365. }
  36366. }
  36367. function processComponent (el) {
  36368. var binding;
  36369. if ((binding = getBindingAttr(el, 'is'))) {
  36370. el.component = binding;
  36371. }
  36372. if (getAndRemoveAttr(el, 'inline-template') != null) {
  36373. el.inlineTemplate = true;
  36374. }
  36375. }
  36376. function processAttrs (el) {
  36377. var list = el.attrsList;
  36378. var i, l, name, rawName, value, modifiers, isProp;
  36379. for (i = 0, l = list.length; i < l; i++) {
  36380. name = rawName = list[i].name;
  36381. value = list[i].value;
  36382. if (dirRE.test(name)) {
  36383. // mark element as dynamic
  36384. el.hasBindings = true;
  36385. // modifiers
  36386. modifiers = parseModifiers(name);
  36387. if (modifiers) {
  36388. name = name.replace(modifierRE, '');
  36389. }
  36390. if (bindRE.test(name)) { // v-bind
  36391. name = name.replace(bindRE, '');
  36392. value = parseFilters(value);
  36393. isProp = false;
  36394. if (modifiers) {
  36395. if (modifiers.prop) {
  36396. isProp = true;
  36397. name = camelize(name);
  36398. if (name === 'innerHtml') { name = 'innerHTML'; }
  36399. }
  36400. if (modifiers.camel) {
  36401. name = camelize(name);
  36402. }
  36403. if (modifiers.sync) {
  36404. addHandler(
  36405. el,
  36406. ("update:" + (camelize(name))),
  36407. genAssignmentCode(value, "$event")
  36408. );
  36409. }
  36410. }
  36411. if (isProp || (
  36412. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  36413. )) {
  36414. addProp(el, name, value);
  36415. } else {
  36416. addAttr(el, name, value);
  36417. }
  36418. } else if (onRE.test(name)) { // v-on
  36419. name = name.replace(onRE, '');
  36420. addHandler(el, name, value, modifiers, false, warn$2);
  36421. } else { // normal directives
  36422. name = name.replace(dirRE, '');
  36423. // parse arg
  36424. var argMatch = name.match(argRE);
  36425. var arg = argMatch && argMatch[1];
  36426. if (arg) {
  36427. name = name.slice(0, -(arg.length + 1));
  36428. }
  36429. addDirective(el, name, rawName, value, arg, modifiers);
  36430. if ("development" !== 'production' && name === 'model') {
  36431. checkForAliasModel(el, value);
  36432. }
  36433. }
  36434. } else {
  36435. // literal attribute
  36436. if (true) {
  36437. var res = parseText(value, delimiters);
  36438. if (res) {
  36439. warn$2(
  36440. name + "=\"" + value + "\": " +
  36441. 'Interpolation inside attributes has been removed. ' +
  36442. 'Use v-bind or the colon shorthand instead. For example, ' +
  36443. 'instead of <div id="{{ val }}">, use <div :id="val">.'
  36444. );
  36445. }
  36446. }
  36447. addAttr(el, name, JSON.stringify(value));
  36448. // #6887 firefox doesn't update muted state if set via attribute
  36449. // even immediately after element creation
  36450. if (!el.component &&
  36451. name === 'muted' &&
  36452. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  36453. addProp(el, name, 'true');
  36454. }
  36455. }
  36456. }
  36457. }
  36458. function checkInFor (el) {
  36459. var parent = el;
  36460. while (parent) {
  36461. if (parent.for !== undefined) {
  36462. return true
  36463. }
  36464. parent = parent.parent;
  36465. }
  36466. return false
  36467. }
  36468. function parseModifiers (name) {
  36469. var match = name.match(modifierRE);
  36470. if (match) {
  36471. var ret = {};
  36472. match.forEach(function (m) { ret[m.slice(1)] = true; });
  36473. return ret
  36474. }
  36475. }
  36476. function makeAttrsMap (attrs) {
  36477. var map = {};
  36478. for (var i = 0, l = attrs.length; i < l; i++) {
  36479. if (
  36480. "development" !== 'production' &&
  36481. map[attrs[i].name] && !isIE && !isEdge
  36482. ) {
  36483. warn$2('duplicate attribute: ' + attrs[i].name);
  36484. }
  36485. map[attrs[i].name] = attrs[i].value;
  36486. }
  36487. return map
  36488. }
  36489. // for script (e.g. type="x/template") or style, do not decode content
  36490. function isTextTag (el) {
  36491. return el.tag === 'script' || el.tag === 'style'
  36492. }
  36493. function isForbiddenTag (el) {
  36494. return (
  36495. el.tag === 'style' ||
  36496. (el.tag === 'script' && (
  36497. !el.attrsMap.type ||
  36498. el.attrsMap.type === 'text/javascript'
  36499. ))
  36500. )
  36501. }
  36502. var ieNSBug = /^xmlns:NS\d+/;
  36503. var ieNSPrefix = /^NS\d+:/;
  36504. /* istanbul ignore next */
  36505. function guardIESVGBug (attrs) {
  36506. var res = [];
  36507. for (var i = 0; i < attrs.length; i++) {
  36508. var attr = attrs[i];
  36509. if (!ieNSBug.test(attr.name)) {
  36510. attr.name = attr.name.replace(ieNSPrefix, '');
  36511. res.push(attr);
  36512. }
  36513. }
  36514. return res
  36515. }
  36516. function checkForAliasModel (el, value) {
  36517. var _el = el;
  36518. while (_el) {
  36519. if (_el.for && _el.alias === value) {
  36520. warn$2(
  36521. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  36522. "You are binding v-model directly to a v-for iteration alias. " +
  36523. "This will not be able to modify the v-for source array because " +
  36524. "writing to the alias is like modifying a function local variable. " +
  36525. "Consider using an array of objects and use v-model on an object property instead."
  36526. );
  36527. }
  36528. _el = _el.parent;
  36529. }
  36530. }
  36531. /* */
  36532. /**
  36533. * Expand input[v-model] with dyanmic type bindings into v-if-else chains
  36534. * Turn this:
  36535. * <input v-model="data[type]" :type="type">
  36536. * into this:
  36537. * <input v-if="type === 'checkbox'" type="checkbox" v-model="data[type]">
  36538. * <input v-else-if="type === 'radio'" type="radio" v-model="data[type]">
  36539. * <input v-else :type="type" v-model="data[type]">
  36540. */
  36541. function preTransformNode (el, options) {
  36542. if (el.tag === 'input') {
  36543. var map = el.attrsMap;
  36544. if (map['v-model'] && (map['v-bind:type'] || map[':type'])) {
  36545. var typeBinding = getBindingAttr(el, 'type');
  36546. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  36547. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  36548. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  36549. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  36550. // 1. checkbox
  36551. var branch0 = cloneASTElement(el);
  36552. // process for on the main node
  36553. processFor(branch0);
  36554. addRawAttr(branch0, 'type', 'checkbox');
  36555. processElement(branch0, options);
  36556. branch0.processed = true; // prevent it from double-processed
  36557. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  36558. addIfCondition(branch0, {
  36559. exp: branch0.if,
  36560. block: branch0
  36561. });
  36562. // 2. add radio else-if condition
  36563. var branch1 = cloneASTElement(el);
  36564. getAndRemoveAttr(branch1, 'v-for', true);
  36565. addRawAttr(branch1, 'type', 'radio');
  36566. processElement(branch1, options);
  36567. addIfCondition(branch0, {
  36568. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  36569. block: branch1
  36570. });
  36571. // 3. other
  36572. var branch2 = cloneASTElement(el);
  36573. getAndRemoveAttr(branch2, 'v-for', true);
  36574. addRawAttr(branch2, ':type', typeBinding);
  36575. processElement(branch2, options);
  36576. addIfCondition(branch0, {
  36577. exp: ifCondition,
  36578. block: branch2
  36579. });
  36580. if (hasElse) {
  36581. branch0.else = true;
  36582. } else if (elseIfCondition) {
  36583. branch0.elseif = elseIfCondition;
  36584. }
  36585. return branch0
  36586. }
  36587. }
  36588. }
  36589. function cloneASTElement (el) {
  36590. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  36591. }
  36592. var model$2 = {
  36593. preTransformNode: preTransformNode
  36594. };
  36595. var modules$1 = [
  36596. klass$1,
  36597. style$1,
  36598. model$2
  36599. ];
  36600. /* */
  36601. function text (el, dir) {
  36602. if (dir.value) {
  36603. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"));
  36604. }
  36605. }
  36606. /* */
  36607. function html (el, dir) {
  36608. if (dir.value) {
  36609. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"));
  36610. }
  36611. }
  36612. var directives$1 = {
  36613. model: model,
  36614. text: text,
  36615. html: html
  36616. };
  36617. /* */
  36618. var baseOptions = {
  36619. expectHTML: true,
  36620. modules: modules$1,
  36621. directives: directives$1,
  36622. isPreTag: isPreTag,
  36623. isUnaryTag: isUnaryTag,
  36624. mustUseProp: mustUseProp,
  36625. canBeLeftOpenTag: canBeLeftOpenTag,
  36626. isReservedTag: isReservedTag,
  36627. getTagNamespace: getTagNamespace,
  36628. staticKeys: genStaticKeys(modules$1)
  36629. };
  36630. /* */
  36631. var isStaticKey;
  36632. var isPlatformReservedTag;
  36633. var genStaticKeysCached = cached(genStaticKeys$1);
  36634. /**
  36635. * Goal of the optimizer: walk the generated template AST tree
  36636. * and detect sub-trees that are purely static, i.e. parts of
  36637. * the DOM that never needs to change.
  36638. *
  36639. * Once we detect these sub-trees, we can:
  36640. *
  36641. * 1. Hoist them into constants, so that we no longer need to
  36642. * create fresh nodes for them on each re-render;
  36643. * 2. Completely skip them in the patching process.
  36644. */
  36645. function optimize (root, options) {
  36646. if (!root) { return }
  36647. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  36648. isPlatformReservedTag = options.isReservedTag || no;
  36649. // first pass: mark all non-static nodes.
  36650. markStatic$1(root);
  36651. // second pass: mark static roots.
  36652. markStaticRoots(root, false);
  36653. }
  36654. function genStaticKeys$1 (keys) {
  36655. return makeMap(
  36656. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs' +
  36657. (keys ? ',' + keys : '')
  36658. )
  36659. }
  36660. function markStatic$1 (node) {
  36661. node.static = isStatic(node);
  36662. if (node.type === 1) {
  36663. // do not make component slot content static. this avoids
  36664. // 1. components not able to mutate slot nodes
  36665. // 2. static slot content fails for hot-reloading
  36666. if (
  36667. !isPlatformReservedTag(node.tag) &&
  36668. node.tag !== 'slot' &&
  36669. node.attrsMap['inline-template'] == null
  36670. ) {
  36671. return
  36672. }
  36673. for (var i = 0, l = node.children.length; i < l; i++) {
  36674. var child = node.children[i];
  36675. markStatic$1(child);
  36676. if (!child.static) {
  36677. node.static = false;
  36678. }
  36679. }
  36680. if (node.ifConditions) {
  36681. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  36682. var block = node.ifConditions[i$1].block;
  36683. markStatic$1(block);
  36684. if (!block.static) {
  36685. node.static = false;
  36686. }
  36687. }
  36688. }
  36689. }
  36690. }
  36691. function markStaticRoots (node, isInFor) {
  36692. if (node.type === 1) {
  36693. if (node.static || node.once) {
  36694. node.staticInFor = isInFor;
  36695. }
  36696. // For a node to qualify as a static root, it should have children that
  36697. // are not just static text. Otherwise the cost of hoisting out will
  36698. // outweigh the benefits and it's better off to just always render it fresh.
  36699. if (node.static && node.children.length && !(
  36700. node.children.length === 1 &&
  36701. node.children[0].type === 3
  36702. )) {
  36703. node.staticRoot = true;
  36704. return
  36705. } else {
  36706. node.staticRoot = false;
  36707. }
  36708. if (node.children) {
  36709. for (var i = 0, l = node.children.length; i < l; i++) {
  36710. markStaticRoots(node.children[i], isInFor || !!node.for);
  36711. }
  36712. }
  36713. if (node.ifConditions) {
  36714. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  36715. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  36716. }
  36717. }
  36718. }
  36719. }
  36720. function isStatic (node) {
  36721. if (node.type === 2) { // expression
  36722. return false
  36723. }
  36724. if (node.type === 3) { // text
  36725. return true
  36726. }
  36727. return !!(node.pre || (
  36728. !node.hasBindings && // no dynamic bindings
  36729. !node.if && !node.for && // not v-if or v-for or v-else
  36730. !isBuiltInTag(node.tag) && // not a built-in
  36731. isPlatformReservedTag(node.tag) && // not a component
  36732. !isDirectChildOfTemplateFor(node) &&
  36733. Object.keys(node).every(isStaticKey)
  36734. ))
  36735. }
  36736. function isDirectChildOfTemplateFor (node) {
  36737. while (node.parent) {
  36738. node = node.parent;
  36739. if (node.tag !== 'template') {
  36740. return false
  36741. }
  36742. if (node.for) {
  36743. return true
  36744. }
  36745. }
  36746. return false
  36747. }
  36748. /* */
  36749. var fnExpRE = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
  36750. var simplePathRE = /^\s*[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['.*?']|\[".*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*\s*$/;
  36751. // keyCode aliases
  36752. var keyCodes = {
  36753. esc: 27,
  36754. tab: 9,
  36755. enter: 13,
  36756. space: 32,
  36757. up: 38,
  36758. left: 37,
  36759. right: 39,
  36760. down: 40,
  36761. 'delete': [8, 46]
  36762. };
  36763. // #4868: modifiers that prevent the execution of the listener
  36764. // need to explicitly return null so that we can determine whether to remove
  36765. // the listener for .once
  36766. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  36767. var modifierCode = {
  36768. stop: '$event.stopPropagation();',
  36769. prevent: '$event.preventDefault();',
  36770. self: genGuard("$event.target !== $event.currentTarget"),
  36771. ctrl: genGuard("!$event.ctrlKey"),
  36772. shift: genGuard("!$event.shiftKey"),
  36773. alt: genGuard("!$event.altKey"),
  36774. meta: genGuard("!$event.metaKey"),
  36775. left: genGuard("'button' in $event && $event.button !== 0"),
  36776. middle: genGuard("'button' in $event && $event.button !== 1"),
  36777. right: genGuard("'button' in $event && $event.button !== 2")
  36778. };
  36779. function genHandlers (
  36780. events,
  36781. isNative,
  36782. warn
  36783. ) {
  36784. var res = isNative ? 'nativeOn:{' : 'on:{';
  36785. for (var name in events) {
  36786. res += "\"" + name + "\":" + (genHandler(name, events[name])) + ",";
  36787. }
  36788. return res.slice(0, -1) + '}'
  36789. }
  36790. function genHandler (
  36791. name,
  36792. handler
  36793. ) {
  36794. if (!handler) {
  36795. return 'function(){}'
  36796. }
  36797. if (Array.isArray(handler)) {
  36798. return ("[" + (handler.map(function (handler) { return genHandler(name, handler); }).join(',')) + "]")
  36799. }
  36800. var isMethodPath = simplePathRE.test(handler.value);
  36801. var isFunctionExpression = fnExpRE.test(handler.value);
  36802. if (!handler.modifiers) {
  36803. if (isMethodPath || isFunctionExpression) {
  36804. return handler.value
  36805. }
  36806. /* istanbul ignore if */
  36807. return ("function($event){" + (handler.value) + "}") // inline statement
  36808. } else {
  36809. var code = '';
  36810. var genModifierCode = '';
  36811. var keys = [];
  36812. for (var key in handler.modifiers) {
  36813. if (modifierCode[key]) {
  36814. genModifierCode += modifierCode[key];
  36815. // left/right
  36816. if (keyCodes[key]) {
  36817. keys.push(key);
  36818. }
  36819. } else if (key === 'exact') {
  36820. var modifiers = (handler.modifiers);
  36821. genModifierCode += genGuard(
  36822. ['ctrl', 'shift', 'alt', 'meta']
  36823. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  36824. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  36825. .join('||')
  36826. );
  36827. } else {
  36828. keys.push(key);
  36829. }
  36830. }
  36831. if (keys.length) {
  36832. code += genKeyFilter(keys);
  36833. }
  36834. // Make sure modifiers like prevent and stop get executed after key filtering
  36835. if (genModifierCode) {
  36836. code += genModifierCode;
  36837. }
  36838. var handlerCode = isMethodPath
  36839. ? handler.value + '($event)'
  36840. : isFunctionExpression
  36841. ? ("(" + (handler.value) + ")($event)")
  36842. : handler.value;
  36843. /* istanbul ignore if */
  36844. return ("function($event){" + code + handlerCode + "}")
  36845. }
  36846. }
  36847. function genKeyFilter (keys) {
  36848. return ("if(!('button' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
  36849. }
  36850. function genFilterCode (key) {
  36851. var keyVal = parseInt(key, 10);
  36852. if (keyVal) {
  36853. return ("$event.keyCode!==" + keyVal)
  36854. }
  36855. var code = keyCodes[key];
  36856. return (
  36857. "_k($event.keyCode," +
  36858. (JSON.stringify(key)) + "," +
  36859. (JSON.stringify(code)) + "," +
  36860. "$event.key)"
  36861. )
  36862. }
  36863. /* */
  36864. function on (el, dir) {
  36865. if ("development" !== 'production' && dir.modifiers) {
  36866. warn("v-on without argument does not support modifiers.");
  36867. }
  36868. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  36869. }
  36870. /* */
  36871. function bind$1 (el, dir) {
  36872. el.wrapData = function (code) {
  36873. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  36874. };
  36875. }
  36876. /* */
  36877. var baseDirectives = {
  36878. on: on,
  36879. bind: bind$1,
  36880. cloak: noop
  36881. };
  36882. /* */
  36883. var CodegenState = function CodegenState (options) {
  36884. this.options = options;
  36885. this.warn = options.warn || baseWarn;
  36886. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  36887. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  36888. this.directives = extend(extend({}, baseDirectives), options.directives);
  36889. var isReservedTag = options.isReservedTag || no;
  36890. this.maybeComponent = function (el) { return !isReservedTag(el.tag); };
  36891. this.onceId = 0;
  36892. this.staticRenderFns = [];
  36893. };
  36894. function generate (
  36895. ast,
  36896. options
  36897. ) {
  36898. var state = new CodegenState(options);
  36899. var code = ast ? genElement(ast, state) : '_c("div")';
  36900. return {
  36901. render: ("with(this){return " + code + "}"),
  36902. staticRenderFns: state.staticRenderFns
  36903. }
  36904. }
  36905. function genElement (el, state) {
  36906. if (el.staticRoot && !el.staticProcessed) {
  36907. return genStatic(el, state)
  36908. } else if (el.once && !el.onceProcessed) {
  36909. return genOnce(el, state)
  36910. } else if (el.for && !el.forProcessed) {
  36911. return genFor(el, state)
  36912. } else if (el.if && !el.ifProcessed) {
  36913. return genIf(el, state)
  36914. } else if (el.tag === 'template' && !el.slotTarget) {
  36915. return genChildren(el, state) || 'void 0'
  36916. } else if (el.tag === 'slot') {
  36917. return genSlot(el, state)
  36918. } else {
  36919. // component or element
  36920. var code;
  36921. if (el.component) {
  36922. code = genComponent(el.component, el, state);
  36923. } else {
  36924. var data = el.plain ? undefined : genData$2(el, state);
  36925. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  36926. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  36927. }
  36928. // module transforms
  36929. for (var i = 0; i < state.transforms.length; i++) {
  36930. code = state.transforms[i](el, code);
  36931. }
  36932. return code
  36933. }
  36934. }
  36935. // hoist static sub-trees out
  36936. function genStatic (el, state) {
  36937. el.staticProcessed = true;
  36938. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  36939. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  36940. }
  36941. // v-once
  36942. function genOnce (el, state) {
  36943. el.onceProcessed = true;
  36944. if (el.if && !el.ifProcessed) {
  36945. return genIf(el, state)
  36946. } else if (el.staticInFor) {
  36947. var key = '';
  36948. var parent = el.parent;
  36949. while (parent) {
  36950. if (parent.for) {
  36951. key = parent.key;
  36952. break
  36953. }
  36954. parent = parent.parent;
  36955. }
  36956. if (!key) {
  36957. "development" !== 'production' && state.warn(
  36958. "v-once can only be used inside v-for that is keyed. "
  36959. );
  36960. return genElement(el, state)
  36961. }
  36962. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  36963. } else {
  36964. return genStatic(el, state)
  36965. }
  36966. }
  36967. function genIf (
  36968. el,
  36969. state,
  36970. altGen,
  36971. altEmpty
  36972. ) {
  36973. el.ifProcessed = true; // avoid recursion
  36974. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  36975. }
  36976. function genIfConditions (
  36977. conditions,
  36978. state,
  36979. altGen,
  36980. altEmpty
  36981. ) {
  36982. if (!conditions.length) {
  36983. return altEmpty || '_e()'
  36984. }
  36985. var condition = conditions.shift();
  36986. if (condition.exp) {
  36987. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  36988. } else {
  36989. return ("" + (genTernaryExp(condition.block)))
  36990. }
  36991. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  36992. function genTernaryExp (el) {
  36993. return altGen
  36994. ? altGen(el, state)
  36995. : el.once
  36996. ? genOnce(el, state)
  36997. : genElement(el, state)
  36998. }
  36999. }
  37000. function genFor (
  37001. el,
  37002. state,
  37003. altGen,
  37004. altHelper
  37005. ) {
  37006. var exp = el.for;
  37007. var alias = el.alias;
  37008. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  37009. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  37010. if ("development" !== 'production' &&
  37011. state.maybeComponent(el) &&
  37012. el.tag !== 'slot' &&
  37013. el.tag !== 'template' &&
  37014. !el.key
  37015. ) {
  37016. state.warn(
  37017. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  37018. "v-for should have explicit keys. " +
  37019. "See https://vuejs.org/guide/list.html#key for more info.",
  37020. true /* tip */
  37021. );
  37022. }
  37023. el.forProcessed = true; // avoid recursion
  37024. return (altHelper || '_l') + "((" + exp + ")," +
  37025. "function(" + alias + iterator1 + iterator2 + "){" +
  37026. "return " + ((altGen || genElement)(el, state)) +
  37027. '})'
  37028. }
  37029. function genData$2 (el, state) {
  37030. var data = '{';
  37031. // directives first.
  37032. // directives may mutate the el's other properties before they are generated.
  37033. var dirs = genDirectives(el, state);
  37034. if (dirs) { data += dirs + ','; }
  37035. // key
  37036. if (el.key) {
  37037. data += "key:" + (el.key) + ",";
  37038. }
  37039. // ref
  37040. if (el.ref) {
  37041. data += "ref:" + (el.ref) + ",";
  37042. }
  37043. if (el.refInFor) {
  37044. data += "refInFor:true,";
  37045. }
  37046. // pre
  37047. if (el.pre) {
  37048. data += "pre:true,";
  37049. }
  37050. // record original tag name for components using "is" attribute
  37051. if (el.component) {
  37052. data += "tag:\"" + (el.tag) + "\",";
  37053. }
  37054. // module data generation functions
  37055. for (var i = 0; i < state.dataGenFns.length; i++) {
  37056. data += state.dataGenFns[i](el);
  37057. }
  37058. // attributes
  37059. if (el.attrs) {
  37060. data += "attrs:{" + (genProps(el.attrs)) + "},";
  37061. }
  37062. // DOM props
  37063. if (el.props) {
  37064. data += "domProps:{" + (genProps(el.props)) + "},";
  37065. }
  37066. // event handlers
  37067. if (el.events) {
  37068. data += (genHandlers(el.events, false, state.warn)) + ",";
  37069. }
  37070. if (el.nativeEvents) {
  37071. data += (genHandlers(el.nativeEvents, true, state.warn)) + ",";
  37072. }
  37073. // slot target
  37074. // only for non-scoped slots
  37075. if (el.slotTarget && !el.slotScope) {
  37076. data += "slot:" + (el.slotTarget) + ",";
  37077. }
  37078. // scoped slots
  37079. if (el.scopedSlots) {
  37080. data += (genScopedSlots(el.scopedSlots, state)) + ",";
  37081. }
  37082. // component v-model
  37083. if (el.model) {
  37084. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  37085. }
  37086. // inline-template
  37087. if (el.inlineTemplate) {
  37088. var inlineTemplate = genInlineTemplate(el, state);
  37089. if (inlineTemplate) {
  37090. data += inlineTemplate + ",";
  37091. }
  37092. }
  37093. data = data.replace(/,$/, '') + '}';
  37094. // v-bind data wrap
  37095. if (el.wrapData) {
  37096. data = el.wrapData(data);
  37097. }
  37098. // v-on data wrap
  37099. if (el.wrapListeners) {
  37100. data = el.wrapListeners(data);
  37101. }
  37102. return data
  37103. }
  37104. function genDirectives (el, state) {
  37105. var dirs = el.directives;
  37106. if (!dirs) { return }
  37107. var res = 'directives:[';
  37108. var hasRuntime = false;
  37109. var i, l, dir, needRuntime;
  37110. for (i = 0, l = dirs.length; i < l; i++) {
  37111. dir = dirs[i];
  37112. needRuntime = true;
  37113. var gen = state.directives[dir.name];
  37114. if (gen) {
  37115. // compile-time directive that manipulates AST.
  37116. // returns true if it also needs a runtime counterpart.
  37117. needRuntime = !!gen(el, dir, state.warn);
  37118. }
  37119. if (needRuntime) {
  37120. hasRuntime = true;
  37121. res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:\"" + (dir.arg) + "\"") : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
  37122. }
  37123. }
  37124. if (hasRuntime) {
  37125. return res.slice(0, -1) + ']'
  37126. }
  37127. }
  37128. function genInlineTemplate (el, state) {
  37129. var ast = el.children[0];
  37130. if ("development" !== 'production' && (
  37131. el.children.length !== 1 || ast.type !== 1
  37132. )) {
  37133. state.warn('Inline-template components must have exactly one child element.');
  37134. }
  37135. if (ast.type === 1) {
  37136. var inlineRenderFns = generate(ast, state.options);
  37137. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  37138. }
  37139. }
  37140. function genScopedSlots (
  37141. slots,
  37142. state
  37143. ) {
  37144. return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
  37145. return genScopedSlot(key, slots[key], state)
  37146. }).join(',')) + "])")
  37147. }
  37148. function genScopedSlot (
  37149. key,
  37150. el,
  37151. state
  37152. ) {
  37153. if (el.for && !el.forProcessed) {
  37154. return genForScopedSlot(key, el, state)
  37155. }
  37156. var fn = "function(" + (String(el.slotScope)) + "){" +
  37157. "return " + (el.tag === 'template'
  37158. ? el.if
  37159. ? ((el.if) + "?" + (genChildren(el, state) || 'undefined') + ":undefined")
  37160. : genChildren(el, state) || 'undefined'
  37161. : genElement(el, state)) + "}";
  37162. return ("{key:" + key + ",fn:" + fn + "}")
  37163. }
  37164. function genForScopedSlot (
  37165. key,
  37166. el,
  37167. state
  37168. ) {
  37169. var exp = el.for;
  37170. var alias = el.alias;
  37171. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  37172. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  37173. el.forProcessed = true; // avoid recursion
  37174. return "_l((" + exp + ")," +
  37175. "function(" + alias + iterator1 + iterator2 + "){" +
  37176. "return " + (genScopedSlot(key, el, state)) +
  37177. '})'
  37178. }
  37179. function genChildren (
  37180. el,
  37181. state,
  37182. checkSkip,
  37183. altGenElement,
  37184. altGenNode
  37185. ) {
  37186. var children = el.children;
  37187. if (children.length) {
  37188. var el$1 = children[0];
  37189. // optimize single v-for
  37190. if (children.length === 1 &&
  37191. el$1.for &&
  37192. el$1.tag !== 'template' &&
  37193. el$1.tag !== 'slot'
  37194. ) {
  37195. return (altGenElement || genElement)(el$1, state)
  37196. }
  37197. var normalizationType = checkSkip
  37198. ? getNormalizationType(children, state.maybeComponent)
  37199. : 0;
  37200. var gen = altGenNode || genNode;
  37201. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType ? ("," + normalizationType) : ''))
  37202. }
  37203. }
  37204. // determine the normalization needed for the children array.
  37205. // 0: no normalization needed
  37206. // 1: simple normalization needed (possible 1-level deep nested array)
  37207. // 2: full normalization needed
  37208. function getNormalizationType (
  37209. children,
  37210. maybeComponent
  37211. ) {
  37212. var res = 0;
  37213. for (var i = 0; i < children.length; i++) {
  37214. var el = children[i];
  37215. if (el.type !== 1) {
  37216. continue
  37217. }
  37218. if (needsNormalization(el) ||
  37219. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  37220. res = 2;
  37221. break
  37222. }
  37223. if (maybeComponent(el) ||
  37224. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  37225. res = 1;
  37226. }
  37227. }
  37228. return res
  37229. }
  37230. function needsNormalization (el) {
  37231. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  37232. }
  37233. function genNode (node, state) {
  37234. if (node.type === 1) {
  37235. return genElement(node, state)
  37236. } if (node.type === 3 && node.isComment) {
  37237. return genComment(node)
  37238. } else {
  37239. return genText(node)
  37240. }
  37241. }
  37242. function genText (text) {
  37243. return ("_v(" + (text.type === 2
  37244. ? text.expression // no need for () because already wrapped in _s()
  37245. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  37246. }
  37247. function genComment (comment) {
  37248. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  37249. }
  37250. function genSlot (el, state) {
  37251. var slotName = el.slotName || '"default"';
  37252. var children = genChildren(el, state);
  37253. var res = "_t(" + slotName + (children ? ("," + children) : '');
  37254. var attrs = el.attrs && ("{" + (el.attrs.map(function (a) { return ((camelize(a.name)) + ":" + (a.value)); }).join(',')) + "}");
  37255. var bind$$1 = el.attrsMap['v-bind'];
  37256. if ((attrs || bind$$1) && !children) {
  37257. res += ",null";
  37258. }
  37259. if (attrs) {
  37260. res += "," + attrs;
  37261. }
  37262. if (bind$$1) {
  37263. res += (attrs ? '' : ',null') + "," + bind$$1;
  37264. }
  37265. return res + ')'
  37266. }
  37267. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  37268. function genComponent (
  37269. componentName,
  37270. el,
  37271. state
  37272. ) {
  37273. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  37274. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  37275. }
  37276. function genProps (props) {
  37277. var res = '';
  37278. for (var i = 0; i < props.length; i++) {
  37279. var prop = props[i];
  37280. /* istanbul ignore if */
  37281. {
  37282. res += "\"" + (prop.name) + "\":" + (transformSpecialNewlines(prop.value)) + ",";
  37283. }
  37284. }
  37285. return res.slice(0, -1)
  37286. }
  37287. // #3895, #4268
  37288. function transformSpecialNewlines (text) {
  37289. return text
  37290. .replace(/\u2028/g, '\\u2028')
  37291. .replace(/\u2029/g, '\\u2029')
  37292. }
  37293. /* */
  37294. // these keywords should not appear inside expressions, but operators like
  37295. // typeof, instanceof and in are allowed
  37296. var prohibitedKeywordRE = new RegExp('\\b' + (
  37297. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  37298. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  37299. 'extends,finally,continue,debugger,function,arguments'
  37300. ).split(',').join('\\b|\\b') + '\\b');
  37301. // these unary operators should not be used as property/method names
  37302. var unaryOperatorsRE = new RegExp('\\b' + (
  37303. 'delete,typeof,void'
  37304. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  37305. // strip strings in expressions
  37306. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  37307. // detect problematic expressions in a template
  37308. function detectErrors (ast) {
  37309. var errors = [];
  37310. if (ast) {
  37311. checkNode(ast, errors);
  37312. }
  37313. return errors
  37314. }
  37315. function checkNode (node, errors) {
  37316. if (node.type === 1) {
  37317. for (var name in node.attrsMap) {
  37318. if (dirRE.test(name)) {
  37319. var value = node.attrsMap[name];
  37320. if (value) {
  37321. if (name === 'v-for') {
  37322. checkFor(node, ("v-for=\"" + value + "\""), errors);
  37323. } else if (onRE.test(name)) {
  37324. checkEvent(value, (name + "=\"" + value + "\""), errors);
  37325. } else {
  37326. checkExpression(value, (name + "=\"" + value + "\""), errors);
  37327. }
  37328. }
  37329. }
  37330. }
  37331. if (node.children) {
  37332. for (var i = 0; i < node.children.length; i++) {
  37333. checkNode(node.children[i], errors);
  37334. }
  37335. }
  37336. } else if (node.type === 2) {
  37337. checkExpression(node.expression, node.text, errors);
  37338. }
  37339. }
  37340. function checkEvent (exp, text, errors) {
  37341. var stipped = exp.replace(stripStringRE, '');
  37342. var keywordMatch = stipped.match(unaryOperatorsRE);
  37343. if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
  37344. errors.push(
  37345. "avoid using JavaScript unary operator as property name: " +
  37346. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim())
  37347. );
  37348. }
  37349. checkExpression(exp, text, errors);
  37350. }
  37351. function checkFor (node, text, errors) {
  37352. checkExpression(node.for || '', text, errors);
  37353. checkIdentifier(node.alias, 'v-for alias', text, errors);
  37354. checkIdentifier(node.iterator1, 'v-for iterator', text, errors);
  37355. checkIdentifier(node.iterator2, 'v-for iterator', text, errors);
  37356. }
  37357. function checkIdentifier (
  37358. ident,
  37359. type,
  37360. text,
  37361. errors
  37362. ) {
  37363. if (typeof ident === 'string') {
  37364. try {
  37365. new Function(("var " + ident + "=_"));
  37366. } catch (e) {
  37367. errors.push(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())));
  37368. }
  37369. }
  37370. }
  37371. function checkExpression (exp, text, errors) {
  37372. try {
  37373. new Function(("return " + exp));
  37374. } catch (e) {
  37375. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  37376. if (keywordMatch) {
  37377. errors.push(
  37378. "avoid using JavaScript keyword as property name: " +
  37379. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim())
  37380. );
  37381. } else {
  37382. errors.push(
  37383. "invalid expression: " + (e.message) + " in\n\n" +
  37384. " " + exp + "\n\n" +
  37385. " Raw expression: " + (text.trim()) + "\n"
  37386. );
  37387. }
  37388. }
  37389. }
  37390. /* */
  37391. function createFunction (code, errors) {
  37392. try {
  37393. return new Function(code)
  37394. } catch (err) {
  37395. errors.push({ err: err, code: code });
  37396. return noop
  37397. }
  37398. }
  37399. function createCompileToFunctionFn (compile) {
  37400. var cache = Object.create(null);
  37401. return function compileToFunctions (
  37402. template,
  37403. options,
  37404. vm
  37405. ) {
  37406. options = extend({}, options);
  37407. var warn$$1 = options.warn || warn;
  37408. delete options.warn;
  37409. /* istanbul ignore if */
  37410. if (true) {
  37411. // detect possible CSP restriction
  37412. try {
  37413. new Function('return 1');
  37414. } catch (e) {
  37415. if (e.toString().match(/unsafe-eval|CSP/)) {
  37416. warn$$1(
  37417. 'It seems you are using the standalone build of Vue.js in an ' +
  37418. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  37419. 'The template compiler cannot work in this environment. Consider ' +
  37420. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  37421. 'templates into render functions.'
  37422. );
  37423. }
  37424. }
  37425. }
  37426. // check cache
  37427. var key = options.delimiters
  37428. ? String(options.delimiters) + template
  37429. : template;
  37430. if (cache[key]) {
  37431. return cache[key]
  37432. }
  37433. // compile
  37434. var compiled = compile(template, options);
  37435. // check compilation errors/tips
  37436. if (true) {
  37437. if (compiled.errors && compiled.errors.length) {
  37438. warn$$1(
  37439. "Error compiling template:\n\n" + template + "\n\n" +
  37440. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  37441. vm
  37442. );
  37443. }
  37444. if (compiled.tips && compiled.tips.length) {
  37445. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  37446. }
  37447. }
  37448. // turn code into functions
  37449. var res = {};
  37450. var fnGenErrors = [];
  37451. res.render = createFunction(compiled.render, fnGenErrors);
  37452. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  37453. return createFunction(code, fnGenErrors)
  37454. });
  37455. // check function generation errors.
  37456. // this should only happen if there is a bug in the compiler itself.
  37457. // mostly for codegen development use
  37458. /* istanbul ignore if */
  37459. if (true) {
  37460. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  37461. warn$$1(
  37462. "Failed to generate render function:\n\n" +
  37463. fnGenErrors.map(function (ref) {
  37464. var err = ref.err;
  37465. var code = ref.code;
  37466. return ((err.toString()) + " in\n\n" + code + "\n");
  37467. }).join('\n'),
  37468. vm
  37469. );
  37470. }
  37471. }
  37472. return (cache[key] = res)
  37473. }
  37474. }
  37475. /* */
  37476. function createCompilerCreator (baseCompile) {
  37477. return function createCompiler (baseOptions) {
  37478. function compile (
  37479. template,
  37480. options
  37481. ) {
  37482. var finalOptions = Object.create(baseOptions);
  37483. var errors = [];
  37484. var tips = [];
  37485. finalOptions.warn = function (msg, tip) {
  37486. (tip ? tips : errors).push(msg);
  37487. };
  37488. if (options) {
  37489. // merge custom modules
  37490. if (options.modules) {
  37491. finalOptions.modules =
  37492. (baseOptions.modules || []).concat(options.modules);
  37493. }
  37494. // merge custom directives
  37495. if (options.directives) {
  37496. finalOptions.directives = extend(
  37497. Object.create(baseOptions.directives || null),
  37498. options.directives
  37499. );
  37500. }
  37501. // copy other options
  37502. for (var key in options) {
  37503. if (key !== 'modules' && key !== 'directives') {
  37504. finalOptions[key] = options[key];
  37505. }
  37506. }
  37507. }
  37508. var compiled = baseCompile(template, finalOptions);
  37509. if (true) {
  37510. errors.push.apply(errors, detectErrors(compiled.ast));
  37511. }
  37512. compiled.errors = errors;
  37513. compiled.tips = tips;
  37514. return compiled
  37515. }
  37516. return {
  37517. compile: compile,
  37518. compileToFunctions: createCompileToFunctionFn(compile)
  37519. }
  37520. }
  37521. }
  37522. /* */
  37523. // `createCompilerCreator` allows creating compilers that use alternative
  37524. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  37525. // Here we just export a default compiler using the default parts.
  37526. var createCompiler = createCompilerCreator(function baseCompile (
  37527. template,
  37528. options
  37529. ) {
  37530. var ast = parse(template.trim(), options);
  37531. if (options.optimize !== false) {
  37532. optimize(ast, options);
  37533. }
  37534. var code = generate(ast, options);
  37535. return {
  37536. ast: ast,
  37537. render: code.render,
  37538. staticRenderFns: code.staticRenderFns
  37539. }
  37540. });
  37541. /* */
  37542. var ref$1 = createCompiler(baseOptions);
  37543. var compileToFunctions = ref$1.compileToFunctions;
  37544. /* */
  37545. // check whether current browser encodes a char inside attribute values
  37546. var div;
  37547. function getShouldDecode (href) {
  37548. div = div || document.createElement('div');
  37549. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  37550. return div.innerHTML.indexOf('&#10;') > 0
  37551. }
  37552. // #3663: IE encodes newlines inside attribute values while other browsers don't
  37553. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  37554. // #6828: chrome encodes content in a[href]
  37555. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  37556. /* */
  37557. var idToTemplate = cached(function (id) {
  37558. var el = query(id);
  37559. return el && el.innerHTML
  37560. });
  37561. var mount = Vue$3.prototype.$mount;
  37562. Vue$3.prototype.$mount = function (
  37563. el,
  37564. hydrating
  37565. ) {
  37566. el = el && query(el);
  37567. /* istanbul ignore if */
  37568. if (el === document.body || el === document.documentElement) {
  37569. "development" !== 'production' && warn(
  37570. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  37571. );
  37572. return this
  37573. }
  37574. var options = this.$options;
  37575. // resolve template/el and convert to render function
  37576. if (!options.render) {
  37577. var template = options.template;
  37578. if (template) {
  37579. if (typeof template === 'string') {
  37580. if (template.charAt(0) === '#') {
  37581. template = idToTemplate(template);
  37582. /* istanbul ignore if */
  37583. if ("development" !== 'production' && !template) {
  37584. warn(
  37585. ("Template element not found or is empty: " + (options.template)),
  37586. this
  37587. );
  37588. }
  37589. }
  37590. } else if (template.nodeType) {
  37591. template = template.innerHTML;
  37592. } else {
  37593. if (true) {
  37594. warn('invalid template option:' + template, this);
  37595. }
  37596. return this
  37597. }
  37598. } else if (el) {
  37599. template = getOuterHTML(el);
  37600. }
  37601. if (template) {
  37602. /* istanbul ignore if */
  37603. if ("development" !== 'production' && config.performance && mark) {
  37604. mark('compile');
  37605. }
  37606. var ref = compileToFunctions(template, {
  37607. shouldDecodeNewlines: shouldDecodeNewlines,
  37608. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  37609. delimiters: options.delimiters,
  37610. comments: options.comments
  37611. }, this);
  37612. var render = ref.render;
  37613. var staticRenderFns = ref.staticRenderFns;
  37614. options.render = render;
  37615. options.staticRenderFns = staticRenderFns;
  37616. /* istanbul ignore if */
  37617. if ("development" !== 'production' && config.performance && mark) {
  37618. mark('compile end');
  37619. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  37620. }
  37621. }
  37622. }
  37623. return mount.call(this, el, hydrating)
  37624. };
  37625. /**
  37626. * Get outerHTML of elements, taking care
  37627. * of SVG elements in IE as well.
  37628. */
  37629. function getOuterHTML (el) {
  37630. if (el.outerHTML) {
  37631. return el.outerHTML
  37632. } else {
  37633. var container = document.createElement('div');
  37634. container.appendChild(el.cloneNode(true));
  37635. return container.innerHTML
  37636. }
  37637. }
  37638. Vue$3.compile = compileToFunctions;
  37639. module.exports = Vue$3;
  37640. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(36).setImmediate))
  37641. /***/ }),
  37642. /* 36 */
  37643. /***/ (function(module, exports, __webpack_require__) {
  37644. /* WEBPACK VAR INJECTION */(function(global) {var apply = Function.prototype.apply;
  37645. // DOM APIs, for completeness
  37646. exports.setTimeout = function() {
  37647. return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
  37648. };
  37649. exports.setInterval = function() {
  37650. return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
  37651. };
  37652. exports.clearTimeout =
  37653. exports.clearInterval = function(timeout) {
  37654. if (timeout) {
  37655. timeout.close();
  37656. }
  37657. };
  37658. function Timeout(id, clearFn) {
  37659. this._id = id;
  37660. this._clearFn = clearFn;
  37661. }
  37662. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  37663. Timeout.prototype.close = function() {
  37664. this._clearFn.call(window, this._id);
  37665. };
  37666. // Does not start the time, just sets up the members needed.
  37667. exports.enroll = function(item, msecs) {
  37668. clearTimeout(item._idleTimeoutId);
  37669. item._idleTimeout = msecs;
  37670. };
  37671. exports.unenroll = function(item) {
  37672. clearTimeout(item._idleTimeoutId);
  37673. item._idleTimeout = -1;
  37674. };
  37675. exports._unrefActive = exports.active = function(item) {
  37676. clearTimeout(item._idleTimeoutId);
  37677. var msecs = item._idleTimeout;
  37678. if (msecs >= 0) {
  37679. item._idleTimeoutId = setTimeout(function onTimeout() {
  37680. if (item._onTimeout)
  37681. item._onTimeout();
  37682. }, msecs);
  37683. }
  37684. };
  37685. // setimmediate attaches itself to the global object
  37686. __webpack_require__(37);
  37687. // On some exotic environments, it's not clear which object `setimmeidate` was
  37688. // able to install onto. Search each possibility in the same order as the
  37689. // `setimmediate` library.
  37690. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  37691. (typeof global !== "undefined" && global.setImmediate) ||
  37692. (this && this.setImmediate);
  37693. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  37694. (typeof global !== "undefined" && global.clearImmediate) ||
  37695. (this && this.clearImmediate);
  37696. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
  37697. /***/ }),
  37698. /* 37 */
  37699. /***/ (function(module, exports, __webpack_require__) {
  37700. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  37701. "use strict";
  37702. if (global.setImmediate) {
  37703. return;
  37704. }
  37705. var nextHandle = 1; // Spec says greater than zero
  37706. var tasksByHandle = {};
  37707. var currentlyRunningATask = false;
  37708. var doc = global.document;
  37709. var registerImmediate;
  37710. function setImmediate(callback) {
  37711. // Callback can either be a function or a string
  37712. if (typeof callback !== "function") {
  37713. callback = new Function("" + callback);
  37714. }
  37715. // Copy function arguments
  37716. var args = new Array(arguments.length - 1);
  37717. for (var i = 0; i < args.length; i++) {
  37718. args[i] = arguments[i + 1];
  37719. }
  37720. // Store and register the task
  37721. var task = { callback: callback, args: args };
  37722. tasksByHandle[nextHandle] = task;
  37723. registerImmediate(nextHandle);
  37724. return nextHandle++;
  37725. }
  37726. function clearImmediate(handle) {
  37727. delete tasksByHandle[handle];
  37728. }
  37729. function run(task) {
  37730. var callback = task.callback;
  37731. var args = task.args;
  37732. switch (args.length) {
  37733. case 0:
  37734. callback();
  37735. break;
  37736. case 1:
  37737. callback(args[0]);
  37738. break;
  37739. case 2:
  37740. callback(args[0], args[1]);
  37741. break;
  37742. case 3:
  37743. callback(args[0], args[1], args[2]);
  37744. break;
  37745. default:
  37746. callback.apply(undefined, args);
  37747. break;
  37748. }
  37749. }
  37750. function runIfPresent(handle) {
  37751. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  37752. // So if we're currently running a task, we'll need to delay this invocation.
  37753. if (currentlyRunningATask) {
  37754. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  37755. // "too much recursion" error.
  37756. setTimeout(runIfPresent, 0, handle);
  37757. } else {
  37758. var task = tasksByHandle[handle];
  37759. if (task) {
  37760. currentlyRunningATask = true;
  37761. try {
  37762. run(task);
  37763. } finally {
  37764. clearImmediate(handle);
  37765. currentlyRunningATask = false;
  37766. }
  37767. }
  37768. }
  37769. }
  37770. function installNextTickImplementation() {
  37771. registerImmediate = function(handle) {
  37772. process.nextTick(function () { runIfPresent(handle); });
  37773. };
  37774. }
  37775. function canUsePostMessage() {
  37776. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  37777. // where `global.postMessage` means something completely different and can't be used for this purpose.
  37778. if (global.postMessage && !global.importScripts) {
  37779. var postMessageIsAsynchronous = true;
  37780. var oldOnMessage = global.onmessage;
  37781. global.onmessage = function() {
  37782. postMessageIsAsynchronous = false;
  37783. };
  37784. global.postMessage("", "*");
  37785. global.onmessage = oldOnMessage;
  37786. return postMessageIsAsynchronous;
  37787. }
  37788. }
  37789. function installPostMessageImplementation() {
  37790. // Installs an event handler on `global` for the `message` event: see
  37791. // * https://developer.mozilla.org/en/DOM/window.postMessage
  37792. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  37793. var messagePrefix = "setImmediate$" + Math.random() + "$";
  37794. var onGlobalMessage = function(event) {
  37795. if (event.source === global &&
  37796. typeof event.data === "string" &&
  37797. event.data.indexOf(messagePrefix) === 0) {
  37798. runIfPresent(+event.data.slice(messagePrefix.length));
  37799. }
  37800. };
  37801. if (global.addEventListener) {
  37802. global.addEventListener("message", onGlobalMessage, false);
  37803. } else {
  37804. global.attachEvent("onmessage", onGlobalMessage);
  37805. }
  37806. registerImmediate = function(handle) {
  37807. global.postMessage(messagePrefix + handle, "*");
  37808. };
  37809. }
  37810. function installMessageChannelImplementation() {
  37811. var channel = new MessageChannel();
  37812. channel.port1.onmessage = function(event) {
  37813. var handle = event.data;
  37814. runIfPresent(handle);
  37815. };
  37816. registerImmediate = function(handle) {
  37817. channel.port2.postMessage(handle);
  37818. };
  37819. }
  37820. function installReadyStateChangeImplementation() {
  37821. var html = doc.documentElement;
  37822. registerImmediate = function(handle) {
  37823. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  37824. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  37825. var script = doc.createElement("script");
  37826. script.onreadystatechange = function () {
  37827. runIfPresent(handle);
  37828. script.onreadystatechange = null;
  37829. html.removeChild(script);
  37830. script = null;
  37831. };
  37832. html.appendChild(script);
  37833. };
  37834. }
  37835. function installSetTimeoutImplementation() {
  37836. registerImmediate = function(handle) {
  37837. setTimeout(runIfPresent, 0, handle);
  37838. };
  37839. }
  37840. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  37841. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  37842. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  37843. // Don't get fooled by e.g. browserify environments.
  37844. if ({}.toString.call(global.process) === "[object process]") {
  37845. // For Node.js before 0.9
  37846. installNextTickImplementation();
  37847. } else if (canUsePostMessage()) {
  37848. // For non-IE10 modern browsers
  37849. installPostMessageImplementation();
  37850. } else if (global.MessageChannel) {
  37851. // For web workers, where supported
  37852. installMessageChannelImplementation();
  37853. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  37854. // For IE 6–8
  37855. installReadyStateChangeImplementation();
  37856. } else {
  37857. // For older browsers
  37858. installSetTimeoutImplementation();
  37859. }
  37860. attachTo.setImmediate = setImmediate;
  37861. attachTo.clearImmediate = clearImmediate;
  37862. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  37863. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(4)))
  37864. /***/ }),
  37865. /* 38 */
  37866. /***/ (function(module, exports, __webpack_require__) {
  37867. var disposed = false
  37868. var normalizeComponent = __webpack_require__(39)
  37869. /* script */
  37870. var __vue_script__ = __webpack_require__(40)
  37871. /* template */
  37872. var __vue_template__ = __webpack_require__(41)
  37873. /* template functional */
  37874. var __vue_template_functional__ = false
  37875. /* styles */
  37876. var __vue_styles__ = null
  37877. /* scopeId */
  37878. var __vue_scopeId__ = null
  37879. /* moduleIdentifier (server only) */
  37880. var __vue_module_identifier__ = null
  37881. var Component = normalizeComponent(
  37882. __vue_script__,
  37883. __vue_template__,
  37884. __vue_template_functional__,
  37885. __vue_styles__,
  37886. __vue_scopeId__,
  37887. __vue_module_identifier__
  37888. )
  37889. Component.options.__file = "resources\\assets\\js\\components\\Example.vue"
  37890. /* hot reload */
  37891. if (false) {(function () {
  37892. var hotAPI = require("vue-hot-reload-api")
  37893. hotAPI.install(require("vue"), false)
  37894. if (!hotAPI.compatible) return
  37895. module.hot.accept()
  37896. if (!module.hot.data) {
  37897. hotAPI.createRecord("data-v-b6ebd97a", Component.options)
  37898. } else {
  37899. hotAPI.reload("data-v-b6ebd97a", Component.options)
  37900. }
  37901. module.hot.dispose(function (data) {
  37902. disposed = true
  37903. })
  37904. })()}
  37905. module.exports = Component.exports
  37906. /***/ }),
  37907. /* 39 */
  37908. /***/ (function(module, exports) {
  37909. /* globals __VUE_SSR_CONTEXT__ */
  37910. // IMPORTANT: Do NOT use ES2015 features in this file.
  37911. // This module is a runtime utility for cleaner component module output and will
  37912. // be included in the final webpack user bundle.
  37913. module.exports = function normalizeComponent (
  37914. rawScriptExports,
  37915. compiledTemplate,
  37916. functionalTemplate,
  37917. injectStyles,
  37918. scopeId,
  37919. moduleIdentifier /* server only */
  37920. ) {
  37921. var esModule
  37922. var scriptExports = rawScriptExports = rawScriptExports || {}
  37923. // ES6 modules interop
  37924. var type = typeof rawScriptExports.default
  37925. if (type === 'object' || type === 'function') {
  37926. esModule = rawScriptExports
  37927. scriptExports = rawScriptExports.default
  37928. }
  37929. // Vue.extend constructor export interop
  37930. var options = typeof scriptExports === 'function'
  37931. ? scriptExports.options
  37932. : scriptExports
  37933. // render functions
  37934. if (compiledTemplate) {
  37935. options.render = compiledTemplate.render
  37936. options.staticRenderFns = compiledTemplate.staticRenderFns
  37937. options._compiled = true
  37938. }
  37939. // functional template
  37940. if (functionalTemplate) {
  37941. options.functional = true
  37942. }
  37943. // scopedId
  37944. if (scopeId) {
  37945. options._scopeId = scopeId
  37946. }
  37947. var hook
  37948. if (moduleIdentifier) { // server build
  37949. hook = function (context) {
  37950. // 2.3 injection
  37951. context =
  37952. context || // cached call
  37953. (this.$vnode && this.$vnode.ssrContext) || // stateful
  37954. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  37955. // 2.2 with runInNewContext: true
  37956. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  37957. context = __VUE_SSR_CONTEXT__
  37958. }
  37959. // inject component styles
  37960. if (injectStyles) {
  37961. injectStyles.call(this, context)
  37962. }
  37963. // register component module identifier for async chunk inferrence
  37964. if (context && context._registeredComponents) {
  37965. context._registeredComponents.add(moduleIdentifier)
  37966. }
  37967. }
  37968. // used by ssr in case component is cached and beforeCreate
  37969. // never gets called
  37970. options._ssrRegister = hook
  37971. } else if (injectStyles) {
  37972. hook = injectStyles
  37973. }
  37974. if (hook) {
  37975. var functional = options.functional
  37976. var existing = functional
  37977. ? options.render
  37978. : options.beforeCreate
  37979. if (!functional) {
  37980. // inject component registration as beforeCreate hook
  37981. options.beforeCreate = existing
  37982. ? [].concat(existing, hook)
  37983. : [hook]
  37984. } else {
  37985. // for template-only hot-reload because in that case the render fn doesn't
  37986. // go through the normalizer
  37987. options._injectStyles = hook
  37988. // register for functioal component in vue file
  37989. options.render = function renderWithStyleInjection (h, context) {
  37990. hook.call(context)
  37991. return existing(h, context)
  37992. }
  37993. }
  37994. }
  37995. return {
  37996. esModule: esModule,
  37997. exports: scriptExports,
  37998. options: options
  37999. }
  38000. }
  38001. /***/ }),
  38002. /* 40 */
  38003. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  38004. "use strict";
  38005. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  38006. //
  38007. //
  38008. //
  38009. //
  38010. //
  38011. //
  38012. //
  38013. //
  38014. //
  38015. //
  38016. //
  38017. //
  38018. //
  38019. //
  38020. //
  38021. //
  38022. /* harmony default export */ __webpack_exports__["default"] = ({
  38023. mounted: function mounted() {
  38024. console.log('Component mounted.');
  38025. }
  38026. });
  38027. /***/ }),
  38028. /* 41 */
  38029. /***/ (function(module, exports, __webpack_require__) {
  38030. var render = function() {
  38031. var _vm = this
  38032. var _h = _vm.$createElement
  38033. var _c = _vm._self._c || _h
  38034. return _vm._m(0)
  38035. }
  38036. var staticRenderFns = [
  38037. function() {
  38038. var _vm = this
  38039. var _h = _vm.$createElement
  38040. var _c = _vm._self._c || _h
  38041. return _c("div", { staticClass: "container" }, [
  38042. _c("div", { staticClass: "row" }, [
  38043. _c("div", { staticClass: "col-md-8 col-md-offset-2" }, [
  38044. _c("div", { staticClass: "panel panel-default" }, [
  38045. _c("div", { staticClass: "panel-heading" }, [
  38046. _vm._v("Example Component")
  38047. ]),
  38048. _vm._v(" "),
  38049. _c("div", { staticClass: "panel-body" }, [
  38050. _vm._v(
  38051. "\n I'm an example component!\n "
  38052. )
  38053. ])
  38054. ])
  38055. ])
  38056. ])
  38057. ])
  38058. }
  38059. ]
  38060. render._withStripped = true
  38061. module.exports = { render: render, staticRenderFns: staticRenderFns }
  38062. if (false) {
  38063. module.hot.accept()
  38064. if (module.hot.data) {
  38065. require("vue-hot-reload-api") .rerender("data-v-b6ebd97a", module.exports)
  38066. }
  38067. }
  38068. /***/ }),
  38069. /* 42 */
  38070. /***/ (function(module, exports) {
  38071. // removed by extract-text-webpack-plugin
  38072. /***/ })
  38073. /******/ ]);